From 4e1f1222722c6e88f073d801cff30f53869ad78d Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 12 Jan 2005 03:29:02 +0000 Subject: [PATCH] * src/Report.py: Switch to using short format names. Fix templates. * src/Plugins.py: Switch to using short format names. * src/PluginMgr.py: Switch to using short format names. * src/ReportOptions.py: Switch to using short format names. svn: r3905 --- ChangeLog | 5 +++++ src/PluginMgr.py | 2 +- src/Plugins.py | 16 +++++++++++++--- src/Report.py | 35 ++++++++++++++++++++++++++--------- src/ReportOptions.py | 2 +- 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c3a83a4a..8cd21e06d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,11 @@ * src/plugins/GraphViz.py: Support for graphical report if dot was found on the system. + * src/Report.py: Switch to using short format names. Fix templates. + * src/Plugins.py: Switch to using short format names. + * src/PluginMgr.py: Switch to using short format names. + * src/ReportOptions.py: Switch to using short format names. + 2005-01-10 Martin Hawlisch * src/EditPlace.py (EditPlace.display_references): Fix event and object references. diff --git a/src/PluginMgr.py b/src/PluginMgr.py index b032c5801..ae7787a33 100644 --- a/src/PluginMgr.py +++ b/src/PluginMgr.py @@ -283,7 +283,7 @@ def register_book_doc(name,classref, table, paper, style, ext, clname=''): return if not clname: clname = ext[1:] - bookdoc_list.append((name,classref,table,paper,style,ext,clname)) + bookdoc_list.append((name,classref,table,paper,style,ext,None,clname)) #------------------------------------------------------------------------- # diff --git a/src/Plugins.py b/src/Plugins.py index 1c870fa6a..1d3cea638 100644 --- a/src/Plugins.py +++ b/src/Plugins.py @@ -521,7 +521,7 @@ class GrampsTextFormatComboBox(gtk.ComboBox): self.store.append(row=[name]) #if callback: # menuitem.connect("activate",callback) - if name == active: + if item[7] == active: active_index = index elif not active and name == out_pref: active_index = index @@ -546,6 +546,9 @@ class GrampsTextFormatComboBox(gtk.ComboBox): def get_printable(self): return PluginMgr.textdoc_list[self.get_active()][6] + def get_clname(self): + return PluginMgr.textdoc_list[self.get_active()][7] + class GrampsDrawFormatComboBox(gtk.ComboBox): def set(self,tables,callback,obj=None,active=None): @@ -566,7 +569,7 @@ class GrampsDrawFormatComboBox(gtk.ComboBox): self.store.append(row=[name]) #if callback: # menuitem.connect("activate",callback) - if name == active: + if item[6] == active: active_index = index elif not active and name == out_pref: active_index = index @@ -591,6 +594,9 @@ class GrampsDrawFormatComboBox(gtk.ComboBox): def get_printable(self): return PluginMgr.drawdoc_list[self.get_active()][5] + def get_clname(self): + return PluginMgr.drawdoc_list[self.get_active()][6] + class GrampsBookFormatComboBox(gtk.ComboBox): def set(self,tables,callback,obj=None,active=None): @@ -611,7 +617,7 @@ class GrampsBookFormatComboBox(gtk.ComboBox): self.data.append(item) name = item[0] self.store.append(row=[name]) - if name == active: + if item[7] == active: active_index = index elif not active and name == out_pref: active_index = index @@ -633,6 +639,9 @@ class GrampsBookFormatComboBox(gtk.ComboBox): def get_printable(self): return self.data[self.get_active()][6] + def get_clname(self): + return self.data[self.get_active()][7] + #------------------------------------------------------------------------- # # reload_plugins @@ -697,6 +706,7 @@ def reload_plugins(obj=None,junk1=None,junk2=None,junk3=None): if GrampsKeys.get_pop_plugin_status() and len(PluginMgr.failmsg_list): PluginStatus() else: + global status_up status_up.close(None) status_up = None diff --git a/src/Report.py b/src/Report.py index c89eb33c1..0d32a784c 100644 --- a/src/Report.py +++ b/src/Report.py @@ -79,7 +79,7 @@ _default_template = _("Default Template") _user_template = _("User Defined Template") _template_map = { - _user_template : None + _user_template : "" } # Modes for generating reports @@ -441,7 +441,12 @@ class BareReportDialog: """Called to allow parsing of added widgets. It is called when OK is pressed in a dialog. All custom widgets should provide a parsing code here.""" - self.options.parse_user_options(self) + try: + self.options.parse_user_options(self) + except: + import DisplayTrace + DisplayTrace.DisplayTrace() + def add_option(self,label_text,widget,tooltip=None): """Takes a text string and a Gtk Widget, and stores them to be @@ -1246,13 +1251,19 @@ class ReportDialog(BareReportDialog): tlist = _template_map.keys() tlist.sort() + template_name = self.options.handler.get_template_name() + self.template_combo.append_text(_default_template) + template_index = 1 + active_index = 0 for template in tlist: if template != _user_template: self.template_combo.append_text(template) + if _template_map[template] == template_name: + active_index = template_index + template_idex = templatex_index + 1 self.template_combo.append_text(_user_template) - - self.template_combo.set_active(False) + self.template_combo.connect('changed',self.html_file_enable) self.html_table.attach(self.template_combo,2,3,1,2) @@ -1262,11 +1273,18 @@ class ReportDialog(BareReportDialog): self.html_fileentry = gnome.ui.FileEntry("HTML_Template", _("Choose File")) self.html_fileentry.set_modal(True) - self.html_fileentry.set_sensitive(False) - user_template = '' + if template_name and not active_index: + active_index = template_index + user_template = template_name + self.html_fileentry.set_sensitive(True) + else: + user_template = '' + self.html_fileentry.set_sensitive(False) + if os.path.isfile(user_template): self.html_fileentry.set_filename(user_template) self.html_table.attach(self.html_fileentry,2,3,2,3) + self.template_combo.set_active(active_index) #------------------------------------------------------------------------ @@ -1308,7 +1326,7 @@ class ReportDialog(BareReportDialog): """Parse the format frame of the dialog. Save the user selected output format for later use.""" self.format = self.format_menu.get_reference() - format_name = self.format_menu.get_label() + format_name = self.format_menu.get_clname() self.options.handler.set_format_name(format_name) def parse_paper_frame(self): @@ -1363,10 +1381,9 @@ class ReportDialog(BareReportDialog): else: self.template_name = "%s/%s" % (const.template_dir,_template_map[text]) else: - self.template_name = None + self.template_name = "" self.options.handler.set_template_name(self.template_name) - def on_ok_clicked(self, obj): """The user is satisfied with the dialog choices. Validate the output file name before doing anything else. If there is diff --git a/src/ReportOptions.py b/src/ReportOptions.py index b90193b32..0a9b6c778 100644 --- a/src/ReportOptions.py +++ b/src/ReportOptions.py @@ -191,7 +191,7 @@ class OptionListCollection: default_paper_name = GrampsKeys.get_paper_preference() default_template_name = "" default_orientation = BaseDoc.PAPER_PORTRAIT - default_format_name = _('Print...') + default_format_name = 'print' def __init__(self,filename=None): """