On Mon, Mar 3, 2008 at 11:14 PM, Erik Blankinship <[EMAIL PROTECTED]> wrote: > > On 2/29/08, Erik Blankinship <[EMAIL PROTECTED]> wrote: > > > Is there a way to filter the mime types of the objects presented with an > object chooser (e.g., only png)? Here is some sample code I am using: > > > > > > import gtk > > > import shutil > > > from sugar.graphics.objectchooser import ObjectChooser > > > > > > class FilePicker: > > > > > > def __init__(self): > > > pass > > > > > > def show(self): > > > title = None > > > parent = None > > > file = None > > > chooser = ObjectChooser(title, parent, gtk.DIALOG_MODAL | > gtk.DIALOG_DESTROY_WITH_PARENT) > > > try: > > > result = chooser.run() > > > if result == gtk.RESPONSE_ACCEPT: > > > jobject = chooser.get_selected_object() > > > if jobject and jobject.file_path: > > > ext = os.path.splitext(jobject.file_path)[1] > > > f, new_temp = tempfile.mkstemp(ext) > > > del f > > > > > > global _temp_files_to_clean > > > _temp_files_to_clean.append(new_temp) > > > shutil.copy(jobject.file_path, new_temp) > > > > > > file = new_temp > > > finally: > > > chooser.destroy() > > > del chooser > > > > > > return file > > > > > > > > > Unfortunately, this code (and the identical code in the Browse activity) > when run in jhbuild always returns this path: "." > > > > Is this expected behavior? Is this problem unique to jhbuild? Is there > something I should to differently? > > > Trying a few different objects reveals that I can pick Write files (.odt) > and Image files (.png), but not Video files (.ogg) -- those come back as "."
Any info in the logs? Just tried in jhbuild from Abiword with an ogg file, and it got this file path: /home/tomeu/.sugar/default/data/fc7be60e-de25-494c-ad48-b9d5c5629ca8(1) Tomeu _______________________________________________ Sugar mailing list [email protected] http://lists.laptop.org/listinfo/sugar

