From 507cd19739083ec7aaeef549b4850e7ec34c71a9 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 28 Apr 2010 02:28:37 +0100 Subject: [PATCH] Cleanups and diff reading fixes --- openlp/core/lib/settingsmanager.py | 3 +- openlp/core/ui/generaltab.py | 31 ++++++++++++------- openlp/core/ui/mainwindow.py | 2 +- openlp/core/ui/servicemanager.py | 2 +- openlp/core/ui/slidecontroller.py | 2 +- openlp/core/ui/thememanager.py | 2 +- openlp/plugins/bibles/lib/db.py | 10 +++--- openlp/plugins/custom/lib/customtab.py | 2 +- openlp/plugins/custom/lib/manager.py | 8 ++--- .../presentations/lib/presentationtab.py | 2 +- openlp/plugins/songs/lib/manager.py | 12 ++++--- openlp/plugins/songs/lib/songstab.py | 4 +-- openlp/plugins/songusage/lib/manager.py | 12 ++++--- 13 files changed, 54 insertions(+), 38 deletions(-) diff --git a/openlp/core/lib/settingsmanager.py b/openlp/core/lib/settingsmanager.py index d859ddea8..36caa38f5 100644 --- a/openlp/core/lib/settingsmanager.py +++ b/openlp/core/lib/settingsmanager.py @@ -1,4 +1,3 @@ -import os.path # -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 @@ -126,7 +125,7 @@ class SettingsManager(object): settings.setValue( u'%s/%s %d' % (section, name, counter), list[counter-1]) if old_count > new_count: - # Tidy up any old list itrms if list is smaller now + # Tidy up any old list items for counter in range(new_count, old_count): settings.remove(u'%s/%s %d' % (section, name, counter)) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index bb35d8f2a..357756a08 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -264,17 +264,26 @@ class GeneralTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.setValue(u'general/monitor', self.MonitorNumber) - settings.setValue( - u'general/display on monitor', self.DisplayOnMonitor) - settings.setValue(u'general/blank warning', self.Warning) - settings.setValue(u'general/auto open', self.AutoOpen) - settings.setValue(u'general/show splash', self.ShowSplash) - settings.setValue(u'general/save prompt', self.PromptSaveService) - settings.setValue(u'general/auto preview', self.AutoPreview) - settings.setValue(u'general/ccli number', self.CCLINumber) - settings.setValue(u'general/songselect username', self.Username) - settings.setValue(u'general/songselect password', self.Password) + settings.setValue(u'general/monitor', + QtCore.QVariant(self.MonitorNumber)) + settings.setValue(u'general/display on monitor', + QtCore.QVariant(self.DisplayOnMonitor)) + settings.setValue(u'general/blank warning', + QtCore.QVariant(self.Warning)) + settings.setValue(u'general/auto open', + QtCore.QVariant(self.AutoOpen)) + settings.setValue(u'general/show splash', + QtCore.QVariant(self.ShowSplash)) + settings.setValue(u'general/save prompt', + QtCore.QVariant(self.PromptSaveService)) + settings.setValue(u'general/auto preview', + QtCore.QVariant(self.AutoPreview)) + settings.setValue(u'general/ccli number', + QtCore.QVariant(self.CCLINumber)) + settings.setValue(u'general/songselect username', + QtCore.QVariant(self.Username)) + settings.setValue(u'general/songselect password', + QtCore.QVariant(self.Password)) self.screens.display = self.DisplayOnMonitor #Monitor Number has changed. if self.screens.monitor_number != self.MonitorNumber: diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 96357f83d..d1efc79c5 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -431,7 +431,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.plugin_helpers = {} # Set up the interface self.setupUi(self) - # Load settings after setupUi so defaults UI sizes are overwritten + # Load settings after setupUi so default UI sizes are overwritten self.loadSettings() # Once settings are loaded update FileMenu with recentFiles self.updateFileMenu() diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 14bb35113..28793de71 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -641,7 +641,7 @@ class ServiceManager(QtGui.QWidget): """ self.service_theme = unicode(self.ThemeComboBox.currentText()) self.parent.RenderManager.set_service_theme(self.service_theme) - QtCore.QSettings().setValue(u'service manager/service theme', + QtCore.QSettings().setValue(u'servicemanager/service theme', QtCore.QVariant(self.service_theme)) self.regenerateServiceItems() diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index c1f38cf38..6ff739fc3 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -396,7 +396,7 @@ class SlideController(QtGui.QWidget): self.Toolbar.makeWidgetsInvisible(self.loop_list) if item.is_text(): self.Toolbar.makeWidgetsInvisible(self.loop_list) - if QtCore.QSettings().value(u'songs/show songbar', True) \ + if QtCore.QSettings().value(u'songs/show songbar', True).toBool() \ and len(self.slideList) > 0: self.Toolbar.makeWidgetsVisible([u'Song Menu']) if item.is_capable(ItemCapabilities.AllowsLoop) and \ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 0c19c2510..a71e65210 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -145,7 +145,7 @@ class ThemeManager(QtGui.QWidget): name = u'%s (%s)' % (self.global_theme, self.trUtf8('default')) self.ThemeListWidget.item(count).setText(name) QtCore.QSettings().setValue(u'themes/global theme', - self.global_theme) + QtCore.QVariant(self.global_theme)) Receiver.send_message(u'theme_update_global', self.global_theme) self.pushThemes() diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 207fe4091..0d2422a8d 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -80,11 +80,11 @@ class BibleDB(QtCore.QObject): if db_type == u'sqlite': db_url = u'sqlite:///' + self.db_file else: - db_url = u'%s://%s:%s@%s/%s' % \ - (db_type, unicode(settings.value(u'bibles/db username')), - unicode(settings.value(u'bibles/db password')), - unicode(settings.value(u'bibles/db hostname')), - unicode(settings.value(u'bibles/db database'))) + db_url = u'%s://%s:%s@%s/%s' % (db_type, + unicode(settings.value(u'bibles/db username').toString()), + unicode(settings.value(u'bibles/db password').toString()), + unicode(settings.value(u'bibles/db hostname').toString()), + unicode(settings.value(u'bibles/db database').toString())) self.metadata, self.session = init_models(db_url) self.metadata.create_all(checkfirst=True) if u'file' in kwargs: diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index d99c6d9e3..5470c64d0 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -57,7 +57,7 @@ class CustomTab(SettingsTab): def retranslateUi(self): self.CustomModeGroupBox.setTitle(self.trUtf8('Custom Display')) self.DisplayFooterCheckBox.setText( - self.trUtf8('Display Footer:')) + self.trUtf8('Display Footer')) def onDisplayFooterCheckBoxChanged(self, check_state): self.displayFooter = False diff --git a/openlp/plugins/custom/lib/manager.py b/openlp/plugins/custom/lib/manager.py index 54962d9b0..c9555e63a 100644 --- a/openlp/plugins/custom/lib/manager.py +++ b/openlp/plugins/custom/lib/manager.py @@ -54,10 +54,10 @@ class CustomManager(): AppLocation.get_section_data_path(u'custom') else: self.db_url = u'%s://%s:%s@%s/%s' % (db_type, - unicode(settings.value(u'custom/db username')), - unicode(settings.value(u'custom/db password')), - unicode(settings.value(u'custom/db hostname')), - unicode(settings.value(u'custom/db database'))) + unicode(settings.value(u'custom/db username').toString()), + unicode(settings.value(u'custom/db password').toString()), + unicode(settings.value(u'custom/db hostname').toString()), + unicode(settings.value(u'custom/db database').toString())) self.session = init_models(self.db_url) metadata.create_all(checkfirst=True) diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index af492d2c8..4c1b41813 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -93,7 +93,7 @@ class PresentationTab(SettingsTab): controller = self.controllers[key] checkbox = self.PresenterCheckboxes[controller.name] checkbox.setText( - u'%s %s:' % (controller.name, self.trUtf8('available'))) + u'%s %s' % (controller.name, self.trUtf8('available'))) def load(self): for key in self.controllers: diff --git a/openlp/plugins/songs/lib/manager.py b/openlp/plugins/songs/lib/manager.py index f97b0875d..5264a58ed 100644 --- a/openlp/plugins/songs/lib/manager.py +++ b/openlp/plugins/songs/lib/manager.py @@ -55,10 +55,14 @@ class SongManager(): AppLocation.get_section_data_path(u'songs') else: self.db_url = db_type + 'u://' + \ - unicode(settings.value(u'songs/db username', u'').toString()) + u':' + \ - unicode(settings.value(u'songs/db password', u'').toString()) + u'@' + \ - unicode(settings.value(u'songs/db hostname', u'').toString()) + u'/' + \ - unicode(settings.value(u'songs/db database', u'').toString()) + unicode(settings.value( + u'songs/db username', u'').toString()) + u':' + \ + unicode(settings.value( + u'songs/db password', u'').toString()) + u'@' + \ + unicode(settings.value( + u'songs/db hostname', u'').toString()) + u'/' + \ + unicode(settings.value( + u'songs/db database', u'').toString()) self.session = init_models(self.db_url) metadata.create_all(checkfirst=True) log.debug(u'Song Initialised') diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index 3fb41aabf..8b9f6804d 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -63,9 +63,9 @@ class SongsTab(SettingsTab): def retranslateUi(self): self.SongsModeGroupBox.setTitle(self.trUtf8('Songs Mode')) self.SearchAsTypeCheckBox.setText( - self.trUtf8('Enable search as you type:')) + self.trUtf8('Enable search as you type')) self.SongBarActiveCheckBox.setText( - self.trUtf8('Display Verses on Live Tool bar:')) + self.trUtf8('Display Verses on Live Tool bar')) def onSearchAsTypeCheckBoxChanged(self, check_state): self.song_search = False diff --git a/openlp/plugins/songusage/lib/manager.py b/openlp/plugins/songusage/lib/manager.py index dddea5350..d307f9dd5 100644 --- a/openlp/plugins/songusage/lib/manager.py +++ b/openlp/plugins/songusage/lib/manager.py @@ -55,10 +55,14 @@ class SongUsageManager(): AppLocation.get_section_data_path(u'songusage') else: self.db_url = u'%s://%s:%s@%s/%s' % (db_type, - unicode(settings.value(u'songusage/db username', u'')), - unicode(settings.value(u'songusage/db password', u'')), - unicode(settings.value(u'songusage/db hostname', u'')), - unicode(settings.value(u'songusage/db database', u''))) + unicode( + settings.value(u'songusage/db username', u'').toString()), + unicode( + settings.value(u'songusage/db password', u'').toString()), + unicode( + settings.value(u'songusage/db hostname', u'').toString()), + unicode( + settings.value(u'songusage/db database', u'').toString())) self.session = init_models(self.db_url) metadata.create_all(checkfirst=True)