2006-12-19 Alex Roitman <shura@gramps-project.org>
* src/PluginUtils/_Plugins.py: Emit signal on rebuild, rebuild open plugin dialogs on rebuild. * src/ViewManager.py: Use signal to rebuild plugin menus. * src/DisplayState.py (DisplayState.__signals__): Register signal to indicate plugin reloading. svn: r7827
This commit is contained in:
parent
ccd2af619f
commit
43a14bfa74
@ -1,3 +1,10 @@
|
||||
2006-12-19 Alex Roitman <shura@gramps-project.org>
|
||||
* src/PluginUtils/_Plugins.py: Emit signal on rebuild, rebuild
|
||||
open plugin dialogs on rebuild.
|
||||
* src/ViewManager.py: Use signal to rebuild plugin menus.
|
||||
* src/DisplayState.py (DisplayState.__signals__): Register signal
|
||||
to indicate plugin reloading.
|
||||
|
||||
2006-12-19 Don Allingham <don@gramps-project.org>
|
||||
* src/ViewManager.py (ViewManager.post_load_newdb): make sure to enable
|
||||
the readonly menu items
|
||||
|
@ -254,6 +254,7 @@ class DisplayState(GrampsDb.GrampsDBCallback):
|
||||
__signals__ = {
|
||||
'filters-changed' : (str,),
|
||||
'nameformat-changed' : None,
|
||||
'plugins-reloaded' : (list,list),
|
||||
}
|
||||
|
||||
def __init__(self, window, status, progress, warnbtn, uimanager):
|
||||
|
@ -195,6 +195,7 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
|
||||
ilist = []
|
||||
self.store.clear()
|
||||
|
||||
# build the tree items and group together based on the category name
|
||||
item_hash = {}
|
||||
@ -265,6 +266,10 @@ class ReportPlugins(PluginDialog):
|
||||
_("Select a report from those available on the left."),
|
||||
_("_Generate"), _("Generate selected report"),
|
||||
REPORTS)
|
||||
uistate.connect('plugins-reloaded',self.rebuild_reports)
|
||||
|
||||
def rebuild_reports(self,tool_list,report_list):
|
||||
self.build_plugin_tree(report_list,standalone_categories)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -275,6 +280,9 @@ class ToolPlugins(PluginDialog):
|
||||
"""Displays the dialog box that allows the user to select the tool
|
||||
that is desired."""
|
||||
|
||||
__signals__ = {
|
||||
'plugins-reloaded' : (list,list),
|
||||
}
|
||||
def __init__(self,dbstate,uistate,track):
|
||||
"""Display the dialog box, and build up the list of available
|
||||
reports. This is used to build the selection tree on the left
|
||||
@ -293,6 +301,11 @@ class ToolPlugins(PluginDialog):
|
||||
_("Run selected tool"),
|
||||
TOOLS)
|
||||
|
||||
uistate.connect('plugins-reloaded',self.rebuild_tools)
|
||||
|
||||
def rebuild_tools(self,tool_list,report_list):
|
||||
self.build_plugin_tree(tool_list,_Tool.tool_categories)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Reload plugins
|
||||
@ -300,12 +313,11 @@ class ToolPlugins(PluginDialog):
|
||||
#-------------------------------------------------------------------------
|
||||
class Reload(_Tool.Tool):
|
||||
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
||||
_Tool.Tool.__init__(self,dbstate,options_class,name)
|
||||
|
||||
"""
|
||||
Treated as a callback, causes all plugins to get reloaded.
|
||||
This is useful when writing and debugging a plugin.
|
||||
"""
|
||||
_Tool.Tool.__init__(self,dbstate,options_class,name)
|
||||
|
||||
pymod = re.compile(r"^(.*)\.py$")
|
||||
|
||||
@ -396,6 +408,8 @@ class Reload(_Tool.Tool):
|
||||
# Re-generate tool and report menus
|
||||
# FIXME: This needs to be fixed!
|
||||
# build_plugin_menus(rebuild=True)
|
||||
uistate.emit('plugins-reloaded',
|
||||
(_PluginMgr.tool_list,_PluginMgr.report_list))
|
||||
|
||||
class ReloadOptions(_Tool.ToolOptions):
|
||||
"""
|
||||
|
@ -422,8 +422,10 @@ class ViewManager:
|
||||
self.actiongroup.set_visible(False)
|
||||
self.readonlygroup.set_visible(False)
|
||||
self.fileactions.set_sensitive(False)
|
||||
self.build_tools_menu()
|
||||
self.build_report_menu()
|
||||
self.build_tools_menu(tool_list)
|
||||
self.build_report_menu(report_list)
|
||||
self.uistate.connect('plugins-reloaded',
|
||||
self.rebuild_report_and_tool_menus)
|
||||
self.fileactions.set_sensitive(True)
|
||||
self.uistate.widget.set_sensitive(True)
|
||||
Config.client.notify_add("/apps/gramps/interface/statusbar",
|
||||
@ -1018,7 +1020,11 @@ class ViewManager:
|
||||
import Exporter
|
||||
Exporter.Exporter(self.state, self.uistate)
|
||||
|
||||
def build_tools_menu(self):
|
||||
def rebuild_report_and_tool_menus(self,tool_list,report_list):
|
||||
self.build_tools_menu(tool_list)
|
||||
self.build_report_menu(report_list)
|
||||
|
||||
def build_tools_menu(self,tool_list):
|
||||
self.toolactions = gtk.ActionGroup('ToolWindow')
|
||||
(ui, actions) = self.build_plugin_menu('ToolsMenu',
|
||||
tool_list,
|
||||
@ -1029,7 +1035,7 @@ class ViewManager:
|
||||
self.uimanager.insert_action_group(self.toolactions, 1)
|
||||
self.uistate.uimanager.ensure_update()
|
||||
|
||||
def build_report_menu(self):
|
||||
def build_report_menu(self,report_list):
|
||||
self.reportactions = gtk.ActionGroup('ReportWindow')
|
||||
(ui, actions) = self.build_plugin_menu('ReportsMenu',
|
||||
report_list,
|
||||
|
Loading…
Reference in New Issue
Block a user