forked from openlp/openlp
Fixed code per comments. Fixed misc syntax errors.
This commit is contained in:
parent
3f62cc16bb
commit
cf0e8c184e
|
@ -512,7 +512,7 @@ class AdvancedTab(SettingsTab):
|
||||||
# Since data location can be changed, make sure the path is present.
|
# Since data location can be changed, make sure the path is present.
|
||||||
self.currentDataPath = AppLocation.get_data_path()
|
self.currentDataPath = AppLocation.get_data_path()
|
||||||
if not os.path.exists(self.currentDataPath):
|
if not os.path.exists(self.currentDataPath):
|
||||||
log.exception(u'Data path not found %s' % self.currentDataPath)
|
log.error(u'Data path not found %s' % self.currentDataPath)
|
||||||
answer = QtGui.QMessageBox.critical(self,
|
answer = QtGui.QMessageBox.critical(self,
|
||||||
translate('OpenLP.AdvancedTab',
|
translate('OpenLP.AdvancedTab',
|
||||||
'Data Directory Error'),
|
'Data Directory Error'),
|
||||||
|
@ -530,13 +530,13 @@ class AdvancedTab(SettingsTab):
|
||||||
QtGui.QMessageBox.No),
|
QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.No)
|
QtGui.QMessageBox.No)
|
||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
log.exception(u'User requested termination')
|
log.info(u'User requested termination')
|
||||||
Receiver.send_message(u'cleanup')
|
Receiver.send_message(u'cleanup')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
# Set data location to default.
|
# Set data location to default.
|
||||||
settings.remove(u'advanced/data path')
|
settings.remove(u'advanced/data path')
|
||||||
self.currentDataPath = AppLocation.get_data_path()
|
self.currentDataPath = AppLocation.get_data_path()
|
||||||
log.exception(u'User requested data path set to default %s'
|
log.warning(u'User requested data path set to default %s'
|
||||||
% self.currentDataPath)
|
% self.currentDataPath)
|
||||||
self.dataDirectoryLabel.setText(os.path.abspath(
|
self.dataDirectoryLabel.setText(os.path.abspath(
|
||||||
os.path.join(self.currentDataPath, u'..')))
|
os.path.join(self.currentDataPath, u'..')))
|
||||||
|
@ -654,7 +654,7 @@ class AdvancedTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
Browse for a new data directory location.
|
Browse for a new data directory location.
|
||||||
"""
|
"""
|
||||||
old_root_path = unicode(str(self.dataDirectoryLabel.text()))
|
old_root_path = unicode(self.dataDirectoryLabel.text())
|
||||||
# Get the new directory location.
|
# Get the new directory location.
|
||||||
new_path = unicode(QtGui.QFileDialog.getExistingDirectory(self,
|
new_path = unicode(QtGui.QFileDialog.getExistingDirectory(self,
|
||||||
translate('OpenLP.AdvancedTab',
|
translate('OpenLP.AdvancedTab',
|
||||||
|
|
|
@ -1479,7 +1479,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
def changeDataDirectory(self):
|
def changeDataDirectory(self):
|
||||||
log.info(u'Changing data path to %s' % self.newDataPath )
|
log.info(u'Changing data path to %s' % self.newDataPath )
|
||||||
old_data_path = unicode(str(AppLocation.get_data_path()))
|
old_data_path = unicode(AppLocation.get_data_path())
|
||||||
# Copy OpenLP data to new location if requested.
|
# Copy OpenLP data to new location if requested.
|
||||||
if self.copyData:
|
if self.copyData:
|
||||||
log.info(u'Copying data to new path')
|
log.info(u'Copying data to new path')
|
||||||
|
@ -1495,12 +1495,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
log.info(u'Copy sucessful')
|
log.info(u'Copy sucessful')
|
||||||
except (IOError, os.error, DistutilsFileError), why:
|
except (IOError, os.error, DistutilsFileError), why:
|
||||||
Receiver.send_message(u'cursor_normal')
|
Receiver.send_message(u'cursor_normal')
|
||||||
log.exception(u'Data copy failed %s' % unicode(str(why)))
|
log.exception(u'Data copy failed %s' % unicode(why))
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('OpenLP.MainWindow', 'New Data Directory Error'),
|
translate('OpenLP.MainWindow', 'New Data Directory Error'),
|
||||||
translate('OpenLP.MainWindow',
|
translate('OpenLP.MainWindow',
|
||||||
'OpenLP Data directory copy failed\n\n%s'
|
'OpenLP Data directory copy failed\n\n%s'
|
||||||
% unicode(str(why))),
|
% unicode(why)),
|
||||||
QtGui.QMessageBox.StandardButtons(
|
QtGui.QMessageBox.StandardButtons(
|
||||||
QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.Ok))
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -128,9 +128,9 @@ class AppLocation(object):
|
||||||
Return the path OpenLP stores all its data under.
|
Return the path OpenLP stores all its data under.
|
||||||
"""
|
"""
|
||||||
# Check if we have a different data location.
|
# Check if we have a different data location.
|
||||||
if QtCore.QSettings().contains("advanced/data path"):
|
if QtCore.QSettings().contains(u'advanced/data path'):
|
||||||
path = unicode(QtCore.QSettings().value(
|
path = unicode(QtCore.QSettings().value(
|
||||||
u'advanced/data path', QtCore.QVariant(u'')).toString())
|
u'advanced/data path').toString())
|
||||||
else:
|
else:
|
||||||
path = AppLocation.get_directory(AppLocation.DataDir)
|
path = AppLocation.get_directory(AppLocation.DataDir)
|
||||||
check_directory_exists(path)
|
check_directory_exists(path)
|
||||||
|
|
Loading…
Reference in New Issue