This commit is contained in:
Tim Bentley 2011-02-11 17:19:56 +00:00
commit 4422d824bb
54 changed files with 291 additions and 438 deletions

View File

@ -6,18 +6,18 @@ Object Library
.. automodule:: openlp.core.lib .. automodule:: openlp.core.lib
:members: :members:
:mod:`BaseListWithDnD`
----------------------
.. autoclass:: openlp.core.lib.baselistwithdnd.BaseListWithDnD
:members:
:mod:`EventReceiver` :mod:`EventReceiver`
-------------------- --------------------
.. autoclass:: openlp.core.lib.eventreceiver.EventReceiver .. autoclass:: openlp.core.lib.eventreceiver.EventReceiver
:members: :members:
:mod:`ListWidgetWithDnD`
----------------------
.. autoclass:: openlp.core.lib.listwidgetwithdnd.ListWidgetWithDnD
:members:
:mod:`MediaManagerItem` :mod:`MediaManagerItem`
----------------------- -----------------------

View File

@ -319,6 +319,7 @@ def check_directory_exists(dir):
if not os.path.exists(dir): if not os.path.exists(dir):
os.makedirs(dir) os.makedirs(dir)
from listwidgetwithdnd import ListWidgetWithDnD
from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \ from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \
BackgroundType, HorizontalType, VerticalType BackgroundType, HorizontalType, VerticalType
from displaytags import DisplayTags from displaytags import DisplayTags
@ -339,4 +340,3 @@ from dockwidget import OpenLPDockWidget
from renderer import Renderer from renderer import Renderer
from rendermanager import RenderManager from rendermanager import RenderManager
from mediamanageritem import MediaManagerItem from mediamanageritem import MediaManagerItem
from baselistwithdnd import BaseListWithDnD

View File

@ -28,7 +28,8 @@ import logging
from PyQt4 import QtWebKit from PyQt4 import QtWebKit
from openlp.core.lib import BackgroundType, BackgroundGradientType from openlp.core.lib import BackgroundType, BackgroundGradientType, \
VerticalType
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -536,12 +537,7 @@ def build_lyrics_format_css(theme, width, height):
align = u'right' align = u'right'
else: else:
align = u'left' align = u'left'
if theme.display_vertical_align == 2: valign = VerticalType.to_string(theme.display_vertical_align)
valign = u'bottom'
elif theme.display_vertical_align == 1:
valign = u'middle'
else:
valign = u'top'
if theme.font_main_outline: if theme.font_main_outline:
left_margin = int(theme.font_main_outline_size) * 2 left_margin = int(theme.font_main_outline_size) * 2
else: else:
@ -634,13 +630,7 @@ def build_alert_css(alertTab, width):
""" """
if not alertTab: if not alertTab:
return u'' return u''
align = u'' align = VerticalType.to_string(alertTab.location)
if alertTab.location == 2:
align = u'bottom'
elif alertTab.location == 1:
align = u'middle'
else:
align = u'top'
alert = style % (width, align, alertTab.font_face, alertTab.font_size, alert = style % (width, align, alertTab.font_face, alertTab.font_size,
alertTab.font_color, alertTab.bg_color) alertTab.font_color, alertTab.bg_color)
return alert return alert

View File

@ -28,17 +28,17 @@ Extend QListWidget to handle drag and drop functionality
""" """
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
class BaseListWithDnD(QtGui.QListWidget): class ListWidgetWithDnD(QtGui.QListWidget):
""" """
Provide a list widget to store objects and handle drag and drop events Provide a list widget to store objects and handle drag and drop events
""" """
def __init__(self, parent=None): def __init__(self, parent=None, name=u''):
""" """
Initialise the list widget Initialise the list widget
""" """
QtGui.QListWidget.__init__(self, parent) QtGui.QListWidget.__init__(self, parent)
# this must be set by the class which is inheriting self.mimeDataText = name
assert(self.PluginName) assert(self.mimeDataText)
def mouseMoveEvent(self, event): def mouseMoveEvent(self, event):
""" """
@ -47,9 +47,10 @@ class BaseListWithDnD(QtGui.QListWidget):
just tell it what plugin to call just tell it what plugin to call
""" """
if event.buttons() != QtCore.Qt.LeftButton: if event.buttons() != QtCore.Qt.LeftButton:
event.ignore()
return return
drag = QtGui.QDrag(self) drag = QtGui.QDrag(self)
mimeData = QtCore.QMimeData() mimeData = QtCore.QMimeData()
drag.setMimeData(mimeData) drag.setMimeData(mimeData)
mimeData.setText(self.PluginName) mimeData.setText(self.mimeDataText)
drag.start(QtCore.Qt.CopyAction) drag.start(QtCore.Qt.CopyAction)

View File

@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import context_menu_action, context_menu_separator, \ from openlp.core.lib import context_menu_action, context_menu_separator, \
SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \ SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \
translate, Receiver translate, Receiver, ListWidgetWithDnD
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -73,11 +73,6 @@ class MediaManagerItem(QtGui.QWidget):
assumes that the new action is to load a file. If not, you assumes that the new action is to load a file. If not, you
need to override the ``OnNew`` method. need to override the ``OnNew`` method.
``self.ListViewWithDnD_class``
This must be a **class**, not an object, descended from
``openlp.core.lib.BaseListWithDnD`` that is not used in any
other part of OpenLP.
``self.PreviewFunction`` ``self.PreviewFunction``
This must be a method which returns a QImage to represent the This must be a method which returns a QImage to represent the
item (usually a preview). No scaling is required, that is item (usually a preview). No scaling is required, that is
@ -202,68 +197,50 @@ class MediaManagerItem(QtGui.QWidget):
""" """
Create buttons for the media item toolbar Create buttons for the media item toolbar
""" """
toolbar_actions = []
## Import Button ## ## Import Button ##
if self.hasImportIcon: if self.hasImportIcon:
import_string = self.plugin.getString(StringContent.Import) toolbar_actions.append([StringContent.Import,
self.addToolbarButton( u':/general/general_import.png', self.onImportClick])
import_string[u'title'],
import_string[u'tooltip'],
u':/general/general_import.png', self.onImportClick)
## Load Button ## ## Load Button ##
if self.hasFileIcon: if self.hasFileIcon:
load_string = self.plugin.getString(StringContent.Load) toolbar_actions.append([StringContent.Load,
self.addToolbarButton( u':/general/general_open.png', self.onFileClick])
load_string[u'title'],
load_string[u'tooltip'],
u':/general/general_open.png', self.onFileClick)
## New Button ## ## New Button ##
if self.hasNewIcon: if self.hasNewIcon:
new_string = self.plugin.getString(StringContent.New) toolbar_actions.append([StringContent.New,
self.addToolbarButton( u':/general/general_new.png', self.onNewClick])
new_string[u'title'],
new_string[u'tooltip'],
u':/general/general_new.png', self.onNewClick)
## Edit Button ## ## Edit Button ##
if self.hasEditIcon: if self.hasEditIcon:
edit_string = self.plugin.getString(StringContent.Edit) toolbar_actions.append([StringContent.Edit,
self.addToolbarButton( u':/general/general_edit.png', self.onEditClick])
edit_string[u'title'],
edit_string[u'tooltip'],
u':/general/general_edit.png', self.onEditClick)
## Delete Button ## ## Delete Button ##
if self.hasDeleteIcon: if self.hasDeleteIcon:
delete_string = self.plugin.getString(StringContent.Delete) toolbar_actions.append([StringContent.Delete,
self.addToolbarButton( u':/general/general_delete.png', self.onDeleteClick])
delete_string[u'title'],
delete_string[u'tooltip'],
u':/general/general_delete.png', self.onDeleteClick)
## Separator Line ## ## Separator Line ##
self.addToolbarSeparator() self.addToolbarSeparator()
## Preview ## ## Preview ##
preview_string = self.plugin.getString(StringContent.Preview) toolbar_actions.append([StringContent.Preview,
self.addToolbarButton( u':/general/general_preview.png', self.onPreviewClick])
preview_string[u'title'],
preview_string[u'tooltip'],
u':/general/general_preview.png', self.onPreviewClick)
## Live Button ## ## Live Button ##
live_string = self.plugin.getString(StringContent.Live) toolbar_actions.append([StringContent.Live,
self.addToolbarButton( u':/general/general_live.png', self.onLiveClick])
live_string[u'title'],
live_string[u'tooltip'],
u':/general/general_live.png', self.onLiveClick)
## Add to service Button ## ## Add to service Button ##
service_string = self.plugin.getString(StringContent.Service) toolbar_actions.append([StringContent.Service,
self.addToolbarButton( u':/general/general_add.png', self.onAddClick])
service_string[u'title'], for action in toolbar_actions:
service_string[u'tooltip'], self.addToolbarButton(
u':/general/general_add.png', self.onAddClick) self.plugin.getString(action[0])[u'title'],
self.plugin.getString(action[0])[u'tooltip'],
action[1], action[2])
def addListViewToToolBar(self): def addListViewToToolBar(self):
""" """
Creates the main widget for listing items the media item is tracking Creates the main widget for listing items the media item is tracking
""" """
# Add the List widget # Add the List widget
self.listView = self.ListViewWithDnD_class(self) self.listView = ListWidgetWithDnD(self, self.title)
self.listView.uniformItemSizes = True self.listView.uniformItemSizes = True
self.listView.setSpacing(1) self.listView.setSpacing(1)
self.listView.setSelectionMode( self.listView.setSelectionMode(
@ -500,7 +477,7 @@ class MediaManagerItem(QtGui.QWidget):
""" """
if not self.listView.selectedIndexes() and not self.remoteTriggered: if not self.listView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('OpenLP.MediaManagerItem', 'No items selected'), translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select one or more items')) 'You must select one or more items'))
else: else:

View File

@ -114,7 +114,8 @@ class Plugin(QtCore.QObject):
""" """
log.info(u'loaded') log.info(u'loaded')
def __init__(self, name, version=None, pluginHelpers=None): def __init__(self, name, version=None, pluginHelpers=None,
mediaItemClass=None, settingsTabClass=None):
""" """
This is the constructor for the plugin object. This provides an easy This is the constructor for the plugin object. This provides an easy
way for descendent plugins to populate common data. This method *must* way for descendent plugins to populate common data. This method *must*
@ -132,6 +133,12 @@ class Plugin(QtCore.QObject):
``pluginHelpers`` ``pluginHelpers``
Defaults to *None*. A list of helper objects. Defaults to *None*. A list of helper objects.
``mediaItemClass``
The class name of the plugin's media item.
``settingsTabClass``
The class name of the plugin's settings tab.
""" """
QtCore.QObject.__init__(self) QtCore.QObject.__init__(self)
self.name = name self.name = name
@ -141,6 +148,8 @@ class Plugin(QtCore.QObject):
self.version = version self.version = version
self.settingsSection = self.name.lower() self.settingsSection = self.name.lower()
self.icon = None self.icon = None
self.mediaItemClass = mediaItemClass
self.settingsTabClass = settingsTabClass
self.weight = 0 self.weight = 0
self.status = PluginStatus.Inactive self.status = PluginStatus.Inactive
# Set up logging # Set up logging
@ -199,7 +208,9 @@ class Plugin(QtCore.QObject):
Construct a MediaManagerItem object with all the buttons and things Construct a MediaManagerItem object with all the buttons and things
you need, and return it for integration into openlp.org. you need, and return it for integration into openlp.org.
""" """
pass if self.mediaItemClass:
return self.mediaItemClass(self, self, self.icon)
return None
def addImportMenuItem(self, importMenu): def addImportMenuItem(self, importMenu):
""" """
@ -230,9 +241,13 @@ class Plugin(QtCore.QObject):
def getSettingsTab(self): def getSettingsTab(self):
""" """
Create a tab for the settings window. Create a tab for the settings window to display the configurable
options for this plugin to the user.
""" """
pass if self.settingsTabClass:
return self.settingsTabClass(self.name,
self.getString(StringContent.VisibleName)[u'title'])
return None
def addToMenu(self, menubar): def addToMenu(self, menubar):
""" """

View File

@ -68,7 +68,6 @@ class RenderManager(object):
self.theme_level = u'' self.theme_level = u''
self.override_background = None self.override_background = None
self.theme_data = None self.theme_data = None
self.alertTab = None
self.force_page = False self.force_page = False
def update_display(self): def update_display(self):

View File

@ -164,6 +164,7 @@ class BackgroundGradientType(object):
elif type_string == u'leftBottom': elif type_string == u'leftBottom':
return BackgroundGradientType.LeftBottom return BackgroundGradientType.LeftBottom
class HorizontalType(object): class HorizontalType(object):
""" """
Type enumeration for horizontal alignment. Type enumeration for horizontal alignment.
@ -172,6 +173,19 @@ class HorizontalType(object):
Center = 1 Center = 1
Right = 2 Right = 2
@staticmethod
def to_string(horizontal_type):
"""
Return a string representation of a horizontal type.
"""
if horizontal_type == Horizontal.Right:
return u'right'
elif horizontal_type == Horizontal.Center:
return u'center'
else:
return u'left'
class VerticalType(object): class VerticalType(object):
""" """
Type enumeration for vertical alignment. Type enumeration for vertical alignment.
@ -180,6 +194,19 @@ class VerticalType(object):
Middle = 1 Middle = 1
Bottom = 2 Bottom = 2
@staticmethod
def to_string(vertical_type):
"""
Return a string representation of a vertical type.
"""
if vertical_type == VerticalType.Bottom:
return u'bottom'
elif vertical_type == VerticalType.Middle:
return u'middle'
else:
return u'top'
BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow', BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
u'slide_transition'] u'slide_transition']

