0003033: const dependence in gen/plug/docgen stylesheet

svn: r12608
This commit is contained in:
Brian Matherly
2009-06-02 11:50:17 +00:00
parent a0b1965c24
commit 4ca984bd2f
7 changed files with 18 additions and 34 deletions

View File

@@ -168,8 +168,8 @@ class DocReportDialog(ReportDialog):
ext = ""
else:
spath = self.get_default_directory()
base = self.get_default_basename()
spath = os.path.normpath("%s/%s.%s" % (spath, base, ext))
base = "%s.%s" % (self.raw_name, ext)
spath = os.path.normpath(os.path.join(spath, base))
self.target_fileentry.set_filename(spath)
def setup_report_options_frame(self):

View File

@@ -1090,8 +1090,8 @@ class GraphvizReportDialog(ReportDialog):
ext = ""
else:
spath = self.get_default_directory()
base = self.get_default_basename()
spath = os.path.normpath("%s/%s%s" % (spath, base, ext))
base = "%s.%s" % (self.raw_name, ext)
spath = os.path.normpath(os.path.join(spath, base))
self.target_fileentry.set_filename(spath)
def setup_report_options_frame(self):

View File

@@ -179,25 +179,6 @@ class ReportDialog(ManagedWindow.ManagedWindow):
category = standalone_categories[self.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
@@ -443,7 +424,7 @@ class ReportDialog(ManagedWindow.ManagedWindow):
#------------------------------------------------------------------------
def setup_init(self):
# add any elements that we are going to need:
hid = self.get_stylesheet_savefile()
hid = self.style_name
if hid[-4:] == ".xml":
hid = hid[0:-4]
self.target_fileentry = FileEntry(hid, _("Save As"))

View File

@@ -633,7 +633,8 @@ class OptionHandler(_Options.OptionHandler):
def get_stylesheet_savefile(self):
"""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):
return self.style_name