2006-12-31 Don Allingham <don@gramps-project.org>

* 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
This commit is contained in:
Don Allingham 2006-12-31 23:56:14 +00:00
parent bcefe6c7d7
commit 5493631d19
4 changed files with 54 additions and 30 deletions

View File

@ -1,3 +1,8 @@
2006-12-31 Don Allingham <don@gramps-project.org>
* 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 <don@gramps-project.org> 2006-12-30 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: Map to existing places if possible * src/GrampsDb/_ReadGedcom.py: Map to existing places if possible
* src/Merge/_MergePerson.py: Merge identical names * src/Merge/_MergePerson.py: Merge identical names

View File

@ -70,6 +70,7 @@ class BareReportDialog(ManagedWindow.ManagedWindow):
frame_pad = 5 frame_pad = 5
border_pad = 6 border_pad = 6
HELP_TOPIC = None
def __init__(self,dbstate,uistate,person,option_class, def __init__(self,dbstate,uistate,person,option_class,
name,translated_name,track=[]): name,translated_name,track=[]):
@ -127,12 +128,17 @@ class BareReportDialog(ManagedWindow.ManagedWindow):
window = gtk.Dialog('GRAMPS') window = gtk.Dialog('GRAMPS')
self.set_window(window,None,self.get_title()) self.set_window(window,None,self.get_title())
self.window.set_has_separator(False) 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.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) self.window.set_default_size(600,-1)
# Set up and run the dialog. These calls are not in top down # 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): def on_cancel(self,*obj):
pass 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): def on_ok_clicked(self, obj):
"""The user is satisfied with the dialog choices. Parse all options """The user is satisfied with the dialog choices. Parse all options
and close the window.""" and close the window."""

View File

@ -646,26 +646,29 @@ def report(dbstate,uistate,person,report_class,options_class,
dialog_class = ReportDialog dialog_class = ReportDialog
dialog = dialog_class(dbstate,uistate,person,options_class,name,trans_name) dialog = dialog_class(dbstate,uistate,person,options_class,name,trans_name)
response = dialog.window.run()
if response == gtk.RESPONSE_OK: while True:
try: response = dialog.window.run()
MyReport = report_class(dialog.db,dialog.person,dialog.options) if response == gtk.RESPONSE_OK:
MyReport.doc.init() try:
MyReport.begin_report() MyReport = report_class(dialog.db,dialog.person,dialog.options)
MyReport.write_report() MyReport.doc.init()
MyReport.end_report() MyReport.begin_report()
except Errors.FilterError, msg: MyReport.write_report()
(m1,m2) = msg.messages() MyReport.end_report()
ErrorDialog(m1,m2) except Errors.FilterError, msg:
except IOError, msg: (m1,m2) = msg.messages()
ErrorDialog(_("Report could not be created"),str(msg)) ErrorDialog(m1,m2)
except Errors.ReportError, msg: except IOError, msg:
(m1,m2) = msg.messages() ErrorDialog(_("Report could not be created"),str(msg))
ErrorDialog(m1,m2) except Errors.ReportError, msg:
except Errors.DatabaseError,msg: (m1,m2) = msg.messages()
ErrorDialog(_("Report could not be created"),str(msg)) ErrorDialog(m1,m2)
except: except Errors.DatabaseError,msg:
log.error("Failed to run report.", exc_info=True) ErrorDialog(_("Report could not be created"),str(msg))
elif response == gtk.RESPONSE_DELETE_EVENT: except:
return log.error("Failed to run report.", exc_info=True)
break
elif response == gtk.RESPONSE_DELETE_EVENT or response == gtk.RESPONSE_CANCEL:
break
dialog.close() dialog.close()

View File

@ -2625,6 +2625,8 @@ class WebReportOptions(ReportOptions):
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class WebReportDialog(ReportDialog): class WebReportDialog(ReportDialog):
HELP_TOPIC = "rep-web"
def __init__(self,dbstate,uistate,person): def __init__(self,dbstate,uistate,person):
self.database = dbstate.db self.database = dbstate.db
self.person = person self.person = person
@ -2636,11 +2638,13 @@ class WebReportDialog(ReportDialog):
name,translated_name) name,translated_name)
self.style_name = None self.style_name = None
response = self.window.run() while True:
if response == gtk.RESPONSE_OK: response = self.window.run()
self.make_report() if response == gtk.RESPONSE_OK:
elif response == gtk.RESPONSE_DELETE_EVENT: self.make_report()
return break
elif response != gtk.RESPONSE_HELP:
break
self.close() self.close()
def setup_style_frame(self): def setup_style_frame(self):