View File

@ -41,16 +41,18 @@ class UiStrings(object):
# These strings should need a good reason to be retranslated elsewhere. # These strings should need a good reason to be retranslated elsewhere.
# Should some/more/less of these have an & attached? # Should some/more/less of these have an & attached?
Add = translate('OpenLP.Ui', '&Add') Add = translate('OpenLP.Ui', '&Add')
AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s')) AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s.'))
AddSelectService = unicode(translate('OpenLP.Ui', AddSelectService = unicode(translate('OpenLP.Ui',
'Add the selected %s to the service')) 'Add the selected %s to the service.'))
Advanced = translate('OpenLP.Ui', 'Advanced')
AllFiles = translate('OpenLP.Ui', 'All Files') AllFiles = translate('OpenLP.Ui', 'All Files')
Authors = translate('OpenLP.Ui', 'Authors') Authors = translate('OpenLP.Ui', 'Authors')
CreateANew = unicode(translate('OpenLP.Ui', 'Create a new %s.'))
Delete = translate('OpenLP.Ui', '&Delete') Delete = translate('OpenLP.Ui', '&Delete')
DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s')) DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s.'))
DeleteType = unicode(translate('OpenLP.Ui', 'Delete %s')) DeleteType = unicode(translate('OpenLP.Ui', 'Delete %s'))
Edit = translate('OpenLP.Ui', '&Edit') Edit = translate('OpenLP.Ui', '&Edit')
EditSelect = unicode(translate('OpenLP.Ui', 'Edit the selected %s')) EditSelect = unicode(translate('OpenLP.Ui', 'Edit the selected %s.'))
EditType = unicode(translate('OpenLP.Ui', 'Edit %s')) EditType = unicode(translate('OpenLP.Ui', 'Edit %s'))
Error = translate('OpenLP.Ui', 'Error') Error = translate('OpenLP.Ui', 'Error')
ExportType = unicode(translate('OpenLP.Ui', 'Export %s')) ExportType = unicode(translate('OpenLP.Ui', 'Export %s'))
@ -58,14 +60,20 @@ class UiStrings(object):
ImportType = unicode(translate('OpenLP.Ui', 'Import %s')) ImportType = unicode(translate('OpenLP.Ui', 'Import %s'))
Live = translate('OpenLP.Ui', 'Live') Live = translate('OpenLP.Ui', 'Live')
Load = translate('OpenLP.Ui', 'Load') Load = translate('OpenLP.Ui', 'Load')
LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s')) LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.'))
New = translate('OpenLP.Ui', 'New') New = translate('OpenLP.Ui', 'New')
NewType = unicode(translate('OpenLP.Ui', 'New %s')) NewType = unicode(translate('OpenLP.Ui', 'New %s'))
OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0') OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0')
OpenType = unicode(translate('OpenLP.Ui', 'Open %s'))
Preview = translate('OpenLP.Ui', 'Preview') Preview = translate('OpenLP.Ui', 'Preview')
PreviewSelect = unicode(translate('OpenLP.Ui', 'Preview the selected %s')) PreviewSelect = unicode(translate('OpenLP.Ui', 'Preview the selected %s.'))
ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background')
ResetBG = translate('OpenLP.Ui', 'Reset Background')
ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background')
SaveType = unicode(translate('OpenLP.Ui', 'Save %s'))
SendSelectLive = unicode(translate('OpenLP.Ui', SendSelectLive = unicode(translate('OpenLP.Ui',
'Send the selected %s live')) 'Send the selected %s live.'))
Service = translate('OpenLP.Ui', 'Service') Service = translate('OpenLP.Ui', 'Service')
Theme = translate('OpenLP.Ui', 'Theme') Theme = translate('OpenLP.Ui', 'Theme')
Themes = translate('OpenLP.Ui', 'Themes') Themes = translate('OpenLP.Ui', 'Themes')
@ -98,18 +106,25 @@ def add_welcome_page(parent, image):
parent.welcomeLayout.addStretch() parent.welcomeLayout.addStretch()
parent.addPage(parent.welcomePage) parent.addPage(parent.welcomePage)
def create_save_cancel_button_box(parent): def create_accept_reject_button_box(parent, okay=False):
""" """
Creates a standard dialog button box with save and cancel buttons. The Creates a standard dialog button box with two buttons. The buttons default
button box is connected to the parent's ``accept()`` and ``reject()`` to save and cancel but the ``okay`` parameter can be used to make the
buttons okay and cancel instead.
The button box is connected to the parent's ``accept()`` and ``reject()``
methods to handle the default ``accepted()`` and ``rejected()`` signals. methods to handle the default ``accepted()`` and ``rejected()`` signals.
``parent`` ``parent``
The parent object. This should be a ``QWidget`` descendant. The parent object. This should be a ``QWidget`` descendant.
``okay``
If true creates an okay/cancel combination instead of save/cancel.
""" """
button_box = QtGui.QDialogButtonBox(parent) button_box = QtGui.QDialogButtonBox(parent)
button_box.setStandardButtons( accept_button = QtGui.QDialogButtonBox.Save
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) if okay:
accept_button = QtGui.QDialogButtonBox.Ok
button_box.setStandardButtons(accept_button | QtGui.QDialogButtonBox.Cancel)
button_box.setObjectName(u'%sButtonBox' % parent) button_box.setObjectName(u'%sButtonBox' % parent)
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'),
parent.accept) parent.accept)

