openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #02063
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
* Fix ampersands and add a couple more
* Refactor checkItemSelected -> check_item_selected so whole application can use function
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/28425
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2010-06-19 17:26:34 +0000
+++ openlp/core/lib/__init__.py 2010-06-24 15:56:29 +0000
@@ -159,6 +159,22 @@
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
return new_image
+def check_item_selected(list_widget, message):
+ """
+ Check if a list item is selected so an action may be performed on it
+
+ ``list_widget``
+ The list to check for selected items
+
+ ``message``
+ The message to give the user if no item is selected
+ """
+ if not list_widget.selectedIndexes():
+ QtGui.QMessageBox.information(self,
+ translate('MediaManagerItem', 'No Items Selected'), message)
+ return False
+ return True
+
class ThemeLevel(object):
"""
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2010-06-21 21:57:01 +0000
+++ openlp/core/lib/mediamanageritem.py 2010-06-24 15:56:29 +0000
@@ -343,19 +343,6 @@
"""
pass
- def checkItemSelected(self, message):
- """
- Check if a list item is selected so an action may be performed on it
-
- ``message``
- The message to give the user if no item is selected
- """
- if not self.ListView.selectedIndexes():
- QtGui.QMessageBox.information(self,
- translate('MediaManagerItem', 'No Items Selected'), message)
- return False
- return True
-
def onFileClick(self):
files = QtGui.QFileDialog.getOpenFileNames(
self, self.OnNewPrompt,
=== modified file 'openlp/core/ui/amendthemedialog.py'
--- openlp/core/ui/amendthemedialog.py 2010-06-18 23:18:08 +0000
+++ openlp/core/ui/amendthemedialog.py 2010-06-24 15:56:29 +0000
@@ -50,6 +50,7 @@
self.ThemeNameLayout.addWidget(self.ThemeNameLabel)
self.ThemeNameEdit = QtGui.QLineEdit(self.ThemeNameWidget)
self.ThemeNameEdit.setObjectName(u'ThemeNameEdit')
+ self.ThemeNameLabel.setBuddy(self.ThemeNameEdit)
self.ThemeNameLayout.addWidget(self.ThemeNameEdit)
self.AmendThemeLayout.addWidget(self.ThemeNameWidget)
self.ContentWidget = QtGui.QWidget(AmendThemeDialog)
@@ -72,6 +73,7 @@
self.BackgroundLabel)
self.BackgroundComboBox = QtGui.QComboBox(self.BackgroundTab)
self.BackgroundComboBox.setObjectName(u'BackgroundComboBox')
+ self.BackgroundLabel.setBuddy(self.BackgroundComboBox)
self.BackgroundComboBox.addItem(QtCore.QString())
self.BackgroundComboBox.addItem(QtCore.QString())
self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
@@ -752,9 +754,9 @@
AmendThemeDialog.setWindowTitle(
translate('AmendThemeForm', 'Theme Maintenance'))
self.ThemeNameLabel.setText(
- translate('AmendThemeForm', 'Theme Name:'))
+ translate('AmendThemeForm', 'Theme &Name:'))
self.BackgroundLabel.setText(
- translate('AmendThemeForm', 'Visibility:'))
+ translate('AmendThemeForm', '&Visibility:'))
self.BackgroundComboBox.setItemText(0,
translate('AmendThemeForm', 'Opaque'))
self.BackgroundComboBox.setItemText(1,
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2010-06-21 20:06:36 +0000
+++ openlp/core/ui/thememanager.py 2010-06-24 15:56:29 +0000
@@ -35,7 +35,7 @@
from openlp.core.theme import Theme
from openlp.core.lib import OpenLPToolbar, context_menu_action, \
ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
- context_menu_separator, SettingsManager, translate
+ context_menu_separator, SettingsManager, translate, check_item_selected
from openlp.core.utils import AppLocation, get_filesystem_encoding
log = logging.getLogger(__name__)
@@ -182,8 +182,9 @@
Loads the settings for the theme that is to be edited and launches the
theme editing form so the user can make their changes.
"""
- item = self.ThemeListWidget.currentItem()
- if item:
+ if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
+ 'You must select a theme to edit.')):
+ item = self.ThemeListWidget.currentItem()
theme = self.getThemeData(
unicode(item.data(QtCore.Qt.UserRole).toString()))
self.amendThemeForm.loadTheme(theme)
@@ -198,8 +199,9 @@
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
- item = self.ThemeListWidget.currentItem()
- if item:
+ if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
+ 'You must select a theme to delete.')):
+ item = self.ThemeListWidget.currentItem()
theme = unicode(item.text())
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
=== modified file 'openlp/plugins/custom/forms/editcustomdialog.py'
--- openlp/plugins/custom/forms/editcustomdialog.py 2010-06-19 03:43:10 +0000
+++ openlp/plugins/custom/forms/editcustomdialog.py 2010-06-24 15:56:29 +0000
@@ -43,6 +43,7 @@
self.TitleLabel.setObjectName(u'TitleLabel')
self.horizontalLayout.addWidget(self.TitleLabel)
self.TitleEdit = QtGui.QLineEdit(customEditDialog)
+ self.TitleLabel.setBuddy(self.TitleEdit)
self.TitleEdit.setObjectName(u'TitleEdit')
self.horizontalLayout.addWidget(self.TitleEdit)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
@@ -118,6 +119,7 @@
self.ThemeLabel.setObjectName(u'ThemeLabel')
self.horizontalLayout_3.addWidget(self.ThemeLabel)
self.ThemeComboBox = QtGui.QComboBox(customEditDialog)
+ self.ThemeLabel.setBuddy(self.ThemeComboBox)
self.ThemeComboBox.setObjectName(u'ThemeComboBox')
self.horizontalLayout_3.addWidget(self.ThemeComboBox)
self.gridLayout.addLayout(self.horizontalLayout_3, 3, 0, 1, 1)
@@ -127,6 +129,7 @@
self.CreditLabel.setObjectName(u'CreditLabel')
self.horizontalLayout_2.addWidget(self.CreditLabel)
self.CreditEdit = QtGui.QLineEdit(customEditDialog)
+ self.CreditLabel.setBuddy(self.CreditEdit)
self.CreditEdit.setObjectName(u'CreditEdit')
self.horizontalLayout_2.addWidget(self.CreditEdit)
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1)
@@ -162,7 +165,7 @@
self.DownButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Move slide down 1'))
self.TitleLabel.setText(
- translate('CustomPlugin.EditCustomForm', 'Title:'))
+ translate('CustomPlugin.EditCustomForm', '&Title:'))
self.AddButton.setText(
translate('CustomPlugin.EditCustomForm', 'Add New'))
self.AddButton.setToolTip(
@@ -192,7 +195,7 @@
self.SplitButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Add slide split'))
self.ThemeLabel.setText(
- translate('CustomPlugin.EditCustomForm', 'Theme:'))
+ translate('CustomPlugin.EditCustomForm', 'The&me:'))
self.CreditLabel.setText(
- translate('CustomPlugin.EditCustomForm', 'Credits:'))
+ translate('CustomPlugin.EditCustomForm', '&Credits:'))
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2010-06-21 18:28:36 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2010-06-24 15:56:29 +0000
@@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD, \
- Receiver, ItemCapabilities, translate
+ Receiver, ItemCapabilities, translate, check_item_selected
log = logging.getLogger(__name__)
@@ -118,7 +118,8 @@
"""
Edit a custom item
"""
- if self.checkItemSelected(translate('CustomPlugin.MediaItem',
+ if check_item_selected(self.ListView,
+ translate('CustomPlugin.MediaItem',
'You must select an item to edit.')):
item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
@@ -130,7 +131,8 @@
"""
Remove a custom item from the list and database
"""
- if self.checkItemSelected(translate('CustomPlugin.MediaItem',
+ if check_item_selected(self.ListView,
+ translate('CustomPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2010-06-19 18:38:17 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2010-06-24 15:56:29 +0000
@@ -29,7 +29,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
- context_menu_action, ItemCapabilities, SettingsManager, translate
+ context_menu_action, ItemCapabilities, SettingsManager, translate, \
+ check_item_selected
from openlp.core.utils import AppLocation, get_images_filter
log = logging.getLogger(__name__)
@@ -116,7 +117,7 @@
"""
Remove an image item from the list
"""
- if self.checkItemSelected(translate('ImagePlugin.MediaItem',
+ if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
'You must select an item to delete.')):
items = self.ListView.selectedIndexes()
for item in items:
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2010-06-19 13:18:38 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2010-06-24 15:56:29 +0000
@@ -29,7 +29,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
- ItemCapabilities, SettingsManager, translate
+ ItemCapabilities, SettingsManager, translate, check_item_selected
log = logging.getLogger(__name__)
@@ -141,7 +141,7 @@
"""
Remove a media item from the list
"""
- if self.checkItemSelected(translate('MediaPlugin.MediaItem',
+ if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
row = self.ListView.row(item)
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2010-06-21 18:28:36 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2010-06-24 15:56:29 +0000
@@ -29,7 +29,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
- SettingsManager, translate
+ SettingsManager, translate, check_item_selected
from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import MessageListener
@@ -177,7 +177,8 @@
"""
Remove a presentation item from the list
"""
- if self.checkItemSelected(translate('PresentationPlugin.MediaItem',
+ if check_item_selected(self.ListView,
+ translate('PresentationPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
row = self.ListView.row(item)
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2010-06-21 16:43:59 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2010-06-24 15:56:29 +0000
@@ -50,6 +50,7 @@
self.TitleLabel.setObjectName(u'TitleLabel')
self.LyricsTabLayout.addWidget(self.TitleLabel, 0, 0, 1, 1)
self.TitleEditItem = QtGui.QLineEdit(self.LyricsTab)
+ self.TitleLabel.setBuddy(self.TitleEditItem)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -63,6 +64,7 @@
self.AlternativeTitleLabel.setObjectName(u'AlternativeTitleLabel')
self.LyricsTabLayout.addWidget(self.AlternativeTitleLabel, 1, 0, 1, 1)
self.AlternativeEdit = QtGui.QLineEdit(self.LyricsTab)
+ self.AlternativeTitleLabel.setBuddy(self.AlternativeEdit)
self.AlternativeEdit.setObjectName(u'AlternativeEdit')
self.LyricsTabLayout.addWidget(self.AlternativeEdit, 1, 1, 1, 2)
self.LyricsLabel = QtGui.QLabel(self.LyricsTab)
@@ -71,6 +73,7 @@
self.LyricsLabel.setObjectName(u'LyricsLabel')
self.LyricsTabLayout.addWidget(self.LyricsLabel, 2, 0, 1, 1)
self.VerseListWidget = QtGui.QTableWidget(self.LyricsTab)
+ self.LyricsLabel.setBuddy(self.VerseListWidget)
self.VerseListWidget.setColumnCount(1)
self.VerseListWidget.horizontalHeader().setVisible(False)
self.VerseListWidget.setSelectionBehavior(1)
@@ -83,6 +86,7 @@
self.VerseOrderLabel.setObjectName(u'VerseOrderLabel')
self.LyricsTabLayout.addWidget(self.VerseOrderLabel, 4, 0, 1, 1)
self.VerseOrderEdit = QtGui.QLineEdit(self.LyricsTab)
+ self.VerseOrderLabel.setBuddy(self.VerseOrderEdit)
self.VerseOrderEdit.setObjectName(u'VerseOrderEdit')
self.LyricsTabLayout.addWidget(self.VerseOrderEdit, 4, 1, 1, 2)
self.VerseButtonWidget = QtGui.QWidget(self.LyricsTab)
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2010-06-21 18:28:36 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2010-06-24 15:56:29 +0000
@@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, \
- BaseListWithDnD, Receiver, ItemCapabilities, translate
+ BaseListWithDnD, Receiver, ItemCapabilities, translate, check_item_selected
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
ImportWizardForm
@@ -279,7 +279,7 @@
"""
Edit a song
"""
- if self.checkItemSelected(translate('SongsPlugin.MediaItem',
+ if check_item_selected(self.ListView, translate('SongsPlugin.MediaItem',
'You must select an item to edit.')):
item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
@@ -290,7 +290,7 @@
"""
Remove a song from the list and database
"""
- if self.checkItemSelected(translate('SongsPlugin.MediaItem',
+ if check_item_selected(self.ListView, translate('SongsPlugin.MediaItem',
'You must select an item to delete.')):
items = self.ListView.selectedIndexes()
if len(items) == 1:
Follow ups