You Are Here:

Community: Developer Discussion Boards

#1 Old File Path???? - 2009-06-20, 04:15

Join Date: Jan 2009
Posts: 71
programer_asal
Offline
Regular Contributor
Is there any function or method let me when i click the file from the list it give me the path for that file???
thanks
Last edited by programer_asal : 2009-06-20 at 06:00.
Reply With Quote

#2 Old Re: File Path???? - 2009-06-20, 08:15

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Online
Forum Nokia Champion
What list?
Reply With Quote

#3 Old Re: File Path???? - 2009-06-20, 10:49

Join Date: Jan 2009
Posts: 71
programer_asal
Offline
Regular Contributor
This type of list
appuifw.Listbox
thanks
Reply With Quote

#4 Old Re: File Path???? - 2009-06-20, 10:51

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Online
Forum Nokia Champion
And what does this list contain? You can't expect us to help you if you don't describe the situation with as many details as possible...
Reply With Quote

#5 Old Re: File Path???? - 2009-06-20, 10:56

Join Date: Jan 2009
Posts: 71
programer_asal
Offline
Regular Contributor
Sorry for that the idea is that am trying to let the user to browse for file and after selecting that file I pass the path of it to the send function to send that file by Bluetooth is it clear now or should I describe more?sorry again and thank you
Reply With Quote

#6 Old Re: File Path???? - 2009-06-20, 10:59

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Online
Forum Nokia Champion
OK. So the list contains the names of the files, right?

Could you show us the code you used?
Reply With Quote

#7 Old Re: File Path???? - 2009-06-20, 11:58

Join Date: Jan 2009
Posts: 71
programer_asal
Offline
Regular Contributor
Code:
import os
import appuifw
import e32
import dir_iter

class Filebrowser:
    def __init__(self):
        self.script_lock = e32.Ao_lock()
        self.dir_stack = []
        self.current_dir = dir_iter.Directory_iter(e32.drive_list())

    def run(self):
        from key_codes import EKeyLeftArrow
        entries = self.current_dir.list_repr()
        if not self.current_dir.at_root:
            entries.insert(0, (u"..", u""))
        self.lb = appuifw.Listbox(entries, self.lbox_observe)
        self.lb.bind(EKeyLeftArrow, lambda: self.lbox_observe(0))
        old_title = appuifw.app.title
        self.refresh()
        self.script_lock.wait()
        appuifw.app.title = old_title
        appuifw.app.body = None
        self.lb = None

    def refresh(self):
        appuifw.app.title = u"File browser"
        appuifw.app.menu = []
        appuifw.app.exit_key_handler = self.exit_key_handler
        appuifw.app.body = self.lb

    def do_exit(self):
        self.exit_key_handler()

    def exit_key_handler(self):
        appuifw.app.exit_key_handler = None
        self.script_lock.signal()

    def lbox_observe(self, ind = None):
        if not ind == None:
            index = ind
        else:
            index = self.lb.current()
        focused_item = 0

        if self.current_dir.at_root:
            self.dir_stack.append(index)
            self.current_dir.add(index)
        elif index == 0:                              # ".." selected
            focused_item = self.dir_stack.pop()
            self.current_dir.pop()
        elif os.path.isdir(self.current_dir.entry(index-1)):
            self.dir_stack.append(index)
            self.current_dir.add(index-1)
        else:
            item = self.current_dir.entry(index-1)
            if os.path.splitext(item)[1] == '.py':
                i = appuifw.popup_menu([u"execfile()", u"Delete"])
            else:
                i = appuifw.app.menu = [(u"Send",Send(item)]
           


        entries = self.current_dir.list_repr()
        if not self.current_dir.at_root:
            entries.insert(0, (u"..", u""))
        self.lb.set_list(entries, focused_item)



def Send(item):
    from socket import *
    import appuifw
    import e32
    addr,services=bt_obex_discover()
    print "Discovered: %s, %s"%(addr,services)
    if len(services)>0:
        choices=services.keys()
        choices.sort()
        choice=appuifw.popup_menu([unicode(services[x])+": "+x 
                               for x in choices],u'Choose port:')
        port=services[choices[choice]]
    else:
       port=services[services.keys()[0]]
    address=(addr,port)
    

    #print "Sending file %s to host %s port %s"%(send_path, address[0], address[1])
    bt_obex_send_file(address[0], address[1], item)
    print "File sent."



    






if __name__ == '__main__':
    Filebrowser().run()


I wish that it is ok right now am really very sorry for that
about the problem when executing this code said that socket.error2,'No such file or directory')
and the file didnot sent

thank you very much and sorry for annoying
Last edited by programer_asal : 2009-06-20 at 13:17.
Reply With Quote

#8 Old Re: File Path???? - 2009-06-20, 12:06

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Online
Forum Nokia Champion
Please edit your post and use the code tags (after you click on the Edit/Delete Message button, click on the Go Advanced button. In the editor that shows up, delete all the code you posted and post it again, exactly as it is in your script. Then select the code and press the button with the # symbol on it). This will maintain the code indentation and make it a lot easier to read.

Another important thing: exactly what problem are you facing? Does the code give errors? Is there something you want to do but don't know how (if so, what?)?
Reply With Quote

#9 Old Re: File Path???? - 2009-06-20, 13:22

Join Date: Jan 2009
Posts: 71
programer_asal
Offline
Regular Contributor
I have edited the last post

what I wnat to do exactly is browsing for a file and then sending it I tried alot and I have edited the code a lot but with no benefit
thank you Mr.bogdan.galiceanu a lot and sorry alot for the unordered post
Reply With Quote

#10 Old Re: File Path???? - 2009-06-20, 13:50

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Online
Forum Nokia Champion
The line
Code:
i = appuifw.app.menu = [(u"Send",Send(item)]
gives a syntax error because you forgot to close the tuple's bracket. So change it to
Code:
i = appuifw.app.menu = [(u"Send",Send(item))]
Reply With Quote

#11 Old Re: File Path???? - 2009-06-20, 14:03

Join Date: Jan 2009
Posts: 71
programer_asal
Offline
Regular Contributor
Sorry Mr.bogdan.galiceanu
but still the same problem!
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding BMCONV sanah007 General Symbian C++ 2 2009-05-26 13:47
[split] mbm build error mando222 Symbian Tools & SDKs 1 2009-03-29 13:32
File Path problem SingerSinger Symbian Tools & SDKs 1 2008-11-30 08:22
sound file path symbians60 Symbian Media (Graphics & Sounds) 1 2007-09-10 14:30
Help needed with a 3gp file... joedoe_1981 Streaming and Video 0 2007-07-18 19:58

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia