3292: register plugins, load on need, not on start of GRAMPS - GEPS 014
svn: r13400
This commit is contained in:
parent
d1fbb2bff9
commit
ed619cfdd6
@ -377,13 +377,13 @@ src/Selectors/__init__.py
|
||||
|
||||
# plugins directory
|
||||
src/plugins/BookReport.py
|
||||
src/plugins/export/ExportXml.py
|
||||
src/plugins/import/ImportGpkg.py
|
||||
src/plugins/import/ImportXml.py
|
||||
src/plugins/bookreport.gpr.py
|
||||
src/plugins/records.gpr.py
|
||||
src/plugins/Records.py
|
||||
|
||||
# plugins/docgen directory
|
||||
src/plugins/docgen/AsciiDoc.py
|
||||
src/plugins/docgen/docgen.gpr.py
|
||||
src/plugins/docgen/GtkPrint.py
|
||||
src/plugins/docgen/HtmlDoc.py
|
||||
src/plugins/docgen/LaTeXDoc.py
|
||||
@ -396,11 +396,13 @@ src/plugins/docgen/SvgDrawDoc.py
|
||||
src/plugins/drawreport/AncestorTree.py
|
||||
src/plugins/drawreport/Calendar.py
|
||||
src/plugins/drawreport/DescendTree.py
|
||||
src/plugins/drawreport/drawplugins.gpr.py
|
||||
src/plugins/drawreport/FanChart.py
|
||||
src/plugins/drawreport/StatisticsChart.py
|
||||
src/plugins/drawreport/TimeLine.py
|
||||
|
||||
# plugins/export directory
|
||||
src/plugins/export/export.gpr.py
|
||||
src/plugins/export/ExportCsv.py
|
||||
src/plugins/export/ExportFtree.py
|
||||
src/plugins/export/ExportGedcom.py
|
||||
@ -409,6 +411,7 @@ src/plugins/export/ExportPkg.py
|
||||
#src/plugins/export/ExportSql.py
|
||||
src/plugins/export/ExportVCalendar.py
|
||||
src/plugins/export/ExportVCard.py
|
||||
src/plugins/export/ExportXml.py
|
||||
|
||||
# plugins/gramplet directory
|
||||
src/plugins/gramplet/AgeOnDateGramplet.py
|
||||
@ -418,6 +421,7 @@ src/plugins/gramplet/CalendarGramplet.py
|
||||
src/plugins/gramplet/DescendGramplet.py
|
||||
src/plugins/gramplet/FanChartGramplet.py
|
||||
src/plugins/gramplet/GivenNameGramplet.py
|
||||
src/plugins/gramplet/gramplet.gpr.py
|
||||
src/plugins/gramplet/PedigreeGramplet.py
|
||||
src/plugins/gramplet/QuickViewGramplet.py
|
||||
src/plugins/gramplet/RelativeGramplet.py
|
||||
@ -430,17 +434,21 @@ src/plugins/gramplet/WelcomeGramplet.py
|
||||
src/plugins/gramplet/WhatsNext.py
|
||||
|
||||
# plugins/graph directory
|
||||
src/plugins/graph/graphplugins.gpr.py
|
||||
src/plugins/graph/GVFamilyLines.py
|
||||
src/plugins/graph/GVHourGlass.py
|
||||
src/plugins/graph/GVRelGraph.py
|
||||
|
||||
# plugins/import directory
|
||||
src/plugins/import/import.gpr.py
|
||||
src/plugins/import/ImportCsv.py
|
||||
src/plugins/import/ImportGedcom.py
|
||||
src/plugins/import/ImportGeneWeb.py
|
||||
src/plugins/import/ImportGrdb.py
|
||||
src/plugins/import/ImportProGen.py
|
||||
src/plugins/import/ImportVCard.py
|
||||
src/plugins/import/ImportGpkg.py
|
||||
src/plugins/import/ImportXml.py
|
||||
|
||||
# plugins/lib directory
|
||||
src/plugins/lib/libcairodoc.py
|
||||
@ -450,10 +458,13 @@ src/plugins/lib/libhtml.py
|
||||
src/plugins/lib/libhtmlbackend.py
|
||||
src/plugins/lib/libhtmlconst.py
|
||||
src/plugins/lib/libmapservice.py
|
||||
src/plugins/lib/libodfbackend.py
|
||||
src/plugins/lib/libplugins.gpr.py
|
||||
|
||||
# plugins/mapservices directory
|
||||
src/plugins/mapservices/eniroswedenmap.py
|
||||
src/plugins/mapservices/googlemap.py
|
||||
src/plugins/mapservices/mapservice.gpr.py
|
||||
src/plugins/mapservices/openstreetmap.py
|
||||
|
||||
# plugins/quickview directory
|
||||
@ -465,12 +476,14 @@ src/plugins/quickview/FilterByName.py
|
||||
src/plugins/quickview/lineage.py
|
||||
src/plugins/quickview/OnThisDay.py
|
||||
#src/plugins/quickview/Query.py
|
||||
src/plugins/quickview/quickview.gpr.py
|
||||
src/plugins/quickview/References.py
|
||||
src/plugins/quickview/Reporef.py
|
||||
src/plugins/quickview/SameSurnames.py
|
||||
src/plugins/quickview/siblings.py
|
||||
|
||||
# plugins/rel directory
|
||||
src/plugins/rel/relplugins.gpr.py
|
||||
src/plugins/rel/rel_cs.py
|
||||
src/plugins/rel/rel_da.py
|
||||
src/plugins/rel/rel_de.py
|
||||
@ -503,6 +516,7 @@ src/plugins/textreport/NumberOfAncestorsReport.py
|
||||
src/plugins/textreport/PlaceReport.py
|
||||
src/plugins/textreport/SimpleBookTitle.py
|
||||
src/plugins/textreport/Summary.py
|
||||
src/plugins/textreport/textplugins.gpr.py
|
||||
|
||||
# plugins/tool directory
|
||||
src/plugins/tool/CalculateEstimatedDates.py
|
||||
@ -527,11 +541,13 @@ src/plugins/tool/RemoveUnused.py
|
||||
src/plugins/tool/ReorderIds.py
|
||||
src/plugins/tool/SortEvents.py
|
||||
src/plugins/tool/SoundGen.py
|
||||
src/plugins/tool/tools.gpr.py
|
||||
src/plugins/tool/Verify.py
|
||||
|
||||
# plugins/webreport directory
|
||||
src/plugins/webreport/NarrativeWeb.py
|
||||
src/plugins/webreport/WebCal.py
|
||||
src/plugins/webreport/webplugins.gpr.py
|
||||
|
||||
# PluginUtils package
|
||||
src/PluginUtils/_GuiOptions.py
|
||||
|
@ -46,7 +46,7 @@ import config
|
||||
from DdTargets import DdTargets
|
||||
from Editors import EditEvent, DelEventQuery
|
||||
from Filters.SideBar import EventSidebarFilter
|
||||
from ReportBase import CATEGORY_QR_EVENT
|
||||
from gen.plug import CATEGORY_QR_EVENT
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -49,7 +49,7 @@ import Bookmarks
|
||||
import Errors
|
||||
import config
|
||||
from Filters.SideBar import FamilySidebarFilter
|
||||
from ReportBase import CATEGORY_QR_FAMILY
|
||||
from gen.plug import CATEGORY_QR_FAMILY
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -837,7 +837,7 @@ class PersonView(PageView.PersonNavView):
|
||||
|
||||
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||
|
||||
from ReportBase import CATEGORY_QR_PERSON
|
||||
from gen.plug import CATEGORY_QR_PERSON
|
||||
from QuickReports import create_quickreport_menu
|
||||
|
||||
menu = self.uistate.uimanager.get_widget('/Popup')
|
||||
|
@ -195,12 +195,12 @@ class PlaceView(ListView):
|
||||
|
||||
#select the map services to show
|
||||
self.mapservicedata = {}
|
||||
servlist = PluginManager.get_instance().get_mapservice_list()
|
||||
for i, service in zip(range(len(servlist)), servlist):
|
||||
key = service[2].replace(' ', '-')
|
||||
add_menuitem(menu, service[1], None,
|
||||
servlist = PluginManager.get_instance().get_reg_mapservices()
|
||||
for i, pdata in zip(range(len(servlist)), servlist):
|
||||
key = pdata.id.replace(' ', '-')
|
||||
add_menuitem(menu, pdata.name, None,
|
||||
make_callback(self.set_mapservice, key))
|
||||
self.mapservicedata[key] = (service[0], service[2], service[3])
|
||||
self.mapservicedata[key] = pdata
|
||||
|
||||
return menu
|
||||
|
||||
@ -220,7 +220,8 @@ class PlaceView(ListView):
|
||||
"""
|
||||
return the current label for the menutoolbutton
|
||||
"""
|
||||
return self.mapservicedata[self.mapservice][1]
|
||||
print 'called', self.mapservicedata[self.mapservice].name
|
||||
return self.mapservicedata[self.mapservice].name
|
||||
|
||||
def gotomap(self, obj):
|
||||
"""
|
||||
@ -249,7 +250,14 @@ class PlaceView(ListView):
|
||||
places = [(x, None) for x in place_handles]
|
||||
|
||||
#run the mapservice:
|
||||
self.mapservicedata[self.mapservice][0](self.dbstate.db, places)
|
||||
pmgr = PluginManager.get_instance()
|
||||
serv = self.mapservicedata[self.mapservice]
|
||||
mod = pmgr.load_plugin(serv)
|
||||
if mod:
|
||||
servfunc = eval('mod.' + serv.mapservice)
|
||||
servfunc()(self.dbstate.db, places)
|
||||
else:
|
||||
print 'Failed to load map plugin, see Plugin Status'
|
||||
|
||||
def drag_info(self):
|
||||
return DdTargets.PLACE_LINK
|
||||
|
@ -46,7 +46,7 @@ import config
|
||||
from Editors import EditRepository, DelRepositoryQuery
|
||||
from DdTargets import DdTargets
|
||||
from Filters.SideBar import RepoSidebarFilter
|
||||
from ReportBase import CATEGORY_QR_REPOSITORY
|
||||
from gen.plug import CATEGORY_QR_REPOSITORY
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -69,7 +69,7 @@ from DisplayTabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
|
||||
FamilyLdsEmbedList, ChildModel)
|
||||
from widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
|
||||
IconButton, LinkBox, BasicLabel)
|
||||
from ReportBase import CATEGORY_QR_FAMILY
|
||||
from gen.plug import CATEGORY_QR_FAMILY
|
||||
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
|
||||
MessageHideDialog)
|
||||
|
||||
|
@ -65,7 +65,7 @@ from DisplayTabs import (PersonEventEmbedList, NameEmbedList, SourceEmbedList,
|
||||
AttrEmbedList, AddrEmbedList, NoteTab, GalleryTab,
|
||||
WebEmbedList, PersonRefEmbedList, LdsEmbedList,
|
||||
PersonBackRefList)
|
||||
from ReportBase import CATEGORY_QR_PERSON
|
||||
from gen.plug import CATEGORY_QR_PERSON
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -42,7 +42,7 @@ from gettext import gettext as _
|
||||
import const
|
||||
from ReportBase import report, standalone_categories
|
||||
import _Tool
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug import PluginManager, REPORT, TOOL
|
||||
import ManagedWindow
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -64,7 +64,7 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
Displays the dialog box that allows the user to select the
|
||||
plugin that is desired.
|
||||
"""
|
||||
def __init__(self, state, uistate, track, item_list, categories, msg,
|
||||
def __init__(self, state, uistate, track, categories, msg,
|
||||
label=None, button_label=None, tool_tip=None,
|
||||
content=_REPORTS):
|
||||
"""
|
||||
@ -76,6 +76,7 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
self.imap = {}
|
||||
self.msg = msg
|
||||
self.content = content
|
||||
self._pmgr = PluginManager.get_instance()
|
||||
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, track,
|
||||
self.__class__)
|
||||
@ -121,7 +122,14 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
self.apply_button.set_tooltip_text(tool_tip)
|
||||
|
||||
self.item = None
|
||||
self.build_plugin_tree(item_list, categories)
|
||||
|
||||
if content == _REPORTS:
|
||||
reg_list = self._pmgr.get_reg_reports()
|
||||
elif content == _TOOLS:
|
||||
reg_list = self._pmgr.get_reg_tools()
|
||||
else:
|
||||
reg_list = []
|
||||
self.build_plugin_tree(reg_list, categories)
|
||||
self.show()
|
||||
|
||||
def rebuild(self):
|
||||
@ -133,19 +141,9 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
|
||||
def on_apply_clicked(self, obj):
|
||||
"""Execute the selected report"""
|
||||
try:
|
||||
(item_class, options_class, title, category,
|
||||
name, require_active) = self.item
|
||||
if self.content == _REPORTS:
|
||||
report(self.state, self.uistate, self.state.active,
|
||||
item_class, options_class, title, name,
|
||||
category, require_active)
|
||||
else:
|
||||
_Tool.gui_tool(self.state, self.uistate,
|
||||
item_class, options_class,title, name,category,
|
||||
self.state.db.request_rebuild)
|
||||
except TypeError:
|
||||
pass # ignore pressing apply without a plugin being selected
|
||||
if not self.item:
|
||||
return
|
||||
self.run_plugin(self.item)
|
||||
|
||||
def on_node_selected(self, obj):
|
||||
"""Updates the informational display on the right hand side of
|
||||
@ -156,28 +154,27 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
path = store.get_path(node)
|
||||
if not node or path not in self.imap:
|
||||
return
|
||||
data = self.imap[path]
|
||||
pdata = self.imap[path]
|
||||
|
||||
(report_class, options_class, title, category, name,
|
||||
doc,status,author,email,unsupported,require_active) = data
|
||||
self.description.set_text(doc)
|
||||
if unsupported:
|
||||
#(report_class, options_class, title, category, name,
|
||||
# doc,status,author,email,unsupported,require_active) = data
|
||||
self.description.set_text(pdata.description)
|
||||
if not pdata.supported:
|
||||
status = _UNSUPPORTED
|
||||
self.status.set_text(status)
|
||||
self.status.set_text(pdata.statustext())
|
||||
self.title.set_text('<span weight="bold" size="larger">%s</span>' \
|
||||
% title)
|
||||
% pdata.name)
|
||||
self.title.set_use_markup(1)
|
||||
self.author_name.set_text(author)
|
||||
self.author_email.set_text(email)
|
||||
self.item = (report_class, options_class, title, category,
|
||||
name, require_active)
|
||||
self.author_name.set_text(', '.join(pdata.authors))
|
||||
self.author_email.set_text(', '.join(pdata.authors_email))
|
||||
self.item = pdata
|
||||
|
||||
def build_plugin_tree(self, item_list, categories):
|
||||
def build_plugin_tree(self, reg_list, categories):
|
||||
"""Populates a GtkTree with each menu item associated with a entry
|
||||
in the lists. The list must consist of a tuples with the following
|
||||
format:
|
||||
in the lists. The list consists of PluginData objects for reports or
|
||||
tools.
|
||||
|
||||
(item_class, options_class,title,category, name,
|
||||
old data was (item_class, options_class,title,category, name,
|
||||
doc,status,author,email)
|
||||
|
||||
Items in the same category are grouped under the same submenu.
|
||||
@ -188,11 +185,11 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
|
||||
# build the tree items and group together based on the category name
|
||||
item_hash = {}
|
||||
for plugin in item_list:
|
||||
if plugin[9]:
|
||||
for plugin in reg_list:
|
||||
if not plugin.supported:
|
||||
category = _UNSUPPORTED
|
||||
else:
|
||||
category = categories[plugin[3]]
|
||||
category = categories[plugin.category]
|
||||
if category in item_hash:
|
||||
item_hash[category].append(plugin)
|
||||
else:
|
||||
@ -210,24 +207,48 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
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]))
|
||||
data.sort(lambda x, y: cmp(x.name, y.name))
|
||||
for item in data:
|
||||
next = self.store.insert_after(node, next)
|
||||
ilist.append((next, item))
|
||||
self.store.set(next, 0, item[2])
|
||||
self.store.set(next, 0, item.name)
|
||||
for key in key_list:
|
||||
data = item_hash[key]
|
||||
node = self.store.insert_after(None, prev)
|
||||
self.store.set(node, 0, key)
|
||||
next = None
|
||||
data.sort(key=lambda k:k[2])
|
||||
data.sort(key=lambda k:k.name)
|
||||
for item in data:
|
||||
next = self.store.insert_after(node, next)
|
||||
ilist.append((next, item))
|
||||
self.store.set(next, 0, item[2])
|
||||
self.store.set(next, 0, item.name)
|
||||
for next, tab in ilist:
|
||||
path = self.store.get_path(next)
|
||||
self.imap[path] = tab
|
||||
|
||||
def run_plugin(self, pdata):
|
||||
"""
|
||||
run a plugin based on it's PluginData:
|
||||
1/ load plugin.
|
||||
2/ the report is run
|
||||
"""
|
||||
mod = self._pmgr.load_plugin(pdata)
|
||||
if not mod:
|
||||
#import of plugin failed
|
||||
return
|
||||
|
||||
if pdata.ptype == REPORT:
|
||||
report(self.state, self.uistate, self.state.active,
|
||||
eval('mod.' + pdata.reportclass),
|
||||
eval('mod.' + pdata.optionclass),
|
||||
pdata.name, pdata.id,
|
||||
pdata.category, pdata.require_active)
|
||||
else:
|
||||
_Tool.gui_tool(self.state, self.uistate,
|
||||
eval('mod.' + pdata.toolclass),
|
||||
eval('mod.' + pdata.optionclass),
|
||||
pdata.name, pdata.id, pdata.category,
|
||||
self.state.db.request_rebuild)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -244,24 +265,22 @@ class ReportPluginDialog(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."""
|
||||
self.__pmgr = PluginManager.get_instance()
|
||||
|
||||
PluginDialog.__init__(
|
||||
self,
|
||||
dbstate,
|
||||
uistate,
|
||||
track,
|
||||
self.__pmgr.get_report_list(),
|
||||
standalone_categories,
|
||||
_("Report Selection"),
|
||||
_("Select a report from those available on the left."),
|
||||
_("_Generate"), _("Generate selected report"),
|
||||
_REPORTS)
|
||||
|
||||
self.__pmgr.connect('plugins-reloaded', self.rebuild)
|
||||
self._pmgr.connect('plugins-reloaded', self.rebuild)
|
||||
|
||||
def rebuild(self):
|
||||
report_list = self.__pmgr.get_report_list()
|
||||
report_list = self._pmgr.get_reg_reports()
|
||||
self.build_plugin_tree(report_list, standalone_categories)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -277,14 +296,12 @@ class ToolPluginDialog(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."""
|
||||
self.__pmgr = PluginManager.get_instance()
|
||||
|
||||
PluginDialog.__init__(
|
||||
self,
|
||||
dbstate,
|
||||
uistate,
|
||||
track,
|
||||
self.__pmgr.get_tool_list(),
|
||||
_Tool.tool_categories,
|
||||
_("Tool Selection"),
|
||||
_("Select a tool from those available on the left."),
|
||||
@ -293,5 +310,5 @@ class ToolPluginDialog(PluginDialog):
|
||||
_TOOLS)
|
||||
|
||||
def rebuild(self):
|
||||
tool_list = self.__pmgr.get_tool_list()
|
||||
tool_list = self._pmgr.get_reg_tools()
|
||||
self.build_plugin_tree(tool_list, _Tool.tool_categories)
|
||||
|
@ -43,20 +43,15 @@ from BasicUtils import name_displayer
|
||||
import Errors
|
||||
from PluginUtils import (Options, OptionHandler, OptionList,
|
||||
OptionListCollection)
|
||||
from gen.plug import (TOOL_DEBUG, TOOL_ANAL, TOOL_DBPROC, TOOL_DBFIX,
|
||||
TOOL_REVCTL, TOOL_UTILS)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# Tool categories
|
||||
TOOL_DEBUG = -1
|
||||
TOOL_ANAL = 0
|
||||
TOOL_DBPROC = 1
|
||||
TOOL_DBFIX = 2
|
||||
TOOL_REVCTL = 3
|
||||
TOOL_UTILS = 4
|
||||
|
||||
tool_categories = {
|
||||
TOOL_DEBUG : _("Debug"),
|
||||
TOOL_ANAL : _("Analysis and Exploration"),
|
||||
|
@ -24,6 +24,7 @@
|
||||
from _GuiOptions import GuiMenuOptions, make_gui_option
|
||||
from _Options import Options, OptionListCollection, OptionList, OptionHandler
|
||||
|
||||
from _Tool import gui_tool, cli_tool
|
||||
import _Tool as Tool
|
||||
from _PluginDialogs import ReportPluginDialog, ToolPluginDialog
|
||||
import _PluginWindows as PluginWindows
|
||||
|
@ -54,10 +54,9 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
from gen.plug import PluginManager
|
||||
from ReportBase import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
|
||||
CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE, CATEGORY_QR_MISC,
|
||||
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY)
|
||||
from gen.plug import (PluginManager, CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
|
||||
CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE, CATEGORY_QR_MISC,
|
||||
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY)
|
||||
|
||||
|
||||
def create_quickreport_menu(category,dbstate,uistate, handle) :
|
||||
@ -86,56 +85,53 @@ def create_quickreport_menu(category,dbstate,uistate, handle) :
|
||||
#select the reports to show
|
||||
showlst = []
|
||||
pmgr = PluginManager.get_instance()
|
||||
for item in pmgr.get_quick_report_list():
|
||||
if not item[8] and item[2] == category :
|
||||
for pdata in pmgr.get_reg_quick_reports():
|
||||
if pdata.supported and pdata.category == category :
|
||||
#add tuple function, translated name, name, status
|
||||
showlst.append((item[0], item[1], item[3], item[5]))
|
||||
showlst.append(pdata)
|
||||
|
||||
showlst.sort(by_menu_name)
|
||||
for report in showlst:
|
||||
new_key = report[2].replace(' ', '-')
|
||||
for pdata in showlst:
|
||||
new_key = pdata.id.replace(' ', '-')
|
||||
ofile.write('<menuitem action="%s"/>' % new_key)
|
||||
actions.append((new_key, None, report[1], None, None,
|
||||
make_quick_report_callback(report, category,
|
||||
actions.append((new_key, None, pdata.name, None, None,
|
||||
make_quick_report_callback(pdata, category,
|
||||
dbstate, uistate, handle)))
|
||||
ofile.write('</menu>')
|
||||
|
||||
return (ofile.getvalue(), actions)
|
||||
|
||||
def by_menu_name(first, second):
|
||||
return cmp(first[1], second[1])
|
||||
return cmp(first.name, second.name)
|
||||
|
||||
def make_quick_report_callback(lst, category, dbstate, uistate, handle):
|
||||
return lambda x: run_report(dbstate, uistate, category, handle, lst[0])
|
||||
def make_quick_report_callback(pdata, category, dbstate, uistate, handle):
|
||||
return lambda x: run_report(dbstate, uistate, category, handle, pdata)
|
||||
|
||||
def get_quick_report_list(qv_category=None):
|
||||
"""
|
||||
Returns a list of quick views: [(translated name, category, name, status)]
|
||||
Returns a list of PluginData of quick views of category qv_category
|
||||
CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT,
|
||||
CATEGORY_QR_SOURCE, CATEGORY_QR_MISC, CATEGORY_QR_PLACE,
|
||||
CATEGORY_QR_REPOSITORY or None for all
|
||||
"""
|
||||
names = []
|
||||
pmgr = PluginManager.get_instance()
|
||||
for item in pmgr.get_quick_report_list():
|
||||
if qv_category == item[2] or qv_category is None:
|
||||
names.append(item[1:]) # (see below for item struct)
|
||||
for pdata in pmgr.get_reg_quick_reports():
|
||||
if qv_category == pdata.category or qv_category is None:
|
||||
names.append(pdata) # (see below for item struct)
|
||||
return names
|
||||
|
||||
def run_quick_report_by_name(dbstate, uistate, report_name, handle, **kwargs):
|
||||
# [0] - function
|
||||
# [1] - translated name
|
||||
# [2] - category
|
||||
# [3] - name
|
||||
# [5] - status
|
||||
def run_quick_report_by_name(dbstate, uistate, report_name, handle,
|
||||
container=None):
|
||||
report = None
|
||||
pmgr = PluginManager.get_instance()
|
||||
for item in pmgr.get_quick_report_list():
|
||||
if item[3] == report_name:
|
||||
report = item
|
||||
for pdata in pmgr.get_reg_quick_reports():
|
||||
if pdata.id == report_name:
|
||||
report = pdata
|
||||
break
|
||||
if report:
|
||||
return run_report(dbstate, uistate, report[2], handle, report[0], **kwargs)
|
||||
return run_report(dbstate, uistate, report.category,
|
||||
handle, report, container=container)
|
||||
else:
|
||||
raise AttributeError, ("No such quick report '%s'" % report_name)
|
||||
|
||||
@ -147,9 +143,9 @@ def run_quick_report_by_name_direct(report_name, database, document, handle):
|
||||
from Simple import make_basic_stylesheet
|
||||
report = None
|
||||
pmgr = PluginManager.get_instance()
|
||||
for item in pmgr.get_quick_report_list():
|
||||
if item[3] == report_name:
|
||||
report = item
|
||||
for pdata in pmgr.get_reg_quick_reports():
|
||||
if pdata.id == report_name:
|
||||
report = pdata
|
||||
break
|
||||
if report:
|
||||
# FIXME: allow auto lookup of obj like below?
|
||||
@ -157,28 +153,38 @@ def run_quick_report_by_name_direct(report_name, database, document, handle):
|
||||
d.dbstate = document.dbstate
|
||||
d.uistate = document.uistate
|
||||
d.open("")
|
||||
retval = report[0](database, d, handle)
|
||||
d.close()
|
||||
return retval
|
||||
mod = pmgr.load_plugin(report)
|
||||
if mod:
|
||||
reportfunc = eval('mod.' + report.runfunc)
|
||||
retval = reportfunc(database, d, handle)
|
||||
d.close()
|
||||
return retval
|
||||
else:
|
||||
raise ImportError, ("Quick report id = '%s' could not be loaded"
|
||||
% report_name)
|
||||
else:
|
||||
raise AttributeError, ("No such quick report '%s'" % report_name)
|
||||
raise AttributeError, ("No such quick report id = '%s'" % report_name)
|
||||
|
||||
def run_report(dbstate, uistate, category, handle, func, **kwargs):
|
||||
def run_report(dbstate, uistate, category, handle, pdata, container=None):
|
||||
"""
|
||||
Run a Quick Report.
|
||||
kwargs can take an optional document=obj to pass the report
|
||||
the document, rather than putting it in a new window.
|
||||
Optionally container can be passed, rather than putting the report
|
||||
in a new window.
|
||||
"""
|
||||
from docgen import TextBufDoc
|
||||
from Simple import make_basic_stylesheet
|
||||
container = None
|
||||
pmgr = PluginManager.get_instance()
|
||||
mod = pmgr.load_plugin(pdata)
|
||||
if not mod:
|
||||
print "QuickView Error: plugin does not load"
|
||||
return
|
||||
func = eval('mod.' + pdata.runfunc)
|
||||
if handle:
|
||||
d = TextBufDoc(make_basic_stylesheet(), None)
|
||||
d.dbstate = dbstate
|
||||
d.uistate = uistate
|
||||
if "container" in kwargs:
|
||||
container = kwargs["container"]
|
||||
del kwargs["container"]
|
||||
if container:
|
||||
d.change_active = False
|
||||
else:
|
||||
d.change_active = True
|
||||
@ -204,11 +210,11 @@ def run_report(dbstate, uistate, category, handle, func, **kwargs):
|
||||
if obj:
|
||||
if container:
|
||||
result = d.open("", container=container)
|
||||
func(dbstate.db, d, obj, **kwargs)
|
||||
func(dbstate.db, d, obj)
|
||||
return result
|
||||
else:
|
||||
d.open("")
|
||||
retval = func(dbstate.db, d, obj, **kwargs)
|
||||
retval = func(dbstate.db, d, obj)
|
||||
d.close()
|
||||
return retval
|
||||
else:
|
||||
|
@ -35,15 +35,9 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
# Report categories
|
||||
CATEGORY_TEXT = 0
|
||||
CATEGORY_DRAW = 1
|
||||
CATEGORY_CODE = 2
|
||||
CATEGORY_WEB = 3
|
||||
CATEGORY_BOOK = 4
|
||||
CATEGORY_GRAPHVIZ = 5
|
||||
from gen.plug import CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_CODE, CATEGORY_WEB,\
|
||||
CATEGORY_BOOK, CATEGORY_GRAPHVIZ
|
||||
|
||||
standalone_categories = {
|
||||
CATEGORY_TEXT : _("Text Reports"),
|
||||
@ -59,17 +53,6 @@ book_categories = {
|
||||
CATEGORY_DRAW : _("Graphics"),
|
||||
}
|
||||
|
||||
# Quick Report categories
|
||||
CATEGORY_QR_MISC = -1
|
||||
CATEGORY_QR_PERSON = 0
|
||||
CATEGORY_QR_FAMILY = 1
|
||||
CATEGORY_QR_EVENT = 2
|
||||
CATEGORY_QR_SOURCE = 3
|
||||
CATEGORY_QR_PLACE = 4
|
||||
CATEGORY_QR_REPOSITORY = 5
|
||||
CATEGORY_QR_NOTE = 6
|
||||
CATEGORY_QR_DATE = 7
|
||||
|
||||
#Common data for html reports
|
||||
## TODO: move to a system where css files are registered
|
||||
# This information defines the list of styles in the Web reports
|
||||
|
@ -450,13 +450,17 @@ class ArgHandler(object):
|
||||
print "Ignoring invalid options string."
|
||||
|
||||
name = options_str_dict.pop('name', None)
|
||||
_cl_list = pmgr.get_cl_list()
|
||||
_cl_list = pmgr.get_reg_reports(gui=False)
|
||||
if name:
|
||||
for item in _cl_list:
|
||||
if name == item[0]:
|
||||
category = item[1]
|
||||
report_class = item[2]
|
||||
options_class = item[3]
|
||||
for pdata in _cl_list:
|
||||
if name == pdata.id:
|
||||
mod = pmgr.load_plugin(pdata)
|
||||
if not mod:
|
||||
#import of plugin failed
|
||||
return
|
||||
category = pdata.category
|
||||
report_class = eval('mod.' + pdata.reportclass)
|
||||
options_class = eval('mod.' + pdata.optionclass)
|
||||
if category in (CATEGORY_BOOK, CATEGORY_CODE):
|
||||
options_class(self.dbstate.db, name, category,
|
||||
options_str_dict)
|
||||
@ -471,13 +475,14 @@ class ArgHandler(object):
|
||||
msg = "Report name not given. Please use -p name=reportname."
|
||||
|
||||
print "%s\n Available names are:" % msg
|
||||
for item in _cl_list:
|
||||
for pdata in _cl_list:
|
||||
# Print cli report name ([item[0]) and GUI report name (item[4])
|
||||
if len(item[0]) <= 25:
|
||||
print " %s%s- %s" % (item[0],
|
||||
" " * (26 - len(item[0])), item[4])
|
||||
if len(pdata.id) <= 25:
|
||||
print " %s%s- %s" % ( pdata.id,
|
||||
" " * (26 - len(pdata.id)),
|
||||
pdata.name)
|
||||
else:
|
||||
print " %s\t- %s" % (item[0], item[4])
|
||||
print " %s\t- %s" % (pdata.id, pdata.name)
|
||||
|
||||
elif action == "tool":
|
||||
try:
|
||||
@ -488,13 +493,17 @@ class ArgHandler(object):
|
||||
print "Ignoring invalid options string."
|
||||
|
||||
name = options_str_dict.pop('name', None)
|
||||
_cli_tool_list = pmgr.get_cl_tool_list()
|
||||
_cli_tool_list = pmgr.get_reg_tools(gui=False)
|
||||
if name:
|
||||
for item in _cli_tool_list:
|
||||
if name == item[0]:
|
||||
category = item[1]
|
||||
tool_class = item[2]
|
||||
options_class = item[3]
|
||||
for pdata in _cli_tool_list:
|
||||
if name == pdata.id:
|
||||
mod = pmgr.load_plugin(pdata)
|
||||
if not mod:
|
||||
#import of plugin failed
|
||||
return
|
||||
category = pdata.category
|
||||
tool_class = eval('mod.' + pdata.toolclass)
|
||||
options_class = eval('mod.' + pdata.optionclass)
|
||||
Tool.cli_tool(self.dbstate, name, category, tool_class,
|
||||
options_class, options_str_dict)
|
||||
return
|
||||
@ -503,8 +512,14 @@ class ArgHandler(object):
|
||||
msg = "Tool name not given. Please use -p name=toolname."
|
||||
|
||||
print "%s\n Available names are:" % msg
|
||||
for item in _cli_tool_list:
|
||||
print " %s" % item[0]
|
||||
for pdata in _cli_tool_list:
|
||||
# Print cli report name ([item[0]) and GUI report name (item[4])
|
||||
if len(pdata.id) <= 25:
|
||||
print " %s%s- %s" % ( pdata.id,
|
||||
" " * (26 - len(pdata.id)),
|
||||
pdata.name)
|
||||
else:
|
||||
print " %s\t- %s" % (pdata.id, pdata.name)
|
||||
else:
|
||||
print "Unknown action: %s." % action
|
||||
sys.exit(0)
|
||||
|
@ -274,17 +274,12 @@ class CLIManager(object):
|
||||
RecentFiles.recent_files(filename, name)
|
||||
self.file_loaded = True
|
||||
|
||||
def do_load_plugins(self):
|
||||
def do_reg_plugins(self):
|
||||
"""
|
||||
Loads the plugins at initialization time. The plugin status window is
|
||||
opened on an error if the user has requested.
|
||||
Register the plugins at initialization time.
|
||||
"""
|
||||
# load plugins
|
||||
|
||||
error = self._pmgr.load_plugins(const.PLUGINS_DIR)
|
||||
error |= self._pmgr.load_plugins(const.USER_PLUGINS)
|
||||
|
||||
return error
|
||||
self._pmgr.reg_plugins(const.PLUGINS_DIR)
|
||||
self._pmgr.reg_plugins(const.USER_PLUGINS)
|
||||
|
||||
def startcli(errors, argparser):
|
||||
"""
|
||||
@ -309,7 +304,7 @@ def startcli(errors, argparser):
|
||||
#we need a manager for the CLI session
|
||||
climanager = CLIManager(dbstate, True)
|
||||
#load the plugins
|
||||
climanager.do_load_plugins()
|
||||
climanager.do_reg_plugins()
|
||||
# handle the arguments
|
||||
from arghandler import ArgHandler
|
||||
handler = ArgHandler(dbstate, argparser, climanager)
|
||||
|
@ -42,6 +42,7 @@ from gettext import gettext as _
|
||||
try:
|
||||
from ast import literal_eval as safe_eval
|
||||
except:
|
||||
# PYTHON2.5 COMPATIBILITY: no ast present
|
||||
# not safe, but works:
|
||||
safe_eval = eval
|
||||
|
||||
|
@ -22,11 +22,27 @@ The "plug" package for handling plugins in Gramps.
|
||||
"""
|
||||
|
||||
from _plugin import Plugin
|
||||
from _pluginreg import (PluginData, PluginRegister, REPORT, TOOL,
|
||||
CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_CODE,
|
||||
CATEGORY_WEB, CATEGORY_BOOK, CATEGORY_GRAPHVIZ,
|
||||
TOOL_DEBUG, TOOL_ANAL, TOOL_DBPROC, TOOL_DBFIX, TOOL_REVCTL,
|
||||
TOOL_UTILS, CATEGORY_QR_MISC, CATEGORY_QR_PERSON,
|
||||
CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE,
|
||||
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY, CATEGORY_QR_NOTE,
|
||||
CATEGORY_QR_DATE )
|
||||
from _manager import PluginManager
|
||||
from _import import ImportPlugin
|
||||
from _export import ExportPlugin
|
||||
from _docgenplugin import DocGenPlugin
|
||||
from utils import *
|
||||
|
||||
__all__ = [ "docbackend", "docgen", "menu", Plugin, PluginManager,
|
||||
ImportPlugin, ExportPlugin, DocGenPlugin ]
|
||||
__all__ = [ "docbackend", "docgen", "menu", Plugin, PluginData,
|
||||
PluginRegister, PluginManager,
|
||||
ImportPlugin, ExportPlugin, DocGenPlugin,
|
||||
REPORT, TOOL, CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_CODE,
|
||||
CATEGORY_WEB, CATEGORY_BOOK, CATEGORY_GRAPHVIZ,
|
||||
TOOL_DEBUG, TOOL_ANAL, TOOL_DBPROC, TOOL_DBFIX, TOOL_REVCTL,
|
||||
TOOL_UTILS, CATEGORY_QR_MISC, CATEGORY_QR_PERSON,
|
||||
CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE,
|
||||
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY, CATEGORY_QR_NOTE,
|
||||
CATEGORY_QR_DATE]
|
||||
|
@ -46,6 +46,7 @@ from gettext import gettext as _
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.utils
|
||||
import Relationship
|
||||
from gen.plug import PluginRegister
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -65,15 +66,6 @@ class PluginManager(gen.utils.Callback):
|
||||
|
||||
__signals__ = { 'plugins-reloaded' : None }
|
||||
|
||||
# Modes for generating reports
|
||||
REPORT_MODE_GUI = 1 # Standalone report using GUI
|
||||
REPORT_MODE_BKI = 2 # Book Item interface using GUI
|
||||
REPORT_MODE_CLI = 4 # Command line interface (CLI)
|
||||
|
||||
# Modes for running tools
|
||||
TOOL_MODE_GUI = 1 # Standard tool using GUI
|
||||
TOOL_MODE_CLI = 2 # Command line interface (CLI)
|
||||
|
||||
def get_instance():
|
||||
""" Use this function to get the instance of the PluginManager """
|
||||
if PluginManager.__instance is None:
|
||||
@ -89,72 +81,75 @@ class PluginManager(gen.utils.Callback):
|
||||
"Use the get_instance() method")
|
||||
|
||||
gen.utils.Callback.__init__(self)
|
||||
|
||||
self.__report_list = []
|
||||
self.__quick_report_list = []
|
||||
self.__tool_list = []
|
||||
|
||||
self.__import_plugins = []
|
||||
self.__export_plugins = []
|
||||
self.__docgen_plugins = []
|
||||
self.__general_plugins = []
|
||||
self.__mapservice_list = []
|
||||
|
||||
self.__attempt_list = []
|
||||
self.__loaddir_list = []
|
||||
self.__failmsg_list = []
|
||||
self.__bkitems_list = []
|
||||
self.__cl_list = []
|
||||
self.__cli_tool_list = []
|
||||
self.__external_opt_dict = {}
|
||||
self.__success_list = []
|
||||
self.__relcalc_class = Relationship.RelationshipCalculator
|
||||
|
||||
self.__mod2text = {}
|
||||
|
||||
def load_plugins(self, 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.
|
||||
Returns True on error.
|
||||
self.__pgr = PluginRegister.get_instance()
|
||||
self.__registereddir_set = set()
|
||||
self.__loaded_plugins = {}
|
||||
|
||||
def reg_plugins(self, direct):
|
||||
"""
|
||||
Searches the specified directory, and registers python plugin that
|
||||
are being defined in gpr.py files.
|
||||
|
||||
If a relationship calculator for env var LANG is present, it is
|
||||
immediately loaded so it is available for all.
|
||||
"""
|
||||
# if the directory does not exist, do nothing
|
||||
if not os.path.isdir(direct):
|
||||
return False # return value is True for error
|
||||
|
||||
pymod = re.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 (dirpath, dirnames, filenames) in os.walk(direct):
|
||||
# add the directory to the python search path
|
||||
sys.path.append(dirpath)
|
||||
|
||||
for (dirpath, dirnames, filenames) in os.walk(direct):
|
||||
# if the path has not already been loaded, save it in the
|
||||
# loaddir_list list for use on reloading.
|
||||
if dirpath not in self.__loaddir_list:
|
||||
self.__loaddir_list.append(dirpath)
|
||||
|
||||
for filename in filenames:
|
||||
name = os.path.split(filename)
|
||||
match = pymod.match(name[1])
|
||||
if not match:
|
||||
continue
|
||||
self.__attempt_list.append(filename)
|
||||
plugin = match.groups()[0]
|
||||
try:
|
||||
_module = __import__(plugin)
|
||||
self.__success_list.append((filename, _module))
|
||||
except:
|
||||
self.__failmsg_list.append((filename, sys.exc_info()))
|
||||
|
||||
return len(self.__failmsg_list) != 0 # return True if there are errors
|
||||
# registereddir_list list for use on reloading.
|
||||
self.__registereddir_set.add(dirpath)
|
||||
self.__pgr.scan_dir(dirpath)
|
||||
|
||||
# set correct relationship calculator based on LANG
|
||||
for plugin in self.__pgr.relcalc_plugins():
|
||||
if os.environ["LANG"] in plugin.lang_list:
|
||||
#the loaded module is put in variable mod
|
||||
mod = self.load_plugin(plugin)
|
||||
if mod:
|
||||
self.__relcalc_class = eval('mod.' +
|
||||
plugin.relcalcclass)
|
||||
break
|
||||
# load plugins that request to be loaded on startup
|
||||
for plugin in self.__pgr.filter_load_on_reg():
|
||||
mod = self.load_plugin(plugin)
|
||||
|
||||
def load_plugin(self, pdata):
|
||||
"""
|
||||
Load a PluginData object. This means import of the python module.
|
||||
Plugin directories are added to sys path, so files are found
|
||||
"""
|
||||
if pdata.id in self.__loaded_plugins:
|
||||
return self.__loaded_plugins[pdata.id]
|
||||
filename = pdata.fname
|
||||
self.__attempt_list.append(filename)
|
||||
plugin = pdata.mod_name
|
||||
try:
|
||||
_module = __import__(plugin)
|
||||
self.__success_list.append((filename, _module))
|
||||
self.__loaded_plugins[pdata.id] = _module
|
||||
self.__mod2text[_module.__name__] = pdata.description
|
||||
return _module
|
||||
except:
|
||||
self.__failmsg_list.append((filename, sys.exc_info()))
|
||||
return None
|
||||
|
||||
def reload_plugins(self):
|
||||
""" Reload previously loaded plugins """
|
||||
@ -199,26 +194,7 @@ class PluginManager(gen.utils.Callback):
|
||||
self.__success_list.append((filename, _module))
|
||||
except:
|
||||
self.__failmsg_list.append((filename, sys.exc_info()))
|
||||
|
||||
# attempt to load any new files found
|
||||
for directory in self.__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 self.__attempt_list:
|
||||
continue
|
||||
self.__attempt_list.append(filename)
|
||||
plugin = match.groups()[0]
|
||||
try:
|
||||
_module = __import__(plugin)
|
||||
if _module not in [plugin[1]
|
||||
for plugin in self.__success_list]:
|
||||
self.__success_list.append((filename, _module))
|
||||
except:
|
||||
self.__failmsg_list.append((filename, sys.exc_info()))
|
||||
|
||||
|
||||
self.emit('plugins-reloaded')
|
||||
|
||||
def get_fail_list(self):
|
||||
@ -228,34 +204,35 @@ class PluginManager(gen.utils.Callback):
|
||||
def get_success_list(self):
|
||||
""" Return the list of succeeded plugins. """
|
||||
return self.__success_list
|
||||
|
||||
def get_report_list(self):
|
||||
""" Return the list of report plugins. """
|
||||
return self.__report_list
|
||||
|
||||
def get_tool_list(self):
|
||||
""" Return the list of tool plugins. """
|
||||
return self.__tool_list
|
||||
|
||||
def get_quick_report_list(self):
|
||||
""" Return the list of quick report plugins. """
|
||||
return self.__quick_report_list
|
||||
|
||||
def get_mapservice_list(self):
|
||||
""" Return the list of map services"""
|
||||
return self.__mapservice_list
|
||||
|
||||
def get_book_item_list(self):
|
||||
""" Return the list of book plugins. """
|
||||
return self.__bkitems_list
|
||||
def get_reg_reports(self, gui=True):
|
||||
""" Return list of registered reports
|
||||
:Param gui: bool indicating if GUI reports or CLI reports must be
|
||||
returned
|
||||
"""
|
||||
return self.__pgr.report_plugins(gui)
|
||||
|
||||
def get_cl_list(self):
|
||||
""" Return the list of command line report plugins. """
|
||||
return self.__cl_list
|
||||
def get_reg_tools(self, gui=True):
|
||||
""" Return list of registered tools
|
||||
:Param gui: bool indicating if GUI reports or CLI reports must be
|
||||
returned
|
||||
"""
|
||||
return self.__pgr.tool_plugins(gui)
|
||||
|
||||
def get_cl_tool_list(self):
|
||||
""" Return the list of command line tool plugins. """
|
||||
return self.__cli_tool_list
|
||||
def get_reg_quick_reports(self):
|
||||
""" Return list of registered quick reports
|
||||
"""
|
||||
return self.__pgr.quickreport_plugins()
|
||||
|
||||
def get_reg_mapservices(self):
|
||||
""" Return list of registered mapservices
|
||||
"""
|
||||
return self.__pgr.mapservice_plugins()
|
||||
|
||||
def get_reg_bookitems(self):
|
||||
""" Return list of reports registered as bookitem
|
||||
"""
|
||||
return self.__pgr.bookitem_plugins()
|
||||
|
||||
def get_external_opt_dict(self):
|
||||
""" Return the dictionary of external options. """
|
||||
@ -265,29 +242,26 @@ class PluginManager(gen.utils.Callback):
|
||||
""" Given a module name, return the module description. """
|
||||
return self.__mod2text.get(module, '')
|
||||
|
||||
def register_plugin(self, plugin):
|
||||
"""
|
||||
@param plugin: The plugin to be registered.
|
||||
@type plugin: gen.plug.Plugin
|
||||
@return: nothing
|
||||
"""
|
||||
if isinstance(plugin, gen.plug.ImportPlugin):
|
||||
self.__import_plugins.append(plugin)
|
||||
elif isinstance(plugin, gen.plug.ExportPlugin):
|
||||
self.__export_plugins.append(plugin)
|
||||
elif isinstance(plugin, gen.plug.DocGenPlugin):
|
||||
self.__docgen_plugins.append(plugin)
|
||||
elif isinstance(plugin, gen.plug.Plugin):
|
||||
self.__general_plugins.append(plugin)
|
||||
|
||||
self.__mod2text[plugin.get_module_name()] = plugin.get_description()
|
||||
|
||||
def get_import_plugins(self):
|
||||
"""
|
||||
Get the list of import plugins.
|
||||
|
||||
@return: [gen.plug.ImportPlugin] (a list of ImportPlugin instances)
|
||||
"""
|
||||
## TODO: would it not be better to remove ImportPlugin and use
|
||||
## only PluginData, loading from module when importfunction needed?
|
||||
if self.__import_plugins == []:
|
||||
#The module still needs to be imported
|
||||
imps = self.__pgr.import_plugins()
|
||||
for pdata in imps:
|
||||
mod = self.load_plugin(pdata)
|
||||
if mod:
|
||||
imp = gen.plug.ImportPlugin(name=pdata.name,
|
||||
description = pdata.description,
|
||||
import_function = eval('mod.' + pdata.import_function),
|
||||
extension = pdata.extension)
|
||||
self.__import_plugins.append(imp)
|
||||
|
||||
return self.__import_plugins
|
||||
|
||||
def get_export_plugins(self):
|
||||
@ -296,6 +270,22 @@ class PluginManager(gen.utils.Callback):
|
||||
|
||||
@return: [gen.plug.ExportPlugin] (a list of ExportPlugin instances)
|
||||
"""
|
||||
## TODO: would it not be better to remove ExportPlugin and use
|
||||
## only PluginData, loading from module when export/options needed?
|
||||
if self.__export_plugins == []:
|
||||
#The modules still need to be imported
|
||||
exps = self.__pgr.export_plugins()
|
||||
for pdata in exps:
|
||||
mod = self.load_plugin(pdata)
|
||||
if mod:
|
||||
exp = gen.plug.ExportPlugin(name=pdata.name,
|
||||
description = pdata.description,
|
||||
export_function = eval('mod.' + pdata.export_function),
|
||||
extension = pdata.extension,
|
||||
config = (pdata.export_options_title,
|
||||
eval('mod.' + pdata.export_options)))
|
||||
self.__export_plugins.append(exp)
|
||||
|
||||
return self.__export_plugins
|
||||
|
||||
def get_docgen_plugins(self):
|
||||
@ -304,211 +294,25 @@ class PluginManager(gen.utils.Callback):
|
||||
|
||||
@return: [gen.plug.DocGenPlugin] (a list of DocGenPlugin instances)
|
||||
"""
|
||||
## TODO: would it not be better to return list of plugindata, and only
|
||||
## import those docgen that will then actuallly be needed?
|
||||
## So, only do import when docgen.get_basedoc() is requested
|
||||
if self.__docgen_plugins == []:
|
||||
#The modules still need to be imported
|
||||
dgdps = self.__pgr.docgen_plugins()
|
||||
for pdata in dgdps:
|
||||
mod = self.load_plugin(pdata)
|
||||
if mod:
|
||||
dgp = gen.plug.DocGenPlugin(name=pdata.name,
|
||||
description = pdata.description,
|
||||
basedoc = eval('mod.' + pdata.basedocclass),
|
||||
paper = pdata.paper,
|
||||
style = pdata.style,
|
||||
extension = pdata.extension )
|
||||
self.__docgen_plugins.append(dgp)
|
||||
|
||||
return self.__docgen_plugins
|
||||
|
||||
def register_tool(self, name, category, tool_class, options_class,
|
||||
modes, translated_name, status=_("Unknown"),
|
||||
description=_UNAVAILABLE, author_name=_("Unknown"),
|
||||
author_email=_("Unknown"), unsupported=False,
|
||||
require_active=True ):
|
||||
"""
|
||||
Register a tool with the plugin system.
|
||||
|
||||
This function should be used to register tool in GUI and/or
|
||||
command-line mode.
|
||||
"""
|
||||
(junk, gui_task) = divmod(modes, 2**PluginManager.TOOL_MODE_GUI)
|
||||
if gui_task:
|
||||
self.__register_gui_tool(tool_class, options_class, translated_name,
|
||||
name, category, description,
|
||||
status, author_name, author_email, unsupported,
|
||||
require_active)
|
||||
|
||||
(junk, cli_task) = divmod(modes-gui_task,
|
||||
2**PluginManager.TOOL_MODE_CLI)
|
||||
if cli_task:
|
||||
self.__register_cli_tool(name, category, tool_class, options_class,
|
||||
translated_name, unsupported)
|
||||
|
||||
def __register_gui_tool(self, tool_class, options_class, translated_name,
|
||||
name, category, description=_UNAVAILABLE,
|
||||
status=_("Unknown"), author_name=_("Unknown"),
|
||||
author_email=_("Unknown"), unsupported=False,
|
||||
require_active=True):
|
||||
"""
|
||||
Register a GUI tool.
|
||||
"""
|
||||
del_index = -1
|
||||
for i in range(0, len(self.__tool_list)):
|
||||
val = self.__tool_list[i]
|
||||
if val[4] == name:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
del self.__tool_list[del_index]
|
||||
self.__mod2text[tool_class.__module__] = description
|
||||
self.__tool_list.append( (tool_class, options_class, translated_name,
|
||||
category, name, description, status,
|
||||
author_name, author_email, unsupported,
|
||||
require_active) )
|
||||
|
||||
def __register_cli_tool(self, name, category, tool_class, options_class,
|
||||
translated_name, unsupported=False):
|
||||
"""
|
||||
Register a CLI tool.
|
||||
"""
|
||||
del_index = -1
|
||||
for i in range(0, len(self.__cli_tool_list)):
|
||||
val = self.__cli_tool_list[i]
|
||||
if val[0] == name:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
del self.__cli_tool_list[del_index]
|
||||
self.__cli_tool_list.append( (name, category, tool_class, options_class,
|
||||
translated_name, unsupported, None) )
|
||||
|
||||
def register_report(self, name, category, report_class, options_class,
|
||||
modes, translated_name, status=_("Unknown"),
|
||||
description=_UNAVAILABLE, author_name=_("Unknown"),
|
||||
author_email=_("Unknown"), unsupported=False,
|
||||
require_active=True):
|
||||
"""
|
||||
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**PluginManager.REPORT_MODE_GUI)
|
||||
if standalone_task:
|
||||
self.__register_standalone(report_class, options_class,
|
||||
translated_name, name, category,
|
||||
description, status, author_name,
|
||||
author_email, unsupported,
|
||||
require_active)
|
||||
|
||||
(junk, book_item_task) = divmod(modes-standalone_task,
|
||||
2**PluginManager.REPORT_MODE_BKI)
|
||||
if book_item_task:
|
||||
book_item_category = category
|
||||
self.__register_book_item(translated_name, book_item_category,
|
||||
report_class, options_class, name,
|
||||
unsupported, require_active)
|
||||
|
||||
(junk, command_line_task) = divmod(modes-standalone_task-book_item_task,
|
||||
2**PluginManager.REPORT_MODE_CLI)
|
||||
if command_line_task:
|
||||
self.__register_cl_report(name, category, report_class,
|
||||
options_class, translated_name,
|
||||
unsupported, require_active)
|
||||
|
||||
def __register_standalone(self, report_class, options_class,
|
||||
translated_name, name, category,
|
||||
description=_UNAVAILABLE, status=_("Unknown"),
|
||||
author_name=_("Unknown"),
|
||||
author_email=_("Unknown"), unsupported=False,
|
||||
require_active=True):
|
||||
"""
|
||||
Register a report with the plugin system.
|
||||
"""
|
||||
del_index = -1
|
||||
for i in range(0, len(self.__report_list)):
|
||||
val = self.__report_list[i]
|
||||
if val[4] == name:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
del self.__report_list[del_index]
|
||||
|
||||
self.__report_list.append( (report_class, options_class,
|
||||
translated_name, category, name,
|
||||
description, status, author_name,
|
||||
author_email, unsupported, require_active) )
|
||||
self.__mod2text[report_class.__module__] = description
|
||||
|
||||
def __register_book_item(self, translated_name, category, report_class,
|
||||
option_class, name, unsupported, require_active):
|
||||
"""
|
||||
Register a book item.
|
||||
"""
|
||||
del_index = -1
|
||||
for i in range(0, len(self.__bkitems_list)):
|
||||
val = self.__bkitems_list[i]
|
||||
if val[4] == name:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
del self.__bkitems_list[del_index]
|
||||
|
||||
self.__bkitems_list.append( (translated_name, category, report_class,
|
||||
option_class, name, unsupported,
|
||||
require_active) )
|
||||
|
||||
def __register_cl_report(self, name, category, report_class, options_class,
|
||||
translated_name, unsupported, require_active):
|
||||
"""
|
||||
Register a command line report.
|
||||
"""
|
||||
del_index = -1
|
||||
for i in range(0, len(self.__cl_list)):
|
||||
val = self.__cl_list[i]
|
||||
if val[0] == name:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
del self.__cl_list[del_index]
|
||||
self.__cl_list.append( (name, category, report_class, options_class,
|
||||
translated_name, unsupported, require_active) )
|
||||
|
||||
def register_quick_report(self, name, category, run_func, translated_name,
|
||||
status=_("Unknown"), description=_UNAVAILABLE,
|
||||
author_name=_("Unknown"),
|
||||
author_email=_("Unknown"), unsupported=False ):
|
||||
"""
|
||||
Registers quick report for all possible objects.
|
||||
|
||||
This function should be used to register a quick report
|
||||
so it appears in the quick report context menu of the object it is
|
||||
attached to.
|
||||
The low-level functions (starting with '_') should not be used
|
||||
on their own. Instead, this function will call them as needed.
|
||||
"""
|
||||
del_index = -1
|
||||
for i in range(0, len(self.__quick_report_list)):
|
||||
val = self.__quick_report_list[i]
|
||||
if val[3] == name:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
del self.__quick_report_list[del_index]
|
||||
|
||||
self.__quick_report_list.append( (run_func, translated_name,
|
||||
category, name, description, status,
|
||||
author_name, author_email, unsupported))
|
||||
|
||||
self.__mod2text[run_func.__module__] = description
|
||||
|
||||
def register_mapservice(self, name, mapservice, translated_name,
|
||||
status=_("Unknown"), tooltip=_UNAVAILABLE,
|
||||
author_name=_("Unknown"),
|
||||
author_email=_("Unknown"), unsupported=False ):
|
||||
"""
|
||||
Register map services for the place view.
|
||||
A map service is a MapService class. The class can be called with a
|
||||
list of (place handle, description) values, and manipulate this data
|
||||
to show on a map.
|
||||
"""
|
||||
del_index = -1
|
||||
for i in range(0, len(self.__mapservice_list)):
|
||||
val = self.__mapservice_list[i]
|
||||
if val[2] == name:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
del self.__mapservice_list[del_index]
|
||||
|
||||
self.__mapservice_list.append( (mapservice, translated_name,
|
||||
name, tooltip, status,
|
||||
author_name, author_email, unsupported))
|
||||
|
||||
self.__mod2text[mapservice.__module__] = tooltip
|
||||
|
||||
def register_option(self, option, guioption):
|
||||
"""
|
||||
Register an external option.
|
||||
@ -532,38 +336,13 @@ class PluginManager(gen.utils.Callback):
|
||||
os.path.splitext(os.path.basename(filename))[0]
|
||||
for filename, junk in self.__failmsg_list
|
||||
]
|
||||
|
||||
self.__general_plugins[:] = [ item for item in self.__export_plugins
|
||||
if item.get_module_name() not in self.__general_plugins ][:]
|
||||
|
||||
self.__export_plugins[:] = [ item for item in self.__export_plugins
|
||||
if item.get_module_name() not in failed_module_names ][:]
|
||||
self.__import_plugins[:] = [ item for item in self.__import_plugins
|
||||
if item.get_module_name() not in failed_module_names ][:]
|
||||
self.__docgen_plugins[:] = [ item for item in self.__docgen_plugins
|
||||
if item.get_module_name() not in failed_module_names ][:]
|
||||
self.__tool_list[:] = [ item for item in self.__tool_list
|
||||
if item[0].__module__ not in failed_module_names ][:]
|
||||
self.__cli_tool_list[:] = [ item for item in self.__cli_tool_list
|
||||
if item[2].__module__ not in failed_module_names ][:]
|
||||
self.__report_list[:] = [ item for item in self.__report_list
|
||||
if item[0].__module__ not in failed_module_names ][:]
|
||||
self.__quick_report_list[:] = \
|
||||
[ item for item in self.__quick_report_list
|
||||
if item[0].__module__ not in failed_module_names ][:]
|
||||
self.__bkitems_list[:] = [ item for item in self.__bkitems_list
|
||||
if item[2].__module__ not in failed_module_names ][:]
|
||||
self.__cl_list[:] = [ item for item in self.__cl_list
|
||||
if item[2].__module__ not in failed_module_names ][:]
|
||||
|
||||
def register_relcalc(self, relclass, languages):
|
||||
"""
|
||||
Register a relationship calculator.
|
||||
"""
|
||||
try:
|
||||
if os.environ["LANG"] in languages:
|
||||
self.__relcalc_class = relclass
|
||||
except:
|
||||
pass
|
||||
|
||||
def get_relationship_calculator(self):
|
||||
"""
|
||||
|
@ -2,6 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2008 Brian G. Matherly
|
||||
# Copyright (C) 2009 Benny Malengier
|
||||
#
|
||||
# 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
|
||||
@ -21,8 +22,8 @@
|
||||
|
||||
"""
|
||||
This module provides the base class for plugins.
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
class Plugin(object):
|
||||
"""
|
||||
This class serves as a base class for all plugins that can be registered
|
||||
|
913
src/gen/plug/_pluginreg.py
Normal file
913
src/gen/plug/_pluginreg.py
Normal file
@ -0,0 +1,913 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2009 Benny Malengier
|
||||
#
|
||||
# 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: _plugin.py 12559 2009-05-21 17:19:50Z gbritton $
|
||||
|
||||
"""
|
||||
This module provides the base class for plugin registration.
|
||||
It provides an object containing data about the plugin (version, filename, ...)
|
||||
and a register for the data of all plugins .
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import traceback
|
||||
from gettext import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from const import VERSION as GRAMPSVERSION
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PluginData
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
#a plugin is stable or unstable
|
||||
STABLE = 0
|
||||
UNSTABLE = 1
|
||||
STATUS = [STABLE, UNSTABLE]
|
||||
STATUSTEXT = {STABLE: _('Stable'), UNSTABLE: _('Unstable')}
|
||||
#possible plugin types
|
||||
REPORT = 0
|
||||
QUICKREPORT = 1
|
||||
TOOL = 2
|
||||
IMPORT = 3
|
||||
EXPORT = 4
|
||||
DOCGEN = 5
|
||||
GENERAL = 6
|
||||
MAPSERVICE = 7
|
||||
VIEW = 8
|
||||
RELCALC = 9
|
||||
GRAMPLET = 10
|
||||
PTYPE = [ REPORT , QUICKREPORT, TOOL, IMPORT,
|
||||
EXPORT, DOCGEN, GENERAL, MAPSERVICE, VIEW, RELCALC, GRAMPLET]
|
||||
|
||||
#possible report categories
|
||||
CATEGORY_TEXT = 0
|
||||
CATEGORY_DRAW = 1
|
||||
CATEGORY_CODE = 2
|
||||
CATEGORY_WEB = 3
|
||||
CATEGORY_BOOK = 4
|
||||
CATEGORY_GRAPHVIZ = 5
|
||||
REPORT_CAT = [ CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_CODE,
|
||||
CATEGORY_WEB, CATEGORY_BOOK, CATEGORY_GRAPHVIZ]
|
||||
#possible tool categories
|
||||
TOOL_DEBUG = -1
|
||||
TOOL_ANAL = 0
|
||||
TOOL_DBPROC = 1
|
||||
TOOL_DBFIX = 2
|
||||
TOOL_REVCTL = 3
|
||||
TOOL_UTILS = 4
|
||||
TOOL_CAT = [ TOOL_DEBUG, TOOL_ANAL, TOOL_DBPROC, TOOL_DBFIX, TOOL_REVCTL,
|
||||
TOOL_UTILS]
|
||||
|
||||
#possible quickreport categories
|
||||
CATEGORY_QR_MISC = -1
|
||||
CATEGORY_QR_PERSON = 0
|
||||
CATEGORY_QR_FAMILY = 1
|
||||
CATEGORY_QR_EVENT = 2
|
||||
CATEGORY_QR_SOURCE = 3
|
||||
CATEGORY_QR_PLACE = 4
|
||||
CATEGORY_QR_REPOSITORY = 5
|
||||
CATEGORY_QR_NOTE = 6
|
||||
CATEGORY_QR_DATE = 7
|
||||
|
||||
# Modes for generating reports
|
||||
REPORT_MODE_GUI = 1 # Standalone report using GUI
|
||||
REPORT_MODE_BKI = 2 # Book Item interface using GUI
|
||||
REPORT_MODE_CLI = 4 # Command line interface (CLI)
|
||||
REPORT_MODES = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
|
||||
|
||||
# Modes for running tools
|
||||
TOOL_MODE_GUI = 1 # Standard tool using GUI
|
||||
TOOL_MODE_CLI = 2 # Command line interface (CLI)
|
||||
TOOL_MODES = [TOOL_MODE_GUI, TOOL_MODE_CLI]
|
||||
|
||||
class PluginData(object):
|
||||
"""
|
||||
This is the base class for all plugin data objects.
|
||||
The workflow is:
|
||||
1. plugin manager reads all register files, and stores plugin data
|
||||
objects in a plugin register
|
||||
2. when plugin is needed, the plugin register creates the plugin, and
|
||||
the manager stores this, after which it can be executed.
|
||||
|
||||
Attributes present for all plugins
|
||||
.. attribute:: id
|
||||
A unique identifier for the plugin. This is eg used to store the plugin
|
||||
settings.
|
||||
.. attribute:: name
|
||||
A friendly name to call this plugin (normally translated)
|
||||
.. attribute:: description
|
||||
A friendly description of what the plugin does
|
||||
.. attribute:: version
|
||||
The version of the plugin
|
||||
.. attribute:: status
|
||||
The status of the plugin, STABLE or UNSTABLE
|
||||
UNSTABLE is only visible in development code, not in release
|
||||
.. attribute:: fname
|
||||
The python file where the plugin implementation can be found
|
||||
.. attribute:: ptype
|
||||
The plugin type. One of REPORT , QUICKREPORT, TOOL, IMPORT,
|
||||
EXPORT, DOCGEN, GENERAL, MAPSERVICE, VIEW, GRAMPLET
|
||||
.. attribute:: authors
|
||||
List of authors of the plugin, default=[]
|
||||
.. attribute:: authors_email
|
||||
List of emails of the authors of the plugin, default=[]
|
||||
.. attribute:: supported
|
||||
Bool value indicating if the plugin is still supported, default=True
|
||||
.. attribute:: load_on_reg
|
||||
bool value, if True, the plugin is loaded on GRAMPS startup. Some
|
||||
plugins. Only set this value if for testing you want the plugin to be
|
||||
loaded immediately on startup. default=False
|
||||
|
||||
Attributes for RELCALC plugins:
|
||||
.. attribute:: relcalcclass
|
||||
The class in the module that is the relationcalc class
|
||||
.. attribute:: lang_list
|
||||
List of languages this plugin handles
|
||||
|
||||
Attributes for REPORT plugins:
|
||||
.. attribute:: require_active
|
||||
Bool, If the reports requries an active person to be set or not
|
||||
.. attribute:: reportclass
|
||||
The class in the module that is the report class
|
||||
.. attribute:: report_modes
|
||||
The report modes: list of REPORT_MODE_GUI ,REPORT_MODE_BKI,REPORT_MODE_CLI
|
||||
|
||||
Attributes for REPORT and TOOL and QUICKREPORT plugins
|
||||
.. attribute:: category
|
||||
Or the report category the plugin belongs to, default=CATEGORY_TEXT
|
||||
or the tool category a plugin belongs to, default=TOOL_UTILS
|
||||
or the quickreport category a plugin belongs to, default=CATEGORY_QR_PERSON
|
||||
|
||||
Attributes for REPORT and TOOL plugins
|
||||
.. attribute:: optionclass
|
||||
The class in the module that is the option class
|
||||
|
||||
Attributes for TOOL plugins
|
||||
.. attribute:: toolclass
|
||||
The class in the module that is the tool class
|
||||
.. attribute:: tool_modes
|
||||
The tool modes: list of TOOL_MODE_GUI, TOOL_MODE_CLI
|
||||
|
||||
Attributes for DOCGEN plugins
|
||||
.. attribute :: basedocclass
|
||||
The class in the module that is the BaseDoc defined
|
||||
.. attribute :: paper
|
||||
bool, Indicates whether the plugin uses paper or not, default=True
|
||||
.. attribute :: style
|
||||
bool, Indicates whether the plugin uses styles or not, default=True
|
||||
|
||||
Attribute for DOCGEN, EXPORT plugins
|
||||
.. attribute :: extension
|
||||
str, The file extension to use for output produced by the docgen/export,
|
||||
default=''
|
||||
|
||||
Attributes for QUICKREPORT plugins
|
||||
.. attribute:: runfunc
|
||||
The function that executes the quick report
|
||||
|
||||
Attributes for MAPSERVICE plugins
|
||||
.. attribute:: mapservice
|
||||
The class in the module that is a mapservice
|
||||
|
||||
Attributes for EXPORT plugins
|
||||
.. attribute:: export_function
|
||||
Function that produces the export
|
||||
.. attribute:: export_options
|
||||
Class to set options
|
||||
.. attribute:: export_options_title
|
||||
Title for the option page
|
||||
|
||||
Attributes for IMPORT plugins
|
||||
.. attribute:: import_function
|
||||
Function that starts an import
|
||||
|
||||
Attributes for GRAMPLET plugins
|
||||
.. attribute:: gramplet
|
||||
The Gramplet that is defined
|
||||
.. attribute:: height
|
||||
The height the gramplet should have in a column on GrampletView,
|
||||
default = 200
|
||||
.. attribute:: detached_height
|
||||
The height the gramplet should have detached, default 300
|
||||
.. attribute:: detached_width
|
||||
The width the gramplet should have detached, default 400
|
||||
.. attribute:: expand
|
||||
If the attributed should be expanded on start, default False
|
||||
.. attribute:: gramplet_title
|
||||
Title to use for the gramplet, default = 'Gramplet'
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._id = None
|
||||
self._name = None
|
||||
self._version = None
|
||||
self._description = None
|
||||
self._status = UNSTABLE
|
||||
self._fname = None
|
||||
self._ptype = None
|
||||
self._authors = []
|
||||
self._authors_email = []
|
||||
self._supported = True
|
||||
self._load_on_reg = False
|
||||
#derived var
|
||||
self.mod_name = None
|
||||
#RELCALC attr
|
||||
self._relcalcclass = None
|
||||
self._lang_list = None
|
||||
#REPORT attr
|
||||
self._reportclass = None
|
||||
self._require_active = True
|
||||
self._report_modes = [REPORT_MODE_GUI]
|
||||
#REPORT and TOOL attr
|
||||
self._category = None
|
||||
self._optionclass = None
|
||||
#TOOL attr
|
||||
self._toolclass = None
|
||||
self._tool_modes = [TOOL_MODE_GUI]
|
||||
#DOCGEN attr
|
||||
self._basedocclass = None
|
||||
self._paper = True
|
||||
self._style = True
|
||||
self._extension = ''
|
||||
#QUICKREPORT attr
|
||||
self._runfunc = None
|
||||
#MAPSERVICE attr
|
||||
self._mapservice = None
|
||||
#EXPORT attr
|
||||
self._export_function = None
|
||||
self._export_options = None
|
||||
self._export_options_title = ''
|
||||
#IMPORT attr
|
||||
self._import_function = None
|
||||
#GRAMPLET attr
|
||||
self._gramplet = None
|
||||
self._height = 200
|
||||
self._detached_height = 300
|
||||
self._detached_width = 400
|
||||
self._expand = False
|
||||
self._gramplet_title = _('Gramplet')
|
||||
|
||||
def _set_id(self, id):
|
||||
self._id = id
|
||||
|
||||
def _get_id(self):
|
||||
return self._id
|
||||
|
||||
def _set_name(self, name):
|
||||
self._name = name
|
||||
|
||||
def _get_name(self):
|
||||
return self._name
|
||||
|
||||
def _set_description(self, description):
|
||||
self._description = description
|
||||
|
||||
def _get_description(self):
|
||||
return self._description
|
||||
|
||||
def _set_version(self, version):
|
||||
self._version = version
|
||||
|
||||
def _get_version(self):
|
||||
return self._version
|
||||
|
||||
def _set_status(self, status):
|
||||
if status not in STATUS:
|
||||
raise ValueError, 'plugin status cannot be %s' % str(status)
|
||||
self._status = status
|
||||
|
||||
def _get_status(self):
|
||||
return self._status
|
||||
|
||||
def _set_fname(self, fname):
|
||||
self._fname = fname
|
||||
|
||||
def _get_fname(self):
|
||||
return self._fname
|
||||
|
||||
def _set_ptype(self, ptype):
|
||||
if ptype not in PTYPE:
|
||||
raise ValueError, 'Plugin type cannot be %s' % str(ptype)
|
||||
elif self._ptype is not None:
|
||||
raise ValueError, 'Plugin type may not be changed'
|
||||
self._ptype = ptype
|
||||
if self._ptype == REPORT:
|
||||
self._category = CATEGORY_TEXT
|
||||
elif self._ptype == TOOL:
|
||||
self._category = TOOL_UTILS
|
||||
elif self._ptype == QUICKREPORT:
|
||||
self._category = CATEGORY_QR_PERSON
|
||||
#if self._ptype == DOCGEN:
|
||||
# self._load_on_reg = True
|
||||
|
||||
def _get_ptype(self):
|
||||
return self._ptype
|
||||
|
||||
def _set_authors(self, authors):
|
||||
if not authors or not isinstance(authors, list):
|
||||
return
|
||||
self._authors = authors
|
||||
|
||||
def _get_authors(self):
|
||||
return self._authors
|
||||
|
||||
def _set_authors_email(self, authors_email):
|
||||
if not authors_email or not isinstance(authors_email, list):
|
||||
return
|
||||
self._authors_email = authors_email
|
||||
|
||||
def _get_authors_email(self):
|
||||
return self._authors_email
|
||||
|
||||
def _set_supported(self, supported):
|
||||
if not isinstance(supported, bool):
|
||||
raise ValueError, 'Plugin must have supported=True or False'
|
||||
self._supported = supported
|
||||
|
||||
def _get_supported(self):
|
||||
return self._supported
|
||||
|
||||
def _get_load_on_reg(self):
|
||||
return self._load_on_reg
|
||||
|
||||
def _set_load_on_reg(self, load_on_reg):
|
||||
if not isinstance(load_on_reg, bool):
|
||||
raise ValueError, 'Plugin must have load_on_reg=True or False'
|
||||
self._load_on_reg = load_on_reg
|
||||
|
||||
id = property(_get_id, _set_id)
|
||||
name = property(_get_name, _set_name)
|
||||
description = property(_get_description, _set_description)
|
||||
version = property(_get_version, _set_version)
|
||||
status = property(_get_status, _set_status)
|
||||
fname = property(_get_fname, _set_fname)
|
||||
ptype = property(_get_ptype, _set_ptype)
|
||||
authors = property(_get_authors, _set_authors)
|
||||
authors_email = property(_get_authors_email, _set_authors_email)
|
||||
supported = property(_get_supported, _set_supported)
|
||||
load_on_reg = property(_get_load_on_reg, _set_load_on_reg)
|
||||
|
||||
def statustext(self):
|
||||
return STATUSTEXT[self.status]
|
||||
|
||||
#type specific plugin attributes
|
||||
|
||||
#RELCALC attributes
|
||||
def _set_relcalcclass(self, relcalcclass):
|
||||
if not self._ptype == RELCALC:
|
||||
raise ValueError, 'relcalcclass may only be set for RELCALC plugins'
|
||||
self._relcalcclass = relcalcclass
|
||||
|
||||
def _get_relcalcclass(self):
|
||||
return self._relcalcclass
|
||||
|
||||
def _set_lang_list(self, lang_list):
|
||||
if not self._ptype == RELCALC:
|
||||
raise ValueError, 'relcalcclass may only be set for RELCALC plugins'
|
||||
self._lang_list = lang_list
|
||||
|
||||
def _get_lang_list(self):
|
||||
return self._lang_list
|
||||
|
||||
relcalcclass = property(_get_relcalcclass, _set_relcalcclass)
|
||||
lang_list = property(_get_lang_list, _set_lang_list)
|
||||
|
||||
#REPORT attributes
|
||||
def _set_require_active(self, require_active):
|
||||
if not self._ptype == REPORT:
|
||||
raise ValueError, 'require_active may only be set for REPORT plugins'
|
||||
if not isinstance(require_active, bool):
|
||||
raise ValueError, 'Report must have require_active=True or False'
|
||||
self._require_active = require_active
|
||||
|
||||
def _get_require_active(self):
|
||||
return self._require_active
|
||||
|
||||
def _set_reportclass(self, reportclass):
|
||||
if not self._ptype == REPORT:
|
||||
raise ValueError, 'reportclass may only be set for REPORT plugins'
|
||||
self._reportclass = reportclass
|
||||
|
||||
def _get_reportclass(self):
|
||||
return self._reportclass
|
||||
|
||||
def _set_report_modes(self, report_modes):
|
||||
if not self._ptype == REPORT:
|
||||
raise ValueError, 'report_modes may only be set for REPORT plugins'
|
||||
if not isinstance(report_modes, list):
|
||||
raise ValueError, 'report_modes must be a list'
|
||||
self._report_modes = [x for x in report_modes if x in REPORT_MODES]
|
||||
if not self._report_modes:
|
||||
raise ValueError, 'report_modes not a valid list of modes'
|
||||
|
||||
def _get_report_modes(self):
|
||||
return self._report_modes
|
||||
|
||||
#REPORT OR TOOL OR QUICKREPORT attributes
|
||||
def _set_category(self, category):
|
||||
if not (self._ptype == REPORT or self._ptype == TOOL or
|
||||
self._ptype == QUICKREPORT):
|
||||
raise ValueError, 'category may only be set for REPORT/TOOL plugins'
|
||||
self._category = category
|
||||
|
||||
def _get_category(self):
|
||||
return self._category
|
||||
|
||||
#REPORT OR TOOL attributes
|
||||
def _set_optionclass(self, optionclass):
|
||||
if not (self._ptype == REPORT or self.ptype == TOOL):
|
||||
raise ValueError, 'optionclass may only be set for REPORT/TOOL plugins'
|
||||
self._optionclass = optionclass
|
||||
|
||||
def _get_optionclass(self):
|
||||
return self._optionclass
|
||||
|
||||
#TOOL attributes
|
||||
def _set_toolclass(self, toolclass):
|
||||
if not self._ptype == TOOL:
|
||||
raise ValueError, 'toolclass may only be set for TOOL plugins'
|
||||
self._toolclass = toolclass
|
||||
|
||||
def _get_toolclass(self):
|
||||
return self._toolclass
|
||||
|
||||
def _set_tool_modes(self, tool_modes):
|
||||
if not self._ptype == TOOL:
|
||||
raise ValueError, 'tool_modes may only be set for TOOL plugins'
|
||||
if not isinstance(tool_modes, list):
|
||||
raise ValueError, 'tool_modes must be a list'
|
||||
self._tool_modes = [x for x in tool_modes if x in TOOL_MODES]
|
||||
if not self._tool_modes:
|
||||
raise ValueError, 'tool_modes not a valid list of modes'
|
||||
|
||||
def _get_tool_modes(self):
|
||||
return self._tool_modes
|
||||
|
||||
require_active = property(_get_require_active, _set_require_active)
|
||||
reportclass = property(_get_reportclass, _set_reportclass)
|
||||
report_modes = property(_get_report_modes, _set_report_modes)
|
||||
category = property(_get_category, _set_category)
|
||||
optionclass = property(_get_optionclass, _set_optionclass)
|
||||
toolclass = property(_get_toolclass, _set_toolclass)
|
||||
tool_modes = property(_get_tool_modes, _set_tool_modes)
|
||||
|
||||
#DOCGEN attributes
|
||||
def _set_basedocclass(self, basedocclass):
|
||||
if not self._ptype == DOCGEN:
|
||||
raise ValueError, 'basedocclass may only be set for DOCGEN plugins'
|
||||
self._basedocclass = basedocclass
|
||||
|
||||
def _get_basedocclass(self):
|
||||
return self._basedocclass
|
||||
|
||||
def _set_paper(self, paper):
|
||||
if not self._ptype == DOCGEN:
|
||||
raise ValueError, 'paper may only be set for DOCGEN plugins'
|
||||
if not isinstance(paper, bool):
|
||||
raise ValueError, 'Plugin must have paper=True or False'
|
||||
self._paper = paper
|
||||
|
||||
def _get_paper(self):
|
||||
return self._paper
|
||||
|
||||
def _set_style(self, style):
|
||||
if not self._ptype == DOCGEN:
|
||||
raise ValueError, 'style may only be set for DOCGEN plugins'
|
||||
if not isinstance(style, bool):
|
||||
raise ValueError, 'Plugin must have style=True or False'
|
||||
self._style = style
|
||||
|
||||
def _get_style(self):
|
||||
return self._style
|
||||
|
||||
def _set_extension(self, extension):
|
||||
if not (self._ptype == DOCGEN or self._ptype == EXPORT
|
||||
or self._ptype == IMPORT):
|
||||
raise ValueError, 'extension may only be set for DOCGEN/EXPORT/'\
|
||||
'IMPORT plugins'
|
||||
self._extension = extension
|
||||
|
||||
def _get_extension(self):
|
||||
return self._extension
|
||||
|
||||
basedocclass = property(_get_basedocclass, _set_basedocclass)
|
||||
paper = property(_get_paper, _set_paper)
|
||||
style = property(_get_style, _set_style)
|
||||
extension = property(_get_extension, _set_extension)
|
||||
|
||||
#QUICKREPORT attributes
|
||||
def _set_runfunc(self, runfunc):
|
||||
if not self._ptype == QUICKREPORT:
|
||||
raise ValueError, 'runfunc may only be set for QUICKREPORT plugins'
|
||||
self._runfunc = runfunc
|
||||
|
||||
def _get_runfunc(self):
|
||||
return self._runfunc
|
||||
|
||||
runfunc = property(_get_runfunc, _set_runfunc)
|
||||
|
||||
#MAPSERVICE attributes
|
||||
def _set_mapservice(self, mapservice):
|
||||
if not self._ptype == MAPSERVICE:
|
||||
raise ValueError, 'mapservice may only be set for MAPSERVICE plugins'
|
||||
self._mapservice = mapservice
|
||||
|
||||
def _get_mapservice(self):
|
||||
return self._mapservice
|
||||
|
||||
mapservice = property(_get_mapservice, _set_mapservice)
|
||||
|
||||
#EXPORT attributes
|
||||
def _set_export_function(self, export_function):
|
||||
if not self._ptype == EXPORT:
|
||||
raise ValueError, 'export_function may only be set for EXPORT plugins'
|
||||
self._export_function = export_function
|
||||
|
||||
def _get_export_function(self):
|
||||
return self._export_function
|
||||
|
||||
def _set_export_options(self, export_options):
|
||||
if not self._ptype == EXPORT:
|
||||
raise ValueError, 'export_options may only be set for EXPORT plugins'
|
||||
self._export_options = export_options
|
||||
|
||||
def _get_export_options(self):
|
||||
return self._export_options
|
||||
|
||||
def _set_export_options_title(self, export_options_title):
|
||||
if not self._ptype == EXPORT:
|
||||
raise ValueError, 'export_options_title may only be set for EXPORT plugins'
|
||||
self._export_options_title = export_options_title
|
||||
|
||||
def _get_export_options_title(self):
|
||||
return self._export_options_title
|
||||
|
||||
export_function = property(_get_export_function, _set_export_function)
|
||||
export_options = property(_get_export_options, _set_export_options)
|
||||
export_options_title = property(_get_export_options_title,
|
||||
_set_export_options_title)
|
||||
|
||||
#IMPORT attributes
|
||||
def _set_import_function(self, import_function):
|
||||
if not self._ptype == IMPORT:
|
||||
raise ValueError, 'import_function may only be set for IMPORT plugins'
|
||||
self._import_function = import_function
|
||||
|
||||
def _get_import_function(self):
|
||||
return self._import_function
|
||||
|
||||
import_function = property(_get_import_function, _set_import_function)
|
||||
|
||||
#GRAMPLET attributes
|
||||
def _set_gramplet(self, gramplet):
|
||||
if not self._ptype == GRAMPLET:
|
||||
raise ValueError, 'gramplet may only be set for GRAMPLET plugins'
|
||||
self._gramplet = gramplet
|
||||
|
||||
def _get_gramplet(self):
|
||||
return self._gramplet
|
||||
|
||||
def _set_height(self, height):
|
||||
if not self._ptype == GRAMPLET:
|
||||
raise ValueError, 'height may only be set for GRAMPLET plugins'
|
||||
if not isinstance(height, int):
|
||||
raise ValueError, 'Plugin must have height an integer'
|
||||
self._height = height
|
||||
|
||||
def _get_height(self):
|
||||
return self._height
|
||||
|
||||
def _set_detached_height(self, detached_height):
|
||||
if not self._ptype == GRAMPLET:
|
||||
raise ValueError, 'detached_height may only be set for GRAMPLET plugins'
|
||||
if not isinstance(detached_height, int):
|
||||
raise ValueError, 'Plugin must have detached_height an integer'
|
||||
self._detached_height = detached_height
|
||||
|
||||
def _get_detached_height(self):
|
||||
return self._detached_height
|
||||
|
||||
def _set_detached_width(self, detached_width):
|
||||
if not self._ptype == GRAMPLET:
|
||||
raise ValueError, 'detached_width may only be set for GRAMPLET plugins'
|
||||
if not isinstance(detached_width, int):
|
||||
raise ValueError, 'Plugin must have detached_width an integer'
|
||||
self._detached_width = detached_width
|
||||
|
||||
def _get_detached_width(self):
|
||||
return self._detached_width
|
||||
|
||||
def _set_expand(self, expand):
|
||||
if not self._ptype == GRAMPLET:
|
||||
raise ValueError, 'expand may only be set for GRAMPLET plugins'
|
||||
if not isinstance(expand, bool):
|
||||
raise ValueError, 'Plugin must have expand as a bool'
|
||||
self._expand = expand
|
||||
|
||||
def _get_expand(self):
|
||||
return self._expand
|
||||
|
||||
def _set_gramplet_title(self, gramplet_title):
|
||||
if not self._ptype == GRAMPLET:
|
||||
raise ValueError, 'gramplet_title may only be set for GRAMPLET plugins'
|
||||
if not isinstance(gramplet_title, str):
|
||||
raise ValueError, 'Plugin must have a string as gramplet_title'
|
||||
self._gramplet_title = gramplet_title
|
||||
|
||||
def _get_gramplet_title(self):
|
||||
return self._gramplet_title
|
||||
|
||||
gramplet = property(_get_gramplet, _set_gramplet)
|
||||
height = property(_get_height, _set_height)
|
||||
detached_height = property(_get_detached_height, _set_detached_height)
|
||||
detached_width = property(_get_detached_width, _set_detached_width)
|
||||
expand = property(_get_expand, _set_expand)
|
||||
gramplet_title = property(_get_gramplet_title, _set_gramplet_title)
|
||||
|
||||
def newplugin():
|
||||
"""
|
||||
Function to create a new plugindata object, add it to list of
|
||||
registered plugins
|
||||
:Returns: a newly created PluginData which is already part of the register
|
||||
"""
|
||||
gpr = PluginRegister.get_instance()
|
||||
pgd = PluginData()
|
||||
gpr.add_plugindata(pgd)
|
||||
return pgd
|
||||
|
||||
def register(ptype, **kwargs):
|
||||
"""
|
||||
Convenience function to register a new plugin using a dictionary as input.
|
||||
The register functions will call newplugin() function, and use the
|
||||
dictionary kwargs to assign data to the PluginData newplugin() created,
|
||||
as in: plugindata.key = data
|
||||
:param ptype: the plugin type, one of REPORT, TOOL, ...
|
||||
:param kwargs: dictionary with keys attributes of the plugin, and data
|
||||
the value
|
||||
|
||||
:Returns: a newly created PluginData which is already part of the register
|
||||
and which has kwargs assigned as attributes
|
||||
"""
|
||||
plg = newplugin()
|
||||
plg.ptype = ptype
|
||||
for prop in kwargs:
|
||||
#check it is a valid attribute with getattr
|
||||
getattr(plg, prop)
|
||||
#set the value
|
||||
setattr(plg, prop, kwargs[prop])
|
||||
return plg
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PluginRegister
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PluginRegister(object):
|
||||
""" PluginRegister is a Singleton which holds plugin data
|
||||
.. attribute : stable_only
|
||||
Bool, include stable plugins only or not. Default True
|
||||
"""
|
||||
__instance = None
|
||||
|
||||
def get_instance():
|
||||
""" Use this function to get the instance of the PluginRegister """
|
||||
if PluginRegister.__instance is None:
|
||||
PluginRegister.__instance = 1 # Set to 1 for __init__()
|
||||
PluginRegister.__instance = PluginRegister()
|
||||
return PluginRegister.__instance
|
||||
get_instance = staticmethod(get_instance)
|
||||
|
||||
def __init__(self):
|
||||
""" This function should only be run once by get_instance() """
|
||||
if PluginRegister.__instance is not 1:
|
||||
raise Exception("This class is a singleton. "
|
||||
"Use the get_instance() method")
|
||||
self.stable_only = True
|
||||
if __debug__:
|
||||
self.stable_only = False
|
||||
self.__plugindata = []
|
||||
|
||||
def add_plugindata(self, plugindata):
|
||||
self.__plugindata.append(plugindata)
|
||||
|
||||
def scan_dir(self, dir):
|
||||
"""
|
||||
The dir name will be scanned for plugin registration code, which will
|
||||
be loaded in PluginData objects if they satisfy some checks.
|
||||
|
||||
:Returns: A list with PluginData objects
|
||||
"""
|
||||
# if the directory does not exist, do nothing
|
||||
if not os.path.isdir(dir):
|
||||
return []
|
||||
|
||||
ext = r".gpr.py"
|
||||
extlen = -len(ext)
|
||||
pymod = re.compile(r"^(.*)\.py$")
|
||||
|
||||
for filename in os.listdir(dir):
|
||||
name = os.path.split(filename)[1]
|
||||
if not name[extlen:] == ext:
|
||||
continue
|
||||
lenpd = len(self.__plugindata)
|
||||
try:
|
||||
execfile(os.path.join(dir, filename),
|
||||
{'_': _,
|
||||
'newplugin': newplugin,
|
||||
'register': register,
|
||||
'STABLE': STABLE,
|
||||
'UNSTABLE': UNSTABLE,
|
||||
'REPORT': REPORT,
|
||||
'QUICKREPORT': QUICKREPORT,
|
||||
'TOOL': TOOL,
|
||||
'IMPORT': IMPORT,
|
||||
'EXPORT': EXPORT,
|
||||
'DOCGEN': DOCGEN,
|
||||
'GENERAL': GENERAL,
|
||||
'MAPSERVICE': MAPSERVICE,
|
||||
'VIEW': VIEW,
|
||||
'RELCALC': RELCALC,
|
||||
'GRAMPLET': GRAMPLET,
|
||||
'CATEGORY_TEXT': CATEGORY_TEXT,
|
||||
'CATEGORY_DRAW': CATEGORY_DRAW,
|
||||
'CATEGORY_CODE': CATEGORY_CODE,
|
||||
'CATEGORY_WEB': CATEGORY_WEB,
|
||||
'CATEGORY_BOOK': CATEGORY_BOOK,
|
||||
'CATEGORY_GRAPHVIZ': CATEGORY_GRAPHVIZ,
|
||||
'TOOL_DEBUG': TOOL_DEBUG,
|
||||
'TOOL_ANAL': TOOL_ANAL,
|
||||
'TOOL_DBPROC': TOOL_DBPROC,
|
||||
'TOOL_DBFIX': TOOL_DBFIX,
|
||||
'TOOL_REVCTL': TOOL_REVCTL,
|
||||
'TOOL_UTILS': TOOL_UTILS,
|
||||
'CATEGORY_QR_MISC': CATEGORY_QR_MISC,
|
||||
'CATEGORY_QR_PERSON': CATEGORY_QR_PERSON,
|
||||
'CATEGORY_QR_FAMILY': CATEGORY_QR_FAMILY,
|
||||
'CATEGORY_QR_EVENT': CATEGORY_QR_EVENT,
|
||||
'CATEGORY_QR_SOURCE': CATEGORY_QR_SOURCE,
|
||||
'CATEGORY_QR_PLACE': CATEGORY_QR_PLACE,
|
||||
'CATEGORY_QR_REPOSITORY': CATEGORY_QR_REPOSITORY,
|
||||
'CATEGORY_QR_NOTE': CATEGORY_QR_NOTE,
|
||||
'CATEGORY_QR_DATE': CATEGORY_QR_DATE,
|
||||
'REPORT_MODE_GUI': REPORT_MODE_GUI,
|
||||
'REPORT_MODE_BKI': REPORT_MODE_BKI,
|
||||
'REPORT_MODE_CLI': REPORT_MODE_CLI,
|
||||
'TOOL_MODE_GUI': TOOL_MODE_GUI,
|
||||
'TOOL_MODE_CLI': TOOL_MODE_CLI,
|
||||
'GRAMPSVERSION': GRAMPSVERSION,
|
||||
},
|
||||
{})
|
||||
except ValueError, msg:
|
||||
print _('Failed reading plugin registration %(filename)s') % \
|
||||
{'filename' : filename}
|
||||
print msg
|
||||
self.__plugindata = self.__plugindata[:lenpd]
|
||||
except:
|
||||
print _('Failed reading plugin registration %(filename)s') % \
|
||||
{'filename' : filename}
|
||||
print "".join(traceback.format_exception(*sys.exc_info()))
|
||||
self.__plugindata = self.__plugindata[:lenpd]
|
||||
#check if:
|
||||
# 1. plugin exists, if not remove, otherwise set module name
|
||||
# 2. plugin not stable, if stable_only=True, remove
|
||||
# 3. TOOL_DEBUG only if __debug__ True
|
||||
rmlist = []
|
||||
ind = lenpd-1
|
||||
for plugin in self.__plugindata[lenpd:]:
|
||||
ind += 1
|
||||
if not plugin.status == STABLE and self.stable_only:
|
||||
rmlist.append(ind)
|
||||
continue
|
||||
if plugin.ptype == TOOL and plugin.category == TOOL_DEBUG \
|
||||
and not __debug__:
|
||||
rmlist.append(ind)
|
||||
continue
|
||||
match = pymod.match(plugin.fname)
|
||||
if not match:
|
||||
rmlist.append(ind)
|
||||
print _('Wrong python file %(filename)s in register file '
|
||||
'%(regfile)s') % {
|
||||
'filename': os.path.join(dir, plugin.fname),
|
||||
'regfile': os.path.join(dir, filename)
|
||||
}
|
||||
continue
|
||||
if not os.path.isfile(os.path.join(dir, plugin.fname)):
|
||||
rmlist.append(ind)
|
||||
print _('Python file %(filename)s in register file '
|
||||
'%(regfile)s does not exist') % {
|
||||
'filename': os.path.join(dir, plugin.fname),
|
||||
'regfile': os.path.join(dir, filename)
|
||||
}
|
||||
continue
|
||||
module = match.groups()[0]
|
||||
plugin.mod_name = module
|
||||
rmlist.reverse()
|
||||
for ind in rmlist:
|
||||
del self.__plugindata[ind]
|
||||
|
||||
def __type_plugins(self, ptype):
|
||||
"""Return a list of PluginData that are of type ptype
|
||||
"""
|
||||
return [x for x in self.__plugindata if x.ptype == ptype]
|
||||
|
||||
def report_plugins(self, gui=True):
|
||||
"""Return a list of gui or cli PluginData that are of type REPORT
|
||||
:param gui: bool, if True then gui plugin, otherwise cli plugin
|
||||
"""
|
||||
if gui:
|
||||
return [x for x in self.__type_plugins(REPORT) if REPORT_MODE_GUI
|
||||
in x.report_modes]
|
||||
else:
|
||||
return [x for x in self.__type_plugins(REPORT) if REPORT_MODE_CLI
|
||||
in x.report_modes]
|
||||
|
||||
def tool_plugins(self, gui=True):
|
||||
"""Return a list of PluginData that are of type TOOL
|
||||
"""
|
||||
if gui:
|
||||
return [x for x in self.__type_plugins(TOOL) if TOOL_MODE_GUI
|
||||
in x.tool_modes]
|
||||
else:
|
||||
return [x for x in self.__type_plugins(TOOL) if TOOL_MODE_CLI
|
||||
in x.tool_modes]
|
||||
|
||||
|
||||
def bookitem_plugins(self):
|
||||
"""Return a list of REPORT PluginData that are can be used as bookitem
|
||||
"""
|
||||
return [x for x in self.__type_plugins(REPORT) if REPORT_MODE_BKI
|
||||
in x.report_modes]
|
||||
|
||||
def quickreport_plugins(self):
|
||||
"""Return a list of PluginData that are of type QUICKREPORT
|
||||
"""
|
||||
return self.__type_plugins(QUICKREPORT)
|
||||
|
||||
def import_plugins(self):
|
||||
"""Return a list of PluginData that are of type IMPORT
|
||||
"""
|
||||
return self.__type_plugins(IMPORT)
|
||||
|
||||
def export_plugins(self):
|
||||
"""Return a list of PluginData that are of type EXPORT
|
||||
"""
|
||||
return self.__type_plugins(EXPORT)
|
||||
|
||||
def docgen_plugins(self):
|
||||
"""Return a list of PluginData that are of type DOCGEN
|
||||
"""
|
||||
return self.__type_plugins(DOCGEN)
|
||||
|
||||
def general_plugins(self):
|
||||
"""Return a list of PluginData that are of type GENERAL
|
||||
"""
|
||||
return self.__type_plugins(GENERAL)
|
||||
|
||||
def mapservice_plugins(self):
|
||||
"""Return a list of PluginData that are of type MAPSERVICE
|
||||
"""
|
||||
return self.__type_plugins(MAPSERVICE)
|
||||
|
||||
def view_plugins(self):
|
||||
"""Return a list of PluginData that are of type VIEW
|
||||
"""
|
||||
return self.__type_plugins(RELCALC)
|
||||
|
||||
def relcalc_plugins(self):
|
||||
"""Return a list of PluginData that are of type RELCALC
|
||||
"""
|
||||
return self.__type_plugins(RELCALC)
|
||||
|
||||
def filter_load_on_reg(self):
|
||||
"""Return a list of PluginData that have load_on_reg == True
|
||||
"""
|
||||
return [x for x in self.__plugindata if x.load_on_reg == True]
|
@ -58,7 +58,8 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
from cli.grampscli import CLIManager
|
||||
from PluginUtils import Tool, PluginWindows, \
|
||||
ReportPluginDialog, ToolPluginDialog
|
||||
ReportPluginDialog, ToolPluginDialog, gui_tool
|
||||
from gen.plug import PluginManager, REPORT
|
||||
import ReportBase
|
||||
import DisplayState
|
||||
import const
|
||||
@ -230,7 +231,7 @@ class ViewManager(CLIManager):
|
||||
|
||||
self.__build_main_window()
|
||||
self.__connect_signals()
|
||||
self.do_load_plugins()
|
||||
self.do_reg_plugins()
|
||||
|
||||
def _errordialog(title, errormessage):
|
||||
"""
|
||||
@ -546,8 +547,8 @@ class ViewManager(CLIManager):
|
||||
self.actiongroup.set_visible(False)
|
||||
self.readonlygroup.set_visible(False)
|
||||
self.fileactions.set_sensitive(False)
|
||||
self.__build_tools_menu(self._pmgr.get_tool_list())
|
||||
self.__build_report_menu(self._pmgr.get_report_list())
|
||||
self.__build_tools_menu(self._pmgr.get_reg_tools())
|
||||
self.__build_report_menu(self._pmgr.get_reg_reports())
|
||||
self.uistate.set_relationship_class()
|
||||
self._pmgr.connect('plugins-reloaded',
|
||||
self.__rebuild_report_and_tool_menus)
|
||||
@ -605,6 +606,21 @@ class ViewManager(CLIManager):
|
||||
self.__plugin_status()
|
||||
|
||||
self.uistate.push_message(self.dbstate, _('Ready'))
|
||||
|
||||
def do_reg_plugins(self):
|
||||
"""
|
||||
Register the plugins at initialization time. The plugin status window
|
||||
is opened on an error if the user has requested.
|
||||
"""
|
||||
# registering plugins
|
||||
self.uistate.status_text(_('Registering plugins...'))
|
||||
error = CLIManager.do_reg_plugins(self)
|
||||
|
||||
# get to see if we need to open the plugin status window
|
||||
if error and config.get('behavior.pop-plugin-status'):
|
||||
self.__plugin_status()
|
||||
|
||||
self.uistate.push_message(self.dbstate, _('Ready'))
|
||||
|
||||
def quit(self, *obj):
|
||||
"""
|
||||
@ -1266,10 +1282,8 @@ class ViewManager(CLIManager):
|
||||
"""
|
||||
Callback that rebuilds the tools and reports menu
|
||||
"""
|
||||
tool_menu_list = self._pmgr.get_tool_list()
|
||||
report_menu_list = self._pmgr.get_report_list()
|
||||
self.__build_tools_menu(tool_menu_list)
|
||||
self.__build_report_menu(report_menu_list)
|
||||
self.__build_tools_menu(self._pmgr.get_reg_tools())
|
||||
self.__build_report_menu(self._pmgr.get_reg_reports())
|
||||
self.uistate.set_relationship_class()
|
||||
|
||||
def __build_tools_menu(self, tool_menu_list):
|
||||
@ -1279,7 +1293,7 @@ class ViewManager(CLIManager):
|
||||
self.toolactions = gtk.ActionGroup('ToolWindow')
|
||||
(uidef, actions) = self.build_plugin_menu(
|
||||
'ToolsMenu', tool_menu_list, Tool.tool_categories,
|
||||
make_tool_callback)
|
||||
make_plugin_callback)
|
||||
self.toolactions.add_actions(actions)
|
||||
self.uistate.uimanager.add_ui_from_string(uidef)
|
||||
self.uimanager.insert_action_group(self.toolactions, 1)
|
||||
@ -1292,7 +1306,7 @@ class ViewManager(CLIManager):
|
||||
self.reportactions = gtk.ActionGroup('ReportWindow')
|
||||
(uidef, actions) = self.build_plugin_menu(
|
||||
'ReportsMenu', report_menu_list, ReportBase.standalone_categories,
|
||||
make_report_callback)
|
||||
make_plugin_callback)
|
||||
self.reportactions.add_actions(actions)
|
||||
self.uistate.uimanager.add_ui_from_string(uidef)
|
||||
self.uimanager.insert_action_group(self.reportactions, 1)
|
||||
@ -1300,7 +1314,7 @@ class ViewManager(CLIManager):
|
||||
|
||||
def build_plugin_menu(self, text, item_list, categories, func):
|
||||
"""
|
||||
Builds a new XML description for a menu based on the item list
|
||||
Builds a new XML description for a menu based on the list of plugindata
|
||||
"""
|
||||
actions = []
|
||||
ofile = StringIO()
|
||||
@ -1310,17 +1324,15 @@ class ViewManager(CLIManager):
|
||||
menu.show()
|
||||
|
||||
hash_data = {}
|
||||
for item in item_list:
|
||||
if item[9]:
|
||||
for pdata in item_list:
|
||||
if not pdata.supported:
|
||||
category = _UNSUPPORTED
|
||||
else:
|
||||
category = categories[item[3]]
|
||||
category = categories[pdata.category]
|
||||
if category in hash_data:
|
||||
hash_data[category].append(
|
||||
(item[0], item[1], item[2], item[4], item[3], item[10]))
|
||||
hash_data[category].append(pdata)
|
||||
else:
|
||||
hash_data[category] = [
|
||||
(item[0], item[1], item[2], item[4], item[3], item[10])]
|
||||
hash_data[category] = [pdata]
|
||||
|
||||
# Sort categories, skipping the unsupported
|
||||
catlist = [item for item in hash_data
|
||||
@ -1330,14 +1342,14 @@ class ViewManager(CLIManager):
|
||||
new_key = key.replace(' ', '-')
|
||||
ofile.write('<menu action="%s">' % new_key)
|
||||
actions.append((new_key, None, key))
|
||||
lst = hash_data[key]
|
||||
lst.sort(by_menu_name)
|
||||
for name in lst:
|
||||
new_key = name[3].replace(' ', '-')
|
||||
menu_name = ("%s...") % name[2]
|
||||
pdatas = hash_data[key]
|
||||
pdatas.sort(by_menu_name)
|
||||
for pdata in pdatas:
|
||||
new_key = pdata.id.replace(' ', '-')
|
||||
menu_name = ("%s...") % pdata.name
|
||||
ofile.write('<menuitem action="%s"/>' % new_key)
|
||||
actions.append((new_key, None, menu_name, None, None,
|
||||
func(name, self.dbstate, self.uistate)))
|
||||
func(pdata, self.dbstate, self.uistate)))
|
||||
ofile.write('</menu>')
|
||||
|
||||
# If there are any unsupported items we add separator
|
||||
@ -1346,13 +1358,14 @@ class ViewManager(CLIManager):
|
||||
ofile.write('<separator/>')
|
||||
ofile.write('<menu action="%s">' % _UNSUPPORTED)
|
||||
actions.append((_UNSUPPORTED, None, _UNSUPPORTED))
|
||||
lst = hash_data[_UNSUPPORTED]
|
||||
lst.sort(by_menu_name)
|
||||
for name in lst:
|
||||
new_key = name[3].replace(' ', '-')
|
||||
pdatas = hash_data[_UNSUPPORTED]
|
||||
pdatas.sort(by_menu_name)
|
||||
for pdata in pdatas:
|
||||
new_key = pdata.id.replace(' ', '-')
|
||||
menu_name = ("%s...") % pdata.name
|
||||
ofile.write('<menuitem action="%s"/>' % new_key)
|
||||
actions.append((new_key, None, name[2], None, None,
|
||||
func(name, self.dbstate, self.uistate)))
|
||||
actions.append((new_key, None, menu_name, None, None,
|
||||
func(pdata, self.dbstate, self.uistate)))
|
||||
ofile.write('</menu>')
|
||||
|
||||
ofile.write('</menu></menubar></ui>')
|
||||
@ -1417,20 +1430,40 @@ def by_menu_name(first, second):
|
||||
"""
|
||||
Sorts menu item lists
|
||||
"""
|
||||
return cmp(first[2], second[2])
|
||||
return cmp(first.name, second.name)
|
||||
|
||||
def make_report_callback(lst, dbstate, uistate):
|
||||
"""
|
||||
Makes a callback for a report menu item
|
||||
"""
|
||||
return lambda x: ReportBase.report(
|
||||
dbstate, uistate, dbstate.get_active_person(),
|
||||
lst[0], lst[1], lst[2], lst[3], lst[4], lst[5])
|
||||
def run_plugin(pdata, dbstate, uistate):
|
||||
"""
|
||||
run a plugin based on it's PluginData:
|
||||
1/ load plugin.
|
||||
2/ the report is run
|
||||
"""
|
||||
mod = PluginManager.get_instance().load_plugin(pdata)
|
||||
if not mod:
|
||||
#import of plugin failed
|
||||
ErrorDialog(
|
||||
_('Failed Loading Plugin'),
|
||||
_('The plugin did not load. See Help Menu, Plugin Status'
|
||||
' for more info.\nUse http://bugs.gramps-project.org to'
|
||||
' submit bugs of official plugins, contact the plugin '
|
||||
'author otherwise. '))
|
||||
return
|
||||
|
||||
def make_tool_callback(lst, dbstate, uistate):
|
||||
if pdata.ptype == REPORT:
|
||||
ReportBase.report(dbstate, uistate, dbstate.active,
|
||||
eval('mod.' + pdata.reportclass),
|
||||
eval('mod.' + pdata.optionclass),
|
||||
pdata.name, pdata.id,
|
||||
pdata.category, pdata.require_active)
|
||||
else:
|
||||
gui_tool(dbstate, uistate,
|
||||
eval('mod.' + pdata.toolclass),
|
||||
eval('mod.' + pdata.optionclass),
|
||||
pdata.name, pdata.id, pdata.category,
|
||||
dbstate.db.request_rebuild)
|
||||
|
||||
def make_plugin_callback(pdata, dbstate, uistate):
|
||||
"""
|
||||
Makes a callback for a tool menu item
|
||||
Makes a callback for a report/tool menu item
|
||||
"""
|
||||
return lambda x: Tool.gui_tool(dbstate, uistate,
|
||||
lst[0], lst[1], lst[2], lst[3], lst[4],
|
||||
dbstate.db.request_rebuild)
|
||||
return lambda x: run_plugin(pdata, dbstate, uistate)
|
||||
|
@ -69,9 +69,9 @@ import const
|
||||
import Utils
|
||||
import ListModel
|
||||
import Errors
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.docgen import StyleSheet, StyleSheetList
|
||||
from QuestionDialog import WarningDialog, ErrorDialog
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.menu import PersonOption, FilterOption, FamilyOption
|
||||
import ManagedWindow
|
||||
from glade import Glade
|
||||
@ -200,16 +200,18 @@ class BookItem(object):
|
||||
self.style_name = "default"
|
||||
pmgr = PluginManager.get_instance()
|
||||
|
||||
for item in pmgr.get_book_item_list():
|
||||
if item[4] == name:
|
||||
self.translated_name = item[0]
|
||||
if item[5]:
|
||||
for pdata in pmgr.get_reg_bookitems():
|
||||
if pdata.id == name:
|
||||
self.translated_name = pdata.name
|
||||
if not pdata.supported:
|
||||
self.category = _UNSUPPORTED
|
||||
else:
|
||||
self.category = book_categories[item[1]]
|
||||
self.write_item = item[2]
|
||||
self.name = item[4]
|
||||
self.option_class = item[3](self.name, self.dbase)
|
||||
self.category = book_categories[pdata.category]
|
||||
mod = pmgr.load_plugin(pdata)
|
||||
self.write_item = eval('mod.' + pdata.reportclass)
|
||||
self.name = pdata.id
|
||||
oclass = eval('mod.' + pdata.optionclass)
|
||||
self.option_class = oclass(self.name, self.dbase)
|
||||
self.option_class.load_previous_values()
|
||||
|
||||
def get_name(self):
|
||||
@ -747,16 +749,17 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
The selections are read from the book item registry.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
if not pmgr.get_book_item_list():
|
||||
regbi = pmgr.get_reg_bookitems()
|
||||
if not regbi:
|
||||
return
|
||||
|
||||
for book_item in pmgr.get_book_item_list():
|
||||
if book_item[5]:
|
||||
for pdata in regbi:
|
||||
if not pdata.supported:
|
||||
category = _UNSUPPORTED
|
||||
else:
|
||||
category = book_categories[book_item[1]]
|
||||
category = book_categories[pdata.category]
|
||||
|
||||
data = [ book_item[0], category, book_item[4] ]
|
||||
data = [pdata.name, category, pdata.id ]
|
||||
new_iter = self.avail_model.add(data)
|
||||
|
||||
self.avail_model.connect_model()
|
||||
@ -1275,22 +1278,3 @@ def write_book_item(database, report_class, options_class):
|
||||
except:
|
||||
log.error("Failed to write book item.", exc_info=True)
|
||||
return None
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'book',
|
||||
category = CATEGORY_BOOK,
|
||||
report_class = BookReportSelector,
|
||||
options_class = cl_report,
|
||||
modes = PluginManager.REPORT_MODE_GUI | PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Book Report"),
|
||||
status = _("Stable"),
|
||||
description = _("Produces a book containing several reports."),
|
||||
author_name = "Alex Roitman",
|
||||
author_email = "shura@gramps-project.org"
|
||||
)
|
||||
|
@ -22,6 +22,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/plugins
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
BookReport.py\
|
||||
records.gpr.py\
|
||||
Records.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/plugins
|
||||
|
@ -37,12 +37,10 @@ from TransUtils import sgettext as _
|
||||
from gen.lib import ChildRefType, Date, EventType, Name
|
||||
from gen.plug.docgen import FontStyle, ParagraphStyle, FONT_SANS_SERIF
|
||||
from BasicUtils import name_displayer
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from gen.plug.menu import (BooleanOption, EnumeratedListOption,
|
||||
FilterOption, PersonOption)
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||
CATEGORY_TEXT
|
||||
from gen.plug import PluginManager
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
from Utils import probably_alive
|
||||
|
||||
MODE_GUI = PluginManager.REPORT_MODE_GUI
|
||||
@ -542,32 +540,3 @@ RECORDS = [
|
||||
(_("Living couple married most long ago"), 'family_oldestmarried', True),
|
||||
(_("Shortest past marriage"), 'family_shortest', False),
|
||||
(_("Longest past marriage"), 'family_longest', True)]
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register the gramplet and the report
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
register(
|
||||
type="gramplet",
|
||||
name= "Records Gramplet",
|
||||
tname=_("Records Gramplet"),
|
||||
height=230,
|
||||
expand=True,
|
||||
content = RecordsGramplet,
|
||||
title=_("Records"))
|
||||
|
||||
pmgr.register_report(
|
||||
name = 'records',
|
||||
category = CATEGORY_TEXT,
|
||||
report_class = RecordsReport,
|
||||
options_class = RecordsReportOptions,
|
||||
modes = MODE_GUI | MODE_BKI | MODE_CLI,
|
||||
translated_name = _("Records Report"),
|
||||
status = _("Stable"),
|
||||
author_name = u"Reinhard Müller",
|
||||
author_email = "reinhard.mueller@bytewise.at",
|
||||
description = _(
|
||||
"Shows some interesting records about people and families"))
|
||||
|
21
src/plugins/bookreport.gpr.py
Normal file
21
src/plugins/bookreport.gpr.py
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Book plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
register(REPORT,
|
||||
id = 'book',
|
||||
name = _("Book Report"),
|
||||
description = _("Produces a book containing several reports."),
|
||||
version = '1.0',
|
||||
status = STABLE,
|
||||
fname = 'BookReport.py',
|
||||
authors = ["Alex Roitman"],
|
||||
authors_email = ["shura@gramps-project.org"],
|
||||
category = CATEGORY_BOOK,
|
||||
reportclass = 'BookReportSelector',
|
||||
optionclass = 'cl_report',
|
||||
report_modes = [REPORT_MODE_GUI, REPORT_MODE_CLI]
|
||||
)
|
@ -37,7 +37,6 @@ from gettext import gettext as _
|
||||
from gui.utils import open_file_with_default_application
|
||||
from gen.plug.docgen import BaseDoc, TextDoc,\
|
||||
PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
import Errors
|
||||
import Utils
|
||||
|
||||
@ -364,24 +363,3 @@ class AsciiDoc(BaseDoc,TextDoc):
|
||||
#--------------------------------------------------------------------
|
||||
def write_text(self,text,mark=None):
|
||||
self.text = self.text + text
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _("Plain Text"),
|
||||
description = _("Generates documents in plain text "
|
||||
"format (.txt)."),
|
||||
basedoc = AsciiDoc,
|
||||
paper = True,
|
||||
style = True,
|
||||
extension = "txt" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
@ -44,7 +44,6 @@ from math import radians
|
||||
#------------------------------------------------------------------------
|
||||
from gen.plug.docgen import PAPER_PORTRAIT
|
||||
import libcairodoc
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
import Errors
|
||||
from glade import Glade
|
||||
|
||||
@ -602,24 +601,3 @@ class GtkPrint(libcairodoc.CairoDoc):
|
||||
context.set_cairo_context(cr, PRINTER_DPI, PRINTER_DPI)
|
||||
|
||||
return True
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _('Print...'),
|
||||
description = _("Generates documents and prints them "
|
||||
"directly."),
|
||||
basedoc = GtkPrint,
|
||||
paper = True,
|
||||
style = True,
|
||||
extension = "" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
@ -43,7 +43,6 @@ from gettext import gettext as _
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gui.utils import open_file_with_default_application
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
import ImgManip
|
||||
import const
|
||||
from gen.plug.docgen import BaseDoc, TextDoc, FONT_SANS_SERIF
|
||||
@ -541,24 +540,3 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
overwrite base method so page break has no effect
|
||||
"""
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _('HTML'),
|
||||
description = _("Generates documents in HTML "
|
||||
"format."),
|
||||
basedoc = HtmlDoc,
|
||||
paper = False,
|
||||
style = True,
|
||||
extension = "html" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
@ -40,7 +40,6 @@ from gettext import gettext as _
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gui.utils import open_file_with_default_application
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
from gen.plug.docgen import BaseDoc, TextDoc, PAPER_LANDSCAPE, FONT_SANS_SERIF
|
||||
from gen.plug.docbackend import DocBackend
|
||||
import ImgManip
|
||||
@ -657,24 +656,3 @@ class LaTeXDoc(BaseDoc, TextDoc):
|
||||
if format == 1:
|
||||
self._backend.write('\\end{verbatim}')
|
||||
self.end_paragraph()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _('LaTeX'),
|
||||
description = _("Generates documents in LaTeX "
|
||||
"format."),
|
||||
basedoc = LaTeXDoc,
|
||||
paper = True,
|
||||
style = False,
|
||||
extension = "tex" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
@ -7,6 +7,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/plugins/docgen
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
AsciiDoc.py \
|
||||
docgen.gpr.py\
|
||||
GtkPrint.py \
|
||||
HtmlDoc.py \
|
||||
LaTeXDoc.py \
|
||||
|
@ -77,7 +77,6 @@ from xml.sax.saxutils import escape
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gui.utils import open_file_with_default_application
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
from gen.plug.docgen import (BaseDoc, TextDoc, DrawDoc,
|
||||
FONT_SANS_SERIF, DASHED, PAPER_PORTRAIT,
|
||||
INDEX_TYPE_TOC, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,
|
||||
@ -1541,24 +1540,3 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
|
||||
self.cntnt.write('</text:p>\n')
|
||||
self.cntnt.write('</draw:text-box>')
|
||||
self.cntnt.write('</draw:frame>\n')
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _('Open Document Text'),
|
||||
description = _("Generates documents in Open "
|
||||
"Document Text format (.odt)."),
|
||||
basedoc = ODFDoc,
|
||||
paper = True,
|
||||
style = True,
|
||||
extension = "odt" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
@ -37,7 +37,6 @@ from gettext import gettext as _
|
||||
#-------------------------------------------------------------------------
|
||||
from gui.utils import open_file_with_default_application
|
||||
from ReportBase import ReportUtils
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
from gen.plug.docgen import BaseDoc, DrawDoc, FONT_SERIF, PAPER_PORTRAIT, SOLID
|
||||
from gen.plug.utils import gformat
|
||||
import Errors
|
||||
@ -350,24 +349,3 @@ class PSDrawDoc(BaseDoc, DrawDoc):
|
||||
self.file.write('%s cm %s cm moveto\n' % coords(self.translate(x+mar, ypos)))
|
||||
self.file.write("(%s) show\n" % lines[i])
|
||||
self.file.write('grestore\n')
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _("PostScript"),
|
||||
description = _("Generates documents in postscript "
|
||||
"format (.ps)."),
|
||||
basedoc = PSDrawDoc,
|
||||
paper = True,
|
||||
style = True,
|
||||
extension = "ps" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
@ -38,7 +38,6 @@ from gettext import gettext as _
|
||||
#------------------------------------------------------------------------
|
||||
from gui.utils import open_file_with_default_application
|
||||
import libcairodoc
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -126,24 +125,3 @@ class PdfDoc(libcairodoc.CairoDoc):
|
||||
# load the result into an external viewer
|
||||
if self.open_req:
|
||||
open_file_with_default_application(self._backend.filename)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _('PDF document'),
|
||||
description = _("Generates documents in PDF "
|
||||
"format (.pdf)."),
|
||||
basedoc = PdfDoc,
|
||||
paper = True,
|
||||
style = True,
|
||||
extension = "pdf" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
@ -37,7 +37,6 @@ from gettext import gettext as _
|
||||
from gui.utils import open_file_with_default_application
|
||||
from gen.plug.docgen import (BaseDoc, TextDoc, FONT_SERIF, PARA_ALIGN_RIGHT,
|
||||
PARA_ALIGN_CENTER, PARA_ALIGN_JUSTIFY)
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
import ImgManip
|
||||
import Errors
|
||||
import Utils
|
||||
@ -433,24 +432,3 @@ class RTFDoc(BaseDoc,TextDoc):
|
||||
self.text = self.text + '\\%s' % i
|
||||
else:
|
||||
self.text = self.text + i
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _('RTF document'),
|
||||
description = _("Generates documents in Rich Text "
|
||||
"format (.rtf)."),
|
||||
basedoc = RTFDoc,
|
||||
paper = True,
|
||||
style = True,
|
||||
extension = "rtf" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
@ -38,7 +38,6 @@ import StringIO
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.plug import PluginManager, DocGenPlugin
|
||||
from gen.plug.docgen import BaseDoc, DrawDoc, FONT_SANS_SERIF
|
||||
import Errors
|
||||
|
||||
@ -259,24 +258,3 @@ class SvgDrawDoc(BaseDoc, DrawDoc):
|
||||
|
||||
def units(val):
|
||||
return (val[0]*35.433, val[1]*35.433)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
"""
|
||||
Register the document generator with the GRAMPS plugin system.
|
||||
"""
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = DocGenPlugin(name = _("SVG (Scalable Vector Graphics)"),
|
||||
description = _("Generates documents in Scalable "
|
||||
"Vector Graphics format (.svg)."),
|
||||
basedoc = SvgDrawDoc,
|
||||
paper = True,
|
||||
style = True,
|
||||
extension = "svg" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
register_plugin()
|
||||
|
173
src/plugins/docgen/docgen.gpr.py
Normal file
173
src/plugins/docgen/docgen.gpr.py
Normal file
@ -0,0 +1,173 @@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Ascii docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'asciidoc'
|
||||
plg.name = _("Plain Text")
|
||||
plg.description = _("Generates documents in plain text format (.txt).")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'AsciiDoc.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'AsciiDoc'
|
||||
plg.paper = True
|
||||
plg.style = True
|
||||
plg.extension = "txt"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GTKPrint docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'gtkprint'
|
||||
plg.name = _('Print...')
|
||||
plg.description = _("Generates documents and prints them directly.")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'GtkPrint.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'GtkPrint'
|
||||
plg.paper = True
|
||||
plg.style = True
|
||||
plg.extension = ""
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# HtmlDoc docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'htmldoc'
|
||||
plg.name = _('HTML')
|
||||
plg.description = _("Generates documents in HTML format.")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'HtmlDoc.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'HtmlDoc'
|
||||
plg.paper = False
|
||||
plg.style = True
|
||||
plg.extension = "html"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# LaTeXDoc docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'latexdoc'
|
||||
plg.name = _('LaTeX')
|
||||
plg.description = _("Generates documents in LaTeX format.")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'LaTeXDoc.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'LaTeXDoc'
|
||||
plg.paper = True
|
||||
plg.style = False
|
||||
plg.extension = "tex"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# ODFDoc docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'odfdoc'
|
||||
plg.name = _('Open Document Text')
|
||||
plg.description = _("Generates documents in Open "
|
||||
"Document Text format (.odt).")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ODFDoc.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'ODFDoc'
|
||||
plg.paper = True
|
||||
plg.style = True
|
||||
plg.extension = "odt"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# PdfDoc docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'pdfdoc'
|
||||
plg.name = _('PDF document')
|
||||
plg.description = _("Generates documents in PDF format (.pdf).")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'PdfDoc.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'PdfDoc'
|
||||
plg.paper = True
|
||||
plg.style = True
|
||||
plg.extension = "pdf"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# PSDrawDoc docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'psdrawdoc'
|
||||
plg.name = _('PostScript')
|
||||
plg.description = _("Generates documents in postscript format (.ps).")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'PSDrawDoc.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'PSDrawDoc'
|
||||
plg.paper = True
|
||||
plg.style = True
|
||||
plg.extension = "ps"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# RTFDoc docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'rftdoc'
|
||||
plg.name = _('RTF document')
|
||||
plg.description = _("Generates documents in Rich Text format (.rtf).")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'RTFDoc.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'RTFDoc'
|
||||
plg.paper = True
|
||||
plg.style = True
|
||||
plg.extension = "rtf"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# SvgDrawDoc docgen
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'SVG (Scalable Vector Graphics)'
|
||||
plg.name = _('RTF document')
|
||||
plg.description = _("Generates documents in Scalable "
|
||||
"Vector Graphics format (.svg).")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'SvgDrawDoc.py'
|
||||
plg.ptype = DOCGEN
|
||||
plg.basedocclass = 'SvgDrawDoc'
|
||||
plg.paper = True
|
||||
plg.style = True
|
||||
plg.extension = "svg"
|
@ -37,11 +37,10 @@ from TransUtils import sgettext as _
|
||||
#------------------------------------------------------------------------
|
||||
from BasicUtils import name_displayer
|
||||
from Errors import ReportError
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
|
||||
from gen.plug.menu import BooleanOption, NumberOption, TextOption, PersonOption
|
||||
from ReportBase import Report, ReportUtils, CATEGORY_DRAW, MenuReportOptions
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
from SubstKeywords import SubstKeywords
|
||||
|
||||
pt2cm = ReportUtils.pt2cm
|
||||
@ -524,24 +523,3 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
|
||||
g = GraphicsStyle()
|
||||
default_style.add_draw_style("AC2-line", g)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'ancestor_chart',
|
||||
category = CATEGORY_DRAW,
|
||||
report_class = AncestorTree,
|
||||
options_class = AncestorTreeOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_BKI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Ancestor Tree"),
|
||||
status = _("Stable"),
|
||||
author_name = "Donald N. Allingham",
|
||||
author_email = "don@gramps-project.org",
|
||||
description = _("Produces a graphical ancestral tree"),
|
||||
)
|
||||
|
@ -44,7 +44,7 @@ from gen.plug.docgen.fontscale import string_trim
|
||||
from gen.plug.menu import (BooleanOption, StringOption, NumberOption,
|
||||
EnumeratedListOption, FilterOption, PersonOption)
|
||||
from gui.utils import ProgressMeter
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
from Utils import probably_alive
|
||||
import GrampsLocale
|
||||
import gen.lib
|
||||
@ -528,25 +528,3 @@ class CalendarOptions(MenuReportOptions):
|
||||
_('Text at bottom, line 3'), 9)
|
||||
self.make_my_style(default_style, "CAL-Border",
|
||||
_('Borders'), borders=True)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register the plugins
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'calendar',
|
||||
category = CATEGORY_DRAW,
|
||||
report_class = Calendar,
|
||||
options_class = CalendarOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_BKI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Calendar"),
|
||||
status = _("Stable"),
|
||||
author_name = "Douglas S. Blank",
|
||||
author_email = "dblank@cs.brynmawr.edu",
|
||||
description = _("Produces a graphical calendar"),
|
||||
)
|
||||
|
||||
|
@ -31,11 +31,10 @@
|
||||
#------------------------------------------------------------------------
|
||||
from BasicUtils import name_displayer
|
||||
from Errors import ReportError
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.docgen import (GraphicsStyle, FontStyle, ParagraphStyle,
|
||||
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
|
||||
from gen.plug.menu import TextOption, NumberOption, BooleanOption, PersonOption
|
||||
from ReportBase import Report, MenuReportOptions, ReportUtils, CATEGORY_DRAW
|
||||
from ReportBase import Report, MenuReportOptions, ReportUtils
|
||||
from SubstKeywords import SubstKeywords
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
@ -524,24 +523,3 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
|
||||
g = GraphicsStyle()
|
||||
default_style.add_draw_style("DC2-line", g)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'descend_chart',
|
||||
category = CATEGORY_DRAW,
|
||||
report_class = DescendTree,
|
||||
options_class = DescendTreeOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_BKI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Descendant Tree"),
|
||||
status = _("Stable"),
|
||||
author_name = "Donald N. Allingham",
|
||||
author_email = "don@gramps-project.org",
|
||||
description = _("Produces a graphical descendant tree"),
|
||||
)
|
||||
|
@ -34,11 +34,10 @@ from gettext import gettext as _
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Errors import ReportError
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
|
||||
from gen.plug.menu import EnumeratedListOption, NumberOption, PersonOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
from SubstKeywords import SubstKeywords
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -430,24 +429,3 @@ class FanChartOptions(MenuReportOptions):
|
||||
g.set_fill_color((255,255,255))
|
||||
g.set_paragraph_style('FC-Normal')
|
||||
default_style.add_draw_style('background_style_white',g)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'fan_chart',
|
||||
category = CATEGORY_DRAW,
|
||||
report_class = FanChart,
|
||||
options_class = FanChartOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_BKI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Fan Chart"),
|
||||
status = _("Stable"),
|
||||
author_name = "Donald N. Allingham",
|
||||
author_email = "don@gramps-project.org",
|
||||
description = _("Produces fan charts")
|
||||
)
|
||||
|
@ -7,8 +7,9 @@ pkgdatadir = $(datadir)/@PACKAGE@/plugins/drawreport
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
AncestorTree.py \
|
||||
Calendar.py\
|
||||
Calendar.py\
|
||||
DescendTree.py \
|
||||
drawplugins.gpr.py\
|
||||
FanChart.py \
|
||||
StatisticsChart.py \
|
||||
TimeLine.py
|
||||
|
@ -46,10 +46,9 @@ from gen.lib import Person, FamilyRelType, EventType
|
||||
from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
FONT_SANS_SERIF, FONT_SERIF,
|
||||
PARA_ALIGN_CENTER, PARA_ALIGN_LEFT)
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.menu import BooleanOption, NumberOption, EnumeratedListOption, \
|
||||
FilterOption, PersonOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
import DateHandler
|
||||
from gui.utils import ProgressMeter
|
||||
|
||||
@ -882,26 +881,3 @@ class StatisticsChartOptions(MenuReportOptions):
|
||||
g.set_fill_color((255,255,255))
|
||||
g.set_line_width(0)
|
||||
default_style.add_draw_style("SC-legend",g)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register report/options
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'statistics_chart',
|
||||
category = CATEGORY_DRAW,
|
||||
report_class = StatisticsChart,
|
||||
options_class = StatisticsChartOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_BKI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Statistics Charts"),
|
||||
status = _("Stable"),
|
||||
author_name = "Eero Tamminen",
|
||||
author_email = "",
|
||||
description = _("Produces statistical bar and pie charts of the people "
|
||||
"in the database"),
|
||||
require_active = False,
|
||||
)
|
||||
|
@ -37,9 +37,8 @@ from TransUtils import sgettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.menu import PersonOption, FilterOption, EnumeratedListOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
pt2cm = ReportUtils.pt2cm
|
||||
from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
FONT_SANS_SERIF, DASHED, PARA_ALIGN_CENTER)
|
||||
@ -449,24 +448,3 @@ class TimeLineOptions(MenuReportOptions):
|
||||
g.set_fill_color((255,255,255))
|
||||
g.set_line_width(0)
|
||||
default_style.add_draw_style("TLG-label",g)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'timeline',
|
||||
category = CATEGORY_DRAW,
|
||||
report_class = TimeLine,
|
||||
options_class = TimeLineOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_BKI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Timeline Chart"),
|
||||
status = _("Stable"),
|
||||
author_name = "Donald N. Allingham",
|
||||
author_email = "don@gramps-project.org",
|
||||
description = _("Produces a timeline chart.")
|
||||
)
|
||||
|
128
src/plugins/drawreport/drawplugins.gpr.py
Normal file
128
src/plugins/drawreport/drawplugins.gpr.py
Normal file
@ -0,0 +1,128 @@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Ancestor Tree
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ancestor_chart'
|
||||
plg.name = _("Ancestor Tree")
|
||||
plg.description = _("Produces a graphical ancestral tree")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'AncestorTree.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Donald N. Allingham"]
|
||||
plg.authors_email = ["don@gramps-project.org"]
|
||||
plg.category = CATEGORY_DRAW
|
||||
plg.reportclass = 'AncestorTree'
|
||||
plg.optionclass = 'AncestorTreeOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Calendar
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'calendar'
|
||||
plg.name = _("Calendar")
|
||||
plg.description = _("Produces a graphical calendar")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'Calendar.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Douglas S. Blank"]
|
||||
plg.authors_email = ["dblank@cs.brynmawr.edu"]
|
||||
plg.category = CATEGORY_DRAW
|
||||
plg.reportclass = 'Calendar'
|
||||
plg.optionclass = 'CalendarOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Descendant Tree
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'descend_chart'
|
||||
plg.name = _("Descendant Tree")
|
||||
plg.description = _("Produces a graphical descendant tree")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'DescendTree.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Donald N. Allingham"]
|
||||
plg.authors_email = ["don@gramps-project.org"]
|
||||
plg.category = CATEGORY_DRAW
|
||||
plg.reportclass = 'DescendTree'
|
||||
plg.optionclass = 'DescendTreeOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Fan Chart
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'fan_chart'
|
||||
plg.name = _("Fan Chart")
|
||||
plg.description = _("Produces fan charts")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'FanChart.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Donald N. Allingham"]
|
||||
plg.authors_email = ["don@gramps-project.org"]
|
||||
plg.category = CATEGORY_DRAW
|
||||
plg.reportclass = 'FanChart'
|
||||
plg.optionclass = 'FanChartOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Statistics Charts
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'statistics_chart'
|
||||
plg.name = _("Statistics Charts")
|
||||
plg.description = _("Produces statistical bar and pie charts of the people "
|
||||
"in the database")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'StatisticsChart.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Eero Tamminen"]
|
||||
plg.authors_email = [""]
|
||||
plg.category = CATEGORY_DRAW
|
||||
plg.reportclass = 'StatisticsChart'
|
||||
plg.optionclass = 'StatisticsChartOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
|
||||
plg.require_active = False
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Timeline Chart
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'timeline'
|
||||
plg.name = _("Timeline Chart")
|
||||
plg.description = _("Produces a timeline chart.")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'TimeLine.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Donald N. Allingham"]
|
||||
plg.authors_email = ["don@gramps-project.org"]
|
||||
plg.category = CATEGORY_DRAW
|
||||
plg.reportclass = 'TimeLine'
|
||||
plg.optionclass = 'TimeLineOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
|
@ -51,7 +51,6 @@ import gen.lib
|
||||
from Filters import GenericFilter, Rules, build_filter_model
|
||||
import Utils
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
import gen.proxy
|
||||
import DateHandler
|
||||
from glade import Glade
|
||||
@ -475,20 +474,3 @@ class CSVWriter(object):
|
||||
|
||||
def format_date(self, date):
|
||||
return DateHandler.get_date(date)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register the plugin
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
_name = _('Comma _Separated Values Spreadsheet (CSV)')
|
||||
_description = _('CSV is a common spreadsheet format.')
|
||||
_config = (_('CSV spreadsheet options'),CSVWriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _name,
|
||||
description = _description,
|
||||
export_function = exportData,
|
||||
extension = "csv",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -48,7 +48,6 @@ import Utils
|
||||
from Filters import GenericFilter, Rules, build_filter_model
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
from glade import Glade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -282,18 +281,3 @@ def get_name(name, count):
|
||||
(str(count) if count != -1 else '') +
|
||||
(', ' +name.suffix if name.suffix else '')
|
||||
)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_config = (_('Web Family Tree export options'), FtreeWriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _('_Web Family Tree'),
|
||||
description = _('Web Family Tree format.'),
|
||||
export_function = writeData,
|
||||
extension = "wft",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -48,7 +48,6 @@ import BasicUtils
|
||||
from Utils import media_path_full
|
||||
import gen.proxy
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -1405,20 +1404,3 @@ def export_data(database, filename, option_box=None, callback=None):
|
||||
except:
|
||||
ErrorDialog(_("Could not create %s") % filename)
|
||||
return ret
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_description = _('GEDCOM is used to transfer data between genealogy programs. '
|
||||
'Most genealogy software will accept a GEDCOM file as input.')
|
||||
_config = (_('GEDCOM export options'), ExportOptions.WriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _('GE_DCOM'),
|
||||
description = _description,
|
||||
export_function = export_data,
|
||||
extension = "ged",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -50,7 +50,6 @@ from Filters import GenericFilter, Rules, build_filter_model
|
||||
#import const
|
||||
import Utils
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
from glade import Glade
|
||||
import config
|
||||
|
||||
@ -612,19 +611,3 @@ class GeneWebWriter(object):
|
||||
def exportData(database, filename, option_box=None, callback=None):
|
||||
gw = GeneWebWriter(database, filename, option_box, callback)
|
||||
return gw.export_data()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_description = _('GeneWeb is a web based genealogy program.')
|
||||
_config = (_('GeneWeb export options'), GeneWebWriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _('_GeneWeb'),
|
||||
description = _description,
|
||||
export_function = exportData,
|
||||
extension = "gw",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -36,9 +36,6 @@ import sys
|
||||
import tarfile
|
||||
from cStringIO import StringIO
|
||||
from gettext import gettext as _
|
||||
import ExportOptions
|
||||
#from BasicUtils import UpdateCallback
|
||||
import gen.proxy
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -60,8 +57,10 @@ import gtk
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import ExportOptions
|
||||
#from BasicUtils import UpdateCallback
|
||||
import gen.proxy
|
||||
from ExportXml import XmlWriter
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
import Utils
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -231,20 +230,3 @@ class PackageWriter(object):
|
||||
g.close()
|
||||
|
||||
return True
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_description = _('GRAMPS package is an archived XML database together '
|
||||
'with the media object files.')
|
||||
_config = (_('GRAMPS package export options'), ExportOptions.WriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _('GRAM_PS package (portable XML)'),
|
||||
description = _description,
|
||||
export_function = writeData,
|
||||
extension = "gpkg",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -44,7 +44,6 @@ log = logging.getLogger(".ExportSql")
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
import ExportOptions
|
||||
from Utils import create_id
|
||||
|
||||
@ -1073,20 +1072,3 @@ def exportData(database, filename, option_box=None, callback=None):
|
||||
# Name formats
|
||||
# Namemaps?
|
||||
# GRAMPS Version #, date, exporter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register the plugin
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
_name = _('SQLite Export')
|
||||
_description = _('SQLite is a common local database format')
|
||||
_config = (_('SQLite options'), ExportOptions.WriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _name,
|
||||
description = _description,
|
||||
export_function = exportData,
|
||||
extension = "sql",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -51,7 +51,6 @@ import Utils
|
||||
from gen.lib import Date, EventType
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
from glade import Glade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -342,19 +341,3 @@ class CalendarWriter(object):
|
||||
def exportData(database, filename, option_box=None, callback=None):
|
||||
cw = CalendarWriter(database, 0, filename, option_box, callback)
|
||||
return cw.export_data(filename)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_description = _('vCalendar is used in many calendaring and pim applications.')
|
||||
_config = (_('vCalendar export options'), CalendarWriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _('vC_alendar'),
|
||||
description = _description,
|
||||
export_function = exportData,
|
||||
extension = "vcs",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -49,7 +49,6 @@ from Filters import GenericFilter, Rules, build_filter_model
|
||||
from gen.lib import Date
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
from glade import Glade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -256,19 +255,3 @@ class CardWriter(object):
|
||||
def exportData(database, filename, option_box=None, callback=None):
|
||||
cw = CardWriter(database, 0, filename, option_box, callback)
|
||||
return cw.export_data(filename)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_description = _('vCard is used in many addressbook and pim applications.')
|
||||
_config = (_('vCard export options'), CardWriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _('_vCard'),
|
||||
description = _description,
|
||||
export_function = exportData,
|
||||
extension = "vcf",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -62,7 +62,6 @@ import const
|
||||
from QuestionDialog import ErrorDialog
|
||||
import ExportOptions
|
||||
import gen.proxy
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
import libgrampsxml
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -1210,21 +1209,3 @@ class XmlWriter(GrampsDbXmlWriter):
|
||||
(m1,m2) = msg.messages()
|
||||
ErrorDialog(m1, m2)
|
||||
return ret
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_description = _('GRAMPS XML export is a complete archived XML backup of the'
|
||||
' GRAMPS database without the media object files.'
|
||||
' Suitable for backup purposes.' )
|
||||
_config = (_('GRAMPS XML export options'), ExportOptions.WriterOptionBox)
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ExportPlugin(name = _('GRAMPS _XML database'),
|
||||
description = _description,
|
||||
export_function = export_data,
|
||||
extension = "gramps",
|
||||
config = _config )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -6,6 +6,7 @@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/plugins/export
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
export.gpr.py \
|
||||
ExportCsv.py \
|
||||
ExportFtree.py \
|
||||
ExportGedcom.py \
|
||||
|
176
src/plugins/export/export.gpr.py
Normal file
176
src/plugins/export/export.gpr.py
Normal file
@ -0,0 +1,176 @@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Comma _Separated Values Spreadsheet (CSV)
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_csv'
|
||||
plg.name = _("Comma _Separated Values Spreadsheet (CSV)")
|
||||
plg.description = _("CSV is a common spreadsheet format.")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ExportCsv.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'exportData'
|
||||
plg.export_options = 'CSVWriterOptionBox'
|
||||
plg.export_options_title = ('CSV spreadsheet options')
|
||||
plg.extension = "csv"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Web Family Tree export
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_webfamtree'
|
||||
plg.name = _('_Web Family Tree')
|
||||
plg.description = _("Web Family Tree format")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ExportFtree.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'writeData'
|
||||
plg.export_options = 'FtreeWriterOptionBox'
|
||||
plg.export_options_title = ('Web Family Tree export options')
|
||||
plg.extension = "wft"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GEDCOM
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_ged'
|
||||
plg.name = _('GE_DCOM')
|
||||
plg.description = _('GEDCOM is used to transfer data between genealogy programs. '
|
||||
'Most genealogy software will accept a GEDCOM file as input.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ExportGedcom.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'export_data'
|
||||
plg.export_options = 'ExportOptions.WriterOptionBox'
|
||||
plg.export_options_title = ('GEDCOM export options')
|
||||
plg.extension = "ged"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Geneweb
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_geneweb'
|
||||
plg.name = _('_GeneWeb')
|
||||
plg.description = _('GeneWeb is a web based genealogy program.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ExportGeneWeb.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'exportData'
|
||||
plg.export_options = 'GeneWebWriterOptionBox'
|
||||
plg.export_options_title = ('GeneWeb export options')
|
||||
plg.extension = "gw"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS package (portable XML)
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_gpkg'
|
||||
plg.name = _('GRAM_PS package (portable XML)')
|
||||
plg.description = _('GRAMPS package is an archived XML family tree together '
|
||||
'with the media object files.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ExportPkg.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'writeData'
|
||||
plg.export_options = 'ExportOptions.WriterOptionBox'
|
||||
plg.export_options_title = ('GRAMPS package export options')
|
||||
plg.extension = "gpkg"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS XML database
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_gramps'
|
||||
plg.name = _('GRAMPS _XML family tree')
|
||||
plg.description = _('GRAMPS XML export is a complete archived XML backup of a'
|
||||
' GRAMPS family tree without the media object files.'
|
||||
' Suitable for backup purposes.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ExportXml.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'export_data'
|
||||
plg.export_options = 'ExportOptions.WriterOptionBox'
|
||||
plg.export_options_title = ('GRAMPS XML export options')
|
||||
plg.extension = "gramps"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# SQLITE database
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_sqlite'
|
||||
plg.name = _('SQLite Export')
|
||||
plg.description = _('SQLite is a common local database format')
|
||||
plg.version = '1.0'
|
||||
plg.status = UNSTABLE
|
||||
plg.fname = 'ExportSql.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'exportData'
|
||||
plg.export_options = 'ExportOptions.WriterOptionBox'
|
||||
plg.export_options_title = ('SQLite options')
|
||||
plg.extension = "sql"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# vCalendar
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_vcal'
|
||||
plg.name = _('vC_alendar')
|
||||
plg.description = _('vCalendar is used in many calendaring and pim applications.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ExportVCalendar.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'exportData'
|
||||
plg.export_options = 'CalendarWriterOptionBox'
|
||||
plg.export_options_title = ('vCalendar export options')
|
||||
plg.extension = "vcs"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# vCard
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'ex_vcard'
|
||||
plg.name = _('_vCard')
|
||||
plg.description = _('vCard is used in many addressbook and pim applications.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ExportVCard.py'
|
||||
plg.ptype = EXPORT
|
||||
plg.export_function = 'exportData'
|
||||
plg.export_options = 'CardWriterOptionBox'
|
||||
plg.export_options_title = ('vCard export options')
|
||||
plg.extension = "vcf"
|
||||
|
@ -34,7 +34,7 @@ on a particular date.
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
import DateHandler
|
||||
from QuickReports import run_quick_report_by_name
|
||||
@ -96,19 +96,3 @@ class AgeOnDateGramplet(Gramplet):
|
||||
self.gui.uistate,
|
||||
'ageondate',
|
||||
date)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Age on Date Gramplet",
|
||||
tname=_("Age on Date Gramplet"),
|
||||
version="2.0.0",
|
||||
gramps="3.1.0",
|
||||
height=200,
|
||||
content = AgeOnDateGramplet,
|
||||
title=_("Age on Date"),
|
||||
)
|
||||
|
||||
|
@ -26,7 +26,7 @@ This Gramplet shows textual distributions of age breakdowns of various types.
|
||||
|
||||
import locale
|
||||
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from gettext import gettext as _
|
||||
import gen.lib
|
||||
|
||||
@ -279,17 +279,3 @@ class AgeStatsGramplet(Gramplet):
|
||||
stop = int(max_bin/(float(sum(hash.itervalues())))*100)) +
|
||||
"\n\n")
|
||||
self.append_text(self.compute_stats(hash))
|
||||
self.append_text("\n")
|
||||
|
||||
register(type="gramplet",
|
||||
name = "Age Stats Gramplet",
|
||||
tname = _("Age Stats Gramplet"),
|
||||
height=100,
|
||||
expand=True,
|
||||
content = AgeStatsGramplet,
|
||||
title=_("Age Stats"),
|
||||
detached_width = 600,
|
||||
detached_height = 450,
|
||||
)
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
# $Id: $
|
||||
#
|
||||
|
||||
from DataViews import Gramplet, register
|
||||
from DataViews import Gramplet
|
||||
from BasicUtils import name_displayer
|
||||
from gettext import gettext as _
|
||||
|
||||
@ -52,15 +52,3 @@ class AttributesGramplet(Gramplet):
|
||||
self.link(str(attr.type), 'Attribute', str(attr.type))
|
||||
self.append_text(": %s\n" % attr.get_value())
|
||||
self.append_text("\n", scroll_to="begin")
|
||||
|
||||
register(type="gramplet",
|
||||
name="Attributes Gramplet",
|
||||
tname=_("Attributes Gramplet"),
|
||||
height=150,
|
||||
expand=True,
|
||||
content = AttributesGramplet,
|
||||
title=_("Attributes"),
|
||||
detached_width = 325,
|
||||
detached_height = 250,
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
from QuickReports import run_quick_report_by_name
|
||||
import gen.lib
|
||||
@ -52,17 +52,3 @@ class CalendarGramplet(Gramplet):
|
||||
self.gui.uistate,
|
||||
'onthisday',
|
||||
date)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Calendar Gramplet",
|
||||
tname=_("Calendar Gramplet"),
|
||||
height=200,
|
||||
content = CalendarGramplet,
|
||||
title=_("Calendar"),
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from BasicUtils import name_displayer
|
||||
from ReportBase import ReportUtils
|
||||
import DateHandler
|
||||
@ -730,22 +730,3 @@ class DataEntryGramplet(Gramplet):
|
||||
|
||||
def active_changed(self, handle):
|
||||
self.update()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Data Entry Gramplet",
|
||||
tname=_("Data Entry Gramplet"),
|
||||
height=375,
|
||||
expand=False,
|
||||
content = DataEntryGramplet,
|
||||
title=_("Data Entry"),
|
||||
detached_width = 510,
|
||||
detached_height = 480,
|
||||
gramps="3.1.0",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
|
@ -35,7 +35,7 @@ import gtk
|
||||
#------------------------------------------------------------------------
|
||||
from gen.lib import EventType, FamilyRelType
|
||||
from BasicUtils import name_displayer
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -175,17 +175,3 @@ class DeepConnectionsGramplet(Gramplet):
|
||||
yield True
|
||||
self.append_text(_("\nSearch completed. %d relations found.") % self.total_relations_found)
|
||||
yield False
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register the gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(
|
||||
type = "gramplet",
|
||||
name = "Deep Connections Gramplet",
|
||||
tname =_("Deep Connections Gramplet"),
|
||||
height = 230,
|
||||
expand = True,
|
||||
content = DeepConnectionsGramplet,
|
||||
title = _("Deep Connections"))
|
||||
|
@ -36,7 +36,7 @@ from gettext import gettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from ReportBase import ReportUtils
|
||||
from BasicUtils import name_displayer
|
||||
import DateHandler
|
||||
@ -160,14 +160,3 @@ class DescendantGramplet(Gramplet):
|
||||
for child_ref in childlist:
|
||||
child = self.dbstate.db.get_person_from_handle(child_ref.ref)
|
||||
self.dump(level+1,child)
|
||||
|
||||
register(type="gramplet",
|
||||
name = "Descendant Gramplet",
|
||||
tname=_("Descendant Gramplet"),
|
||||
height=100,
|
||||
expand=True,
|
||||
content = DescendantGramplet,
|
||||
title=_("Descendants"),
|
||||
detached_width = 500,
|
||||
detached_height = 500,
|
||||
)
|
||||
|
@ -54,7 +54,7 @@ if gtk.pygtk_version < (2,3,93):
|
||||
#-------------------------------------------------------------------------
|
||||
from BasicUtils import name_displayer
|
||||
from gettext import gettext as _
|
||||
from DataViews import Gramplet, register
|
||||
from DataViews import Gramplet
|
||||
from DataViews.PedigreeView import (find_children, find_parents,
|
||||
find_witnessed_people, FormattingHelper)
|
||||
import gen.lib
|
||||
@ -885,19 +885,3 @@ class FanChartGramplet(Gramplet):
|
||||
menu.append(item)
|
||||
menu.popup(None,None,None,event.button,event.time)
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register the Gramplet
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name= "Fan Chart Gramplet",
|
||||
tname=_("Fan Chart Gramplet"),
|
||||
height=430,
|
||||
expand=True,
|
||||
content = FanChartGramplet,
|
||||
detached_height = 550,
|
||||
detached_width = 475,
|
||||
title=_("Fan Chart"),
|
||||
)
|
||||
|
@ -23,7 +23,7 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -38,14 +38,3 @@ class FAQGramplet(Gramplet):
|
||||
self.render_text("Draft of a <a wiki='FAQ'>Frequently Asked Questions</a> Gramplet\n\n")
|
||||
self.render_text(" 1. <a href='http://bugs.gramps-project.org/'>Test 1</a>\n")
|
||||
self.render_text(" 2. <a href='http://gramps-project.org//'>Test 2</a>\n")
|
||||
|
||||
register(type="gramplet",
|
||||
name="FAQ Gramplet",
|
||||
tname=_("FAQ Gramplet"),
|
||||
height=300,
|
||||
content = FAQGramplet,
|
||||
title=_("FAQ"),
|
||||
gramps="3.1.0",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#
|
||||
from gettext import gettext as _
|
||||
|
||||
from DataViews import Gramplet, register
|
||||
from DataViews import Gramplet
|
||||
import config
|
||||
|
||||
_YIELD_INTERVAL = 350
|
||||
@ -133,12 +133,3 @@ class GivenNameCloudGramplet(Gramplet):
|
||||
total_givensubnames)
|
||||
self.append_text((_("Total given names showing") + ": %d\n") % showing)
|
||||
self.append_text((_("Total people") + ": %d") % total_people, "begin")
|
||||
|
||||
register(type="gramplet",
|
||||
name= "Given Name Cloud Gramplet",
|
||||
tname=_("Given Name Cloud Gramplet"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = GivenNameCloudGramplet,
|
||||
title=_("Given Name Cloud"),
|
||||
)
|
||||
|
@ -45,7 +45,7 @@ import re
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from const import URL_WIKISTRING
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
@ -265,19 +265,3 @@ class HeadlineNewsGramplet(Gramplet):
|
||||
|
||||
def nice_title(self, title):
|
||||
return title.replace("_", " ")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Headline News Gramplet",
|
||||
tname=_("Headline News Gramplet"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = HeadlineNewsGramplet,
|
||||
title=_("Headline News"),
|
||||
gramps="3.1.0",
|
||||
version="1.0.2",
|
||||
)
|
||||
|
@ -14,6 +14,7 @@ pkgdata_PYTHON = \
|
||||
FanChartGramplet.py \
|
||||
FaqGramplet.py \
|
||||
GivenNameGramplet.py \
|
||||
gramplet.gpr.py \
|
||||
HeadlineNewsGramplet.py \
|
||||
PedigreeGramplet.py \
|
||||
QuickViewGramplet.py \
|
||||
|
@ -31,7 +31,7 @@ import pango
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import Gramplet, register
|
||||
from DataViews import Gramplet
|
||||
from BasicUtils import name_displayer
|
||||
from TransUtils import sgettext as _
|
||||
from const import GLADE_FILE
|
||||
@ -257,22 +257,3 @@ class NoteGramplet(Gramplet):
|
||||
msg = _("Edit Note")
|
||||
self.dbstate.db.transaction_commit(trans, msg)
|
||||
self.dirty = False
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Note Gramplet",
|
||||
tname=_("Note Gramplet"),
|
||||
height=100,
|
||||
expand=True,
|
||||
content = NoteGramplet,
|
||||
title=_("Note"),
|
||||
detached_width = 500,
|
||||
detached_height = 400,
|
||||
gramps="3.1.0",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
|
@ -31,7 +31,7 @@ import locale
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
from gettext import ngettext
|
||||
from BasicUtils import name_displayer
|
||||
@ -269,20 +269,3 @@ class PedigreeGramplet(Gramplet):
|
||||
start, end = self.gui.buffer.get_bounds()
|
||||
self.gui.buffer.apply_tag_by_name("fixed", start, end)
|
||||
self.append_text("", scroll_to="begin")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Pedigree Gramplet",
|
||||
tname=_("Pedigree Gramplet"),
|
||||
height=300,
|
||||
content = PedigreeGramplet,
|
||||
title=_("Pedigree"),
|
||||
expand=True,
|
||||
detached_width = 600,
|
||||
detached_height = 400,
|
||||
)
|
||||
|
||||
|
@ -30,7 +30,7 @@ import urllib
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from DataViews.GrampletView import AVAILABLE_GRAMPLETS
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
@ -121,19 +121,3 @@ class PluginManagerGramplet(Gramplet):
|
||||
row_count += 1
|
||||
|
||||
self.append_text("\n", scroll_to="begin")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Plugin Manager Gramplet",
|
||||
tname=_("Plugin Manager Gramplet"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = PluginManagerGramplet,
|
||||
title=_("Plugin Manager"),
|
||||
version="1.0.0",
|
||||
gramps="3.1.0",
|
||||
)
|
||||
|
@ -30,7 +30,7 @@ import sys
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
import gen
|
||||
|
||||
@ -158,17 +158,3 @@ class PythonGramplet(Gramplet):
|
||||
buffer.place_cursor(end)
|
||||
return True
|
||||
return False
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Python Gramplet",
|
||||
tname=_("Python Gramplet"),
|
||||
height=250,
|
||||
content = PythonGramplet,
|
||||
title=_("Python Shell"),
|
||||
)
|
||||
|
||||
|
@ -30,10 +30,10 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
from QuickReports import run_quick_report_by_name, get_quick_report_list
|
||||
from ReportBase import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
|
||||
from gen.plug import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
|
||||
CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE,
|
||||
CATEGORY_QR_MISC, CATEGORY_QR_PLACE,
|
||||
CATEGORY_QR_REPOSITORY)
|
||||
@ -101,9 +101,8 @@ class QuickViewGramplet(Gramplet):
|
||||
# Add particular lists:
|
||||
qv_list = get_quick_report_list(CATEGORY_QR_PERSON)
|
||||
list_option = EnumeratedListOption(_("Quick Views"), qv_list[0][2])
|
||||
for item in qv_list:
|
||||
#(title, category, name, status)
|
||||
list_option.add_item(item[2], item[0])
|
||||
for pdata in qv_list:
|
||||
list_option.add_item(pdata.id, pdata.name)
|
||||
self.add_option(type_list)
|
||||
self.add_option(list_option)
|
||||
type_widget = self.get_option_widget(_("View Type"))
|
||||
@ -114,18 +113,5 @@ class QuickViewGramplet(Gramplet):
|
||||
list_option = self.get_option(_("Quick Views"))
|
||||
list_option.clear()
|
||||
qv_list = get_quick_report_list(qv_option.get_value())
|
||||
for item in qv_list:
|
||||
#(title, category, name, status)
|
||||
list_option.add_item(item[2], item[0])
|
||||
|
||||
register(type="gramplet",
|
||||
name="Quick View Gramplet",
|
||||
tname=_("Quick View Gramplet"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = QuickViewGramplet,
|
||||
title=_("Quick View"),
|
||||
detached_width = 600,
|
||||
detached_height = 400,
|
||||
)
|
||||
|
||||
for pdata in qv_list:
|
||||
list_option.add_item(pdata.id, pdata.name)
|
||||
|
@ -23,7 +23,7 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
from BasicUtils import name_displayer
|
||||
|
||||
@ -132,19 +132,3 @@ class RelativesGramplet(Gramplet):
|
||||
self.append_text(_(" %d.b Father: ") % (famc))
|
||||
self.append_text(_("Unknown"))
|
||||
self.append_text("\n")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Relatives Gramplet",
|
||||
tname=_("Relatives Gramplet"),
|
||||
height=200,
|
||||
content = RelativesGramplet,
|
||||
title=_("Relatives"),
|
||||
detached_width = 250,
|
||||
detached_height = 300,
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
from BasicUtils import name_displayer
|
||||
|
||||
@ -84,18 +84,3 @@ class LogGramplet(Gramplet):
|
||||
name = _("%s and %s") % (mother_name, father_name)
|
||||
self.link(name, ltype, handle)
|
||||
self.append_text("\n")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Session Log Gramplet",
|
||||
tname=_("Session Log Gramplet"),
|
||||
height=230,
|
||||
data=['no'],
|
||||
content = LogGramplet,
|
||||
title=_("Session Log"),
|
||||
)
|
||||
|
||||
|
@ -30,7 +30,7 @@ import posixpath
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
from Utils import media_path_full
|
||||
import DateHandler
|
||||
@ -184,18 +184,3 @@ class StatsGramplet(Gramplet):
|
||||
'Filter', 'missing media')
|
||||
self.append_text(" %s\n" % len(notfound))
|
||||
self.append_text("", scroll_to="begin")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Statistics Gramplet",
|
||||
tname=_("Statistics Gramplet"),
|
||||
height=230,
|
||||
expand=True,
|
||||
content = StatsGramplet,
|
||||
title=_("Statistics"),
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
import config
|
||||
|
||||
@ -148,18 +148,3 @@ class SurnameCloudGramplet(Gramplet):
|
||||
total_surnames)
|
||||
self.append_text((_("Total surnames showing") + ": %d\n") % showing)
|
||||
self.append_text((_("Total people") + ": %d") % total_people, "begin")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name= "Surname Cloud Gramplet",
|
||||
tname=_("Surname Cloud Gramplet"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = SurnameCloudGramplet,
|
||||
title=_("Surname Cloud"),
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -44,18 +44,3 @@ class TODOGramplet(Gramplet):
|
||||
def on_save(self):
|
||||
self.gui.data = [] # clear out old data
|
||||
self.save_text_to_data()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="TODO Gramplet",
|
||||
tname=_("TODO Gramplet"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = TODOGramplet,
|
||||
title=_("TODO List"),
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from TransUtils import sgettext as _
|
||||
import config
|
||||
|
||||
@ -105,17 +105,3 @@ class TopSurnamesGramplet(Gramplet):
|
||||
self.append_text(("\n" + _("Total unique surnames") + ": %d\n") %
|
||||
total_surnames)
|
||||
self.append_text((_("Total people") + ": %d") % total_people, "begin")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name= "Top Surnames Gramplet",
|
||||
tname=_("Top Surnames Gramplet"),
|
||||
height=230,
|
||||
content = TopSurnamesGramplet,
|
||||
title=_("Top Surnames"),
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from DataViews import register
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -57,17 +56,3 @@ def make_welcome_content(gui):
|
||||
'GRAMPS.'
|
||||
)
|
||||
gui.set_text(text)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(type="gramplet",
|
||||
name="Welcome Gramplet",
|
||||
tname=_("Welcome Gramplet"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = make_welcome_content,
|
||||
title=_("Welcome to GRAMPS!"),
|
||||
)
|
||||
|
@ -28,7 +28,7 @@
|
||||
#------------------------------------------------------------------------
|
||||
from gen.lib import EventType, FamilyRelType, MarkerType
|
||||
from BasicUtils import name_displayer
|
||||
from DataViews import register, Gramplet
|
||||
from DataViews import Gramplet
|
||||
from ReportBase import ReportUtils
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
@ -512,17 +512,3 @@ class UnknownFamilyClass(object):
|
||||
|
||||
UnknownPerson = UnknownPersonClass()
|
||||
UnknownFamily = UnknownFamilyClass()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register the gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(
|
||||
type = "gramplet",
|
||||
name = "What's Next Gramplet",
|
||||
tname =_("What's Next Gramplet"),
|
||||
height = 230,
|
||||
expand = True,
|
||||
content = WhatNextGramplet,
|
||||
title = _("What's Next?"))
|
||||
|
266
src/plugins/gramplet/gramplet.gpr.py
Normal file
266
src/plugins/gramplet/gramplet.gpr.py
Normal file
@ -0,0 +1,266 @@
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register Gramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register(GRAMPLET,
|
||||
id="Age on Date Gramplet",
|
||||
name=_("Age on Date Gramplet"),
|
||||
version="2.0.0",
|
||||
fname="AgeOnDateGramplet.py",
|
||||
#gramps="3.1.0",
|
||||
height=200,
|
||||
gramplet = 'AgeOnDateGramplet',
|
||||
gramplet_title=_("Age on Date"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id = "Age Stats Gramplet",
|
||||
name = _("Age Stats Gramplet"),
|
||||
fname="AgeStats.py",
|
||||
height=100,
|
||||
expand=True,
|
||||
gramplet = 'AgeStatsGramplet',
|
||||
gramplet_title=_("Age Stats"),
|
||||
detached_width = 600,
|
||||
detached_height = 450,
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Attributes Gramplet",
|
||||
name=_("Attributes Gramplet"),
|
||||
fname="AttributesGramplet.py",
|
||||
height=150,
|
||||
expand=True,
|
||||
gramplet = 'AttributesGramplet',
|
||||
gramplet_title=_("Attributes"),
|
||||
detached_width = 325,
|
||||
detached_height = 250,
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Calendar Gramplet",
|
||||
name=_("Calendar Gramplet"),
|
||||
fname="CalendarGramplet.py",
|
||||
height=200,
|
||||
gramplet = 'CalendarGramplet',
|
||||
gramplet_title=_("Calendar"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Data Entry Gramplet",
|
||||
name=_("Data Entry Gramplet"),
|
||||
fname="DataEntryGramplet.py",
|
||||
status=UNSTABLE,
|
||||
height=375,
|
||||
expand=False,
|
||||
gramplet = 'DataEntryGramplet',
|
||||
gramplet_title=_("Data Entry"),
|
||||
detached_width = 510,
|
||||
detached_height = 480,
|
||||
#gramps="3.1.0",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id = "Deep Connections Gramplet",
|
||||
name =_("Deep Connections Gramplet"),
|
||||
fname="DeepConnections.py",
|
||||
height = 230,
|
||||
expand = True,
|
||||
gramplet = 'DeepConnectionsGramplet',
|
||||
gramplet_title = _("Deep Connections"))
|
||||
|
||||
register(GRAMPLET,
|
||||
id = "Descendant Gramplet",
|
||||
name=_("Descendant Gramplet"),
|
||||
fname="DescendGramplet.py",
|
||||
height=100,
|
||||
expand=True,
|
||||
gramplet = 'DescendantGramplet',
|
||||
gramplet_title=_("Descendants"),
|
||||
detached_width = 500,
|
||||
detached_height = 500,
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id= "Fan Chart Gramplet",
|
||||
name=_("Fan Chart Gramplet"),
|
||||
fname="FanChartGramplet.py",
|
||||
height=430,
|
||||
expand=True,
|
||||
gramplet = 'FanChartGramplet',
|
||||
detached_height = 550,
|
||||
detached_width = 475,
|
||||
gramplet_title=_("Fan Chart"),
|
||||
)
|
||||
register(GRAMPLET,
|
||||
id="FAQ Gramplet",
|
||||
name=_("FAQ Gramplet"),
|
||||
fname="FaqGramplet.py",
|
||||
height=300,
|
||||
gramplet = 'FAQGramplet',
|
||||
gramplet_title=_("FAQ"),
|
||||
#gramps="3.1.0",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id= "Given id Cloud Gramplet",
|
||||
name=_("Given id Cloud Gramplet"),
|
||||
fname="GivenNameGramplet.py",
|
||||
height=300,
|
||||
expand=True,
|
||||
gramplet = 'GivenidCloudGramplet',
|
||||
gramplet_title=_("Given id Cloud"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Headline News Gramplet",
|
||||
name=_("Headline News Gramplet"),
|
||||
fname="HeadlineNewsGramplet.py",
|
||||
height=300,
|
||||
expand=True,
|
||||
gramplet = 'HeadlineNewsGramplet',
|
||||
gramplet_title=_("Headline News"),
|
||||
#gramps="3.1.0",
|
||||
version="1.0.2",
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Note Gramplet",
|
||||
name=_("Note Gramplet"),
|
||||
fname="NoteGramplet.py",
|
||||
height=100,
|
||||
expand=True,
|
||||
gramplet = 'NoteGramplet',
|
||||
gramplet_title=_("Note"),
|
||||
detached_width = 500,
|
||||
detached_height = 400,
|
||||
#gramps="3.1.0",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Pedigree Gramplet",
|
||||
name=_("Pedigree Gramplet"),
|
||||
fname="PedigreeGramplet.py",
|
||||
height=300,
|
||||
gramplet = 'PedigreeGramplet',
|
||||
gramplet_title=_("Pedigree"),
|
||||
expand=True,
|
||||
detached_width = 600,
|
||||
detached_height = 400,
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Plugin Manager Gramplet",
|
||||
name=_("Plugin Manager Gramplet"),
|
||||
fname="PluginManagerGramplet.py",
|
||||
height=300,
|
||||
expand=True,
|
||||
gramplet = 'PluginManagerGramplet',
|
||||
gramplet_title=_("Plugin Manager"),
|
||||
version="1.0.0",
|
||||
#gramps="3.1.0",
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Python Gramplet",
|
||||
name=_("Python Gramplet"),
|
||||
fname="PythonGramplet.py",
|
||||
height=250,
|
||||
gramplet = 'PythonGramplet',
|
||||
gramplet_title=_("Python Shell"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Quick View Gramplet",
|
||||
name=_("Quick View Gramplet"),
|
||||
fname="QuickViewGramplet.py",
|
||||
height=300,
|
||||
expand=True,
|
||||
gramplet = 'QuickViewGramplet',
|
||||
gramplet_title=_("Quick View"),
|
||||
detached_width = 600,
|
||||
detached_height = 400,
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Relatives Gramplet",
|
||||
name=_("Relatives Gramplet"),
|
||||
fname="RelativeGramplet.py",
|
||||
height=200,
|
||||
gramplet = 'RelativesGramplet',
|
||||
gramplet_title=_("Relatives"),
|
||||
detached_width = 250,
|
||||
detached_height = 300,
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Session Log Gramplet",
|
||||
name=_("Session Log Gramplet"),
|
||||
fname="SessionLogGramplet.py",
|
||||
height=230,
|
||||
#data=['no'],
|
||||
gramplet = 'LogGramplet',
|
||||
gramplet_title=_("Session Log"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Statistics Gramplet",
|
||||
name=_("Statistics Gramplet"),
|
||||
fname="StatsGramplet.py",
|
||||
height=230,
|
||||
expand=True,
|
||||
gramplet = 'StatsGramplet',
|
||||
gramplet_title=_("Statistics"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id= "Surid Cloud Gramplet",
|
||||
name=_("Surid Cloud Gramplet"),
|
||||
fname="SurnameCloudGramplet.py",
|
||||
height=300,
|
||||
expand=True,
|
||||
gramplet = 'SuridCloudGramplet',
|
||||
gramplet_title=_("Surid Cloud"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="TODO Gramplet",
|
||||
name=_("TODO Gramplet"),
|
||||
fname="ToDoGramplet.py",
|
||||
height=300,
|
||||
expand=True,
|
||||
gramplet = 'TODOGramplet',
|
||||
gramplet_title=_("TODO List"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id= "Top Surids Gramplet",
|
||||
name=_("Top Surids Gramplet"),
|
||||
fname="TopSurnamesGramplet.py",
|
||||
height=230,
|
||||
gramplet = 'TopSuridsGramplet',
|
||||
gramplet_title=_("Top Surids"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Welcome Gramplet",
|
||||
name=_("Welcome Gramplet"),
|
||||
fname="WelcomeGramplet.py",
|
||||
height=300,
|
||||
expand=True,
|
||||
gramplet = 'make_welcome_gramplet',
|
||||
gramplet_title=_("Welcome to GRAMPS!"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id = "What's Next Gramplet",
|
||||
name =_("What's Next Gramplet"),
|
||||
fname="WhatsNext.py",
|
||||
height = 230,
|
||||
expand = True,
|
||||
gramplet = 'WhatNextGramplet',
|
||||
gramplet_title = _("What's Next?"))
|
@ -52,8 +52,7 @@ import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import ThumbNails
|
||||
from DateHandler import displayer as _dd
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_GRAPHVIZ
|
||||
from gen.plug import PluginManager
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
from gen.plug.menu import NumberOption, ColorOption, BooleanOption, \
|
||||
EnumeratedListOption, PersonListOption, \
|
||||
SurnameColorOption
|
||||
@ -1036,28 +1035,3 @@ class FamilyLinesReport(Report):
|
||||
child = self._db.get_person_from_handle(childRef.ref)
|
||||
comment = "child: %s" % child.get_primary_name().get_regular_name()
|
||||
self.doc.add_link(fgid, child.get_gramps_id(), comment=comment)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_report() is defined in _PluginMgr.py and
|
||||
# is used to hook the plugin into GRAMPS so that it
|
||||
# appears in the "Reports" menu options
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'familylines_graph',
|
||||
translated_name = _("Family Lines Graph"),
|
||||
category = CATEGORY_GRAPHVIZ,
|
||||
report_class = FamilyLinesReport,
|
||||
options_class = FamilyLinesOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
status = _("Stable"),
|
||||
author_name = "Stephane Charette",
|
||||
author_email = "stephanecharette@gmail.com",
|
||||
description = _("Produces family line graphs using GraphViz"),
|
||||
require_active = False
|
||||
)
|
||||
|
||||
|
@ -39,10 +39,9 @@ from gettext import gettext as _
|
||||
#------------------------------------------------------------------------
|
||||
from BasicUtils import name_displayer
|
||||
from Errors import ReportError
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.menu import (PersonOption, BooleanOption, NumberOption,
|
||||
EnumeratedListOption)
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_GRAPHVIZ
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
import DateHandler
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -287,24 +286,3 @@ class HourGlassOptions(MenuReportOptions):
|
||||
_("Use rounded corners to differentiate "
|
||||
"between women and men."))
|
||||
menu.add_option(category_name, "roundcorners", roundedcorners)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'hourglass_graph',
|
||||
category = CATEGORY_GRAPHVIZ,
|
||||
report_class = HourGlassReport,
|
||||
options_class = HourGlassOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Hourglass Graph"),
|
||||
status = _("Stable"),
|
||||
author_name = "Brian G. Matherly",
|
||||
author_email = "brian@gramps-project.org",
|
||||
description = _("Produces an hourglass graph using Graphviz")
|
||||
)
|
||||
|
@ -45,10 +45,9 @@ from TransUtils import sgettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.menu import BooleanOption, EnumeratedListOption, FilterOption, \
|
||||
PersonOption, ColorOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_GRAPHVIZ
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||
from BasicUtils import name_displayer
|
||||
import DateHandler
|
||||
import gen.lib
|
||||
@ -612,26 +611,3 @@ class RelGraphOptions(MenuReportOptions):
|
||||
image location option unavailable.
|
||||
"""
|
||||
self.__image_on_side.set_available(self.__include_images.get_value())
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
pmgr.register_report(
|
||||
name = 'rel_graph',
|
||||
category = CATEGORY_GRAPHVIZ,
|
||||
report_class = RelGraphReport,
|
||||
options_class = RelGraphOptions,
|
||||
modes = PluginManager.REPORT_MODE_GUI | \
|
||||
PluginManager.REPORT_MODE_CLI,
|
||||
translated_name = _("Relationship Graph"),
|
||||
status = _("Stable"),
|
||||
description = _("Produces relationship graphs using Graphviz"),
|
||||
author_name = "Brian G. Matherly",
|
||||
author_email = "brian@gramps-project.org"
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/plugins/graph
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
graphplugins.gpr.py\
|
||||
GVFamilyLines.py \
|
||||
GVHourGlass.py \
|
||||
GVRelGraph.py
|
||||
|
64
src/plugins/graph/graphplugins.gpr.py
Normal file
64
src/plugins/graph/graphplugins.gpr.py
Normal file
@ -0,0 +1,64 @@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Family Lines Graph
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'familylines_graph'
|
||||
plg.name = _("Family Lines Graph")
|
||||
plg.description = _("Produces family line graphs using GraphViz")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'GVFamilyLines.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Stephane Charette"]
|
||||
plg.authors_email = ["stephanecharette@gmail.com"]
|
||||
plg.category = CATEGORY_GRAPHVIZ
|
||||
plg.reportclass = 'FamilyLinesReport'
|
||||
plg.optionclass = 'FamilyLinesOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_CLI]
|
||||
plg.require_active = False
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Hourglass Graph
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'hourglass_graph'
|
||||
plg.name = _("Hourglass Graph")
|
||||
plg.description = _("Produces an hourglass graph using Graphviz")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'GVHourGlass.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Brian G. Matherly"]
|
||||
plg.authors_email = ["brian@gramps-project.org"]
|
||||
plg.category = CATEGORY_GRAPHVIZ
|
||||
plg.reportclass = 'HourGlassReport'
|
||||
plg.optionclass = 'HourGlassOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_CLI]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Relationship Graph
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'rel_graph'
|
||||
plg.name = _("Relationship Graph")
|
||||
plg.description = _("Produces relationship graphs using Graphviz")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'GVRelGraph.py'
|
||||
plg.ptype = REPORT
|
||||
plg.authors = ["Brian G. Matherly"]
|
||||
plg.authors_email = ["brian@gramps-project.org"]
|
||||
plg.category = CATEGORY_GRAPHVIZ
|
||||
plg.reportclass = 'RelGraphReport'
|
||||
plg.optionclass = 'RelGraphOptions'
|
||||
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_CLI]
|
@ -52,7 +52,6 @@ log = logging.getLogger(".ImportCSV")
|
||||
import gen.lib
|
||||
from QuestionDialog import ErrorDialog
|
||||
from DateHandler import parser as _dp
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
from Utils import gender as gender_map
|
||||
from gui.utils import ProgressMeter
|
||||
from Utils import create_id
|
||||
@ -834,18 +833,3 @@ class CSVParser(object):
|
||||
self.db.add_source(source, self.trans)
|
||||
self.db.commit_source(source, self.trans)
|
||||
return (1, source)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register the plugin
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
_mime_type = "text/x-comma-separated-values" # CSV Document
|
||||
_mime_type_rfc_4180 = "text/csv" # CSV Document See rfc4180 for mime type
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('CSV Spreadheet'),
|
||||
description = _("Import data from CSV files"),
|
||||
import_function = importData,
|
||||
extension = "csv")
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -46,7 +46,6 @@ import Errors
|
||||
from GrampsDbUtils._GedcomParse import GedcomParser
|
||||
from GrampsDbUtils._GedcomStageOne import StageOne
|
||||
from QuestionDialog import ErrorDialog, DBErrorDialog
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
from glade import Glade
|
||||
from libmixin import GrampsDbMixin
|
||||
|
||||
@ -136,18 +135,3 @@ def importData(database, filename, callback=None):
|
||||
except Errors.GedcomError, msg:
|
||||
ErrorDialog(_('Error reading GEDCOM file'), str(msg))
|
||||
return
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_description = _('GEDCOM is used to transfer data between genealogy programs. '
|
||||
'Most genealogy software will accept a GEDCOM file as input.')
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('GEDCOM'),
|
||||
description = _description,
|
||||
import_function = importData,
|
||||
extension = "ged" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -49,7 +49,6 @@ log = logging.getLogger(".ImportGeneWeb")
|
||||
import Errors
|
||||
import gen.lib
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
from htmlentitydefs import name2codepoint
|
||||
|
||||
_date_parse = re.compile('([kmes~?<>]+)?([0-9/]+)([J|H|F])?(\.\.)?([0-9/]+)?([J|H|F])?')
|
||||
@ -917,14 +916,3 @@ class GeneWebParser(object):
|
||||
def debug( self, txt):
|
||||
if enable_debug:
|
||||
print txt
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('GeneWeb'),
|
||||
description = _("Import data from GeneWeb files"),
|
||||
import_function = importData,
|
||||
extension = "gw")
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -50,7 +50,6 @@ import const
|
||||
import ImportXml
|
||||
from QuestionDialog import ErrorDialog, WarningDialog
|
||||
import Utils
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -131,20 +130,3 @@ def impData(database, name, cb=None):
|
||||
os.remove(imp_db_name)
|
||||
|
||||
return info
|
||||
|
||||
## files = os.listdir(tmpdir_path)
|
||||
## for filename in files:
|
||||
## os.remove(os.path.join(tmpdir_path, filename))
|
||||
## os.rmdir(tmpdir_path)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('GRAMPS package'),
|
||||
description = _("Import data from GRAMPS packages"),
|
||||
import_function = impData,
|
||||
extension = "gpkg")
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -60,7 +60,6 @@ from QuestionDialog import ErrorDialog
|
||||
from Errors import HandleError
|
||||
from BasicUtils import UpdateCallback
|
||||
from BasicUtils import name_displayer
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -2947,16 +2946,3 @@ def make_peron_name_remapper(other_database, formats_map):
|
||||
remap_name(person, formats_map)
|
||||
return person
|
||||
return new_get_person
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('GRAMPS 2.x database'),
|
||||
description = _("Import data from GRAMPS 2.x "
|
||||
"database files"),
|
||||
import_function = importData,
|
||||
extension = "grdb")
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -51,8 +51,6 @@ import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import gen.lib
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
|
||||
|
||||
class ProgenError(Exception):
|
||||
"""Error used to report Progen errors."""
|
||||
@ -1271,15 +1269,3 @@ class ProgenParser(object):
|
||||
person.add_parent_family_handle(fam.get_handle())
|
||||
self.db.commit_person(person, self.trans)
|
||||
self.progress.step()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('Pro-Gen'),
|
||||
description = _("Import data from Pro-Gen files"),
|
||||
import_function = _importData,
|
||||
extension = "def")
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -46,7 +46,6 @@ log = logging.getLogger(".ImportSql")
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
from Utils import create_id
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -833,19 +832,3 @@ def importData(db, filename, callback=None):
|
||||
g = SQLReader(db, filename, callback)
|
||||
g.process()
|
||||
g.cleanup()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register the plugin
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
_name = _('SQLite Import')
|
||||
_description = _('SQLite is a common local database format')
|
||||
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('SQLite Database'),
|
||||
description = _("Import data from SQLite database"),
|
||||
import_function = importData,
|
||||
extension = "sql")
|
||||
pmgr.register_plugin(plugin)
|
||||
|
||||
|
@ -49,7 +49,6 @@ log = logging.getLogger(".ImportVCard")
|
||||
import Errors
|
||||
import gen.lib
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -214,15 +213,3 @@ class VCardParser(object):
|
||||
url = gen.lib.Url()
|
||||
url.set_path(data)
|
||||
self.person.add_url(url)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('vCard'),
|
||||
description = _("Import data from vCard files"),
|
||||
import_function = importData,
|
||||
extension = "vcf")
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -47,7 +47,6 @@ from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY,
|
||||
MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY)
|
||||
from BasicUtils import UpdateCallback
|
||||
import const
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
import libgrampsxml
|
||||
from libmixin import GrampsDbMixin
|
||||
|
||||
@ -2528,18 +2527,3 @@ def version_is_valid(filename, cli):
|
||||
WarningDialog(_('Old xml file'), msg)
|
||||
return True
|
||||
return True
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register with the plugin system
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
pmgr = PluginManager.get_instance()
|
||||
plugin = ImportPlugin(name = _('GRAMPS XML database'),
|
||||
description = _('The GRAMPS XML database is a text '
|
||||
'version of a family tree. It is '
|
||||
'read-write compatible with the '
|
||||
'present GRAMPS database format.'),
|
||||
import_function = importData,
|
||||
extension = "gramps" )
|
||||
pmgr.register_plugin(plugin)
|
||||
|
@ -6,6 +6,7 @@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/plugins/import
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
import.gpr.py \
|
||||
ImportCsv.py \
|
||||
ImportGedcom.py \
|
||||
ImportGeneWeb.py \
|
||||
|
160
src/plugins/import/import.gpr.py
Normal file
160
src/plugins/import/import.gpr.py
Normal file
@ -0,0 +1,160 @@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Comma _Separated Values Spreadsheet (CSV)
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
_mime_type = "text/x-comma-separated-values" # CSV Document
|
||||
_mime_type_rfc_4180 = "text/csv" # CSV Document See rfc4180 for mime type
|
||||
plg = newplugin()
|
||||
plg.id = 'im_csv'
|
||||
plg.name = _("Comma _Separated Values Spreadsheet (CSV)")
|
||||
plg.description = _("Import data from CSV files")
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ImportCsv.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = 'importData'
|
||||
plg.extension = "csv"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GEDCOM
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'im_ged'
|
||||
plg.name = _('GEDCOM')
|
||||
plg.description = _('GEDCOM is used to transfer data between genealogy programs. '
|
||||
'Most genealogy software will accept a GEDCOM file as input.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ImportGedcom.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = 'importData'
|
||||
plg.extension = "ged"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Geneweb
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'im_geneweb'
|
||||
plg.name = _('GeneWeb')
|
||||
plg.description = _('Import data from GeneWeb files')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ImportGeneWeb.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = 'importData'
|
||||
plg.extension = "gw"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS package (portable XML)
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'im_gpkg'
|
||||
plg.name = _('GRAMPS package (portable XML)')
|
||||
plg.description = _('Import data from a GRAMPS package (an archived XML '
|
||||
'family tree together with the media object files.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ImportGpkg.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = 'impData'
|
||||
plg.extension = "gpkg"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS XML database
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'im_gramps'
|
||||
plg.name = _('GRAMPS XML Family Tree')
|
||||
plg.description = _('The GRAMPS XML format is a text '
|
||||
'version of a family tree. It is '
|
||||
'read-write compatible with the '
|
||||
'present GRAMPS database format.')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ImportXml.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = 'importData'
|
||||
plg.extension = "gramps"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRDB database
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'im_grdb'
|
||||
plg.name = _('GRAMPS 2.x database')
|
||||
plg.description = _('Import data from GRAMPS 2.x database files')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ImportGrdb.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = 'importData'
|
||||
plg.extension = "grdb"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Pro-Gen Files
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'im_progen'
|
||||
plg.name = _('Pro-Gen')
|
||||
plg.description = _('Import data from Pro-Gen files')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ImportProGen.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = '_importData'
|
||||
plg.extension = "def"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# SQLite Import
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'im_sqlite'
|
||||
plg.name = _('SQLite Import')
|
||||
plg.description = _('SQLite is a common local database format')
|
||||
plg.version = '1.0'
|
||||
plg.status = UNSTABLE
|
||||
plg.fname = 'ImportSql.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = 'importData'
|
||||
plg.extension = "sql"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# vCard
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
plg = newplugin()
|
||||
plg.id = 'im_vcard'
|
||||
plg.name = _('vCard')
|
||||
plg.description = _('Import data from vCard files')
|
||||
plg.version = '1.0'
|
||||
plg.status = STABLE
|
||||
plg.fname = 'ImportVCard.py'
|
||||
plg.ptype = IMPORT
|
||||
plg.import_function = 'importData'
|
||||
plg.extension = "vcf"
|
@ -15,7 +15,8 @@ pkgdata_PYTHON = \
|
||||
libholiday.py\
|
||||
libmapservice.py\
|
||||
libmixin.py\
|
||||
libodfbackend.py
|
||||
libodfbackend.py\
|
||||
libplugins.gpr.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/plugins/lib
|
||||
pkgpythondir = @pkgpythondir@/plugins/lib
|
||||
|
@ -43,7 +43,6 @@ from gen.plug.docgen import (BaseDoc, TextDoc, DrawDoc, ParagraphStyle,
|
||||
FONT_MONOSPACE, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT)
|
||||
from ReportBase import ReportUtils
|
||||
from Errors import PluginError
|
||||
from gen.plug import PluginManager, Plugin
|
||||
from gen.plug.docbackend import CairoBackend
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -1527,20 +1526,3 @@ class CairoDoc(BaseDoc, TextDoc, DrawDoc):
|
||||
cr.stroke()
|
||||
|
||||
self._pages[page_nr].draw(cr, layout, width, dpi_x, dpi_y)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# register_plugin
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def register_plugin():
|
||||
PluginManager.get_instance().register_plugin(
|
||||
Plugin(
|
||||
name = __name__,
|
||||
description = _("Provides a library for using Cairo to "
|
||||
"generate documents."),
|
||||
module_name = __name__
|
||||
)
|
||||
)
|
||||
|
||||
register_plugin()
|
||||
|
@ -23,14 +23,12 @@
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gettext import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gen.plug import PluginManager, Plugin
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -39,16 +37,3 @@ from gen.plug import PluginManager, Plugin
|
||||
#------------------------------------------------------------------------
|
||||
GRAMPS_XML_VERSION = "1.3.0"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Register the plugins
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
PluginManager.get_instance().register_plugin(
|
||||
Plugin(
|
||||
name = __name__,
|
||||
description = _("Provides common functionality for Gramps XML "
|
||||
"import/export."),
|
||||
module_name = __name__
|
||||
)
|
||||
)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user