diff --git a/ChangeLog b/ChangeLog index 3879fc448..8840239ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,11 @@ * various: Merge REP_OPT branch with HEAD. + * src/Plugins.py: Use category to register cl report. + * src/Report.py: Handle showing options centrally. + * src/gramps_main.py: Remove name and category from options. + * src/plugins/BookReport.py: Handle showing options centrally. + 2004-12-20 Alex Roitman * src/ArgHandler.py: Single out Book by category. * src/Plugins.py: Use category to register cl report. diff --git a/src/Plugins.py b/src/Plugins.py index e00df07e4..62f3ad802 100644 --- a/src/Plugins.py +++ b/src/Plugins.py @@ -574,7 +574,7 @@ def register_report( (junk,standalone_task) = divmod(modes,2**Report.MODE_GUI) if standalone_task: _register_standalone(report_class,options_class,translated_name, - category,description, + name,category,description, status,author_name,author_email) (junk,book_item_task) = divmod(modes-standalone_task,2**Report.MODE_BKI) @@ -588,8 +588,8 @@ def register_report( if command_line_task: _register_cl_report(name,category,report_class,options_class) -def _register_standalone(report_class, options_class, name, - category=_("Uncategorized"), +def _register_standalone(report_class, options_class, translated_name, + name, category, description=_unavailable, status=_("Unknown"), author_name=_("Unknown"), @@ -604,7 +604,7 @@ def _register_standalone(report_class, options_class, name, del_index = i if del_index != -1: del _reports[del_index] - _reports.append((report_class, options_class, + _reports.append((report_class, options_class, translated_name, category, name, description, status, author_name, author_email)) def _register_book_item(translated_name,category,report_class,option_class,name): @@ -744,13 +744,16 @@ def build_report_menu(top_menu,callback): hash_data = {} for report in _reports: - standalone_category = const.standalone_categories[report[2]] + standalone_category = const.standalone_categories[report[3]] if hash_data.has_key(standalone_category): hash_data[standalone_category].append( - (report[3],report[0],report[1],report[2])) + (report[0],report[1],report[2],report[4],report[3])) else: hash_data[standalone_category] = [ - (report[3],report[0],report[1],report[2])] + (report[0],report[1],report[2],report[4],report[3])] + +# 0 1 2 3 4 +#report_class, options_class, translated_name, name, category, catlist = hash_data.keys() catlist.sort() @@ -764,9 +767,9 @@ def build_report_menu(top_menu,callback): lst = hash_data[key] lst.sort() for name in lst: - subentry = gtk.MenuItem("%s..." % name[0]) + subentry = gtk.MenuItem("%s..." % name[2]) subentry.show() - subentry.connect("activate",callback,Report.report,name[1],name[2],name[3],name[0]) + subentry.connect("activate",callback,Report.report,name[0],name[1],name[2],name[3],name[4]) submenu.append(subentry) top_menu.set_submenu(report_menu) diff --git a/src/Report.py b/src/Report.py index 6e60cc8cd..2e2bded23 100644 --- a/src/Report.py +++ b/src/Report.py @@ -199,7 +199,7 @@ class BareReportDialog: frame_pad = 5 border_pad = 6 - def __init__(self,database,person,option_class,name): + def __init__(self,database,person,option_class,name,translated_name): """Initialize a dialog to request that the user select options for a basic *bare* report.""" @@ -209,7 +209,7 @@ class BareReportDialog: self.options = option_class(name) elif type(option_class) == InstanceType: self.options = option_class - self.report_name = name + self.report_name = translated_name self.init_interface() def init_interface(self): @@ -813,12 +813,12 @@ class ReportDialog(BareReportDialog): dialog for a stand-alone report. """ - def __init__(self,database,person,option_class,name=''): + def __init__(self,database,person,option_class,name,translated_name): """Initialize a dialog to request that the user select options for a basic *stand-alone* report.""" self.style_name = "default" - BareReportDialog.__init__(self,database,person,option_class,name) + BareReportDialog.__init__(self,database,person,option_class,name,translated_name) # Allow for post processing of the format frame, since the # show_all task calls events that may reset values @@ -1333,12 +1333,12 @@ class ReportDialog(BareReportDialog): class TextReportDialog(ReportDialog): """A class of ReportDialog customized for text based reports.""" - def __init__(self,database,person,options,name=''): + def __init__(self,database,person,options,name,translated_name): """Initialize a dialog to request that the user select options for a basic text report. See the ReportDialog class for more information.""" self.category = const.CATEGORY_TEXT - ReportDialog.__init__(self,database,person,options,name) + ReportDialog.__init__(self,database,person,options,name,translated_name) #------------------------------------------------------------------------ # @@ -1379,12 +1379,12 @@ class TextReportDialog(ReportDialog): class DrawReportDialog(ReportDialog): """A class of ReportDialog customized for drawing based reports.""" - def __init__(self,database,person,opt,name=''): + def __init__(self,database,person,opt,name,translated_name): """Initialize a dialog to request that the user select options for a basic drawing report. See the ReportDialog class for more information.""" self.category = const.CATEGORY_DRAW - ReportDialog.__init__(self,database,person,opt,name) + ReportDialog.__init__(self,database,person,opt,name,translated_name) #------------------------------------------------------------------------ # @@ -1635,7 +1635,7 @@ class CommandLineReport: # #------------------------------------------------------------------------ # Standalone GUI report generic task -def report(database,person,report_class,options_class,category,name): +def report(database,person,report_class,options_class,translated_name,name,category): """ report - task starts the report. The plugin system requires that the task be in the format of task that takes a database and a person as @@ -1652,7 +1652,7 @@ def report(database,person,report_class,options_class,category,name): else: dialog_class = ReportDialog - dialog = dialog_class(database,person,options_class,name) + dialog = dialog_class(database,person,options_class,name,translated_name) response = dialog.window.run() if response == True: try: diff --git a/src/gramps_main.py b/src/gramps_main.py index 63f86ce73..c38d4a406 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -1691,10 +1691,10 @@ class Gramps: def on_preferences_activate(self,obj): GrampsCfg.display_preferences_box(self.db) - def menu_report(self,obj,task,report_class,options_class,category,name): + def menu_report(self,obj,task,report_class,options_class,translated_name,name,category): """Call the report plugin selected from the menus""" if self.active_person: - task(self.db,self.active_person,report_class,options_class,category,name) + task(self.db,self.active_person,report_class,options_class,translated_name,name,category) def menu_tools(self,obj,task): """Call the tool plugin selected from the menus""" diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index 2f4f0dd8b..43267262c 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -100,6 +100,7 @@ class BookItem: self.style_file = "" self.style_name = "default" self.make_default_style = None + self.item_name = "" def get_registered_item(self,name): """ @@ -773,7 +774,7 @@ class BookReportSelector: row = self.bk_model.get_selected_row() item = self.book.get_item(row) option_class = item.option_class - item_dialog = BookItemDialog(self.db,option_class,data[0]) + item_dialog = BookItemDialog(self.db,option_class,item.item_name,data[0]) response = item_dialog.window.run() if response == True and item_dialog.person and data[1] != _("Title"): self.bk_model.model.set_value(iter,2, @@ -906,13 +907,13 @@ class BookItemDialog(Report.BareReportDialog): in a way specific for this report. This is a book item dialog. """ - def __init__(self,database,option_class,name=''): + def __init__(self,database,option_class,name,translated_name): self.database = database self.option_class = option_class self.person = self.database.get_person_from_gramps_id(self.option_class.handler.get_person_id()) self.new_person = None - Report.BareReportDialog.__init__(self,database,self.person,option_class,name) + Report.BareReportDialog.__init__(self,database,self.person,option_class,name,translated_name) def on_ok_clicked(self, obj): """The user is satisfied with the dialog choices. Parse all options @@ -943,7 +944,8 @@ class BookReportDialog(Report.ReportDialog): def __init__(self,database,person,book,options): self.options = options - Report.BareReportDialog.__init__(self,database,person,options,'book') + Report.BareReportDialog.__init__(self,database,person,options, + 'book',_("Book Report")) self.book = book self.database = database self.person = person