forked from openlp/openlp
more clean ups
This commit is contained in:
parent
56c36f355d
commit
a379d9ec54
@ -78,6 +78,7 @@ QToolBar
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class OpenLP(QtGui.QApplication):
|
||||
"""
|
||||
The core application class. This class inherits from Qt's QApplication
|
||||
@ -97,7 +98,6 @@ class OpenLP(QtGui.QApplication):
|
||||
"""
|
||||
Run the OpenLP application.
|
||||
"""
|
||||
|
||||
# On Windows, the args passed into the constructor are
|
||||
# ignored. Not very handy, so set the ones we want to use.
|
||||
self.args.extend(args)
|
||||
@ -111,8 +111,7 @@ class OpenLP(QtGui.QApplication):
|
||||
# Decide how many screens we have and their size
|
||||
screens = ScreenList(self.desktop())
|
||||
# First time checks in settings
|
||||
has_run_wizard = Settings().value(
|
||||
u'general/has run wizard', False)
|
||||
has_run_wizard = Settings().value(u'general/has run wizard', False)
|
||||
if not has_run_wizard:
|
||||
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
|
||||
Settings().setValue(u'general/has run wizard', True)
|
||||
|
@ -190,7 +190,6 @@ class Plugin(QtCore.QObject):
|
||||
"""
|
||||
Sets the status of the plugin
|
||||
"""
|
||||
#TODO: check if [0] is needed.
|
||||
self.status = Settings().value(
|
||||
self.settingsSection + u'/status', PluginStatus.Inactive)
|
||||
|
||||
|
@ -348,28 +348,20 @@ class AdvancedTab(SettingsTab):
|
||||
# 20 will always be used.
|
||||
self.recentSpinBox.setMaximum(Settings().value(
|
||||
u'max recent files', 20))
|
||||
self.recentSpinBox.setValue(settings.value(u'recent file count',
|
||||
4))
|
||||
self.recentSpinBox.setValue(settings.value(u'recent file count', 4))
|
||||
self.mediaPluginCheckBox.setChecked(
|
||||
settings.value(u'save current plugin',
|
||||
False))
|
||||
settings.value(u'save current plugin', False))
|
||||
self.doubleClickLiveCheckBox.setChecked(
|
||||
settings.value(u'double click live',
|
||||
False))
|
||||
settings.value(u'double click live', False))
|
||||
self.singleClickPreviewCheckBox.setChecked(
|
||||
settings.value(u'single click preview',
|
||||
False))
|
||||
settings.value(u'single click preview', False))
|
||||
self.expandServiceItemCheckBox.setChecked(
|
||||
settings.value(u'expand service item',
|
||||
False))
|
||||
settings.value(u'expand service item', False))
|
||||
self.enableAutoCloseCheckBox.setChecked(
|
||||
settings.value(u'enable exit confirmation',
|
||||
True))
|
||||
self.hideMouseCheckBox.setChecked(
|
||||
settings.value(u'hide mouse', False))
|
||||
settings.value(u'enable exit confirmation', True))
|
||||
self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse', False))
|
||||
self.serviceNameDay.setCurrentIndex(
|
||||
settings.value(u'default service day',
|
||||
self.defaultServiceDay))
|
||||
settings.value(u'default service day', self.defaultServiceDay))
|
||||
self.serviceNameTime.setTime(QtCore.QTime(
|
||||
settings.value(u'default service hour', self.defaultServiceHour),
|
||||
settings.value(u'default service minute',
|
||||
|
@ -113,8 +113,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
check_directory_exists(os.path.join(gettempdir(), u'openlp'))
|
||||
self.noInternetFinishButton.setVisible(False)
|
||||
# Check if this is a re-run of the wizard.
|
||||
self.hasRunWizard = Settings().value(
|
||||
u'general/has run wizard', False)
|
||||
self.hasRunWizard = Settings().value(u'general/has run wizard', False)
|
||||
# Sort out internet access for downloads
|
||||
if self.webAccess:
|
||||
songs = self.config.get(u'songs', u'languages')
|
||||
|
@ -280,18 +280,14 @@ class GeneralTab(SettingsTab):
|
||||
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank',
|
||||
False))
|
||||
self.displayOnMonitorCheck.setChecked(self.screens.display)
|
||||
self.warningCheckBox.setChecked(settings.value(u'blank warning',
|
||||
False))
|
||||
self.autoOpenCheckBox.setChecked(settings.value(u'auto open',
|
||||
False))
|
||||
self.showSplashCheckBox.setChecked(settings.value(u'show splash',
|
||||
True))
|
||||
self.warningCheckBox.setChecked(settings.value(u'blank warning', False))
|
||||
self.autoOpenCheckBox.setChecked(settings.value(u'auto open', False))
|
||||
self.showSplashCheckBox.setChecked(settings.value(u'show splash', True))
|
||||
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check',
|
||||
True))
|
||||
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview',
|
||||
False))
|
||||
self.timeoutSpinBox.setValue(settings.value(u'loop delay',
|
||||
5))
|
||||
self.timeoutSpinBox.setValue(settings.value(u'loop delay', 5))
|
||||
self.monitorRadioButton.setChecked(
|
||||
not settings.value(u'override position',
|
||||
False))
|
||||
|
@ -198,8 +198,7 @@ class MainDisplay(Display):
|
||||
u':/graphics/openlp-splash-screen.png')
|
||||
background_color = QtGui.QColor()
|
||||
background_color.setNamedColor(Settings().value(
|
||||
u'advanced/default color',
|
||||
u'#ffffff'))
|
||||
u'advanced/default color', u'#ffffff'))
|
||||
if not background_color.isValid():
|
||||
background_color = QtCore.Qt.white
|
||||
splash_image = QtGui.QImage(image_file)
|
||||
@ -350,8 +349,7 @@ class MainDisplay(Display):
|
||||
# Single screen active
|
||||
if self.screens.display_count == 1:
|
||||
# Only make visible if setting enabled.
|
||||
if Settings().value(
|
||||
u'general/display on monitor', True):
|
||||
if Settings().value(u'general/display on monitor', True):
|
||||
self.setVisible(True)
|
||||
else:
|
||||
self.setVisible(True)
|
||||
@ -399,8 +397,7 @@ class MainDisplay(Display):
|
||||
self.footer(serviceItem.foot_text)
|
||||
# if was hidden keep it hidden
|
||||
if self.hideMode and self.isLive and not serviceItem.is_media():
|
||||
if Settings().value(u'general/auto unblank',
|
||||
False):
|
||||
if Settings().value(u'general/auto unblank', False):
|
||||
Receiver.send_message(u'slidecontroller_live_unblank')
|
||||
else:
|
||||
self.hideDisplay(self.hideMode)
|
||||
@ -423,8 +420,7 @@ class MainDisplay(Display):
|
||||
log.debug(u'hideDisplay mode = %d', mode)
|
||||
if self.screens.display_count == 1:
|
||||
# Only make visible if setting enabled.
|
||||
if not Settings().value(u'general/display on monitor',
|
||||
True):
|
||||
if not Settings().value(u'general/display on monitor', True):
|
||||
return
|
||||
if mode == HideMode.Screen:
|
||||
self.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||
@ -448,8 +444,7 @@ class MainDisplay(Display):
|
||||
log.debug(u'showDisplay')
|
||||
if self.screens.display_count == 1:
|
||||
# Only make visible if setting enabled.
|
||||
if not Settings().value(u'general/display on monitor',
|
||||
True):
|
||||
if not Settings().value(u'general/display on monitor', True):
|
||||
return
|
||||
self.frame.evaluateJavaScript('show_blank("show");')
|
||||
if self.isHidden():
|
||||
@ -463,8 +458,7 @@ class MainDisplay(Display):
|
||||
"""
|
||||
Hide mouse cursor when moved over display.
|
||||
"""
|
||||
if Settings().value(u'advanced/hide mouse',
|
||||
False):
|
||||
if Settings().value(u'advanced/hide mouse', False):
|
||||
self.setCursor(QtCore.Qt.BlankCursor)
|
||||
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
|
||||
else:
|
||||
|
@ -99,13 +99,10 @@ class Ui_MainWindow(object):
|
||||
# Create slide controllers
|
||||
self.previewController = SlideController(self)
|
||||
self.liveController = SlideController(self, True)
|
||||
previewVisible = Settings().value(
|
||||
u'user interface/preview panel', True)
|
||||
previewVisible = Settings().value(u'user interface/preview panel', True)
|
||||
self.previewController.panel.setVisible(previewVisible)
|
||||
liveVisible = Settings().value(u'user interface/live panel',
|
||||
True)
|
||||
panelLocked = Settings().value(u'user interface/lock panel',
|
||||
False)
|
||||
liveVisible = Settings().value(u'user interface/live panel', True)
|
||||
panelLocked = Settings().value(u'user interface/lock panel', False)
|
||||
self.liveController.panel.setVisible(liveVisible)
|
||||
# Create menu
|
||||
self.menuBar = QtGui.QMenuBar(mainWindow)
|
||||
@ -685,8 +682,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
self.liveController.screenSizeChanged()
|
||||
log.info(u'Load data from Settings')
|
||||
if Settings().value(u'advanced/save current plugin', False):
|
||||
savedPlugin = Settings().value(
|
||||
u'advanced/current media plugin', )
|
||||
savedPlugin = Settings().value(u'advanced/current media plugin', -1)
|
||||
if savedPlugin != -1:
|
||||
self.mediaToolBox.setCurrentIndex(savedPlugin)
|
||||
self.settingsForm.postSetUp()
|
||||
@ -738,10 +734,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
filename = unicode(filename, sys.getfilesystemencoding())
|
||||
self.serviceManagerContents.loadFile(filename)
|
||||
elif Settings().value(
|
||||
self.generalSettingsSection + u'/auto open',
|
||||
False):
|
||||
self.generalSettingsSection + u'/auto open', False):
|
||||
self.serviceManagerContents.loadLastFile()
|
||||
view_mode = Settings().value(u'%s/view mode' % \
|
||||
view_mode = Settings().value(u'%s/view mode' %
|
||||
self.generalSettingsSection, u'default')
|
||||
if view_mode == u'default':
|
||||
self.modeDefaultItem.setChecked(True)
|
||||
@ -954,8 +949,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
for plugin in self.pluginManager.plugins:
|
||||
setting_sections.extend([plugin.name])
|
||||
settings = Settings()
|
||||
import_settings = Settings(import_file_name,
|
||||
QtCore.QSettings.IniFormat)
|
||||
import_settings = Settings(import_file_name, QtCore.QSettings.IniFormat)
|
||||
import_keys = import_settings.allKeys()
|
||||
for section_key in import_keys:
|
||||
# We need to handle the really bad files.
|
||||
@ -988,8 +982,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
now = datetime.now()
|
||||
settings.beginGroup(self.headerSection)
|
||||
settings.setValue(u'file_imported', import_file_name)
|
||||
settings.setValue(u'file_date_imported',
|
||||
now.strftime("%Y-%m-%d %H:%M"))
|
||||
settings.setValue(u'file_date_imported', now.strftime("%Y-%m-%d %H:%M"))
|
||||
settings.endGroup()
|
||||
settings.sync()
|
||||
# We must do an immediate restart or current configuration will
|
||||
@ -1043,8 +1036,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
settings.remove(self.headerSection)
|
||||
# Get the settings.
|
||||
keys = settings.allKeys()
|
||||
export_settings = Settings(temp_file,
|
||||
QtCore.QSettings.IniFormat)
|
||||
export_settings = Settings(temp_file, QtCore.QSettings.IniFormat)
|
||||
# Add a header section.
|
||||
# This is to insure it's our conf file for import.
|
||||
now = datetime.now()
|
||||
@ -1147,8 +1139,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
else:
|
||||
event.ignore()
|
||||
else:
|
||||
if Settings().value(u'advanced/enable exit confirmation',
|
||||
True):
|
||||
if Settings().value(u'advanced/enable exit confirmation', True):
|
||||
ret = QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.MainWindow', 'Close OpenLP'),
|
||||
translate('OpenLP.MainWindow',
|
||||
@ -1172,8 +1163,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
# Clean temporary files used by services
|
||||
self.serviceManagerContents.cleanUp()
|
||||
if Settings().value(u'advanced/save current plugin',
|
||||
False):
|
||||
if Settings().value(u'advanced/save current plugin', False):
|
||||
Settings().setValue(u'advanced/current media plugin',
|
||||
self.mediaToolBox.currentIndex())
|
||||
# Call the cleanup method to shutdown plugins.
|
||||
@ -1368,8 +1358,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
Updates the recent file menu with the latest list of service files
|
||||
accessed.
|
||||
"""
|
||||
recentFileCount = Settings().value(
|
||||
u'advanced/recent file count', 4)
|
||||
recentFileCount = Settings().value(u'advanced/recent file count', 4)
|
||||
existingRecentFiles = [recentFile for recentFile in self.recentFiles
|
||||
if os.path.isfile(unicode(recentFile))]
|
||||
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
|
||||
@ -1401,8 +1390,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
# The maxRecentFiles value does not have an interface and so never gets
|
||||
# actually stored in the settings therefore the default value of 20 will
|
||||
# always be used.
|
||||
maxRecentFiles = Settings().value(
|
||||
u'advanced/max recent files', 20)
|
||||
maxRecentFiles = Settings().value(u'advanced/max recent files', 20)
|
||||
if filename:
|
||||
# Add some cleanup to reduce duplication in the recent file list
|
||||
filename = os.path.abspath(filename)
|
||||
|
Loading…
Reference in New Issue
Block a user