View File

@ -29,6 +29,7 @@ The :mod:`advancedtab` provides an advanced settings facility.
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate from openlp.core.lib import SettingsTab, translate
from openlp.core.lib.ui import UiStrings
class AdvancedTab(SettingsTab): class AdvancedTab(SettingsTab):
""" """
@ -112,7 +113,7 @@ class AdvancedTab(SettingsTab):
""" """
Setup the interface translation strings. Setup the interface translation strings.
""" """
self.tabTitleVisible = translate('OpenLP.AdvancedTab', 'Advanced') self.tabTitleVisible = UiStrings.Advanced
self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings')) self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
self.recentLabel.setText( self.recentLabel.setText(
translate('OpenLP.AdvancedTab', translate('OpenLP.AdvancedTab',

View File

@ -56,6 +56,7 @@ except ImportError:
from openlp.core.lib import translate, SettingsManager from openlp.core.lib import translate, SettingsManager
from openlp.core.lib.mailto import mailto from openlp.core.lib.mailto import mailto
from openlp.core.lib.ui import UiStrings
from exceptiondialog import Ui_ExceptionDialog from exceptiondialog import Ui_ExceptionDialog
@ -176,8 +177,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
self,translate('ImagePlugin.ExceptionDialog', self,translate('ImagePlugin.ExceptionDialog',
'Select Attachment'), 'Select Attachment'),
SettingsManager.get_last_dir(u'exceptions'), SettingsManager.get_last_dir(u'exceptions'),
u'%s (*.*) (*)' % u'%s (*.*) (*)' % UiStrings.AllFiles)
unicode(translate('ImagePlugin.MediaItem', 'All Files')))
log.info(u'New files(s) %s', unicode(files)) log.info(u'New files(s) %s', unicode(files))
if files: if files:
self.fileAttachment = unicode(files) self.fileAttachment = unicode(files)

View File

@ -27,30 +27,28 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_FileRenameDialog(object): class Ui_FileRenameDialog(object):
def setupUi(self, FileRenameDialog): def setupUi(self, fileRenameDialog):
FileRenameDialog.setObjectName(u'FileRenameDialog') fileRenameDialog.setObjectName(u'fileRenameDialog')
FileRenameDialog.resize(300, 10) fileRenameDialog.resize(300, 10)
self.dialogLayout = QtGui.QGridLayout(FileRenameDialog) self.dialogLayout = QtGui.QGridLayout(fileRenameDialog)
self.dialogLayout.setObjectName(u'dialogLayout') self.dialogLayout.setObjectName(u'dialogLayout')
self.fileNameLabel = QtGui.QLabel(FileRenameDialog) self.fileNameLabel = QtGui.QLabel(fileRenameDialog)
self.fileNameLabel.setObjectName(u'fileNameLabel') self.fileNameLabel.setObjectName(u'fileNameLabel')
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0) self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
self.fileNameEdit = QtGui.QLineEdit(FileRenameDialog) self.fileNameEdit = QtGui.QLineEdit(fileRenameDialog)
self.fileNameEdit.setValidator(QtGui.QRegExpValidator( self.fileNameEdit.setValidator(QtGui.QRegExpValidator(
QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self)) QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self))
self.fileNameEdit.setObjectName(u'fileNameEdit') self.fileNameEdit.setObjectName(u'fileNameEdit')
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1) self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog) self.buttonBox = create_accept_reject_button_box(fileRenameDialog, True)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(FileRenameDialog) self.retranslateUi(fileRenameDialog)
self.setMaximumHeight(self.sizeHint().height()) self.setMaximumHeight(self.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(FileRenameDialog) QtCore.QMetaObject.connectSlotsByName(fileRenameDialog)
def retranslateUi(self, FileRenameDialog): def retranslateUi(self, fileRenameDialog):
self.fileNameLabel.setText(translate('OpenLP.FileRenameForm', self.fileNameLabel.setText(translate('OpenLP.FileRenameForm',
'New File Name:')) 'New File Name:'))

View File

@ -24,7 +24,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtGui
from filerenamedialog import Ui_FileRenameDialog from filerenamedialog import Ui_FileRenameDialog
@ -37,10 +37,6 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
def __init__(self, parent): def __init__(self, parent):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
self.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
self.reject)
def exec_(self, copy=False): def exec_(self, copy=False):
""" """
@ -51,5 +47,5 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
'File Copy')) 'File Copy'))
else: else:
self.setWindowTitle(translate('OpenLP.FileRenameForm', self.setWindowTitle(translate('OpenLP.FileRenameForm',
'File Rename')) 'File Rename'))
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)

View File

@ -65,7 +65,6 @@ class MainDisplay(DisplayWidget):
self.parent = parent self.parent = parent
self.screens = screens self.screens = screens
self.isLive = live self.isLive = live
self.alertTab = None
self.hideMode = None self.hideMode = None
self.override = {} self.override = {}
mainIcon = build_icon(u':/icon/openlp-logo-16x16.png') mainIcon = build_icon(u':/icon/openlp-logo-16x16.png')

View File

@ -216,8 +216,8 @@ class Ui_MainWindow(object):
self.ToolsAddToolItem = icon_action(mainWindow, u'ToolsAddToolItem', self.ToolsAddToolItem = icon_action(mainWindow, u'ToolsAddToolItem',
u':/tools/tools_add.png') u':/tools/tools_add.png')
mainWindow.actionList.add_action(self.ToolsAddToolItem, u'Tools') mainWindow.actionList.add_action(self.ToolsAddToolItem, u'Tools')
self.ToolsOpenDataFolder = icon_action(mainWindow, u'ToolsOpenDataFolder', self.ToolsOpenDataFolder = icon_action(mainWindow,
u':/general/general_open.png') u'ToolsOpenDataFolder', u':/general/general_open.png')
mainWindow.actionList.add_action(self.ToolsOpenDataFolder, u'Tools') mainWindow.actionList.add_action(self.ToolsOpenDataFolder, u'Tools')
self.settingsPluginListItem = icon_action(mainWindow, self.settingsPluginListItem = icon_action(mainWindow,
u'settingsPluginListItem', u':/system/settings_plugin_list.png') u'settingsPluginListItem', u':/system/settings_plugin_list.png')
@ -319,20 +319,17 @@ class Ui_MainWindow(object):
self.themeManagerDock.setWindowTitle( self.themeManagerDock.setWindowTitle(
translate('OpenLP.MainWindow', 'Theme Manager')) translate('OpenLP.MainWindow', 'Theme Manager'))
self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New')) self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New'))
self.FileNewItem.setToolTip( self.FileNewItem.setToolTip(UiStrings.NewType % UiStrings.Service)
translate('OpenLP.MainWindow', 'New Service'))
self.FileNewItem.setStatusTip( self.FileNewItem.setStatusTip(
translate('OpenLP.MainWindow', 'Create a new service.')) UiStrings.CreateANew % UiStrings.Service.toLower())
self.FileNewItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+N')) self.FileNewItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+N'))
self.FileOpenItem.setText(translate('OpenLP.MainWindow', '&Open')) self.FileOpenItem.setText(translate('OpenLP.MainWindow', '&Open'))
self.FileOpenItem.setToolTip( self.FileOpenItem.setToolTip(UiStrings.OpenType % UiStrings.Service)
translate('OpenLP.MainWindow', 'Open Service'))
self.FileOpenItem.setStatusTip( self.FileOpenItem.setStatusTip(
translate('OpenLP.MainWindow', 'Open an existing service.')) translate('OpenLP.MainWindow', 'Open an existing service.'))
self.FileOpenItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+O')) self.FileOpenItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+O'))
self.FileSaveItem.setText(translate('OpenLP.MainWindow', '&Save')) self.FileSaveItem.setText(translate('OpenLP.MainWindow', '&Save'))
self.FileSaveItem.setToolTip( self.FileSaveItem.setToolTip(UiStrings.SaveType % UiStrings.Service)
translate('OpenLP.MainWindow', 'Save Service'))
self.FileSaveItem.setStatusTip( self.FileSaveItem.setStatusTip(
translate('OpenLP.MainWindow', 'Save the current service to disk.')) translate('OpenLP.MainWindow', 'Save the current service to disk.'))
self.FileSaveItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+S')) self.FileSaveItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+S'))

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_save_cancel_button_box, \ from openlp.core.lib.ui import create_accept_reject_button_box, \
create_delete_push_button, create_up_down_push_button_set create_delete_push_button, create_up_down_push_button_set
class Ui_ServiceItemEditDialog(object): class Ui_ServiceItemEditDialog(object):
@ -50,7 +50,7 @@ class Ui_ServiceItemEditDialog(object):
self.buttonLayout.addWidget(self.downButton) self.buttonLayout.addWidget(self.downButton)
self.dialogLayout.addLayout(self.buttonLayout, 0, 1) self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
self.dialogLayout.addWidget( self.dialogLayout.addWidget(
create_save_cancel_button_box(serviceItemEditDialog), 1, 0, 1, 2) create_accept_reject_button_box(serviceItemEditDialog), 1, 0, 1, 2)
self.retranslateUi(serviceItemEditDialog) self.retranslateUi(serviceItemEditDialog)
QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog) QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog)

