From 4c3e96b1637fe3d822fd0f32387e208e71760c0f Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 29 Mar 2006 04:24:39 +0000 Subject: [PATCH] remove expanduser svn: r6219 --- ChangeLog | 3 +++ src/Exporter.py | 4 ++-- src/GrampsCfg.py | 10 +++++----- src/PluginUtils/_Report.py | 19 +++++++++++++------ src/ViewManager.py | 4 ++-- src/plugins/BookReport.py | 2 +- 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index aaaef688b..d1c8f00ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ 2006-03-28 Don Allingham + * src/ViewManager.py: remove expanduser + * src/Exporter.py: remove expanduser + * src/plugins/BookReport.py: remove expanduser * src/plugins/Calendar.py: remove expanduser * src/plugins/GrampViz.py: remove expanduser * src/const.py.in: fix home dir. diff --git a/src/Exporter.py b/src/Exporter.py index ff3b2d287..9ee3c2d5a 100644 --- a/src/Exporter.py +++ b/src/Exporter.py @@ -308,10 +308,10 @@ class Exporter: if len(default_dir)<=1: default_dir = Config.get_last_import_dir() if len(default_dir)<=1: - default_dir = '~/' + default_dir = const.user_home if ext == 'gramps': - new_filename = os.path.expanduser(default_dir + 'data.gramps') + new_filename = os.path.join(default_dir,'data.gramps') elif ext == 'burn': new_filename = os.path.basename(self.dbstate.db.get_save_path()) else: diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 1b61ef611..67dfc2f2e 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -110,11 +110,11 @@ def loadConfig(): Load preferences on startup. Not much to do, since all the prefs are in gconf and can be retrieved any time. """ - make_path(os.path.expanduser("~/.gramps")) - make_path(os.path.expanduser("~/.gramps/filters")) - make_path(os.path.expanduser("~/.gramps/plugins")) - make_path(os.path.expanduser("~/.gramps/templates")) - make_path(os.path.expanduser("~/.gramps/thumb")) + make_path(const.home_dir) + make_path(os.path.join(const.home_dir,"filters")) + make_path(os.path.join(const.home_dir,"plugins")) + make_path(os.path.join(const.home_dir,"templates")) + make_path(os.path.join(const.home_dir,"thumb")) #------------------------------------------------------------------------- # diff --git a/src/PluginUtils/_Report.py b/src/PluginUtils/_Report.py index 17eac0c0d..b457c2d53 100644 --- a/src/PluginUtils/_Report.py +++ b/src/PluginUtils/_Report.py @@ -1645,14 +1645,21 @@ class TemplateParser(handler.ContentHandler): # #----------------------------------------------------------------------- try: - parser = make_parser() gspath = const.template_dir - parser.setContentHandler(TemplateParser(_template_map,gspath)) - parser.parse("file://" + os.path.join(gspath,"templates.xml")) - parser = make_parser() + xmlfile = os.path.join(gspath,"templates.xml") + + if os.path.isfile(xmlfile): + parser = make_parser() + parser.setContentHandler(TemplateParser(_template_map,gspath)) + parser.parse(xmlfile) + gspath = os.path.join(const.home_dir,"templates") - parser.setContentHandler(TemplateParser(_template_map,gspath)) - parser.parse("file://" + os.path.join(gspath,"templates.xml")) + xmlfile = os.path.join(gspath,"templates.xml") + if os.path.isfile(xmlfile): + parser = make_parser() + parser.setContentHandler(TemplateParser(_template_map,gspath)) + parser.parse(xmlfile) + except (IOError,OSError,SAXParseException): pass diff --git a/src/ViewManager.py b/src/ViewManager.py index 34582c375..3bf0b69a4 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -273,10 +273,10 @@ class ViewManager: def do_load_plugins(self): self.uistate.status_text(_('Loading document formats...')) error = load_plugins(const.docgenDir) - error |= load_plugins(os.path.expanduser("~/.gramps/docgen")) + error |= load_plugins(os.path.join(const.home_dir,"docgen")) self.uistate.status_text(_('Loading plugins...')) error |= load_plugins(const.pluginsDir) - error |= load_plugins(os.path.expanduser("~/.gramps/plugins")) + error |= load_plugins(os.path.join(const.home_dir,"plugins")) if Config.get_pop_plugin_status() and error: Plugins.PluginStatus(self) self.uistate.push_message(_('Ready')) diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index fae91b6b3..74c7a3eee 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -306,7 +306,7 @@ class BookList: """ self.bookmap = {} - self.file = os.path.expanduser("~/.gramps/" + filename) + self.file = os.path.join(const.home_dir,filename) self.parse() def delete_book(self,name):