2006-04-27 Alex Roitman <shura@gramps-project.org>
* src/ViewManager.py (ViewManager.build_plugin_menu): Use unique command-line name for action menu. * src/plugins/GraphViz.py: Fix report. * src/PluginUtils/_PluginMgr.py (_register_standalone): Remove unneeded import. * src/PluginUtils/_Plugins.py (build_tools_menu, build_report_menu, build_plugin_menu, by_menu_name): Remove functions already re-implemented in ViewManager. * src/plugins/EventCmp.py: Correct button label. * src/plugins/StatisticsChart.py: Fix report. svn: r6481
This commit is contained in:
@@ -293,8 +293,6 @@ def _register_standalone(report_class, options_class, translated_name,
|
||||
unsupported=False
|
||||
):
|
||||
"""Register a report with the plugin system"""
|
||||
|
||||
from PluginUtils import Report
|
||||
|
||||
del_index = -1
|
||||
for i in range(0,len(report_list)):
|
||||
|
@@ -293,86 +293,6 @@ class ToolPlugins(PluginDialog):
|
||||
_("Run selected tool"),
|
||||
TOOLS)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Building pulldown menus
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_tools_menu(top_menu,callback):
|
||||
build_plugin_menu(_PluginMgr.tool_list,
|
||||
_Tool.tool_categories,
|
||||
_Tool.gui_tool,
|
||||
top_menu,callback)
|
||||
|
||||
def build_report_menu(top_menu,callback):
|
||||
build_plugin_menu(_PluginMgr.report_list,
|
||||
_Report.standalone_categories,
|
||||
_Report.report,
|
||||
top_menu,callback)
|
||||
|
||||
def build_plugin_menu(item_list,categories,func,top_menu,callback):
|
||||
menu = gtk.Menu()
|
||||
menu.show()
|
||||
|
||||
hash_data = {}
|
||||
for item in item_list:
|
||||
if item[9]:
|
||||
category = UNSUPPORTED
|
||||
else:
|
||||
category = categories[item[3]]
|
||||
if hash_data.has_key(category):
|
||||
hash_data[category].append(
|
||||
(item[0],item[1],item[2],item[4],item[3]))
|
||||
else:
|
||||
hash_data[category] = [
|
||||
(item[0],item[1],item[2],item[4],item[3])]
|
||||
|
||||
# Sort categories, skipping the unsupported
|
||||
catlist = [item for item in hash_data.keys() if item != UNSUPPORTED]
|
||||
catlist.sort()
|
||||
for key in catlist:
|
||||
entry = gtk.MenuItem(key)
|
||||
entry.show()
|
||||
menu.append(entry)
|
||||
submenu = gtk.Menu()
|
||||
submenu.show()
|
||||
entry.set_submenu(submenu)
|
||||
lst = hash_data[key]
|
||||
lst.sort(by_menu_name)
|
||||
for name in lst:
|
||||
subentry = gtk.MenuItem("%s..." % name[2])
|
||||
subentry.show()
|
||||
subentry.connect("activate",callback,func,
|
||||
name[0],name[1],name[2],name[3],name[4])
|
||||
submenu.append(subentry)
|
||||
|
||||
# If there are any unsupported items we add separator
|
||||
# and the unsupported category at the end of the menu
|
||||
if hash_data.has_key(UNSUPPORTED):
|
||||
entry = gtk.MenuItem(None)
|
||||
entry.show()
|
||||
menu.append(entry)
|
||||
key = UNSUPPORTED
|
||||
entry = gtk.MenuItem(key)
|
||||
entry.show()
|
||||
menu.append(entry)
|
||||
submenu = gtk.Menu()
|
||||
submenu.show()
|
||||
entry.set_submenu(submenu)
|
||||
lst = hash_data[key]
|
||||
lst.sort(by_menu_name)
|
||||
for name in lst:
|
||||
subentry = gtk.MenuItem("%s..." % name[2])
|
||||
subentry.show()
|
||||
subentry.connect("activate",callback,func,
|
||||
name[0],name[1],name[2],name[3],name[4])
|
||||
submenu.append(subentry)
|
||||
|
||||
top_menu.set_submenu(menu)
|
||||
|
||||
def by_menu_name(a,b):
|
||||
return cmp(a[2],b[2])
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Reload plugins
|
||||
|
Reference in New Issue
Block a user