openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #16644
[Merge] lp:~googol/openlp/trivial into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/trivial into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol/openlp/trivial/+merge/114698
NOTE: To be reviewed after the 1.9.11 release.
- removed not needed 'QtCore.Qt.OtherFocusReason' from setFocus calls
- fixed 'short' lines
- changed addItem to addItems when possible
- other clean ups
--
https://code.launchpad.net/~googol/openlp/trivial/+merge/114698
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/trivial into lp:openlp.
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2012-06-22 14:14:53 +0000
+++ openlp/core/lib/ui.py 2012-07-12 18:45:28 +0000
@@ -464,9 +464,8 @@
label = QtGui.QLabel(parent)
label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
combo_box = QtGui.QComboBox(parent)
- combo_box.addItem(UiStrings().Top)
- combo_box.addItem(UiStrings().Middle)
- combo_box.addItem(UiStrings().Bottom)
+ combo_box.addItems(
+ [UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
label.setBuddy(combo_box)
return label, combo_box
@@ -481,8 +480,7 @@
``value_to_find``
The value to find
"""
- index = combo_box.findText(value_to_find,
- QtCore.Qt.MatchExactly)
+ index = combo_box.findText(value_to_find, QtCore.Qt.MatchExactly)
if index == -1:
# Not Found.
index = 0
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2012-06-22 14:14:53 +0000
+++ openlp/core/ui/advancedtab.py 2012-07-12 18:45:28 +0000
@@ -102,28 +102,22 @@
u'expandServiceItemCheckBox')
self.uiLayout.addRow(self.expandServiceItemCheckBox)
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
- self.enableAutoCloseCheckBox.setObjectName(
- u'enableAutoCloseCheckBox')
+ self.enableAutoCloseCheckBox.setObjectName(u'enableAutoCloseCheckBox')
self.uiLayout.addRow(self.enableAutoCloseCheckBox)
self.leftLayout.addWidget(self.uiGroupBox)
# Default service name
self.serviceNameGroupBox = QtGui.QGroupBox(self.leftColumn)
self.serviceNameGroupBox.setObjectName(u'serviceNameGroupBox')
- self.serviceNameLayout = QtGui.QFormLayout(
- self.serviceNameGroupBox)
- self.serviceNameCheckBox = QtGui.QCheckBox(
- self.serviceNameGroupBox)
+ self.serviceNameLayout = QtGui.QFormLayout(self.serviceNameGroupBox)
+ self.serviceNameCheckBox = QtGui.QCheckBox(self.serviceNameGroupBox)
self.serviceNameCheckBox.setObjectName(u'serviceNameCheckBox')
self.serviceNameLayout.setObjectName(u'serviceNameLayout')
self.serviceNameLayout.addRow(self.serviceNameCheckBox)
self.serviceNameTimeLabel = QtGui.QLabel(self.serviceNameGroupBox)
self.serviceNameTimeLabel.setObjectName(u'serviceNameTimeLabel')
- self.serviceNameDay = QtGui.QComboBox(
- self.serviceNameGroupBox)
- self.serviceNameDay.addItems(
- [u'', u'', u'', u'', u'', u'', u'', u''])
- self.serviceNameDay.setObjectName(
- u'serviceNameDay')
+ self.serviceNameDay = QtGui.QComboBox(self.serviceNameGroupBox)
+ self.serviceNameDay.addItems([u'', u'', u'', u'', u'', u'', u'', u''])
+ self.serviceNameDay.setObjectName(u'serviceNameDay')
self.serviceNameTime = QtGui.QTimeEdit(self.serviceNameGroupBox)
self.serviceNameTime.setObjectName(u'serviceNameTime')
self.serviceNameTimeHBox = QtGui.QHBoxLayout()
@@ -150,8 +144,7 @@
self.serviceNameHBox.addWidget(self.serviceNameRevertButton)
self.serviceNameLayout.addRow(self.serviceNameLabel,
self.serviceNameHBox)
- self.serviceNameExampleLabel = QtGui.QLabel(
- self.serviceNameGroupBox)
+ self.serviceNameExampleLabel = QtGui.QLabel(self.serviceNameGroupBox)
self.serviceNameExampleLabel.setObjectName(
u'serviceNameExampleLabel')
self.serviceNameExample = QtGui.QLabel(self.serviceNameGroupBox)
@@ -201,8 +194,7 @@
self.newDataDirectoryLabelHBox.setObjectName(
u'newDataDirectoryLabelHBox')
self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit)
- self.newDataDirectoryLabelHBox.addWidget(
- self.dataDirectoryBrowseButton)
+ self.newDataDirectoryLabelHBox.addWidget(self.dataDirectoryBrowseButton)
self.newDataDirectoryLabelHBox.addWidget(
self.dataDirectoryDefaultButton)
self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout()
@@ -339,8 +331,7 @@
Setup the interface translation strings.
"""
self.tabTitleVisible = UiStrings().Advanced
- self.uiGroupBox.setTitle(
- translate('OpenLP.AdvancedTab', 'UI Settings'))
+ self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
self.dataDirectoryGroupBox.setTitle(
translate('OpenLP.AdvancedTab', 'Data Location'))
self.recentLabel.setText(
@@ -432,8 +423,7 @@
translate('OpenLP.AdvancedTab',
'<strong>WARNING:</strong> New data directory location contains '
'OpenLP data files. These files WILL be replaced during a copy.'))
- self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab',
- 'X11'))
+ self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', 'X11'))
self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab',
'Bypass X11 Window Manager'))
# Slide Limits
@@ -498,8 +488,7 @@
self.defaultColor = settings.value(u'default color',
QtCore.QVariant(u'#ffffff')).toString()
self.defaultFileEdit.setText(settings.value(u'default image',
- QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
- .toString())
+ QtCore.QVariant(u':/graphics/openlp-splash-screen.png')).toString())
self.slide_limits = settings.value(
u'slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0]
if self.slide_limits == SlideLimits.End:
@@ -541,8 +530,7 @@
self.currentDataPath = AppLocation.get_data_path()
log.warning(u'User requested data path set to default %s'
% self.currentDataPath)
- self.dataDirectoryLabel.setText(os.path.abspath(
- self.currentDataPath))
+ self.dataDirectoryLabel.setText(os.path.abspath(self.currentDataPath))
self.defaultColorButton.setStyleSheet(
u'background-color: %s' % self.defaultColor)
@@ -652,8 +640,7 @@
file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(),
UiStrings().AllFiles)
filename = QtGui.QFileDialog.getOpenFileName(self,
- translate('OpenLP.AdvancedTab', 'Open File'), '',
- file_filters)
+ translate('OpenLP.AdvancedTab', 'Open File'), '', file_filters)
if filename:
self.defaultFileEdit.setText(filename)
self.defaultFileEdit.setFocus()
@@ -702,7 +689,8 @@
"""
new_data_path = AppLocation.get_directory(AppLocation.DataDir)
if self.currentDataPath.lower() != new_data_path.lower():
- # Make sure they want to change the data location back to the default.
+ # Make sure they want to change the data location back to the
+ # default.
answer = QtGui.QMessageBox.question(self,
translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
translate('OpenLP.AdvancedTab',
@@ -761,7 +749,7 @@
self.dataExists = False
self.dataDirectoryCopyCheckBox.setChecked(True)
self.newDataDirectoryHasFilesLabel.hide()
-
+
def onDataDirectoryCancelButtonClicked(self):
"""
Cancel the data directory location change
=== modified file 'openlp/core/ui/shortcutlistform.py'
--- openlp/core/ui/shortcutlistform.py 2012-06-22 14:14:53 +0000
+++ openlp/core/ui/shortcutlistform.py 2012-07-12 18:45:28 +0000
@@ -222,10 +222,10 @@
self.alternatePushButton.setChecked(column not in [0, 1])
if column in [0, 1]:
self.primaryPushButton.setText(u'')
- self.primaryPushButton.setFocus(QtCore.Qt.OtherFocusReason)
+ self.primaryPushButton.setFocus()
else:
self.alternatePushButton.setText(u'')
- self.alternatePushButton.setFocus(QtCore.Qt.OtherFocusReason)
+ self.alternatePushButton.setFocus()
def onCurrentItemChanged(self, item=None, previousItem=None):
"""
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2012-07-02 18:45:03 +0000
+++ openlp/core/ui/thememanager.py 2012-07-12 18:45:28 +0000
@@ -457,7 +457,7 @@
# Sort the themes by its name considering language specific characters.
# lower() is needed for windows!
files.sort(key=lambda file_name: unicode(file_name).lower(),
- cmp=locale.strcoll)
+ cmp=locale.strcoll)
# now process the file list of png files
for name in files:
# check to see file is in theme root directory
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2012-06-22 14:14:53 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2012-07-12 18:45:28 +0000
@@ -537,8 +537,7 @@
"""
self.bibleThemeComboBox.clear()
self.bibleThemeComboBox.addItem(u'')
- for theme in theme_list:
- self.bibleThemeComboBox.addItem(theme)
+ self.bibleThemeComboBox.addItems(theme_list)
find_and_set_in_combo_box(self.bibleThemeComboBox, self.bible_theme)
def getGreyTextPalette(self, greyed):
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2012-06-22 14:14:53 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2012-07-12 18:45:28 +0000
@@ -75,8 +75,7 @@
def loadThemes(self, themelist):
self.themeComboBox.clear()
self.themeComboBox.addItem(u'')
- for themename in themelist:
- self.themeComboBox.addItem(themename)
+ self.themeComboBox.addItems(themelist)
def loadCustom(self, id, preview=False):
"""
@@ -105,7 +104,7 @@
self.slideListView.addItem(slide[1])
theme = self.customSlide.theme_name
find_and_set_in_combo_box(self.themeComboBox, theme)
- self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
+ self.titleEdit.setFocus()
# If not preview hide the preview button.
self.previewButton.setVisible(preview)
@@ -127,11 +126,9 @@
sxml = CustomXMLBuilder()
sxml.new_document()
sxml.add_lyrics_to_song()
- count = 1
- for i in range(self.slideListView.count()):
- sxml.add_verse_to_lyrics(u'custom', unicode(count),
- unicode(self.slideListView.item(i).text()))
- count += 1
+ for count in range(self.slideListView.count()):
+ sxml.add_verse_to_lyrics(u'custom', unicode(count + 1),
+ unicode(self.slideListView.item(count).text()))
self.customSlide.title = unicode(self.titleEdit.text())
self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8')
self.customSlide.credits = unicode(self.creditEdit.text())
@@ -158,8 +155,7 @@
def onAddButtonClicked(self):
self.editSlideForm.setText(u'')
if self.editSlideForm.exec_():
- for slide in self.editSlideForm.getText():
- self.slideListView.addItem(slide)
+ self.slideListView.addItems(self.editSlideForm.getText())
def onEditButtonClicked(self):
self.editSlideForm.setText(self.slideListView.currentItem().text())
@@ -170,13 +166,13 @@
"""
Edits all slides.
"""
- slide_list = u''
+ slide_text = u''
for row in range(self.slideListView.count()):
item = self.slideListView.item(row)
- slide_list += item.text()
+ slide_text += item.text()
if row != self.slideListView.count() - 1:
- slide_list += u'\n[===]\n'
- self.editSlideForm.setText(slide_list)
+ slide_text += u'\n[===]\n'
+ self.editSlideForm.setText(slide_text)
if self.editSlideForm.exec_():
self.updateSlideList(self.editSlideForm.getText(), True)
@@ -200,21 +196,19 @@
"""
if edit_all:
self.slideListView.clear()
- for slide in slides:
- self.slideListView.addItem(slide)
+ self.slideListView.addItems(slides)
else:
old_slides = []
old_row = self.slideListView.currentRow()
# Create a list with all (old/unedited) slides.
- old_slides = [self.slideListView.item(row).text() for row in \
+ old_slides = [self.slideListView.item(row).text() for row in
range(self.slideListView.count())]
self.slideListView.clear()
old_slides.pop(old_row)
# Insert all slides to make the old_slides list complete.
for slide in slides:
old_slides.insert(old_row, slide)
- for slide in old_slides:
- self.slideListView.addItem(slide)
+ self.slideListView.addItems(old_slides)
self.slideListView.repaint()
def onDeleteButtonClicked(self):
@@ -241,14 +235,8 @@
self.deleteButton.setEnabled(True)
self.editButton.setEnabled(True)
# Decide if the up/down buttons should be enabled or not.
- if self.slideListView.count() - 1 == row:
- self.downButton.setEnabled(False)
- else:
- self.downButton.setEnabled(True)
- if row == 0:
- self.upButton.setEnabled(False)
- else:
- self.upButton.setEnabled(True)
+ self.downButton.setEnabled(self.slideListView.count() - 1 != row)
+ self.upButton.setEnabled(row != 0)
def _validate(self):
"""
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2012-07-07 14:54:14 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2012-07-12 18:45:28 +0000
@@ -202,7 +202,7 @@
self.authorsListView.clear()
self.topicsListView.clear()
self.audioListWidget.clear()
- self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
+ self.titleEdit.setFocus()
self.songBookNumberEdit.clear()
self.loadAuthors()
self.loadTopics()
@@ -325,7 +325,7 @@
media_file.setData(QtCore.Qt.UserRole,
QtCore.QVariant(media.file_name))
self.audioListWidget.addItem(media_file)
- self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
+ self.titleEdit.setFocus()
# Hide or show the preview button.
self.previewButton.setVisible(preview)
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py 2012-06-22 14:14:53 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2012-07-12 18:45:28 +0000
@@ -171,7 +171,7 @@
self.verseNumberBox.setValue(1)
self.insertButton.setVisible(True)
self.verseTextEdit.setPlainText(text)
- self.verseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
+ self.verseTextEdit.setFocus()
self.verseTextEdit.moveCursor(QtGui.QTextCursor.End)
def getVerse(self):
Follow ups