Fix Windows AppLocation (Bug #706396)

bzr-revno: 1243
This commit is contained in:
Jon Tibble 2011-01-23 09:22:41 +00:00
commit 5d41a9fb90
4 changed files with 14 additions and 17 deletions

View File

@ -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'),
None, os.path.join(os.getenv(u'HOME'), u'.openlp'), dir_type)
return _get_os_dir_path(dir_type)
@staticmethod
def get_data_path():
@ -163,17 +160,18 @@ 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(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 darwin_option
return os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp', u'Data')
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:
@ -183,7 +181,7 @@ def _get_os_dir_path(win_option, darwin_option, 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):
"""

View File

@ -45,15 +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'])
self.alertsTab = AlertsTab(self, self.visible_name[u'title'])
return self.alertsTab
def addToolsMenuItem(self, tools_menu):

View File

@ -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
"""

View File

@ -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()