View File

@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \ Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
ThemeLevel ThemeLevel
from openlp.core.lib.ui import critical_error_message_box from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
from openlp.core.ui.printserviceorderform import PrintServiceOrderForm from openlp.core.ui.printserviceorderform import PrintServiceOrderForm
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
@ -95,17 +95,17 @@ class ServiceManager(QtGui.QWidget):
# Create the top toolbar # Create the top toolbar
self.toolbar = OpenLPToolbar(self) self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'New Service'), UiStrings.NewType % UiStrings.Service,
u':/general/general_new.png', u':/general/general_new.png',
translate('OpenLP.ServiceManager', 'Create a new service'), UiStrings.CreateANew % UiStrings.Service.toLower(),
self.onNewServiceClicked) self.onNewServiceClicked)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Open Service'), UiStrings.OpenType % UiStrings.Service,
u':/general/general_open.png', u':/general/general_open.png',
translate('OpenLP.ServiceManager', 'Load an existing service'), translate('OpenLP.ServiceManager', 'Load an existing service'),
self.onLoadServiceClicked) self.onLoadServiceClicked)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Save Service'), UiStrings.SaveType % UiStrings.Service,
u':/general/general_save.png', u':/general/general_save.png',
translate('OpenLP.ServiceManager', 'Save this service'), translate('OpenLP.ServiceManager', 'Save this service'),
self.saveFile) self.saveFile)
@ -465,7 +465,7 @@ class ServiceManager(QtGui.QWidget):
save the file. save the file.
""" """
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow,
translate('OpenLP.ServiceManager', 'Save Service'), UiStrings.SaveType % UiStrings.Service,
SettingsManager.get_last_dir( SettingsManager.get_last_dir(
self.mainwindow.serviceSettingsSection), self.mainwindow.serviceSettingsSection),
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))) translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)')))

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_save_cancel_button_box from openlp.core.lib.ui import create_accept_reject_button_box
class ServiceNoteForm(QtGui.QDialog): class ServiceNoteForm(QtGui.QDialog):
""" """
@ -48,7 +48,7 @@ class ServiceNoteForm(QtGui.QDialog):
self.textEdit = QtGui.QTextEdit(self) self.textEdit = QtGui.QTextEdit(self)
self.textEdit.setObjectName(u'textEdit') self.textEdit.setObjectName(u'textEdit')
self.dialogLayout.addWidget(self.textEdit) self.dialogLayout.addWidget(self.textEdit)
self.dialogLayout.addWidget(create_save_cancel_button_box(self)) self.dialogLayout.addWidget(create_accept_reject_button_box(self))
QtCore.QMetaObject.connectSlotsByName(self) QtCore.QMetaObject.connectSlotsByName(self)
def retranslateUi(self): def retranslateUi(self):

View File

@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon from openlp.core.lib import translate, build_icon
from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_SettingsDialog(object): class Ui_SettingsDialog(object):
def setupUi(self, settingsDialog): def setupUi(self, settingsDialog):
@ -40,16 +41,9 @@ class Ui_SettingsDialog(object):
self.settingsTabWidget = QtGui.QTabWidget(settingsDialog) self.settingsTabWidget = QtGui.QTabWidget(settingsDialog)
self.settingsTabWidget.setObjectName(u'settingsTabWidget') self.settingsTabWidget.setObjectName(u'settingsTabWidget')
self.settingsLayout.addWidget(self.settingsTabWidget) self.settingsLayout.addWidget(self.settingsTabWidget)
self.buttonBox = QtGui.QDialogButtonBox(settingsDialog) self.buttonBox = create_accept_reject_button_box(settingsDialog, True)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.settingsLayout.addWidget(self.buttonBox) self.settingsLayout.addWidget(self.buttonBox)
self.retranslateUi(settingsDialog) self.retranslateUi(settingsDialog)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), settingsDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), settingsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(settingsDialog) QtCore.QMetaObject.connectSlotsByName(settingsDialog)
def retranslateUi(self, settingsDialog): def retranslateUi(self, settingsDialog):

View File

@ -415,7 +415,6 @@ class SlideController(QtGui.QWidget):
# rebuild display as screen size changed # rebuild display as screen size changed
self.display = MainDisplay(self, self.screens, self.isLive) self.display = MainDisplay(self, self.screens, self.isLive)
self.display.imageManager = self.parent.renderManager.image_manager self.display.imageManager = self.parent.renderManager.image_manager
self.display.alertTab = self.alertTab
self.display.setup() self.display.setup()
if self.isLive: if self.isLive:
self.__addActionsToWidget(self.display) self.__addActionsToWidget(self.display)

View File

@ -34,7 +34,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \ from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
build_icon, Receiver, SettingsManager, translate, check_item_selected, \ build_icon, Receiver, SettingsManager, translate, check_item_selected, \
BackgroundType, BackgroundGradientType, check_directory_exists BackgroundType, BackgroundGradientType, check_directory_exists, \
VerticalType
from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.theme import Theme from openlp.core.theme import Theme
from openlp.core.ui import FileRenameForm, ThemeForm from openlp.core.ui import FileRenameForm, ThemeForm
@ -64,7 +65,7 @@ class ThemeManager(QtGui.QWidget):
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
UiStrings.NewType % UiStrings.Theme, UiStrings.NewType % UiStrings.Theme,
u':/themes/theme_new.png', u':/themes/theme_new.png',
translate('OpenLP.ThemeManager', 'Create a new theme.'), UiStrings.CreateANew % UiStrings.Theme.toLower(),
self.onAddTheme) self.onAddTheme)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
UiStrings.EditType % UiStrings.Theme, UiStrings.EditType % UiStrings.Theme,
@ -406,7 +407,7 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager', 'Select Theme Import File'), translate('OpenLP.ThemeManager', 'Select Theme Import File'),
SettingsManager.get_last_dir(self.settingsSection), SettingsManager.get_last_dir(self.settingsSection),
translate('OpenLP.ThemeManager', 'Theme v1 (*.theme);;' translate('OpenLP.ThemeManager', 'Theme v1 (*.theme);;'
'Theme v2 (*.otz);;All Files (*.*)')) 'Theme v2 (*.otz);;%s (*.*)') % UiStrings.AllFiles)
log.info(u'New Themes %s', unicode(files)) log.info(u'New Themes %s', unicode(files))
if files: if files:
for file in files: for file in files:
@ -762,11 +763,11 @@ class ThemeManager(QtGui.QWidget):
newtheme.font_main_outline = True newtheme.font_main_outline = True
newtheme.font_main_outline_color = \ newtheme.font_main_outline_color = \
unicode(theme.OutlineColor.name()) unicode(theme.OutlineColor.name())
vAlignCorrection = 0 vAlignCorrection = VerticalType.Top
if theme.VerticalAlign == 2: if theme.VerticalAlign == 2:
vAlignCorrection = 1 vAlignCorrection = VerticalType.Middle
elif theme.VerticalAlign == 1: elif theme.VerticalAlign == 1:
vAlignCorrection = 2 vAlignCorrection = VerticalType.Bottom
newtheme.display_horizontal_align = theme.HorizontalAlign newtheme.display_horizontal_align = theme.HorizontalAlign
newtheme.display_vertical_align = vAlignCorrection newtheme.display_vertical_align = vAlignCorrection
return newtheme.extract_xml() return newtheme.extract_xml()

View File

@ -27,11 +27,12 @@
The :mod:``wizard`` module provides generic wizard tools for OpenLP. The :mod:``wizard`` module provides generic wizard tools for OpenLP.
""" """
import logging import logging
import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, Receiver from openlp.core.lib import build_icon, Receiver, SettingsManager
from openlp.core.lib.ui import add_welcome_page from openlp.core.lib.ui import UiStrings, add_welcome_page
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -70,6 +71,12 @@ class OpenLPWizard(QtGui.QWizard):
self.retranslateUi() self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self) QtCore.QMetaObject.connectSlotsByName(self)
def registerFields(self):
"""
Hook method for wizards to register any fields they need.
"""
pass
def addProgressPage(self): def addProgressPage(self):
""" """
Add the progress page for the wizard. This page informs the user how Add the progress page for the wizard. This page informs the user how
@ -146,3 +153,30 @@ class OpenLPWizard(QtGui.QWizard):
self.finishButton.setVisible(True) self.finishButton.setVisible(True)
self.cancelButton.setVisible(False) self.cancelButton.setVisible(False)
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
def getFileName(self, title, editbox, filters=u''):
"""
Opens a QFileDialog and saves the filename to the given editbox.
``title``
The title of the dialog (unicode).
``editbox``
A editbox (QLineEdit).
``filters``
The file extension filters. It should contain the file description
as well as the file extension. For example::
u'OpenLP 2.0 Databases (*.sqlite)'
"""
if filters:
filters += u';;'
filters += u'%s (*)' % UiStrings.AllFiles
filename = QtGui.QFileDialog.getOpenFileName(self, title,
os.path.dirname(SettingsManager.get_last_dir(
self.plugin.settingsSection, 1)), filters)
if filename:
editbox.setText(filename)
SettingsManager.set_last_dir(self.plugin.settingsSection,
filename, 1)

View File

