2007-12-09 Douglas S. Blank <dblank@cs.brynmawr.edu>

* src/plugins/CalculateEstimatedDates.py: define set_title
	* src/plugins/OwnerEditor.py: define build_menu_names
	* src/PluginUtils/_PluginWindows.py: Fixed layer window issues



svn: r9467
This commit is contained in:
Doug Blank 2007-12-09 16:25:28 +00:00
parent c4bf352d49
commit b12d33db45
4 changed files with 21 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2007-12-09 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/plugins/CalculateEstimatedDates.py: define set_title
* src/plugins/OwnerEditor.py: define build_menu_names
* src/PluginUtils/_PluginWindows.py: Fixed layer window issues
2007-12-09 Benny Malengier <benny.malengier@gramps-project.org> 2007-12-09 Benny Malengier <benny.malengier@gramps-project.org>
* src/gen/db/dbdir.py: rebuild ref map correctly, bug #1421 * src/gen/db/dbdir.py: rebuild ref map correctly, bug #1421

View File

@ -177,6 +177,7 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
border_pad = 6 border_pad = 6
HELP_TOPIC = None HELP_TOPIC = None
def __init__(self, dbstate, uistate, option_class, name, callback=None): def __init__(self, dbstate, uistate, option_class, name, callback=None):
self.name = name
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
self.extra_menu = None self.extra_menu = None
@ -322,7 +323,7 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
def pre_run(self): def pre_run(self):
from Utils import ProgressMeter from Utils import ProgressMeter
self.progress = ProgressMeter(_('Tool')) self.progress = ProgressMeter(self.get_title())
def run(self): def run(self):
raise NotImplementedError, "tool needs to define a run() method" raise NotImplementedError, "tool needs to define a run() method"
@ -337,7 +338,7 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def get_title(self): def get_title(self):
"""The window title for this dialog""" """The window title for this dialog"""
return "Tool" return "Tool" # self.title
def get_header(self, name): def get_header(self, name):
"""The header line to put at the top of the contents of the """The header line to put at the top of the contents of the
@ -345,14 +346,12 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
selected person. Most subclasses will customize this to give selected person. Most subclasses will customize this to give
some indication of what the report will be, i.e. 'Descendant some indication of what the report will be, i.e. 'Descendant
Report for %s'.""" Report for %s'."""
return _("%(tool_name)s for GRAMPS") % { return self.get_title()
'tool_name' : "Tool"}
def setup_title(self): def setup_title(self):
"""Set up the title bar of the dialog. This function relies """Set up the title bar of the dialog. This function relies
on the get_title() customization function for what the title on the get_title() customization function for what the title
should be.""" should be."""
self.name = ''
self.window.set_title(self.get_title()) self.window.set_title(self.get_title())
def setup_header(self): def setup_header(self):
@ -362,7 +361,7 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
supplied by the subclass, the default is to use the full name supplied by the subclass, the default is to use the full name
of the currently selected person.""" of the currently selected person."""
title = self.get_header(self.name) title = self.get_header(self.get_title())
label = gtk.Label('<span size="larger" weight="bold">%s</span>' % title) label = gtk.Label('<span size="larger" weight="bold">%s</span>' % title)
label.set_use_markup(True) label.set_use_markup(True)
self.window.vbox.pack_start(label, True, True, self.border_pad) self.window.vbox.pack_start(label, True, True, self.border_pad)
@ -463,6 +462,11 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
this task.""" this task."""
self.options.add_user_options(self) self.options.add_user_options(self)
def build_menu_names(self, obj):
return (_('Main window'), self.get_title())
class ToolManagedWindowBatch(Tool.BatchTool, ToolManagedWindowBase): class ToolManagedWindowBatch(Tool.BatchTool, ToolManagedWindowBase):
def __init__(self, dbstate, uistate, options_class, name, callback=None): def __init__(self, dbstate, uistate, options_class, name, callback=None):
# This constructor will ask a question, set self.fail: # This constructor will ask a question, set self.fail:

View File

@ -110,6 +110,9 @@ class CalcEstDateOptions(MenuToolOptions):
class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch): class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
def get_title(self):
return _("Calculate Estimated Dates")
def initial_frame(self): def initial_frame(self):
return _("Options") return _("Options")

View File

@ -152,6 +152,9 @@ class OwnerEditor(Tool.Tool, ManagedWindow.ManagedWindow):
if event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS: if event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
self.menu.popup(None,None,None,0,0) self.menu.popup(None,None,None,0,0)
def build_menu_names(self, obj):
return (_('Main window'), _("Edit database owner information"))
def on_menu_activate(self, menuitem): def on_menu_activate(self, menuitem):
"""Copies the owner information from/to the preferences""" """Copies the owner information from/to the preferences"""
if menuitem.name == 'copy_from_preferences_to_db': if menuitem.name == 'copy_from_preferences_to_db':