openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #15902
[Merge] lp:~smpettit/openlp/data-path into lp:openlp
Stevan Pettit has proposed merging lp:~smpettit/openlp/data-path into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Jonathan Corwin (j-corwin)
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~smpettit/openlp/data-path/+merge/109456
Take 2 of User Specified Data Location.
Last needs fixing comment:
The setting to store the data directory should either be "data path" or "custom data path", not "new data path". Personally, I would go with "data path" and then just delete the value and let OpenLP do it's thing to create a default data path (though you may have to code this yourself anyway)
If you catch an exception you must *always* log that exception to the log file via "log.exception(u'Brief description of what went wrong')"
We use shutil for other copying actions, I recommend you use that too, just for consistency's sake.
AppLocation.IsDefaultDataPath should not be a class-level variable. Class-level "variables" are used as enumerations, and should never be altered programmatically. You should create a method instead, called "AppLocation.is_default_data_path()".
Line 435 and onward should look like this:
# Check if we have a different data location.
path = unicode(QtCore.QSettings().value(
u'advanced/data path', QtCore.QVariant(u'')).toString())
if not path or not os.path.exists(path):
path = AppLocation.get_directory(AppLocation.DataDir)
check_directory_exists(path)
Additionally, your new method should look something like this:
@staticmethod
def is_default_data_path():
path = unicode(QtCore.QSettings().value(
u'advanced/data path', QtCore.QVariant(u'')).toString())
return not path or not os.path.exists(path)
Made changes as requested in last proposal.
Deleted "copy data dialogs" when exiting program.
Added "status message" to tell user what is going on during exit
Consolidated buttons to a single line.
I'm using distutils instead of shutil because shutil will not overwrite data when doing a copy-tree
I had to remove "or not os.path.exists(path)" from AppLocation.get_data_path so the code in advancedtab will notify the user that their data-path is not found. If the path was not found, .get_data_path was setting it to the default with no user notification.
Re-did all the "missing" changes from when the branch was corrected..
Corrected dialogue's as per comments.
Changed GUI to be consistent with other forms.
Fixed code as per comments. Fixed syntax in other sections.
Removed code that added a specific sub-dir to the directory chosen by the user. The one chosen, will be the one used.
Fixed buttons on GUI. Fixed message.
Moved call to cancel button from settingsform to advancedtab
Merged with trunk, resolved conflict
--
https://code.launchpad.net/~smpettit/openlp/data-path/+merge/109456
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2012-04-22 19:37:11 +0000
+++ openlp/core/ui/advancedtab.py 2012-06-08 23:35:22 +0000
@@ -31,10 +31,15 @@
from PyQt4 import QtCore, QtGui
+import logging
+import os
+import sys
from openlp.core.lib import SettingsTab, translate, build_icon, Receiver
from openlp.core.lib.ui import UiStrings
+from openlp.core.utils import get_images_filter, AppLocation
from openlp.core.lib import SlideLimits
-from openlp.core.utils import get_images_filter
+
+log = logging.getLogger(__name__)
class AdvancedTab(SettingsTab):
"""
@@ -59,6 +64,7 @@
'#strftime-strptime-behavior for more information.'))
self.defaultImage = u':/graphics/openlp-splash-screen.png'
self.defaultColor = u'#ffffff'
+ self.dataExists = False
self.iconPath = u':/system/system_settings.png'
advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
SettingsTab.__init__(self, parent, u'Advanced', advanced_translated)
@@ -151,6 +157,71 @@
self.serviceNameLayout.addRow(self.serviceNameExampleLabel,
self.serviceNameExample)
self.leftLayout.addWidget(self.serviceNameGroupBox)
+ # Data Directory
+ self.dataDirectoryGroupBox = QtGui.QGroupBox(self.leftColumn)
+ self.dataDirectoryGroupBox.setObjectName(u'dataDirectoryGroupBox')
+ self.dataDirectoryLayout = QtGui.QFormLayout(self.dataDirectoryGroupBox)
+ self.dataDirectoryLayout.setObjectName(u'dataDirectoryLayout')
+ self.dataDirectoryCurrentLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
+ self.dataDirectoryCurrentLabel.setObjectName(
+ u'dataDirectoryCurrentLabel')
+ self.dataDirectoryLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
+ self.dataDirectoryLabel.setObjectName(u'dataDirectoryLabel')
+ self.dataDirectoryNewLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
+ self.dataDirectoryNewLabel.setObjectName(u'dataDirectoryCurrentLabel')
+ self.newDataDirectoryEdit = QtGui.QLineEdit(self.dataDirectoryGroupBox)
+ self.newDataDirectoryEdit.setObjectName(u'newDataDirectoryEdit')
+ self.newDataDirectoryEdit.setReadOnly(True)
+ self.newDataDirectoryHasFilesLabel = QtGui.QLabel(
+ self.dataDirectoryGroupBox)
+ self.newDataDirectoryHasFilesLabel.setObjectName(
+ u'newDataDirectoryHasFilesLabel')
+ self.newDataDirectoryHasFilesLabel.setWordWrap(True)
+ self.dataDirectoryBrowseButton = QtGui.QToolButton(
+ self.dataDirectoryGroupBox)
+ self.dataDirectoryBrowseButton.setObjectName(
+ u'dataDirectoryBrowseButton')
+ self.dataDirectoryBrowseButton.setIcon(
+ build_icon(u':/general/general_open.png'))
+ self.dataDirectoryDefaultButton = QtGui.QToolButton(
+ self.dataDirectoryGroupBox)
+ self.dataDirectoryDefaultButton.setObjectName(
+ u'dataDirectoryDefaultButton')
+ self.dataDirectoryDefaultButton.setIcon(
+ build_icon(u':/general/general_revert.png'))
+ self.dataDirectoryCancelButton = QtGui.QToolButton(
+ self.dataDirectoryGroupBox)
+ self.dataDirectoryCancelButton.setObjectName(
+ u'dataDirectoryCancelButton')
+ self.dataDirectoryCancelButton.setIcon(
+ build_icon(u':/general/general_delete.png'))
+ self.newDataDirectoryLabelHBox = QtGui.QHBoxLayout()
+ self.newDataDirectoryLabelHBox.setObjectName(
+ u'newDataDirectoryLabelHBox')
+ self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit)
+ self.newDataDirectoryLabelHBox.addWidget(
+ self.dataDirectoryBrowseButton)
+ self.newDataDirectoryLabelHBox.addWidget(
+ self.dataDirectoryDefaultButton)
+ self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout()
+ self.dataDirectoryCopyCheckHBox.setObjectName(
+ u'dataDirectoryCopyCheckHBox')
+ self.dataDirectoryCopyCheckBox = QtGui.QCheckBox(
+ self.dataDirectoryGroupBox)
+ self.dataDirectoryCopyCheckBox.setObjectName(
+ u'dataDirectoryCopyCheckBox')
+ self.dataDirectoryCopyCheckHBox.addWidget(
+ self.dataDirectoryCopyCheckBox)
+ self.dataDirectoryCopyCheckHBox.addStretch()
+ self.dataDirectoryCopyCheckHBox.addWidget(
+ self.dataDirectoryCancelButton)
+ self.dataDirectoryLayout.addRow(self.dataDirectoryCurrentLabel,
+ self.dataDirectoryLabel)
+ self.dataDirectoryLayout.addRow(self.dataDirectoryNewLabel,
+ self.newDataDirectoryLabelHBox)
+ self.dataDirectoryLayout.addRow(self.dataDirectoryCopyCheckHBox)
+ self.dataDirectoryLayout.addRow(self.newDataDirectoryHasFilesLabel)
+ self.leftLayout.addWidget(self.dataDirectoryGroupBox)
self.leftLayout.addStretch()
# Default Image
self.defaultImageGroupBox = QtGui.QGroupBox(self.rightColumn)
@@ -219,7 +290,6 @@
self.x11Layout.addWidget(self.x11BypassCheckBox)
self.rightLayout.addWidget(self.x11GroupBox)
self.rightLayout.addStretch()
-
self.shouldUpdateServiceNameExample = False
QtCore.QObject.connect(self.serviceNameCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.serviceNameCheckBoxToggled)
@@ -243,6 +313,18 @@
QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
QtCore.QObject.connect(self.x11BypassCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
+ QtCore.QObject.connect(self.dataDirectoryBrowseButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onDataDirectoryBrowseButtonClicked)
+ QtCore.QObject.connect(self.dataDirectoryDefaultButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onDataDirectoryDefaultButtonClicked)
+ QtCore.QObject.connect(self.dataDirectoryCancelButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onDataDirectoryCancelButtonClicked)
+ QtCore.QObject.connect(self.dataDirectoryCopyCheckBox,
+ QtCore.SIGNAL(u'toggled(bool)'),
+ self.onDataDirectoryCopyCheckBoxToggled)
QtCore.QObject.connect(self.endSlideRadioButton,
QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked)
QtCore.QObject.connect(self.wrapSlideRadioButton,
@@ -257,6 +339,8 @@
self.tabTitleVisible = UiStrings().Advanced
self.uiGroupBox.setTitle(
translate('OpenLP.AdvancedTab', 'UI Settings'))
+ self.dataDirectoryGroupBox.setTitle(
+ translate('OpenLP.AdvancedTab', 'Data Location'))
self.recentLabel.setText(
translate('OpenLP.AdvancedTab',
'Number of recent files to display:'))
@@ -320,6 +404,32 @@
'Browse for an image file to display.'))
self.defaultRevertButton.setToolTip(translate('OpenLP.AdvancedTab',
'Revert to the default OpenLP logo.'))
+ self.dataDirectoryCurrentLabel.setText(translate('OpenLP.AdvancedTab',
+ 'Current path:'))
+ self.dataDirectoryNewLabel.setText(translate('OpenLP.AdvancedTab',
+ 'Custom path:'))
+ self.dataDirectoryBrowseButton.setToolTip(
+ translate('OpenLP.AdvancedTab',
+ 'Browse for new data file location.'))
+ self.dataDirectoryDefaultButton.setToolTip(
+ translate('OpenLP.AdvancedTab',
+ 'Set the data location to the default.'))
+ self.dataDirectoryCancelButton.setText(
+ translate('OpenLP.AdvancedTab',
+ 'Cancel'))
+ self.dataDirectoryCancelButton.setToolTip(
+ translate('OpenLP.AdvancedTab',
+ 'Cancel OpenLP data directory location change.'))
+ self.dataDirectoryCopyCheckBox.setText(
+ translate('OpenLP.AdvancedTab',
+ 'Copy data to new location.'))
+ self.dataDirectoryCopyCheckBox.setToolTip(
+ translate('OpenLP.AdvancedTab',
+ 'Copy the OpenLP data files to the new location.'))
+ self.newDataDirectoryHasFilesLabel.setText(
+ translate('OpenLP.AdvancedTab',
+ '<strong>WARNING:</strong> New data directory location contains '
+ 'OpenLP data files. These files WILL be replaced during a copy.'))
self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab',
'X11'))
self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab',
@@ -397,6 +507,40 @@
else:
self.nextItemRadioButton.setChecked(True)
settings.endGroup()
+ self.dataDirectoryCopyCheckBox.hide()
+ self.newDataDirectoryHasFilesLabel.hide()
+ self.dataDirectoryCancelButton.hide()
+ # Since data location can be changed, make sure the path is present.
+ self.currentDataPath = AppLocation.get_data_path()
+ if not os.path.exists(self.currentDataPath):
+ log.error(u'Data path not found %s' % self.currentDataPath)
+ answer = QtGui.QMessageBox.critical(self,
+ translate('OpenLP.AdvancedTab',
+ 'Data Directory Error'),
+ translate('OpenLP.AdvancedTab',
+ 'OpenLP data directory was not found\n\n%s\n\n'
+ 'This data directory was previously changed from the OpenLP '
+ 'default location. If the new location was on removable '
+ 'media, that media needs to be made available.\n\n'
+ 'Click "No" to stop loading OpenLP. allowing you to fix '
+ 'the the problem.\n\n'
+ 'Click "Yes" to reset the data directory to the default '
+ 'location.' % self.currentDataPath),
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Yes |
+ QtGui.QMessageBox.No),
+ QtGui.QMessageBox.No)
+ if answer == QtGui.QMessageBox.No:
+ log.info(u'User requested termination')
+ Receiver.send_message(u'cleanup')
+ sys.exit()
+ # Set data location to default.
+ settings.remove(u'advanced/data path')
+ self.currentDataPath = AppLocation.get_data_path()
+ log.warning(u'User requested data path set to default %s'
+ % self.currentDataPath)
+ self.dataDirectoryLabel.setText(os.path.abspath(
+ self.currentDataPath))
self.defaultColorButton.setStyleSheet(
u'background-color: %s' % self.defaultColor)
@@ -446,6 +590,10 @@
self.displayChanged = False
Receiver.send_message(u'slidecontroller_update_slide_limits')
+ def cancel(self):
+ # Dialogue was cancelled, remove any pending data path change.
+ self.onDataDirectoryCancelButtonClicked()
+
def serviceNameCheckBoxToggled(self, default_service_enabled):
self.serviceNameDay.setEnabled(default_service_enabled)
time_enabled = default_service_enabled and \
@@ -507,6 +655,122 @@
self.defaultFileEdit.setText(filename)
self.defaultFileEdit.setFocus()
+ def onDataDirectoryBrowseButtonClicked(self):
+ """
+ Browse for a new data directory location.
+ """
+ old_root_path = unicode(self.dataDirectoryLabel.text())
+ # Get the new directory location.
+ new_data_path = unicode(QtGui.QFileDialog.getExistingDirectory(self,
+ translate('OpenLP.AdvancedTab',
+ 'Select Data Directory Location'), old_root_path,
+ options = QtGui.QFileDialog.ShowDirsOnly))
+ # Set the new data path.
+ if new_data_path:
+ if self.currentDataPath.lower() == new_data_path.lower():
+ self.onDataDirectoryCancelButtonClicked()
+ return
+ else:
+ return
+ # Make sure they want to change the data.
+ answer = QtGui.QMessageBox.question(self,
+ translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
+ translate('OpenLP.AdvancedTab',
+ 'Are you sure you want to change the location of the OpenLP '
+ 'data directory to:\n\n%s\n\n'
+ 'The data directory will be changed when OpenLP is closed.'
+ % new_data_path),
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Yes |
+ QtGui.QMessageBox.No),
+ QtGui.QMessageBox.No)
+ if answer != QtGui.QMessageBox.Yes:
+ return
+ # Check if data already exists here.
+ self.checkDataOverwrite(new_data_path)
+ # Save the new location.
+ Receiver.send_message(u'set_new_data_path', new_data_path)
+ self.newDataDirectoryEdit.setText(new_data_path)
+ self.dataDirectoryCancelButton.show()
+
+ def onDataDirectoryDefaultButtonClicked(self):
+ """
+ Re-set the data directory location to the 'default' location.
+ """
+ new_data_path = AppLocation.get_directory(AppLocation.DataDir)
+ if self.currentDataPath.lower() != new_data_path.lower():
+ # Make sure they want to change the data location back to the default.
+ answer = QtGui.QMessageBox.question(self,
+ translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
+ translate('OpenLP.AdvancedTab',
+ 'Are you sure you want to change the location of the OpenLP '
+ 'data directory to the default location?\n\n'
+ 'This location will be used after OpenLP is closed.'),
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Yes |
+ QtGui.QMessageBox.No),
+ QtGui.QMessageBox.No)
+ if answer != QtGui.QMessageBox.Yes:
+ return
+ self.checkDataOverwrite(new_data_path)
+ # Save the new location.
+ Receiver.send_message(u'set_new_data_path', new_data_path)
+ self.newDataDirectoryEdit.setText(os.path.abspath(new_data_path))
+ self.dataDirectoryCancelButton.show()
+ else:
+ # We cancel the change in case user changed their mind.
+ self.onDataDirectoryCancelButtonClicked()
+
+ def onDataDirectoryCopyCheckBoxToggled(self):
+ Receiver.send_message(u'set_copy_data',
+ self.dataDirectoryCopyCheckBox.isChecked())
+ if self.dataExists:
+ if self.dataDirectoryCopyCheckBox.isChecked():
+ self.newDataDirectoryHasFilesLabel.show()
+ else:
+ self.newDataDirectoryHasFilesLabel.hide()
+
+ def checkDataOverwrite(self, data_path ):
+ test_path = os.path.join(data_path, u'songs')
+ self.dataDirectoryCopyCheckBox.show()
+ if os.path.exists(test_path):
+ self.dataExists = True
+ # Check is they want to replace existing data.
+ answer = QtGui.QMessageBox.warning(self,
+ translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'),
+ translate('OpenLP.AdvancedTab',
+ 'WARNING: \n\n'
+ 'The location you have selected \n\n%s\n\n'
+ 'appears to contain OpenLP data files. Do you wish to replace '
+ 'these files with the current data files?'
+ % os.path.abspath(data_path,)),
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Yes |
+ QtGui.QMessageBox.No),
+ QtGui.QMessageBox.No)
+ if answer == QtGui.QMessageBox.Yes:
+ self.dataDirectoryCopyCheckBox.setChecked(True)
+ self.newDataDirectoryHasFilesLabel.show()
+ else:
+ self.dataDirectoryCopyCheckBox.setChecked(False)
+ self.newDataDirectoryHasFilesLabel.hide()
+ else:
+ self.dataExists = False
+ self.dataDirectoryCopyCheckBox.setChecked(True)
+ self.newDataDirectoryHasFilesLabel.hide()
+
+ def onDataDirectoryCancelButtonClicked(self):
+ """
+ Cancel the data directory location change
+ """
+ self.newDataDirectoryEdit.clear()
+ self.dataDirectoryCopyCheckBox.setChecked(False)
+ Receiver.send_message(u'set_new_data_path', u'')
+ Receiver.send_message(u'set_copy_data', False)
+ self.dataDirectoryCopyCheckBox.hide()
+ self.dataDirectoryCancelButton.hide()
+ self.newDataDirectoryHasFilesLabel.hide()
+
def onDefaultRevertButtonClicked(self):
self.defaultFileEdit.setText(u':/graphics/openlp-splash-screen.png')
self.defaultFileEdit.setFocus()
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2012-06-04 10:22:47 +0000
+++ openlp/core/ui/mainwindow.py 2012-06-08 23:35:22 +0000
@@ -29,6 +29,8 @@
import os
import sys
import shutil
+from distutils import dir_util
+from distutils.errors import DistutilsFileError
from tempfile import gettempdir
import time
from datetime import datetime
@@ -582,6 +584,8 @@
# Once settings are loaded update the menu with the recent files.
self.updateRecentFilesMenu()
self.pluginForm = PluginForm(self)
+ self.newDataPath = u''
+ self.copyData = False
# Set up signals and slots
QtCore.QObject.connect(self.importThemeItem,
QtCore.SIGNAL(u'triggered()'),
@@ -634,6 +638,8 @@
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'mainwindow_status_text'), self.showStatusMessage)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'cleanup'), self.cleanUp)
# Media Manager
QtCore.QObject.connect(self.mediaToolBox,
QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
@@ -646,6 +652,10 @@
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_information_message'),
self.onInformationMessage)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'set_new_data_path'), self.setNewDataPath)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'set_copy_data'), self.setCopyData)
# warning cyclic dependency
# renderer needs to call ThemeManager and
# ThemeManager needs to call Renderer
@@ -1198,6 +1208,9 @@
if save_settings:
# Save settings
self.saveSettings()
+ # Check if we need to change the data directory
+ if self.newDataPath:
+ self.changeDataDirectory()
# Close down the display
if self.liveController.display:
self.liveController.display.close()
@@ -1474,3 +1487,45 @@
self.timer_id = 0
self.loadProgressBar.hide()
Receiver.send_message(u'openlp_process_events')
+
+ def setNewDataPath(self, new_data_path):
+ self.newDataPath = new_data_path
+
+ def setCopyData(self, copy_data):
+ self.copyData = copy_data
+
+ def changeDataDirectory(self):
+ log.info(u'Changing data path to %s' % self.newDataPath )
+ old_data_path = unicode(AppLocation.get_data_path())
+ # Copy OpenLP data to new location if requested.
+ if self.copyData:
+ log.info(u'Copying data to new path')
+ try:
+ Receiver.send_message(u'openlp_process_events')
+ Receiver.send_message(u'cursor_busy')
+ self.showStatusMessage(
+ translate('OpenLP.MainWindow',
+ 'Copying OpenLP data to new data directory location - %s '
+ '- Please wait for copy to finish'
+ % self.newDataPath))
+ dir_util.copy_tree(old_data_path, self.newDataPath)
+ log.info(u'Copy sucessful')
+ except (IOError, os.error, DistutilsFileError), why:
+ Receiver.send_message(u'cursor_normal')
+ log.exception(u'Data copy failed %s' % unicode(why))
+ QtGui.QMessageBox.critical(self,
+ translate('OpenLP.MainWindow', 'New Data Directory Error'),
+ translate('OpenLP.MainWindow',
+ 'OpenLP Data directory copy failed\n\n%s'
+ % unicode(why)),
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Ok))
+ return False
+ else:
+ log.info(u'No data copy requested')
+ # Change the location of data directory in config file.
+ settings = QtCore.QSettings()
+ settings.setValue(u'advanced/data path', self.newDataPath)
+ # Check if the new data path is our default.
+ if self.newDataPath == AppLocation.get_directory(AppLocation.DataDir):
+ settings.remove(u'advanced/data path')
=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py 2012-05-01 11:00:02 +0000
+++ openlp/core/ui/settingsform.py 2012-06-08 23:35:22 +0000
@@ -29,7 +29,7 @@
"""
import logging
-from PyQt4 import QtGui
+from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, build_icon, PluginStatus
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2012-05-20 15:52:21 +0000
+++ openlp/core/utils/__init__.py 2012-06-08 23:35:22 +0000
@@ -87,7 +87,7 @@
VersionDir = 5
CacheDir = 6
LanguageDir = 7
-
+
# Base path where data/config/cache dir is located
BaseDir = None
@@ -126,8 +126,13 @@
"""
Return the path OpenLP stores all its data under.
"""
- path = AppLocation.get_directory(AppLocation.DataDir)
- check_directory_exists(path)
+ # Check if we have a different data location.
+ if QtCore.QSettings().contains(u'advanced/data path'):
+ path = unicode(QtCore.QSettings().value(
+ u'advanced/data path').toString())
+ else:
+ path = AppLocation.get_directory(AppLocation.DataDir)
+ check_directory_exists(path)
return path
@staticmethod
Follow ups