0003033: const dependence in gen/plug/docgen stylesheet
svn: r12608
This commit is contained in:
parent
a0b1965c24
commit
4ca984bd2f
@ -168,8 +168,8 @@ class DocReportDialog(ReportDialog):
|
|||||||
ext = ""
|
ext = ""
|
||||||
else:
|
else:
|
||||||
spath = self.get_default_directory()
|
spath = self.get_default_directory()
|
||||||
base = self.get_default_basename()
|
base = "%s.%s" % (self.raw_name, ext)
|
||||||
spath = os.path.normpath("%s/%s.%s" % (spath, base, ext))
|
spath = os.path.normpath(os.path.join(spath, base))
|
||||||
self.target_fileentry.set_filename(spath)
|
self.target_fileentry.set_filename(spath)
|
||||||
|
|
||||||
def setup_report_options_frame(self):
|
def setup_report_options_frame(self):
|
||||||
|
@ -1090,8 +1090,8 @@ class GraphvizReportDialog(ReportDialog):
|
|||||||
ext = ""
|
ext = ""
|
||||||
else:
|
else:
|
||||||
spath = self.get_default_directory()
|
spath = self.get_default_directory()
|
||||||
base = self.get_default_basename()
|
base = "%s.%s" % (self.raw_name, ext)
|
||||||
spath = os.path.normpath("%s/%s%s" % (spath, base, ext))
|
spath = os.path.normpath(os.path.join(spath, base))
|
||||||
self.target_fileentry.set_filename(spath)
|
self.target_fileentry.set_filename(spath)
|
||||||
|
|
||||||
def setup_report_options_frame(self):
|
def setup_report_options_frame(self):
|
||||||
|
@ -179,25 +179,6 @@ class ReportDialog(ManagedWindow.ManagedWindow):
|
|||||||
category = standalone_categories[self.category]
|
category = standalone_categories[self.category]
|
||||||
return "%s - %s - GRAMPS" % (name, category)
|
return "%s - %s - GRAMPS" % (name, category)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Customization hooks for subclasses
|
|
||||||
#
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def get_stylesheet_savefile(self):
|
|
||||||
"""Where should new styles for this report be saved? This is
|
|
||||||
the name of an XML file that will be located in the ~/.gramps
|
|
||||||
directory. This file does not have to exist; it will be
|
|
||||||
created when needed. All subclasses should probably override
|
|
||||||
this function."""
|
|
||||||
return "basic_report.xml"
|
|
||||||
|
|
||||||
def get_default_basename(self):
|
|
||||||
"""What should the default name be?
|
|
||||||
"""
|
|
||||||
spath = self.options.handler.get_stylesheet_savefile()
|
|
||||||
return spath.split('.')[0]
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Functions related to extending the options
|
# Functions related to extending the options
|
||||||
@ -443,7 +424,7 @@ class ReportDialog(ManagedWindow.ManagedWindow):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
def setup_init(self):
|
def setup_init(self):
|
||||||
# add any elements that we are going to need:
|
# add any elements that we are going to need:
|
||||||
hid = self.get_stylesheet_savefile()
|
hid = self.style_name
|
||||||
if hid[-4:] == ".xml":
|
if hid[-4:] == ".xml":
|
||||||
hid = hid[0:-4]
|
hid = hid[0:-4]
|
||||||
self.target_fileentry = FileEntry(hid, _("Save As"))
|
self.target_fileentry = FileEntry(hid, _("Save As"))
|
||||||
|
@ -633,7 +633,8 @@ class OptionHandler(_Options.OptionHandler):
|
|||||||
|
|
||||||
def get_stylesheet_savefile(self):
|
def get_stylesheet_savefile(self):
|
||||||
"""Where to save user defined styles for this report."""
|
"""Where to save user defined styles for this report."""
|
||||||
return "%s.xml" % self.module_name
|
filename = "%s.xml" % self.module_name
|
||||||
|
return os.path.join(const.HOME_DIR, filename)
|
||||||
|
|
||||||
def get_default_stylesheet_name(self):
|
def get_default_stylesheet_name(self):
|
||||||
return self.style_name
|
return self.style_name
|
||||||
|
@ -43,7 +43,6 @@ def escxml(string):
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import const
|
|
||||||
from gen.plug.utils import gformat, gfloat
|
from gen.plug.utils import gformat, gfloat
|
||||||
from paragraphstyle import ParagraphStyle
|
from paragraphstyle import ParagraphStyle
|
||||||
from fontstyle import FontStyle
|
from fontstyle import FontStyle
|
||||||
@ -103,7 +102,7 @@ class StyleSheetList(object):
|
|||||||
"""
|
"""
|
||||||
defstyle.set_name('default')
|
defstyle.set_name('default')
|
||||||
self.map = { "default" : defstyle }
|
self.map = { "default" : defstyle }
|
||||||
self.file = os.path.join(const.HOME_DIR, filename)
|
self.__file = filename
|
||||||
self.parse()
|
self.parse()
|
||||||
|
|
||||||
def delete_style_sheet(self, name):
|
def delete_style_sheet(self, name):
|
||||||
@ -149,7 +148,7 @@ class StyleSheetList(object):
|
|||||||
"""
|
"""
|
||||||
Saves the current StyleSheet definitions to the associated file.
|
Saves the current StyleSheet definitions to the associated file.
|
||||||
"""
|
"""
|
||||||
xml_file = open(self.file,"w")
|
xml_file = open(self.__file,"w")
|
||||||
xml_file.write("<?xml version=\"1.0\"?>\n")
|
xml_file.write("<?xml version=\"1.0\"?>\n")
|
||||||
xml_file.write('<stylelist>\n')
|
xml_file.write('<stylelist>\n')
|
||||||
|
|
||||||
@ -200,10 +199,10 @@ class StyleSheetList(object):
|
|||||||
Loads the StyleSheets from the associated file, if it exists.
|
Loads the StyleSheets from the associated file, if it exists.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if os.path.isfile(self.file):
|
if os.path.isfile(self.__file):
|
||||||
parser = make_parser()
|
parser = make_parser()
|
||||||
parser.setContentHandler(SheetParser(self))
|
parser.setContentHandler(SheetParser(self))
|
||||||
the_file = open(self.file)
|
the_file = open(self.__file)
|
||||||
parser.parse(the_file)
|
parser.parse(the_file)
|
||||||
the_file.close()
|
the_file.close()
|
||||||
except (IOError,OSError,SAXParseException):
|
except (IOError,OSError,SAXParseException):
|
||||||
|
@ -24,6 +24,13 @@
|
|||||||
General utility functions usefull for the generic plugin system
|
General utility functions usefull for the generic plugin system
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import locale
|
||||||
|
|
||||||
def gfloat(val):
|
def gfloat(val):
|
||||||
"""Convert to floating number, taking care of possible locale differences.
|
"""Convert to floating number, taking care of possible locale differences.
|
||||||
|
|
||||||
|
@ -1143,10 +1143,6 @@ class BookReportDialog(DocReportDialog):
|
|||||||
def get_header(self, name):
|
def get_header(self, name):
|
||||||
return _("GRAMPS Book")
|
return _("GRAMPS Book")
|
||||||
|
|
||||||
def get_stylesheet_savefile(self):
|
|
||||||
"""Needed solely for forming sane filename for the output."""
|
|
||||||
return "book.xml"
|
|
||||||
|
|
||||||
def make_doc_menu(self, active=None):
|
def make_doc_menu(self, active=None):
|
||||||
"""Build a menu of document types that are appropriate for
|
"""Build a menu of document types that are appropriate for
|
||||||
this text report. This menu will be generated based upon
|
this text report. This menu will be generated based upon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user