This commit is contained in:
Tim Bentley 2011-01-23 15:36:48 +00:00
commit 483ec98e4c
4 changed files with 14 additions and 17 deletions

View File

@ -137,10 +137,7 @@ class AppLocation(object):
os.path.split(openlp.__file__)[0]) os.path.split(openlp.__file__)[0])
return os.path.join(app_path, u'i18n') return os.path.join(app_path, u'i18n')
else: else:
return _get_os_dir_path(u'openlp', return _get_os_dir_path(dir_type)
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)
@staticmethod @staticmethod
def get_data_path(): def get_data_path():
@ -163,17 +160,18 @@ class AppLocation(object):
os.makedirs(path) os.makedirs(path)
return path return path
def _get_os_dir_path(win_option, darwin_option, base_dir_option, def _get_os_dir_path(dir_type):
non_base_dir_option, dir_type=1):
""" """
Return a path based on which OS and environment we are running in. Return a path based on which OS and environment we are running in.
""" """
if sys.platform == u'win32': 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': elif sys.platform == u'darwin':
if dir_type == AppLocation.DataDir: if dir_type == AppLocation.DataDir:
return os.path.join(darwin_option, u'Data') return os.path.join(os.getenv(u'HOME'), u'Library',
return darwin_option u'Application Support', u'openlp', u'Data')
return os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp')
else: else:
if XDG_BASE_AVAILABLE: if XDG_BASE_AVAILABLE:
if dir_type == AppLocation.ConfigDir: if dir_type == AppLocation.ConfigDir:
@ -183,7 +181,7 @@ def _get_os_dir_path(win_option, darwin_option, base_dir_option,
elif dir_type == AppLocation.CacheDir: elif dir_type == AppLocation.CacheDir:
return os.path.join(BaseDirectory.xdg_cache_home, u'openlp') return os.path.join(BaseDirectory.xdg_cache_home, u'openlp')
else: 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): def _get_frozen_path(frozen_option, non_frozen_option):
""" """

View File

@ -45,15 +45,14 @@ class AlertsPlugin(Plugin):
self.icon = build_icon(u':/plugins/plugin_alerts.png') self.icon = build_icon(u':/plugins/plugin_alerts.png')
self.alertsmanager = AlertsManager(self) self.alertsmanager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema) self.manager = Manager(u'alerts', init_schema)
visible_name = self.getString(StringContent.VisibleName) self.visible_name = self.getString(StringContent.VisibleName)
self.alertForm = AlertForm(self, visible_name[u'title']) self.alertForm = AlertForm(self)
def getSettingsTab(self): def getSettingsTab(self):
""" """
Return the settings tab for the Alerts plugin Return the settings tab for the Alerts plugin
""" """
visible_name = self.getString(StringContent.VisibleName) self.alertsTab = AlertsTab(self, self.visible_name[u'title'])
self.alertsTab = AlertsTab(self, visible_name[u'title'])
return self.alertsTab return self.alertsTab
def addToolsMenuItem(self, tools_menu): def addToolsMenuItem(self, tools_menu):

View File

@ -35,7 +35,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
""" """
Provide UI for the alert system Provide UI for the alert system
""" """
def __init__(self, plugin, visible_title): def __init__(self, plugin):
""" """
Initialise the alert form Initialise the alert form
""" """

View File

@ -171,11 +171,11 @@ class ImpressController(PresentationController):
desktop = self.get_com_desktop() desktop = self.get_com_desktop()
#Sometimes we get a failure and desktop is None #Sometimes we get a failure and desktop is None
if not desktop: if not desktop:
log.exception(u'Failed to terminate OpenOffice') log.exception(u'Failed to find an OpenOffice desktop to terminate')
return return
docs = desktop.getComponents() docs = desktop.getComponents()
if docs.hasElements(): if docs.hasElements():
log.debug(u'OpenOffice not terminated') log.debug(u'OpenOffice not terminated as docs are still open')
else: else:
try: try:
desktop.terminate() desktop.terminate()