| Reply | « Previous Thread | Next Thread » |
|
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.
|
| programer_asal |
| View Public Profile |
| Find all posts by programer_asal |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
What list?
|
|
This type of list
appuifw.Listbox thanks |
| programer_asal |
| View Public Profile |
| Find all posts by programer_asal |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
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...
|
|
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
|
| programer_asal |
| View Public Profile |
| Find all posts by programer_asal |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
OK. So the list contains the names of the files, right?
Could you show us the code you used? |
|
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.error 2,'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.
|
| programer_asal |
| View Public Profile |
| Find all posts by programer_asal |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
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?)? |
|
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 |
| programer_asal |
| View Public Profile |
| Find all posts by programer_asal |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
The line
Code:
i = appuifw.app.menu = [(u"Send",Send(item)] Code:
i = appuifw.app.menu = [(u"Send",Send(item))] |
|
Sorry Mr.bogdan.galiceanu
but still the same problem! |
| programer_asal |
| View Public Profile |
| Find all posts by programer_asal |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| 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 |