trivial clean ups

This commit is contained in:
Andreas Preikschat 2012-05-17 14:59:57 +02:00
parent d9cbcc7d46
commit 0b9923742e

View File

@ -352,8 +352,8 @@ class ServiceManager(QtGui.QWidget):
self._fileName = unicode(fileName) self._fileName = unicode(fileName)
self.mainwindow.setServiceModified(self.isModified(), self.mainwindow.setServiceModified(self.isModified(),
self.shortFileName()) self.shortFileName())
QtCore.QSettings(). \ QtCore.QSettings().setValue(
setValue(u'servicemanager/last file',QtCore.QVariant(fileName)) u'servicemanager/last file',QtCore.QVariant(fileName))
def fileName(self): def fileName(self):
""" """
@ -372,8 +372,7 @@ class ServiceManager(QtGui.QWidget):
Triggered when Config dialog is updated. Triggered when Config dialog is updated.
""" """
self.expandTabs = QtCore.QSettings().value( self.expandTabs = QtCore.QSettings().value(
u'advanced/expand service item', u'advanced/expand service item', QtCore.QVariant(u'False')).toBool()
QtCore.QVariant(u'False')).toBool()
def supportedSuffixes(self, suffix): def supportedSuffixes(self, suffix):
self.suffixes.append(suffix) self.suffixes.append(suffix)
@ -444,8 +443,8 @@ class ServiceManager(QtGui.QWidget):
self.setFileName(u'') self.setFileName(u'')
self.serviceId += 1 self.serviceId += 1
self.setModified(False) self.setModified(False)
QtCore.QSettings(). \ QtCore.QSettings().setValue(
setValue(u'servicemanager/last file',QtCore.QVariant(u'')) u'servicemanager/last file',QtCore.QVariant(u''))
Receiver.send_message(u'servicemanager_new_service') Receiver.send_message(u'servicemanager_new_service')
def saveFile(self): def saveFile(self):
@ -469,8 +468,7 @@ class ServiceManager(QtGui.QWidget):
service_file_name = '%s.osd' % basename service_file_name = '%s.osd' % basename
log.debug(u'ServiceManager.saveFile - %s', path_file_name) log.debug(u'ServiceManager.saveFile - %s', path_file_name)
SettingsManager.set_last_dir( SettingsManager.set_last_dir(
self.mainwindow.serviceManagerSettingsSection, self.mainwindow.serviceManagerSettingsSection, path)
path)
service = [] service = []
write_list = [] write_list = []
audio_files = [] audio_files = []
@ -561,14 +559,12 @@ class ServiceManager(QtGui.QWidget):
zip.write(audio_from, audio_to.encode(u'utf-8')) zip.write(audio_from, audio_to.encode(u'utf-8'))
except IOError: except IOError:
log.exception(u'Failed to save service to disk: %s', temp_file_name) log.exception(u'Failed to save service to disk: %s', temp_file_name)
# Add this line in after the release to notify the user that saving Receiver.send_message(u'openlp_error_message', {
# their file failed. Commented out due to string freeze. u'title': translate(u'OpenLP.ServiceManager',
#Receiver.send_message(u'openlp_error_message', { u'Error Saving File'),
# u'title': translate(u'OpenLP.ServiceManager', u'message': translate(u'OpenLP.ServiceManager',
# u'Error Saving File'), u'There was an error saving your file.')
# u'message': translate(u'OpenLP.ServiceManager', })
# u'There was an error saving your file.')
#})
success = False success = False
finally: finally:
if zip: if zip:
@ -734,8 +730,8 @@ class ServiceManager(QtGui.QWidget):
service was last closed. Can be blank if there was no service service was last closed. Can be blank if there was no service
present. present.
""" """
fileName = QtCore.QSettings(). \ fileName = QtCore.QSettings().value(
value(u'servicemanager/last file',QtCore.QVariant(u'')).toString() u'servicemanager/last file',QtCore.QVariant(u'')).toString()
if fileName: if fileName:
self.loadFile(fileName) self.loadFile(fileName)
@ -752,7 +748,7 @@ class ServiceManager(QtGui.QWidget):
self.maintainAction.setVisible(False) self.maintainAction.setVisible(False)
self.notesAction.setVisible(False) self.notesAction.setVisible(False)
self.timeAction.setVisible(False) self.timeAction.setVisible(False)
if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanEdit)\ if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanEdit) \
and serviceItem[u'service_item'].edit_id: and serviceItem[u'service_item'].edit_id:
self.editAction.setVisible(True) self.editAction.setVisible(True)
if serviceItem[u'service_item']\ if serviceItem[u'service_item']\
@ -1107,8 +1103,7 @@ class ServiceManager(QtGui.QWidget):
self.service_theme = unicode(self.themeComboBox.currentText()) self.service_theme = unicode(self.themeComboBox.currentText())
self.mainwindow.renderer.set_service_theme(self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme)
QtCore.QSettings().setValue( QtCore.QSettings().setValue(
self.mainwindow.serviceManagerSettingsSection + self.mainwindow.serviceManagerSettingsSection + u'/service theme',
u'/service theme',
QtCore.QVariant(self.service_theme)) QtCore.QVariant(self.service_theme))
self.regenerateServiceItems(True) self.regenerateServiceItems(True)