Review fixes

This commit is contained in:
Tim Bentley 2011-04-10 19:54:26 +01:00
parent c8d2baff7c
commit 1882c5366d
7 changed files with 29 additions and 29 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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