@ -40,21 +40,14 @@ class AlertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded') log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Alerts', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'Alerts', u'1.9.4', plugin_helpers,
settingsTabClass=AlertsTab)
self.weight = -3 self.weight = -3
self.icon = build_icon(u':/plugins/plugin_alerts.png') self.icon = build_icon(u':/plugins/plugin_alerts.png')
self.alertsmanager = AlertsManager(self) self.alertsmanager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema) self.manager = Manager(u'alerts', init_schema)
self.visible_name = self.getString(StringContent.VisibleName)
self.alertForm = AlertForm(self) self.alertForm = AlertForm(self)
def getSettingsTab(self):
"""
Return the settings tab for the Alerts plugin
"""
self.alertsTab = AlertsTab(self, self.visible_name[u'title'])
return self.alertsTab
def addToolsMenuItem(self, tools_menu): def addToolsMenuItem(self, tools_menu):
""" """
Give the alerts plugin the opportunity to add items to the Give the alerts plugin the opportunity to add items to the
@ -81,7 +74,7 @@ class AlertsPlugin(Plugin):
log.info(u'Alerts Initialising') log.info(u'Alerts Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.toolsAlertItem.setVisible(True) self.toolsAlertItem.setVisible(True)
self.liveController.alertTab = self.alertsTab self.liveController.alertTab = self.settings_tab
def finalise(self): def finalise(self):
""" """

View File

@ -84,7 +84,7 @@ class AlertsManager(QtCore.QObject):
if len(self.alertList) == 0: if len(self.alertList) == 0:
return return
text = self.alertList.pop(0) text = self.alertList.pop(0)
alertTab = self.parent.alertsTab alertTab = self.parent.settings_tab
self.parent.liveController.display.alert(text) self.parent.liveController.display.alert(text)
# Check to see if we have a timer running. # Check to see if we have a timer running.
if self.timer_id == 0: if self.timer_id == 0:

View File

@ -33,10 +33,8 @@ class AlertsTab(SettingsTab):
""" """
AlertsTab is the alerts settings tab in the settings dialog. AlertsTab is the alerts settings tab in the settings dialog.
""" """
def __init__(self, parent, visible_title): def __init__(self, name, visible_title):
self.parent = parent SettingsTab.__init__(self, name, visible_title)
self.manager = parent.manager
SettingsTab.__init__(self, parent.name, visible_title)
def setupUi(self): def setupUi(self):
self.setObjectName(u'AlertsTab') self.setObjectName(u'AlertsTab')

View File

@ -38,7 +38,8 @@ class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded') log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Bibles', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'Bibles', u'1.9.4', plugin_helpers,
BibleMediaItem, BiblesTab)
self.weight = -9 self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png' self.icon_path = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
@ -62,14 +63,6 @@ class BiblePlugin(Plugin):
self.importBibleItem.setVisible(False) self.importBibleItem.setVisible(False)
self.exportBibleItem.setVisible(False) self.exportBibleItem.setVisible(False)
def getSettingsTab(self):
visible_name = self.getString(StringContent.VisibleName)
return BiblesTab(self.name, visible_name[u'title'])
def getMediaManagerItem(self):
# Create the BibleManagerItem object.
return BibleMediaItem(self, self, self.icon)
def addImportMenuItem(self, import_menu): def addImportMenuItem(self, import_menu):
self.importBibleItem = QtGui.QAction(import_menu) self.importBibleItem = QtGui.QAction(import_menu)
self.importBibleItem.setObjectName(u'importBibleItem') self.importBibleItem.setObjectName(u'importBibleItem')

View File

@ -33,9 +33,9 @@ import os.path
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import delete_database from openlp.core.lib.db import delete_database
from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard from openlp.core.ui.wizard import OpenLPWizard
from openlp.core.utils import AppLocation, string_is_unicode from openlp.core.utils import AppLocation, string_is_unicode
from openlp.plugins.bibles.lib.manager import BibleFormat from openlp.plugins.bibles.lib.manager import BibleFormat
@ -727,33 +727,6 @@ class BibleImportForm(OpenLPWizard):
if books_file: if books_file:
books_file.close() books_file.close()
def getFileName(self, title, editbox, filters=u''):
"""
Opens a QFileDialog and saves the filename to the given editbox.
``title``
The title of the dialog (unicode).
``editbox``
A editbox (QLineEdit).
``filters``
The file extension filters. It should contain the file description
as well as the file extension. For example::
u'openlp.org 1.x bible (*.bible)'
"""
if filters:
filters += u';;'
filters += u'%s (*)' % UiStrings.AllFiles
filename = QtGui.QFileDialog.getOpenFileName(self, title,
os.path.dirname(SettingsManager.get_last_dir(
self.plugin.settingsSection, 1)), filters)
if filename:
editbox.setText(filename)
SettingsManager.set_last_dir(
self.plugin.settingsSection, filename, 1)
def preWizard(self): def preWizard(self):
""" """
Prepare the UI for the import. Prepare the UI for the import.

View File

@ -28,24 +28,15 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
ItemCapabilities, translate translate
from openlp.core.lib.ui import add_widget_completer, media_item_combo_box, \ from openlp.core.lib.ui import UiStrings, add_widget_completer, \
critical_error_message_box media_item_combo_box, critical_error_message_box
from openlp.plugins.bibles.forms import BibleImportForm from openlp.plugins.bibles.forms import BibleImportForm
from openlp.plugins.bibles.lib import get_reference_match from openlp.plugins.bibles.lib import get_reference_match
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class BibleListView(BaseListWithDnD):
"""
Custom list view descendant, required for drag and drop.
"""
def __init__(self, parent=None):
self.PluginName = u'Bibles'
BaseListWithDnD.__init__(self, parent)
class BibleMediaItem(MediaManagerItem): class BibleMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Bibles. This is the custom media manager item for Bibles.
@ -54,7 +45,6 @@ class BibleMediaItem(MediaManagerItem):
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.IconPath = u'songs/song' self.IconPath = u'songs/song'
self.ListViewWithDnD_class = BibleListView
MediaManagerItem.__init__(self, parent, plugin, icon) MediaManagerItem.__init__(self, parent, plugin, icon)
# Place to store the search results for both bibles. # Place to store the search results for both bibles.
self.search_results = {} self.search_results = {}
@ -192,8 +182,7 @@ class BibleMediaItem(MediaManagerItem):
self.advancedSearchButtonLayout.addWidget(self.advancedSearchButton) self.advancedSearchButtonLayout.addWidget(self.advancedSearchButton)
self.advancedLayout.addLayout( self.advancedLayout.addLayout(
self.advancedSearchButtonLayout, 7, 0, 1, 3) self.advancedSearchButtonLayout, 7, 0, 1, 3)
self.searchTabWidget.addTab(self.advancedTab, self.searchTabWidget.addTab(self.advancedTab, UiStrings.Advanced)
translate('BiblesPlugin.MediaItem', 'Advanced'))
# Add the search tab widget to the page layout. # Add the search tab widget to the page layout.
self.pageLayout.addWidget(self.searchTabWidget) self.pageLayout.addWidget(self.searchTabWidget)
# Combo Boxes # Combo Boxes

View File

