From 29ef34b569d9f9c1561201f8a1bb7d8d559fd3ef Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 10 Apr 2011 07:18:31 +0100 Subject: [PATCH 01/13] Add saving of selected Bible names in Quick and Advanced. Clean up combo box selection code (General) Fixes: https://launchpad.net/bugs/755687 --- openlp/core/lib/ui.py | 17 ++++++++++ openlp/core/ui/servicemanager.py | 11 ++----- openlp/core/ui/themestab.py | 9 ++---- openlp/plugins/bibles/lib/biblestab.py | 9 ++---- openlp/plugins/bibles/lib/mediaitem.py | 32 +++++++++++++------ openlp/plugins/custom/forms/editcustomform.py | 8 ++--- openlp/plugins/songs/forms/editsongform.py | 17 ++-------- 7 files changed, 51 insertions(+), 52 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index c1a9f8b35..ffcc32414 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -315,3 +315,20 @@ def create_valign_combo(form, parent, layout): form.verticalComboBox.addItem(UiStrings.Bottom) verticalLabel.setBuddy(form.verticalComboBox) layout.addRow(verticalLabel, form.verticalComboBox) + +def find_in_combo_box(combo_box, value_to_find): + """ + Find a string in a combo box and set it as the selected item if present + + ``combo_box`` + The combo box to check for selected items + + ``value_to_find`` + The value to find + """ + index = combo_box.findText(value_to_find, + QtCore.Qt.MatchExactly) + if index == -1: + # Not Found. + index = 0 + combo_box.setCurrentIndex(index) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9c1c63917..a07d7f970 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -35,7 +35,8 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \ Receiver, build_icon, ItemCapabilities, SettingsManager, translate from openlp.core.lib.theme import ThemeLevel -from openlp.core.lib.ui import UiStrings, critical_error_message_box +from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ + find_in_combo_box from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ @@ -1261,13 +1262,7 @@ class ServiceManager(QtGui.QWidget): action = context_menu_action(self.serviceManagerList, None, theme, self.onThemeChangeAction) self.themeMenu.addAction(action) - index = self.themeComboBox.findText(self.service_theme, - QtCore.Qt.MatchExactly) - # Not Found - if index == -1: - index = 0 - self.service_theme = u'' - self.themeComboBox.setCurrentIndex(index) + find_in_combo_box(self.themeComboBox, self.service_theme) self.mainwindow.renderManager.set_service_theme(self.service_theme) self.regenerateServiceItems() diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 1b76d2198..3307b94fe 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, Receiver, translate from openlp.core.lib.theme import ThemeLevel -from openlp.core.lib.ui import UiStrings +from openlp.core.lib.ui import UiStrings, find_in_combo_box class ThemesTab(SettingsTab): """ @@ -185,12 +185,7 @@ class ThemesTab(SettingsTab): self.DefaultComboBox.clear() for theme in theme_list: self.DefaultComboBox.addItem(theme) - id = self.DefaultComboBox.findText( - self.global_theme, QtCore.Qt.MatchExactly) - if id == -1: - id = 0 # Not Found - self.global_theme = u'' - self.DefaultComboBox.setCurrentIndex(id) + find_in_combo_box(self.DefaultComboBox, self.global_theme) self.parent.renderManager.set_global_theme( self.global_theme, self.theme_level) if self.global_theme is not u'': diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 7a631ad09..d2e6ad8d9 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, SettingsTab, translate from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle +from openlp.core.lib.ui import find_in_combo_box log = logging.getLogger(__name__) @@ -208,10 +209,4 @@ class BiblesTab(SettingsTab): self.BibleThemeComboBox.addItem(u'') for theme in theme_list: self.BibleThemeComboBox.addItem(theme) - index = self.BibleThemeComboBox.findText( - unicode(self.bible_theme), QtCore.Qt.MatchExactly) - if index == -1: - # Not Found. - index = 0 - self.bible_theme = u'' - self.BibleThemeComboBox.setCurrentIndex(index) + find_in_combo_box(self.BibleThemeComboBox, self.bible_theme) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index a9694fd0c..5c77a75d7 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -32,7 +32,7 @@ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ translate from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings, add_widget_completer, \ - media_item_combo_box, critical_error_message_box + media_item_combo_box, critical_error_message_box, find_in_combo_box from openlp.plugins.bibles.forms import BibleImportForm from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \ VerseReferenceList, get_reference_match @@ -274,7 +274,7 @@ class BibleMediaItem(MediaManagerItem): log.debug(u'bible manager initialise') self.parent.manager.media = self self.loadBibles() - self.updateAutoCompleter() + self.updateAutoCompleter(False) self.configUpdated() log.debug(u'bible manager initialise complete') @@ -298,23 +298,25 @@ class BibleMediaItem(MediaManagerItem): bibles = self.parent.manager.get_bibles().keys() bibles.sort() # Load the bibles into the combo boxes. - first = True for bible in bibles: if bible: self.quickVersionComboBox.addItem(bible) self.quickSecondComboBox.addItem(bible) self.advancedVersionComboBox.addItem(bible) self.advancedSecondComboBox.addItem(bible) - if first: - first = False - self.initialiseBible(bible) + # set the default value + book = QtCore.QSettings().value( + self.settingsSection + u'/advanced bible', + QtCore.QVariant(u'')).toString() + find_in_combo_box(self.advancedVersionComboBox, book) + self.initialiseAdvancedBible(unicode(book)) def reloadBibles(self): log.debug(u'Reloading Bibles') self.parent.manager.reload_bibles() self.loadBibles() - def initialiseBible(self, bible): + def initialiseAdvancedBible(self, bible): """ This initialises the given bible, which means that its book names and their chapter numbers is added to the combo boxes on the @@ -324,7 +326,7 @@ class BibleMediaItem(MediaManagerItem): ``bible`` The bible to initialise (unicode). """ - log.debug(u'initialiseBible %s', bible) + log.debug(u'initialiseAdvancedBible %s', bible) book_data = self.parent.manager.get_books(bible) self.advancedBookComboBox.clear() first = True @@ -354,12 +356,20 @@ class BibleMediaItem(MediaManagerItem): self.adjustComboBox(1, verse_count, self.advancedFromVerse) self.adjustComboBox(1, verse_count, self.advancedToVerse) - def updateAutoCompleter(self): + def updateAutoCompleter(self, updateConfig=True): """ This updates the bible book completion list for the search field. The completion depends on the bible. It is only updated when we are doing a reference search, otherwise the auto completion list is removed. """ + if updateConfig: + QtCore.QSettings().setValue(self.settingsSection + u'/quick bible', + QtCore.QVariant(self.quickVersionComboBox.currentText())) + else: + book = QtCore.QSettings().value( + self.settingsSection + u'/quick bible', + QtCore.QVariant(u'')).toString() + find_in_combo_box(self.quickVersionComboBox, book) books = [] # We have to do a 'Reference Search'. if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference: @@ -372,7 +382,9 @@ class BibleMediaItem(MediaManagerItem): add_widget_completer(books, self.quickSearchEdit) def onAdvancedVersionComboBox(self): - self.initialiseBible( + QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible', + QtCore.QVariant(self.advancedVersionComboBox.currentText())) + self.initialiseAdvancedBible( unicode(self.advancedVersionComboBox.currentText())) def onAdvancedBookComboBox(self): diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index f81bd4c7d..3ebd5f984 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -29,7 +29,7 @@ import logging from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, translate -from openlp.core.lib.ui import critical_error_message_box +from openlp.core.lib.ui import critical_error_message_box, find_in_combo_box from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser from openlp.plugins.custom.lib.db import CustomSlide from editcustomdialog import Ui_CustomEditDialog @@ -98,11 +98,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): for slide in slideList: self.slideListView.addItem(slide[1]) theme = self.customSlide.theme_name - id = self.themeComboBox.findText(theme, QtCore.Qt.MatchExactly) - # No theme match - if id == -1: - id = 0 - self.themeComboBox.setCurrentIndex(id) + find_in_combo_box(self.themeComboBox, theme) # If not preview hide the preview button. self.previewButton.setVisible(False) if preview: diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 2f21e57cd..8dfae1736 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, translate from openlp.core.lib.ui import UiStrings, add_widget_completer, \ - critical_error_message_box + critical_error_message_box, find_in_combo_box from openlp.plugins.songs.forms import EditVerseForm from openlp.plugins.songs.lib import SongXML, VerseType, clean_song from openlp.plugins.songs.lib.db import Book, Song, Author, Topic @@ -208,20 +208,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.alternativeEdit.setText(u'') if self.song.song_book_id != 0: book_name = self.manager.get_object(Book, self.song.song_book_id) - id = self.songBookComboBox.findText( - unicode(book_name.name), QtCore.Qt.MatchExactly) - if id == -1: - # Not Found - id = 0 - self.songBookComboBox.setCurrentIndex(id) + find_in_combo_box(self.songBookComboBox, unicode(book_name.name)) if self.song.theme_name: - id = self.themeComboBox.findText( - unicode(self.song.theme_name), QtCore.Qt.MatchExactly) - if id == -1: - # Not Found - id = 0 - self.song.theme_name = None - self.themeComboBox.setCurrentIndex(id) + find_in_combo_box(self.themeComboBox, unicode(self.song.theme_name)) if self.song.copyright: self.copyrightEdit.setText(self.song.copyright) else: From c55df2583a2c3fc558b0c5d52079589f59dbe956 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 10 Apr 2011 07:27:23 +0100 Subject: [PATCH 02/13] Remove trailing comma Fixes: https://launchpad.net/bugs/748960 --- openlp/plugins/bibles/lib/versereferencelist.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlp/plugins/bibles/lib/versereferencelist.py b/openlp/plugins/bibles/lib/versereferencelist.py index bc28f2570..bab6d7e11 100644 --- a/openlp/plugins/bibles/lib/versereferencelist.py +++ b/openlp/plugins/bibles/lib/versereferencelist.py @@ -96,4 +96,7 @@ class VerseReferenceList(object): version[u'copyright']) if version[u'permission'].strip(): result = result + u', ' + version[u'permission'] + result = result.rstrip() + if result.endswith(u','): + return result[:len(result)-1] return result From c8d2baff7ce25635474903c478e7be54687827fa Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 10 Apr 2011 08:32:15 +0100 Subject: [PATCH 03/13] Add bible verse layout to Quick tab. Not moved to Advanced tab as no real estate. Fixes: https://launchpad.net/bugs/745218 --- openlp/core/lib/ui.py | 4 + openlp/plugins/bibles/lib/biblestab.py | 161 ++++++++++++------------- openlp/plugins/bibles/lib/mediaitem.py | 25 ++++ 3 files changed, 109 insertions(+), 81 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index ffcc32414..9b03cce03 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -49,8 +49,10 @@ class UiStrings(object): Cancel = translate('OpenLP.Ui', 'Cancel') CCLINumberLabel = translate('OpenLP.Ui', 'CCLI number:') CreateService = translate('OpenLP.Ui', 'Create a new service.') + Continuous = translate('OpenLP.Ui', 'Continuous') Default = unicode(translate('OpenLP.Ui', 'Default')) Delete = translate('OpenLP.Ui', '&Delete') + DisplayStyle = translate('OpenLP.Ui', 'Display style:') Edit = translate('OpenLP.Ui', '&Edit') EmptyField = translate('OpenLP.Ui', 'Empty Field') Error = translate('OpenLP.Ui', 'Error') @@ -97,6 +99,8 @@ class UiStrings(object): Theme = translate('OpenLP.Ui', 'Theme', 'Singular') Themes = translate('OpenLP.Ui', 'Themes', 'Plural') Top = translate('OpenLP.Ui', 'Top') + VersePerSlide = translate('OpenLP.Ui', 'Verse Per Slide') + VersePerLine = translate('OpenLP.Ui', 'Verse Per Line') Version = translate('OpenLP.Ui', 'Version') def add_welcome_page(parent, image): diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index d2e6ad8d9..5133587b3 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -30,7 +30,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, SettingsTab, translate from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle -from openlp.core.lib.ui import find_in_combo_box +from openlp.core.lib.ui import UiStrings, find_in_combo_box log = logging.getLogger(__name__) @@ -49,116 +49,115 @@ class BiblesTab(SettingsTab): def setupUi(self): self.setObjectName(u'BiblesTab') SettingsTab.setupUi(self) - self.VerseDisplayGroupBox = QtGui.QGroupBox(self.leftColumn) - self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox') - self.VerseDisplayLayout = QtGui.QFormLayout(self.VerseDisplayGroupBox) - self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout') - self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) - self.NewChaptersCheckBox.setObjectName(u'NewChaptersCheckBox') - self.VerseDisplayLayout.addRow(self.NewChaptersCheckBox) - self.DisplayStyleLabel = QtGui.QLabel(self.VerseDisplayGroupBox) - self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel') - self.DisplayStyleComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox) - self.DisplayStyleComboBox.addItems([u'', u'', u'', u'']) - self.DisplayStyleComboBox.setObjectName(u'DisplayStyleComboBox') - self.VerseDisplayLayout.addRow(self.DisplayStyleLabel, - self.DisplayStyleComboBox) - self.LayoutStyleLabel = QtGui.QLabel(self.VerseDisplayGroupBox) - self.LayoutStyleLabel.setObjectName(u'LayoutStyleLabel') - self.LayoutStyleComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox) - self.LayoutStyleComboBox.setObjectName(u'LayoutStyleComboBox') - self.LayoutStyleComboBox.addItems([u'', u'', u'']) - self.VerseDisplayLayout.addRow(self.LayoutStyleLabel, - self.LayoutStyleComboBox) - self.BibleSecondCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) - self.BibleSecondCheckBox.setObjectName(u'BibleSecondCheckBox') - self.VerseDisplayLayout.addRow(self.BibleSecondCheckBox) - self.BibleThemeLabel = QtGui.QLabel(self.VerseDisplayGroupBox) - self.BibleThemeLabel.setObjectName(u'BibleThemeLabel') - self.BibleThemeComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox) - self.BibleThemeComboBox.setSizeAdjustPolicy( + self.verseDisplayGroupBox = QtGui.QGroupBox(self.leftColumn) + self.verseDisplayGroupBox.setObjectName(u'verseDisplayGroupBox') + self.verseDisplayLayout = QtGui.QFormLayout(self.verseDisplayGroupBox) + self.verseDisplayLayout.setObjectName(u'verseDisplayLayout') + self.newChaptersCheckBox = QtGui.QCheckBox(self.verseDisplayGroupBox) + self.newChaptersCheckBox.setObjectName(u'newChaptersCheckBox') + self.verseDisplayLayout.addRow(self.newChaptersCheckBox) + self.displayStyleLabel = QtGui.QLabel(self.verseDisplayGroupBox) + self.displayStyleLabel.setObjectName(u'displayStyleLabel') + self.displayStyleComboBox = QtGui.QComboBox(self.verseDisplayGroupBox) + self.displayStyleComboBox.addItems([u'', u'', u'', u'']) + self.displayStyleComboBox.setObjectName(u'displayStyleComboBox') + self.verseDisplayLayout.addRow(self.displayStyleLabel, + self.displayStyleComboBox) + self.layoutStyleLabel = QtGui.QLabel(self.verseDisplayGroupBox) + self.layoutStyleLabel.setObjectName(u'layoutStyleLabel') + self.layoutStyleComboBox = QtGui.QComboBox(self.verseDisplayGroupBox) + self.layoutStyleComboBox.setObjectName(u'layoutStyleComboBox') + self.layoutStyleComboBox.addItems([u'', u'', u'']) + self.verseDisplayLayout.addRow(self.layoutStyleLabel, + self.layoutStyleComboBox) + self.bibleSecondCheckBox = QtGui.QCheckBox(self.verseDisplayGroupBox) + self.bibleSecondCheckBox.setObjectName(u'bibleSecondCheckBox') + self.verseDisplayLayout.addRow(self.bibleSecondCheckBox) + self.bibleThemeLabel = QtGui.QLabel(self.verseDisplayGroupBox) + self.bibleThemeLabel.setObjectName(u'BibleThemeLabel') + self.bibleThemeComboBox = QtGui.QComboBox(self.verseDisplayGroupBox) + self.bibleThemeComboBox.setSizeAdjustPolicy( QtGui.QComboBox.AdjustToMinimumContentsLength) - self.BibleThemeComboBox.setSizePolicy( + self.bibleThemeComboBox.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - self.BibleThemeComboBox.addItem(u'') - self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox') - self.VerseDisplayLayout.addRow(self.BibleThemeLabel, - self.BibleThemeComboBox) - self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox) - self.ChangeNoteLabel.setWordWrap(True) - self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel') - self.VerseDisplayLayout.addRow(self.ChangeNoteLabel) - self.leftLayout.addWidget(self.VerseDisplayGroupBox) + self.bibleThemeComboBox.addItem(u'') + self.bibleThemeComboBox.setObjectName(u'BibleThemeComboBox') + self.verseDisplayLayout.addRow(self.bibleThemeLabel, + self.bibleThemeComboBox) + self.changeNoteLabel = QtGui.QLabel(self.verseDisplayGroupBox) + self.changeNoteLabel.setWordWrap(True) + self.changeNoteLabel.setObjectName(u'changeNoteLabel') + self.verseDisplayLayout.addRow(self.changeNoteLabel) + self.leftLayout.addWidget(self.verseDisplayGroupBox) self.leftLayout.addStretch() self.rightColumn.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) self.rightLayout.addStretch() # Signals and slots QtCore.QObject.connect( - self.NewChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), - self.onNewChaptersCheckBoxChanged) + self.newChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), + self.onnewChaptersCheckBoxChanged) QtCore.QObject.connect( - self.DisplayStyleComboBox, QtCore.SIGNAL(u'activated(int)'), - self.onDisplayStyleComboBoxChanged) + self.displayStyleComboBox, QtCore.SIGNAL(u'activated(int)'), + self.ondisplayStyleComboBoxChanged) QtCore.QObject.connect( - self.BibleThemeComboBox, QtCore.SIGNAL(u'activated(int)'), + self.bibleThemeComboBox, QtCore.SIGNAL(u'activated(int)'), self.onBibleThemeComboBoxChanged) QtCore.QObject.connect( - self.LayoutStyleComboBox, QtCore.SIGNAL(u'activated(int)'), - self.onLayoutStyleComboBoxChanged) + self.layoutStyleComboBox, QtCore.SIGNAL(u'activated(int)'), + self.onlayoutStyleComboBoxChanged) QtCore.QObject.connect( - self.BibleSecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), - self.onBibleSecondCheckBox) + self.bibleSecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), + self.onbibleSecondCheckBox) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) def retranslateUi(self): - self.VerseDisplayGroupBox.setTitle( + self.verseDisplayGroupBox.setTitle( translate('BiblesPlugin.BiblesTab', 'Verse Display')) - self.NewChaptersCheckBox.setText( + self.newChaptersCheckBox.setText( translate('BiblesPlugin.BiblesTab', 'Only show new chapter numbers')) - self.LayoutStyleLabel.setText( + self.layoutStyleLabel.setText( translate('BiblesPlugin.BiblesTab', 'Layout style:')) - self.DisplayStyleLabel.setText( - translate('BiblesPlugin.BiblesTab', 'Display style:')) - self.BibleThemeLabel.setText( + self.displayStyleLabel.setText(UiStrings.DisplayStyle) + self.bibleThemeLabel.setText( translate('BiblesPlugin.BiblesTab', 'Bible theme:')) - self.LayoutStyleComboBox.setItemText(LayoutStyle.VersePerSlide, - translate('BiblesPlugin.BiblesTab', 'Verse Per Slide')) - self.LayoutStyleComboBox.setItemText(LayoutStyle.VersePerLine, - translate('BiblesPlugin.BiblesTab', 'Verse Per Line')) - self.LayoutStyleComboBox.setItemText(LayoutStyle.Continuous, - translate('BiblesPlugin.BiblesTab', 'Continuous')) - self.DisplayStyleComboBox.setItemText(DisplayStyle.NoBrackets, + self.layoutStyleComboBox.setItemText(LayoutStyle.VersePerSlide, + UiStrings.VersePerSlide) + self.layoutStyleComboBox.setItemText(LayoutStyle.VersePerLine, + UiStrings.VersePerLine) + self.layoutStyleComboBox.setItemText(LayoutStyle.Continuous, + UiStrings.Continuous) + self.displayStyleComboBox.setItemText(DisplayStyle.NoBrackets, translate('BiblesPlugin.BiblesTab', 'No Brackets')) - self.DisplayStyleComboBox.setItemText(DisplayStyle.Round, + self.displayStyleComboBox.setItemText(DisplayStyle.Round, translate('BiblesPlugin.BiblesTab', '( And )')) - self.DisplayStyleComboBox.setItemText(DisplayStyle.Curly, + self.displayStyleComboBox.setItemText(DisplayStyle.Curly, translate('BiblesPlugin.BiblesTab', '{ And }')) - self.DisplayStyleComboBox.setItemText(DisplayStyle.Square, + self.displayStyleComboBox.setItemText(DisplayStyle.Square, translate('BiblesPlugin.BiblesTab', '[ And ]')) - self.ChangeNoteLabel.setText(translate('BiblesPlugin.BiblesTab', + self.changeNoteLabel.setText(translate('BiblesPlugin.BiblesTab', 'Note:\nChanges do not affect verses already in the service.')) - self.BibleSecondCheckBox.setText( + self.bibleSecondCheckBox.setText( translate('BiblesPlugin.BiblesTab', 'Display second Bible verses')) def onBibleThemeComboBoxChanged(self): - self.bible_theme = self.BibleThemeComboBox.currentText() + self.bible_theme = self.bibleThemeComboBox.currentText() - def onDisplayStyleComboBoxChanged(self): - self.display_style = self.DisplayStyleComboBox.currentIndex() + def ondisplayStyleComboBoxChanged(self): + self.display_style = self.displayStyleComboBox.currentIndex() - def onLayoutStyleComboBoxChanged(self): - self.layout_style = self.LayoutStyleComboBox.currentIndex() + def onlayoutStyleComboBoxChanged(self): + self.layout_style = self.layoutStyleComboBox.currentIndex() - def onNewChaptersCheckBoxChanged(self, check_state): + def onnewChaptersCheckBoxChanged(self, check_state): self.show_new_chapters = False # We have a set value convert to True/False. if check_state == QtCore.Qt.Checked: self.show_new_chapters = True - def onBibleSecondCheckBox(self, check_state): + def onbibleSecondCheckBox(self, check_state): self.second_bibles = False # We have a set value convert to True/False. if check_state == QtCore.Qt.Checked: @@ -177,10 +176,10 @@ class BiblesTab(SettingsTab): settings.value(u'bible theme', QtCore.QVariant(u'')).toString()) self.second_bibles = settings.value( u'second bibles', QtCore.QVariant(True)).toBool() - self.NewChaptersCheckBox.setChecked(self.show_new_chapters) - self.DisplayStyleComboBox.setCurrentIndex(self.display_style) - self.LayoutStyleComboBox.setCurrentIndex(self.layout_style) - self.BibleSecondCheckBox.setChecked(self.second_bibles) + self.newChaptersCheckBox.setChecked(self.show_new_chapters) + self.displayStyleComboBox.setCurrentIndex(self.display_style) + self.layoutStyleComboBox.setCurrentIndex(self.layout_style) + self.bibleSecondCheckBox.setChecked(self.second_bibles) settings.endGroup() def save(self): @@ -205,8 +204,8 @@ class BiblesTab(SettingsTab): [u'Bible Theme', u'Song Theme'] """ - self.BibleThemeComboBox.clear() - self.BibleThemeComboBox.addItem(u'') + self.bibleThemeComboBox.clear() + self.bibleThemeComboBox.addItem(u'') for theme in theme_list: - self.BibleThemeComboBox.addItem(theme) - find_in_combo_box(self.BibleThemeComboBox, self.bible_theme) + self.bibleThemeComboBox.addItem(theme) + find_in_combo_box(self.bibleThemeComboBox, self.bible_theme) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 5c77a75d7..84275f3fc 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -106,6 +106,12 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'Text Search')) ]) self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit) + self.quickLayoutLabel = QtGui.QLabel(self.quickTab) + self.quickLayoutLabel.setObjectName(u'quickClearLabel') + self.quickLayoutComboBox = media_item_combo_box(self.quickTab, + u'quickLayoutComboBox') + self.quickLayoutComboBox.addItems([u'', u'', u'']) + self.quickLayout.addRow(self.quickLayoutLabel, self.quickLayoutComboBox) self.quickClearLabel = QtGui.QLabel(self.quickTab) self.quickClearLabel.setObjectName(u'quickClearLabel') self.quickClearComboBox = media_item_combo_box(self.quickTab, @@ -210,6 +216,9 @@ class BibleMediaItem(MediaManagerItem): QtCore.SIGNAL(u'searchTypeChanged(int)'), self.updateAutoCompleter) QtCore.QObject.connect(self.quickVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) + QtCore.QObject.connect( + self.quickLayoutComboBox, QtCore.SIGNAL(u'activated(int)'), + self.onlayoutStyleComboBoxChanged) # Buttons QtCore.QObject.connect(self.advancedSearchButton, QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton) @@ -234,6 +243,7 @@ class BibleMediaItem(MediaManagerItem): self.advancedSecondComboBox.setVisible(False) self.quickSecondLabel.setVisible(False) self.quickSecondComboBox.setVisible(False) + self.quickLayoutComboBox.setCurrentIndex(self.settings.layout_style) def retranslateUi(self): log.debug(u'retranslateUi') @@ -269,6 +279,13 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'Clear')) self.advancedClearComboBox.addItem( translate('BiblesPlugin.MediaItem', 'Keep')) + self.quickLayoutLabel.setText(UiStrings.DisplayStyle) + self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerSlide, + UiStrings.VersePerSlide) + self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerLine, + UiStrings.VersePerLine) + self.quickLayoutComboBox.setItemText(LayoutStyle.Continuous, + UiStrings.Continuous) def initialise(self): log.debug(u'bible manager initialise') @@ -816,3 +833,11 @@ class BibleMediaItem(MediaManagerItem): if self.settings.display_style == DisplayStyle.Square: return u'{su}[%s]{/su}' % verse_text return u'{su}%s{/su}' % verse_text + + def onlayoutStyleComboBoxChanged(self): + self.settings.layout_style = self.quickLayoutComboBox.currentIndex() + self.settings.layoutStyleComboBox.setCurrentIndex( + self.settings.layout_style) + QtCore.QSettings().setValue( + self.settingsSection + u'/verse layout style', + QtCore.QVariant(self.settings.layout_style)) From 1882c5366d4b7456acb966016282cacf0f3a2bb0 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 10 Apr 2011 19:54:26 +0100 Subject: [PATCH 04/13] Review fixes --- openlp/core/lib/ui.py | 4 ++-- openlp/core/ui/servicemanager.py | 6 +++--- openlp/core/ui/themestab.py | 6 +++--- openlp/plugins/bibles/lib/biblestab.py | 20 +++++++++---------- openlp/plugins/bibles/lib/mediaitem.py | 8 ++++---- openlp/plugins/custom/forms/editcustomform.py | 6 +++--- openlp/plugins/songs/forms/editsongform.py | 8 ++++---- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 9b03cce03..4f6951d13 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -320,7 +320,7 @@ def create_valign_combo(form, parent, layout): verticalLabel.setBuddy(form.verticalComboBox) layout.addRow(verticalLabel, form.verticalComboBox) -def find_in_combo_box(combo_box, value_to_find): +def find_and_set_in_combo_box(combo_box, value_to_find): """ Find a string in a combo box and set it as the selected item if present @@ -335,4 +335,4 @@ def find_in_combo_box(combo_box, value_to_find): if index == -1: # Not Found. index = 0 - combo_box.setCurrentIndex(index) + combo_box.setCurrentIndex(index) \ No newline at end of file diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index a07d7f970..4c4837676 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -36,7 +36,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \ Receiver, build_icon, ItemCapabilities, SettingsManager, translate from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ - find_in_combo_box + find_and_set_in_combo_box from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ @@ -1262,7 +1262,7 @@ class ServiceManager(QtGui.QWidget): action = context_menu_action(self.serviceManagerList, None, theme, self.onThemeChangeAction) self.themeMenu.addAction(action) - find_in_combo_box(self.themeComboBox, self.service_theme) + find_and_set_in_combo_box(self.themeComboBox, self.service_theme) self.mainwindow.renderManager.set_service_theme(self.service_theme) self.regenerateServiceItems() @@ -1301,4 +1301,4 @@ class ServiceManager(QtGui.QWidget): Print a Service Order Sheet. """ settingDialog = PrintServiceForm(self.mainwindow, self) - settingDialog.exec_() + settingDialog.exec_() \ No newline at end of file diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 3307b94fe..1415c6810 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, Receiver, translate from openlp.core.lib.theme import ThemeLevel -from openlp.core.lib.ui import UiStrings, find_in_combo_box +from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box class ThemesTab(SettingsTab): """ @@ -185,7 +185,7 @@ class ThemesTab(SettingsTab): self.DefaultComboBox.clear() for theme in theme_list: self.DefaultComboBox.addItem(theme) - find_in_combo_box(self.DefaultComboBox, self.global_theme) + find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme) self.parent.renderManager.set_global_theme( self.global_theme, self.theme_level) if self.global_theme is not u'': @@ -201,4 +201,4 @@ class ThemesTab(SettingsTab): if not preview.isNull(): preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) - self.DefaultListView.setPixmap(preview) + self.DefaultListView.setPixmap(preview) \ No newline at end of file diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 5133587b3..914377e35 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -30,7 +30,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, SettingsTab, translate from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle -from openlp.core.lib.ui import UiStrings, find_in_combo_box +from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box log = logging.getLogger(__name__) @@ -96,19 +96,19 @@ class BiblesTab(SettingsTab): # Signals and slots QtCore.QObject.connect( self.newChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), - self.onnewChaptersCheckBoxChanged) + self.onNewChaptersCheckBoxChanged) QtCore.QObject.connect( self.displayStyleComboBox, QtCore.SIGNAL(u'activated(int)'), - self.ondisplayStyleComboBoxChanged) + self.onDisplayStyleComboBoxChanged) QtCore.QObject.connect( self.bibleThemeComboBox, QtCore.SIGNAL(u'activated(int)'), self.onBibleThemeComboBoxChanged) QtCore.QObject.connect( self.layoutStyleComboBox, QtCore.SIGNAL(u'activated(int)'), - self.onlayoutStyleComboBoxChanged) + self.onLayoutStyleComboBoxChanged) QtCore.QObject.connect( self.bibleSecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), - self.onbibleSecondCheckBox) + self.onBibleSecondCheckBox) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) @@ -145,19 +145,19 @@ class BiblesTab(SettingsTab): def onBibleThemeComboBoxChanged(self): self.bible_theme = self.bibleThemeComboBox.currentText() - def ondisplayStyleComboBoxChanged(self): + def onDisplayStyleComboBoxChanged(self): self.display_style = self.displayStyleComboBox.currentIndex() - def onlayoutStyleComboBoxChanged(self): + def onLayoutStyleComboBoxChanged(self): self.layout_style = self.layoutStyleComboBox.currentIndex() - def onnewChaptersCheckBoxChanged(self, check_state): + def onNewChaptersCheckBoxChanged(self, check_state): self.show_new_chapters = False # We have a set value convert to True/False. if check_state == QtCore.Qt.Checked: self.show_new_chapters = True - def onbibleSecondCheckBox(self, check_state): + def onBibleSecondCheckBox(self, check_state): self.second_bibles = False # We have a set value convert to True/False. if check_state == QtCore.Qt.Checked: @@ -208,4 +208,4 @@ class BiblesTab(SettingsTab): self.bibleThemeComboBox.addItem(u'') for theme in theme_list: self.bibleThemeComboBox.addItem(theme) - find_in_combo_box(self.bibleThemeComboBox, self.bible_theme) + find_and_set_in_combo_box(self.bibleThemeComboBox, self.bible_theme) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 84275f3fc..73ed0c9bd 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -32,7 +32,7 @@ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ translate from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings, add_widget_completer, \ - media_item_combo_box, critical_error_message_box, find_in_combo_box + media_item_combo_box, critical_error_message_box, find_and_set_in_combo_box from openlp.plugins.bibles.forms import BibleImportForm from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \ VerseReferenceList, get_reference_match @@ -325,7 +325,7 @@ class BibleMediaItem(MediaManagerItem): book = QtCore.QSettings().value( self.settingsSection + u'/advanced bible', QtCore.QVariant(u'')).toString() - find_in_combo_box(self.advancedVersionComboBox, book) + find_and_set_in_combo_box(self.advancedVersionComboBox, book) self.initialiseAdvancedBible(unicode(book)) def reloadBibles(self): @@ -386,7 +386,7 @@ class BibleMediaItem(MediaManagerItem): book = QtCore.QSettings().value( self.settingsSection + u'/quick bible', QtCore.QVariant(u'')).toString() - find_in_combo_box(self.quickVersionComboBox, book) + find_and_set_in_combo_box(self.quickVersionComboBox, book) books = [] # We have to do a 'Reference Search'. if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference: @@ -840,4 +840,4 @@ class BibleMediaItem(MediaManagerItem): self.settings.layout_style) QtCore.QSettings().setValue( self.settingsSection + u'/verse layout style', - QtCore.QVariant(self.settings.layout_style)) + QtCore.QVariant(self.settings.layout_style)) \ No newline at end of file diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 3ebd5f984..9312b5ddd 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -29,7 +29,7 @@ import logging from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, translate -from openlp.core.lib.ui import critical_error_message_box, find_in_combo_box +from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser from openlp.plugins.custom.lib.db import CustomSlide from editcustomdialog import Ui_CustomEditDialog @@ -98,7 +98,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): for slide in slideList: self.slideListView.addItem(slide[1]) theme = self.customSlide.theme_name - find_in_combo_box(self.themeComboBox, theme) + find_and_set_in_combo_box(self.themeComboBox, theme) # If not preview hide the preview button. self.previewButton.setVisible(False) if preview: @@ -261,4 +261,4 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): message=translate('CustomPlugin.EditCustomForm', 'You need to add at least one slide')) return False - return True + return True \ No newline at end of file diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 8dfae1736..85294d92b 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, translate from openlp.core.lib.ui import UiStrings, add_widget_completer, \ - critical_error_message_box, find_in_combo_box + critical_error_message_box, find_and_set_in_combo_box from openlp.plugins.songs.forms import EditVerseForm from openlp.plugins.songs.lib import SongXML, VerseType, clean_song from openlp.plugins.songs.lib.db import Book, Song, Author, Topic @@ -208,9 +208,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.alternativeEdit.setText(u'') if self.song.song_book_id != 0: book_name = self.manager.get_object(Book, self.song.song_book_id) - find_in_combo_box(self.songBookComboBox, unicode(book_name.name)) + find_and_set_in_combo_box(self.songBookComboBox, unicode(book_name.name)) if self.song.theme_name: - find_in_combo_box(self.themeComboBox, unicode(self.song.theme_name)) + find_and_set_in_combo_box(self.themeComboBox, unicode(self.song.theme_name)) if self.song.copyright: self.copyrightEdit.setText(self.song.copyright) else: @@ -779,4 +779,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.song.verse_order) except: log.exception(u'Problem processing song Lyrics \n%s', - sxml.dump_xml()) + sxml.dump_xml()) \ No newline at end of file From 20dc7846ce0c9f74415ff53430fbc6f3b07e16db Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 10 Apr 2011 19:59:29 +0100 Subject: [PATCH 05/13] Take new count after loading files works better Fixes: https://launchpad.net/bugs/756545 --- openlp/core/ui/thememanager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index d033daeb3..81da6e021 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -445,6 +445,7 @@ class ThemeManager(QtGui.QWidget): files = SettingsManager.get_files(self.settingsSection, u'.png') if firstTime: self.firstTime() + files = SettingsManager.get_files(self.settingsSection, u'.png') # No themes have been found so create one if len(files) == 0: theme = ThemeXML() From 2060fecbca341f7ae1048e7a9600c842fbd2d3e7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 11 Apr 2011 15:15:47 +0200 Subject: [PATCH 06/13] footer font/size are now not reset when the footer colour has changed --- openlp/core/ui/themeform.py | 51 +++++++++++++++---------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 6653e7e1d..3a3b3bb61 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -63,26 +63,19 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onGradientComboBoxCurrentIndexChanged) QtCore.QObject.connect(self.colorButton, - QtCore.SIGNAL(u'clicked()'), - self.onColorButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onColorButtonClicked) QtCore.QObject.connect(self.gradientStartButton, - QtCore.SIGNAL(u'clicked()'), - self.onGradientStartButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onGradientStartButtonClicked) QtCore.QObject.connect(self.gradientEndButton, - QtCore.SIGNAL(u'clicked()'), - self.onGradientEndButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onGradientEndButtonClicked) QtCore.QObject.connect(self.imageBrowseButton, - QtCore.SIGNAL(u'clicked()'), - self.onImageBrowseButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onImageBrowseButtonClicked) QtCore.QObject.connect(self.mainColorButton, - QtCore.SIGNAL(u'clicked()'), - self.onMainColorButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onMainColorButtonClicked) QtCore.QObject.connect(self.outlineColorButton, - QtCore.SIGNAL(u'clicked()'), - self.onOutlineColorButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onOutlineColorButtonClicked) QtCore.QObject.connect(self.shadowColorButton, - QtCore.SIGNAL(u'clicked()'), - self.onShadowColorButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onShadowColorButtonClicked) QtCore.QObject.connect(self.outlineCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckCheckBoxStateChanged) @@ -90,8 +83,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckCheckBoxStateChanged) QtCore.QObject.connect(self.footerColorButton, - QtCore.SIGNAL(u'clicked()'), - self.onFooterColorButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onFooterColorButtonClicked) QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onMainPositionCheckBoxStateChanged) @@ -99,26 +91,23 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): QtCore.SIGNAL(u'stateChanged(int)'), self.onFooterPositionCheckBoxStateChanged) QtCore.QObject.connect(self, - QtCore.SIGNAL(u'currentIdChanged(int)'), - self.onCurrentIdChanged) + QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'theme_line_count'), - self.updateLinesText) + QtCore.SIGNAL(u'theme_line_count'), self.updateLinesText) QtCore.QObject.connect(self.mainSizeSpinBox, - QtCore.SIGNAL(u'valueChanged(int)'), - self.calculateLines) + QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines) QtCore.QObject.connect(self.lineSpacingSpinBox, - QtCore.SIGNAL(u'valueChanged(int)'), - self.calculateLines) + QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines) QtCore.QObject.connect(self.outlineSizeSpinBox, - QtCore.SIGNAL(u'valueChanged(int)'), - self.calculateLines) + QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines) QtCore.QObject.connect(self.shadowSizeSpinBox, - QtCore.SIGNAL(u'valueChanged(int)'), - self.calculateLines) + QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines) QtCore.QObject.connect(self.mainFontComboBox, - QtCore.SIGNAL(u'activated(int)'), - self.calculateLines) + QtCore.SIGNAL(u'activated(int)'), self.calculateLines) + QtCore.QObject.connect(self.footerFontComboBox, + QtCore.SIGNAL(u'activated(int)'), self.updateTheme) + QtCore.QObject.connect(self.footerSizeSpinBox, + QtCore.SIGNAL(u'valueChanged(int)'), self.updateTheme) def setDefaults(self): """ @@ -389,7 +378,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): Handle the display and state of the Footer Area page. """ self.footerFontComboBox.setCurrentFont( - QtGui.QFont(self.theme.font_main_name)) + QtGui.QFont(self.theme.font_footer_name)) self.footerColorButton.setStyleSheet(u'background-color: %s' % self.theme.font_footer_color) self.setField(u'footerSizeSpinBox', From de616b9d1a35358b12af6d77af528d3d29b30372 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 11 Apr 2011 16:17:43 +0200 Subject: [PATCH 07/13] fixed OpenOffice import being available even if OpenOffice is not installed --- openlp/plugins/songs/lib/oooimport.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index c9c05907e..2ab66820c 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -39,12 +39,8 @@ if os.name == u'nt': PAGE_AFTER = 5 PAGE_BOTH = 6 else: - try: - import uno - from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, \ - PAGE_BOTH - except ImportError: - pass + import uno + from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH class OooImport(SongImport): """ From 073d6c8403aa7c21cfe5a8ad0a8733d11c401100 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 11 Apr 2011 16:34:14 +0200 Subject: [PATCH 08/13] disable 'next button' if importer is not available --- openlp/plugins/songs/forms/songimportform.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 6d20c8f41..468d2f341 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -66,7 +66,17 @@ class SongImportForm(OpenLPWizard): self.formatStack.setCurrentIndex(0) QtCore.QObject.connect(self.formatComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), - self.formatStack.setCurrentIndex) + self.onCurrentIndexChanged) + + def onCurrentIndexChanged(self, index): + """ + Called when the format combo box's index changed. We have to check if + the import is available and accordingly to disable or enable the next + button. + """ + self.formatStack.setCurrentIndex(index) + next_button = self.button(QtGui.QWizard.NextButton) + next_button.setEnabled(SongFormat.get_availability(index)) def customInit(self): """ From 53660fe23fa47dc59800c4d838561856574234a4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 11 Apr 2011 17:01:42 +0200 Subject: [PATCH 09/13] enable/disable next button if bible importer is not available --- openlp/plugins/bibles/forms/bibleimportform.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 117ffaf4c..35cd17c4b 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -85,8 +85,18 @@ class BibleImportForm(OpenLPWizard): """ OpenLPWizard.setupUi(self, image) QtCore.QObject.connect(self.formatComboBox, - QtCore.SIGNAL(u'currentIndexChanged(int)'), self.selectStack, - QtCore.SLOT(u'setCurrentIndex(int)')) + QtCore.SIGNAL(u'currentIndexChanged(int)'), + self.onCurrentIndexChanged) + + def onCurrentIndexChanged(self, index): + """ + Called when the format combo box's index changed. We have to check if + the import is available and accordingly to disable or enable the next + button. + """ + self.selectStack.setCurrentIndex(index) + next_button = self.button(QtGui.QWizard.NextButton) + next_button.setEnabled(BibleFormat.get_availability(index)) def customInit(self): """ From ad16ba8ef189915b7193222b6d1e026b6cf7e6dc Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 11 Apr 2011 18:49:14 +0100 Subject: [PATCH 10/13] Fix missing value --- openlp/plugins/bibles/lib/mediaitem.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 73ed0c9bd..1630ea62f 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -326,7 +326,8 @@ class BibleMediaItem(MediaManagerItem): self.settingsSection + u'/advanced bible', QtCore.QVariant(u'')).toString() find_and_set_in_combo_box(self.advancedVersionComboBox, book) - self.initialiseAdvancedBible(unicode(book)) + if book != u'': + self.initialiseAdvancedBible(unicode(book)) def reloadBibles(self): log.debug(u'Reloading Bibles') @@ -840,4 +841,4 @@ class BibleMediaItem(MediaManagerItem): self.settings.layout_style) QtCore.QSettings().setValue( self.settingsSection + u'/verse layout style', - QtCore.QVariant(self.settings.layout_style)) \ No newline at end of file + QtCore.QVariant(self.settings.layout_style)) From 1f91c4c82d3343a52a61c5aac489e20fa95138d2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 11 Apr 2011 19:02:24 +0100 Subject: [PATCH 11/13] if book --- openlp/plugins/bibles/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 1630ea62f..eac3eaeae 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -326,7 +326,7 @@ class BibleMediaItem(MediaManagerItem): self.settingsSection + u'/advanced bible', QtCore.QVariant(u'')).toString() find_and_set_in_combo_box(self.advancedVersionComboBox, book) - if book != u'': + if book: self.initialiseAdvancedBible(unicode(book)) def reloadBibles(self): From 7ba5497764eca875d779987a7f6be0f2edea3481 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 11 Apr 2011 19:15:02 +0100 Subject: [PATCH 12/13] Improved version --- openlp/plugins/bibles/lib/mediaitem.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index eac3eaeae..d6ffbc898 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -322,11 +322,11 @@ class BibleMediaItem(MediaManagerItem): self.advancedVersionComboBox.addItem(bible) self.advancedSecondComboBox.addItem(bible) # set the default value - book = QtCore.QSettings().value( + bible = QtCore.QSettings().value( self.settingsSection + u'/advanced bible', QtCore.QVariant(u'')).toString() - find_and_set_in_combo_box(self.advancedVersionComboBox, book) - if book: + if bible in bibles: + find_and_set_in_combo_box(self.advancedVersionComboBox, bible) self.initialiseAdvancedBible(unicode(book)) def reloadBibles(self): From 427c2a18434834e48500b0d35502af6f71209fe0 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 11 Apr 2011 19:27:01 +0100 Subject: [PATCH 13/13] oops --- openlp/plugins/bibles/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index d6ffbc898..b0d4c8bca 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -327,7 +327,7 @@ class BibleMediaItem(MediaManagerItem): QtCore.QVariant(u'')).toString() if bible in bibles: find_and_set_in_combo_box(self.advancedVersionComboBox, bible) - self.initialiseAdvancedBible(unicode(book)) + self.initialiseAdvancedBible(unicode(bible)) def reloadBibles(self): log.debug(u'Reloading Bibles')