svn: r6903
This commit is contained in:
parent
c9a65984d6
commit
460a8ca0bd
@ -622,6 +622,9 @@ class PersonView(PageView.PersonNavView):
|
||||
selected_ids = self.get_selected_objects()
|
||||
if not self.inactive:
|
||||
try:
|
||||
if len(selected_ids) == 0:
|
||||
self.dbstate.change_active_person(None)
|
||||
else:
|
||||
handle = selected_ids[0]
|
||||
person = self.dbstate.db.get_person_from_handle(handle)
|
||||
self.dbstate.change_active_person(person)
|
||||
|
@ -321,7 +321,7 @@ class DisplayState(GrampsDb.GrampsDBCallback):
|
||||
self.status.push(self.status_id,"")
|
||||
else:
|
||||
person = self.dbstate.get_active_person()
|
||||
if not person:
|
||||
if person:
|
||||
pname = NameDisplay.displayer.display(person)
|
||||
name = "[%s] %s" % (person.get_gramps_id(),pname)
|
||||
else:
|
||||
|
@ -185,7 +185,8 @@ def register_tool(
|
||||
description=_unavailable,
|
||||
author_name=_("Unknown"),
|
||||
author_email=_("Unknown"),
|
||||
unsupported=False
|
||||
unsupported=False,
|
||||
require_active=True,
|
||||
):
|
||||
"""
|
||||
Register a tool with the plugin system.
|
||||
@ -202,7 +203,8 @@ def register_tool(
|
||||
if gui_task:
|
||||
_register_gui_tool(tool_class,options_class,translated_name,
|
||||
name,category,description,
|
||||
status,author_name,author_email,unsupported)
|
||||
status,author_name,author_email,unsupported,
|
||||
require_active)
|
||||
|
||||
(junk,cli_task) = divmod(modes-gui_task,2**_Tool.MODE_CLI)
|
||||
if cli_task:
|
||||
@ -215,7 +217,8 @@ def _register_gui_tool(tool_class,options_class,translated_name,
|
||||
status=_("Unknown"),
|
||||
author_name=_("Unknown"),
|
||||
author_email=_("Unknown"),
|
||||
unsupported=False):
|
||||
unsupported=False,
|
||||
require_active=True):
|
||||
del_index = -1
|
||||
for i in range(0,len(tool_list)):
|
||||
val = tool_list[i]
|
||||
@ -226,7 +229,7 @@ def _register_gui_tool(tool_class,options_class,translated_name,
|
||||
mod2text[tool_class.__module__] = description
|
||||
tool_list.append((tool_class,options_class,translated_name,
|
||||
category,name,description,status,
|
||||
author_name,author_email,unsupported))
|
||||
author_name,author_email,unsupported, require_active))
|
||||
|
||||
def _register_cli_tool(name,category,tool_class,options_class,
|
||||
translated_name,unsupported=False):
|
||||
@ -238,7 +241,7 @@ def _register_cli_tool(name,category,tool_class,options_class,
|
||||
if del_index != -1:
|
||||
del cli_tool_list[del_index]
|
||||
cli_tool_list.append((name,category,tool_class,options_class,
|
||||
translated_name,unsupported))
|
||||
translated_name,unsupported, None))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -256,7 +259,8 @@ def register_report(
|
||||
description=_unavailable,
|
||||
author_name=_("Unknown"),
|
||||
author_email=_("Unknown"),
|
||||
unsupported=False
|
||||
unsupported=False,
|
||||
require_active=True,
|
||||
):
|
||||
"""
|
||||
Registers report for all possible flavors.
|
||||
@ -270,13 +274,15 @@ def register_report(
|
||||
if standalone_task:
|
||||
_register_standalone(report_class,options_class,translated_name,
|
||||
name,category,description,
|
||||
status,author_name,author_email,unsupported)
|
||||
status,author_name,author_email,unsupported,
|
||||
require_active)
|
||||
|
||||
(junk,book_item_task) = divmod(modes-standalone_task,2**MODE_BKI)
|
||||
if book_item_task:
|
||||
book_item_category = book_categories[category]
|
||||
register_book_item(translated_name,book_item_category,
|
||||
report_class,options_class,name,unsupported)
|
||||
report_class,options_class,name,unsupported,
|
||||
require_active)
|
||||
|
||||
(junk,command_line_task) = divmod(modes-standalone_task-book_item_task,
|
||||
2**MODE_CLI)
|
||||
@ -284,13 +290,17 @@ def register_report(
|
||||
_register_cl_report(name,category,report_class,options_class,
|
||||
translated_name,unsupported)
|
||||
|
||||
def _register_standalone(report_class, options_class, translated_name,
|
||||
name, category,
|
||||
def _register_standalone(report_class,
|
||||
options_class,
|
||||
translated_name,
|
||||
name,
|
||||
category,
|
||||
description=_unavailable,
|
||||
status=_("Unknown"),
|
||||
author_name=_("Unknown"),
|
||||
author_email=_("Unknown"),
|
||||
unsupported=False
|
||||
unsupported=False,
|
||||
require_active=True,
|
||||
):
|
||||
"""Register a report with the plugin system"""
|
||||
|
||||
@ -304,11 +314,12 @@ def _register_standalone(report_class, options_class, translated_name,
|
||||
|
||||
report_list.append((report_class, options_class, translated_name,
|
||||
category, name, description, status,
|
||||
author_name, author_email, unsupported))
|
||||
author_name, author_email, unsupported,
|
||||
require_active))
|
||||
mod2text[report_class.__module__] = description
|
||||
|
||||
def register_book_item(translated_name, category, report_class,
|
||||
option_class, name, unsupported):
|
||||
option_class, name, unsupported, require_active):
|
||||
"""Register a book item"""
|
||||
|
||||
del_index = -1
|
||||
@ -320,10 +331,10 @@ def register_book_item(translated_name, category, report_class,
|
||||
del bkitems_list[del_index]
|
||||
|
||||
bkitems_list.append((translated_name, category, report_class,
|
||||
option_class, name, unsupported))
|
||||
option_class, name, unsupported, require_active))
|
||||
|
||||
def _register_cl_report(name,category,report_class,options_class,
|
||||
translated_name,unsupported):
|
||||
translated_name,unsupported, require_active):
|
||||
del_index = -1
|
||||
for i in range(0,len(cl_list)):
|
||||
val = cl_list[i]
|
||||
@ -332,7 +343,7 @@ def _register_cl_report(name,category,report_class,options_class,
|
||||
if del_index != -1:
|
||||
del cl_list[del_index]
|
||||
cl_list.append((name,category,report_class,options_class,
|
||||
translated_name,unsupported))
|
||||
translated_name,unsupported, require_active))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -606,13 +606,20 @@ class ReportDialog(BareReportDialog):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def report(dbstate,uistate,person,report_class,options_class,
|
||||
trans_name,name,category):
|
||||
trans_name,name,category, require_active):
|
||||
"""
|
||||
report - task starts the report. The plugin system requires that the
|
||||
task be in the format of task that takes a database and a person as
|
||||
its arguments.
|
||||
"""
|
||||
|
||||
if require_active and not person:
|
||||
ErrorDialog(
|
||||
_('Active person has not been set'),
|
||||
_('You must select an active person for this report to work '
|
||||
'properly.'))
|
||||
return
|
||||
|
||||
if category == CATEGORY_TEXT:
|
||||
from _TextReportDialog import TextReportDialog
|
||||
dialog_class = TextReportDialog
|
||||
|
@ -921,10 +921,10 @@ class ViewManager:
|
||||
category = categories[item[3]]
|
||||
if hash_data.has_key(category):
|
||||
hash_data[category].append(
|
||||
(item[0], item[1], item[2], item[4], item[3]))
|
||||
(item[0], item[1], item[2], item[4], item[3], item[10]))
|
||||
else:
|
||||
hash_data[category] = [
|
||||
(item[0], item[1], item[2], item[4], item[3])]
|
||||
(item[0], item[1], item[2], item[4], item[3], item[10])]
|
||||
|
||||
# Sort categories, skipping the unsupported
|
||||
catlist = [item for item in hash_data.keys()
|
||||
@ -967,7 +967,7 @@ def by_menu_name(a, b):
|
||||
|
||||
def make_report_callback(lst, dbstate, uistate):
|
||||
return lambda x: report(dbstate, uistate, dbstate.get_active_person(),
|
||||
lst[0], lst[1], lst[2], lst[3], lst[4])
|
||||
lst[0], lst[1], lst[2], lst[3], lst[4], lst[5])
|
||||
|
||||
def make_tool_callback(lst, dbstate, uistate):
|
||||
return lambda x: Tool.gui_tool(dbstate, uistate,
|
||||
|
@ -981,5 +981,6 @@ register_report(
|
||||
status = (_("Stable")),
|
||||
author_name="Eero Tamminen",
|
||||
author_email="",
|
||||
description= _("Generates statistical bar and pie charts of the people in the database.")
|
||||
description= _("Generates statistical bar and pie charts of the people in the database."),
|
||||
require_active=False,
|
||||
)
|
||||
|
@ -179,4 +179,5 @@ register_report(
|
||||
translated_name = _("Summary of the database"),
|
||||
status = _("Beta"),
|
||||
description= _("Provides a summary of the current database"),
|
||||
require_active=False,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user