0003968: [NarWeb] Save/Restore settings for Narrated Website Generation. Change report_options file to be in the database directory, and implement different default report file and directory names based on the Family Tree Name. N.B. On upgrading, if you want to preserve your report_options, copy the report_option.xml file from the .gramps directory to the applicable .gramps.grampsdb.<number> directory. Also don't forget that the default options are to EXCLUDE private and living data.
svn: r21305
This commit is contained in:
parent
43c49238f5
commit
3ee843917e
@ -601,13 +601,14 @@ class OptionHandler(_options.OptionHandler):
|
|||||||
"""
|
"""
|
||||||
Implements handling of the options for the plugins.
|
Implements handling of the options for the plugins.
|
||||||
"""
|
"""
|
||||||
def __init__(self, module_name, options_dict):
|
def __init__(self, module_name, options_dict, filename):
|
||||||
|
self.default_filename = filename
|
||||||
_options.OptionHandler.__init__(self, module_name, options_dict, None)
|
_options.OptionHandler.__init__(self, module_name, options_dict, None)
|
||||||
|
|
||||||
def init_subclass(self):
|
def init_subclass(self):
|
||||||
self.collection_class = OptionListCollection
|
self.collection_class = OptionListCollection
|
||||||
self.list_class = OptionList
|
self.list_class = OptionList
|
||||||
self.filename = REPORT_OPTIONS
|
self.filename = self.default_filename
|
||||||
|
|
||||||
def init_common(self):
|
def init_common(self):
|
||||||
"""
|
"""
|
||||||
@ -777,9 +778,12 @@ class ReportOptions(_options.Options):
|
|||||||
self.options_dict = {}
|
self.options_dict = {}
|
||||||
self.options_help = {}
|
self.options_help = {}
|
||||||
self.handler = None
|
self.handler = None
|
||||||
|
self.default_report_options_file = os.path.join(dbase.full_name,
|
||||||
|
"report_options.xml")
|
||||||
|
|
||||||
def load_previous_values(self):
|
def load_previous_values(self):
|
||||||
self.handler = OptionHandler(self.name, self.options_dict)
|
self.handler = OptionHandler(self.name, self.options_dict,
|
||||||
|
self.default_report_options_file)
|
||||||
|
|
||||||
def make_default_style(self, default_style):
|
def make_default_style(self, default_style):
|
||||||
"""
|
"""
|
||||||
|
@ -66,6 +66,7 @@ class DocReportDialog(ReportDialog):
|
|||||||
self.style_name = "default"
|
self.style_name = "default"
|
||||||
self.firstpage_added = False
|
self.firstpage_added = False
|
||||||
self.CSS = PLUGMAN.process_plugin_data('WEBSTUFF')
|
self.CSS = PLUGMAN.process_plugin_data('WEBSTUFF')
|
||||||
|
self.dbname = dbstate.db.get_dbname()
|
||||||
ReportDialog.__init__(self, dbstate, uistate, option_class,
|
ReportDialog.__init__(self, dbstate, uistate, option_class,
|
||||||
name, trans_name)
|
name, trans_name)
|
||||||
|
|
||||||
@ -183,10 +184,9 @@ class DocReportDialog(ReportDialog):
|
|||||||
ext = ""
|
ext = ""
|
||||||
else:
|
else:
|
||||||
spath = self.get_default_directory()
|
spath = self.get_default_directory()
|
||||||
if self.options.get_output():
|
default_name = self.dbname + "_" + \
|
||||||
base = os.path.basename(self.options.get_output())
|
"".join(x[0].upper() for x in self.raw_name.split("_"))
|
||||||
else:
|
base = "%s.%s" % (default_name, ext)
|
||||||
base = "%s.%s" % (self.report_name, ext)
|
|
||||||
spath = os.path.normpath(os.path.join(spath, base))
|
spath = os.path.normpath(os.path.join(spath, base))
|
||||||
self.target_fileentry.set_filename(spath)
|
self.target_fileentry.set_filename(spath)
|
||||||
|
|
||||||
|
@ -115,6 +115,7 @@ class GraphvizReportDialog(ReportDialog):
|
|||||||
more information."""
|
more information."""
|
||||||
self.category = CATEGORY_GRAPHVIZ
|
self.category = CATEGORY_GRAPHVIZ
|
||||||
self.__gvoptions = graphdoc.GVOptions()
|
self.__gvoptions = graphdoc.GVOptions()
|
||||||
|
self.dbname = dbstate.db.get_dbname()
|
||||||
ReportDialog.__init__(self, dbstate, uistate, opt,
|
ReportDialog.__init__(self, dbstate, uistate, opt,
|
||||||
name, translated_name)
|
name, translated_name)
|
||||||
|
|
||||||
@ -164,10 +165,9 @@ class GraphvizReportDialog(ReportDialog):
|
|||||||
ext = ""
|
ext = ""
|
||||||
else:
|
else:
|
||||||
spath = self.get_default_directory()
|
spath = self.get_default_directory()
|
||||||
if self.options.get_output():
|
default_name = self.dbname + "_" + \
|
||||||
base = os.path.basename(self.options.get_output())
|
"".join(x[0].upper() for x in self.raw_name.split("_"))
|
||||||
else:
|
base = "%s%s" % (default_name, ext)
|
||||||
base = "%s%s" % (self.report_name, ext)
|
|
||||||
spath = os.path.normpath(os.path.join(spath, base))
|
spath = os.path.normpath(os.path.join(spath, base))
|
||||||
self.target_fileentry.set_filename(spath)
|
self.target_fileentry.set_filename(spath)
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ from gramps.gen.lib import Date, Name, NameType, Person
|
|||||||
from gramps.gen.lib.date import Today
|
from gramps.gen.lib.date import Today
|
||||||
from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE, USER_HOME, VERSION
|
from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE, USER_HOME, VERSION
|
||||||
from gramps.gen.constfunc import win
|
from gramps.gen.constfunc import win
|
||||||
|
from gramps.gen.config import config
|
||||||
from gramps.gen.plug.report import Report
|
from gramps.gen.plug.report import Report
|
||||||
from gramps.gen.plug.report import utils as ReportUtils
|
from gramps.gen.plug.report import utils as ReportUtils
|
||||||
from gramps.gen.plug.report import MenuReportOptions
|
from gramps.gen.plug.report import MenuReportOptions
|
||||||
@ -250,6 +251,8 @@ class WebCalReport(Report):
|
|||||||
"a different directory to store your generated "
|
"a different directory to store your generated "
|
||||||
"web pages."))
|
"web pages."))
|
||||||
self.warn_dir = False
|
self.warn_dir = False
|
||||||
|
config.set('paths.website-directory',
|
||||||
|
os.path.dirname(self.html_dir) + os.sep)
|
||||||
|
|
||||||
def add_day_item(self, text, year, month, day, event):
|
def add_day_item(self, text, year, month, day, event):
|
||||||
"""
|
"""
|
||||||
@ -1302,8 +1305,11 @@ class WebCalOptions(MenuReportOptions):
|
|||||||
"""
|
"""
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
|
dbname = self.__db.get_dbname()
|
||||||
|
default_dir = dbname + "_WEBCAL"
|
||||||
target = DestinationOption( _("Destination"),
|
target = DestinationOption( _("Destination"),
|
||||||
os.path.join(USER_HOME, "WEBCAL"))
|
os.path.join(config.get('paths.website-directory'),
|
||||||
|
default_dir))
|
||||||
target.set_help( _("The destination directory for the web files"))
|
target.set_help( _("The destination directory for the web files"))
|
||||||
target.set_directory_entry(True)
|
target.set_directory_entry(True)
|
||||||
menu.add_option(category_name, "target", target)
|
menu.add_option(category_name, "target", target)
|
||||||
@ -1421,7 +1427,9 @@ class WebCalOptions(MenuReportOptions):
|
|||||||
start_dow.set_help(_("Select the first day of the week for the calendar"))
|
start_dow.set_help(_("Select the first day of the week for the calendar"))
|
||||||
menu.add_option(category_name, "start_dow", start_dow)
|
menu.add_option(category_name, "start_dow", start_dow)
|
||||||
|
|
||||||
home_link = StringOption(_('Home link'), '../../NAVWEB/index.html')
|
dbname = self.__db.get_dbname()
|
||||||
|
default_link = '../../' + dbname + "_NAVWEB/index.html"
|
||||||
|
home_link = StringOption(_('Home link'), default_link)
|
||||||
home_link.set_help(_("The link to be included to direct the user to "
|
home_link.set_help(_("The link to be included to direct the user to "
|
||||||
"the main page of the web site"))
|
"the main page of the web site"))
|
||||||
menu.add_option(category_name, "home_link", home_link)
|
menu.add_option(category_name, "home_link", home_link)
|
||||||
@ -1522,7 +1530,9 @@ class WebCalOptions(MenuReportOptions):
|
|||||||
menu.add_option(category_name, 'link_to_narweb', self.__links)
|
menu.add_option(category_name, 'link_to_narweb', self.__links)
|
||||||
self.__links.connect('value-changed', self.__links_changed)
|
self.__links.connect('value-changed', self.__links_changed)
|
||||||
|
|
||||||
self.__prefix = StringOption(_('Link prefix'), "../../NAVWEB/")
|
dbname = self.__db.get_dbname()
|
||||||
|
default_prefix = '../../' + dbname + "_NAVWEB/"
|
||||||
|
self.__prefix = StringOption(_('Link prefix'), default_prefix)
|
||||||
self.__prefix.set_help(_("A Prefix on the links to take you to "
|
self.__prefix.set_help(_("A Prefix on the links to take you to "
|
||||||
"Narrated Web Report"))
|
"Narrated Web Report"))
|
||||||
menu.add_option(category_name, "prefix", self.__prefix)
|
menu.add_option(category_name, "prefix", self.__prefix)
|
||||||
|
Loading…
Reference in New Issue
Block a user