From d72fce2c082c70ca27b864328d5d44baa6f12e75 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 31 Dec 2006 23:56:14 +0000 Subject: [PATCH] 2006-12-31 Don Allingham * src/ReportBase/_ReportDialog.py: add HELP button support * src/ReportBase/_BareReportDialog.py: add HELP button support * src/plugins/NarrativeWeb.py: add HELP button support svn: r7862 --- gramps2/ChangeLog | 5 +++ gramps2/src/ReportBase/_BareReportDialog.py | 18 ++++++-- gramps2/src/ReportBase/_ReportDialog.py | 47 +++++++++++---------- gramps2/src/plugins/NarrativeWeb.py | 14 +++--- 4 files changed, 54 insertions(+), 30 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 076ca0ecf..50ee9c205 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2006-12-31 Don Allingham + * src/ReportBase/_ReportDialog.py: add HELP button support + * src/ReportBase/_BareReportDialog.py: add HELP button support + * src/plugins/NarrativeWeb.py: add HELP button support + 2006-12-30 Don Allingham * src/GrampsDb/_ReadGedcom.py: Map to existing places if possible * src/Merge/_MergePerson.py: Merge identical names diff --git a/gramps2/src/ReportBase/_BareReportDialog.py b/gramps2/src/ReportBase/_BareReportDialog.py index bba5f6018..66a512a07 100644 --- a/gramps2/src/ReportBase/_BareReportDialog.py +++ b/gramps2/src/ReportBase/_BareReportDialog.py @@ -70,6 +70,7 @@ class BareReportDialog(ManagedWindow.ManagedWindow): frame_pad = 5 border_pad = 6 + HELP_TOPIC = None def __init__(self,dbstate,uistate,person,option_class, name,translated_name,track=[]): @@ -127,12 +128,17 @@ class BareReportDialog(ManagedWindow.ManagedWindow): window = gtk.Dialog('GRAMPS') self.set_window(window,None,self.get_title()) self.window.set_has_separator(False) - self.cancel = self.window.add_button(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL) - self.ok = self.window.add_button(gtk.STOCK_OK,gtk.RESPONSE_OK) - self.ok.connect('clicked',self.on_ok_clicked) + if self.HELP_TOPIC: + self.help = self.window.add_button(gtk.STOCK_HELP, gtk.RESPONSE_HELP) + self.help.connect('clicked',self.on_help_clicked) + + self.cancel = self.window.add_button(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL) self.cancel.connect('clicked',self.on_cancel) + self.ok = self.window.add_button(gtk.STOCK_OK,gtk.RESPONSE_OK) + self.ok.connect('clicked',self.on_ok_clicked) + self.window.set_default_size(600,-1) # Set up and run the dialog. These calls are not in top down @@ -641,6 +647,12 @@ class BareReportDialog(ManagedWindow.ManagedWindow): def on_cancel(self,*obj): pass + def on_help_clicked(self, *obj): + if self.HELP_TOPIC: + import GrampsDisplay + GrampsDisplay.help(self.HELP_TOPIC) + print "HELP CLICKED" + def on_ok_clicked(self, obj): """The user is satisfied with the dialog choices. Parse all options and close the window.""" diff --git a/gramps2/src/ReportBase/_ReportDialog.py b/gramps2/src/ReportBase/_ReportDialog.py index 88cd686f6..1b94d91f5 100644 --- a/gramps2/src/ReportBase/_ReportDialog.py +++ b/gramps2/src/ReportBase/_ReportDialog.py @@ -646,26 +646,29 @@ def report(dbstate,uistate,person,report_class,options_class, dialog_class = ReportDialog dialog = dialog_class(dbstate,uistate,person,options_class,name,trans_name) - response = dialog.window.run() - if response == gtk.RESPONSE_OK: - try: - MyReport = report_class(dialog.db,dialog.person,dialog.options) - MyReport.doc.init() - MyReport.begin_report() - MyReport.write_report() - MyReport.end_report() - except Errors.FilterError, msg: - (m1,m2) = msg.messages() - ErrorDialog(m1,m2) - except IOError, msg: - ErrorDialog(_("Report could not be created"),str(msg)) - except Errors.ReportError, msg: - (m1,m2) = msg.messages() - ErrorDialog(m1,m2) - except Errors.DatabaseError,msg: - ErrorDialog(_("Report could not be created"),str(msg)) - except: - log.error("Failed to run report.", exc_info=True) - elif response == gtk.RESPONSE_DELETE_EVENT: - return + + while True: + response = dialog.window.run() + if response == gtk.RESPONSE_OK: + try: + MyReport = report_class(dialog.db,dialog.person,dialog.options) + MyReport.doc.init() + MyReport.begin_report() + MyReport.write_report() + MyReport.end_report() + except Errors.FilterError, msg: + (m1,m2) = msg.messages() + ErrorDialog(m1,m2) + except IOError, msg: + ErrorDialog(_("Report could not be created"),str(msg)) + except Errors.ReportError, msg: + (m1,m2) = msg.messages() + ErrorDialog(m1,m2) + except Errors.DatabaseError,msg: + ErrorDialog(_("Report could not be created"),str(msg)) + except: + log.error("Failed to run report.", exc_info=True) + break + elif response == gtk.RESPONSE_DELETE_EVENT or response == gtk.RESPONSE_CANCEL: + break dialog.close() diff --git a/gramps2/src/plugins/NarrativeWeb.py b/gramps2/src/plugins/NarrativeWeb.py index 41aed38c6..f3be2e35c 100644 --- a/gramps2/src/plugins/NarrativeWeb.py +++ b/gramps2/src/plugins/NarrativeWeb.py @@ -2625,6 +2625,8 @@ class WebReportOptions(ReportOptions): #------------------------------------------------------------------------ class WebReportDialog(ReportDialog): + HELP_TOPIC = "rep-web" + def __init__(self,dbstate,uistate,person): self.database = dbstate.db self.person = person @@ -2636,11 +2638,13 @@ class WebReportDialog(ReportDialog): name,translated_name) self.style_name = None - response = self.window.run() - if response == gtk.RESPONSE_OK: - self.make_report() - elif response == gtk.RESPONSE_DELETE_EVENT: - return + while True: + response = self.window.run() + if response == gtk.RESPONSE_OK: + self.make_report() + break + elif response != gtk.RESPONSE_HELP: + break self.close() def setup_style_frame(self):