Cleanups and diff reading fixes

This commit is contained in:
Jon Tibble 2010-04-28 02:28:37 +01:00
parent 2470f776cd
commit 507cd19739
13 changed files with 54 additions and 38 deletions

View File

@ -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))

View File

@ -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:

View File

@ -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()

View File

@ -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()

View File

@ -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 \

View File

@ -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()

View File

@ -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:

View File

@ -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

View File

@ -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)

View File

@ -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:

View File

@ -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')

View File

@ -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

View File

@ -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)