3413: Hidden export plugins still show in list; and rewrote eval() as getattr()

svn: r13708
This commit is contained in:
Doug Blank 2009-12-05 06:35:21 +00:00
parent e9bc3df09b
commit b876023812
6 changed files with 19 additions and 12 deletions

View File

@ -45,6 +45,7 @@ from gettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import config
import gen.utils
from gen.plug import PluginRegister
@ -279,11 +280,13 @@ class BasePluginManager(object):
if self.__import_plugins == []:
#The module still needs to be imported
for pdata in self.get_reg_importers():
if pdata.id in config.get("plugin.hiddenplugins"):
continue
mod = self.load_plugin(pdata)
if mod:
imp = gen.plug.ImportPlugin(name=pdata.name,
description = pdata.description,
import_function = eval('mod.' + pdata.import_function),
import_function = getattr(mod, pdata.import_function),
extension = pdata.extension)
self.__import_plugins.append(imp)
@ -300,14 +303,16 @@ class BasePluginManager(object):
if self.__export_plugins == []:
#The modules still need to be imported
for pdata in self.get_reg_exporters():
if pdata.id in config.get("plugin.hiddenplugins"):
continue
mod = self.load_plugin(pdata)
if mod:
exp = gen.plug.ExportPlugin(name=pdata.name,
description = pdata.description,
export_function = eval('mod.' + pdata.export_function),
export_function = getattr(mod, pdata.export_function),
extension = pdata.extension,
config = (pdata.export_options_title,
eval('mod.' + pdata.export_options)))
getattr(mod, pdata.export_options)))
self.__export_plugins.append(exp)
return self.__export_plugins
@ -324,11 +329,13 @@ class BasePluginManager(object):
if self.__docgen_plugins == []:
#The modules still need to be imported
for pdata in self.get_reg_docgens():
if pdata.id in config.get("plugin.hiddenplugins"):
continue
mod = self.load_plugin(pdata)
if mod:
dgp = gen.plug.DocGenPlugin(name=pdata.name,
description = pdata.description,
basedoc = eval('mod.' + pdata.basedocclass),
basedoc = getattr(mod, pdata.basedocclass),
paper = pdata.paper,
style = pdata.style,
extension = pdata.extension )

View File

@ -43,7 +43,7 @@ from gen.lib.date import make_gedcom_date, MONTH
import const
import GrampsDbUtils._GedcomInfo as GedcomInfo
import Errors
import ExportOptions
from ExportOptions import WriterOptionBox
import BasicUtils
from Utils import media_path_full
import gen.proxy

View File

@ -58,7 +58,7 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import ExportOptions
from ExportOptions import WriterOptionBox
#from BasicUtils import UpdateCallback
import gen.proxy
from ExportXml import XmlWriter

View File

@ -44,7 +44,7 @@ log = logging.getLogger(".ExportSql")
# GRAMPS modules
#
#------------------------------------------------------------------------
import ExportOptions
from ExportOptions import WriterOptionBox
from Utils import create_id
#-------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ from BasicUtils import UpdateCallback
from gen.db.exceptions import GrampsDbWriteFailure
import const
from QuestionDialog import ErrorDialog
import ExportOptions
from ExportOptions import WriterOptionBox
import gen.proxy
import libgrampsxml

View File

@ -74,7 +74,7 @@ plg.status = STABLE
plg.fname = 'ExportGedcom.py'
plg.ptype = EXPORT
plg.export_function = 'export_data'
plg.export_options = 'ExportOptions.WriterOptionBox'
plg.export_options = 'WriterOptionBox'
plg.export_options_title = ('GEDCOM export options')
plg.extension = "ged"
@ -113,7 +113,7 @@ plg.status = STABLE
plg.fname = 'ExportPkg.py'
plg.ptype = EXPORT
plg.export_function = 'writeData'
plg.export_options = 'ExportOptions.WriterOptionBox'
plg.export_options = 'WriterOptionBox'
plg.export_options_title = ('Gramps package export options')
plg.extension = "gpkg"
@ -134,7 +134,7 @@ plg.status = STABLE
plg.fname = 'ExportXml.py'
plg.ptype = EXPORT
plg.export_function = 'export_data'
plg.export_options = 'ExportOptions.WriterOptionBox'
plg.export_options = 'WriterOptionBox'
plg.export_options_title = ('Gramps XML export options')
plg.extension = "gramps"
@ -153,7 +153,7 @@ plg.status = UNSTABLE
plg.fname = 'ExportSql.py'
plg.ptype = EXPORT
plg.export_function = 'exportData'
plg.export_options = 'ExportOptions.WriterOptionBox'
plg.export_options = 'WriterOptionBox'
plg.export_options_title = ('SQLite options')
plg.extension = "sql"