Active Topics

 


Reply
Thread Tools
HangLoose's Avatar
Posts: 319 | Thanked: 289 times | Joined on Sep 2009 @ Lisboa, Portugal
#1
Can someone point me to something like this?

I want to press a button, open a filen dialog that I can browse through directorios and select a file, then this would return the path of that file.

Also would be nice to know if I could filter, lets say just text files...

thanks
 
HangLoose's Avatar
Posts: 319 | Thanked: 289 times | Joined on Sep 2009 @ Lisboa, Portugal
#2
-bump-
anyone?!
-bump-
 
Posts: 547 | Thanked: 1,383 times | Joined on Sep 2009 @ Stockholm, Sweden
#3
I'm currently doing something like this (no idea if it's the *right* way to do it):

Code:
self.bAttachment = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL, "Attachment")
self.bAttachment.connect('clicked', self.open_file_dialog)
Code:
def open_file_dialog(self, button):
	#fsm = hildon.FileSystemModel()
	#fcd = hildon.FileChooserDialog(self.window, gtk.FILE_CHOOSER_ACTION_OPEN, fsm)
	# this shouldnt issue a warning according to the pymaemo mailing list, but does
	# anyway, nfc why :(
	fcd = gobject.new(hildon.FileChooserDialog, action=gtk.FILE_CHOOSER_ACTION_OPEN)
	fcd.set_default_response(gtk.RESPONSE_OK)
	ret = fcd.run()
	if ret == gtk.RESPONSE_OK:
		self.bAttachment.set_label(fcd.get_filename())
		self.update_size(fcd.get_filename())
		fcd.destroy()
	else:
		fcd.destroy()
Usually when I'm after some function like these I get one of the python apps from the repos and look through their source code, the beauty of open-source ;-)
__________________

Problem with fMMS? Run in x-terminal: cp /tmp/fmms.log /home/user/MyDocs/
After that you'll see fmms.log in filemanager or when you connect the device to your desktop as a mass storage device.
E-mail the log to me, if you don't have the email address, drop me a PM. Thanks!

fMMS - MMS for your N900
fAPN - GUI for adding a new GPRS APN
If you like this post, don't be shy to thank me -->
 

The Following 2 Users Say Thank You to frals For This Useful Post:
HangLoose's Avatar
Posts: 319 | Thanked: 289 times | Joined on Sep 2009 @ Lisboa, Portugal
#4
wow... double thanks for the tip dude.
ill try that out when i arrive home.
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:24.