@ -48,21 +48,14 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded') log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Custom', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'Custom', u'1.9.4', plugin_helpers,
CustomMediaItem, CustomTab)
self.weight = -5 self.weight = -5
self.manager = Manager(u'custom', init_schema) self.manager = Manager(u'custom', init_schema)
self.edit_custom_form = EditCustomForm(self.manager) self.edit_custom_form = EditCustomForm(self.manager)
self.icon_path = u':/plugins/plugin_custom.png' self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
def getSettingsTab(self):
visible_name = self.getString(StringContent.VisibleName)
return CustomTab(self.name, visible_name[u'title'])
def getMediaManagerItem(self):
# Create the ManagerItem object
return CustomMediaItem(self, self, self.icon)
def about(self): def about(self):
about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>' about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>'
'<br />The custom plugin provides the ability to set up custom ' '<br />The custom plugin provides the ability to set up custom '

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings, create_save_cancel_button_box, \ from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \
create_delete_push_button, create_up_down_push_button_set create_delete_push_button, create_up_down_push_button_set
class Ui_CustomEditDialog(object): class Ui_CustomEditDialog(object):
@ -94,7 +94,7 @@ class Ui_CustomEditDialog(object):
self.creditLabel.setBuddy(self.creditEdit) self.creditLabel.setBuddy(self.creditEdit)
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit) self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
self.dialogLayout.addLayout(self.bottomFormLayout) self.dialogLayout.addLayout(self.bottomFormLayout)
self.buttonBox = create_save_cancel_button_box(customEditDialog) self.buttonBox = create_accept_reject_button_box(customEditDialog)
self.previewButton = QtGui.QPushButton() self.previewButton = QtGui.QPushButton()
self.buttonBox.addButton( self.buttonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole) self.previewButton, QtGui.QDialogButtonBox.ActionRole)

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, SpellTextEdit from openlp.core.lib import translate, SpellTextEdit
from openlp.core.lib.ui import create_save_cancel_button_box from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_CustomSlideEditDialog(object): class Ui_CustomSlideEditDialog(object):
def setupUi(self, customSlideEditDialog): def setupUi(self, customSlideEditDialog):
@ -37,7 +37,7 @@ class Ui_CustomSlideEditDialog(object):
self.slideTextEdit = SpellTextEdit(self) self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setObjectName(u'slideTextEdit') self.slideTextEdit.setObjectName(u'slideTextEdit')
self.dialogLayout.addWidget(self.slideTextEdit) self.dialogLayout.addWidget(self.slideTextEdit)
self.buttonBox = create_save_cancel_button_box(customSlideEditDialog) self.buttonBox = create_accept_reject_button_box(customSlideEditDialog)
self.splitButton = QtGui.QPushButton(customSlideEditDialog) self.splitButton = QtGui.QPushButton(customSlideEditDialog)
self.splitButton.setObjectName(u'splitButton') self.splitButton.setObjectName(u'splitButton')
self.buttonBox.addButton(self.splitButton, self.buttonBox.addButton(self.splitButton,

View File

@ -28,18 +28,13 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, \ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
Receiver, ItemCapabilities, translate, check_item_selected translate, check_item_selected
from openlp.plugins.custom.lib import CustomXMLParser from openlp.plugins.custom.lib import CustomXMLParser
from openlp.plugins.custom.lib.db import CustomSlide from openlp.plugins.custom.lib.db import CustomSlide
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class CustomListView(BaseListWithDnD):
def __init__(self, parent=None):
self.PluginName = u'Custom'
BaseListWithDnD.__init__(self, parent)
class CustomMediaItem(MediaManagerItem): class CustomMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Custom Slides. This is the custom media manager item for Custom Slides.
@ -48,9 +43,6 @@ class CustomMediaItem(MediaManagerItem):
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.IconPath = u'custom/custom' self.IconPath = u'custom/custom'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = CustomListView
MediaManagerItem.__init__(self, parent, self, icon) MediaManagerItem.__init__(self, parent, self, icon)
self.singleServiceItem = False self.singleServiceItem = False
# Holds information about whether the edit is remotly triggered and # Holds information about whether the edit is remotly triggered and

View File

@ -27,7 +27,6 @@
import logging import logging
from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.ui import UiStrings
from openlp.plugins.images.lib import ImageMediaItem from openlp.plugins.images.lib import ImageMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -36,15 +35,12 @@ class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded') log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Images', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'Images', u'1.9.4', plugin_helpers,
ImageMediaItem)
self.weight = -7 self.weight = -7
self.icon_path = u':/plugins/plugin_images.png' self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
def getMediaManagerItem(self):
# Create the MediaManagerItem object.
return ImageMediaItem(self, self, self.icon)
def about(self): def about(self):
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>' about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
'<br />The image plugin provides displaying of images.<br />One ' '<br />The image plugin provides displaying of images.<br />One '

View File

@ -29,21 +29,14 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
ItemCapabilities, SettingsManager, translate, check_item_selected, \ SettingsManager, translate, check_item_selected, check_directory_exists, \
check_directory_exists, Receiver Receiver
from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.utils import AppLocation, delete_file, get_images_filter from openlp.core.utils import AppLocation, delete_file, get_images_filter
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
# We have to explicitly create separate classes for each plugin
# in order for DnD to the Service manager to work correctly.
class ImageListView(BaseListWithDnD):
def __init__(self, parent=None):
self.PluginName = u'Images'
BaseListWithDnD.__init__(self, parent)
class ImageMediaItem(MediaManagerItem): class ImageMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for images. This is the custom media manager item for images.
@ -52,9 +45,6 @@ class ImageMediaItem(MediaManagerItem):
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.IconPath = u'images/image' self.IconPath = u'images/image'
# This next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem.
self.ListViewWithDnD_class = ImageListView
MediaManagerItem.__init__(self, parent, self, icon) MediaManagerItem.__init__(self, parent, self, icon)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged) QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
@ -64,15 +54,11 @@ class ImageMediaItem(MediaManagerItem):
'Select Image(s)') 'Select Image(s)')
file_formats = get_images_filter() file_formats = get_images_filter()
self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats, self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
unicode(UiStrings.AllFiles)) UiStrings.AllFiles)
self.replaceAction.setText( self.replaceAction.setText(UiStrings.ReplaceBG)
translate('ImagePlugin.MediaItem', 'Replace Background')) self.replaceAction.setToolTip(UiStrings.ReplaceLiveBG)
self.replaceAction.setToolTip( self.resetAction.setText(UiStrings.ResetBG)
translate('ImagePlugin.MediaItem', 'Replace Live Background')) self.resetAction.setToolTip(UiStrings.ResetLiveBG)
self.resetAction.setText(
translate('ImagePlugin.MediaItem', 'Reset Background'))
self.resetAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Reset Live Background'))
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)

View File

@ -29,18 +29,12 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
ItemCapabilities, SettingsManager, translate, check_item_selected, Receiver SettingsManager, translate, check_item_selected, Receiver
from openlp.core.lib.ui import critical_error_message_box from openlp.core.lib.ui import UiStrings, critical_error_message_box
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class MediaListView(BaseListWithDnD):
def __init__(self, parent=None):
self.PluginName = u'Media'
BaseListWithDnD.__init__(self, parent)
class MediaMediaItem(MediaManagerItem): class MediaMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Media Slides. This is the custom media manager item for Media Slides.
@ -50,9 +44,6 @@ class MediaMediaItem(MediaManagerItem):
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.IconPath = u'images/image' self.IconPath = u'images/image'
self.background = False self.background = False
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = MediaListView
self.PreviewFunction = QtGui.QPixmap( self.PreviewFunction = QtGui.QPixmap(
u':/media/media_video.png').toImage() u':/media/media_video.png').toImage()
MediaManagerItem.__init__(self, parent, self, icon) MediaManagerItem.__init__(self, parent, self, icon)
@ -64,16 +55,12 @@ class MediaMediaItem(MediaManagerItem):
def retranslateUi(self): def retranslateUi(self):
self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media') self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem', self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
'Videos (%s);;Audio (%s);;All files (*)')) % \ 'Videos (%s);;Audio (%s);;%s (*)')) % (self.parent.video_list,
(self.parent.video_list, self.parent.audio_list) self.parent.audio_list, UiStrings.AllFiles)
self.replaceAction.setText( self.replaceAction.setText(UiStrings.ReplaceBG)
translate('MediaPlugin.MediaItem', 'Replace Background')) self.replaceAction.setToolTip(UiStrings.ReplaceLiveBG)
self.replaceAction.setToolTip( self.resetAction.setText(UiStrings.ResetBG)
translate('MediaPlugin.MediaItem', 'Replace Live Background')) self.resetAction.setToolTip(UiStrings.ResetLiveBG)
self.resetAction.setText(
translate('MediaPlugin.MediaItem', 'Reset Background'))
self.resetAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Reset Live Background'))
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)
@ -151,6 +138,7 @@ class MediaMediaItem(MediaManagerItem):
return False return False
def initialise(self): def initialise(self):
self.listView.clear()
self.listView.setIconSize(QtCore.QSize(88, 50)) self.listView.setIconSize(QtCore.QSize(88, 50))
self.loadList(SettingsManager.load_list(self.settingsSection, self.loadList(SettingsManager.load_list(self.settingsSection,
self.settingsSection)) self.settingsSection))

View File

@ -32,8 +32,8 @@ class MediaTab(SettingsTab):
""" """
MediaTab is the Media settings tab in the settings dialog. MediaTab is the Media settings tab in the settings dialog.
""" """
def __init__(self, title): def __init__(self, title, visible_title):
SettingsTab.__init__(self, title) SettingsTab.__init__(self, title, visible_title)
def setupUi(self): def setupUi(self):
self.setObjectName(u'MediaTab') self.setObjectName(u'MediaTab')
@ -53,9 +53,8 @@ class MediaTab(SettingsTab):
self.onUsePhononCheckBoxChanged) self.onUsePhononCheckBoxChanged)
def retranslateUi(self): def retranslateUi(self):
self.tabTitleVisible = translate('MediaPlugin.MediaTab', 'Media') self.mediaModeGroupBox.setTitle(
self.mediaModeGroupBox.setTitle(translate('MediaPlugin.MediaTab', translate('MediaPlugin.MediaTab', 'Media Display'))
'Media Display'))
self.usePhononCheckBox.setText( self.usePhononCheckBox.setText(
translate('MediaPlugin.MediaTab', 'Use Phonon for video playback')) translate('MediaPlugin.MediaTab', 'Use Phonon for video playback'))

View File

@ -30,7 +30,6 @@ import mimetypes
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.ui import UiStrings
from openlp.plugins.media.lib import MediaMediaItem, MediaTab from openlp.plugins.media.lib import MediaMediaItem, MediaTab
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -39,7 +38,8 @@ class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__) log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Media', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'Media', u'1.9.4', plugin_helpers,
MediaMediaItem, MediaTab)
self.weight = -6 self.weight = -6
self.icon_path = u':/plugins/plugin_media.png' self.icon_path = u':/plugins/plugin_media.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
@ -76,13 +76,6 @@ class MediaPlugin(Plugin):
mimetype = u'' mimetype = u''
return list, mimetype return list, mimetype
def getSettingsTab(self):
return MediaTab(self.name)
def getMediaManagerItem(self):
# Create the MediaManagerItem object.
return MediaMediaItem(self, self, self.icon)
def about(self): def about(self):
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>' about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
'<br />The media plugin provides playback of audio and video.') '<br />The media plugin provides playback of audio and video.')

View File

@ -145,7 +145,12 @@ class ImpressController(PresentationController):
log.debug(u'get COM Desktop OpenOffice') log.debug(u'get COM Desktop OpenOffice')
if not self.manager: if not self.manager:
return None return None
return self.manager.createInstance(u'com.sun.star.frame.Desktop') desktop = None
try:
desktop = self.manager.createInstance(u'com.sun.star.frame.Desktop')
except AttributeError:
log.exception(u'Failure to find desktop - Impress may have closed')
return desktop if desktop else None
def get_com_servicemanager(self): def get_com_servicemanager(self):
""" """
@ -166,13 +171,15 @@ class ImpressController(PresentationController):
log.debug(u'Kill OpenOffice') log.debug(u'Kill OpenOffice')
while self.docs: while self.docs:
self.docs[0].close_presentation() self.docs[0].close_presentation()
if os.name != u'nt': desktop = None
desktop = self.get_uno_desktop() try:
else: if os.name != u'nt':
desktop = self.get_com_desktop() desktop = self.get_uno_desktop()
#Sometimes we get a failure and desktop is None else:
if not desktop: desktop = self.get_com_desktop()
except:
log.exception(u'Failed to find an OpenOffice desktop to terminate') log.exception(u'Failed to find an OpenOffice desktop to terminate')
if not desktop:
return return
docs = desktop.getComponents() docs = desktop.getComponents()
if docs.hasElements(): if docs.hasElements():

View File

@ -29,24 +29,13 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
SettingsManager, translate, check_item_selected, Receiver, ItemCapabilities translate, check_item_selected, Receiver, ItemCapabilities
from openlp.core.lib.ui import critical_error_message_box, media_item_combo_box from openlp.core.lib.ui import critical_error_message_box, media_item_combo_box
from openlp.plugins.presentations.lib import MessageListener from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class PresentationListView(BaseListWithDnD):
"""
Class for the list of Presentations
We have to explicitly create separate classes for each plugin
in order for DnD to the Service manager to work correctly.
"""
def __init__(self, parent=None):
self.PluginName = u'Presentations'
BaseListWithDnD.__init__(self, parent)
class PresentationMediaItem(MediaManagerItem): class PresentationMediaItem(MediaManagerItem):
""" """
This is the Presentation media manager item for Presentation Items. This is the Presentation media manager item for Presentation Items.
@ -61,9 +50,6 @@ class PresentationMediaItem(MediaManagerItem):
self.controllers = controllers self.controllers = controllers
self.IconPath = u'presentations/presentation' self.IconPath = u'presentations/presentation'
self.Automatic = u'' self.Automatic = u''
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = PresentationListView
MediaManagerItem.__init__(self, parent, self, icon) MediaManagerItem.__init__(self, parent, self, icon)
self.message_listener = MessageListener(self) self.message_listener = MessageListener(self)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),

View File

@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, SettingsTab, translate from openlp.core.lib import Receiver, SettingsTab, translate
from openlp.core.lib.ui import UiStrings
class PresentationTab(SettingsTab): class PresentationTab(SettingsTab):
""" """
@ -85,9 +86,7 @@ class PresentationTab(SettingsTab):
checkbox.setText( checkbox.setText(
unicode(translate('PresentationPlugin.PresentationTab', unicode(translate('PresentationPlugin.PresentationTab',
'%s (unvailable)')) % controller.name) '%s (unvailable)')) % controller.name)
self.AdvancedGroupBox.setTitle( self.AdvancedGroupBox.setTitle(UiStrings.Advanced)
translate('PresentationPlugin.PresentationTab',
'Advanced'))
self.OverrideAppCheckBox.setText( self.OverrideAppCheckBox.setText(
translate('PresentationPlugin.PresentationTab', translate('PresentationPlugin.PresentationTab',
'Allow presentation application to be overriden')) 'Allow presentation application to be overriden'))

View File

@ -31,7 +31,6 @@ import os
import logging import logging
from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.ui import UiStrings
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import PresentationController, \ from openlp.plugins.presentations.lib import PresentationController, \
PresentationMediaItem, PresentationTab PresentationMediaItem, PresentationTab

View File

@ -38,7 +38,8 @@ class RemotesPlugin(Plugin):
""" """
remotes constructor remotes constructor
""" """
Plugin.__init__(self, u'Remotes', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'Remotes', u'1.9.4', plugin_helpers,
settingsTabClass=RemoteTab)
self.icon = build_icon(u':/plugins/plugin_remote.png') self.icon = build_icon(u':/plugins/plugin_remote.png')
self.weight = -1 self.weight = -1
self.server = None self.server = None
@ -61,13 +62,6 @@ class RemotesPlugin(Plugin):
if self.server: if self.server:
self.server.close() self.server.close()
def getSettingsTab(self):
"""
Create the settings Tab
"""
visible_name = self.getString(StringContent.VisibleName)
return RemoteTab(self.name, visible_name[u'title'])
def about(self): def about(self):
""" """
Information about this plugin Information about this plugin

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_save_cancel_button_box from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_AuthorsDialog(object): class Ui_AuthorsDialog(object):
def setupUi(self, authorsDialog): def setupUi(self, authorsDialog):
@ -57,7 +57,7 @@ class Ui_AuthorsDialog(object):
self.authorLayout.addRow(self.displayLabel, self.displayEdit) self.authorLayout.addRow(self.displayLabel, self.displayEdit)
self.dialogLayout.addLayout(self.authorLayout) self.dialogLayout.addLayout(self.authorLayout)
self.dialogLayout.addWidget( self.dialogLayout.addWidget(
create_save_cancel_button_box(authorsDialog)) create_accept_reject_button_box(authorsDialog))
self.retranslateUi(authorsDialog) self.retranslateUi(authorsDialog)
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height()) authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(authorsDialog) QtCore.QMetaObject.connectSlotsByName(authorsDialog)

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings, create_save_cancel_button_box from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
class Ui_EditSongDialog(object): class Ui_EditSongDialog(object):
def setupUi(self, editSongDialog): def setupUi(self, editSongDialog):
@ -241,7 +241,7 @@ class Ui_EditSongDialog(object):
self.themeTabLayout.addWidget(self.commentsGroupBox) self.themeTabLayout.addWidget(self.commentsGroupBox)
self.songTabWidget.addTab(self.themeTab, u'') self.songTabWidget.addTab(self.themeTab, u'')
self.dialogLayout.addWidget(self.songTabWidget) self.dialogLayout.addWidget(self.songTabWidget)
self.buttonBox = create_save_cancel_button_box(editSongDialog) self.buttonBox = create_accept_reject_button_box(editSongDialog)
self.dialogLayout.addWidget(self.buttonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(editSongDialog) self.retranslateUi(editSongDialog)
QtCore.QMetaObject.connectSlotsByName(editSongDialog) QtCore.QMetaObject.connectSlotsByName(editSongDialog)

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate, SpellTextEdit from openlp.core.lib import build_icon, translate, SpellTextEdit
from openlp.core.lib.ui import create_save_cancel_button_box from openlp.core.lib.ui import create_accept_reject_button_box
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
class Ui_EditVerseDialog(object): class Ui_EditVerseDialog(object):
@ -61,7 +61,7 @@ class Ui_EditVerseDialog(object):
self.verseTypeLayout.addStretch() self.verseTypeLayout.addStretch()
self.dialogLayout.addLayout(self.verseTypeLayout) self.dialogLayout.addLayout(self.verseTypeLayout)
self.dialogLayout.addWidget( self.dialogLayout.addWidget(
create_save_cancel_button_box(editVerseDialog)) create_accept_reject_button_box(editVerseDialog))
self.retranslateUi(editVerseDialog) self.retranslateUi(editVerseDialog)
QtCore.QMetaObject.connectSlotsByName(editVerseDialog) QtCore.QMetaObject.connectSlotsByName(editVerseDialog)

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_save_cancel_button_box from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_SongBookDialog(object): class Ui_SongBookDialog(object):
def setupUi(self, songBookDialog): def setupUi(self, songBookDialog):
@ -51,7 +51,7 @@ class Ui_SongBookDialog(object):
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit) self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
self.dialogLayout.addLayout(self.bookLayout) self.dialogLayout.addLayout(self.bookLayout)
self.dialogLayout.addWidget( self.dialogLayout.addWidget(
create_save_cancel_button_box(songBookDialog)) create_accept_reject_button_box(songBookDialog))
self.retranslateUi(songBookDialog) self.retranslateUi(songBookDialog)
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height()) songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(songBookDialog) QtCore.QMetaObject.connectSlotsByName(songBookDialog)

View File

@ -87,7 +87,8 @@ class SongExportForm(OpenLPWizard):
Song wizard specific signals. Song wizard specific signals.
""" """
QtCore.QObject.connect(self.availableListWidget, QtCore.QObject.connect(self.availableListWidget,
QtCore.SIGNAL(u'itemActivated(QListWidgetItem*)'), self.onItemPressed) QtCore.SIGNAL(u'itemActivated(QListWidgetItem*)'),
self.onItemPressed)
QtCore.QObject.connect(self.searchLineEdit, QtCore.QObject.connect(self.searchLineEdit,
QtCore.SIGNAL(u'textEdited(const QString&)'), QtCore.SIGNAL(u'textEdited(const QString&)'),
self.onSearchLineEditChanged) self.onSearchLineEditChanged)
@ -241,12 +242,6 @@ class SongExportForm(OpenLPWizard):
self.selectedListWidget.clear() self.selectedListWidget.clear()
return True return True
def registerFields(self):
"""
Register song export wizard fields.
"""
pass
def setDefaults(self): def setDefaults(self):
""" """
Set default form values for the song export wizard. Set default form values for the song export wizard.

View File

@ -442,34 +442,6 @@ class SongImportForm(OpenLPWizard):
elif self.currentPage() == self.progressPage: elif self.currentPage() == self.progressPage:
return True return True
def getFileName(self, title, editbox, filters=u''):
"""
Opens a QFileDialog and writes the filename to the given editbox.
``title``
The title of the dialog (unicode).
``editbox``
A editbox (QLineEdit).
``filters``
The file extension filters. It should contain the file descriptions
as well as the file extensions. For example::
u'OpenLP 2.0 Databases (*.sqlite)'
"""
if filters:
filters += u';;'
filters += u'%s (*)' % translate('SongsPlugin.ImportWizardForm',
'All Files')
filename = QtGui.QFileDialog.getOpenFileName(self, title,
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
filters)
if filename:
editbox.setText(filename)
SettingsManager.set_last_dir(self.plugin.settingsSection,
os.path.split(unicode(filename))[0], 1)
def getFiles(self, title, listbox, filters=u''): def getFiles(self, title, listbox, filters=u''):
""" """
Opens a QFileDialog and writes the filenames to the given listbox. Opens a QFileDialog and writes the filenames to the given listbox.
@ -672,12 +644,6 @@ class SongImportForm(OpenLPWizard):
""" """
self.removeSelectedItems(self.songBeamerFileListWidget) self.removeSelectedItems(self.songBeamerFileListWidget)
def registerFields(self):
"""
Register song import wizard fields.
"""
pass
def setDefaults(self): def setDefaults(self):
""" """
Set default form values for the song import wizard. Set default form values for the song import wizard.

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_save_cancel_button_box from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_TopicsDialog(object): class Ui_TopicsDialog(object):
def setupUi(self, topicsDialog): def setupUi(self, topicsDialog):
@ -45,7 +45,7 @@ class Ui_TopicsDialog(object):
self.nameLayout.addRow(self.nameLabel, self.nameEdit) self.nameLayout.addRow(self.nameLabel, self.nameEdit)
self.dialogLayout.addLayout(self.nameLayout) self.dialogLayout.addLayout(self.nameLayout)
self.dialogLayout.addWidget( self.dialogLayout.addWidget(
create_save_cancel_button_box(topicsDialog)) create_accept_reject_button_box(topicsDialog))
self.retranslateUi(topicsDialog) self.retranslateUi(topicsDialog)
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height()) topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(topicsDialog) QtCore.QMetaObject.connectSlotsByName(topicsDialog)

View File

@ -31,8 +31,8 @@ import re
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_ from sqlalchemy.sql import or_
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, Receiver, \ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
ItemCapabilities, translate, check_item_selected, PluginStatus translate, check_item_selected, PluginStatus
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \ from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
SongImportForm, SongExportForm SongImportForm, SongExportForm
@ -42,12 +42,6 @@ from openlp.core.lib.searchedit import SearchEdit
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class SongListView(BaseListWithDnD):
def __init__(self, parent=None):
self.PluginName = u'Songs'
BaseListWithDnD.__init__(self, parent)
class SongMediaItem(MediaManagerItem): class SongMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Songs. This is the custom media manager item for Songs.
@ -56,7 +50,6 @@ class SongMediaItem(MediaManagerItem):
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.IconPath = u'songs/song' self.IconPath = u'songs/song'
self.ListViewWithDnD_class = SongListView
MediaManagerItem.__init__(self, parent, self, icon) MediaManagerItem.__init__(self, parent, self, icon)
self.edit_song_form = EditSongForm(self, self.parent.manager) self.edit_song_form = EditSongForm(self, self.parent.manager)
self.openLyrics = OpenLyrics(self.parent.manager) self.openLyrics = OpenLyrics(self.parent.manager)

View File

@ -263,7 +263,8 @@ class OpenLyrics(object):
songbooks = etree.SubElement(properties, u'songbooks') songbooks = etree.SubElement(properties, u'songbooks')
element = self._add_text_to_element( element = self._add_text_to_element(
u'songbook', songbooks, None, book) u'songbook', songbooks, None, book)
element.set(u'entry', song.song_number) if song.song_number:
element.set(u'entry', song.song_number)
if song.topics: if song.topics:
themes = etree.SubElement(properties, u'themes') themes = etree.SubElement(properties, u'themes')
for topic in song.topics: for topic in song.topics:

View File

@ -31,7 +31,6 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.core.lib.ui import UiStrings
from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML
from openlp.plugins.songs.lib.db import init_schema, Song from openlp.plugins.songs.lib.db import init_schema, Song
from openlp.plugins.songs.lib.importer import SongFormat from openlp.plugins.songs.lib.importer import SongFormat
@ -52,17 +51,14 @@ class SongsPlugin(Plugin):
""" """
Create and set up the Songs plugin. Create and set up the Songs plugin.
""" """
Plugin.__init__(self, u'Songs', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'Songs', u'1.9.4', plugin_helpers,
SongMediaItem, SongsTab)
self.weight = -10 self.weight = -10
self.manager = Manager(u'songs', init_schema) self.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png' self.icon_path = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.whitespace = re.compile(r'\W+', re.UNICODE) self.whitespace = re.compile(r'\W+', re.UNICODE)
def getSettingsTab(self):
visible_name = self.getString(StringContent.VisibleName)
return SongsTab(self.name, visible_name[u'title'])
def initialise(self): def initialise(self):
log.info(u'Songs Initialising') log.info(u'Songs Initialising')
Plugin.initialise(self) Plugin.initialise(self)
@ -70,13 +66,6 @@ class SongsPlugin(Plugin):
self.mediaItem.displayResultsSong( self.mediaItem.displayResultsSong(
self.manager.get_all_objects(Song, order_by_ref=Song.search_title)) self.manager.get_all_objects(Song, order_by_ref=Song.search_title))
def getMediaManagerItem(self):
"""
Create the MediaManagerItem object, which is displaed in the
Media Manager.
"""
return SongMediaItem(self, self, self.icon)
def addImportMenuItem(self, import_menu): def addImportMenuItem(self, import_menu):
""" """
Give the Songs plugin the opportunity to add items to the Give the Songs plugin the opportunity to add items to the

View File

@ -25,7 +25,9 @@
############################################################################### ###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_SongUsageDeleteDialog(object): class Ui_SongUsageDeleteDialog(object):
def setupUi(self, songUsageDeleteDialog): def setupUi(self, songUsageDeleteDialog):
@ -43,19 +45,11 @@ class Ui_SongUsageDeleteDialog(object):
QtGui.QCalendarWidget.NoVerticalHeader) QtGui.QCalendarWidget.NoVerticalHeader)
self.deleteCalendar.setObjectName(u'deleteCalendar') self.deleteCalendar.setObjectName(u'deleteCalendar')
self.verticalLayout.addWidget(self.deleteCalendar) self.verticalLayout.addWidget(self.deleteCalendar)
self.buttonBox = QtGui.QDialogButtonBox(songUsageDeleteDialog) self.buttonBox = create_accept_reject_button_box(
songUsageDeleteDialog, True)
self.buttonBox.setGeometry(QtCore.QRect(30, 210, 245, 25)) self.buttonBox.setGeometry(QtCore.QRect(30, 210, 245, 25))
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.retranslateUi(songUsageDeleteDialog) self.retranslateUi(songUsageDeleteDialog)
QtCore.QObject.connect(
self.buttonBox, QtCore.SIGNAL(u'accepted()'),
songUsageDeleteDialog.accept)
QtCore.QObject.connect(
self.buttonBox, QtCore.SIGNAL(u'rejected()'),
songUsageDeleteDialog.close)
QtCore.QMetaObject.connectSlotsByName(songUsageDeleteDialog) QtCore.QMetaObject.connectSlotsByName(songUsageDeleteDialog)
def retranslateUi(self, songUsageDeleteDialog): def retranslateUi(self, songUsageDeleteDialog):

View File

@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_SongUsageDetailDialog(object): class Ui_SongUsageDetailDialog(object):
def setupUi(self, songUsageDetailDialog): def setupUi(self, songUsageDetailDialog):
@ -71,17 +72,10 @@ class Ui_SongUsageDetailDialog(object):
self.verticalLayout4.addLayout(self.horizontalLayout) self.verticalLayout4.addLayout(self.horizontalLayout)
self.verticalLayout2.addWidget(self.fileGroupBox) self.verticalLayout2.addWidget(self.fileGroupBox)
self.verticalLayout.addWidget(self.dateRangeGroupBox) self.verticalLayout.addWidget(self.dateRangeGroupBox)
self.buttonBox = QtGui.QDialogButtonBox(songUsageDetailDialog) self.buttonBox = create_accept_reject_button_box(
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | songUsageDetailDialog, True)
QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.buttonBox) self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(songUsageDetailDialog) self.retranslateUi(songUsageDetailDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
songUsageDetailDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
songUsageDetailDialog.close)
QtCore.QObject.connect(self.saveFilePushButton, QtCore.QObject.connect(self.saveFilePushButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'pressed()'),
songUsageDetailDialog.defineOutputLocation) songUsageDetailDialog.defineOutputLocation)