This commit is contained in:
Jonathan Corwin 2010-06-24 20:43:06 +01:00
commit 84b7a4f4ad
21 changed files with 72 additions and 55 deletions

View File

@ -159,6 +159,22 @@ def resize_image(image, width, height):
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):
"""

View File

@ -343,19 +343,6 @@ class MediaManagerItem(QtGui.QWidget):
"""
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,

View File

@ -50,6 +50,7 @@ class Ui_AmendThemeDialog(object):
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 @@ class Ui_AmendThemeDialog(object):
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 @@ class Ui_AmendThemeDialog(object):
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,

View File

@ -655,6 +655,7 @@ class SlideController(QtGui.QWidget):
"""
Allow the main display to blank the main display at startup time
"""
log.debug(u'mainDisplaySetBackground')
if not self.mainDisplay.primary:
self.blankButton.setChecked(True)
@ -672,12 +673,12 @@ class SlideController(QtGui.QWidget):
def onBlankDisplay(self, checked):
"""
Handle the blank screen button
Handle the blank screen button actions
"""
log.debug(u'onBlankDisplay %d' % checked)
self.hideButton.setChecked(False)
self.themeButton.setChecked(False)
self.canDisplay = not checked
self.canDisplay = not checked
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(checked))
@ -722,6 +723,7 @@ class SlideController(QtGui.QWidget):
"""
Blank the display screen within a plugin if required.
"""
log.debug(u'blankPlugin %d ', blank)
if self.serviceItem is not None:
if blank:
Receiver.send_message(u'%s_blank'

View File

@ -35,7 +35,7 @@ from openlp.core.ui import AmendThemeForm
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 @@ class ThemeManager(QtGui.QWidget):
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 @@ class ThemeManager(QtGui.QWidget):
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()):

View File

@ -37,7 +37,7 @@ class alertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Alerts', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Alerts', u'1.9.2', plugin_helpers)
self.weight = -3
self.icon = build_icon(u':/media/media_image.png')
self.alertsmanager = AlertsManager(self)
@ -97,4 +97,4 @@ class alertsPlugin(Plugin):
about_text = translate('AlertsPlugin',
'<b>Alerts Plugin</b><br>This plugin '
'controls the displaying of alerts on the presentations screen')
return about_text
return about_text

View File

@ -36,7 +36,7 @@ class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Bibles', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Bibles', u'1.9.2', plugin_helpers)
self.weight = -9
self.icon = build_icon(u':/media/media_bible.png')
#Register the bible Manager
@ -99,4 +99,4 @@ class BiblePlugin(Plugin):
def can_delete_theme(self, theme):
if self.settings_tab.bible_theme == theme:
return False
return True
return True

View File

@ -43,7 +43,7 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Custom', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Custom', u'1.9.2', plugin_helpers)
self.weight = -5
self.custommanager = CustomManager()
self.edit_custom_form = EditCustomForm(self.custommanager)
@ -77,4 +77,4 @@ class CustomPlugin(Plugin):
def can_delete_theme(self, theme):
if len(self.custommanager.get_customs_for_theme(theme)) == 0:
return True
return False
return False

View File

@ -43,6 +43,7 @@ class Ui_customEditDialog(object):
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 @@ class Ui_customEditDialog(object):
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 @@ class Ui_customEditDialog(object):
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 @@ class Ui_customEditDialog(object):
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 @@ class Ui_customEditDialog(object):
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:'))

View File

@ -28,7 +28,7 @@ import logging
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 @@ class CustomMediaItem(MediaManagerItem):
"""
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 @@ class CustomMediaItem(MediaManagerItem):
"""
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]

View File

@ -34,7 +34,7 @@ class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Images', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Images', u'1.9.2', plugin_helpers)
self.weight = -7
self.icon = build_icon(u':/media/media_image.png')
self.status = PluginStatus.Active
@ -64,4 +64,4 @@ class ImagePlugin(Plugin):
'an image is selected any songs which are rendered will use the '
'selected image from the background instead of the one provied by '
'the theme.<br>')
return about_text
return about_text

View File

@ -29,7 +29,8 @@ import os
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 @@ class ImageMediaItem(MediaManagerItem):
"""
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:

View File

@ -29,7 +29,7 @@ import os
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 @@ class MediaMediaItem(MediaManagerItem):
"""
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)

View File

@ -36,7 +36,7 @@ class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Media', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Media', u'1.9.2', plugin_helpers)
self.weight = -6
self.icon = build_icon(u':/media/media_video.png')
# passed with drag and drop messages
@ -85,4 +85,3 @@ class MediaPlugin(Plugin):
'<b>Media Plugin</b><br>This plugin '
'allows the playing of audio and video media')
return about_text

View File

@ -29,7 +29,7 @@ import os
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 @@ class PresentationMediaItem(MediaManagerItem):
"""
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)

View File

@ -38,7 +38,7 @@ class PresentationPlugin(Plugin):
def __init__(self, plugin_helpers):
log.debug(u'Initialised')
self.controllers = {}
Plugin.__init__(self, u'Presentations', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Presentations', u'1.9.2', plugin_helpers)
self.weight = -8
self.icon = build_icon(u':/media/media_presentation.png')
self.status = PluginStatus.Active
@ -114,4 +114,3 @@ class PresentationPlugin(Plugin):
'programs. The choice of available presentation programs is '
'available to the user in a drop down box.')
return about_text

View File

@ -37,7 +37,7 @@ class RemotesPlugin(Plugin):
"""
remotes constructor
"""
Plugin.__init__(self, u'Remotes', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Remotes', u'1.9.2', plugin_helpers)
self.weight = -1
self.server = None
@ -74,4 +74,4 @@ class RemotesPlugin(Plugin):
'provides the ability to send messages to a running version of '
'openlp on a different computer via a web browser or other app<br>'
'The Primary use for this would be to send alerts from a creche')
return about_text
return about_text

View File

@ -50,6 +50,7 @@ class Ui_EditSongDialog(object):
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 @@ class Ui_EditSongDialog(object):
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 @@ class Ui_EditSongDialog(object):
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 @@ class Ui_EditSongDialog(object):
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)

View File

@ -28,7 +28,7 @@ import logging
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 @@ class SongMediaItem(MediaManagerItem):
"""
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 @@ class SongMediaItem(MediaManagerItem):
"""
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:

View File

@ -49,7 +49,7 @@ class SongsPlugin(Plugin):
"""
Create and set up the Songs plugin.
"""
Plugin.__init__(self, u'Songs', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
self.weight = -10
self.manager = SongManager()
self.icon = build_icon(u':/media/media_song.png')
@ -194,4 +194,3 @@ class SongsPlugin(Plugin):
if len(self.manager.get_songs_for_theme(theme)) == 0:
return True
return False

View File

@ -40,7 +40,7 @@ class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'SongUsage', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'SongUsage', u'1.9.2', plugin_helpers)
self.weight = -4
self.icon = build_icon(u':/media/media_image.png')
self.songusagemanager = None
@ -162,4 +162,4 @@ class SongUsagePlugin(Plugin):
'<b>SongUsage Plugin</b><br>This plugin '
'records the use of songs and when they have been used during '
'a live service')
return about_text
return about_text