* 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
This commit is contained in:
Alex Roitman 2005-01-12 03:29:02 +00:00
parent 979ef1a6bc
commit 8f4bbbe0b1
5 changed files with 46 additions and 14 deletions

View File

@ -15,6 +15,11 @@
* src/plugins/GraphViz.py: Support for graphical report * src/plugins/GraphViz.py: Support for graphical report
if dot was found on the system. 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 <Martin.Hawlisch@gmx.de> 2005-01-10 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/EditPlace.py (EditPlace.display_references): * src/EditPlace.py (EditPlace.display_references):
Fix event and object references. Fix event and object references.

View File

@ -283,7 +283,7 @@ def register_book_doc(name,classref, table, paper, style, ext, clname=''):
return return
if not clname: if not clname:
clname = ext[1:] clname = ext[1:]
bookdoc_list.append((name,classref,table,paper,style,ext,clname)) bookdoc_list.append((name,classref,table,paper,style,ext,None,clname))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -521,7 +521,7 @@ class GrampsTextFormatComboBox(gtk.ComboBox):
self.store.append(row=[name]) self.store.append(row=[name])
#if callback: #if callback:
# menuitem.connect("activate",callback) # menuitem.connect("activate",callback)
if name == active: if item[7] == active:
active_index = index active_index = index
elif not active and name == out_pref: elif not active and name == out_pref:
active_index = index active_index = index
@ -546,6 +546,9 @@ class GrampsTextFormatComboBox(gtk.ComboBox):
def get_printable(self): def get_printable(self):
return PluginMgr.textdoc_list[self.get_active()][6] return PluginMgr.textdoc_list[self.get_active()][6]
def get_clname(self):
return PluginMgr.textdoc_list[self.get_active()][7]
class GrampsDrawFormatComboBox(gtk.ComboBox): class GrampsDrawFormatComboBox(gtk.ComboBox):
def set(self,tables,callback,obj=None,active=None): def set(self,tables,callback,obj=None,active=None):
@ -566,7 +569,7 @@ class GrampsDrawFormatComboBox(gtk.ComboBox):
self.store.append(row=[name]) self.store.append(row=[name])
#if callback: #if callback:
# menuitem.connect("activate",callback) # menuitem.connect("activate",callback)
if name == active: if item[6] == active:
active_index = index active_index = index
elif not active and name == out_pref: elif not active and name == out_pref:
active_index = index active_index = index
@ -591,6 +594,9 @@ class GrampsDrawFormatComboBox(gtk.ComboBox):
def get_printable(self): def get_printable(self):
return PluginMgr.drawdoc_list[self.get_active()][5] return PluginMgr.drawdoc_list[self.get_active()][5]
def get_clname(self):
return PluginMgr.drawdoc_list[self.get_active()][6]
class GrampsBookFormatComboBox(gtk.ComboBox): class GrampsBookFormatComboBox(gtk.ComboBox):
def set(self,tables,callback,obj=None,active=None): def set(self,tables,callback,obj=None,active=None):
@ -611,7 +617,7 @@ class GrampsBookFormatComboBox(gtk.ComboBox):
self.data.append(item) self.data.append(item)
name = item[0] name = item[0]
self.store.append(row=[name]) self.store.append(row=[name])
if name == active: if item[7] == active:
active_index = index active_index = index
elif not active and name == out_pref: elif not active and name == out_pref:
active_index = index active_index = index
@ -633,6 +639,9 @@ class GrampsBookFormatComboBox(gtk.ComboBox):
def get_printable(self): def get_printable(self):
return self.data[self.get_active()][6] return self.data[self.get_active()][6]
def get_clname(self):
return self.data[self.get_active()][7]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# reload_plugins # 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): if GrampsKeys.get_pop_plugin_status() and len(PluginMgr.failmsg_list):
PluginStatus() PluginStatus()
else: else:
global status_up
status_up.close(None) status_up.close(None)
status_up = None status_up = None

View File

@ -79,7 +79,7 @@ _default_template = _("Default Template")
_user_template = _("User Defined Template") _user_template = _("User Defined Template")
_template_map = { _template_map = {
_user_template : None _user_template : ""
} }
# Modes for generating reports # Modes for generating reports
@ -441,7 +441,12 @@ class BareReportDialog:
"""Called to allow parsing of added widgets. """Called to allow parsing of added widgets.
It is called when OK is pressed in a dialog. It is called when OK is pressed in a dialog.
All custom widgets should provide a parsing code here.""" 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): def add_option(self,label_text,widget,tooltip=None):
"""Takes a text string and a Gtk Widget, and stores them to be """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 = _template_map.keys()
tlist.sort() tlist.sort()
template_name = self.options.handler.get_template_name()
self.template_combo.append_text(_default_template) self.template_combo.append_text(_default_template)
template_index = 1
active_index = 0
for template in tlist: for template in tlist:
if template != _user_template: if template != _user_template:
self.template_combo.append_text(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.append_text(_user_template)
self.template_combo.set_active(False)
self.template_combo.connect('changed',self.html_file_enable) self.template_combo.connect('changed',self.html_file_enable)
self.html_table.attach(self.template_combo,2,3,1,2) 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", self.html_fileentry = gnome.ui.FileEntry("HTML_Template",
_("Choose File")) _("Choose File"))
self.html_fileentry.set_modal(True) self.html_fileentry.set_modal(True)
self.html_fileentry.set_sensitive(False) if template_name and not active_index:
user_template = '' 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): if os.path.isfile(user_template):
self.html_fileentry.set_filename(user_template) self.html_fileentry.set_filename(user_template)
self.html_table.attach(self.html_fileentry,2,3,2,3) 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 """Parse the format frame of the dialog. Save the user
selected output format for later use.""" selected output format for later use."""
self.format = self.format_menu.get_reference() 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) self.options.handler.set_format_name(format_name)
def parse_paper_frame(self): def parse_paper_frame(self):
@ -1363,10 +1381,9 @@ class ReportDialog(BareReportDialog):
else: else:
self.template_name = "%s/%s" % (const.template_dir,_template_map[text]) self.template_name = "%s/%s" % (const.template_dir,_template_map[text])
else: else:
self.template_name = None self.template_name = ""
self.options.handler.set_template_name(self.template_name) self.options.handler.set_template_name(self.template_name)
def on_ok_clicked(self, obj): def on_ok_clicked(self, obj):
"""The user is satisfied with the dialog choices. Validate """The user is satisfied with the dialog choices. Validate
the output file name before doing anything else. If there is the output file name before doing anything else. If there is

View File

@ -191,7 +191,7 @@ class OptionListCollection:
default_paper_name = GrampsKeys.get_paper_preference() default_paper_name = GrampsKeys.get_paper_preference()
default_template_name = "" default_template_name = ""
default_orientation = BaseDoc.PAPER_PORTRAIT default_orientation = BaseDoc.PAPER_PORTRAIT
default_format_name = _('Print...') default_format_name = 'print'
def __init__(self,filename=None): def __init__(self,filename=None):
""" """