From 1cc7c9ec396de85c6dc0ef6c538553dbf65546fa Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 22 Jan 2011 12:21:43 +0000 Subject: [PATCH 1/4] Cleanups --- openlp/core/utils/__init__.py | 6 +++--- openlp/plugins/alerts/alertsplugin.py | 8 +++----- openlp/plugins/alerts/forms/alertform.py | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 9dd133852..37bd02a4e 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -140,7 +140,7 @@ class AppLocation(object): return _get_os_dir_path(u'openlp', os.path.join(os.getenv(u'HOME'), u'Library', u'Application Support', u'openlp'), - None, os.path.join(os.getenv(u'HOME'), u'.openlp'), dir_type) + os.path.join(os.getenv(u'HOME'), u'.openlp'), dir_type) @staticmethod def get_data_path(): @@ -163,8 +163,8 @@ class AppLocation(object): os.makedirs(path) return path -def _get_os_dir_path(win_option, darwin_option, base_dir_option, - non_base_dir_option, dir_type=1): +def _get_os_dir_path(win_option, darwin_option, non_base_dir_option, + dir_type=1): """ Return a path based on which OS and environment we are running in. """ diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 61be922d5..54478b2c3 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -45,16 +45,14 @@ class AlertsPlugin(Plugin): self.icon = build_icon(u':/plugins/plugin_alerts.png') self.alertsmanager = AlertsManager(self) self.manager = Manager(u'alerts', init_schema) - visible_name = self.getString(StringContent.VisibleName) - self.alertForm = AlertForm(self, visible_name[u'title']) + self.visible_name = self.getString(StringContent.VisibleName) + self.alertForm = AlertForm(self) def getSettingsTab(self): """ Return the settings tab for the Alerts plugin """ - visible_name = self.getString(StringContent.VisibleName) - self.alertsTab = AlertsTab(self, visible_name[u'title']) - return self.alertsTab + return AlertsTab(self, self.visible_name[u'title']) def addToolsMenuItem(self, tools_menu): """ diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index 1d6a566fd..f1a0f7fea 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -35,7 +35,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): """ Provide UI for the alert system """ - def __init__(self, plugin, visible_title): + def __init__(self, plugin): """ Initialise the alert form """ From 7fc5bea107417ba8db6b11c4223113c51abbae9c Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 22 Jan 2011 17:50:32 +0000 Subject: [PATCH 2/4] Couple of cleanups --- openlp/plugins/alerts/alertsplugin.py | 3 ++- openlp/plugins/presentations/lib/impresscontroller.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 54478b2c3..443ec1e84 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -52,7 +52,8 @@ class AlertsPlugin(Plugin): """ Return the settings tab for the Alerts plugin """ - return AlertsTab(self, self.visible_name[u'title']) + self.alertsTab = AlertsTab(self, self.visible_name[u'title']) + return self.alertsTab def addToolsMenuItem(self, tools_menu): """ diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 6ca67c2ae..f12d36dc8 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -171,11 +171,11 @@ class ImpressController(PresentationController): desktop = self.get_com_desktop() #Sometimes we get a failure and desktop is None if not desktop: - log.exception(u'Failed to terminate OpenOffice') + log.exception(u'Failed to find an OpenOffice desktop to terminate') return docs = desktop.getComponents() if docs.hasElements(): - log.debug(u'OpenOffice not terminated') + log.debug(u'OpenOffice not terminated as docs are still open') else: try: desktop.terminate() From 09aee63cd204ef23a816db15f05171533ca325d6 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sun, 23 Jan 2011 00:27:29 +0000 Subject: [PATCH 3/4] Fix Windows AppLocation (Bug #706396) --- openlp/core/utils/__init__.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 37bd02a4e..22781f769 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -137,10 +137,7 @@ class AppLocation(object): os.path.split(openlp.__file__)[0]) return os.path.join(app_path, u'i18n') else: - return _get_os_dir_path(u'openlp', - os.path.join(os.getenv(u'HOME'), u'Library', - u'Application Support', u'openlp'), - os.path.join(os.getenv(u'HOME'), u'.openlp'), dir_type) + return _get_os_dir_path(dir_type) @staticmethod def get_data_path(): @@ -163,16 +160,16 @@ class AppLocation(object): os.makedirs(path) return path -def _get_os_dir_path(win_option, darwin_option, non_base_dir_option, - dir_type=1): +def _get_os_dir_path(dir_type): """ Return a path based on which OS and environment we are running in. """ if sys.platform == u'win32': - return os.path.join(os.getenv(u'APPDATA'), win_option) + return os.path.join(os.getenv(u'APPDATA', u'openlp') elif sys.platform == u'darwin': if dir_type == AppLocation.DataDir: - return os.path.join(darwin_option, u'Data') + return os.path.join(os.getenv(u'HOME'), u'Library', + u'Application Support', u'openlp', u'Data') return darwin_option else: if XDG_BASE_AVAILABLE: @@ -183,7 +180,7 @@ def _get_os_dir_path(win_option, darwin_option, non_base_dir_option, elif dir_type == AppLocation.CacheDir: return os.path.join(BaseDirectory.xdg_cache_home, u'openlp') else: - return non_base_dir_option + return os.path.join(os.getenv(u'HOME'), u'.openlp') def _get_frozen_path(frozen_option, non_frozen_option): """ From 01826ddda8408f7c485220cb1b970ed0afc6071d Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sun, 23 Jan 2011 00:46:51 +0000 Subject: [PATCH 4/4] Fix fix --- openlp/core/utils/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 22781f769..37cbd7a63 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -165,12 +165,13 @@ def _get_os_dir_path(dir_type): Return a path based on which OS and environment we are running in. """ if sys.platform == u'win32': - return os.path.join(os.getenv(u'APPDATA', u'openlp') + return os.path.join(os.getenv(u'APPDATA'), u'openlp') elif sys.platform == u'darwin': if dir_type == AppLocation.DataDir: return os.path.join(os.getenv(u'HOME'), u'Library', u'Application Support', u'openlp', u'Data') - return darwin_option + return os.path.join(os.getenv(u'HOME'), u'Library', + u'Application Support', u'openlp') else: if XDG_BASE_AVAILABLE: if dir_type == AppLocation.ConfigDir: