* src/PluginMgr.py: Add the optional argument indicating the
unsupported status to all registrations. * src/Plugins.py: Reflect unsupported status in menus and trees. * src/plugins/BookReport.py: Reflect unsupported status. * src/plugins/WebPage.py, src/plugins/FtmStyleAncestors.py, src/plugins/FtmStyleDescendants.py: Declare unsupported status. svn: r5362
This commit is contained in:
@@ -183,7 +183,8 @@ def register_tool(
|
|||||||
status=_("Unknown"),
|
status=_("Unknown"),
|
||||||
description=_unavailable,
|
description=_unavailable,
|
||||||
author_name=_("Unknown"),
|
author_name=_("Unknown"),
|
||||||
author_email=_("Unknown")
|
author_email=_("Unknown"),
|
||||||
|
unsupported=False
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Register a tool with the plugin system.
|
Register a tool with the plugin system.
|
||||||
@@ -199,19 +200,20 @@ def register_tool(
|
|||||||
if gui_task:
|
if gui_task:
|
||||||
_register_gui_tool(tool_class,options_class,translated_name,
|
_register_gui_tool(tool_class,options_class,translated_name,
|
||||||
name,category,description,
|
name,category,description,
|
||||||
status,author_name,author_email)
|
status,author_name,author_email,unsupported)
|
||||||
|
|
||||||
(junk,cli_task) = divmod(modes-gui_task,2**Tool.MODE_CLI)
|
(junk,cli_task) = divmod(modes-gui_task,2**Tool.MODE_CLI)
|
||||||
if cli_task:
|
if cli_task:
|
||||||
_register_cli_tool(name,category,tool_class,options_class,
|
_register_cli_tool(name,category,tool_class,options_class,
|
||||||
translated_name)
|
translated_name,unsupported)
|
||||||
|
|
||||||
def _register_gui_tool(tool_class,options_class,translated_name,
|
def _register_gui_tool(tool_class,options_class,translated_name,
|
||||||
name,category,
|
name,category,
|
||||||
description=_unavailable,
|
description=_unavailable,
|
||||||
status=_("Unknown"),
|
status=_("Unknown"),
|
||||||
author_name=_("Unknown"),
|
author_name=_("Unknown"),
|
||||||
author_email=_("Unknown")):
|
author_email=_("Unknown"),
|
||||||
|
unsupported=False):
|
||||||
del_index = -1
|
del_index = -1
|
||||||
for i in range(0,len(tool_list)):
|
for i in range(0,len(tool_list)):
|
||||||
val = tool_list[i]
|
val = tool_list[i]
|
||||||
@@ -221,10 +223,10 @@ def _register_gui_tool(tool_class,options_class,translated_name,
|
|||||||
del tool_list[del_index]
|
del tool_list[del_index]
|
||||||
tool_list.append((tool_class,options_class,translated_name,
|
tool_list.append((tool_class,options_class,translated_name,
|
||||||
category,name,description,status,
|
category,name,description,status,
|
||||||
author_name,author_email))
|
author_name,author_email,unsupported))
|
||||||
|
|
||||||
def _register_cli_tool(name,category,tool_class,options_class,
|
def _register_cli_tool(name,category,tool_class,options_class,
|
||||||
translated_name):
|
translated_name,unsupported=False):
|
||||||
del_index = -1
|
del_index = -1
|
||||||
for i in range(0,len(cli_tool_list)):
|
for i in range(0,len(cli_tool_list)):
|
||||||
val = cli_tool_list[i]
|
val = cli_tool_list[i]
|
||||||
@@ -233,7 +235,7 @@ def _register_cli_tool(name,category,tool_class,options_class,
|
|||||||
if del_index != -1:
|
if del_index != -1:
|
||||||
del cli_tool_list[del_index]
|
del cli_tool_list[del_index]
|
||||||
cli_tool_list.append((name,category,tool_class,options_class,
|
cli_tool_list.append((name,category,tool_class,options_class,
|
||||||
translated_name))
|
translated_name,unsupported))
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -250,7 +252,8 @@ def register_report(
|
|||||||
status=_("Unknown"),
|
status=_("Unknown"),
|
||||||
description=_unavailable,
|
description=_unavailable,
|
||||||
author_name=_("Unknown"),
|
author_name=_("Unknown"),
|
||||||
author_email=_("Unknown")
|
author_email=_("Unknown"),
|
||||||
|
unsupported=False
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Registers report for all possible flavors.
|
Registers report for all possible flavors.
|
||||||
@@ -266,26 +269,27 @@ def register_report(
|
|||||||
if standalone_task:
|
if standalone_task:
|
||||||
_register_standalone(report_class,options_class,translated_name,
|
_register_standalone(report_class,options_class,translated_name,
|
||||||
name,category,description,
|
name,category,description,
|
||||||
status,author_name,author_email)
|
status,author_name,author_email,unsupported)
|
||||||
|
|
||||||
(junk,book_item_task) = divmod(modes-standalone_task,2**Report.MODE_BKI)
|
(junk,book_item_task) = divmod(modes-standalone_task,2**Report.MODE_BKI)
|
||||||
if book_item_task:
|
if book_item_task:
|
||||||
book_item_category = Report.book_categories[category]
|
book_item_category = Report.book_categories[category]
|
||||||
register_book_item(translated_name,book_item_category,
|
register_book_item(translated_name,book_item_category,
|
||||||
report_class,options_class,name)
|
report_class,options_class,name,unsupported)
|
||||||
|
|
||||||
(junk,command_line_task) = divmod(modes-standalone_task-book_item_task,
|
(junk,command_line_task) = divmod(modes-standalone_task-book_item_task,
|
||||||
2**Report.MODE_CLI)
|
2**Report.MODE_CLI)
|
||||||
if command_line_task:
|
if command_line_task:
|
||||||
_register_cl_report(name,category,report_class,options_class,
|
_register_cl_report(name,category,report_class,options_class,
|
||||||
translated_name)
|
translated_name,unsupported)
|
||||||
|
|
||||||
def _register_standalone(report_class, options_class, translated_name,
|
def _register_standalone(report_class, options_class, translated_name,
|
||||||
name, category,
|
name, category,
|
||||||
description=_unavailable,
|
description=_unavailable,
|
||||||
status=_("Unknown"),
|
status=_("Unknown"),
|
||||||
author_name=_("Unknown"),
|
author_name=_("Unknown"),
|
||||||
author_email=_("Unknown")
|
author_email=_("Unknown"),
|
||||||
|
unsupported=False
|
||||||
):
|
):
|
||||||
"""Register a report with the plugin system"""
|
"""Register a report with the plugin system"""
|
||||||
|
|
||||||
@@ -299,10 +303,11 @@ def _register_standalone(report_class, options_class, translated_name,
|
|||||||
if del_index != -1:
|
if del_index != -1:
|
||||||
del report_list[del_index]
|
del report_list[del_index]
|
||||||
report_list.append((report_class, options_class, translated_name,
|
report_list.append((report_class, options_class, translated_name,
|
||||||
category, name, description, status, author_name, author_email))
|
category, name, description, status,
|
||||||
|
author_name, author_email, unsupported))
|
||||||
|
|
||||||
def register_book_item(translated_name, category, report_class,
|
def register_book_item(translated_name, category, report_class,
|
||||||
option_class, name):
|
option_class, name, unsupported):
|
||||||
"""Register a book item"""
|
"""Register a book item"""
|
||||||
|
|
||||||
del_index = -1
|
del_index = -1
|
||||||
@@ -314,10 +319,10 @@ def register_book_item(translated_name, category, report_class,
|
|||||||
del bkitems_list[del_index]
|
del bkitems_list[del_index]
|
||||||
|
|
||||||
bkitems_list.append((translated_name, category, report_class,
|
bkitems_list.append((translated_name, category, report_class,
|
||||||
option_class, name))
|
option_class, name, unsupported))
|
||||||
|
|
||||||
def _register_cl_report(name,category,report_class,options_class,
|
def _register_cl_report(name,category,report_class,options_class,
|
||||||
translated_name):
|
translated_name,unsupported):
|
||||||
del_index = -1
|
del_index = -1
|
||||||
for i in range(0,len(cl_list)):
|
for i in range(0,len(cl_list)):
|
||||||
val = cl_list[i]
|
val = cl_list[i]
|
||||||
@@ -326,7 +331,7 @@ def _register_cl_report(name,category,report_class,options_class,
|
|||||||
if del_index != -1:
|
if del_index != -1:
|
||||||
del cl_list[del_index]
|
del cl_list[del_index]
|
||||||
cl_list.append((name,category,report_class,options_class,
|
cl_list.append((name,category,report_class,options_class,
|
||||||
translated_name))
|
translated_name,unsupported))
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@@ -69,6 +69,7 @@ import GrampsDisplay
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
REPORTS = 0
|
REPORTS = 0
|
||||||
TOOLS = 1
|
TOOLS = 1
|
||||||
|
UNSUPPORTED = _("Unsupported")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -126,6 +127,7 @@ class PluginDialog:
|
|||||||
|
|
||||||
self.author_name = self.dialog.get_widget("author_name")
|
self.author_name = self.dialog.get_widget("author_name")
|
||||||
self.author_email = self.dialog.get_widget("author_email")
|
self.author_email = self.dialog.get_widget("author_email")
|
||||||
|
|
||||||
self.statbox = self.dialog.get_widget("statbox")
|
self.statbox = self.dialog.get_widget("statbox")
|
||||||
|
|
||||||
self.apply_button = self.dialog.get_widget("apply")
|
self.apply_button = self.dialog.get_widget("apply")
|
||||||
@@ -194,8 +196,10 @@ class PluginDialog:
|
|||||||
data = self.imap[path]
|
data = self.imap[path]
|
||||||
|
|
||||||
(report_class,options_class,title,category,name,
|
(report_class,options_class,title,category,name,
|
||||||
doc,status,author,email) = data
|
doc,status,author,email,unsupported) = data
|
||||||
self.description.set_text(doc)
|
self.description.set_text(doc)
|
||||||
|
if unsupported:
|
||||||
|
status = UNSUPPORTED
|
||||||
self.status.set_text(status)
|
self.status.set_text(status)
|
||||||
self.title.set_text('<span weight="bold" size="larger">%s</span>' % title)
|
self.title.set_text('<span weight="bold" size="larger">%s</span>' % title)
|
||||||
self.title.set_use_markup(1)
|
self.title.set_use_markup(1)
|
||||||
@@ -220,6 +224,9 @@ class PluginDialog:
|
|||||||
# build the tree items and group together based on the category name
|
# build the tree items and group together based on the category name
|
||||||
item_hash = {}
|
item_hash = {}
|
||||||
for plugin in item_list:
|
for plugin in item_list:
|
||||||
|
if plugin[9]:
|
||||||
|
category = UNSUPPORTED
|
||||||
|
else:
|
||||||
category = categories[plugin[3]]
|
category = categories[plugin[3]]
|
||||||
if item_hash.has_key(category):
|
if item_hash.has_key(category):
|
||||||
item_hash[category].append(plugin)
|
item_hash[category].append(plugin)
|
||||||
@@ -228,11 +235,22 @@ class PluginDialog:
|
|||||||
|
|
||||||
# add a submenu for each category, and populate it with the
|
# add a submenu for each category, and populate it with the
|
||||||
# GtkTreeItems that are associated with it.
|
# GtkTreeItems that are associated with it.
|
||||||
key_list = item_hash.keys()
|
key_list = [ item for item in item_hash.keys() if item != UNSUPPORTED]
|
||||||
key_list.sort()
|
key_list.sort()
|
||||||
key_list.reverse()
|
key_list.reverse()
|
||||||
|
|
||||||
prev = None
|
prev = None
|
||||||
|
if item_hash.has_key(UNSUPPORTED):
|
||||||
|
key = UNSUPPORTED
|
||||||
|
data = item_hash[key]
|
||||||
|
node = self.store.insert_after(None,prev)
|
||||||
|
self.store.set(node,0,key)
|
||||||
|
next = None
|
||||||
|
data.sort(lambda x,y: cmp(x[2],y[2]))
|
||||||
|
for item in data:
|
||||||
|
next = self.store.insert_after(node,next)
|
||||||
|
ilist.append((next,item))
|
||||||
|
self.store.set(next,0,item[2])
|
||||||
for key in key_list:
|
for key in key_list:
|
||||||
data = item_hash[key]
|
data = item_hash[key]
|
||||||
node = self.store.insert_after(None,prev)
|
node = self.store.insert_after(None,prev)
|
||||||
@@ -397,6 +415,9 @@ def build_plugin_menu(item_list,categories,func,top_menu,callback):
|
|||||||
|
|
||||||
hash_data = {}
|
hash_data = {}
|
||||||
for item in item_list:
|
for item in item_list:
|
||||||
|
if item[9]:
|
||||||
|
category = UNSUPPORTED
|
||||||
|
else:
|
||||||
category = categories[item[3]]
|
category = categories[item[3]]
|
||||||
if hash_data.has_key(category):
|
if hash_data.has_key(category):
|
||||||
hash_data[category].append(
|
hash_data[category].append(
|
||||||
@@ -405,7 +426,8 @@ def build_plugin_menu(item_list,categories,func,top_menu,callback):
|
|||||||
hash_data[category] = [
|
hash_data[category] = [
|
||||||
(item[0],item[1],item[2],item[4],item[3])]
|
(item[0],item[1],item[2],item[4],item[3])]
|
||||||
|
|
||||||
catlist = hash_data.keys()
|
# Sort categories, skipping the unsupported
|
||||||
|
catlist = [item for item in hash_data.keys() if item != UNSUPPORTED]
|
||||||
catlist.sort()
|
catlist.sort()
|
||||||
for key in catlist:
|
for key in catlist:
|
||||||
entry = gtk.MenuItem(key)
|
entry = gtk.MenuItem(key)
|
||||||
@@ -422,20 +444,34 @@ def build_plugin_menu(item_list,categories,func,top_menu,callback):
|
|||||||
subentry.connect("activate",callback,func,
|
subentry.connect("activate",callback,func,
|
||||||
name[0],name[1],name[2],name[3],name[4])
|
name[0],name[1],name[2],name[3],name[4])
|
||||||
submenu.append(subentry)
|
submenu.append(subentry)
|
||||||
top_menu.set_submenu(menu)
|
|
||||||
|
|
||||||
|
# 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):
|
def by_menu_name(a,b):
|
||||||
return cmp(a[2],b[2])
|
return cmp(a[2],b[2])
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# build_tools_menu
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#def build_tools_menu(top_menu,callback):
|
|
||||||
# build_menu(top_menu,PluginMgr.tool_list,callback)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# get_text_doc_menu
|
# get_text_doc_menu
|
||||||
|
@@ -423,5 +423,6 @@ register_report(
|
|||||||
status=(_("Beta")),
|
status=(_("Beta")),
|
||||||
description= _("Produces a textual ancestral report similar to Family Tree Maker."),
|
description= _("Produces a textual ancestral report similar to Family Tree Maker."),
|
||||||
author_name="Donald N. Allingham",
|
author_name="Donald N. Allingham",
|
||||||
author_email="dallingham@users.sourceforge.net"
|
author_email="dallingham@users.sourceforge.net",
|
||||||
|
unsupported=True
|
||||||
)
|
)
|
||||||
|
@@ -571,5 +571,6 @@ register_report(
|
|||||||
status = _("Beta"),
|
status = _("Beta"),
|
||||||
description= _("Produces a textual descendant report similar to Family Tree Maker."),
|
description= _("Produces a textual descendant report similar to Family Tree Maker."),
|
||||||
author_name="Alex Roitman",
|
author_name="Alex Roitman",
|
||||||
author_email="shura@alex.neuro.umn.edu"
|
author_email="shura@alex.neuro.umn.edu",
|
||||||
|
unsupported=True
|
||||||
)
|
)
|
||||||
|
@@ -1980,4 +1980,5 @@ register_report(
|
|||||||
"or a set of individuals. This report is considered "
|
"or a set of individuals. This report is considered "
|
||||||
"to be deprecated. Please migrate to the new "
|
"to be deprecated. Please migrate to the new "
|
||||||
"Narrative Web Page generator."),
|
"Narrative Web Page generator."),
|
||||||
|
unsupported=True
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user