* src/Plugins.py: move non-gui functions to PluginMgr.py

* src/PluginMgr.py: Non-gui functions for plugins
* src/Makefile.am: Added PluginMgr.py
* various: switch from Plugins to PluginMgr


svn: r3866
This commit is contained in:
Don Allingham 2005-01-05 05:02:19 +00:00
parent a161a842eb
commit 40559041d3
79 changed files with 589 additions and 539 deletions

View File

@ -1,3 +1,9 @@
2005-01-04 Don Allingham <dallingham@users.sourceforge.net>
* src/Plugins.py: move non-gui functions to PluginMgr.py
* src/PluginMgr.py: Non-gui functions for plugins
* src/Makefile.am: Added PluginMgr.py
* various: switch from Plugins to PluginMgr
2005-01-03 Don Allingham <dallingham@users.sourceforge.net>
* src/GrampsDbBase.py: move all thumbnail creation here to have
a common thumbnail scheme.

View File

@ -106,7 +106,7 @@ def register_datehandler(locales,parse_class,display_class):
# Import localized date classes
#
#-------------------------------------------------------------------------
from Plugins import load_plugins
from PluginMgr import load_plugins
from const import datesDir
load_plugins(datesDir)

View File

@ -46,7 +46,7 @@ import gnome
import Utils
import const
import QuestionDialog
import Plugins
import PluginMgr
import GrampsBSDDB
import GrampsXMLDB
import GrampsGEDDB
@ -156,7 +156,7 @@ class ExistingDbPrompter:
choose.add_filter(mime_filter)
# Add more data type selections if opening existing db
for (importData,mime_filter,mime_type,native_format) in Plugins._imports:
for (importData,mime_filter,mime_type,native_format) in PluginMgr.import_list:
if not native_format:
choose.add_filter(mime_filter)
@ -183,7 +183,7 @@ class ExistingDbPrompter:
# The above native formats did not work, so we need to
# look up the importer for this format
# and create an empty native database to import data in
for (importData,mime_filter,mime_type,native_format) in Plugins._imports:
for (importData,mime_filter,mime_type,native_format) in Plugin.import_list:
if filetype == mime_type or the_file == mime_type:
QuestionDialog.OkDialog(
_("Opening non-native format"),
@ -252,7 +252,7 @@ class ImportDbPrompter:
# choose.add_filter(mime_filter)
# Add more data type selections if opening existing db
for (importData,mime_filter,mime_type,native_format) in Plugins._imports:
for (importData,mime_filter,mime_type,native_format) in PluginMgr.import_list:
choose.add_filter(mime_filter)
# Suggested folder: try last open file, import, then last export,
@ -279,7 +279,7 @@ class ImportDbPrompter:
(the_path,the_file) = os.path.split(filename)
GrampsGconfKeys.save_last_import_dir(the_path)
for (importData,mime_filter,mime_type,native_format) in Plugins._imports:
for (importData,mime_filter,mime_type,native_format) in PluginMgr.import_list:
if filetype == mime_type or the_file == mime_type:
choose.destroy()
importData(self.parent.db,filename)

View File

@ -1398,6 +1398,8 @@ class IsSpouseOfFilterMatch(Rule):
class GenericFilter:
"""Filter class that consists of several rules"""
logical_functions = ['or', 'and', 'xor', 'one']
def __init__(self,source=None):
if source:
self.need_param = source.need_param
@ -1415,7 +1417,7 @@ class GenericFilter:
self.invert = 0
def set_logical_op(self,val):
if val in const.logical_functions:
if val in GenericFilter.logical_functions:
self.logical_op = val
else:
self.logical_op = 'and'

View File

@ -78,6 +78,7 @@ gdir_PYTHON = \
PeopleModel.py\
PlaceView.py\
Plugins.py\
PluginMgr.py\
QuestionDialog.py\
ReadGedcom.py \
ReadXML.py\

418
src/PluginMgr.py Normal file
View File

@ -0,0 +1,418 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2004 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"""
The core of the GRAMPS plugin system. This module provides tasks to load
plugins from specfied directories, build menus for the different categories,
and provide dialog to select and execute plugins.
Plugins are divided into several categories. This are: reports, tools,
importers, exporters, and document generators.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
import os
import sys
import string
from re import compile
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
import GrampsGconfKeys
import Errors
#-------------------------------------------------------------------------
#
# Global lists
#
#-------------------------------------------------------------------------
report_list = []
tool_list = []
import_list = []
export_list = []
expect_list = []
attempt_list = []
loaddir_list = []
textdoc_list = []
bookdoc_list = []
drawdoc_list = []
failmsg_list = []
bkitems_list = []
cl_list = []
_success_list = []
status_up = None
#-------------------------------------------------------------------------
#
# Default relationship calculator
#
#-------------------------------------------------------------------------
import Relationship
_relcalc_class = Relationship.RelationshipCalculator
#-------------------------------------------------------------------------
#
#
#-------------------------------------------------------------------------
_unavailable = _("No description was provided"),
#-------------------------------------------------------------------------
#
# load_plugins
#
#-------------------------------------------------------------------------
def load_plugins(direct):
"""Searches the specified directory, and attempts to load any python
modules that it finds, adding name to the attempt_lists list. If the module
successfully loads, it is added to the _success_list list. Each plugin is
responsible for registering itself in the correct manner. No attempt
is done in this routine to register the tasks."""
global _success_list,attempt_list,loaddir_list,failmsg_list
# if the directory does not exist, do nothing
if not os.path.isdir(direct):
return
# if the path has not already been loaded, save it in the loaddir_list
# list for use on reloading
if direct not in loaddir_list:
loaddir_list.append(direct)
# add the directory to the python search path
sys.path.append(direct)
pymod = compile(r"^(.*)\.py$")
# loop through each file in the directory, looking for files that
# have a .py extention, and attempt to load the file. If it succeeds,
# add it to the _success_list list. If it fails, add it to the _failure
# list
for filename in os.listdir(direct):
name = os.path.split(filename)
match = pymod.match(name[1])
if not match:
continue
attempt_list.append(filename)
plugin = match.groups()[0]
try:
a = __import__(plugin)
_success_list.append(a)
except Errors.PluginError, msg:
expect_list.append((filename,str(msg)))
except:
failmsg_list.append((filename,sys.exc_info()))
if GrampsGconfKeys.get_pop_plugin_status() and len(expect_list)+len(failmsg_list):
PluginStatus()
#-------------------------------------------------------------------------
#
# reload_plugins
#
#-------------------------------------------------------------------------
def reload_plugins(obj=None,junk1=None,junk2=None,junk3=None):
"""Treated as a callback, causes all plugins to get reloaded. This is
useful when writing and debugging a plugin"""
pymod = compile(r"^(.*)\.py$")
global _success_list,attempt_list,loaddir_list,failmsg_list
oldfailmsg = failmsg_list[:]
failmsg_list = []
# attempt to reload all plugins that have succeeded in the past
for plugin in _success_list:
filename = os.path.basename(plugin.__file__)
filename = filename.replace('pyc','py')
filename = filename.replace('pyo','py')
try:
reload(plugin)
except:
failmsg_list.append((filename,sys.exc_info()))
# attempt to load the plugins that have failed in the past
for (filename,message) in oldfailmsg:
name = os.path.split(filename)
match = pymod.match(name[1])
if not match:
continue
attempt_list.append(filename)
plugin = match.groups()[0]
try:
# For some strange reason second importing of a failed plugin
# results in success. Then reload reveals the actual error.
# Looks like a bug in Python.
a = __import__(plugin)
reload(a)
_success_list.append(a)
except:
failmsg_list.append((filename,sys.exc_info()))
# attempt to load any new files found
for directory in loaddir_list:
for filename in os.listdir(directory):
name = os.path.split(filename)
match = pymod.match(name[1])
if not match:
continue
if filename in attempt_list:
continue
attempt_list.append(filename)
plugin = match.groups()[0]
try:
a = __import__(plugin)
if a not in _success_list:
_success_list.append(a)
except:
failmsg_list.append((filename,sys.exc_info()))
if GrampsGconfKeys.get_pop_plugin_status():
global status_up
if len(failmsg_list):
PluginStatus()
elif status_up:
status_up.close(None)
status_up = None
#-------------------------------------------------------------------------
#
# Plugin registering
#
#-------------------------------------------------------------------------
def register_export(exportData,title,description='',config=None,filename=''):
"""
Register an export filter, taking the task, file filter,
and the list of patterns for the filename matching.
"""
if description and filename:
export_list.append((exportData,title,description,config,filename))
def register_import(task, ffilter, mime=None, native_format=0):
"""Register an import filter, taking the task and file filter"""
if mime:
import_list.append((task, ffilter, mime, native_format))
def register_tool(
task,
name,
category=_("Uncategorized"),
description=_unavailable,
status=_("Unknown"),
author_name=_("Unknown"),
author_email=_("Unknown")
):
"""Register a tool with the plugin system"""
del_index = -1
for i in range(0,len(tool_list)):
val = tool_list[i]
if val[2] == name:
del_index = i
if del_index != -1:
del tool_list[del_index]
tool_list.append((task, category, name, description,
status, author_name, author_name))
#-------------------------------------------------------------------------
#
# Report registration
#
#-------------------------------------------------------------------------
def register_report(
name,
category,
report_class,
options_class,
modes,
translated_name,
status=_("Unknown"),
description=_unavailable,
author_name=_("Unknown"),
author_email=_("Unknown")
):
"""
Registers report for all possible flavors.
This function should be used to register report as a stand-alone, book item, or command-line flavor in any combination of those.
The low-level functions (starting with '_') should not be used
on their own. Instead, this function will call them as needed.
"""
import Report
(junk,standalone_task) = divmod(modes,2**Report.MODE_GUI)
if standalone_task:
_register_standalone(report_class,options_class,translated_name,
name,category,description,
status,author_name,author_email)
(junk,book_item_task) = divmod(modes-standalone_task,2**Report.MODE_BKI)
if book_item_task:
book_item_category = const.book_categories[category]
register_book_item(translated_name,book_item_category,
report_class,options_class,name)
(junk,command_line_task) = divmod(modes-standalone_task-book_item_task,
2**Report.MODE_CLI)
if command_line_task:
_register_cl_report(name,category,report_class,options_class)
def _register_standalone(report_class, options_class, translated_name,
name, category,
description=_unavailable,
status=_("Unknown"),
author_name=_("Unknown"),
author_email=_("Unknown")
):
"""Register a report with the plugin system"""
import Report
del_index = -1
for i in range(0,len(report_list)):
val = report_list[i]
if val[2] == name:
del_index = i
if del_index != -1:
del report_list[del_index]
report_list.append((report_class, options_class, translated_name,
category, name, description, status, author_name, author_email))
def register_book_item(translated_name, category, report_class,
option_class, name):
"""Register a book item"""
for n in bkitems_list:
if n[0] == name:
return
bkitems_list.append((translated_name, category, report_class,
option_class, name))
def _register_cl_report(name,category,report_class,options_class):
for n in cl_list:
if n[0] == name:
return
cl_list.append((name,category,report_class,options_class))
#-------------------------------------------------------------------------
#
# Text document generator registration
#
#-------------------------------------------------------------------------
def register_text_doc(name,classref, table, paper, style, ext,
print_report_label=None,clname=''):
"""Register a text document generator"""
for n in textdoc_list:
if n[0] == name:
return
if not clname:
clname = ext[1:]
textdoc_list.append(
(name, classref, table, paper, style,
ext, print_report_label, clname))
#-------------------------------------------------------------------------
#
# Book document generator registration
#
#-------------------------------------------------------------------------
def register_book_doc(name,classref, table, paper, style, ext, clname=''):
"""Register a text document generator"""
for n in bookdoc_list:
if n[0] == name:
return
if not clname:
clname = ext[1:]
bookdoc_list.append((name,classref,table,paper,style,ext,clname))
#-------------------------------------------------------------------------
#
# Drawing document generator registration
#
#-------------------------------------------------------------------------
def register_draw_doc(name,classref,paper,style, ext,
print_report_label=None,clname=''):
"""Register a drawing document generator"""
for n in drawdoc_list:
if n[0] == name:
return
if not clname:
clname = ext[1:]
drawdoc_list.append((name, classref, paper,style, ext,
print_report_label, clname))
#-------------------------------------------------------------------------
#
# Relationship calculator registration
#
#-------------------------------------------------------------------------
def register_relcalc(relclass, languages):
"""Register a relationshp calculator"""
global _relcalc_class
try:
if os.environ["LANG"] in languages:
_relcalc_class = relclass
except:
pass
def relationship_class(db):
global _relcalc_class
return _relcalc_class(db)
#-------------------------------------------------------------------------
#
# Image attributes
#
#-------------------------------------------------------------------------
_image_attributes = []
def register_image_attribute(name):
if name not in _image_attributes:
_image_attributes.append(name)
def get_image_attributes():
return _image_attributes
#-------------------------------------------------------------------------
#
# Register the plugin reloading tool
#
#-------------------------------------------------------------------------
register_tool(
reload_plugins,
_("Reload plugins"),
category=_("Debug"),
description=_("Attempt to reload plugins. Note: This tool itself is not reloaded!"),
)

View File

@ -60,41 +60,7 @@ import Utils
import GrampsGconfKeys
import Errors
import Report
#-------------------------------------------------------------------------
#
# Global lists
#
#-------------------------------------------------------------------------
_reports = []
_tools = []
_imports = []
_exports = []
_success = []
_expect = []
_attempt = []
_loaddir = []
_textdoc = []
_bookdoc = []
_drawdoc = []
_failmsg = []
_bkitems = []
_cl = []
_status_up = None
#-------------------------------------------------------------------------
#
# Default relationship calculator
#
#-------------------------------------------------------------------------
import Relationship
_relcalc_class = Relationship.RelationshipCalculator
#-------------------------------------------------------------------------
#
#
#-------------------------------------------------------------------------
_unavailable = _("No description was provided"),
import PluginMgr
#-------------------------------------------------------------------------
#
@ -341,9 +307,13 @@ class ReportPlugins(PluginDialog):
"""Display the dialog box, and build up the list of available
reports. This is used to build the selection tree on the left
hand side of the dailog box."""
PluginDialog.__init__(self,parent,db,active,_reports,_("Report Selection"),
_("Select a report from those available on the left."),
_("_Generate"), _("Generate selected report"))
PluginDialog.__init__(
self,parent,
db,
active,
PluginMgr.report_list,_("Report Selection"),
_("Select a report from those available on the left."),
_("_Generate"), _("Generate selected report"))
#-------------------------------------------------------------------------
#
@ -359,9 +329,16 @@ class ToolPlugins(PluginDialog):
reports. This is used to build the selection tree on the left
hand side of the dailog box."""
PluginDialog.__init__(self,parent,db,active,_tools,_("Tool Selection"),
_("Select a tool from those available on the left."),
_("_Run"), _("Run selected tool"))
PluginDialog.__init__(
self,
parent,
db,
active,
PluginMgr.tool_list,
_("Tool Selection"),
_("Select a tool from those available on the left."),
_("_Run"),
_("Run selected tool"))
self.update = update
#-------------------------------------------------------------------------
@ -373,10 +350,9 @@ class PluginStatus:
"""Displays a dialog showing the status of loaded plugins"""
def __init__(self):
global _status_up
if _status_up:
_status_up.close(None)
_status_up = self
if PluginMgr.status_up:
PluginMgr.status_up.close(None)
PluginMgr.status_up = self
import cStringIO
@ -401,16 +377,16 @@ class PluginStatus:
info = cStringIO.StringIO()
if len(_expect) + len(_failmsg) == 0:
if len(PluginMgr.expect_list) + len(PluginMgr.failmsg_list) == 0:
window.get_buffer().set_text(_('All modules were successfully loaded.'))
else:
info.write(_("The following modules could not be loaded:"))
info.write("\n\n")
for (filename,msg) in _expect:
for (filename,msg) in PluginMgr.expect_list:
info.write("%s: %s\n\n" % (filename,msg))
for (filename,msgs) in _failmsg:
for (filename,msgs) in PluginMgr.failmsg_list:
error = str(msgs[0])
if error[0:11] == "exceptions.":
error = error[11:]
@ -421,11 +397,11 @@ class PluginStatus:
window.get_buffer().set_text(info.read())
def on_delete(self,obj1,obj2):
_status_up = None
PluginMgr.status_up = None
def close(self,obj):
self.top.destroy()
_status_up = None
PluginMgr.status_up = None
def help(self,obj):
"""Display the GRAMPS manual"""
@ -434,316 +410,6 @@ class PluginStatus:
def pop_button_update(self, client,cnxn_id,entry,data):
self.pop_button.set_active(GrampsGconfKeys.get_pop_plugin_status())
#-------------------------------------------------------------------------
#
# load_plugins
#
#-------------------------------------------------------------------------
def load_plugins(direct):
"""Searches the specified directory, and attempts to load any python
modules that it finds, adding name to the _attempts list. If the module
successfully loads, it is added to the _success list. Each plugin is
responsible for registering itself in the correct manner. No attempt
is done in this routine to register the tasks."""
global _success,_attempt,_loaddir,_failmsg
# if the directory does not exist, do nothing
if not os.path.isdir(direct):
return
# if the path has not already been loaded, save it in the _loaddir
# list for use on reloading
if direct not in _loaddir:
_loaddir.append(direct)
# add the directory to the python search path
sys.path.append(direct)
pymod = compile(r"^(.*)\.py$")
# loop through each file in the directory, looking for files that
# have a .py extention, and attempt to load the file. If it succeeds,
# add it to the _success list. If it fails, add it to the _failure
# list
for filename in os.listdir(direct):
name = os.path.split(filename)
match = pymod.match(name[1])
if not match:
continue
_attempt.append(filename)
plugin = match.groups()[0]
try:
a = __import__(plugin)
_success.append(a)
except Errors.PluginError, msg:
_expect.append((filename,str(msg)))
except:
_failmsg.append((filename,sys.exc_info()))
if GrampsGconfKeys.get_pop_plugin_status() and len(_expect)+len(_failmsg):
PluginStatus()
#-------------------------------------------------------------------------
#
# reload_plugins
#
#-------------------------------------------------------------------------
def reload_plugins(obj=None,junk1=None,junk2=None,junk3=None):
"""Treated as a callback, causes all plugins to get reloaded. This is
useful when writing and debugging a plugin"""
pymod = compile(r"^(.*)\.py$")
global _success,_attempt,_loaddir,_failmsg
oldfailmsg = _failmsg[:]
_failmsg = []
# attempt to reload all plugins that have succeeded in the past
for plugin in _success:
filename = os.path.basename(plugin.__file__)
filename = filename.replace('pyc','py')
filename = filename.replace('pyo','py')
try:
reload(plugin)
except:
_failmsg.append((filename,sys.exc_info()))
# attempt to load the plugins that have failed in the past
for (filename,message) in oldfailmsg:
name = os.path.split(filename)
match = pymod.match(name[1])
if not match:
continue
_attempt.append(filename)
plugin = match.groups()[0]
try:
# For some strange reason second importing of a failed plugin
# results in success. Then reload reveals the actual error.
# Looks like a bug in Python.
a = __import__(plugin)
reload(a)
_success.append(a)
except:
_failmsg.append((filename,sys.exc_info()))
# attempt to load any new files found
for directory in _loaddir:
for filename in os.listdir(directory):
name = os.path.split(filename)
match = pymod.match(name[1])
if not match:
continue
if filename in _attempt:
continue
_attempt.append(filename)
plugin = match.groups()[0]
try:
a = __import__(plugin)
if a not in _success:
_success.append(a)
except:
_failmsg.append((filename,sys.exc_info()))
if GrampsGconfKeys.get_pop_plugin_status():
global _status_up
if len(_failmsg):
PluginStatus()
elif _status_up:
_status_up.close(None)
_status_up = None
#-------------------------------------------------------------------------
#
# Plugin registering
#
#-------------------------------------------------------------------------
def register_export(exportData,title,description='',config=None,filename=''):
"""
Register an export filter, taking the task, file filter,
and the list of patterns for the filename matching.
"""
if description and filename:
_exports.append((exportData,title,description,config,filename))
def register_import(task, ffilter, mime=None, native_format=0):
"""Register an import filter, taking the task and file filter"""
if mime:
_imports.append((task, ffilter, mime, native_format))
def register_tool(task, name,
category=_("Uncategorized"),
description=_unavailable,
status=_("Unknown"),
author_name=_("Unknown"),
author_email=_("Unknown")
):
"""Register a tool with the plugin system"""
del_index = -1
for i in range(0,len(_tools)):
val = _tools[i]
if val[2] == name:
del_index = i
if del_index != -1:
del _tools[del_index]
_tools.append((task, category, name, description, status, author_name, author_name))
#-------------------------------------------------------------------------
#
# Report registration
#
#-------------------------------------------------------------------------
def register_report(
name,
category,
report_class,
options_class,
modes,
translated_name,
status=_("Unknown"),
description=_unavailable,
author_name=_("Unknown"),
author_email=_("Unknown")
):
"""
Registers report for all possible flavors.
This function should be used to register report as a stand-alone,
book item, or command-line flavor in any combination of those.
The low-level functions (starting with '_') should not be used
on their own. Instead, this function will call them as needed.
"""
(junk,standalone_task) = divmod(modes,2**Report.MODE_GUI)
if standalone_task:
_register_standalone(report_class,options_class,translated_name,
name,category,description,
status,author_name,author_email)
(junk,book_item_task) = divmod(modes-standalone_task,2**Report.MODE_BKI)
if book_item_task:
book_item_category = const.book_categories[category]
_register_book_item(translated_name,book_item_category,
report_class,options_class,name)
(junk,command_line_task) = divmod(modes-standalone_task-book_item_task,
2**Report.MODE_CLI)
if command_line_task:
_register_cl_report(name,category,report_class,options_class)
def _register_standalone(report_class, options_class, translated_name,
name, category,
description=_unavailable,
status=_("Unknown"),
author_name=_("Unknown"),
author_email=_("Unknown")
):
"""Register a report with the plugin system"""
del_index = -1
for i in range(0,len(_reports)):
val = _reports[i]
if val[2] == name:
del_index = i
if del_index != -1:
del _reports[del_index]
_reports.append((report_class, options_class, translated_name,
category, name, description, status, author_name, author_email))
def _register_book_item(translated_name,category,report_class,option_class,name):
"""Register a book item"""
for n in _bkitems:
if n[0] == name:
return
_bkitems.append((translated_name,category,report_class,option_class,name))
def _register_cl_report(name,category,report_class,options_class):
for n in _cl:
if n[0] == name:
return
_cl.append((name,category,report_class,options_class))
#-------------------------------------------------------------------------
#
# Text document generator registration
#
#-------------------------------------------------------------------------
def register_text_doc(name,classref, table, paper, style, ext,
print_report_label=None,clname=''):
"""Register a text document generator"""
for n in _textdoc:
if n[0] == name:
return
if not clname:
clname = ext[1:]
_textdoc.append((name,classref,table,paper,style,ext,print_report_label,clname))
#-------------------------------------------------------------------------
#
# Book document generator registration
#
#-------------------------------------------------------------------------
def register_book_doc(name,classref, table, paper, style, ext, clname=''):
"""Register a text document generator"""
for n in _bookdoc:
if n[0] == name:
return
if not clname:
clname = ext[1:]
_bookdoc.append((name,classref,table,paper,style,ext,clname))
#-------------------------------------------------------------------------
#
# Drawing document generator registration
#
#-------------------------------------------------------------------------
def register_draw_doc(name,classref,paper,style, ext,
print_report_label=None,clname=''):
"""Register a drawing document generator"""
for n in _drawdoc:
if n[0] == name:
return
if not clname:
clname = ext[1:]
_drawdoc.append((name,classref,paper,style,ext,print_report_label,clname))
#-------------------------------------------------------------------------
#
# Relationship calculator registration
#
#-------------------------------------------------------------------------
def register_relcalc(relclass, languages):
"""Register a relationshp calculator"""
global _relcalc_class
try:
if os.environ["LANG"] in languages:
_relcalc_class = relclass
except:
pass
def relationship_class(db):
global _relcalc_class
return _relcalc_class(db)
#-------------------------------------------------------------------------
#
# Image attributes
#
#-------------------------------------------------------------------------
_image_attributes = []
def register_image_attribute(name):
if name not in _image_attributes:
_image_attributes.append(name)
def get_image_attributes():
return _image_attributes
#-------------------------------------------------------------------------
#
# Building pulldown menus
@ -790,7 +456,7 @@ def build_report_menu(top_menu,callback):
report_menu.show()
hash_data = {}
for report in _reports:
for report in PluginMgr.report_list:
standalone_category = const.standalone_categories[report[3]]
if hash_data.has_key(standalone_category):
hash_data[standalone_category].append(
@ -827,7 +493,7 @@ def build_report_menu(top_menu,callback):
#
#-------------------------------------------------------------------------
def build_tools_menu(top_menu,callback):
build_menu(top_menu,_tools,callback)
build_menu(top_menu,PluginMgr.tool_list,callback)
#-------------------------------------------------------------------------
#
@ -966,53 +632,3 @@ class GrampsBookFormatComboBox(gtk.ComboBox):
def get_printable(self):
return self.data[self.get_active()][6]
#-------------------------------------------------------------------------
#
# get_text_doc_list
#
#-------------------------------------------------------------------------
def get_text_doc_list():
l = []
_textdoc.sort()
for item in _textdoc:
l.append(item[0])
return l
#-------------------------------------------------------------------------
#
# get_book_doc_list
#
#-------------------------------------------------------------------------
def get_book_doc_list():
l = []
_bookdoc.sort()
for item in _bookdoc:
l.append(item[0])
return l
#-------------------------------------------------------------------------
#
# get_draw_doc_list
#
#-------------------------------------------------------------------------
def get_draw_doc_list():
l = []
_drawdoc.sort()
for item in _drawdoc:
l.append(item[0])
return l
#-------------------------------------------------------------------------
#
# Register the plugin reloading tool
#
#-------------------------------------------------------------------------
register_tool(
reload_plugins,
_("Reload plugins"),
category=_("Debug"),
description=_("Attempt to reload plugins. Note: This tool itself is not reloaded!"),
)

View File

@ -2014,5 +2014,5 @@ def create_id():
#
#
#-------------------------------------------------------------------------
from Plugins import register_import
from PluginMgr import register_import
register_import(importData,_filter,_mime_type,1)

View File

@ -1440,5 +1440,5 @@ _filter = gtk.FileFilter()
_filter.set_name(_('GRAMPS XML databases'))
_filter.add_pattern(_mime_type)
from Plugins import register_import
from PluginMgr import register_import
register_import(importData,_filter,_mime_type,1)

View File

@ -1240,5 +1240,5 @@ _description = _('GEDCOM is used to transfer data between genealogy programs. '
_config = (_('GEDCOM export options'),GedcomWriterOptionBox)
_filename = 'ged'
from Plugins import register_export
from PluginMgr import register_export
register_export(exportData,_title,_description,_config,_filename)

View File

@ -899,5 +899,5 @@ _description = _('The GRAMPS XML database is a format used by older '
_config = None
_filename = 'gramps'
from Plugins import register_export
from PluginMgr import register_export
register_export(exportData,_title,_description,_config,_filename)

View File

@ -875,7 +875,6 @@ lds_ssealing = [
_("Submitted"), _("Uncleared"),
]
logical_functions = ['or', 'and', 'xor', 'one']
notes_formats = [
_("Flowed"),

View File

@ -35,7 +35,7 @@ import os
import BaseDoc
import Errors
import Plugins
import PluginMgr
import ImgManip
import GrampsMime
@ -327,6 +327,6 @@ try:
print_label=_("Open in %s") % prog[1]
else:
print_label=None
Plugins.register_text_doc(mtype,AbiWordDoc,1,1,1,".abw", print_label)
PluginMgr.register_text_doc(mtype,AbiWordDoc,1,1,1,".abw", print_label)
except:
Plugins.register_text_doc(_('AbiWord document'),AbiWordDoc,1,1,1,".abw", None)
PluginMgr.register_text_doc(_('AbiWord document'),AbiWordDoc,1,1,1,".abw", None)

View File

@ -35,7 +35,7 @@ import GrampsMime
#
#------------------------------------------------------------------------
import BaseDoc
import Plugins
import PluginMgr
import Errors
from gettext import gettext as _
@ -367,7 +367,7 @@ try:
else:
print_label=None
Plugins.register_text_doc(mtype,AsciiDoc,1,1,1,".txt", print_label)
PluginMgr.register_text_doc(mtype,AsciiDoc,1,1,1,".txt", print_label)
except:
Plugins.register_text_doc(_("Plain Text"),AsciiDoc,1,1,1,".txt", None)
PluginMgr.register_text_doc(_("Plain Text"),AsciiDoc,1,1,1,".txt", None)

View File

@ -25,7 +25,7 @@ import string
import re
import time
import Plugins
import PluginMgr
import ImgManip
import TarFile
import const
@ -486,6 +486,6 @@ try:
print_label=_("Open in %s") % prog[1]
else:
print_label=None
Plugins.register_text_doc(mtype,HtmlDoc,1,0,1,".html", print_label)
PluginMgr.register_text_doc(mtype,HtmlDoc,1,0,1,".html", print_label)
except:
Plugins.register_text_doc(_('HTML'),HtmlDoc,1,0,1,".html", None)
PluginMgr.register_text_doc(_('HTML'),HtmlDoc,1,0,1,".html", None)

View File

@ -31,7 +31,7 @@ import os
import Errors
from TarFile import TarFile
import Plugins
import PluginMgr
import ImgManip
import GrampsMime
@ -495,7 +495,7 @@ try:
print_label=_("Open in %s") % prog[1]
else:
print_label=None
Plugins.register_text_doc(mtype, KwordDoc, 1, 0, 1, ".kwd", print_label)
PluginMgr.register_text_doc(mtype, KwordDoc, 1, 0, 1, ".kwd", print_label)
except:
Plugins.register_text_doc(_('KWord'), KwordDoc, 1, 0, 1, ".kwd", print_label)
PluginMgr.register_text_doc(_('KWord'), KwordDoc, 1, 0, 1, ".kwd", print_label)

View File

@ -61,7 +61,7 @@ else:
#
#------------------------------------------------------------------------
import BaseDoc
import Plugins
import PluginMgr
#------------------------------------------------------------------------
#
@ -1161,7 +1161,7 @@ class LPRDoc(BaseDoc.BaseDoc):
# Register the document generator with the system
#
#------------------------------------------------------------------------
Plugins.register_text_doc(
PluginMgr.register_text_doc(
name=_("Print..."),
classref=LPRDoc,
table=1,
@ -1172,7 +1172,7 @@ Plugins.register_text_doc(
clname='print')
Plugins.register_book_doc(
PluginMgr.register_book_doc(
_("Print..."),
LPRDoc,
1,
@ -1181,7 +1181,7 @@ Plugins.register_book_doc(
"",
'print')
Plugins.register_draw_doc(
PluginMgr.register_draw_doc(
_("Print..."),
LPRDoc,
1,

View File

@ -40,7 +40,7 @@ import string
#
#------------------------------------------------------------------------
import BaseDoc
import Plugins
import PluginMgr
import ImgManip
import Errors
@ -425,7 +425,7 @@ class LaTeXDoc(BaseDoc.BaseDoc):
# Register the document generator with the system
#
#------------------------------------------------------------------------
Plugins.register_text_doc(
PluginMgr.register_text_doc(
name=_("LaTeX"),
classref=LaTeXDoc,
table=1,

View File

@ -41,7 +41,7 @@ from math import pi, cos, sin, fabs
import Errors
import BaseDoc
import const
import Plugins
import PluginMgr
import ImgManip
import FontScale
import GrampsMime
@ -975,10 +975,10 @@ try:
else:
print_label = None
Plugins.register_text_doc(mtype,OpenOfficeDoc,1,1,1,".sxw",print_label)
Plugins.register_book_doc(mtype,OpenOfficeDoc,1,1,1,".sxw")
Plugins.register_draw_doc(mtype,OpenOfficeDoc,1,1, ".sxw",print_label);
PluginMgr.register_text_doc(mtype,OpenOfficeDoc,1,1,1,".sxw",print_label)
PluginMgr.register_book_doc(mtype,OpenOfficeDoc,1,1,1,".sxw")
PluginMgr.register_draw_doc(mtype,OpenOfficeDoc,1,1, ".sxw",print_label);
except:
Plugins.register_text_doc(_('OpenOffice.org Writer'), OpenOfficeDoc,1,1,1,".sxw", None)
Plugins.register_book_doc(_("OpenOffice.org Writer"), OpenOfficeDoc,1,1,1,".sxw")
Plugins.register_draw_doc(_("OpenOffice.org Writer"), OpenOfficeDoc,1,1,".sxx",None);
PluginMgr.register_text_doc(_('OpenOffice.org Writer'), OpenOfficeDoc,1,1,1,".sxw", None)
PluginMgr.register_book_doc(_("OpenOffice.org Writer"), OpenOfficeDoc,1,1,1,".sxw")
PluginMgr.register_draw_doc(_("OpenOffice.org Writer"), OpenOfficeDoc,1,1,".sxx",None);

View File

@ -31,7 +31,7 @@ from math import pi, cos, sin
# Gramps modules
#
#-------------------------------------------------------------------------
import Plugins
import PluginMgr
import Errors
import BaseDoc
from Report import run_print_dialog
@ -401,5 +401,5 @@ def rgb_color(color):
b = float(color[2])/255.0
return (r,g,b)
Plugins.register_draw_doc(_("PostScript"),PSDrawDoc,1,1,".ps",
PluginMgr.register_draw_doc(_("PostScript"),PSDrawDoc,1,1,".ps",
_("Print a copy"));

View File

@ -26,7 +26,7 @@
#
#------------------------------------------------------------------------
import BaseDoc
import Plugins
import PluginMgr
import Errors
import ImgManip
import GrampsMime
@ -589,10 +589,10 @@ try:
print_label=_("Open in %s") % mprog[1]
else:
print_label=None
Plugins.register_text_doc(mtype, PdfDoc, 1, 0, 1, ".pdf", print_label)
Plugins.register_draw_doc(mtype, PdfDoc, 1, 1, ".pdf", print_label)
Plugins.register_book_doc(mtype,classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf")
PluginMgr.register_text_doc(mtype, PdfDoc, 1, 0, 1, ".pdf", print_label)
PluginMgr.register_draw_doc(mtype, PdfDoc, 1, 1, ".pdf", print_label)
PluginMgr.register_book_doc(mtype,classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf")
except:
Plugins.register_text_doc(_('PDF document'), PdfDoc, 1, 0, 1,".pdf", None)
Plugins.register_draw_doc(_('PDF document'), PdfDoc, 1, 1, ".pdf", None)
Plugins.register_book_doc(name=_("PDF document"),classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf")
PluginMgr.register_text_doc(_('PDF document'), PdfDoc, 1, 0, 1,".pdf", None)
PluginMgr.register_draw_doc(_('PDF document'), PdfDoc, 1, 1, ".pdf", None)
PluginMgr.register_book_doc(name=_("PDF document"),classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf")

View File

@ -35,7 +35,7 @@ import GrampsMime
#
#------------------------------------------------------------------------
import BaseDoc
import Plugins
import PluginMgr
import ImgManip
import Errors
@ -429,6 +429,6 @@ try:
print_label=_("Open in %s") % mprog[1]
else:
print_label=None
Plugins.register_text_doc(mtype, RTFDoc, 1, 0, 1, ".rtf", print_label)
PluginMgr.register_text_doc(mtype, RTFDoc, 1, 0, 1, ".rtf", print_label)
except:
Plugins.register_text_doc(_('RTF document'), RTFDoc, 1, 0, 1, ".rtf", None)
PluginMgr.register_text_doc(_('RTF document'), RTFDoc, 1, 0, 1, ".rtf", None)

View File

@ -33,7 +33,7 @@ from math import pi, cos, sin, fabs
# Gramps modules
#
#-------------------------------------------------------------------------
import Plugins
import PluginMgr
from gettext import gettext as _
import BaseDoc
import Errors
@ -258,4 +258,4 @@ def units(val):
# Register document generator
#
#-------------------------------------------------------------------------
Plugins.register_draw_doc(_("SVG (Scalable Vector Graphics)"),SvgDrawDoc,1,1,".svg");
PluginMgr.register_draw_doc(_("SVG (Scalable Vector Graphics)"),SvgDrawDoc,1,1,".svg");

View File

@ -19539,7 +19539,7 @@ GNOME Settings</property>
<property name="selectable">False</property>
<property name="xalign">1</property>
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
@ -19563,7 +19563,7 @@ GNOME Settings</property>
<property name="selectable">False</property>
<property name="xalign">1</property>
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>

View File

@ -63,6 +63,7 @@ import GenericFilter
import DisplayTrace
import const
import Plugins
import PluginMgr
import Utils
import Bookmarks
import GrampsGconfKeys
@ -140,7 +141,7 @@ class Gramps:
"contain bugs which could corrupt your database."))
GrampsGconfKeys.save_betawarn(1)
self.RelClass = Plugins.relationship_class
self.RelClass = PluginMgr.relationship_class
self.relationship = self.RelClass(self.db)
self.gtop = gtk.glade.XML(const.gladeFile, "gramps", "gramps")
self.init_interface()
@ -820,15 +821,15 @@ class Gramps:
self.report_menu.set_sensitive(0)
self.tools_menu.set_sensitive(0)
Plugins.load_plugins(const.docgenDir)
Plugins.load_plugins(os.path.expanduser("~/.gramps/docgen"))
Plugins.load_plugins(const.pluginsDir)
Plugins.load_plugins(os.path.expanduser("~/.gramps/plugins"))
PluginMgr.load_plugins(const.docgenDir)
PluginMgr.load_plugins(os.path.expanduser("~/.gramps/docgen"))
PluginMgr.load_plugins(const.pluginsDir)
PluginMgr.load_plugins(os.path.expanduser("~/.gramps/plugins"))
Plugins.build_report_menu(self.report_menu,self.menu_report)
Plugins.build_tools_menu(self.tools_menu,self.menu_tools)
self.RelClass = Plugins.relationship_class
self.RelClass = PluginMgr.relationship_class
self.relationship = self.RelClass(self.db)
def init_filters(self):

View File

@ -264,7 +264,7 @@ class AncestorChartOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'ancestor_chart',
category = const.CATEGORY_DRAW,

View File

@ -515,7 +515,7 @@ class AncestorChartOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'ancestor_chart2',
category = const.CATEGORY_DRAW,

View File

@ -295,7 +295,7 @@ class AncestorOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'ancestor_report',
category = const.CATEGORY_TEXT,

View File

@ -44,7 +44,7 @@ import const
import Report
import BaseDoc
import RelLib
import Plugins
import PluginMgr
import ReportOptions
from DateHandler import displayer as _dd
@ -83,7 +83,7 @@ class ComprehensiveAncestorsReport (Report.Report):
self.sources = []
self.sourcerefs = []
self.RelClass = Plugins.relationship_class
self.RelClass = PluginMgr.relationship_class
self.relationship = self.RelClass(database)
table = BaseDoc.TableStyle ()
@ -988,7 +988,7 @@ class ComprehensiveAncestorsOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
Plugins.register_report(
PluginMgr.register_report(
name = 'ancestors_report',
category = const.CATEGORY_TEXT,
report_class = ComprehensiveAncestorsReport,

View File

@ -58,7 +58,7 @@ from RelLib import Person
import const
import Utils
import ListModel
import Plugins
import PluginMgr
import Report
import BaseDoc
from QuestionDialog import WarningDialog
@ -110,7 +110,7 @@ class BookItem:
"""
self.clear()
for item in Plugins._bkitems:
for item in PluginMgr.bkitems_list:
if item[0] == name:
self.name = item[0]
self.category = item[1]
@ -642,10 +642,10 @@ class BookReportSelector:
The selections are read from the book item registry.
"""
if not Plugins._bkitems:
if not PluginMgr.bkitems_list:
return
for book_item in Plugins._bkitems:
for book_item in PluginMgr.bkitems_list:
data = [ book_item[0], book_item[1] ]
new_iter = self.av_model.add(data)
@ -1097,7 +1097,7 @@ def cl_report(database,name,category,options_str_dict):
#
#
#------------------------------------------------------------------------
Plugins.register_report(
PluginMgr.register_report(
name = 'book',
category = const.CATEGORY_BOOK,
report_class = BookReportSelector,

View File

@ -182,7 +182,7 @@ class ChangeNames:
#
#
#------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -104,7 +104,7 @@ class ChangeTypes:
#
#
#------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -406,7 +406,7 @@ class CheckIntegrity:
#
#
#------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -111,7 +111,7 @@ class CountAncestors:
#
#
#-------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'count_ancestors',
category = const.CATEGORY_VIEW,

View File

@ -280,7 +280,7 @@ def write_book_item(database,person,doc,options,newpage=0):
#
#
#------------------------------------------------------------------------
from Plugins import register_book_item
from PluginMgr import register_book_item
# (name,category,options_dialog,write_book_item,options,style_name,style_file,make_default_style)
register_book_item(

View File

@ -338,7 +338,7 @@ class DescendantGraphOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'descendant_graph',
category = const.CATEGORY_DRAW,

View File

@ -143,7 +143,7 @@ class DesBrowse:
#
#
#------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -187,7 +187,7 @@ class DescendantOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'descend_report',
category = const.CATEGORY_TEXT,

View File

@ -964,7 +964,7 @@ class DetAncestorOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'det_ancestor_report',
category = const.CATEGORY_TEXT,

View File

@ -977,7 +977,7 @@ class DetDescendantOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'det_descendant_report',
category = const.CATEGORY_TEXT,

View File

@ -106,7 +106,7 @@ class EvalWindow:
#
#
#------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
def runtool(database,person,callback,parent):
EvalWindow(parent)

View File

@ -441,7 +441,7 @@ class DisplayChart:
#
#
#-------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -537,7 +537,7 @@ class FamilyGroupOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'family_group',
category = const.CATEGORY_TEXT,

View File

@ -317,7 +317,7 @@ class FanChartOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'fan_chart',
category = const.CATEGORY_DRAW,

View File

@ -842,7 +842,7 @@ def SystemFilterEditor(database,person,callback,parent=None):
#
#
#-------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
CustomFilterEditor,

View File

@ -1100,7 +1100,7 @@ class FtmAncestorOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'ftm_ancestor_report',

View File

@ -1529,7 +1529,7 @@ class FtmDescendantOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'ftm_descendant_report',
category = const.CATEGORY_TEXT,

View File

@ -541,7 +541,7 @@ def get_description():
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
import sys
ver = sys.version_info

View File

@ -685,5 +685,6 @@ _filter = gtk.FileFilter()
_filter.set_name(_('GeneWeb files'))
_filter.add_mime_type(_mime_type)
from Plugins import register_import
from PluginMgr import register_import
register_import(importData,_filter,_mime_type,1)

View File

@ -590,7 +590,8 @@ class IndivCompleteOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'indiv_complete',
category = const.CATEGORY_TEXT,

View File

@ -384,7 +384,8 @@ class IndivSummaryOptions(ReportOptions.ReportOptions):
# Register plugins
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'individual_summary',
category = const.CATEGORY_TEXT,

View File

@ -95,7 +95,7 @@ class Leak:
#
#
#------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
def runtool(database,person,callback,parent=None):
Leak(parent)

View File

@ -650,7 +650,7 @@ def by_id(p1,p2):
#
#
#-------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -220,7 +220,7 @@ def report(db, person):
#
#
#-------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
report,

View File

@ -299,7 +299,7 @@ class PatchNames:
#
#
#------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -104,6 +104,6 @@ class ReadNative:
# Register with the plugin system
#
#------------------------------------------------------------------------
from Plugins import register_import
from PluginMgr import register_import
register_import(readData,_title_string)

View File

@ -187,5 +187,6 @@ _filter = gtk.FileFilter()
_filter.set_name(_('GRAMPS packages'))
_filter.add_mime_type(_mime_type)
from Plugins import register_import
from PluginMgr import register_import
register_import(impData,_filter,_mime_type)

View File

@ -46,7 +46,7 @@ import RelLib
import Utils
import NameDisplay
import ListModel
import Plugins
import PluginMgr
from gettext import gettext as _
#-------------------------------------------------------------------------
@ -70,7 +70,7 @@ class RelCalc:
def __init__(self,database,person,parent):
self.person = person
self.db = database
self.RelClass = Plugins.relationship_class
self.RelClass = PluginMgr.relationship_class
self.relationship = self.RelClass(database)
self.parent = parent
self.win_key = self
@ -200,7 +200,7 @@ class RelCalc:
#
#-------------------------------------------------------------------------
Plugins.register_tool(
PluginMgr.register_tool(
runTool,
_("Relationship calculator"),
category=_("Utilities"),

View File

@ -122,7 +122,7 @@ class ReorderIds:
#
#
#-------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -466,7 +466,7 @@ def write_book_item(database,person,doc,options,newpage=0):
#
#
#------------------------------------------------------------------------
from Plugins import register_book_item
from PluginMgr import register_book_item
# (name,category,options_dialog,write_book_item,options,style_name,style_file,make_default_style)
register_book_item(

View File

@ -126,7 +126,7 @@ class SoundGen:
#
#
#-------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -166,7 +166,8 @@ class SummaryReport:
#
#
#-------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'summary',
category = const.CATEGORY_VIEW,

View File

@ -469,7 +469,8 @@ class TimeLineOptions(ReportOptions.ReportOptions):
#
#
#------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
name = 'timeline',
category = const.CATEGORY_DRAW,

View File

@ -508,7 +508,7 @@ class Verify:
#
#
#-------------------------------------------------------------------------
from Plugins import register_tool
from PluginMgr import register_tool
register_tool(
runTool,

View File

@ -72,8 +72,6 @@ _month = [
_hline = " " # Everything is underlined, so use blank
_BORN = _('b.')
_dd = DateHandler.create_display()
#------------------------------------------------------------------------
#
# HtmlLinkDoc
@ -235,7 +233,7 @@ class IndividualPage:
self.write_info(base.get_title())
self.write_info(base.get_author())
self.write_info(base.get_publication_info())
self.write_info(_dd.display(sref.get_date()))
self.write_info(DateHander.displayer.display(sref.get_date()))
self.write_info(sref.get_page())
if self.usecomments:
self.write_info(sref.get_text())
@ -799,7 +797,7 @@ class WebReport(Report.Report):
else:
continue
if e:
f.write("%s|" % _dd.display(e.get_date_object()))
f.write("%s|" % DateHander.displayer.display(e.get_date_object()))
if e.get_place_handle():
f.write('%s|' % self.db.get_place_from_handle(e.get_place_handle()).get_title())
else:
@ -1744,7 +1742,7 @@ def report(database,person):
#
#
#-------------------------------------------------------------------------
from Plugins import register_report
from PluginMgr import register_report
register_report(
report,

View File

@ -311,6 +311,6 @@ class PackageWriter:
# Register the plugin
#
#-------------------------------------------------------------------------
from Plugins import register_export
from PluginMgr import register_export
register_export(writeData,_title_string)

View File

@ -266,6 +266,6 @@ def get_name(name,count):
# Register the plugin
#
#-------------------------------------------------------------------------
from Plugins import register_export
from PluginMgr import register_export
register_export(writeData,_title_string)

View File

@ -582,5 +582,6 @@ _description = _('GeneWeb is a web based genealogy program.')
_config = (_('GeneWeb export options'),GeneWebWriterOptionBox)
_filename = 'gw'
from Plugins import register_export
from PluginMgr import register_export
register_export(exportData,_title,_description,_config,_filename)

View File

@ -202,5 +202,6 @@ _filter.set_name(_('GRAMPS packages'))
_filter.add_mime_type(_mime_type)
_ext_list = ('.gpkg',)
from Plugins import register_export
from PluginMgr import register_export
register_export(writeData,_filter,_ext_list)

View File

@ -177,8 +177,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Register this class with the Plugins system
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["da","DA","da_DK","danish","Danish","da_DK.UTF8","da_DK@euro","da_DK.UTF8@euro",
"dansk","Dansk", "da_DK.UTF-8", "da_DK.utf-8", "da_DK.utf8"])
[ "da", "DA", "da_DK", "danish", "Danish", "da_DK.UTF8",
"da_DK@euro", "da_DK.UTF8@euro", "dansk", "Dansk",
"da_DK.UTF-8", "da_DK.utf-8", "da_DK.utf8"])

View File

@ -391,7 +391,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Register this class with the Plugins system
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["de","DE","de_DE","deutsch","Deutsch","de_DE.UTF8","de_DE@euro","de_DE.UTF8@euro",

View File

@ -316,7 +316,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Register this function with the Plugins system
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["es","ES","es_ES","espanol","Espanol","es_ES.UTF8","es_ES@euro","es_ES.UTF8@euro",

View File

@ -216,7 +216,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Register this class with the Plugins system
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["fi","FI","fi_FI","finnish","Finnish","fi_FI.UTF8","fi_FI@euro","fi_FI.UTF8@euro",

View File

@ -218,7 +218,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Register this class with the Plugins system
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["fr","FR","fr_FR","francais","Francais","fr_FR.UTF8","fr_FR@euro","fr_FR.UTF8@euro",

View File

@ -33,7 +33,7 @@
import RelLib
import Date
import Relationship
from Plugins import register_relcalc
from PluginMgr import register_relcalc
import types
from gettext import gettext as _

View File

@ -200,7 +200,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Function registration
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["it", "IT", "it_IT", "it_IT@euro", "it_IT.utf8"])

View File

@ -273,7 +273,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Register this class with the Plugins system
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["nb","nn","no", "nb_NO","nn_NO","no_NO","nb_NO.UTF8","nn_NO.UTF8","no_NO.UTF8",

View File

@ -260,7 +260,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Register this class with the Plugins system
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["ru","RU","ru_RU","koi8r","ru_koi8r","russian","Russian","ru_RU.koi8r","ru_RU.KOI8-R","ru_RU.utf8","ru_RU.UTF8", "ru_RU.utf-8","ru_RU.UTF-8","ru_RU.iso88595","ru_RU.iso8859-5","ru_RU.iso-8859-5"])

View File

@ -224,7 +224,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# Register this class with the Plugins system
#
#-------------------------------------------------------------------------
from Plugins import register_relcalc
from PluginMgr import register_relcalc
register_relcalc(RelationshipCalculator,
["sv","SV","sv_SE","swedish","Swedish","sv_SE.UTF8","sv_SE@euro","sv_SE.UTF8@euro",