From f357f5e6073c0630b28424f605c2c1fb65690516 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 7 Dec 2005 18:37:24 +0000 Subject: [PATCH] * src/Report.py: change from gtk.FILE_CHOOSER_CREATE_FOLDER to gtl.FILE_CHOOSER_SELECT_FOLDER. GTK documentation error. svn: r5499 --- gramps2/ChangeLog | 2 ++ gramps2/src/Report.py | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index b6b806c5a..bc1c6be7f 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -7,6 +7,8 @@ slashes to prevent collision with the ISO format. 2005-12-07 Don Allingham + * src/Report.py: change from gtk.FILE_CHOOSER_CREATE_FOLDER to + gtl.FILE_CHOOSER_SELECT_FOLDER. GTK documentation error. * src/plugins/NavWebPage.py: restore .tar.gz archive option 2005-12-07 Jérôme Rapinat diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index 1e7e1a536..9ec779201 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -62,14 +62,26 @@ class FileEntry(gtk.HBox): self.pack_end(self.button,False,False) def select_file(self,obj): + if self.dir: + my_action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER + else: + my_action = gtk.FILE_CHOOSER_ACTION_SAVE + f = gtk.FileChooserDialog(self.title, - action=gtk.FILE_CHOOSER_ACTION_SAVE, + action=my_action, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) - f.set_current_name(os.path.basename(self.entry.get_text())) + name = os.path.basename(self.entry.get_text()) + if self.dir: + if os.path.isdir(name): + f.set_current_name(name) + elif os.path.isdir(os.path.basename(name)): + f.set_current_name(os.path.basename(name)) + else: + f.set_current_name(name) f.set_current_folder(self.spath) status = f.run() if status == gtk.RESPONSE_OK: @@ -93,7 +105,7 @@ class FileEntry(gtk.HBox): return self.entry.get_text() def set_directory_entry(self,opt): - self.dir = False + self.dir = opt