From f05004329ec8daa669ceee26c02e2666bd4e5a1d Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 24 Jan 2005 23:39:50 +0000 Subject: [PATCH] * src/Report.py (BareReportDialog.init_interface): Set up buttons with proper response values; (report): Ignore everything except RESPONSE_OK. * src/plugins/BookReport.py (BookReportSelector.on_setup_clicked, BookReportDialog.__init__): Ignore everything except RESPONSE_OK. svn: r3956 --- gramps2/ChangeLog | 6 ++++ gramps2/src/Report.py | 48 ++++++++++++------------------- gramps2/src/plugins/BookReport.py | 5 ++-- 3 files changed, 27 insertions(+), 32 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 4d999c3c1..a3486404c 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -19,6 +19,12 @@ * src/StyleEditor.py (draw,save_paragraph): Swap SERIF and SANS_SERIF. + * src/Report.py (BareReportDialog.init_interface): Set up buttons + with proper response values; (report): Ignore everything except + RESPONSE_OK. + * src/plugins/BookReport.py (BookReportSelector.on_setup_clicked, + BookReportDialog.__init__): Ignore everything except RESPONSE_OK. + 2005-01-23 Don Allingham * src/BaseDoc.py: don't check for init on table or cell addition * src/Report.py: Call doc.init() before write_report diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index ed3e580a5..debd9123a 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -342,14 +342,12 @@ class BareReportDialog: self.window = gtk.Dialog('GRAMPS') self.window.set_has_separator(gtk.FALSE) - self.cancel = self.window.add_button(gtk.STOCK_CANCEL,False) - self.ok = self.window.add_button(gtk.STOCK_OK,True) + 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) self.cancel.connect('clicked',self.on_cancel) -# self.window.set_response_sensitive(0,gtk.TRUE) -# self.window.set_response_sensitive(1,gtk.TRUE) self.window.set_resize_mode(0) # Set up and run the dialog. These calls are not in top down @@ -1387,7 +1385,6 @@ class ReportDialog(BareReportDialog): model = self.template_combo.get_model() text = unicode(model[self.template_combo.get_active()][0]) - #text = unicode(self.template_combo.entry.get_text()) if _template_map.has_key(text): if text == _user_template: @@ -1419,19 +1416,14 @@ class ReportDialog(BareReportDialog): # Create the output document. self.make_document() -# # Create the report object and product the report. -# try: -# self.make_report() -# except (IOError,OSError),msg: -# ErrorDialog(str(msg)) - # Save options self.options.handler.save_options() - # Clean up the dialog object - #self.window.destroy() - - +#----------------------------------------------------------------------- +# +# Textual reports +# +#----------------------------------------------------------------------- class TextReportDialog(ReportDialog): """A class of ReportDialog customized for text based reports.""" @@ -1466,20 +1458,11 @@ class TextReportDialog(ReportDialog): self.format_menu.set(self.doc_uses_tables(), self.doc_type_changed, None, active) - #------------------------------------------------------------------------ - # - # Functions related to creating the actual report document. - # - #------------------------------------------------------------------------ -# def make_report(self): -# """Create the contents of the report. This is a simple -# default implementation suitable for testing. Is should be -# overridden to produce a real report.""" -# self.doc.start_paragraph("Title") -# title = "Basic Report for %s" % self.name -# self.doc.write_text(title) -# self.doc.end_paragraph() - +#----------------------------------------------------------------------- +# +# Drawing reports +# +#----------------------------------------------------------------------- class DrawReportDialog(ReportDialog): """A class of ReportDialog customized for drawing based reports.""" def __init__(self,database,person,opt,name,translated_name): @@ -1501,6 +1484,11 @@ class DrawReportDialog(ReportDialog): self.format_menu.set(False,self.doc_type_changed, None, active) +#----------------------------------------------------------------------- +# +# Parser for templates file +# +#----------------------------------------------------------------------- class TemplateParser(handler.ContentHandler): """ Interface to the document template file @@ -1769,7 +1757,7 @@ def report(database,person,report_class,options_class,translated_name,name,categ dialog = dialog_class(database,person,options_class,name,translated_name) response = dialog.window.run() - if response: + if response == gtk.RESPONSE_OK: try: MyReport = report_class(dialog.db,dialog.person,dialog.options) MyReport.doc.init() diff --git a/gramps2/src/plugins/BookReport.py b/gramps2/src/plugins/BookReport.py index c2897680b..24bab3783 100644 --- a/gramps2/src/plugins/BookReport.py +++ b/gramps2/src/plugins/BookReport.py @@ -46,6 +46,7 @@ except: # GTK/Gnome modules # #------------------------------------------------------------------------- +from gtk import RESPONSE_OK import gtk.glade #------------------------------------------------------------------------- @@ -785,7 +786,7 @@ class BookReportSelector: item_dialog = BookItemDialog(self.db,option_class,item.get_name(), item.get_translated_name()) response = item_dialog.window.run() - if response == True and item_dialog.person and data[1] != _("Title"): + if response == RESPONSE_OK and item_dialog.person and data[1] != _("Title"): self.bk_model.model.set_value(the_iter,2, item_dialog.person.get_primary_name().get_regular_name()) self.book.set_item(row,item) @@ -980,7 +981,7 @@ class BookReportDialog(Report.ReportDialog): this_style_name,style_sheet.get_style(this_style_name)) response = self.window.run() - if response == True: + if response == RESPONSE_OK: try: self.make_report() except (IOError,OSError),msg: