From c0855147dfbd3af869ad2ed11841a1b7485ec454 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 9 Dec 2005 20:14:52 +0000 Subject: [PATCH] * src/Report.py (parse_target_frame): Remove unneeded check; when checking existing file/dir, make sure we requested file/dir, correspondingly. * src/plugins/NavWebPage (archive_toggle): Add/remove '.tar.gz' to path when this options is turned on/off. svn: r5520 --- gramps2/ChangeLog | 7 +++++++ gramps2/src/Report.py | 18 +++++++----------- gramps2/src/plugins/NavWebPage.py | 12 ++++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 640b41b88..ed0306b46 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,10 @@ +2005-12-09 Alex Roitman + * src/Report.py (parse_target_frame): Remove unneeded check; when + checking existing file/dir, make sure we requested file/dir, + correspondingly. + * src/plugins/NavWebPage (archive_toggle): Add/remove '.tar.gz' + to path when this options is turned on/off. + 2005-12-08 Don Allingham * src/Merge.py: fix date comparison * src/Utils.py: add xml:lang generation function diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index 66ae7a555..cec58f21f 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -1412,15 +1412,10 @@ class ReportDialog(BareReportDialog): # First we check whether the selected path exists if os.path.exists(self.target_path): - # selected path is an existing dir - if os.path.isdir(self.target_path): - # check whether we asked for a dir - if not self.get_target_is_directory(): - ErrorDialog(_("Invalid file name"), - _("The filename that you gave is a " - "directory.\n" - "You need to provide a valid filename.")) - return None + # selected path is an existing dir and we need a dir + if os.path.isdir(self.target_path) \ + and self.get_target_is_directory(): + # check whether the dir has rwx permissions if not os.access(self.target_path,os.R_OK|os.W_OK|os.X_OK): ErrorDialog(_('Permission problem'), @@ -1431,8 +1426,9 @@ class ReportDialog(BareReportDialog): ) return None - # selected path is an exsting file - if os.path.isfile(self.target_path): + # selected path is an exsting file and we need a file + if os.path.isfile(self.target_path) \ + and not self.get_target_is_directory(): a = OptionDialog(_('File already exists'), _('You can choose to either overwrite the ' 'file, or change the selected filename.'), diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index c1a219e12..962c0e0ee 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -2639,11 +2639,23 @@ class WebReportDialog(Report.ReportDialog): def archive_toggle(self,obj): if obj.get_active(): + # The .tar.gz box is on + # Set doc label, mark file vs dir, add '.tar.gz' to the path self.target_fileentry.set_directory_entry(False) self.doc_label.set_label("%s:" % _("Filename")) + fname = self.target_fileentry.get_full_path(0) + if fname[-7:] != '.tar.gz': + fname = fname + '.tar.gz' + self.target_fileentry.set_filename(fname) else: + # The .tar.gz box is off + # Set doc label, mark dir vs file, remove '.tar.gz' from path self.target_fileentry.set_directory_entry(True) self.doc_label.set_label("%s:" % _("Directory")) + fname = self.target_fileentry.get_full_path(0) + if fname[-7:] == '.tar.gz': + fname = fname[:-7] + self.target_fileentry.set_filename(fname) def setup_paper_frame(self): pass