This commit is contained in:
Andreas Preikschat 2011-01-08 21:42:00 +01:00
commit 4d5248cc12
68 changed files with 2042 additions and 2722 deletions

View File

@ -182,7 +182,7 @@ class OpenLP(QtGui.QApplication):
screens = ScreenList() screens = ScreenList()
# Decide how many screens we have and their size # Decide how many screens we have and their size
for screen in xrange(0, self.desktop().numScreens()): for screen in xrange(0, self.desktop().numScreens()):
size = self.desktop().screenGeometry(screen); size = self.desktop().screenGeometry(screen)
screens.add_screen({u'number': screen, screens.add_screen({u'number': screen,
u'size': size, u'size': size,
u'primary': (self.desktop().primaryScreen() == screen)}) u'primary': (self.desktop().primaryScreen() == screen)})

View File

@ -102,7 +102,8 @@ def translate(context, text, comment=None,
An identifying string for when the same text is used in different roles An identifying string for when the same text is used in different roles
within the same context. within the same context.
""" """
return QtCore.QCoreApplication.translate(context, text, comment, encoding, n) return QtCore.QCoreApplication.translate(
context, text, comment, encoding, n)
def get_text_file_string(text_file): def get_text_file_string(text_file):
""" """

View File

@ -48,4 +48,3 @@ class OpenLPDockWidget(QtGui.QDockWidget):
self.setObjectName(name) self.setObjectName(name)
if icon: if icon:
self.setWindowIcon(icon) self.setWindowIcon(icon)
self.setFloating(False)

View File

@ -111,7 +111,7 @@ class MediaManagerItem(QtGui.QWidget):
self.singleServiceItem = True self.singleServiceItem = True
self.pageLayout = QtGui.QVBoxLayout(self) self.pageLayout = QtGui.QVBoxLayout(self)
self.pageLayout.setSpacing(0) self.pageLayout.setSpacing(0)
self.pageLayout.setContentsMargins(4, 0, 4, 0) self.pageLayout.setMargin(0)
self.requiredIcons() self.requiredIcons()
self.setupUi() self.setupUi()
self.retranslateUi() self.retranslateUi()
@ -176,7 +176,8 @@ class MediaManagerItem(QtGui.QWidget):
# break compatability), but it makes sense for the icon to # break compatability), but it makes sense for the icon to
# come before the tooltip (as you have to have an icon, but # come before the tooltip (as you have to have an icon, but
# not neccesarily a tooltip) # not neccesarily a tooltip)
self.toolbar.addToolbarButton(title, icon, tooltip, slot, checkable) return self.toolbar.addToolbarButton(title, icon, tooltip, slot,
checkable)
def addToolbarSeparator(self): def addToolbarSeparator(self):
""" """
@ -268,7 +269,6 @@ class MediaManagerItem(QtGui.QWidget):
#Add the List widget #Add the List widget
self.listView = self.ListViewWithDnD_class(self) self.listView = self.ListViewWithDnD_class(self)
self.listView.uniformItemSizes = True self.listView.uniformItemSizes = True
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591))
self.listView.setSpacing(1) self.listView.setSpacing(1)
self.listView.setSelectionMode( self.listView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection) QtGui.QAbstractItemView.ExtendedSelection)

View File

@ -69,7 +69,7 @@ class SearchEdit(QtGui.QLineEdit):
""" """
frameWidth = self.style().pixelMetric( frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth) QtGui.QStyle.PM_DefaultFrameWidth)
rightPadding = self.clearButton.sizeHint().width() + frameWidth rightPadding = self.clearButton.width() + frameWidth
if hasattr(self, u'menuButton'): if hasattr(self, u'menuButton'):
leftPadding = self.menuButton.width() leftPadding = self.menuButton.width()
self.setStyleSheet( self.setStyleSheet(
@ -78,10 +78,10 @@ class SearchEdit(QtGui.QLineEdit):
else: else:
self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % \ self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % \
rightPadding) rightPadding)
msz = self.minimumSizeHint(); msz = self.minimumSizeHint()
self.setMinimumSize( self.setMinimumSize(
max(msz.width(), max(msz.width(),
self.clearButton.sizeHint().width() + (frameWidth * 2) + 2), self.clearButton.width() + (frameWidth * 2) + 2),
max(msz.height(), max(msz.height(),
self.clearButton.height() + (frameWidth * 2) + 2) self.clearButton.height() + (frameWidth * 2) + 2)
) )
@ -93,13 +93,13 @@ class SearchEdit(QtGui.QLineEdit):
``event`` ``event``
The event that happened. The event that happened.
""" """
sz = self.clearButton.sizeHint() sz = self.clearButton.size()
frameWidth = self.style().pixelMetric( frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth) QtGui.QStyle.PM_DefaultFrameWidth)
self.clearButton.move(self.rect().right() - frameWidth - sz.width(), self.clearButton.move(self.rect().right() - frameWidth - sz.width(),
(self.rect().bottom() + 1 - sz.height()) / 2) (self.rect().bottom() + 1 - sz.height()) / 2)
if hasattr(self, u'menuButton'): if hasattr(self, u'menuButton'):
sz = self.menuButton.sizeHint() sz = self.menuButton.size()
self.menuButton.move(self.rect().left() + frameWidth + 2, self.menuButton.move(self.rect().left() + frameWidth + 2,
(self.rect().bottom() + 1 - sz.height()) / 2) (self.rect().bottom() + 1 - sz.height()) / 2)

View File

@ -55,7 +55,34 @@ class SettingsTab(QtGui.QWidget):
""" """
Setup the tab's interface. Setup the tab's interface.
""" """
pass self.tabLayout = QtGui.QHBoxLayout(self)
self.tabLayout.setObjectName(u'tabLayout')
self.leftColumn = QtGui.QWidget(self)
self.leftColumn.setObjectName(u'leftColumn')
self.leftLayout = QtGui.QVBoxLayout(self.leftColumn)
self.leftLayout.setMargin(0)
self.leftLayout.setObjectName(u'leftLayout')
self.tabLayout.addWidget(self.leftColumn)
self.rightColumn = QtGui.QWidget(self)
self.rightColumn.setObjectName(u'rightColumn')
self.rightLayout = QtGui.QVBoxLayout(self.rightColumn)
self.rightLayout.setMargin(0)
self.rightLayout.setObjectName(u'rightLayout')
self.tabLayout.addWidget(self.rightColumn)
def resizeEvent(self, event=None):
"""
Resize the sides in two equal halves if the layout allows this.
"""
if event:
QtGui.QWidget.resizeEvent(self, event)
width = self.width() - self.tabLayout.spacing() - \
self.tabLayout.contentsMargins().left() - \
self.tabLayout.contentsMargins().right()
left_width = min(width - self.rightColumn.minimumSizeHint().width(),
width / 2)
left_width = max(left_width, self.leftColumn.minimumSizeHint().width())
self.leftColumn.setFixedWidth(left_width)
def preLoad(self): def preLoad(self):
""" """

View File

@ -72,27 +72,27 @@ class OpenLPToolbar(QtGui.QToolBar):
``objectname`` ``objectname``
The name of the object, as used in `<button>.setObjectName()`. The name of the object, as used in `<button>.setObjectName()`.
""" """
toolbarButton = None newAction = None
if icon: if icon:
buttonIcon = build_icon(icon) actionIcon = build_icon(icon)
if slot and not checkable: if slot and not checkable:
toolbarButton = self.addAction(buttonIcon, title, slot) newAction = self.addAction(actionIcon, title, slot)
else: else:
toolbarButton = self.addAction(buttonIcon, title) newAction = self.addAction(actionIcon, title)
self.icons[title] = buttonIcon self.icons[title] = actionIcon
else: else:
toolbarButton = QtGui.QAction(title, toolbarButton) newAction = QtGui.QAction(title, newAction)
self.addAction(toolbarButton) self.addAction(newAction)
QtCore.QObject.connect(toolbarButton, QtCore.QObject.connect(newAction,
QtCore.SIGNAL(u'triggered()'), slot) QtCore.SIGNAL(u'triggered()'), slot)
if tooltip: if tooltip:
toolbarButton.setToolTip(tooltip) newAction.setToolTip(tooltip)
if checkable: if checkable:
toolbarButton.setCheckable(True) newAction.setCheckable(True)
QtCore.QObject.connect(toolbarButton, QtCore.QObject.connect(newAction,
QtCore.SIGNAL(u'toggled(bool)'), slot) QtCore.SIGNAL(u'toggled(bool)'), slot)
self.actions[title] = toolbarButton self.actions[title] = newAction
return toolbarButton return newAction
def addToolbarSeparator(self, handle): def addToolbarSeparator(self, handle):
""" """
@ -154,4 +154,4 @@ class OpenLPToolbar(QtGui.QToolBar):
push_button.setCheckable(True) push_button.setCheckable(True)
push_button.setFlat(True) push_button.setFlat(True)
self.addWidget(push_button) self.addWidget(push_button)
return push_button return push_button

View File

@ -29,9 +29,20 @@ The :mod:`ui` module provides the core user interface for OpenLP
class HideMode(object): class HideMode(object):
""" """
This is basically an enumeration class which specifies the mode of a Bible. This is an enumeration class which specifies the different modes of hiding
Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to the display.
be downloaded from the Internet on an as-needed basis.
``Blank``
This mode is used to hide all output, specifically by covering the
display with a black screen.
``Theme``
This mode is used to hide all output, but covers the display with the
current theme background, as opposed to black.
``Desktop``
This mode hides all output by minimising the display, leaving the user's
desktop showing.
""" """
Blank = 1 Blank = 1
Theme = 2 Theme = 2
@ -58,4 +69,4 @@ from thememanager import ThemeManager
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
'MediaDockManager', 'ServiceItemEditForm'] 'MediaDockManager', 'ServiceItemEditForm']

View File

@ -31,17 +31,12 @@ from openlp.core.lib import build_icon, translate
class Ui_AboutDialog(object): class Ui_AboutDialog(object):
def setupUi(self, aboutDialog): def setupUi(self, aboutDialog):
aboutDialog.setObjectName(u'aboutDialog') aboutDialog.setObjectName(u'aboutDialog')
aboutDialog.resize(516, 481)
aboutDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png')) aboutDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
self.aboutDialogLayout = QtGui.QVBoxLayout(aboutDialog) self.aboutDialogLayout = QtGui.QVBoxLayout(aboutDialog)
self.aboutDialogLayout.setSpacing(8)
self.aboutDialogLayout.setMargin(8)
self.aboutDialogLayout.setObjectName(u'aboutDialogLayout') self.aboutDialogLayout.setObjectName(u'aboutDialogLayout')
self.logoLabel = QtGui.QLabel(aboutDialog) self.logoLabel = QtGui.QLabel(aboutDialog)
self.logoLabel.setPixmap( self.logoLabel.setPixmap(
QtGui.QPixmap(u':/graphics/openlp-about-logo.png')) QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
self.logoLabel.setScaledContents(False)
self.logoLabel.setIndent(0)
self.logoLabel.setObjectName(u'logoLabel') self.logoLabel.setObjectName(u'logoLabel')
self.aboutDialogLayout.addWidget(self.logoLabel) self.aboutDialogLayout.addWidget(self.logoLabel)
self.aboutNotebook = QtGui.QTabWidget(aboutDialog) self.aboutNotebook = QtGui.QTabWidget(aboutDialog)
@ -49,59 +44,44 @@ class Ui_AboutDialog(object):
self.aboutTab = QtGui.QWidget() self.aboutTab = QtGui.QWidget()
self.aboutTab.setObjectName(u'aboutTab') self.aboutTab.setObjectName(u'aboutTab')
self.aboutTabLayout = QtGui.QVBoxLayout(self.aboutTab) self.aboutTabLayout = QtGui.QVBoxLayout(self.aboutTab)
self.aboutTabLayout.setSpacing(0)
self.aboutTabLayout.setMargin(8)
self.aboutTabLayout.setObjectName(u'aboutTabLayout') self.aboutTabLayout.setObjectName(u'aboutTabLayout')
self.aboutTextEdit = QtGui.QPlainTextEdit(self.aboutTab) self.aboutTextEdit = QtGui.QPlainTextEdit(self.aboutTab)
self.aboutTextEdit.setReadOnly(True) self.aboutTextEdit.setReadOnly(True)
self.aboutTextEdit.setObjectName(u'aboutTextEdit') self.aboutTextEdit.setObjectName(u'aboutTextEdit')
self.aboutTabLayout.addWidget(self.aboutTextEdit) self.aboutTabLayout.addWidget(self.aboutTextEdit)
self.aboutNotebook.addTab(self.aboutTab, '') self.aboutNotebook.addTab(self.aboutTab, u'')
self.creditsTab = QtGui.QWidget() self.creditsTab = QtGui.QWidget()
self.creditsTab.setObjectName(u'creditsTab') self.creditsTab.setObjectName(u'creditsTab')
self.creditsTabLayout = QtGui.QVBoxLayout(self.creditsTab) self.creditsTabLayout = QtGui.QVBoxLayout(self.creditsTab)
self.creditsTabLayout.setSpacing(0)
self.creditsTabLayout.setMargin(8)
self.creditsTabLayout.setObjectName(u'creditsTabLayout') self.creditsTabLayout.setObjectName(u'creditsTabLayout')
self.creditsTextEdit = QtGui.QPlainTextEdit(self.creditsTab) self.creditsTextEdit = QtGui.QPlainTextEdit(self.creditsTab)
self.creditsTextEdit.setReadOnly(True) self.creditsTextEdit.setReadOnly(True)
self.creditsTextEdit.setObjectName(u'creditsTextEdit') self.creditsTextEdit.setObjectName(u'creditsTextEdit')
self.creditsTabLayout.addWidget(self.creditsTextEdit) self.creditsTabLayout.addWidget(self.creditsTextEdit)
self.aboutNotebook.addTab(self.creditsTab, '') self.aboutNotebook.addTab(self.creditsTab, u'')
self.licenseTab = QtGui.QWidget() self.licenseTab = QtGui.QWidget()
self.licenseTab.setObjectName(u'licenseTab') self.licenseTab.setObjectName(u'licenseTab')
self.licenseTabLayout = QtGui.QVBoxLayout(self.licenseTab) self.licenseTabLayout = QtGui.QVBoxLayout(self.licenseTab)
self.licenseTabLayout.setSpacing(8)
self.licenseTabLayout.setMargin(8)
self.licenseTabLayout.setObjectName(u'licenseTabLayout') self.licenseTabLayout.setObjectName(u'licenseTabLayout')
self.licenseTextEdit = QtGui.QPlainTextEdit(self.licenseTab) self.licenseTextEdit = QtGui.QPlainTextEdit(self.licenseTab)
self.licenseTextEdit.setReadOnly(True) self.licenseTextEdit.setReadOnly(True)
self.licenseTextEdit.setObjectName(u'licenseTextEdit') self.licenseTextEdit.setObjectName(u'licenseTextEdit')
self.licenseTabLayout.addWidget(self.licenseTextEdit) self.licenseTabLayout.addWidget(self.licenseTextEdit)
self.aboutNotebook.addTab(self.licenseTab, '') self.aboutNotebook.addTab(self.licenseTab, u'')
self.aboutDialogLayout.addWidget(self.aboutNotebook) self.aboutDialogLayout.addWidget(self.aboutNotebook)
self.buttonWidget = QtGui.QWidget(aboutDialog) self.buttonBox = QtGui.QDialogButtonBox(aboutDialog)
self.buttonWidget.setObjectName(u'buttonWidget') self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.buttonWidgetLayout = QtGui.QHBoxLayout(self.buttonWidget) self.buttonBox.setObjectName(u'buttonBox')
self.buttonWidgetLayout.setSpacing(8) self.contributeButton = QtGui.QPushButton()
self.buttonWidgetLayout.setMargin(0)
self.buttonWidgetLayout.setObjectName(u'buttonWidgetLayout')
buttonSpacer = QtGui.QSpacerItem(275, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.buttonWidgetLayout.addItem(buttonSpacer)
self.contributeButton = QtGui.QPushButton(self.buttonWidget)
self.contributeButton.setIcon( self.contributeButton.setIcon(
build_icon(u':/system/system_contribute.png')) build_icon(u':/system/system_contribute.png'))
self.contributeButton.setObjectName(u'contributeButton') self.contributeButton.setObjectName(u'contributeButton')
self.buttonWidgetLayout.addWidget(self.contributeButton) self.buttonBox.addButton(self.contributeButton,
self.closeButton = QtGui.QPushButton(self.buttonWidget) QtGui.QDialogButtonBox.ActionRole)
self.closeButton.setIcon(build_icon(u':/system/system_close.png')) self.aboutDialogLayout.addWidget(self.buttonBox)
self.closeButton.setObjectName(u'closeButton')
self.buttonWidgetLayout.addWidget(self.closeButton)
self.aboutDialogLayout.addWidget(self.buttonWidget)
self.retranslateUi(aboutDialog) self.retranslateUi(aboutDialog)
self.aboutNotebook.setCurrentIndex(0) self.aboutNotebook.setCurrentIndex(0)
QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
aboutDialog.close) aboutDialog.close)
QtCore.QMetaObject.connectSlotsByName(aboutDialog) QtCore.QMetaObject.connectSlotsByName(aboutDialog)
@ -575,4 +555,3 @@ class Ui_AboutDialog(object):
translate('OpenLP.AboutForm', 'License')) translate('OpenLP.AboutForm', 'License'))
self.contributeButton.setText(translate('OpenLP.AboutForm', self.contributeButton.setText(translate('OpenLP.AboutForm',
'Contribute')) 'Contribute'))
self.closeButton.setText(translate('OpenLP.AboutForm', 'Close'))

View File

@ -46,97 +46,57 @@ class AdvancedTab(SettingsTab):
Configure the UI elements for the tab. Configure the UI elements for the tab.
""" """
self.setObjectName(u'AdvancedTab') self.setObjectName(u'AdvancedTab')
self.tabTitleVisible = translate('OpenLP.AdvancedTab', 'Advanced') SettingsTab.setupUi(self)
self.advancedTabLayout = QtGui.QHBoxLayout(self) self.uiGroupBox = QtGui.QGroupBox(self.leftColumn)
self.advancedTabLayout.setSpacing(8)
self.advancedTabLayout.setMargin(8)
self.leftWidget = QtGui.QWidget(self)
self.leftLayout = QtGui.QVBoxLayout(self.leftWidget)
self.leftLayout.setSpacing(8)
self.leftLayout.setMargin(0)
self.uiGroupBox = QtGui.QGroupBox(self.leftWidget)
self.uiGroupBox.setObjectName(u'uiGroupBox') self.uiGroupBox.setObjectName(u'uiGroupBox')
self.uiLayout = QtGui.QVBoxLayout(self.uiGroupBox) self.uiLayout = QtGui.QFormLayout(self.uiGroupBox)
self.uiLayout.setSpacing(8)
self.uiLayout.setMargin(6)
self.uiLayout.setObjectName(u'uiLayout') self.uiLayout.setObjectName(u'uiLayout')
self.recentLayout = QtGui.QHBoxLayout()
self.recentLayout.setSpacing(8)
self.recentLayout.setMargin(0)
self.recentLayout.setObjectName(u'recentLayout')
self.recentLabel = QtGui.QLabel(self.uiGroupBox) self.recentLabel = QtGui.QLabel(self.uiGroupBox)
self.recentLabel.setObjectName(u'recentLabel') self.recentLabel.setObjectName(u'recentLabel')
self.recentLayout.addWidget(self.recentLabel)
self.recentSpinBox = QtGui.QSpinBox(self.uiGroupBox) self.recentSpinBox = QtGui.QSpinBox(self.uiGroupBox)
self.recentSpinBox.setObjectName(u'recentSpinBox') self.recentSpinBox.setObjectName(u'recentSpinBox')
self.recentSpinBox.setMinimum(0) self.recentSpinBox.setMinimum(0)
self.recentLayout.addWidget(self.recentSpinBox) self.uiLayout.addRow(self.recentLabel, self.recentSpinBox)
self.recentSpacer = QtGui.QSpacerItem(50, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.recentLayout.addItem(self.recentSpacer)
self.uiLayout.addLayout(self.recentLayout)
self.mediaPluginCheckBox = QtGui.QCheckBox(self.uiGroupBox) self.mediaPluginCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.mediaPluginCheckBox.setObjectName(u'mediaPluginCheckBox') self.mediaPluginCheckBox.setObjectName(u'mediaPluginCheckBox')
self.uiLayout.addWidget(self.mediaPluginCheckBox) self.uiLayout.addRow(self.mediaPluginCheckBox)
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox) self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox') self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
self.uiLayout.addWidget(self.doubleClickLiveCheckBox) self.uiLayout.addRow(self.doubleClickLiveCheckBox)
# self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
# self.expandServiceItemCheckBox.setObjectName(
# u'expandServiceItemCheckBox')
# self.uiLayout.addWidget(self.expandServiceItemCheckBox)
self.leftLayout.addWidget(self.uiGroupBox)
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox) self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.expandServiceItemCheckBox.setObjectName( self.expandServiceItemCheckBox.setObjectName(
u'expandServiceItemCheckBox') u'expandServiceItemCheckBox')
self.uiLayout.addWidget(self.expandServiceItemCheckBox) self.uiLayout.addRow(self.expandServiceItemCheckBox)
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox) self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.enableAutoCloseCheckBox.setObjectName( self.enableAutoCloseCheckBox.setObjectName(
u'enableAutoCloseCheckBox') u'enableAutoCloseCheckBox')
self.uiLayout.addWidget(self.enableAutoCloseCheckBox) self.uiLayout.addRow(self.enableAutoCloseCheckBox)
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget) self.leftLayout.addWidget(self.uiGroupBox)
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftColumn)
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox') # self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
# self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85)) # self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox)
# self.sharedDirGroupBox.setMaximumSize(QtCore.QSize(500, 85))
# self.sharedDirLayout = QtGui.QVBoxLayout(self.sharedDirGroupBox)
# self.sharedDirLayout.setSpacing(8)
# self.sharedDirLayout.setMargin(8)
# self.sharedCheckBox = QtGui.QCheckBox(self.sharedDirGroupBox) # self.sharedCheckBox = QtGui.QCheckBox(self.sharedDirGroupBox)
# self.sharedCheckBox.setObjectName(u'sharedCheckBox') # self.sharedCheckBox.setObjectName(u'sharedCheckBox')
# self.sharedDirLayout.addWidget(self.sharedCheckBox) # self.sharedDirLayout.addRow(self.sharedCheckBox)
# self.sharedSubLayout = QtGui.QHBoxLayout()
# self.sharedSubLayout.setSpacing(8)
# self.sharedSubLayout.setMargin(0)
# self.sharedLabel = QtGui.QLabel(self.sharedDirGroupBox) # self.sharedLabel = QtGui.QLabel(self.sharedDirGroupBox)
# self.sharedLabel.setObjectName(u'sharedLabel') # self.sharedLabel.setObjectName(u'sharedLabel')
# self.sharedSubLayout.addWidget(self.sharedLabel) # self.sharedSubLayout = QtGui.QHBoxLayout()
# self.sharedSubLayout.setObjectName(u'sharedSubLayout')
# self.sharedLineEdit = QtGui.QLineEdit(self.sharedDirGroupBox) # self.sharedLineEdit = QtGui.QLineEdit(self.sharedDirGroupBox)
# self.sharedLineEdit.setObjectName(u'sharedLineEdit') # self.sharedLineEdit.setObjectName(u'sharedLineEdit')
# self.sharedSubLayout.addWidget(self.sharedLineEdit) # self.sharedSubLayout.addWidget(self.sharedLineEdit)
# self.sharedPushButton = QtGui.QPushButton(self.sharedDirGroupBox) # self.sharedPushButton = QtGui.QPushButton(self.sharedDirGroupBox)
# self.sharedPushButton.setObjectName(u'sharedPushButton') # self.sharedPushButton.setObjectName(u'sharedPushButton')
# self.sharedSubLayout.addWidget(self.sharedPushButton) # self.sharedSubLayout.addWidget(self.sharedPushButton)
# self.sharedDirLayout.addLayout(self.sharedSubLayout) # self.sharedDirLayout.addRow(self.sharedLabel, self.sharedSubLayout)
# self.leftLayout.addWidget(self.sharedDirGroupBox) # self.leftLayout.addWidget(self.sharedDirGroupBox)
self.leftSpacer = QtGui.QSpacerItem(20, 40, self.leftLayout.addStretch()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) # self.databaseGroupBox = QtGui.QGroupBox(self.rightColumn)
self.leftLayout.addItem(self.leftSpacer)
self.advancedTabLayout.addWidget(self.leftWidget)
self.rightWidget = QtGui.QWidget(self)
self.rightLayout = QtGui.QVBoxLayout(self.rightWidget)
self.rightLayout.setSpacing(8)
self.rightLayout.setMargin(0)
# self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget)
# self.databaseGroupBox.setObjectName(u'databaseGroupBox') # self.databaseGroupBox.setObjectName(u'databaseGroupBox')
# self.databaseGroupBox.setEnabled(False) # self.databaseGroupBox.setEnabled(False)
# self.databaseLayout = QtGui.QVBoxLayout(self.databaseGroupBox) # self.databaseLayout = QtGui.QVBoxLayout(self.databaseGroupBox)
# self.databaseLayout.setSpacing(8)
# self.databaseLayout.setMargin(8)
# self.rightLayout.addWidget(self.databaseGroupBox) # self.rightLayout.addWidget(self.databaseGroupBox)
self.rightSpacer = QtGui.QSpacerItem(20, 40, self.rightLayout.addStretch()
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
self.rightLayout.addItem(self.rightSpacer)
self.advancedTabLayout.addWidget(self.rightWidget)
# QtCore.QObject.connect(self.sharedCheckBox, # QtCore.QObject.connect(self.sharedCheckBox,
# QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged) # QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged)
@ -144,6 +104,7 @@ class AdvancedTab(SettingsTab):
""" """
Setup the interface translation strings. Setup the interface translation strings.
""" """
self.tabTitleVisible = translate('OpenLP.AdvancedTab', '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',
@ -215,4 +176,4 @@ class AdvancedTab(SettingsTab):
# """ # """
# self.sharedLabel.setEnabled(checked) # self.sharedLabel.setEnabled(checked)
# self.sharedTextEdit.setEnabled(checked) # self.sharedTextEdit.setEnabled(checked)
# self.sharedPushButton.setEnabled(checked) # self.sharedPushButton.setEnabled(checked)

View File

@ -31,23 +31,16 @@ from openlp.core.lib import translate, build_icon
class Ui_ExceptionDialog(object): class Ui_ExceptionDialog(object):
def setupUi(self, exceptionDialog): def setupUi(self, exceptionDialog):
exceptionDialog.setObjectName(u'exceptionDialog') exceptionDialog.setObjectName(u'exceptionDialog')
exceptionDialog.resize(580, 407)
self.exceptionLayout = QtGui.QVBoxLayout(exceptionDialog) self.exceptionLayout = QtGui.QVBoxLayout(exceptionDialog)
self.exceptionLayout.setSpacing(8)
self.exceptionLayout.setMargin(8)
self.exceptionLayout.setObjectName(u'exceptionLayout') self.exceptionLayout.setObjectName(u'exceptionLayout')
self.messageLayout = QtGui.QHBoxLayout() self.messageLayout = QtGui.QHBoxLayout()
self.messageLayout.setSpacing(0)
self.messageLayout.setContentsMargins(0, -1, 0, -1)
self.messageLayout.setObjectName(u'messageLayout') self.messageLayout.setObjectName(u'messageLayout')
self.messageLayout.addSpacing(12)
self.bugLabel = QtGui.QLabel(exceptionDialog) self.bugLabel = QtGui.QLabel(exceptionDialog)
self.bugLabel.setMinimumSize(QtCore.QSize(64, 64))
self.bugLabel.setMaximumSize(QtCore.QSize(64, 64))
self.bugLabel.setText(u'')
self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png')) self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
self.bugLabel.setAlignment(QtCore.Qt.AlignCenter)
self.bugLabel.setObjectName(u'bugLabel') self.bugLabel.setObjectName(u'bugLabel')
self.messageLayout.addWidget(self.bugLabel) self.messageLayout.addWidget(self.bugLabel)
self.messageLayout.addSpacing(12)
self.messageLabel = QtGui.QLabel(exceptionDialog) self.messageLabel = QtGui.QLabel(exceptionDialog)
self.messageLabel.setWordWrap(True) self.messageLabel.setWordWrap(True)
self.messageLabel.setObjectName(u'messageLabel') self.messageLabel.setObjectName(u'messageLabel')
@ -55,11 +48,9 @@ class Ui_ExceptionDialog(object):
self.exceptionLayout.addLayout(self.messageLayout) self.exceptionLayout.addLayout(self.messageLayout)
self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog) self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog)
self.exceptionTextEdit.setReadOnly(True) self.exceptionTextEdit.setReadOnly(True)
self.exceptionTextEdit.setBackgroundVisible(False)
self.exceptionTextEdit.setObjectName(u'exceptionTextEdit') self.exceptionTextEdit.setObjectName(u'exceptionTextEdit')
self.exceptionLayout.addWidget(self.exceptionTextEdit) self.exceptionLayout.addWidget(self.exceptionTextEdit)
self.exceptionButtonBox = QtGui.QDialogButtonBox(exceptionDialog) self.exceptionButtonBox = QtGui.QDialogButtonBox(exceptionDialog)
self.exceptionButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.exceptionButtonBox.setObjectName(u'exceptionButtonBox') self.exceptionButtonBox.setObjectName(u'exceptionButtonBox')
self.exceptionLayout.addWidget(self.exceptionButtonBox) self.exceptionLayout.addWidget(self.exceptionButtonBox)
@ -76,8 +67,6 @@ class Ui_ExceptionDialog(object):
QtGui.QDialogButtonBox.ActionRole) QtGui.QDialogButtonBox.ActionRole)
self.retranslateUi(exceptionDialog) self.retranslateUi(exceptionDialog)
QtCore.QObject.connect(self.exceptionButtonBox,
QtCore.SIGNAL(u'accepted()'), exceptionDialog.accept)
QtCore.QObject.connect(self.exceptionButtonBox, QtCore.QObject.connect(self.exceptionButtonBox,
QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject) QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject)
QtCore.QObject.connect(self.sendReportButton, QtCore.QObject.connect(self.sendReportButton,
@ -98,4 +87,4 @@ class Ui_ExceptionDialog(object):
self.sendReportButton.setText(translate('OpenLP.ExceptionDialog', self.sendReportButton.setText(translate('OpenLP.ExceptionDialog',
'Send E-Mail')) 'Send E-Mail'))
self.saveReportButton.setText(translate('OpenLP.ExceptionDialog', self.saveReportButton.setText(translate('OpenLP.ExceptionDialog',
'Save to File')) 'Save to File'))

View File

@ -31,27 +31,26 @@ from openlp.core.lib import translate
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(400, 87) FileRenameDialog.resize(300, 10)
self.dialogLayout = QtGui.QGridLayout(FileRenameDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.fileNameLabel = QtGui.QLabel(FileRenameDialog)
self.fileNameLabel.setObjectName(u'fileNameLabel')
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
self.fileNameEdit = QtGui.QLineEdit(FileRenameDialog)
self.fileNameEdit.setValidator(QtGui.QRegExpValidator(
QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self))
self.fileNameEdit.setObjectName(u'fileNameEdit')
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog) self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog)
self.buttonBox.setGeometry(QtCore.QRect(210, 50, 171, 25))
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Ok) QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.widget = QtGui.QWidget(FileRenameDialog) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.widget.setGeometry(QtCore.QRect(10, 10, 381, 35))
self.widget.setObjectName(u'widget')
self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.fileRenameLabel = QtGui.QLabel(self.widget)
self.fileRenameLabel.setObjectName(u'fileRenameLabel')
self.horizontalLayout.addWidget(self.fileRenameLabel)
self.fileNameEdit = QtGui.QLineEdit(self.widget)
self.fileNameEdit.setObjectName(u'fileNameEdit')
self.horizontalLayout.addWidget(self.fileNameEdit)
self.retranslateUi(FileRenameDialog) self.retranslateUi(FileRenameDialog)
self.setMaximumHeight(self.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(FileRenameDialog) QtCore.QMetaObject.connectSlotsByName(FileRenameDialog)
def retranslateUi(self, FileRenameDialog): def retranslateUi(self, FileRenameDialog):
self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm', self.fileNameLabel.setText(translate('OpenLP.FileRenameForm',
'New File Name:')) 'New File Name:'))

View File

@ -52,4 +52,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
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

@ -85,37 +85,24 @@ class GeneralTab(SettingsTab):
Create the user interface for the general settings tab Create the user interface for the general settings tab
""" """
self.setObjectName(u'GeneralTab') self.setObjectName(u'GeneralTab')
self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General') SettingsTab.setupUi(self)
self.generalLayout = QtGui.QHBoxLayout(self) self.monitorGroupBox = QtGui.QGroupBox(self.leftColumn)
self.generalLayout.setSpacing(8)
self.generalLayout.setMargin(8)
self.generalLayout.setObjectName(u'generalLayout')
self.generalLeftLayout = QtGui.QVBoxLayout()
self.generalLeftLayout.setObjectName(u'generalLeftLayout')
self.generalLeftLayout.setSpacing(8)
self.generalLeftLayout.setMargin(0)
self.generalLayout.addLayout(self.generalLeftLayout)
self.monitorGroupBox = QtGui.QGroupBox(self)
self.monitorGroupBox.setObjectName(u'monitorGroupBox') self.monitorGroupBox.setObjectName(u'monitorGroupBox')
self.monitorLayout = QtGui.QVBoxLayout(self.monitorGroupBox) self.monitorLayout = QtGui.QFormLayout(self.monitorGroupBox)
self.monitorLayout.setSpacing(8)
self.monitorLayout.setMargin(8)
self.monitorLayout.setObjectName(u'monitorLayout') self.monitorLayout.setObjectName(u'monitorLayout')
self.monitorLabel = QtGui.QLabel(self.monitorGroupBox) self.monitorLabel = QtGui.QLabel(self.monitorGroupBox)
self.monitorLabel.setObjectName(u'monitorLabel') self.monitorLabel.setObjectName(u'monitorLabel')
self.monitorLayout.addWidget(self.monitorLabel) self.monitorLayout.addRow(self.monitorLabel)
self.monitorComboBox = QtGui.QComboBox(self.monitorGroupBox) self.monitorComboBox = QtGui.QComboBox(self.monitorGroupBox)
self.monitorComboBox.setObjectName(u'monitorComboBox') self.monitorComboBox.setObjectName(u'monitorComboBox')
self.monitorLayout.addWidget(self.monitorComboBox) self.monitorLayout.addRow(self.monitorComboBox)
self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox) self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox)
self.displayOnMonitorCheck.setObjectName(u'monitorComboBox') self.displayOnMonitorCheck.setObjectName(u'monitorComboBox')
self.monitorLayout.addWidget(self.displayOnMonitorCheck) self.monitorLayout.addRow(self.displayOnMonitorCheck)
self.generalLeftLayout.addWidget(self.monitorGroupBox) self.leftLayout.addWidget(self.monitorGroupBox)
self.startupGroupBox = QtGui.QGroupBox(self) self.startupGroupBox = QtGui.QGroupBox(self.leftColumn)
self.startupGroupBox.setObjectName(u'startupGroupBox') self.startupGroupBox.setObjectName(u'startupGroupBox')
self.startupLayout = QtGui.QVBoxLayout(self.startupGroupBox) self.startupLayout = QtGui.QVBoxLayout(self.startupGroupBox)
self.startupLayout.setSpacing(8)
self.startupLayout.setMargin(8)
self.startupLayout.setObjectName(u'startupLayout') self.startupLayout.setObjectName(u'startupLayout')
self.warningCheckBox = QtGui.QCheckBox(self.startupGroupBox) self.warningCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.warningCheckBox.setObjectName(u'warningCheckBox') self.warningCheckBox.setObjectName(u'warningCheckBox')
@ -126,189 +113,107 @@ class GeneralTab(SettingsTab):
self.showSplashCheckBox = QtGui.QCheckBox(self.startupGroupBox) self.showSplashCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.showSplashCheckBox.setObjectName(u'showSplashCheckBox') self.showSplashCheckBox.setObjectName(u'showSplashCheckBox')
self.startupLayout.addWidget(self.showSplashCheckBox) self.startupLayout.addWidget(self.showSplashCheckBox)
self.generalLeftLayout.addWidget(self.startupGroupBox) self.leftLayout.addWidget(self.startupGroupBox)
self.settingsGroupBox = QtGui.QGroupBox(self) self.settingsGroupBox = QtGui.QGroupBox(self.leftColumn)
self.settingsGroupBox.setObjectName(u'settingsGroupBox') self.settingsGroupBox.setObjectName(u'settingsGroupBox')
self.settingsLayout = QtGui.QGridLayout(self.settingsGroupBox) self.settingsLayout = QtGui.QFormLayout(self.settingsGroupBox)
self.settingsLayout.setSpacing(8)
self.settingsLayout.setMargin(8)
self.settingsLayout.setObjectName(u'settingsLayout') self.settingsLayout.setObjectName(u'settingsLayout')
self.saveCheckServiceCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.saveCheckServiceCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.saveCheckServiceCheckBox.setObjectName(u'saveCheckServiceCheckBox') self.saveCheckServiceCheckBox.setObjectName(u'saveCheckServiceCheckBox')
self.settingsLayout.addWidget(self.saveCheckServiceCheckBox, 0, 0, 1, 2) self.settingsLayout.addRow(self.saveCheckServiceCheckBox)
self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox') self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox')
self.settingsLayout.addWidget(self.autoPreviewCheckBox, 1, 0, 1, 2) self.settingsLayout.addRow(self.autoPreviewCheckBox)
# Moved here from image tab # Moved here from image tab
self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox) self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox)
self.timeoutLabel.setObjectName(u'timeoutLabel') self.timeoutLabel.setObjectName(u'timeoutLabel')
self.settingsLayout.addWidget(self.timeoutLabel, 2, 0, 1, 1)
self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox) self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox)
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox') self.timeoutSpinBox.setObjectName(u'timeoutSpinBox')
self.settingsLayout.addWidget(self.timeoutSpinBox, 2, 1, 1, 1) self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox)
self.generalLeftLayout.addWidget(self.settingsGroupBox) self.leftLayout.addWidget(self.settingsGroupBox)
self.generalLeftSpacer = QtGui.QSpacerItem(20, 40, self.leftLayout.addStretch()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.ccliGroupBox = QtGui.QGroupBox(self.rightColumn)
self.generalLeftLayout.addItem(self.generalLeftSpacer)
self.generalRightLayout = QtGui.QVBoxLayout()
self.generalRightLayout.setSpacing(8)
self.generalRightLayout.setMargin(0)
self.generalRightLayout.setObjectName(u'generalRightLayout')
self.generalLayout.addLayout(self.generalRightLayout)
self.ccliGroupBox = QtGui.QGroupBox(self)
self.ccliGroupBox.setObjectName(u'ccliGroupBox') self.ccliGroupBox.setObjectName(u'ccliGroupBox')
self.ccliLayout = QtGui.QGridLayout(self.ccliGroupBox) self.ccliLayout = QtGui.QFormLayout(self.ccliGroupBox)
self.ccliLayout.setMargin(8)
self.ccliLayout.setSpacing(8)
self.ccliLayout.setObjectName(u'ccliLayout') self.ccliLayout.setObjectName(u'ccliLayout')
self.numberLabel = QtGui.QLabel(self.ccliGroupBox) self.numberLabel = QtGui.QLabel(self.ccliGroupBox)
self.numberLabel.setObjectName(u'numberLabel') self.numberLabel.setObjectName(u'numberLabel')
self.ccliLayout.addWidget(self.numberLabel, 0, 0, 1, 1)
self.numberEdit = QtGui.QLineEdit(self.ccliGroupBox) self.numberEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.numberEdit.setValidator(QtGui.QIntValidator())
self.numberEdit.setObjectName(u'numberEdit') self.numberEdit.setObjectName(u'numberEdit')
self.ccliLayout.addWidget(self.numberEdit, 0, 1, 1, 1) self.ccliLayout.addRow(self.numberLabel, self.numberEdit)
self.usernameLabel = QtGui.QLabel(self.ccliGroupBox) self.usernameLabel = QtGui.QLabel(self.ccliGroupBox)
self.usernameLabel.setObjectName(u'usernameLabel') self.usernameLabel.setObjectName(u'usernameLabel')
self.ccliLayout.addWidget(self.usernameLabel, 1, 0, 1, 1)
self.usernameEdit = QtGui.QLineEdit(self.ccliGroupBox) self.usernameEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.usernameEdit.setObjectName(u'usernameEdit') self.usernameEdit.setObjectName(u'usernameEdit')
self.ccliLayout.addWidget(self.usernameEdit, 1, 1, 1, 1) self.ccliLayout.addRow(self.usernameLabel, self.usernameEdit)
self.passwordLabel = QtGui.QLabel(self.ccliGroupBox) self.passwordLabel = QtGui.QLabel(self.ccliGroupBox)
self.passwordLabel.setObjectName(u'passwordLabel') self.passwordLabel.setObjectName(u'passwordLabel')
self.ccliLayout.addWidget(self.passwordLabel, 2, 0, 1, 1)
self.passwordEdit = QtGui.QLineEdit(self.ccliGroupBox) self.passwordEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.passwordEdit.setEchoMode(QtGui.QLineEdit.Password) self.passwordEdit.setEchoMode(QtGui.QLineEdit.Password)
self.passwordEdit.setObjectName(u'passwordEdit') self.passwordEdit.setObjectName(u'passwordEdit')
self.ccliLayout.addWidget(self.passwordEdit, 2, 1, 1, 1) self.ccliLayout.addRow(self.passwordLabel, self.passwordEdit)
self.generalRightLayout.addWidget(self.ccliGroupBox) self.rightLayout.addWidget(self.ccliGroupBox)
# Moved here from display tab # Moved here from display tab
self.displayGroupBox = QtGui.QGroupBox(self) self.displayGroupBox = QtGui.QGroupBox(self.rightColumn)
self.displayGroupBox.setObjectName(u'displayGroupBox') self.displayGroupBox.setObjectName(u'displayGroupBox')
self.displayLayout = QtGui.QVBoxLayout(self.displayGroupBox) self.displayLayout = QtGui.QGridLayout(self.displayGroupBox)
self.displayLayout.setSpacing(8)
self.displayLayout.setMargin(8)
self.displayLayout.setObjectName(u'displayLayout') self.displayLayout.setObjectName(u'displayLayout')
self.currentLayout = QtGui.QHBoxLayout()
self.currentLayout.setSpacing(8)
self.currentLayout.setMargin(0)
self.currentLayout.setObjectName(u'currentLayout')
self.currentXLayout = QtGui.QVBoxLayout()
self.currentXLayout.setSpacing(0)
self.currentXLayout.setMargin(0)
self.currentXLayout.setObjectName(u'currentXLayout')
self.currentXLabel = QtGui.QLabel(self.displayGroupBox) self.currentXLabel = QtGui.QLabel(self.displayGroupBox)
self.currentXLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentXLabel.setObjectName(u'currentXLabel') self.currentXLabel.setObjectName(u'currentXLabel')
self.currentXLayout.addWidget(self.currentXLabel) self.displayLayout.addWidget(self.currentXLabel, 0, 0)
self.currentXValueLabel = QtGui.QLabel(self.displayGroupBox) self.currentXValueLabel = QtGui.QLabel(self.displayGroupBox)
self.currentXValueLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentXValueLabel.setObjectName(u'currentXValueLabel') self.currentXValueLabel.setObjectName(u'currentXValueLabel')
self.currentXLayout.addWidget(self.currentXValueLabel) self.displayLayout.addWidget(self.currentXValueLabel, 1, 0)
self.currentLayout.addLayout(self.currentXLayout)
self.currentYLayout = QtGui.QVBoxLayout()
self.currentYLayout.setSpacing(0)
self.currentYLayout.setMargin(0)
self.currentYLayout.setObjectName(u'currentYLayout')
self.currentYLabel = QtGui.QLabel(self.displayGroupBox) self.currentYLabel = QtGui.QLabel(self.displayGroupBox)
self.currentYLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentYLabel.setObjectName(u'currentYLabel') self.currentYLabel.setObjectName(u'currentYLabel')
self.currentYLayout.addWidget(self.currentYLabel) self.displayLayout.addWidget(self.currentYLabel, 0, 1)
self.currentYValueLabel = QtGui.QLabel(self.displayGroupBox) self.currentYValueLabel = QtGui.QLabel(self.displayGroupBox)
self.currentYValueLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentYValueLabel.setObjectName(u'currentYValueLabel') self.currentYValueLabel.setObjectName(u'currentYValueLabel')
self.currentYLayout.addWidget(self.currentYValueLabel) self.displayLayout.addWidget(self.currentYValueLabel, 1, 1)
self.currentLayout.addLayout(self.currentYLayout)
self.currentWidthLayout = QtGui.QVBoxLayout()
self.currentWidthLayout.setSpacing(0)
self.currentWidthLayout.setMargin(0)
self.currentWidthLayout.setObjectName(u'currentWidthLayout')
self.currentWidthLabel = QtGui.QLabel(self.displayGroupBox) self.currentWidthLabel = QtGui.QLabel(self.displayGroupBox)
self.currentWidthLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentWidthLabel.setObjectName(u'currentWidthLabel') self.currentWidthLabel.setObjectName(u'currentWidthLabel')
self.currentWidthLayout.addWidget(self.currentWidthLabel) self.displayLayout.addWidget(self.currentWidthLabel, 0, 2)
self.currentWidthValueLabel = QtGui.QLabel(self.displayGroupBox) self.currentWidthValueLabel = QtGui.QLabel(self.displayGroupBox)
self.currentWidthValueLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentWidthValueLabel.setObjectName(u'currentWidthValueLabel') self.currentWidthValueLabel.setObjectName(u'currentWidthValueLabel')
self.currentWidthLayout.addWidget(self.currentWidthValueLabel) self.displayLayout.addWidget(self.currentWidthValueLabel, 1, 2)
self.currentLayout.addLayout(self.currentWidthLayout)
self.currentHeightLayout = QtGui.QVBoxLayout()
self.currentHeightLayout.setSpacing(0)
self.currentHeightLayout.setMargin(0)
self.currentHeightLayout.setObjectName(u'currentHeightLayout')
self.currentHeightLabel = QtGui.QLabel(self.displayGroupBox) self.currentHeightLabel = QtGui.QLabel(self.displayGroupBox)
self.currentHeightLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.currentHeightLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentHeightLabel.setObjectName(u'currentHeightLabel') self.currentHeightLabel.setObjectName(u'currentHeightLabel')
self.currentHeightLayout.addWidget(self.currentHeightLabel) self.displayLayout.addWidget(self.currentHeightLabel, 0, 3)
self.currentHeightValueLabel = QtGui.QLabel(self.displayGroupBox) self.currentHeightValueLabel = QtGui.QLabel(self.displayGroupBox)
self.currentHeightValueLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentHeightValueLabel.setObjectName(u'Height') self.currentHeightValueLabel.setObjectName(u'Height')
self.currentHeightLayout.addWidget(self.currentHeightValueLabel) self.displayLayout.addWidget(self.currentHeightValueLabel, 1, 3)
self.currentLayout.addLayout(self.currentHeightLayout)
self.displayLayout.addLayout(self.currentLayout)
self.overrideCheckBox = QtGui.QCheckBox(self.displayGroupBox) self.overrideCheckBox = QtGui.QCheckBox(self.displayGroupBox)
self.overrideCheckBox.setObjectName(u'overrideCheckBox') self.overrideCheckBox.setObjectName(u'overrideCheckBox')
self.displayLayout.addWidget(self.overrideCheckBox) self.displayLayout.addWidget(self.overrideCheckBox, 2, 0, 1, 4)
self.generalRightLayout.addWidget(self.displayGroupBox) self.rightLayout.addWidget(self.displayGroupBox)
# Custom position # Custom position
self.customLayout = QtGui.QHBoxLayout()
self.customLayout.setSpacing(8)
self.customLayout.setMargin(0)
self.customLayout.setObjectName(u'customLayout')
self.customXLayout = QtGui.QVBoxLayout()
self.customXLayout.setSpacing(0)
self.customXLayout.setMargin(0)
self.customXLayout.setObjectName(u'customXLayout')
self.customXLabel = QtGui.QLabel(self.displayGroupBox) self.customXLabel = QtGui.QLabel(self.displayGroupBox)
self.customXLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customXLabel.setObjectName(u'customXLabel') self.customXLabel.setObjectName(u'customXLabel')
self.customXLayout.addWidget(self.customXLabel) self.displayLayout.addWidget(self.customXLabel, 3, 0)
self.customXValueEdit = ValidEdit(self.displayGroupBox) self.customXValueEdit = ValidEdit(self.displayGroupBox)
self.customXValueEdit.setObjectName(u'customXValueEdit') self.customXValueEdit.setObjectName(u'customXValueEdit')
self.customXLayout.addWidget(self.customXValueEdit) self.displayLayout.addWidget(self.customXValueEdit, 4, 0)
self.customLayout.addLayout(self.customXLayout)
self.customYLayout = QtGui.QVBoxLayout()
self.customYLayout.setSpacing(0)
self.customYLayout.setMargin(0)
self.customYLayout.setObjectName(u'customYLayout')
self.customYLabel = QtGui.QLabel(self.displayGroupBox) self.customYLabel = QtGui.QLabel(self.displayGroupBox)
self.customYLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customYLabel.setObjectName(u'customYLabel') self.customYLabel.setObjectName(u'customYLabel')
self.customYLayout.addWidget(self.customYLabel) self.displayLayout.addWidget(self.customYLabel, 3, 1)
self.customYValueEdit = ValidEdit(self.displayGroupBox) self.customYValueEdit = ValidEdit(self.displayGroupBox)
self.customYValueEdit.setObjectName(u'customYValueEdit') self.customYValueEdit.setObjectName(u'customYValueEdit')
self.customYLayout.addWidget(self.customYValueEdit) self.displayLayout.addWidget(self.customYValueEdit, 4, 1)
self.customLayout.addLayout(self.customYLayout)
self.customWidthLayout = QtGui.QVBoxLayout()
self.customWidthLayout.setSpacing(0)
self.customWidthLayout.setMargin(0)
self.customWidthLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.customWidthLayout.setObjectName(u'customWidthLayout')
self.customWidthLabel = QtGui.QLabel(self.displayGroupBox) self.customWidthLabel = QtGui.QLabel(self.displayGroupBox)
self.customWidthLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customWidthLabel.setObjectName(u'customWidthLabel') self.customWidthLabel.setObjectName(u'customWidthLabel')
self.customWidthLayout.addWidget(self.customWidthLabel) self.displayLayout.addWidget(self.customWidthLabel, 3, 2)
self.customWidthValueEdit = ValidEdit(self.displayGroupBox) self.customWidthValueEdit = ValidEdit(self.displayGroupBox)
self.customWidthValueEdit.setObjectName(u'customWidthValueEdit') self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
self.customWidthLayout.addWidget(self.customWidthValueEdit) self.displayLayout.addWidget(self.customWidthValueEdit, 4, 2)
self.customLayout.addLayout(self.customWidthLayout)
self.customHeightLayout = QtGui.QVBoxLayout()
self.customHeightLayout.setSpacing(0)
self.customHeightLayout.setMargin(0)
self.customHeightLayout.setObjectName(u'customHeightLayout')
self.customHeightLabel = QtGui.QLabel(self.displayGroupBox) self.customHeightLabel = QtGui.QLabel(self.displayGroupBox)
self.customHeightLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customHeightLabel.setObjectName(u'customHeightLabel') self.customHeightLabel.setObjectName(u'customHeightLabel')
self.customHeightLayout.addWidget(self.customHeightLabel) self.displayLayout.addWidget(self.customHeightLabel, 3, 3)
self.customHeightValueEdit = ValidEdit(self.displayGroupBox) self.customHeightValueEdit = ValidEdit(self.displayGroupBox)
self.customHeightValueEdit.setObjectName(u'customHeightValueEdit') self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
self.customHeightLayout.addWidget(self.customHeightValueEdit) self.displayLayout.addWidget(self.customHeightValueEdit, 4, 3)
self.customLayout.addLayout(self.customHeightLayout) self.rightLayout.addWidget(self.displayGroupBox)
self.displayLayout.addLayout(self.customLayout) self.rightLayout.addStretch()
# Bottom spacer
self.generalRightSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.generalRightLayout.addItem(self.generalRightSpacer)
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.overrideCheckBox, QtCore.QObject.connect(self.overrideCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled) QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled)
@ -329,6 +234,7 @@ class GeneralTab(SettingsTab):
""" """
Translate the general settings tab to the currently selected language Translate the general settings tab to the currently selected language
""" """
self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General')
self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab', self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab',
'Monitors')) 'Monitors'))
self.monitorLabel.setText(translate('OpenLP.GeneralTab', self.monitorLabel.setText(translate('OpenLP.GeneralTab',
@ -389,11 +295,11 @@ class GeneralTab(SettingsTab):
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
for screen in self.screens.screen_list: for screen in self.screens.screen_list:
screen_name = unicode(translate('OpenLP.GeneralTab', 'Screen %d')) \ screen_name = u'%s %d' % (translate('OpenLP.GeneralTab', 'Screen'),
% (screen[u'number'] + 1) screen[u'number'] + 1)
if screen[u'primary']: if screen[u'primary']:
screen_name = unicode(translate('OpenLP.GeneralTab', screen_name = u'%s (%s)' % (screen_name,
'%s (primary)')) % screen_name translate('OpenLP.GeneralTab', 'primary'))
self.monitorComboBox.addItem(screen_name) self.monitorComboBox.addItem(screen_name)
self.numberEdit.setText(unicode(settings.value( self.numberEdit.setText(unicode(settings.value(
u'ccli number', QtCore.QVariant(u'')).toString())) u'ccli number', QtCore.QVariant(u'')).toString()))

View File

@ -31,7 +31,8 @@ import os
from PyQt4 import QtCore, QtGui, QtWebKit from PyQt4 import QtCore, QtGui, QtWebKit
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
translate
from openlp.core.ui import HideMode from openlp.core.ui import HideMode
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -101,7 +102,7 @@ class MainDisplay(DisplayWidget):
self.isLive = live self.isLive = live
self.alertTab = None self.alertTab = None
self.hideMode = None self.hideMode = None
self.setWindowTitle(u'OpenLP Display') self.retranslateUi()
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
QtCore.Qt.WindowStaysOnTopHint) QtCore.Qt.WindowStaysOnTopHint)
@ -111,6 +112,12 @@ class MainDisplay(DisplayWidget):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
def retranslateUi(self):
"""
Setup the interface translation strings.
"""
self.setWindowTitle(translate('OpenLP.MainDisplay', 'OpenLP Display'))
def setup(self): def setup(self):
""" """
Set up and build the output screen Set up and build the output screen

View File

@ -66,25 +66,10 @@ class Ui_MainWindow(object):
MainWindow.setObjectName(u'MainWindow') MainWindow.setObjectName(u'MainWindow')
MainWindow.resize(self.settingsmanager.width, MainWindow.resize(self.settingsmanager.width,
self.settingsmanager.height) self.settingsmanager.height)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, MainWindow.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
QtGui.QSizePolicy.Expanding) MainWindow.setDockNestingEnabled(True)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
MainWindow.setWindowIcon(MainIcon)
self.setDockNestingEnabled(True)
# Set up the main container, which contains all the other form widgets. # Set up the main container, which contains all the other form widgets.
self.MainContent = QtGui.QWidget(MainWindow) self.MainContent = QtGui.QWidget(MainWindow)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.MainContent.sizePolicy().hasHeightForWidth())
self.MainContent.setSizePolicy(sizePolicy)
self.MainContent.setObjectName(u'MainContent') self.MainContent.setObjectName(u'MainContent')
self.MainContentLayout = QtGui.QHBoxLayout(self.MainContent) self.MainContentLayout = QtGui.QHBoxLayout(self.MainContent)
self.MainContentLayout.setSpacing(0) self.MainContentLayout.setSpacing(0)
@ -93,7 +78,6 @@ class Ui_MainWindow(object):
MainWindow.setCentralWidget(self.MainContent) MainWindow.setCentralWidget(self.MainContent)
self.ControlSplitter = QtGui.QSplitter(self.MainContent) self.ControlSplitter = QtGui.QSplitter(self.MainContent)
self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal) self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal)
self.ControlSplitter.setOpaqueResize(False)
self.ControlSplitter.setObjectName(u'ControlSplitter') self.ControlSplitter.setObjectName(u'ControlSplitter')
self.MainContentLayout.addWidget(self.ControlSplitter) self.MainContentLayout.addWidget(self.ControlSplitter)
# Create slide controllers # Create slide controllers
@ -109,7 +93,6 @@ class Ui_MainWindow(object):
self.liveController.Panel.setVisible(liveVisible) self.liveController.Panel.setVisible(liveVisible)
# Create menu # Create menu
self.MenuBar = QtGui.QMenuBar(MainWindow) self.MenuBar = QtGui.QMenuBar(MainWindow)
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
self.MenuBar.setObjectName(u'MenuBar') self.MenuBar.setObjectName(u'MenuBar')
self.FileMenu = QtGui.QMenu(self.MenuBar) self.FileMenu = QtGui.QMenu(self.MenuBar)
self.FileMenu.setObjectName(u'FileMenu') self.FileMenu.setObjectName(u'FileMenu')
@ -147,38 +130,33 @@ class Ui_MainWindow(object):
self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE) self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
self.MediaManagerDock.setMinimumWidth( self.MediaManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_left) self.settingsmanager.mainwindow_left)
self.MediaManagerContents = QtGui.QWidget(MainWindow)
self.MediaManagerContents.setObjectName(u'MediaManagerContents')
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0)
self.MediaManagerLayout.setObjectName(u'MediaManagerLayout')
# Create the media toolbox # Create the media toolbox
self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents) self.MediaToolBox = QtGui.QToolBox(self.MediaManagerDock)
self.MediaToolBox.setObjectName(u'MediaToolBox') self.MediaToolBox.setObjectName(u'MediaToolBox')
self.MediaManagerLayout.addWidget(self.MediaToolBox) self.MediaManagerDock.setWidget(self.MediaToolBox)
self.MediaManagerDock.setWidget(self.MediaManagerContents) MainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea,
MainWindow.addDockWidget( self.MediaManagerDock)
QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
# Create the service manager # Create the service manager
self.ServiceManagerDock = OpenLPDockWidget( self.ServiceManagerDock = OpenLPDockWidget(
MainWindow, u'ServiceManagerDock', MainWindow, u'ServiceManagerDock',
build_icon(u':/system/system_servicemanager.png')) build_icon(u':/system/system_servicemanager.png'))
self.ServiceManagerDock.setMinimumWidth( self.ServiceManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right) self.settingsmanager.mainwindow_right)
self.ServiceManagerContents = ServiceManager(self) self.ServiceManagerContents = ServiceManager(MainWindow)
self.ServiceManagerDock.setWidget(self.ServiceManagerContents) self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
MainWindow.addDockWidget( MainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock) self.ServiceManagerDock)
# Create the theme manager # Create the theme manager
self.ThemeManagerDock = OpenLPDockWidget( self.ThemeManagerDock = OpenLPDockWidget(
MainWindow, u'ThemeManagerDock', MainWindow, u'ThemeManagerDock',
build_icon(u':/system/system_thememanager.png')) build_icon(u':/system/system_thememanager.png'))
self.ThemeManagerDock.setMinimumWidth( self.ThemeManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right) self.settingsmanager.mainwindow_right)
self.ThemeManagerContents = ThemeManager(self) self.ThemeManagerContents = ThemeManager(MainWindow)
self.ThemeManagerContents.setObjectName(u'ThemeManagerContents')
self.ThemeManagerDock.setWidget(self.ThemeManagerContents) self.ThemeManagerDock.setWidget(self.ThemeManagerContents)
MainWindow.addDockWidget( MainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock) self.ThemeManagerDock)
# Create the menu items # Create the menu items
self.FileNewItem = QtGui.QAction(MainWindow) self.FileNewItem = QtGui.QAction(MainWindow)
self.FileNewItem.setIcon(build_icon(u':/general/general_new.png')) self.FileNewItem.setIcon(build_icon(u':/general/general_new.png'))
@ -275,9 +253,12 @@ class Ui_MainWindow(object):
self.AutoLanguageItem.setCheckable(True) self.AutoLanguageItem.setCheckable(True)
MainWindow.actionList.add_action(self.AutoLanguageItem, u'Settings') MainWindow.actionList.add_action(self.AutoLanguageItem, u'Settings')
self.LanguageGroup = QtGui.QActionGroup(MainWindow) self.LanguageGroup = QtGui.QActionGroup(MainWindow)
self.LanguageGroup.setExclusive(True)
self.LanguageGroup.setObjectName(u'LanguageGroup')
self.AutoLanguageItem.setChecked(LanguageManager.auto_language)
self.LanguageGroup.setDisabled(LanguageManager.auto_language)
qmList = LanguageManager.get_qm_list() qmList = LanguageManager.get_qm_list()
savedLanguage = LanguageManager.get_language() savedLanguage = LanguageManager.get_language()
self.AutoLanguageItem.setChecked(LanguageManager.auto_language)
for key in sorted(qmList.keys()): for key in sorted(qmList.keys()):
languageItem = QtGui.QAction(MainWindow) languageItem = QtGui.QAction(MainWindow)
languageItem.setObjectName(key) languageItem.setObjectName(key)
@ -285,7 +266,6 @@ class Ui_MainWindow(object):
if qmList[key] == savedLanguage: if qmList[key] == savedLanguage:
languageItem.setChecked(True) languageItem.setChecked(True)
add_actions(self.LanguageGroup, [languageItem]) add_actions(self.LanguageGroup, [languageItem])
self.LanguageGroup.setDisabled(LanguageManager.auto_language)
self.SettingsShortcutsItem = QtGui.QAction(MainWindow) self.SettingsShortcutsItem = QtGui.QAction(MainWindow)
self.SettingsShortcutsItem.setIcon( self.SettingsShortcutsItem.setIcon(
build_icon(u':/system/system_configure_shortcuts.png')) build_icon(u':/system/system_configure_shortcuts.png'))
@ -334,15 +314,13 @@ class Ui_MainWindow(object):
add_actions(self.SettingsMenu, (self.SettingsPluginListItem, add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
self.SettingsLanguageMenu.menuAction(), None, self.SettingsLanguageMenu.menuAction(), None,
self.SettingsShortcutsItem, self.SettingsConfigureItem)) self.SettingsShortcutsItem, self.SettingsConfigureItem))
add_actions(self.ToolsMenu, add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None))
(self.ToolsAddToolItem, None)) add_actions(self.HelpMenu, (self.HelpDocumentationItem,
add_actions(self.HelpMenu, self.HelpOnlineHelpItem, None, self.HelpWebSiteItem,
(self.HelpDocumentationItem, self.HelpOnlineHelpItem, None, self.HelpAboutItem))
self.HelpWebSiteItem, self.HelpAboutItem)) add_actions(self.MenuBar, (self.FileMenu.menuAction(),
add_actions(self.MenuBar, self.ViewMenu.menuAction(), self.ToolsMenu.menuAction(),
(self.FileMenu.menuAction(), self.ViewMenu.menuAction(), self.SettingsMenu.menuAction(), self.HelpMenu.menuAction()))
self.ToolsMenu.menuAction(), self.SettingsMenu.menuAction(),
self.HelpMenu.menuAction()))
# Initialise the translation # Initialise the translation
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
self.MediaToolBox.setCurrentIndex(0) self.MediaToolBox.setCurrentIndex(0)
@ -857,7 +835,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QVariant(True)).toBool(): QtCore.QVariant(True)).toBool():
ret = QtGui.QMessageBox.question(self, ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Close OpenLP'), translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'), translate('OpenLP.MainWindow',
'Are you sure you want to close OpenLP?'),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No),
@ -1059,4 +1038,4 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.recentFiles.insert(0, QtCore.QString(filename)) self.recentFiles.insert(0, QtCore.QString(filename))
while self.recentFiles.count() > maxRecentFiles: while self.recentFiles.count() > maxRecentFiles:
# Don't care what API says takeLast works, removeLast doesn't! # Don't care what API says takeLast works, removeLast doesn't!
self.recentFiles.takeLast() self.recentFiles.takeLast()

View File

@ -31,69 +31,41 @@ class Ui_PluginViewDialog(object):
def setupUi(self, pluginViewDialog): def setupUi(self, pluginViewDialog):
pluginViewDialog.setObjectName(u'pluginViewDialog') pluginViewDialog.setObjectName(u'pluginViewDialog')
pluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal) pluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal)
pluginViewDialog.resize(554, 344)
self.pluginLayout = QtGui.QVBoxLayout(pluginViewDialog) self.pluginLayout = QtGui.QVBoxLayout(pluginViewDialog)
self.pluginLayout.setSpacing(8)
self.pluginLayout.setMargin(8)
self.pluginLayout.setObjectName(u'pluginLayout') self.pluginLayout.setObjectName(u'pluginLayout')
self.listLayout = QtGui.QHBoxLayout() self.listLayout = QtGui.QHBoxLayout()
self.listLayout.setSpacing(8)
self.listLayout.setObjectName(u'listLayout') self.listLayout.setObjectName(u'listLayout')
self.pluginListWidget = QtGui.QListWidget(pluginViewDialog) self.pluginListWidget = QtGui.QListWidget(pluginViewDialog)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.pluginListWidget.sizePolicy().hasHeightForWidth())
self.pluginListWidget.setSizePolicy(sizePolicy)
self.pluginListWidget.setMaximumSize(QtCore.QSize(192, 16777215))
self.pluginListWidget.setObjectName(u'pluginListWidget') self.pluginListWidget.setObjectName(u'pluginListWidget')
self.listLayout.addWidget(self.pluginListWidget) self.listLayout.addWidget(self.pluginListWidget)
self.pluginInfoGroupBox = QtGui.QGroupBox(pluginViewDialog) self.pluginInfoGroupBox = QtGui.QGroupBox(pluginViewDialog)
self.pluginInfoGroupBox.setAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.pluginInfoGroupBox.setFlat(False)
self.pluginInfoGroupBox.setObjectName(u'pluginInfoGroupBox') self.pluginInfoGroupBox.setObjectName(u'pluginInfoGroupBox')
self.pluginInfoLayout = QtGui.QFormLayout(self.pluginInfoGroupBox) self.pluginInfoLayout = QtGui.QFormLayout(self.pluginInfoGroupBox)
self.pluginInfoLayout.setMargin(8)
self.pluginInfoLayout.setSpacing(8)
self.pluginInfoLayout.setObjectName(u'pluginInfoLayout') self.pluginInfoLayout.setObjectName(u'pluginInfoLayout')
self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.versionLabel.setObjectName(u'versionLabel')
self.pluginInfoLayout.setWidget(
1, QtGui.QFormLayout.LabelRole, self.versionLabel)
self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.versionNumberLabel.setObjectName(u'versionNumberLabel')
self.pluginInfoLayout.setWidget(
1, QtGui.QFormLayout.FieldRole, self.versionNumberLabel)
self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.aboutLabel.setObjectName(u'aboutLabel')
self.pluginInfoLayout.setWidget(
2, QtGui.QFormLayout.LabelRole, self.aboutLabel)
self.statusLabel = QtGui.QLabel(self.pluginInfoGroupBox) self.statusLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.statusLabel.setObjectName(u'statusLabel') self.statusLabel.setObjectName(u'statusLabel')
self.pluginInfoLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.statusLabel)
self.statusComboBox = QtGui.QComboBox(self.pluginInfoGroupBox) self.statusComboBox = QtGui.QComboBox(self.pluginInfoGroupBox)
self.statusComboBox.addItems((u'', u''))
self.statusComboBox.setObjectName(u'statusComboBox') self.statusComboBox.setObjectName(u'statusComboBox')
self.statusComboBox.addItem(QtCore.QString()) self.pluginInfoLayout.addRow(self.statusLabel, self.statusComboBox)
self.statusComboBox.addItem(QtCore.QString()) self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.pluginInfoLayout.setWidget( self.versionLabel.setObjectName(u'versionLabel')
0, QtGui.QFormLayout.FieldRole, self.statusComboBox) self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.versionNumberLabel.setObjectName(u'versionNumberLabel')
self.pluginInfoLayout.addRow(self.versionLabel, self.versionNumberLabel)
self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.aboutLabel.setObjectName(u'aboutLabel')
self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox) self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox)
self.aboutTextBrowser.setTextInteractionFlags( self.aboutTextBrowser.setTextInteractionFlags(
QtCore.Qt.LinksAccessibleByMouse) QtCore.Qt.LinksAccessibleByMouse)
self.aboutTextBrowser.setObjectName(u'aboutTextBrowser') self.aboutTextBrowser.setObjectName(u'aboutTextBrowser')
self.pluginInfoLayout.setWidget( self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
2, QtGui.QFormLayout.FieldRole, self.aboutTextBrowser)
self.listLayout.addWidget(self.pluginInfoGroupBox) self.listLayout.addWidget(self.pluginInfoGroupBox)
self.pluginLayout.addLayout(self.listLayout) self.pluginLayout.addLayout(self.listLayout)
self.pluginListButtonBox = QtGui.QDialogButtonBox(pluginViewDialog) self.pluginListButtonBox = QtGui.QDialogButtonBox(pluginViewDialog)
self.pluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.pluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.pluginListButtonBox.setObjectName(u'pluginListButtonBox') self.pluginListButtonBox.setObjectName(u'pluginListButtonBox')
self.pluginLayout.addWidget(self.pluginListButtonBox) self.pluginLayout.addWidget(self.pluginListButtonBox)
self.versionNumberLabel.setText(u'')
self.retranslateUi(pluginViewDialog) self.retranslateUi(pluginViewDialog)
QtCore.QObject.connect(self.pluginListButtonBox, QtCore.QObject.connect(self.pluginListButtonBox,
QtCore.SIGNAL(u'accepted()'), pluginViewDialog.close) QtCore.SIGNAL(u'accepted()'), pluginViewDialog.close)

View File

@ -67,23 +67,24 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
# sometimes when it's loaded from the config, it isn't cast to int. # sometimes when it's loaded from the config, it isn't cast to int.
plugin.status = int(plugin.status) plugin.status = int(plugin.status)
# Set the little status text in brackets next to the plugin name. # Set the little status text in brackets next to the plugin name.
status_text = unicode( if plugin.status == PluginStatus.Disabled:
translate('OpenLP.PluginForm', '%s (Inactive)'))
if plugin.status == PluginStatus.Active:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Active)'))
elif plugin.status == PluginStatus.Inactive:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
elif plugin.status == PluginStatus.Disabled:
status_text = unicode( status_text = unicode(
translate('OpenLP.PluginForm', '%s (Disabled)')) translate('OpenLP.PluginForm', '%s (Disabled)'))
elif plugin.status == PluginStatus.Active:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Active)'))
else:
# PluginStatus.Inactive
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
name_string = plugin.getString(StringContent.Name) name_string = plugin.getString(StringContent.Name)
item.setText(status_text % name_string[u'singular']) item.setText(status_text % name_string[u'singular'])
# If the plugin has an icon, set it! # If the plugin has an icon, set it!
if plugin.icon: if plugin.icon:
item.setIcon(plugin.icon) item.setIcon(plugin.icon)
self.pluginListWidget.addItem(item) self.pluginListWidget.addItem(item)
self.pluginListWidget.setFixedWidth(
self.pluginListWidget.sizeHint().width())
def _clearDetails(self): def _clearDetails(self):
self.statusComboBox.setCurrentIndex(-1) self.statusComboBox.setCurrentIndex(-1)

View File

@ -26,54 +26,37 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate, build_icon
class Ui_ServiceItemEditDialog(object): class Ui_ServiceItemEditDialog(object):
def setupUi(self, serviceItemEditDialog): def setupUi(self, serviceItemEditDialog):
serviceItemEditDialog.setObjectName(u'serviceItemEditDialog') serviceItemEditDialog.setObjectName(u'serviceItemEditDialog')
serviceItemEditDialog.resize(386, 272) self.dialogLayout = QtGui.QGridLayout(serviceItemEditDialog)
self.layoutWidget = QtGui.QWidget(serviceItemEditDialog) self.dialogLayout.setObjectName(u'dialogLayout')
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 351, 241)) self.listWidget = QtGui.QListWidget(serviceItemEditDialog)
self.layoutWidget.setObjectName(u'layoutWidget')
self.outerLayout = QtGui.QVBoxLayout(self.layoutWidget)
self.outerLayout.setObjectName(u'outerLayout')
self.topLayout = QtGui.QHBoxLayout()
self.topLayout.setObjectName(u'topLayout')
self.listWidget = QtGui.QListWidget(self.layoutWidget)
self.listWidget.setAlternatingRowColors(True) self.listWidget.setAlternatingRowColors(True)
self.listWidget.setObjectName(u'listWidget') self.listWidget.setObjectName(u'listWidget')
self.topLayout.addWidget(self.listWidget) self.dialogLayout.addWidget(self.listWidget, 0, 0)
self.buttonLayout = QtGui.QVBoxLayout() self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout') self.buttonLayout.setObjectName(u'buttonLayout')
self.deleteButton = QtGui.QPushButton(self.layoutWidget) self.deleteButton = QtGui.QPushButton(serviceItemEditDialog)
self.deleteButton.setObjectName(u'deleteButton') self.deleteButton.setObjectName(u'deleteButton')
self.buttonLayout.addWidget(self.deleteButton) self.buttonLayout.addWidget(self.deleteButton)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, self.buttonLayout.addStretch()
QtGui.QSizePolicy.Expanding) self.upButton = QtGui.QPushButton(serviceItemEditDialog)
self.buttonLayout.addItem(spacerItem) self.upButton.setIcon(build_icon(u':/services/service_up.png'))
self.upButton = QtGui.QPushButton(self.layoutWidget)
self.upButton.setText(u'')
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/services/service_up.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.upButton.setIcon(icon)
self.upButton.setObjectName(u'upButton') self.upButton.setObjectName(u'upButton')
self.buttonLayout.addWidget(self.upButton) self.buttonLayout.addWidget(self.upButton)
self.downButton = QtGui.QPushButton(self.layoutWidget) self.downButton = QtGui.QPushButton(serviceItemEditDialog)
self.downButton.setText(u'') self.downButton.setIcon(build_icon(u':/services/service_down.png'))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/services/service_down.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.downButton.setIcon(icon)
self.downButton.setObjectName(u'downButton') self.downButton.setObjectName(u'downButton')
self.buttonLayout.addWidget(self.downButton) self.buttonLayout.addWidget(self.downButton)
self.topLayout.addLayout(self.buttonLayout) self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
self.outerLayout.addLayout(self.topLayout) self.buttonBox = QtGui.QDialogButtonBox(serviceItemEditDialog)
self.buttonBox = QtGui.QDialogButtonBox(self.layoutWidget) self.buttonBox.setStandardButtons(
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.outerLayout.addWidget(self.buttonBox) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(serviceItemEditDialog) self.retranslateUi(serviceItemEditDialog)
QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog) QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog)
@ -82,4 +65,4 @@ class Ui_ServiceItemEditDialog(object):
serviceItemEditDialog.setWindowTitle( serviceItemEditDialog.setWindowTitle(
translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item')) translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm', self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm',
'Delete')) 'Delete'))

View File

@ -118,7 +118,6 @@ class ServiceManager(QtGui.QWidget):
self.layout = QtGui.QVBoxLayout(self) self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0) self.layout.setSpacing(0)
self.layout.setMargin(0) self.layout.setMargin(0)
self.expandTabs = False
# Create the top toolbar # Create the top toolbar
self.toolbar = OpenLPToolbar(self) self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
@ -140,13 +139,16 @@ class ServiceManager(QtGui.QWidget):
self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager', self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
'Theme:'), self) 'Theme:'), self)
self.themeLabel.setMargin(3) self.themeLabel.setMargin(3)
self.themeLabel.setObjectName(u'themeLabel')
self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel) self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel)
self.themeComboBox = QtGui.QComboBox(self.toolbar) self.themeComboBox = QtGui.QComboBox(self.toolbar)
self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager', self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager',
'Select a theme for the service')) 'Select a theme for the service'))
self.themeComboBox.setSizeAdjustPolicy( self.themeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QComboBox.AdjustToContents) QtGui.QSizePolicy.Fixed)
self.themeComboBox.setObjectName(u'themeComboBox')
self.toolbar.addToolbarWidget(u'ThemeWidget', self.themeComboBox) self.toolbar.addToolbarWidget(u'ThemeWidget', self.themeComboBox)
self.toolbar.setObjectName(u'toolbar')
self.layout.addWidget(self.toolbar) self.layout.addWidget(self.toolbar)
# Create the service manager list # Create the service manager list
self.serviceManagerList = ServiceManagerList(self) self.serviceManagerList = ServiceManagerList(self)
@ -216,6 +218,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Collapse all the service items.'), 'Collapse all the service items.'),
self.onCollapseAll) self.onCollapseAll)
self.orderToolbar.setObjectName(u'orderToolbar')
self.layout.addWidget(self.orderToolbar) self.layout.addWidget(self.orderToolbar)
# Connect up our signals and slots # Connect up our signals and slots
QtCore.QObject.connect(self.themeComboBox, QtCore.QObject.connect(self.themeComboBox,
@ -304,7 +307,7 @@ class ServiceManager(QtGui.QWidget):
Setter for service file. Setter for service file.
""" """
self._fileName = unicode(fileName) self._fileName = unicode(fileName)
self.parent.setServiceModified(self.isModified, self.shortFileName()) self.parent.setServiceModified(self.isModified(), self.shortFileName())
QtCore.QSettings(). \ QtCore.QSettings(). \
setValue(u'service/last file',QtCore.QVariant(fileName)) setValue(u'service/last file',QtCore.QVariant(fileName))
@ -367,7 +370,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', 'Open File'), translate('OpenLP.ServiceManager', 'Open File'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection), SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz) (*.osz)'))) 'OpenLP Service Files (*.osz)')))
if not fileName: if not fileName:
return False return False
SettingsManager.set_last_dir(self.parent.serviceSettingsSection, SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
@ -457,7 +460,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', 'Save Service'), translate('OpenLP.ServiceManager', 'Save Service'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection), SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz) (*.osz)'))) 'OpenLP Service Files (*.osz)')))
if not fileName: if not fileName:
return False return False
if os.path.splitext(fileName)[1] == u'': if os.path.splitext(fileName)[1] == u'':
@ -682,7 +685,7 @@ class ServiceManager(QtGui.QWidget):
# Top Item was selected so set the last one # Top Item was selected so set the last one
if setLastItem: if setLastItem:
lastItem.setSelected(True) lastItem.setSelected(True)
self.isModified = True self.setModified(True)
def onMoveSelectionDown(self): def onMoveSelectionDown(self):
""" """
@ -705,7 +708,7 @@ class ServiceManager(QtGui.QWidget):
serviceIterator += 1 serviceIterator += 1
if setSelected: if setSelected:
firstItem.setSelected(True) firstItem.setSelected(True)
self.isModified = True self.setModified(True)
def onCollapseAll(self): def onCollapseAll(self):
""" """
@ -749,7 +752,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(0, temp) self.serviceItems.insert(0, temp)
self.repaintServiceList(0, count) self.repaintServiceList(0, count)
self.isModified = True self.setModified(True)
def onServiceUp(self): def onServiceUp(self):
""" """
@ -982,8 +985,8 @@ class ServiceManager(QtGui.QWidget):
u'expanded':expand}) u'expanded':expand})
self.repaintServiceList(len(self.serviceItems) + 1, 0) self.repaintServiceList(len(self.serviceItems) + 1, 0)
else: else:
self.serviceItems.insert(self.dropPosition, {u'service_item': item, self.serviceItems.insert(self.dropPosition,
u'order': self.dropPosition, {u'service_item': item, u'order': self.dropPosition,
u'expanded':expand}) u'expanded':expand})
self.repaintServiceList(self.dropPosition, 0) self.repaintServiceList(self.dropPosition, 0)
# if rebuilding list make sure live is fixed. # if rebuilding list make sure live is fixed.

View File

@ -30,24 +30,19 @@ from openlp.core.lib import translate
class Ui_ServiceNoteEdit(object): class Ui_ServiceNoteEdit(object):
def setupUi(self, serviceNoteEdit): def setupUi(self, serviceNoteEdit):
serviceNoteEdit.setObjectName(u'serviceNoteEdit') serviceNoteEdit.setObjectName(u'serviceNoteEdit')
serviceNoteEdit.resize(400, 243) self.dialogLayout = QtGui.QVBoxLayout(serviceNoteEdit)
self.widget = QtGui.QWidget(serviceNoteEdit) self.dialogLayout.setObjectName(u'verticalLayout')
self.widget.setGeometry(QtCore.QRect(20, 10, 361, 223)) self.textEdit = QtGui.QTextEdit(serviceNoteEdit)
self.widget.setObjectName(u'widget')
self.verticalLayout = QtGui.QVBoxLayout(self.widget)
self.verticalLayout.setObjectName(u'verticalLayout')
self.textEdit = QtGui.QTextEdit(self.widget)
self.textEdit.setObjectName(u'textEdit') self.textEdit.setObjectName(u'textEdit')
self.verticalLayout.addWidget(self.textEdit) self.dialogLayout.addWidget(self.textEdit)
self.buttonBox = QtGui.QDialogButtonBox(self.widget) self.buttonBox = QtGui.QDialogButtonBox(serviceNoteEdit)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.buttonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(serviceNoteEdit) self.retranslateUi(serviceNoteEdit)
QtCore.QMetaObject.connectSlotsByName(serviceNoteEdit) QtCore.QMetaObject.connectSlotsByName(serviceNoteEdit)
def retranslateUi(self, serviceNoteEdit): def retranslateUi(self, serviceNoteEdit):
serviceNoteEdit.setWindowTitle( serviceNoteEdit.setWindowTitle(
translate('OpenLP.ServiceNoteForm', 'Service Item Notes')) translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))

View File

@ -31,32 +31,21 @@ from openlp.core.lib import translate, build_icon
class Ui_SettingsDialog(object): class Ui_SettingsDialog(object):
def setupUi(self, settingsDialog): def setupUi(self, settingsDialog):
settingsDialog.setObjectName(u'settingsDialog') settingsDialog.setObjectName(u'settingsDialog')
settingsDialog.resize(724, 502) settingsDialog.resize(700, 300)
settingsDialog.setWindowIcon( settingsDialog.setWindowIcon(
build_icon(u':/system/system_settings.png')) build_icon(u':/system/system_settings.png'))
self.settingsLayout = QtGui.QVBoxLayout(settingsDialog) self.settingsLayout = QtGui.QVBoxLayout(settingsDialog)
self.settingsLayout.setSpacing(8) margins = self.settingsLayout.contentsMargins()
self.settingsLayout.setMargin(8)
self.settingsLayout.setObjectName(u'settingsLayout') self.settingsLayout.setObjectName(u'settingsLayout')
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 = QtGui.QDialogButtonBox(settingsDialog)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.buttonBox.sizePolicy().hasHeightForWidth())
self.buttonBox.setSizePolicy(sizePolicy)
self.buttonBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons( self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.settingsLayout.addWidget(self.buttonBox) self.settingsLayout.addWidget(self.buttonBox)
self.retranslateUi(settingsDialog) self.retranslateUi(settingsDialog)
self.settingsTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), settingsDialog.accept) QtCore.SIGNAL(u'accepted()'), settingsDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.QObject.connect(self.buttonBox,
@ -65,4 +54,4 @@ class Ui_SettingsDialog(object):
def retranslateUi(self, settingsDialog): def retranslateUi(self, settingsDialog):
settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm', settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm',
'Configure OpenLP')) 'Configure OpenLP'))

View File

@ -98,4 +98,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Run any post-setup code for the tabs on the form Run any post-setup code for the tabs on the form
""" """
for tabIndex in range(0, self.settingsTabWidget.count()): for tabIndex in range(0, self.settingsTabWidget.count()):
self.settingsTabWidget.widget(tabIndex).postSetUp() self.settingsTabWidget.widget(tabIndex).postSetUp()

View File

@ -31,83 +31,57 @@ from openlp.core.lib import translate, build_icon
class Ui_ShortcutListDialog(object): class Ui_ShortcutListDialog(object):
def setupUi(self, shortcutListDialog): def setupUi(self, shortcutListDialog):
shortcutListDialog.setObjectName(u'shortcutListDialog') shortcutListDialog.setObjectName(u'shortcutListDialog')
shortcutListDialog.resize(500, 438) self.dialogLayout = QtGui.QVBoxLayout(shortcutListDialog)
self.shortcutListLayout = QtGui.QVBoxLayout(shortcutListDialog) self.dialogLayout.setObjectName(u'dialogLayout')
self.shortcutListLayout.setSpacing(8) self.treeWidget = QtGui.QTreeWidget(shortcutListDialog)
self.shortcutListLayout.setMargin(8) self.treeWidget.setAlternatingRowColors(True)
self.shortcutListLayout.setObjectName(u'shortcutListLayout') self.treeWidget.setObjectName(u'treeWidget')
self.shortcutListTreeWidget = QtGui.QTreeWidget(shortcutListDialog) self.treeWidget.setColumnCount(2)
self.shortcutListTreeWidget.setAlternatingRowColors(True) self.dialogLayout.addWidget(self.treeWidget)
self.shortcutListTreeWidget.setObjectName(u'shortcutListTreeWidget') self.defaultButton = QtGui.QRadioButton(shortcutListDialog)
self.shortcutListTreeWidget.setColumnCount(2) self.defaultButton.setChecked(True)
self.shortcutListTreeWidget.setSelectionBehavior( self.defaultButton.setObjectName(u'defaultButton')
QtGui.QAbstractItemView.SelectRows) self.dialogLayout.addWidget(self.defaultButton)
self.shortcutListLayout.addWidget(self.shortcutListTreeWidget) self.customLayout = QtGui.QHBoxLayout()
self.shortcutLayout = QtGui.QVBoxLayout() self.customLayout.setObjectName(u'customLayout')
self.shortcutLayout.setSpacing(8) self.customButton = QtGui.QRadioButton(shortcutListDialog)
self.shortcutLayout.setContentsMargins(0, -1, -1, -1) self.customButton.setObjectName(u'customButton')
self.shortcutLayout.setObjectName(u'shortcutLayout') self.customLayout.addWidget(self.customButton)
self.defaultRadioButton = QtGui.QRadioButton(shortcutListDialog) self.shortcutButton = QtGui.QPushButton(shortcutListDialog)
self.defaultRadioButton.setChecked(True) self.shortcutButton.setIcon(
self.defaultRadioButton.setObjectName(u'defaultRadioButton')
self.shortcutLayout.addWidget(self.defaultRadioButton)
self.customShortcutLayout = QtGui.QHBoxLayout()
self.customShortcutLayout.setSpacing(8)
self.customShortcutLayout.setObjectName(u'customShortcutLayout')
self.customRadioButton = QtGui.QRadioButton(shortcutListDialog)
self.customRadioButton.setObjectName(u'customRadioButton')
self.customShortcutLayout.addWidget(self.customRadioButton)
self.shortcutPushButton = QtGui.QPushButton(shortcutListDialog)
self.shortcutPushButton.setMinimumSize(QtCore.QSize(84, 0))
self.shortcutPushButton.setIcon(
build_icon(u':/system/system_configure_shortcuts.png')) build_icon(u':/system/system_configure_shortcuts.png'))
self.shortcutPushButton.setCheckable(True) self.shortcutButton.setCheckable(True)
self.shortcutPushButton.setChecked(False) self.shortcutButton.setObjectName(u'shortcutButton')
self.shortcutPushButton.setObjectName(u'shortcutPushButton') self.customLayout.addWidget(self.shortcutButton)
self.customShortcutLayout.addWidget(self.shortcutPushButton) self.clearShortcutButton = QtGui.QToolButton(shortcutListDialog)
self.clearShortcutToolButton = QtGui.QToolButton(shortcutListDialog) self.clearShortcutButton.setIcon(
self.clearShortcutToolButton.setMinimumSize(QtCore.QSize(0, 16))
self.clearShortcutToolButton.setText(u'')
self.clearShortcutToolButton.setIcon(
build_icon(u':/system/clear_shortcut.png')) build_icon(u':/system/clear_shortcut.png'))
self.clearShortcutToolButton.setObjectName(u'clearShortcutToolButton') self.clearShortcutButton.setAutoRaise(True)
self.customShortcutLayout.addWidget(self.clearShortcutToolButton) self.clearShortcutButton.setObjectName(u'clearShortcutButton')
self.customShortcutSpacer = QtGui.QSpacerItem(40, 20, self.customLayout.addWidget(self.clearShortcutButton)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.customLayout.addStretch()
self.customShortcutLayout.addItem(self.customShortcutSpacer) self.dialogLayout.addLayout(self.customLayout)
self.shortcutLayout.addLayout(self.customShortcutLayout) self.buttonBox = QtGui.QDialogButtonBox(shortcutListDialog)
self.shortcutListLayout.addLayout(self.shortcutLayout) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
self.shortcutListButtonBox = QtGui.QDialogButtonBox(shortcutListDialog) QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Reset)
self.shortcutListButtonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setObjectName(u'buttonBox')
self.shortcutListButtonBox.setStandardButtons( self.dialogLayout.addWidget(self.buttonBox)
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok |
QtGui.QDialogButtonBox.Reset)
self.shortcutListButtonBox.setObjectName(u'shortcutListButtonBox')
self.shortcutListLayout.addWidget(self.shortcutListButtonBox)
self.retranslateUi(shortcutListDialog) self.retranslateUi(shortcutListDialog)
QtCore.QObject.connect( QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
self.shortcutListButtonBox, shortcutListDialog.accept)
QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
shortcutListDialog.accept shortcutListDialog.reject)
)
QtCore.QObject.connect(
self.shortcutListButtonBox,
QtCore.SIGNAL(u'rejected()'),
shortcutListDialog.reject
)
QtCore.QMetaObject.connectSlotsByName(shortcutListDialog) QtCore.QMetaObject.connectSlotsByName(shortcutListDialog)
def retranslateUi(self, shortcutListDialog): def retranslateUi(self, shortcutListDialog):
shortcutListDialog.setWindowTitle( shortcutListDialog.setWindowTitle(
translate('OpenLP.ShortcutListDialog', 'Customize Shortcuts')) translate('OpenLP.ShortcutListDialog', 'Customize Shortcuts'))
self.shortcutListTreeWidget.setHeaderLabels([ self.treeWidget.setHeaderLabels([
translate('OpenLP.ShortcutListDialog', 'Action'), translate('OpenLP.ShortcutListDialog', 'Action'),
translate('OpenLP.ShortcutListDialog', 'Shortcut') translate('OpenLP.ShortcutListDialog', 'Shortcut')])
]) self.defaultButton.setText(
self.defaultRadioButton.setText(
translate('OpenLP.ShortcutListDialog', 'Default: %s')) translate('OpenLP.ShortcutListDialog', 'Default: %s'))
self.customRadioButton.setText( self.customButton.setText(
translate('OpenLP.ShortcutListDialog', 'Custom:')) translate('OpenLP.ShortcutListDialog', 'Custom:'))
self.shortcutPushButton.setText( self.shortcutButton.setText(
translate('OpenLP.ShortcutListDialog', 'None')) translate('OpenLP.ShortcutListDialog', 'None'))

View File

@ -49,11 +49,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
self.setupUi(self) self.setupUi(self)
self.actionList = None self.actionList = None
self.captureShortcut = False self.captureShortcut = False
QtCore.QObject.connect( QtCore.QObject.connect(self.shortcutButton,
self.shortcutPushButton, QtCore.SIGNAL(u'toggled(bool)'), self.onShortcutButtonClicked)
QtCore.SIGNAL(u'toggled(bool)'),
self.onShortcutPushButtonClicked
)
def keyReleaseEvent(self, event): def keyReleaseEvent(self, event):
Qt = QtCore.Qt Qt = QtCore.Qt
@ -83,8 +80,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
QtGui.QMessageBox.Ok QtGui.QMessageBox.Ok
) )
else: else:
self.shortcutPushButton.setText(key_sequence.toString()) self.shortcutButton.setText(key_sequence.toString())
self.shortcutPushButton.setChecked(False) self.shortcutButton.setChecked(False)
self.captureShortcut = False self.captureShortcut = False
def exec_(self, actionList): def exec_(self, actionList):
@ -93,7 +90,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def refreshActions(self): def refreshActions(self):
self.shortcutListTreeWidget.clear() self.treeWidget.clear()
for category in self.actionList.categories: for category in self.actionList.categories:
item = QtGui.QTreeWidgetItem([category.name]) item = QtGui.QTreeWidgetItem([category.name])
for action in category.actions: for action in category.actions:
@ -103,7 +100,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
actionItem.setIcon(0, action.icon()) actionItem.setIcon(0, action.icon())
item.addChild(actionItem) item.addChild(actionItem)
item.setExpanded(True) item.setExpanded(True)
self.shortcutListTreeWidget.addTopLevelItem(item) self.treeWidget.addTopLevelItem(item)
def onShortcutPushButtonClicked(self, toggled): def onShortcutButtonClicked(self, toggled):
self.captureShortcut = toggled self.captureShortcut = toggled

View File

@ -128,7 +128,6 @@ class SlideController(QtGui.QWidget):
# Splitter # Splitter
self.Splitter = QtGui.QSplitter(self.Panel) self.Splitter = QtGui.QSplitter(self.Panel)
self.Splitter.setOrientation(QtCore.Qt.Vertical) self.Splitter.setOrientation(QtCore.Qt.Vertical)
self.Splitter.setOpaqueResize(False)
self.PanelLayout.addWidget(self.Splitter) self.PanelLayout.addWidget(self.Splitter)
# Actual controller section # Actual controller section
self.Controller = QtGui.QWidget(self.Splitter) self.Controller = QtGui.QWidget(self.Splitter)

View File

@ -26,33 +26,17 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
class SplashScreen(object): class SplashScreen(QtGui.QSplashScreen):
def __init__(self): def __init__(self):
self.splash_screen = QtGui.QSplashScreen() QtGui.QSplashScreen.__init__(self)
self.setupUi() self.setupUi()
def setupUi(self): def setupUi(self):
self.splash_screen.setObjectName(u'splash_screen') self.setObjectName(u'splash_screen')
self.splash_screen.setWindowModality(QtCore.Qt.NonModal) self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
self.splash_screen.setEnabled(True) self.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
self.splash_screen.resize(370, 370)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.splash_screen.sizePolicy().hasHeightForWidth())
self.splash_screen.setSizePolicy(sizePolicy)
self.splash_screen.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
splash_image = QtGui.QPixmap(u':/graphics/openlp-splash-screen.png') splash_image = QtGui.QPixmap(u':/graphics/openlp-splash-screen.png')
self.splash_screen.setPixmap(splash_image) self.setPixmap(splash_image)
self.splash_screen.setMask(splash_image.mask()) self.setMask(splash_image.mask())
self.splash_screen.setWindowFlags( self.resize(370, 370)
QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint) QtCore.QMetaObject.connectSlotsByName(self)
QtCore.QMetaObject.connectSlotsByName(self.splash_screen)
def show(self):
self.splash_screen.show()
def finish(self, widget):
self.splash_screen.finish(widget)

View File

@ -38,8 +38,8 @@ log = logging.getLogger(__name__)
class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
This is the Bible Import Wizard, which allows easy importing of Bibles This is the Theme Import Wizard, which allows easy creation and editing of
into OpenLP from other formats like OSIS, CSV and OpenSong. OpenLP themes.
""" """
log.info(u'ThemeWizardForm loaded') log.info(u'ThemeWizardForm loaded')
@ -435,8 +435,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
Background style Combo box has changed. Background style Combo box has changed.
""" """
self.theme.background_type = BackgroundType.to_string(index) # do not allow updates when screen is building for the first time.
self.setBackgroundPageValues() if self.updateThemeAllowed:
self.theme.background_type = BackgroundType.to_string(index)
self.setBackgroundPageValues()
def onGradientComboBoxCurrentIndexChanged(self, index): def onGradientComboBoxCurrentIndexChanged(self, index):
""" """

View File

@ -49,12 +49,14 @@ class ThemeManager(QtGui.QWidget):
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.parent = parent self.parent = parent
self.settingsSection = u'themes' self.settingsSection = u'themes'
self.themeForm = ThemeForm(self)
self.fileRenameForm = FileRenameForm(self)
self.serviceComboBox = self.parent.ServiceManagerContents.themeComboBox self.serviceComboBox = self.parent.ServiceManagerContents.themeComboBox
# start with the layout
self.layout = QtGui.QVBoxLayout(self) self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0) self.layout.setSpacing(0)
self.layout.setMargin(0) self.layout.setMargin(0)
self.themeForm = ThemeForm(self) self.layout.setObjectName(u'layout')
self.fileRenameForm = FileRenameForm(self)
self.toolbar = OpenLPToolbar(self) self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('OpenLP.ThemeManager', 'New Theme'), translate('OpenLP.ThemeManager', 'New Theme'),
@ -82,13 +84,17 @@ class ThemeManager(QtGui.QWidget):
u':/general/general_export.png', u':/general/general_export.png',
translate('OpenLP.ThemeManager', 'Export a theme.'), translate('OpenLP.ThemeManager', 'Export a theme.'),
self.onExportTheme) self.onExportTheme)
self.themeWidget = QtGui.QWidgetAction(self.toolbar) self.toolbar.setObjectName(u'toolbar')
self.layout.addWidget(self.toolbar) self.layout.addWidget(self.toolbar)
self.themeWidget = QtGui.QWidgetAction(self.toolbar)
self.themeWidget.setObjectName(u'themeWidget')
# create theme manager list
self.themeListWidget = QtGui.QListWidget(self) self.themeListWidget = QtGui.QListWidget(self)
self.themeListWidget.setAlternatingRowColors(True) self.themeListWidget.setAlternatingRowColors(True)
self.themeListWidget.setIconSize(QtCore.QSize(88, 50)) self.themeListWidget.setIconSize(QtCore.QSize(88, 50))
self.layout.addWidget(self.themeListWidget)
self.themeListWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.themeListWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.themeListWidget.setObjectName(u'themeListWidget')
self.layout.addWidget(self.themeListWidget)
QtCore.QObject.connect(self.themeListWidget, QtCore.QObject.connect(self.themeListWidget,
QtCore.SIGNAL('customContextMenuRequested(QPoint)'), QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
self.contextMenu) self.contextMenu)
@ -106,8 +112,7 @@ class ThemeManager(QtGui.QWidget):
self.deleteAction = self.menu.addAction( self.deleteAction = self.menu.addAction(
translate('OpenLP.ThemeManager', '&Delete Theme')) translate('OpenLP.ThemeManager', '&Delete Theme'))
self.deleteAction.setIcon(build_icon(u':/general/general_delete.png')) self.deleteAction.setIcon(build_icon(u':/general/general_delete.png'))
self.sep1 = self.menu.addAction(u'') self.separator = self.menu.addSeparator()
self.sep1.setSeparator(True)
self.globalAction = self.menu.addAction( self.globalAction = self.menu.addAction(
translate('OpenLP.ThemeManager', 'Set As &Global Default')) translate('OpenLP.ThemeManager', 'Set As &Global Default'))
self.globalAction.setIcon(build_icon(u':/general/general_export.png')) self.globalAction.setIcon(build_icon(u':/general/general_export.png'))

View File

@ -38,63 +38,54 @@ class ThemesTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'ThemesTab') self.setObjectName(u'ThemesTab')
self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes') SettingsTab.setupUi(self)
self.ThemesTabLayout = QtGui.QHBoxLayout(self) self.GlobalGroupBox = QtGui.QGroupBox(self.leftColumn)
self.ThemesTabLayout.setSpacing(8)
self.ThemesTabLayout.setMargin(8)
self.ThemesTabLayout.setObjectName(u'ThemesTabLayout')
self.GlobalGroupBox = QtGui.QGroupBox(self)
self.GlobalGroupBox.setObjectName(u'GlobalGroupBox') self.GlobalGroupBox.setObjectName(u'GlobalGroupBox')
self.GlobalGroupBoxLayout = QtGui.QVBoxLayout(self.GlobalGroupBox) self.GlobalGroupBoxLayout = QtGui.QVBoxLayout(self.GlobalGroupBox)
self.GlobalGroupBoxLayout.setSpacing(8)
self.GlobalGroupBoxLayout.setMargin(8)
self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout') self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout')
self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox) self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox)
self.DefaultComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.DefaultComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Fixed)
self.DefaultComboBox.setObjectName(u'DefaultComboBox') self.DefaultComboBox.setObjectName(u'DefaultComboBox')
self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox) self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox)
self.DefaultListView = QtGui.QLabel(self.GlobalGroupBox) self.DefaultListView = QtGui.QLabel(self.GlobalGroupBox)
self.DefaultListView.setObjectName(u'DefaultListView') self.DefaultListView.setObjectName(u'DefaultListView')
self.GlobalGroupBoxLayout.addWidget(self.DefaultListView) self.GlobalGroupBoxLayout.addWidget(self.DefaultListView)
self.ThemesTabLayout.addWidget(self.GlobalGroupBox) self.leftLayout.addWidget(self.GlobalGroupBox)
self.LevelGroupBox = QtGui.QGroupBox(self) self.leftLayout.addStretch()
self.LevelGroupBox = QtGui.QGroupBox(self.rightColumn)
self.LevelGroupBox.setObjectName(u'LevelGroupBox') self.LevelGroupBox.setObjectName(u'LevelGroupBox')
self.LevelLayout = QtGui.QFormLayout(self.LevelGroupBox) self.LevelLayout = QtGui.QFormLayout(self.LevelGroupBox)
self.LevelLayout.setLabelAlignment( self.LevelLayout.setLabelAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LevelLayout.setFormAlignment( self.LevelLayout.setFormAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LevelLayout.setMargin(8)
self.LevelLayout.setSpacing(8)
self.LevelLayout.setObjectName(u'LevelLayout') self.LevelLayout.setObjectName(u'LevelLayout')
self.SongLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.SongLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.SongLevelRadioButton.setObjectName(u'SongLevelRadioButton') self.SongLevelRadioButton.setObjectName(u'SongLevelRadioButton')
self.LevelLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.SongLevelRadioButton)
self.SongLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.SongLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.SongLevelLabel.setWordWrap(True) self.SongLevelLabel.setWordWrap(True)
self.SongLevelLabel.setObjectName(u'SongLevelLabel') self.SongLevelLabel.setObjectName(u'SongLevelLabel')
self.LevelLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.LevelLayout.addRow(self.SongLevelRadioButton, self.SongLevelLabel)
self.SongLevelLabel)
self.ServiceLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.ServiceLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.ServiceLevelRadioButton.setObjectName(u'ServiceLevelRadioButton') self.ServiceLevelRadioButton.setObjectName(u'ServiceLevelRadioButton')
self.LevelLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.ServiceLevelRadioButton)
self.ServiceLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.ServiceLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.ServiceLevelLabel.setWordWrap(True) self.ServiceLevelLabel.setWordWrap(True)
self.ServiceLevelLabel.setObjectName(u'ServiceLevelLabel') self.ServiceLevelLabel.setObjectName(u'ServiceLevelLabel')
self.LevelLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.LevelLayout.addRow(self.ServiceLevelRadioButton,
self.ServiceLevelLabel) self.ServiceLevelLabel)
self.GlobalLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.GlobalLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.GlobalLevelRadioButton.setChecked(True) self.GlobalLevelRadioButton.setChecked(True)
self.GlobalLevelRadioButton.setObjectName(u'GlobalLevelRadioButton') self.GlobalLevelRadioButton.setObjectName(u'GlobalLevelRadioButton')
self.LevelLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.GlobalLevelRadioButton)
self.GlobalLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.GlobalLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.GlobalLevelLabel.setWordWrap(True) self.GlobalLevelLabel.setWordWrap(True)
self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel') self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel')
self.LevelLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.LevelLayout.addRow(self.GlobalLevelRadioButton,
self.GlobalLevelLabel) self.GlobalLevelLabel)
self.ThemesTabLayout.addWidget(self.LevelGroupBox) self.rightLayout.addWidget(self.LevelGroupBox)
self.rightLayout.addStretch()
QtCore.QObject.connect(self.SongLevelRadioButton, QtCore.QObject.connect(self.SongLevelRadioButton,
QtCore.SIGNAL(u'pressed()'), self.onSongLevelButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onSongLevelButtonPressed)
QtCore.QObject.connect(self.ServiceLevelRadioButton, QtCore.QObject.connect(self.ServiceLevelRadioButton,
@ -107,6 +98,7 @@ class ThemesTab(SettingsTab):
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
def retranslateUi(self): def retranslateUi(self):
self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes')
self.GlobalGroupBox.setTitle( self.GlobalGroupBox.setTitle(
translate('OpenLP.ThemesTab', 'Global Theme')) translate('OpenLP.ThemesTab', 'Global Theme'))
self.LevelGroupBox.setTitle( self.LevelGroupBox.setTitle(
@ -212,4 +204,4 @@ class ThemesTab(SettingsTab):
if not preview.isNull(): if not preview.isNull():
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation) QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(preview) self.DefaultListView.setPixmap(preview)

View File

@ -249,7 +249,8 @@ class Ui_ThemeWizard(object):
self.footerSizeSpinBox.setMaximum(999) self.footerSizeSpinBox.setMaximum(999)
self.footerSizeSpinBox.setValue(10) self.footerSizeSpinBox.setValue(10)
self.footerSizeSpinBox.setObjectName(u'FooterSizeSpinBox') self.footerSizeSpinBox.setObjectName(u'FooterSizeSpinBox')
self.footerAreaLayout.addRow(self.footerSizeLabel, self.footerSizeSpinBox) self.footerAreaLayout.addRow(self.footerSizeLabel,
self.footerSizeSpinBox)
ThemeWizard.addPage(self.footerAreaPage) ThemeWizard.addPage(self.footerAreaPage)
# Alignment Page # Alignment Page
self.alignmentPage = QtGui.QWizardPage() self.alignmentPage = QtGui.QWizardPage()
@ -317,9 +318,11 @@ class Ui_ThemeWizard(object):
self.areaPositionLayout.addWidget(self.mainPositionGroupBox) self.areaPositionLayout.addWidget(self.mainPositionGroupBox)
self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage) self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage)
self.footerPositionGroupBox.setObjectName(u'FooterPositionGroupBox') self.footerPositionGroupBox.setObjectName(u'FooterPositionGroupBox')
self.footerPositionLayout = QtGui.QFormLayout(self.footerPositionGroupBox) self.footerPositionLayout = QtGui.QFormLayout(
self.footerPositionGroupBox)
self.footerPositionLayout.setObjectName(u'FooterPositionLayout') self.footerPositionLayout.setObjectName(u'FooterPositionLayout')
self.footerPositionCheckBox = QtGui.QCheckBox(self.footerPositionGroupBox) self.footerPositionCheckBox = QtGui.QCheckBox(
self.footerPositionGroupBox)
self.footerPositionCheckBox.setObjectName(u'FooterPositionCheckBox') self.footerPositionCheckBox.setObjectName(u'FooterPositionCheckBox')
self.footerPositionLayout.addRow(self.footerPositionCheckBox) self.footerPositionLayout.addRow(self.footerPositionCheckBox)
self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox)
@ -360,6 +363,8 @@ class Ui_ThemeWizard(object):
self.themeNameLabel = QtGui.QLabel(self.previewPage) self.themeNameLabel = QtGui.QLabel(self.previewPage)
self.themeNameLabel.setObjectName(u'ThemeNameLabel') self.themeNameLabel.setObjectName(u'ThemeNameLabel')
self.themeNameEdit = QtGui.QLineEdit(self.previewPage) self.themeNameEdit = QtGui.QLineEdit(self.previewPage)
self.themeNameEdit.setValidator(QtGui.QRegExpValidator(
QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self))
self.themeNameEdit.setObjectName(u'ThemeNameEdit') self.themeNameEdit.setObjectName(u'ThemeNameEdit')
self.themeNameLayout.addRow(self.themeNameLabel, self.themeNameEdit) self.themeNameLayout.addRow(self.themeNameLabel, self.themeNameEdit)
self.previewLayout.addLayout(self.themeNameLayout) self.previewLayout.addLayout(self.themeNameLayout)

View File

@ -29,115 +29,81 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
class Ui_AlertDialog(object): class Ui_AlertDialog(object):
def setupUi(self, AlertDialog): def setupUi(self, alertDialog):
AlertDialog.setObjectName(u'AlertDialog') alertDialog.setObjectName(u'alertDialog')
AlertDialog.resize(567, 440) alertDialog.resize(400, 300)
AlertDialog.setWindowIcon(build_icon(u':/icon/openlp.org-icon-32.bmp')) alertDialog.setWindowIcon(build_icon(u':/icon/openlp.org-icon-32.bmp'))
self.AlertDialogLayout = QtGui.QVBoxLayout(AlertDialog) self.alertDialogLayout = QtGui.QGridLayout(alertDialog)
self.AlertDialogLayout.setSpacing(8) self.alertDialogLayout.setObjectName(u'alertDialogLayout')
self.AlertDialogLayout.setMargin(8) self.alertTextLayout = QtGui.QFormLayout()
self.AlertDialogLayout.setObjectName(u'AlertDialogLayout') self.alertTextLayout.setObjectName(u'alertTextLayout')
self.AlertTextLayout = QtGui.QFormLayout() self.alertEntryLabel = QtGui.QLabel(alertDialog)
self.AlertTextLayout.setContentsMargins(0, 0, -1, -1) self.alertEntryLabel.setObjectName(u'alertEntryLabel')
self.AlertTextLayout.setSpacing(8) self.alertTextEdit = QtGui.QLineEdit(alertDialog)
self.AlertTextLayout.setObjectName(u'AlertTextLayout') self.alertTextEdit.setObjectName(u'alertTextEdit')
self.AlertEntryLabel = QtGui.QLabel(AlertDialog) self.alertEntryLabel.setBuddy(self.alertTextEdit)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, self.alertTextLayout.addRow(self.alertEntryLabel, self.alertTextEdit)
QtGui.QSizePolicy.Fixed) self.alertParameter = QtGui.QLabel(alertDialog)
sizePolicy.setHorizontalStretch(0) self.alertParameter.setObjectName(u'alertParameter')
sizePolicy.setVerticalStretch(0) self.parameterEdit = QtGui.QLineEdit(alertDialog)
sizePolicy.setHeightForWidth( self.parameterEdit.setObjectName(u'parameterEdit')
self.AlertEntryLabel.sizePolicy().hasHeightForWidth()) self.alertParameter.setBuddy(self.parameterEdit)
self.AlertEntryLabel.setSizePolicy(sizePolicy) self.alertTextLayout.addRow(self.alertParameter, self.parameterEdit)
self.AlertEntryLabel.setObjectName(u'AlertEntryLabel') self.alertDialogLayout.addLayout(self.alertTextLayout, 0, 0, 1, 2)
self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.alertListWidget = QtGui.QListWidget(alertDialog)
self.AlertEntryLabel) self.alertListWidget.setAlternatingRowColors(True)
self.AlertParameter = QtGui.QLabel(AlertDialog) self.alertListWidget.setObjectName(u'alertListWidget')
self.AlertParameter.setObjectName(u'AlertParameter') self.alertDialogLayout.addWidget(self.alertListWidget, 1, 0)
self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.manageButtonLayout = QtGui.QVBoxLayout()
self.AlertParameter) self.manageButtonLayout.setObjectName(u'manageButtonLayout')
self.ParameterEdit = QtGui.QLineEdit(AlertDialog) self.newButton = QtGui.QPushButton(alertDialog)
self.ParameterEdit.setObjectName(u'ParameterEdit') self.newButton.setIcon(build_icon(u':/general/general_new.png'))
self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.newButton.setObjectName(u'newButton')
self.ParameterEdit) self.manageButtonLayout.addWidget(self.newButton)
self.AlertTextEdit = QtGui.QLineEdit(AlertDialog) self.saveButton = QtGui.QPushButton(alertDialog)
self.AlertTextEdit.setObjectName(u'AlertTextEdit') self.saveButton.setEnabled(False)
self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
self.AlertTextEdit) self.saveButton.setObjectName(u'saveButton')
self.AlertDialogLayout.addLayout(self.AlertTextLayout) self.manageButtonLayout.addWidget(self.saveButton)
self.ManagementLayout = QtGui.QHBoxLayout() self.deleteButton = QtGui.QPushButton(alertDialog)
self.ManagementLayout.setSpacing(8) self.deleteButton.setIcon(build_icon(u':/general/general_delete.png'))
self.ManagementLayout.setContentsMargins(-1, -1, -1, 0) self.deleteButton.setObjectName(u'deleteButton')
self.ManagementLayout.setObjectName(u'ManagementLayout') self.manageButtonLayout.addWidget(self.deleteButton)
self.AlertListWidget = QtGui.QListWidget(AlertDialog) self.manageButtonLayout.addStretch()
self.AlertListWidget.setAlternatingRowColors(True) self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
self.AlertListWidget.setObjectName(u'AlertListWidget') self.buttonBox = QtGui.QDialogButtonBox(alertDialog)
self.ManagementLayout.addWidget(self.AlertListWidget) self.buttonBox.addButton(QtGui.QDialogButtonBox.Close)
self.ManageButtonLayout = QtGui.QVBoxLayout()
self.ManageButtonLayout.setSpacing(8)
self.ManageButtonLayout.setObjectName(u'ManageButtonLayout')
self.NewButton = QtGui.QPushButton(AlertDialog)
self.NewButton.setIcon(build_icon(u':/general/general_new.png'))
self.NewButton.setObjectName(u'NewButton')
self.ManageButtonLayout.addWidget(self.NewButton)
self.SaveButton = QtGui.QPushButton(AlertDialog)
self.SaveButton.setEnabled(False)
self.SaveButton.setIcon(build_icon(u':/general/general_save.png'))
self.SaveButton.setObjectName(u'SaveButton')
self.ManageButtonLayout.addWidget(self.SaveButton)
self.DeleteButton = QtGui.QPushButton(AlertDialog)
self.DeleteButton.setIcon(build_icon(u':/general/general_delete.png'))
self.DeleteButton.setObjectName(u'DeleteButton')
self.ManageButtonLayout.addWidget(self.DeleteButton)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.ManageButtonLayout.addItem(spacerItem)
self.ManagementLayout.addLayout(self.ManageButtonLayout)
self.AlertDialogLayout.addLayout(self.ManagementLayout)
self.AlertButtonLayout = QtGui.QHBoxLayout()
self.AlertButtonLayout.setSpacing(8)
self.AlertButtonLayout.setObjectName(u'AlertButtonLayout')
spacerItem1 = QtGui.QSpacerItem(181, 0, QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Minimum)
self.AlertButtonLayout.addItem(spacerItem1)
displayIcon = build_icon(u':/general/general_live.png') displayIcon = build_icon(u':/general/general_live.png')
self.DisplayButton = QtGui.QPushButton(AlertDialog) self.displayButton = QtGui.QPushButton(alertDialog)
self.DisplayButton.setIcon(displayIcon) self.displayButton.setIcon(displayIcon)
self.DisplayButton.setObjectName(u'DisplayButton') self.displayButton.setObjectName(u'displayButton')
self.AlertButtonLayout.addWidget(self.DisplayButton) self.buttonBox.addButton(self.displayButton,
self.DisplayCloseButton = QtGui.QPushButton(AlertDialog) QtGui.QDialogButtonBox.ActionRole)
self.DisplayCloseButton.setIcon(displayIcon) self.displayCloseButton = QtGui.QPushButton(alertDialog)
self.DisplayCloseButton.setObjectName(u'DisplayCloseButton') self.displayCloseButton.setIcon(displayIcon)
self.AlertButtonLayout.addWidget(self.DisplayCloseButton) self.displayCloseButton.setObjectName(u'displayCloseButton')
self.CloseButton = QtGui.QPushButton(AlertDialog) self.buttonBox.addButton(self.displayCloseButton,
self.CloseButton.setIcon(build_icon(u':/system/system_close.png')) QtGui.QDialogButtonBox.ActionRole)
self.CloseButton.setObjectName(u'CloseButton') self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
self.AlertButtonLayout.addWidget(self.CloseButton) self.retranslateUi(alertDialog)
self.AlertDialogLayout.addLayout(self.AlertButtonLayout) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
self.AlertEntryLabel.setBuddy(self.AlertTextEdit) alertDialog.close)
self.AlertParameter.setBuddy(self.ParameterEdit) QtCore.QMetaObject.connectSlotsByName(alertDialog)
self.retranslateUi(AlertDialog) def retranslateUi(self, alertDialog):
QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'), alertDialog.setWindowTitle(
AlertDialog.close)
QtCore.QMetaObject.connectSlotsByName(AlertDialog)
def retranslateUi(self, AlertDialog):
AlertDialog.setWindowTitle(
translate('AlertsPlugin.AlertForm', 'Alert Message')) translate('AlertsPlugin.AlertForm', 'Alert Message'))
self.AlertEntryLabel.setText( self.alertEntryLabel.setText(
translate('AlertsPlugin.AlertForm', 'Alert &text:')) translate('AlertsPlugin.AlertForm', 'Alert &text:'))
self.AlertParameter.setText( self.alertParameter.setText(
translate('AlertsPlugin.AlertForm', '&Parameter:')) translate('AlertsPlugin.AlertForm', '&Parameter:'))
self.NewButton.setText( self.newButton.setText(
translate('AlertsPlugin.AlertForm', '&New')) translate('AlertsPlugin.AlertForm', '&New'))
self.SaveButton.setText( self.saveButton.setText(
translate('AlertsPlugin.AlertForm', '&Save')) translate('AlertsPlugin.AlertForm', '&Save'))
self.DeleteButton.setText( self.deleteButton.setText(
translate('AlertsPlugin.AlertForm', '&Delete')) translate('AlertsPlugin.AlertForm', '&Delete'))
self.DisplayButton.setText( self.displayButton.setText(
translate('AlertsPlugin.AlertForm', 'Displ&ay')) translate('AlertsPlugin.AlertForm', 'Displ&ay'))
self.DisplayCloseButton.setText( self.displayCloseButton.setText(
translate('AlertsPlugin.AlertForm', 'Display && Cl&ose')) translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))
self.CloseButton.setText(
translate('AlertsPlugin.AlertForm', '&Close'))

View File

@ -44,62 +44,62 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.item_id = None self.item_id = None
QtGui.QDialog.__init__(self, plugin.formparent) QtGui.QDialog.__init__(self, plugin.formparent)
self.setupUi(self) self.setupUi(self)
QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.displayButton, QtCore.SIGNAL(u'clicked()'),
self.onDisplayClicked) self.onDisplayClicked)
QtCore.QObject.connect(self.DisplayCloseButton, QtCore.QObject.connect(self.displayCloseButton,
QtCore.SIGNAL(u'clicked()'), self.onDisplayCloseClicked) QtCore.SIGNAL(u'clicked()'), self.onDisplayCloseClicked)
QtCore.QObject.connect(self.AlertTextEdit, QtCore.QObject.connect(self.alertTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged) QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged)
QtCore.QObject.connect(self.NewButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.newButton, QtCore.SIGNAL(u'clicked()'),
self.onNewClick) self.onNewClick)
QtCore.QObject.connect(self.DeleteButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.deleteButton, QtCore.SIGNAL(u'clicked()'),
self.onDeleteClick) self.onDeleteClick)
QtCore.QObject.connect(self.SaveButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.saveButton, QtCore.SIGNAL(u'clicked()'),
self.onSaveClick) self.onSaveClick)
QtCore.QObject.connect(self.AlertListWidget, QtCore.QObject.connect(self.alertListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onDoubleClick) QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onDoubleClick)
QtCore.QObject.connect(self.AlertListWidget, QtCore.QObject.connect(self.alertListWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSingleClick) QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSingleClick)
def loadList(self): def loadList(self):
""" """
Loads the list with alerts. Loads the list with alerts.
""" """
self.AlertListWidget.clear() self.alertListWidget.clear()
alerts = self.manager.get_all_objects(AlertItem, alerts = self.manager.get_all_objects(AlertItem,
order_by_ref=AlertItem.text) order_by_ref=AlertItem.text)
for alert in alerts: for alert in alerts:
item_name = QtGui.QListWidgetItem(alert.text) item_name = QtGui.QListWidgetItem(alert.text)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
self.AlertListWidget.addItem(item_name) self.alertListWidget.addItem(item_name)
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.DeleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
def onDisplayClicked(self): def onDisplayClicked(self):
if self.triggerAlert(unicode(self.AlertTextEdit.text())): if self.triggerAlert(unicode(self.alertTextEdit.text())):
self.loadList() self.loadList()
def onDisplayCloseClicked(self): def onDisplayCloseClicked(self):
if self.triggerAlert(unicode(self.AlertTextEdit.text())): if self.triggerAlert(unicode(self.alertTextEdit.text())):
self.close() self.close()
def onDeleteClick(self): def onDeleteClick(self):
""" """
Deletes the selected item. Deletes the selected item.
""" """
item = self.AlertListWidget.currentItem() item = self.alertListWidget.currentItem()
if item: if item:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.manager.delete_object(AlertItem, item_id) self.manager.delete_object(AlertItem, item_id)
row = self.AlertListWidget.row(item) row = self.alertListWidget.row(item)
self.AlertListWidget.takeItem(row) self.alertListWidget.takeItem(row)
self.item_id = None self.item_id = None
self.AlertTextEdit.setText(u'') self.alertTextEdit.setText(u'')
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.DeleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
def onNewClick(self): def onNewClick(self):
if len(self.AlertTextEdit.text()) == 0: if len(self.alertTextEdit.text()) == 0:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('AlertsPlugin.AlertForm', 'New Alert'), translate('AlertsPlugin.AlertForm', 'New Alert'),
translate('AlertsPlugin.AlertForm', 'You haven\'t specified ' translate('AlertsPlugin.AlertForm', 'You haven\'t specified '
@ -107,9 +107,9 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
'clicking New.')) 'clicking New.'))
else: else:
alert = AlertItem() alert = AlertItem()
alert.text = unicode(self.AlertTextEdit.text()) alert.text = unicode(self.alertTextEdit.text())
self.manager.save_object(alert) self.manager.save_object(alert)
self.AlertTextEdit.setText(u'') self.alertTextEdit.setText(u'')
self.loadList() self.loadList()
def onSaveClick(self): def onSaveClick(self):
@ -118,7 +118,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
""" """
if self.item_id: if self.item_id:
alert = self.manager.get_object(AlertItem, self.item_id) alert = self.manager.get_object(AlertItem, self.item_id)
alert.text = unicode(self.AlertTextEdit.text()) alert.text = unicode(self.alertTextEdit.text())
self.manager.save_object(alert) self.manager.save_object(alert)
self.item_id = None self.item_id = None
self.loadList() self.loadList()
@ -129,36 +129,36 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
""" """
# Only enable the button, if we are editing an item. # Only enable the button, if we are editing an item.
if self.item_id: if self.item_id:
self.SaveButton.setEnabled(True) self.saveButton.setEnabled(True)
def onDoubleClick(self): def onDoubleClick(self):
""" """
List item has been double clicked to display it List item has been double clicked to display it
""" """
items = self.AlertListWidget.selectedIndexes() items = self.alertListWidget.selectedIndexes()
for item in items: for item in items:
bitem = self.AlertListWidget.item(item.row()) bitem = self.alertListWidget.item(item.row())
self.triggerAlert(unicode(bitem.text())) self.triggerAlert(unicode(bitem.text()))
self.AlertTextEdit.setText(unicode(bitem.text())) self.alertTextEdit.setText(unicode(bitem.text()))
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.DeleteButton.setEnabled(True) self.deleteButton.setEnabled(True)
def onSingleClick(self): def onSingleClick(self):
""" """
List item has been single clicked to add it to List item has been single clicked to add it to
the edit field so it can be changed. the edit field so it can be changed.
""" """
items = self.AlertListWidget.selectedIndexes() items = self.alertListWidget.selectedIndexes()
for item in items: for item in items:
bitem = self.AlertListWidget.item(item.row()) bitem = self.alertListWidget.item(item.row())
self.AlertTextEdit.setText(unicode(bitem.text())) self.alertTextEdit.setText(unicode(bitem.text()))
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
# If the alert does not contain '<>' we clear the ParameterEdit field. # If the alert does not contain '<>' we clear the ParameterEdit field.
if unicode(self.AlertTextEdit.text()).find(u'<>') == -1: if unicode(self.alertTextEdit.text()).find(u'<>') == -1:
self.ParameterEdit.setText(u'') self.parameterEdit.setText(u'')
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.DeleteButton.setEnabled(True) self.deleteButton.setEnabled(True)
def triggerAlert(self, text): def triggerAlert(self, text):
""" """
@ -170,27 +170,27 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
if text: if text:
# We found '<>' in the alert text, but the ParameterEdit field is # We found '<>' in the alert text, but the ParameterEdit field is
# empty. # empty.
if text.find(u'<>') != -1 and not self.ParameterEdit.text() and \ if text.find(u'<>') != -1 and not self.parameterEdit.text() and \
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Parameter found'), translate('AlertPlugin.AlertForm', 'No Parameter found'),
translate('AlertPlugin.AlertForm', 'You have not entered a ' translate('AlertPlugin.AlertForm', 'You have not entered a '
'parameter to be replaced.\nDo you want to continue anyway?'), 'parameter to be replaced.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.ParameterEdit.setFocus() self.parameterEdit.setFocus()
return False return False
# The ParameterEdit field is not empty, but we have not found '<>' # The ParameterEdit field is not empty, but we have not found '<>'
# in the alert text. # in the alert text.
elif text.find(u'<>') == -1 and self.ParameterEdit.text() and \ elif text.find(u'<>') == -1 and self.parameterEdit.text() and \
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Placeholder found'), translate('AlertPlugin.AlertForm', 'No Placeholder found'),
translate('AlertPlugin.AlertForm', 'The alert text does not' translate('AlertPlugin.AlertForm', 'The alert text does not'
' contain \'<>\'.\nDo want to continue anyway?'), ' contain \'<>\'.\nDo want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.ParameterEdit.setFocus() self.parameterEdit.setFocus()
return False return False
text = text.replace(u'<>', unicode(self.ParameterEdit.text())) text = text.replace(u'<>', unicode(self.parameterEdit.text()))
self.parent.alertsmanager.displayAlert(text) self.parent.alertsmanager.displayAlert(text)
return True return True
return False return False

View File

@ -39,139 +39,59 @@ class AlertsTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'AlertsTab') self.setObjectName(u'AlertsTab')
self.AlertsLayout = QtGui.QHBoxLayout(self) SettingsTab.setupUi(self)
self.AlertsLayout.setSpacing(8) self.FontGroupBox = QtGui.QGroupBox(self.leftColumn)
self.AlertsLayout.setMargin(8)
self.AlertsLayout.setObjectName(u'AlertsLayout')
self.AlertLeftColumn = QtGui.QWidget(self)
self.AlertLeftColumn.setObjectName(u'AlertLeftColumn')
self.SlideLeftLayout = QtGui.QVBoxLayout(self.AlertLeftColumn)
self.SlideLeftLayout.setSpacing(8)
self.SlideLeftLayout.setMargin(0)
self.SlideLeftLayout.setObjectName(u'SlideLeftLayout')
self.FontGroupBox = QtGui.QGroupBox(self.AlertLeftColumn)
self.FontGroupBox.setObjectName(u'FontGroupBox') self.FontGroupBox.setObjectName(u'FontGroupBox')
self.FontLayout = QtGui.QVBoxLayout(self.FontGroupBox) self.FontLayout = QtGui.QFormLayout(self.FontGroupBox)
self.FontLayout.setSpacing(8)
self.FontLayout.setMargin(8)
self.FontLayout.setObjectName(u'FontLayout') self.FontLayout.setObjectName(u'FontLayout')
self.FontLabel = QtGui.QLabel(self.FontGroupBox) self.FontLabel = QtGui.QLabel(self.FontGroupBox)
self.FontLabel.setObjectName(u'FontLabel') self.FontLabel.setObjectName(u'FontLabel')
self.FontLayout.addWidget(self.FontLabel)
self.FontComboBox = QtGui.QFontComboBox(self.FontGroupBox) self.FontComboBox = QtGui.QFontComboBox(self.FontGroupBox)
self.FontComboBox.setObjectName(u'FontComboBox') self.FontComboBox.setObjectName(u'FontComboBox')
self.FontLayout.addWidget(self.FontComboBox) self.FontLayout.addRow(self.FontLabel, self.FontComboBox)
self.ColorWidget = QtGui.QWidget(self.FontGroupBox) self.FontColorLabel = QtGui.QLabel(self.FontGroupBox)
self.ColorWidget.setObjectName(u'ColorWidget')
self.ColorLayout = QtGui.QHBoxLayout(self.ColorWidget)
self.ColorLayout.setSpacing(8)
self.ColorLayout.setMargin(0)
self.ColorLayout.setObjectName(u'ColorLayout')
self.FontColorLabel = QtGui.QLabel(self.ColorWidget)
self.FontColorLabel.setObjectName(u'FontColorLabel') self.FontColorLabel.setObjectName(u'FontColorLabel')
self.ColorLayout.addWidget(self.FontColorLabel) self.ColorLayout = QtGui.QHBoxLayout()
self.FontColorButton = QtGui.QPushButton(self.ColorWidget) self.ColorLayout.setObjectName(u'ColorLayout')
self.FontColorButton = QtGui.QPushButton(self.FontGroupBox)
self.FontColorButton.setObjectName(u'FontColorButton') self.FontColorButton.setObjectName(u'FontColorButton')
self.ColorLayout.addWidget(self.FontColorButton) self.ColorLayout.addWidget(self.FontColorButton)
self.ColorSpacerItem = QtGui.QSpacerItem(40, 20, self.ColorLayout.addSpacing(20)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.BackgroundColorLabel = QtGui.QLabel(self.FontGroupBox)
self.ColorLayout.addItem(self.ColorSpacerItem)
self.BackgroundColorLabel = QtGui.QLabel(self.ColorWidget)
self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel') self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel')
self.ColorLayout.addWidget(self.BackgroundColorLabel) self.ColorLayout.addWidget(self.BackgroundColorLabel)
self.BackgroundColorButton = QtGui.QPushButton(self.ColorWidget) self.BackgroundColorButton = QtGui.QPushButton(self.FontGroupBox)
self.BackgroundColorButton.setObjectName(u'BackgroundColorButton') self.BackgroundColorButton.setObjectName(u'BackgroundColorButton')
self.ColorLayout.addWidget(self.BackgroundColorButton) self.ColorLayout.addWidget(self.BackgroundColorButton)
self.FontLayout.addWidget(self.ColorWidget) self.FontLayout.addRow(self.FontColorLabel, self.ColorLayout)
self.FontSizeWidget = QtGui.QWidget(self.FontGroupBox) self.FontSizeLabel = QtGui.QLabel(self.FontGroupBox)
self.FontSizeWidget.setObjectName(u'FontSizeWidget')
self.FontSizeLayout = QtGui.QHBoxLayout(self.FontSizeWidget)
self.FontSizeLayout.setSpacing(8)
self.FontSizeLayout.setMargin(0)
self.FontSizeLayout.setObjectName(u'FontSizeLayout')
self.FontSizeLabel = QtGui.QLabel(self.FontSizeWidget)
self.FontSizeLabel.setObjectName(u'FontSizeLabel') self.FontSizeLabel.setObjectName(u'FontSizeLabel')
self.FontSizeLayout.addWidget(self.FontSizeLabel) self.FontSizeSpinBox = QtGui.QSpinBox(self.FontGroupBox)
self.FontSizeSpinBox = QtGui.QSpinBox(self.FontSizeWidget)
self.FontSizeSpinBox.setObjectName(u'FontSizeSpinBox') self.FontSizeSpinBox.setObjectName(u'FontSizeSpinBox')
self.FontSizeLayout.addWidget(self.FontSizeSpinBox) self.FontLayout.addRow(self.FontSizeLabel, self.FontSizeSpinBox)
self.FontSizeSpacer = QtGui.QSpacerItem(147, 20, self.TimeoutLabel = QtGui.QLabel(self.FontGroupBox)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.FontSizeLayout.addItem(self.FontSizeSpacer)
self.FontLayout.addWidget(self.FontSizeWidget)
self.TimeoutWidget = QtGui.QWidget(self.FontGroupBox)
self.TimeoutWidget.setObjectName(u'TimeoutWidget')
self.TimeoutLayout = QtGui.QHBoxLayout(self.TimeoutWidget)
self.TimeoutLayout.setSpacing(8)
self.TimeoutLayout.setMargin(0)
self.TimeoutLayout.setObjectName(u'TimeoutLayout')
self.TimeoutLabel = QtGui.QLabel(self.TimeoutWidget)
self.TimeoutLabel.setObjectName(u'TimeoutLabel') self.TimeoutLabel.setObjectName(u'TimeoutLabel')
self.TimeoutLayout.addWidget(self.TimeoutLabel) self.TimeoutSpinBox = QtGui.QSpinBox(self.FontGroupBox)
self.TimeoutSpinBox = QtGui.QSpinBox(self.TimeoutWidget)
self.TimeoutSpinBox.setMaximum(180) self.TimeoutSpinBox.setMaximum(180)
self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox') self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox')
self.TimeoutLayout.addWidget(self.TimeoutSpinBox) self.FontLayout.addRow(self.TimeoutLabel, self.TimeoutSpinBox)
self.TimeoutSpacer = QtGui.QSpacerItem(147, 20, self.LocationLabel = QtGui.QLabel(self.FontGroupBox)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TimeoutLayout.addItem(self.TimeoutSpacer)
self.FontLayout.addWidget(self.TimeoutWidget)
self.LocationWidget = QtGui.QWidget(self.FontGroupBox)
self.LocationWidget.setObjectName(u'LocationWidget')
self.LocationLayout = QtGui.QHBoxLayout(self.LocationWidget)
self.LocationLayout.setSpacing(8)
self.LocationLayout.setMargin(0)
self.LocationLayout.setObjectName(u'LocationLayout')
self.LocationLabel = QtGui.QLabel(self.LocationWidget)
self.LocationLabel.setObjectName(u'LocationLabel') self.LocationLabel.setObjectName(u'LocationLabel')
self.LocationLayout.addWidget(self.LocationLabel) self.LocationComboBox = QtGui.QComboBox(self.FontGroupBox)
self.LocationComboBox = QtGui.QComboBox(self.LocationWidget) self.LocationComboBox.addItems([u'', u'', u''])
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox.setObjectName(u'LocationComboBox') self.LocationComboBox.setObjectName(u'LocationComboBox')
self.LocationLayout.addWidget(self.LocationComboBox) self.FontLayout.addRow(self.LocationLabel, self.LocationComboBox)
self.LocationSpacer = QtGui.QSpacerItem(147, 20, self.leftLayout.addWidget(self.FontGroupBox)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.leftLayout.addStretch()
self.LocationLayout.addItem(self.LocationSpacer) self.PreviewGroupBox = QtGui.QGroupBox(self.rightColumn)
self.FontLayout.addWidget(self.LocationWidget)
self.SlideLeftLayout.addWidget(self.FontGroupBox)
self.SlideLeftSpacer = QtGui.QSpacerItem(20, 94,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.SlideLeftLayout.addItem(self.SlideLeftSpacer)
self.AlertsLayout.addWidget(self.AlertLeftColumn)
self.AlertRightColumn = QtGui.QWidget(self)
self.AlertRightColumn.setObjectName(u'AlertRightColumn')
self.SlideRightLayout = QtGui.QVBoxLayout(self.AlertRightColumn)
self.SlideRightLayout.setSpacing(8)
self.SlideRightLayout.setMargin(0)
self.SlideRightLayout.setObjectName(u'SlideRightLayout')
self.PreviewGroupBox = QtGui.QGroupBox(self.AlertRightColumn)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.PreviewGroupBox.sizePolicy().hasHeightForWidth())
self.PreviewGroupBox.setSizePolicy(sizePolicy)
self.PreviewGroupBox.setObjectName(u'PreviewGroupBox') self.PreviewGroupBox.setObjectName(u'PreviewGroupBox')
self.PreviewLayout = QtGui.QVBoxLayout(self.PreviewGroupBox) self.PreviewLayout = QtGui.QVBoxLayout(self.PreviewGroupBox)
self.PreviewLayout.setSpacing(8)
self.PreviewLayout.setMargin(8)
self.PreviewLayout.setObjectName(u'PreviewLayout') self.PreviewLayout.setObjectName(u'PreviewLayout')
self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox) self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox)
self.FontPreview.setFixedSize(QtCore.QSize(350, 100))
self.FontPreview.setReadOnly(True)
self.FontPreview.setFocusPolicy(QtCore.Qt.NoFocus)
self.FontPreview.setAlignment(
QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
self.FontPreview.setObjectName(u'FontPreview') self.FontPreview.setObjectName(u'FontPreview')
self.PreviewLayout.addWidget(self.FontPreview) self.PreviewLayout.addWidget(self.FontPreview)
self.SlideRightLayout.addWidget(self.PreviewGroupBox) self.rightLayout.addWidget(self.PreviewGroupBox)
self.SlideRightSpacer = QtGui.QSpacerItem(20, 40, self.rightLayout.addStretch()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.SlideRightLayout.addItem(self.SlideRightSpacer)
self.AlertsLayout.addWidget(self.AlertRightColumn)
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.BackgroundColorButton, QtCore.QObject.connect(self.BackgroundColorButton,
QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked)
@ -294,4 +214,4 @@ class AlertsTab(SettingsTab):
font.setPointSize(self.font_size) font.setPointSize(self.font_size)
self.FontPreview.setFont(font) self.FontPreview.setFont(font)
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' %
(self.bg_color, self.font_color)) (self.bg_color, self.font_color))

View File

@ -46,89 +46,51 @@ class BiblesTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'BiblesTab') self.setObjectName(u'BiblesTab')
self.BibleLayout = QtGui.QHBoxLayout(self) SettingsTab.setupUi(self)
self.BibleLayout.setSpacing(8) self.VerseDisplayGroupBox = QtGui.QGroupBox(self.leftColumn)
self.BibleLayout.setMargin(8)
self.BibleLayout.setObjectName(u'BibleLayout')
self.BibleLeftWidget = QtGui.QWidget(self)
self.BibleLeftWidget.setObjectName(u'BibleLeftWidget')
self.BibleLeftLayout = QtGui.QVBoxLayout(self.BibleLeftWidget)
self.BibleLeftLayout.setObjectName(u'BibleLeftLayout')
self.BibleLeftLayout.setSpacing(8)
self.BibleLeftLayout.setMargin(0)
self.VerseDisplayGroupBox = QtGui.QGroupBox(self)
self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox') self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox')
self.VerseDisplayLayout = QtGui.QGridLayout(self.VerseDisplayGroupBox) self.VerseDisplayLayout = QtGui.QFormLayout(self.VerseDisplayGroupBox)
self.VerseDisplayLayout.setMargin(8)
self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout') self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout')
self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.NewChaptersCheckBox.setObjectName(u'NewChaptersCheckBox') self.NewChaptersCheckBox.setObjectName(u'NewChaptersCheckBox')
self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 0, 0, 1, 1) self.VerseDisplayLayout.addRow(self.NewChaptersCheckBox)
self.DisplayStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox) self.DisplayStyleLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.DisplayStyleWidget.setObjectName(u'DisplayStyleWidget')
self.DisplayStyleLayout = QtGui.QHBoxLayout(self.DisplayStyleWidget)
self.DisplayStyleLayout.setSpacing(8)
self.DisplayStyleLayout.setMargin(0)
self.DisplayStyleLayout.setObjectName(u'DisplayStyleLayout')
self.DisplayStyleLabel = QtGui.QLabel(self.DisplayStyleWidget)
self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel') self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel')
self.DisplayStyleLayout.addWidget(self.DisplayStyleLabel) self.DisplayStyleComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox)
self.DisplayStyleComboBox = QtGui.QComboBox(self.DisplayStyleWidget) self.DisplayStyleComboBox.addItems([u'', u'', u'', u''])
self.DisplayStyleComboBox.setObjectName(u'DisplayStyleComboBox') self.DisplayStyleComboBox.setObjectName(u'DisplayStyleComboBox')
self.DisplayStyleComboBox.addItem(QtCore.QString()) self.VerseDisplayLayout.addRow(self.DisplayStyleLabel,
self.DisplayStyleComboBox.addItem(QtCore.QString()) self.DisplayStyleComboBox)
self.DisplayStyleComboBox.addItem(QtCore.QString()) self.LayoutStyleLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.DisplayStyleComboBox.addItem(QtCore.QString())
self.DisplayStyleLayout.addWidget(self.DisplayStyleComboBox)
self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 1, 0, 1, 1)
self.LayoutStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.LayoutStyleWidget.setObjectName(u'LayoutStyleWidget')
self.LayoutStyleLayout = QtGui.QHBoxLayout(self.LayoutStyleWidget)
self.LayoutStyleLayout.setSpacing(8)
self.LayoutStyleLayout.setMargin(0)
self.LayoutStyleLayout.setObjectName(u'LayoutStyleLayout')
self.LayoutStyleLabel = QtGui.QLabel(self.LayoutStyleWidget)
self.LayoutStyleLabel.setObjectName(u'LayoutStyleLabel') self.LayoutStyleLabel.setObjectName(u'LayoutStyleLabel')
self.LayoutStyleLayout.addWidget(self.LayoutStyleLabel) self.LayoutStyleComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox)
self.LayoutStyleComboBox = QtGui.QComboBox(self.LayoutStyleWidget)
self.LayoutStyleComboBox.setObjectName(u'LayoutStyleComboBox') self.LayoutStyleComboBox.setObjectName(u'LayoutStyleComboBox')
self.LayoutStyleComboBox.addItem(QtCore.QString()) self.LayoutStyleComboBox.addItems([u'', u'', u''])
self.LayoutStyleComboBox.addItem(QtCore.QString()) self.VerseDisplayLayout.addRow(self.LayoutStyleLabel,
self.LayoutStyleComboBox.addItem(QtCore.QString()) self.LayoutStyleComboBox)
self.LayoutStyleLayout.addWidget(self.LayoutStyleComboBox)
self.VerseDisplayLayout.addWidget(self.LayoutStyleWidget, 2, 0, 1, 1)
self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.BibleThemeWidget.setObjectName(u'BibleThemeWidget')
self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget)
self.BibleThemeLayout.setSpacing(8)
self.BibleThemeLayout.setMargin(0)
self.BibleThemeLayout.setObjectName(u'BibleThemeLayout')
self.BibleThemeLabel = QtGui.QLabel(self.BibleThemeWidget)
self.BibleThemeLabel.setObjectName(u'BibleThemeLabel')
self.BibleThemeLayout.addWidget(self.BibleThemeLabel)
self.BibleThemeComboBox = QtGui.QComboBox(self.BibleThemeWidget)
self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
self.BibleThemeComboBox.addItem(QtCore.QString())
self.BibleThemeLayout.addWidget(self.BibleThemeComboBox)
self.BibleSecondCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) self.BibleSecondCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.BibleSecondCheckBox.setObjectName(u'BibleSecondCheckBox') self.BibleSecondCheckBox.setObjectName(u'BibleSecondCheckBox')
self.VerseDisplayLayout.addWidget(self.BibleSecondCheckBox, 3, 0, 1, 1) self.VerseDisplayLayout.addRow(self.BibleSecondCheckBox)
self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 4, 0, 1, 1) self.BibleThemeLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.BibleThemeLabel.setObjectName(u'BibleThemeLabel')
self.BibleThemeComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox)
self.BibleThemeComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.BibleThemeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Fixed)
self.BibleThemeComboBox.addItem(u'')
self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
self.VerseDisplayLayout.addRow(self.BibleThemeLabel,
self.BibleThemeComboBox)
self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox) self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.ChangeNoteLabel.setWordWrap(True)
self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel') self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel')
self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 5, 0, 1, 1) self.VerseDisplayLayout.addRow(self.ChangeNoteLabel)
self.BibleLeftLayout.addWidget(self.VerseDisplayGroupBox) self.leftLayout.addWidget(self.VerseDisplayGroupBox)
self.BibleLeftSpacer = QtGui.QSpacerItem(40, 20, self.leftLayout.addStretch()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding,
self.BibleLeftLayout.addItem(self.BibleLeftSpacer) QtGui.QSizePolicy.Preferred)
self.BibleLayout.addWidget(self.BibleLeftWidget) self.rightLayout.addStretch()
self.BibleRightWidget = QtGui.QWidget(self)
self.BibleRightWidget.setObjectName(u'BibleRightWidget')
self.BibleRightLayout = QtGui.QVBoxLayout(self.BibleRightWidget)
self.BibleRightLayout.setObjectName(u'BibleRightLayout')
self.BibleRightLayout.setSpacing(8)
self.BibleRightLayout.setMargin(0)
self.BibleLayout.addWidget(self.BibleRightWidget)
# Signals and slots # Signals and slots
QtCore.QObject.connect( QtCore.QObject.connect(
self.NewChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.NewChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
@ -251,4 +213,4 @@ class BiblesTab(SettingsTab):
# Not Found. # Not Found.
index = 0 index = 0
self.bible_theme = u'' self.bible_theme = u''
self.BibleThemeComboBox.setCurrentIndex(index) self.BibleThemeComboBox.setCurrentIndex(index)

View File

@ -28,7 +28,7 @@ import logging
import chardet import chardet
import re import re
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore
from sqlalchemy import Column, ForeignKey, or_, Table, types from sqlalchemy import Column, ForeignKey, or_, Table, types
from sqlalchemy.orm import class_mapper, mapper, relation from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError from sqlalchemy.orm.exc import UnmappedClassError

View File

@ -212,13 +212,7 @@ class BGExtract(object):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
except urllib2.URLError: except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.') log.exception(u'The web bible page could not be downloaded.')
Receiver.send_message(u'openlp_error_message', { send_error_message(u'download')
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
finally: finally:
if not page: if not page:
return None return None
@ -229,15 +223,26 @@ class BGExtract(object):
except HTMLParseError: except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.') log.exception(u'BeautifulSoup could not parse the bible page.')
Receiver.send_message(u'bibles_download_error') Receiver.send_message(u'bibles_download_error')
send_error_message(u'parse')
finally: finally:
if not soup: if not soup:
return None return None
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
footnotes = soup.findAll(u'sup', u'footnote') footnotes = soup.findAll(u'sup', u'footnote')
[footnote.extract() for footnote in footnotes] if footnotes:
[footnote.extract() for footnote in footnotes]
crossrefs = soup.findAll(u'sup', u'xref')
if crossrefs:
[crossref.extract() for crossref in crossrefs]
cleanup = [(re.compile('\s+'), lambda match: ' ')] cleanup = [(re.compile('\s+'), lambda match: ' ')]
verses = BeautifulSoup(str(soup), markupMassage=cleanup) verses = BeautifulSoup(str(soup), markupMassage=cleanup)
content = verses.find(u'div', u'result-text-style-normal') content = verses.find(u'div', u'result-text-style-normal')
if not content:
content = verses.find(u'div', u'result-text-style-rtl-serif')
if not content:
log.debug(u'No content found in the BibleGateway response.')
send_error_message(u'parse')
return None
verse_count = len(verses.findAll(u'sup', u'versenum')) verse_count = len(verses.findAll(u'sup', u'versenum'))
found_count = 0 found_count = 0
verse_list = {} verse_list = {}
@ -283,13 +288,7 @@ class BSExtract(object):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
except urllib2.URLError: except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.') log.exception(u'The web bible page could not be downloaded.')
Receiver.send_message(u'openlp_error_message', { send_error_message(u'download')
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
finally: finally:
if not page: if not page:
return None return None
@ -298,19 +297,15 @@ class BSExtract(object):
soup = BeautifulSoup(page) soup = BeautifulSoup(page)
except HTMLParseError: except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.') log.exception(u'BeautifulSoup could not parse the bible page.')
Receiver.send_message(u'openlp_error_message', { send_error_message(u'parse')
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error '
'continues to occur consider reporting a bug.')
})
return None return None
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
content = None content = None
try: try:
content = soup.find(u'div', u'content').find(u'div').findAll(u'div') content = soup.find(u'div', u'content').find(u'div').findAll(u'div')
except: except:
log.exception(u'No verses found.') log.exception(u'No verses found in the Bibleserver response.')
send_error_message(u'parse')
finally: finally:
if not content: if not content:
return None return None
@ -356,28 +351,21 @@ class CWExtract(object):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
except urllib2.URLError: except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.') log.exception(u'The web bible page could not be downloaded.')
Receiver.send_message(u'openlp_error_message', { send_error_message(u'download')
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
return None return None
soup = None soup = None
try: try:
soup = BeautifulSoup(page) soup = BeautifulSoup(page)
except HTMLParseError: except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.') log.exception(u'BeautifulSoup could not parse the bible page.')
Receiver.send_message(u'openlp_error_message', { send_error_message(u'parse')
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error '
'continues to occur consider reporting a bug.')
})
return None return None
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
htmlverses = soup.findAll(u'span', u'versetext') htmlverses = soup.findAll(u'span', u'versetext')
if not htmlverses:
log.debug(u'No verses found in the CrossWalk response.')
send_error_message(u'parse')
return None
verses = {} verses = {}
reduce_spaces = re.compile(r'[ ]{2,}') reduce_spaces = re.compile(r'[ ]{2,}')
fix_punctuation = re.compile(r'[ ]+([.,;])') fix_punctuation = re.compile(r'[ ]+([.,;])')
@ -488,7 +476,7 @@ class HTTPBible(BibleDB):
Receiver.send_message(u'openlp_error_message', { Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblesPlugin', 'No Book Found'), u'title': translate('BiblesPlugin', 'No Book Found'),
u'message': translate('BiblesPlugin', 'No matching ' u'message': translate('BiblesPlugin', 'No matching '
'book could be found in this Bible. Check that you' 'book could be found in this Bible. Check that you '
'have spelled the name of the book correctly.') 'have spelled the name of the book correctly.')
}) })
return [] return []
@ -560,3 +548,20 @@ class HTTPBible(BibleDB):
The chapter whose verses are being counted. The chapter whose verses are being counted.
""" """
return HTTPBooks.get_verse_count(book, chapter) return HTTPBooks.get_verse_count(book, chapter)
def send_error_message(reason):
if reason == u'downoad':
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
elif reason == u'parse':
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error continues '
'continues to occur consider reporting a bug.')
})

View File

@ -26,9 +26,9 @@
import logging import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore
from openlp.core.lib import SettingsManager, translate from openlp.core.lib import Receiver, SettingsManager, translate
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib import parse_reference from openlp.plugins.bibles.lib import parse_reference
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
@ -257,23 +257,33 @@ class BibleManager(object):
- Genesis 1:1-10,2:1-10 - Genesis 1:1-10,2:1-10
""" """
log.debug(u'BibleManager.get_verses("%s", "%s")', bible, versetext) log.debug(u'BibleManager.get_verses("%s", "%s")', bible, versetext)
if not bible:
Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager',
'No Bibles available'),
u'message': translate('BiblesPlugin.BibleManager',
'There are no Bibles currently installed. Please use the '
'Import Wizard to install one or more Bibles.')
})
return None
reflist = parse_reference(versetext) reflist = parse_reference(versetext)
if reflist: if reflist:
return self.db_cache[bible].get_verses(reflist) return self.db_cache[bible].get_verses(reflist)
else: else:
QtGui.QMessageBox.information(self.parent.mediaItem, Receiver.send_message(u'openlp_information_message', {
translate('BiblesPlugin.BibleManager', u'title': translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'), 'Scripture Reference Error'),
translate('BiblesPlugin.BibleManager', 'Your scripture ' u'message': translate('BiblesPlugin.BibleManager',
'reference is either not supported by OpenLP or is invalid. ' 'Your scripture reference is either not supported by OpenLP '
'Please make sure your reference conforms to one of the ' 'or is invalid. Please make sure your reference conforms to '
'following patterns:\n\n' 'one of the following patterns:\n\n'
'Book Chapter\n' 'Book Chapter\n'
'Book Chapter-Chapter\n' 'Book Chapter-Chapter\n'
'Book Chapter:Verse-Verse\n' 'Book Chapter:Verse-Verse\n'
'Book Chapter:Verse-Verse,Verse-Verse\n' 'Book Chapter:Verse-Verse,Verse-Verse\n'
'Book Chapter:Verse-Verse,Chapter:Verse-Verse\n' 'Book Chapter:Verse-Verse,Chapter:Verse-Verse\n'
'Book Chapter:Verse-Chapter:Verse')) 'Book Chapter:Verse-Chapter:Verse')
})
return None return None
def verse_search(self, bible, second_bible, text): def verse_search(self, bible, second_bible, text):
@ -298,22 +308,25 @@ class BibleManager(object):
second_webbible = self.db_cache[second_bible].get_object(BibleMeta, second_webbible = self.db_cache[second_bible].get_object(BibleMeta,
u'download source') u'download source')
if webbible or second_webbible: if webbible or second_webbible:
QtGui.QMessageBox.information(self.parent.mediaItem, Receiver.send_message(u'openlp_information_message', {
translate('BiblesPlugin.BibleManager', u'title': translate('BiblesPlugin.BibleManager',
'Web Bible cannot be used'), 'Web Bible cannot be used'),
translate('BiblesPlugin.BibleManager', 'Text Search is not ' u'message': translate('BiblesPlugin.BibleManager',
'available with Web Bibles.')) 'Text Search is not available with Web Bibles.')
})
return None return None
if text: if text:
return self.db_cache[bible].verse_search(text) return self.db_cache[bible].verse_search(text)
else: else:
QtGui.QMessageBox.information(self.parent.mediaItem, Receiver.send_message(u'openlp_information_message', {
translate('BiblesPlugin.BibleManager', u'title': translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'), 'Scripture Reference Error'),
translate('BiblesPlugin.BibleManager', 'You did not enter a ' u'message': translate('BiblesPlugin.BibleManager',
'search keyword.\nYou can separate different keywords by a ' 'You did not enter a search keyword.\n'
'space to search for all of your keywords and you can separate ' 'You can separate different keywords by a space to search for '
'them by a comma to search for one of them.')) 'all of your keywords and you can separate them by a comma to '
'search for one of them.')
})
return None return None
def save_meta_data(self, bible, version, copyright, permissions): def save_meta_data(self, bible, version, copyright, permissions):

View File

@ -56,8 +56,6 @@ class BibleMediaItem(MediaManagerItem):
log.info(u'Bible Media Item loaded') log.info(u'Bible Media Item loaded')
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.PluginNameShort = u'Bible'
self.pluginNameVisible = translate('BiblesPlugin.MediaItem', 'Bible')
self.IconPath = u'songs/song' self.IconPath = u'songs/song'
self.ListViewWithDnD_class = BibleListView self.ListViewWithDnD_class = BibleListView
MediaManagerItem.__init__(self, parent, plugin, icon) MediaManagerItem.__init__(self, parent, plugin, icon)
@ -76,184 +74,178 @@ class BibleMediaItem(MediaManagerItem):
self.addToServiceItem = False self.addToServiceItem = False
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.SearchTabWidget = QtGui.QTabWidget(self) self.searchTabWidget = QtGui.QTabWidget(self)
sizePolicy = QtGui.QSizePolicy( self.searchTabWidget.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0) self.searchTabWidget.setObjectName(u'SearchTabWidget')
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.SearchTabWidget.sizePolicy().hasHeightForWidth())
self.SearchTabWidget.setSizePolicy(sizePolicy)
self.SearchTabWidget.setObjectName(u'SearchTabWidget')
# Add the Quick Search tab. # Add the Quick Search tab.
self.QuickTab = QtGui.QWidget() self.quickTab = QtGui.QWidget()
self.QuickTab.setObjectName(u'QuickTab') self.quickTab.setObjectName(u'quickTab')
self.QuickLayout = QtGui.QGridLayout(self.QuickTab) self.quickLayout = QtGui.QFormLayout(self.quickTab)
self.QuickLayout.setMargin(2) self.quickLayout.setObjectName(u'quickLayout')
self.QuickLayout.setSpacing(4) self.quickVersionLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.setVerticalSpacing(4) self.quickVersionLabel.setObjectName(u'quickVersionLabel')
self.QuickLayout.setObjectName(u'QuickLayout') self.quickVersionComboBox = QtGui.QComboBox(self.quickTab)
self.QuickVersionLabel = QtGui.QLabel(self.QuickTab) self.quickVersionComboBox.setSizePolicy(
self.QuickVersionLabel.setObjectName(u'QuickVersionLabel') QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.QuickLayout.addWidget(self.QuickVersionLabel, 0, 0, 1, 1) self.quickVersionComboBox.setObjectName(u'quickVersionComboBox')
self.QuickVersionComboBox = QtGui.QComboBox(self.QuickTab) self.quickVersionLabel.setBuddy(self.quickVersionComboBox)
self.QuickVersionComboBox.setSizeAdjustPolicy( self.quickLayout.addRow(self.quickVersionLabel,
QtGui.QComboBox.AdjustToMinimumContentsLength) self.quickVersionComboBox)
self.QuickVersionComboBox.setObjectName(u'VersionComboBox') self.quickSecondLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.addWidget(self.QuickVersionComboBox, 0, 1, 1, 2) self.quickSecondLabel.setObjectName(u'quickSecondLabel')
self.QuickSecondVersionLabel = QtGui.QLabel(self.QuickTab) self.quickSecondComboBox = QtGui.QComboBox(self.quickTab)
self.QuickSecondVersionLabel.setObjectName(u'QuickSecondVersionLabel') self.quickSecondComboBox.setSizePolicy(
self.QuickLayout.addWidget(self.QuickSecondVersionLabel, 1, 0, 1, 1) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.QuickSecondBibleComboBox = QtGui.QComboBox(self.QuickTab) self.quickSecondComboBox.setObjectName(u'quickSecondComboBox')
self.QuickSecondBibleComboBox.setSizeAdjustPolicy( self.quickSecondLabel.setBuddy(self.quickSecondComboBox)
QtGui.QComboBox.AdjustToMinimumContentsLength) self.quickLayout.addRow(self.quickSecondLabel, self.quickSecondComboBox)
self.QuickSecondBibleComboBox.setObjectName(u'SecondBible') self.quickSearchTypeLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.addWidget(self.QuickSecondBibleComboBox, 1, 1, 1, 2) self.quickSearchTypeLabel.setObjectName(u'quickSearchTypeLabel')
self.QuickSearchLabel = QtGui.QLabel(self.QuickTab) self.quickSearchComboBox = QtGui.QComboBox(self.quickTab)
self.QuickSearchLabel.setObjectName(u'QuickSearchLabel') self.quickSearchComboBox.setSizePolicy(
self.QuickLayout.addWidget(self.QuickSearchLabel, 2, 0, 1, 1) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.QuickSearchComboBox = QtGui.QComboBox(self.QuickTab) self.quickSearchComboBox.setObjectName(u'quickSearchComboBox')
self.QuickSearchComboBox.setObjectName(u'SearchComboBox') self.quickSearchTypeLabel.setBuddy(self.quickSearchComboBox)
self.QuickLayout.addWidget(self.QuickSearchComboBox, 2, 1, 1, 2) self.quickLayout.addRow(self.quickSearchTypeLabel,
self.QuickSearchLabel = QtGui.QLabel(self.QuickTab) self.quickSearchComboBox)
self.QuickSearchLabel.setObjectName(u'QuickSearchLabel') self.quickSearchLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.addWidget(self.QuickSearchLabel, 3, 0, 1, 1) self.quickSearchLabel.setObjectName(u'quickSearchLabel')
self.QuickSearchEdit = QtGui.QLineEdit(self.QuickTab) self.quickSearchEdit = QtGui.QLineEdit(self.quickTab)
self.QuickSearchEdit.setObjectName(u'QuickSearchEdit') self.quickSearchEdit.setObjectName(u'quickSearchEdit')
self.QuickLayout.addWidget(self.QuickSearchEdit, 3, 1, 1, 2) self.quickSearchLabel.setBuddy(self.quickSearchEdit)
self.QuickClearLabel = QtGui.QLabel(self.QuickTab) self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit)
self.QuickClearLabel.setObjectName(u'QuickSearchLabel') self.quickClearLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.addWidget(self.QuickClearLabel, 4, 0, 1, 1) self.quickClearLabel.setObjectName(u'quickClearLabel')
self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab) self.quickClearComboBox = QtGui.QComboBox(self.quickTab)
self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox') self.quickClearComboBox.setSizePolicy(
self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 4, 1, 1, 2) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.QuickSearchButtonLayout = QtGui.QHBoxLayout() self.quickClearComboBox.setObjectName(u'quickClearComboBox')
self.QuickSearchButtonLayout.setMargin(0) self.quickLayout.addRow(self.quickClearLabel, self.quickClearComboBox)
self.QuickSearchButtonLayout.setSpacing(0) self.quickSearchButtonLayout = QtGui.QHBoxLayout()
self.QuickSearchButtonLayout.setObjectName(u'QuickSearchButtonLayout') self.quickSearchButtonLayout.setObjectName(u'quickSearchButtonLayout')
self.QuickSearchButtonSpacer = QtGui.QSpacerItem(40, 20, self.quickSearchButtonLayout.addStretch()
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.quickSearchButton = QtGui.QPushButton(self.quickTab)
self.QuickSearchButtonLayout.addItem(self.QuickSearchButtonSpacer) self.quickSearchButton.setObjectName(u'quickSearchButton')
self.QuickSearchButton = QtGui.QPushButton(self.QuickTab) self.quickSearchButtonLayout.addWidget(self.quickSearchButton)
self.QuickSearchButton.setObjectName(u'QuickSearchButton') self.quickLayout.addRow(self.quickSearchButtonLayout)
self.QuickSearchButtonLayout.addWidget(self.QuickSearchButton) self.quickMessage = QtGui.QLabel(self.quickTab)
self.QuickLayout.addLayout(self.QuickSearchButtonLayout, 5, 0, 1, 3) self.quickMessage.setObjectName(u'quickMessage')
self.QuickMessage = QtGui.QLabel(self.QuickTab) self.quickLayout.addRow(self.quickMessage)
self.QuickMessage.setObjectName(u'QuickMessage') self.searchTabWidget.addTab(self.quickTab,
self.QuickLayout.addWidget(self.QuickMessage, 6, 0, 1, 3)
self.SearchTabWidget.addTab(self.QuickTab,
translate('BiblesPlugin.MediaItem', 'Quick')) translate('BiblesPlugin.MediaItem', 'Quick'))
QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1)
# Add the Advanced Search tab. # Add the Advanced Search tab.
self.AdvancedTab = QtGui.QWidget() self.advancedTab = QtGui.QWidget()
self.AdvancedTab.setObjectName(u'AdvancedTab') self.advancedTab.setObjectName(u'advancedTab')
self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab) self.advancedLayout = QtGui.QGridLayout(self.advancedTab)
self.AdvancedLayout.setMargin(2) self.advancedLayout.setObjectName(u'advancedLayout')
self.AdvancedLayout.setSpacing(4) self.advancedVersionLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedLayout.setVerticalSpacing(4) self.advancedVersionLabel.setObjectName(u'advancedVersionLabel')
self.AdvancedLayout.setObjectName(u'AdvancedLayout') self.advancedLayout.addWidget(self.advancedVersionLabel, 0, 0,
self.AdvancedVersionLabel = QtGui.QLabel(self.AdvancedTab) QtCore.Qt.AlignRight)
self.AdvancedVersionLabel.setObjectName(u'AdvancedVersionLabel') self.advancedVersionComboBox = QtGui.QComboBox(self.advancedTab)
self.AdvancedLayout.addWidget(self.AdvancedVersionLabel, 0, 0, 1, 1) self.advancedVersionComboBox.setSizePolicy(
self.AdvancedVersionComboBox = QtGui.QComboBox(self.AdvancedTab) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.AdvancedVersionComboBox.setSizeAdjustPolicy( self.advancedVersionComboBox.setObjectName(u'advancedVersionComboBox')
QtGui.QComboBox.AdjustToMinimumContentsLength) self.advancedVersionLabel.setBuddy(self.advancedVersionComboBox)
self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox') self.advancedLayout.addWidget(self.advancedVersionComboBox, 0, 1, 1, 2)
self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2) self.advancedSecondLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab) self.advancedSecondLabel.setObjectName(u'advancedSecondLabel')
self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel') self.advancedLayout.addWidget(self.advancedSecondLabel, 1, 0,
self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1) QtCore.Qt.AlignRight)
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab) self.advancedSecondComboBox = QtGui.QComboBox(self.advancedTab)
self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy( self.advancedSecondComboBox.setSizePolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.AdvancedSecondBibleComboBox.setObjectName( self.advancedSecondComboBox.setObjectName(u'advancedSecondComboBox')
u'AdvancedSecondBibleComboBox') self.advancedSecondLabel.setBuddy(self.advancedSecondComboBox)
self.AdvancedLayout.addWidget( self.advancedLayout.addWidget(self.advancedSecondComboBox, 1, 1, 1, 2)
self.AdvancedSecondBibleComboBox, 1, 1, 1, 2) self.advancedBookLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedBookLabel = QtGui.QLabel(self.AdvancedTab) self.advancedBookLabel.setObjectName(u'advancedBookLabel')
self.AdvancedBookLabel.setObjectName(u'AdvancedBookLabel') self.advancedLayout.addWidget(self.advancedBookLabel, 2, 0,
self.AdvancedLayout.addWidget(self.AdvancedBookLabel, 2, 0, 1, 1) QtCore.Qt.AlignRight)
self.AdvancedBookComboBox = QtGui.QComboBox(self.AdvancedTab) self.advancedBookComboBox = QtGui.QComboBox(self.advancedTab)
self.AdvancedBookComboBox.setObjectName(u'AdvancedBookComboBox') self.advancedBookComboBox.setSizePolicy(
self.AdvancedLayout.addWidget(self.AdvancedBookComboBox, 2, 1, 1, 2) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.AdvancedChapterLabel = QtGui.QLabel(self.AdvancedTab) self.advancedBookComboBox.setObjectName(u'advancedBookComboBox')
self.AdvancedChapterLabel.setObjectName(u'AdvancedChapterLabel') self.advancedBookLabel.setBuddy(self.advancedBookComboBox)
self.AdvancedLayout.addWidget(self.AdvancedChapterLabel, 3, 1, 1, 1) self.advancedLayout.addWidget(self.advancedBookComboBox, 2, 1, 1, 2)
self.AdvancedVerseLabel = QtGui.QLabel(self.AdvancedTab) self.advancedChapterLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedVerseLabel.setObjectName(u'AdvancedVerseLabel') self.advancedChapterLabel.setObjectName(u'advancedChapterLabel')
self.AdvancedLayout.addWidget(self.AdvancedVerseLabel, 3, 2, 1, 1) self.advancedLayout.addWidget(self.advancedChapterLabel, 3, 1)
self.AdvancedFromLabel = QtGui.QLabel(self.AdvancedTab) self.advancedVerseLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedFromLabel.setObjectName(u'AdvancedFromLabel') self.advancedVerseLabel.setObjectName(u'advancedVerseLabel')
self.AdvancedLayout.addWidget(self.AdvancedFromLabel, 4, 0, 1, 1) self.advancedLayout.addWidget(self.advancedVerseLabel, 3, 2)
self.AdvancedFromChapter = QtGui.QComboBox(self.AdvancedTab) self.advancedFromLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedFromChapter.setObjectName(u'AdvancedFromChapter') self.advancedFromLabel.setObjectName(u'advancedFromLabel')
self.AdvancedLayout.addWidget(self.AdvancedFromChapter, 4, 1, 1, 1) self.advancedLayout.addWidget(self.advancedFromLabel, 4, 0,
self.AdvancedFromVerse = QtGui.QComboBox(self.AdvancedTab) QtCore.Qt.AlignRight)
self.AdvancedFromVerse.setObjectName(u'AdvancedFromVerse') self.advancedFromChapter = QtGui.QComboBox(self.advancedTab)
self.AdvancedLayout.addWidget(self.AdvancedFromVerse, 4, 2, 1, 1) self.advancedFromChapter.setObjectName(u'advancedFromChapter')
self.AdvancedToLabel = QtGui.QLabel(self.AdvancedTab) self.advancedLayout.addWidget(self.advancedFromChapter, 4, 1)
self.AdvancedToLabel.setObjectName(u'AdvancedToLabel') self.advancedFromVerse = QtGui.QComboBox(self.advancedTab)
self.AdvancedLayout.addWidget(self.AdvancedToLabel, 5, 0, 1, 1) self.advancedFromVerse.setObjectName(u'advancedFromVerse')
self.AdvancedToChapter = QtGui.QComboBox(self.AdvancedTab) self.advancedLayout.addWidget(self.advancedFromVerse, 4, 2)
self.AdvancedToChapter.setObjectName(u'AdvancedToChapter') self.advancedToLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedLayout.addWidget(self.AdvancedToChapter, 5, 1, 1, 1) self.advancedToLabel.setObjectName(u'advancedToLabel')
self.AdvancedToVerse = QtGui.QComboBox(self.AdvancedTab) self.advancedLayout.addWidget(self.advancedToLabel, 5, 0,
self.AdvancedToVerse.setObjectName(u'AdvancedToVerse') QtCore.Qt.AlignRight)
self.AdvancedLayout.addWidget(self.AdvancedToVerse, 5, 2, 1, 1) self.advancedToChapter = QtGui.QComboBox(self.advancedTab)
self.AdvancedClearLabel = QtGui.QLabel(self.QuickTab) self.advancedToChapter.setObjectName(u'advancedToChapter')
self.AdvancedClearLabel.setObjectName(u'QuickSearchLabel') self.advancedLayout.addWidget(self.advancedToChapter, 5, 1)
self.AdvancedLayout.addWidget(self.AdvancedClearLabel, 6, 0, 1, 1) self.advancedToVerse = QtGui.QComboBox(self.advancedTab)
self.ClearAdvancedSearchComboBox = QtGui.QComboBox(self.QuickTab) self.advancedToVerse.setObjectName(u'advancedToVerse')
self.ClearAdvancedSearchComboBox.setObjectName( self.advancedLayout.addWidget(self.advancedToVerse, 5, 2)
u'ClearAdvancedSearchComboBox')
self.AdvancedLayout.addWidget( self.advancedClearLabel = QtGui.QLabel(self.quickTab)
self.ClearAdvancedSearchComboBox, 6, 1, 1, 2) self.advancedClearLabel.setObjectName(u'advancedClearLabel')
self.AdvancedSearchButtonLayout = QtGui.QHBoxLayout() self.advancedLayout.addWidget(self.advancedClearLabel, 6, 0,
self.AdvancedSearchButtonLayout.setMargin(0) QtCore.Qt.AlignRight)
self.AdvancedSearchButtonLayout.setSpacing(0) self.advancedClearComboBox = QtGui.QComboBox(self.quickTab)
self.AdvancedSearchButtonLayout.setObjectName( self.advancedClearComboBox.setSizePolicy(
u'AdvancedSearchButtonLayout') QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20, self.advancedClearComboBox.setObjectName(u'advancedClearComboBox')
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.advancedClearLabel.setBuddy(self.advancedClearComboBox)
self.AdvancedSearchButtonLayout.addItem(self.AdvancedSearchButtonSpacer) self.advancedLayout.addWidget(self.advancedClearComboBox, 6, 1, 1, 2)
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab) self.advancedSearchButtonLayout = QtGui.QHBoxLayout()
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton') self.advancedSearchButtonLayout.setObjectName(
self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton) u'advancedSearchButtonLayout')
self.AdvancedLayout.addLayout( self.advancedSearchButtonLayout.addStretch()
self.AdvancedSearchButtonLayout, 7, 0, 1, 3) self.advancedSearchButton = QtGui.QPushButton(self.advancedTab)
self.AdvancedMessage = QtGui.QLabel(self.AdvancedTab) self.advancedSearchButton.setObjectName(u'advancedSearchButton')
self.AdvancedMessage.setObjectName(u'AdvancedMessage') self.advancedSearchButtonLayout.addWidget(self.advancedSearchButton)
self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3) self.advancedLayout.addLayout(
self.SearchTabWidget.addTab(self.AdvancedTab, self.advancedSearchButtonLayout, 7, 0, 1, 3)
self.advancedMessage = QtGui.QLabel(self.advancedTab)
self.advancedMessage.setObjectName(u'advancedMessage')
self.advancedLayout.addWidget(self.advancedMessage, 8, 0, 1, 3)
self.searchTabWidget.addTab(self.advancedTab,
translate('BiblesPlugin.MediaItem', '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
QtCore.QObject.connect(self.AdvancedVersionComboBox, QtCore.QObject.connect(self.advancedVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
QtCore.QObject.connect(self.AdvancedBookComboBox, QtCore.QObject.connect(self.advancedBookComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
QtCore.QObject.connect(self.AdvancedFromChapter, QtCore.QObject.connect(self.advancedFromChapter,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromChapter) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromChapter)
QtCore.QObject.connect(self.AdvancedFromVerse, QtCore.QObject.connect(self.advancedFromVerse,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse)
QtCore.QObject.connect(self.AdvancedToChapter, QtCore.QObject.connect(self.advancedToChapter,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter)
QtCore.QObject.connect(self.QuickSearchComboBox, QtCore.QObject.connect(self.quickSearchComboBox,
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
QtCore.QObject.connect(self.QuickVersionComboBox, QtCore.QObject.connect(self.quickVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
# Buttons # Buttons
QtCore.QObject.connect(self.AdvancedSearchButton, QtCore.QObject.connect(self.advancedSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton) QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton)
QtCore.QObject.connect(self.QuickSearchButton, QtCore.QObject.connect(self.quickSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton) QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configUpdated) QtCore.SIGNAL(u'config_updated'), self.configUpdated)
# Other stuff # Other stuff
QtCore.QObject.connect(self.QuickSearchEdit, QtCore.QObject.connect(self.quickSearchEdit,
QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton) QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow) QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow)
@ -276,59 +268,59 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'configUpdated') log.debug(u'configUpdated')
if QtCore.QSettings().value(self.settingsSection + u'/second bibles', if QtCore.QSettings().value(self.settingsSection + u'/second bibles',
QtCore.QVariant(True)).toBool(): QtCore.QVariant(True)).toBool():
self.AdvancedSecondBibleLabel.setVisible(True) self.advancedSecondLabel.setVisible(True)
self.AdvancedSecondBibleComboBox.setVisible(True) self.advancedSecondComboBox.setVisible(True)
self.QuickSecondVersionLabel.setVisible(True) self.quickSecondLabel.setVisible(True)
self.QuickSecondBibleComboBox.setVisible(True) self.quickSecondComboBox.setVisible(True)
else: else:
self.AdvancedSecondBibleLabel.setVisible(False) self.advancedSecondLabel.setVisible(False)
self.AdvancedSecondBibleComboBox.setVisible(False) self.advancedSecondComboBox.setVisible(False)
self.QuickSecondVersionLabel.setVisible(False) self.quickSecondLabel.setVisible(False)
self.QuickSecondBibleComboBox.setVisible(False) self.quickSecondComboBox.setVisible(False)
def retranslateUi(self): def retranslateUi(self):
log.debug(u'retranslateUi') log.debug(u'retranslateUi')
self.QuickVersionLabel.setText( self.quickVersionLabel.setText(
translate('BiblesPlugin.MediaItem', 'Version:')) translate('BiblesPlugin.MediaItem', 'Version:'))
self.QuickSecondVersionLabel.setText( self.quickSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:')) translate('BiblesPlugin.MediaItem', 'Second:'))
self.QuickSearchLabel.setText( self.quickSearchTypeLabel.setText(
translate('BiblesPlugin.MediaItem', 'Search type:')) translate('BiblesPlugin.MediaItem', 'Search type:'))
self.QuickSearchLabel.setText( self.quickSearchLabel.setText(
translate('BiblesPlugin.MediaItem', 'Find:')) translate('BiblesPlugin.MediaItem', 'Find:'))
self.QuickSearchButton.setText( self.quickSearchButton.setText(
translate('BiblesPlugin.MediaItem', 'Search')) translate('BiblesPlugin.MediaItem', 'Search'))
self.QuickClearLabel.setText( self.quickClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:')) translate('BiblesPlugin.MediaItem', 'Results:'))
self.AdvancedVersionLabel.setText( self.advancedVersionLabel.setText(
translate('BiblesPlugin.MediaItem', 'Version:')) translate('BiblesPlugin.MediaItem', 'Version:'))
self.AdvancedSecondBibleLabel.setText( self.advancedSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:')) translate('BiblesPlugin.MediaItem', 'Second:'))
self.AdvancedBookLabel.setText( self.advancedBookLabel.setText(
translate('BiblesPlugin.MediaItem', 'Book:')) translate('BiblesPlugin.MediaItem', 'Book:'))
self.AdvancedChapterLabel.setText( self.advancedChapterLabel.setText(
translate('BiblesPlugin.MediaItem', 'Chapter:')) translate('BiblesPlugin.MediaItem', 'Chapter:'))
self.AdvancedVerseLabel.setText( self.advancedVerseLabel.setText(
translate('BiblesPlugin.MediaItem', 'Verse:')) translate('BiblesPlugin.MediaItem', 'Verse:'))
self.AdvancedFromLabel.setText( self.advancedFromLabel.setText(
translate('BiblesPlugin.MediaItem', 'From:')) translate('BiblesPlugin.MediaItem', 'From:'))
self.AdvancedToLabel.setText( self.advancedToLabel.setText(
translate('BiblesPlugin.MediaItem', 'To:')) translate('BiblesPlugin.MediaItem', 'To:'))
self.AdvancedClearLabel.setText( self.advancedClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:')) translate('BiblesPlugin.MediaItem', 'Results:'))
self.AdvancedSearchButton.setText( self.advancedSearchButton.setText(
translate('BiblesPlugin.MediaItem', 'Search')) translate('BiblesPlugin.MediaItem', 'Search'))
self.QuickSearchComboBox.addItem( self.quickSearchComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Verse Search')) translate('BiblesPlugin.MediaItem', 'Verse Search'))
self.QuickSearchComboBox.addItem( self.quickSearchComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Text Search')) translate('BiblesPlugin.MediaItem', 'Text Search'))
self.ClearQuickSearchComboBox.addItem( self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear')) translate('BiblesPlugin.MediaItem', 'Clear'))
self.ClearQuickSearchComboBox.addItem( self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Keep')) translate('BiblesPlugin.MediaItem', 'Keep'))
self.ClearAdvancedSearchComboBox.addItem( self.advancedClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear')) translate('BiblesPlugin.MediaItem', 'Clear'))
self.ClearAdvancedSearchComboBox.addItem( self.advancedClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Keep')) translate('BiblesPlugin.MediaItem', 'Keep'))
def initialise(self): def initialise(self):
@ -340,8 +332,8 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'bible manager initialise complete') log.debug(u'bible manager initialise complete')
def setQuickMessage(self, text): def setQuickMessage(self, text):
self.QuickMessage.setText(text) self.quickMessage.setText(text)
self.AdvancedMessage.setText(text) self.advancedMessage.setText(text)
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
# Minor delay to get the events processed. # Minor delay to get the events processed.
time.sleep(0.1) time.sleep(0.1)
@ -368,12 +360,12 @@ class BibleMediaItem(MediaManagerItem):
def loadBibles(self): def loadBibles(self):
log.debug(u'Loading Bibles') log.debug(u'Loading Bibles')
self.QuickVersionComboBox.clear() self.quickVersionComboBox.clear()
self.QuickSecondBibleComboBox.clear() self.quickSecondComboBox.clear()
self.AdvancedVersionComboBox.clear() self.advancedVersionComboBox.clear()
self.AdvancedSecondBibleComboBox.clear() self.advancedSecondComboBox.clear()
self.QuickSecondBibleComboBox.addItem(u'') self.quickSecondComboBox.addItem(u'')
self.AdvancedSecondBibleComboBox.addItem(u'') self.advancedSecondComboBox.addItem(u'')
# Get all bibles and sort the list. # Get all bibles and sort the list.
bibles = self.parent.manager.get_bibles().keys() bibles = self.parent.manager.get_bibles().keys()
bibles.sort() bibles.sort()
@ -381,10 +373,10 @@ class BibleMediaItem(MediaManagerItem):
first = True first = True
for bible in bibles: for bible in bibles:
if bible: if bible:
self.QuickVersionComboBox.addItem(bible) self.quickVersionComboBox.addItem(bible)
self.QuickSecondBibleComboBox.addItem(bible) self.quickSecondComboBox.addItem(bible)
self.AdvancedVersionComboBox.addItem(bible) self.advancedVersionComboBox.addItem(bible)
self.AdvancedSecondBibleComboBox.addItem(bible) self.advancedSecondComboBox.addItem(bible)
if first: if first:
first = False first = False
self.initialiseBible(bible) self.initialiseBible(bible)
@ -406,12 +398,12 @@ class BibleMediaItem(MediaManagerItem):
""" """
log.debug(u'initialiseBible %s', bible) log.debug(u'initialiseBible %s', bible)
book_data = self.parent.manager.get_books(bible) book_data = self.parent.manager.get_books(bible)
self.AdvancedBookComboBox.clear() self.advancedBookComboBox.clear()
first = True first = True
for book in book_data: for book in book_data:
row = self.AdvancedBookComboBox.count() row = self.advancedBookComboBox.count()
self.AdvancedBookComboBox.addItem(book[u'name']) self.advancedBookComboBox.addItem(book[u'name'])
self.AdvancedBookComboBox.setItemData( self.advancedBookComboBox.setItemData(
row, QtCore.QVariant(book[u'chapters'])) row, QtCore.QVariant(book[u'chapters']))
if first: if first:
first = False first = False
@ -423,16 +415,16 @@ class BibleMediaItem(MediaManagerItem):
self.chapter_count = chapter_count self.chapter_count = chapter_count
verse_count = self.parent.manager.get_verse_count(bible, book, 1) verse_count = self.parent.manager.get_verse_count(bible, book, 1)
if verse_count == 0: if verse_count == 0:
self.AdvancedSearchButton.setEnabled(False) self.advancedSearchButton.setEnabled(False)
self.AdvancedMessage.setText( self.advancedMessage.setText(
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.')) translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
else: else:
self.AdvancedSearchButton.setEnabled(True) self.advancedSearchButton.setEnabled(True)
self.AdvancedMessage.setText(u'') self.advancedMessage.setText(u'')
self.adjustComboBox(1, self.chapter_count, self.AdvancedFromChapter) self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
self.adjustComboBox(1, self.chapter_count, self.AdvancedToChapter) self.adjustComboBox(1, self.chapter_count, self.advancedToChapter)
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse) self.adjustComboBox(1, verse_count, self.advancedFromVerse)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse) self.adjustComboBox(1, verse_count, self.advancedToVerse)
def updateAutoCompleter(self): def updateAutoCompleter(self):
""" """
@ -442,73 +434,73 @@ class BibleMediaItem(MediaManagerItem):
""" """
books = [] books = []
# We have to do a 'Verse Search'. # We have to do a 'Verse Search'.
if self.QuickSearchComboBox.currentIndex() == 0: if self.quickSearchComboBox.currentIndex() == 0:
bibles = self.parent.manager.get_bibles() bibles = self.parent.manager.get_bibles()
bible = unicode(self.QuickVersionComboBox.currentText()) bible = unicode(self.quickVersionComboBox.currentText())
if bible: if bible:
book_data = bibles[bible].get_books() book_data = bibles[bible].get_books()
books = [book.name for book in book_data] books = [book.name for book in book_data]
books.sort() books.sort()
completer = QtGui.QCompleter(books) completer = QtGui.QCompleter(books)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.QuickSearchEdit.setCompleter(completer) self.quickSearchEdit.setCompleter(completer)
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):
self.initialiseBible( self.initialiseBible(
unicode(self.AdvancedVersionComboBox.currentText())) unicode(self.advancedVersionComboBox.currentText()))
def onAdvancedBookComboBox(self): def onAdvancedBookComboBox(self):
item = int(self.AdvancedBookComboBox.currentIndex()) item = int(self.advancedBookComboBox.currentIndex())
self.initialiseChapterVerse( self.initialiseChapterVerse(
unicode(self.AdvancedVersionComboBox.currentText()), unicode(self.advancedVersionComboBox.currentText()),
unicode(self.AdvancedBookComboBox.currentText()), unicode(self.advancedBookComboBox.currentText()),
self.AdvancedBookComboBox.itemData(item).toInt()[0]) self.advancedBookComboBox.itemData(item).toInt()[0])
def onAdvancedFromVerse(self): def onAdvancedFromVerse(self):
chapter_from = int(self.AdvancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
if chapter_from == chapter_to: if chapter_from == chapter_to:
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.advancedBookComboBox.currentText())
verse_from = int(self.AdvancedFromVerse.currentText()) verse_from = int(self.advancedFromVerse.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book, verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_to) chapter_to)
self.adjustComboBox(verse_from, verse_count, self.adjustComboBox(verse_from, verse_count,
self.AdvancedToVerse, True) self.advancedToVerse, True)
def onAdvancedToChapter(self): def onAdvancedToChapter(self):
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.advancedBookComboBox.currentText())
chapter_from = int(self.AdvancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
verse_from = int(self.AdvancedFromVerse.currentText()) verse_from = int(self.advancedFromVerse.currentText())
verse_to = int(self.AdvancedToVerse.currentText()) verse_to = int(self.advancedToVerse.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book, verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_to) chapter_to)
if chapter_from == chapter_to and verse_from > verse_to: if chapter_from == chapter_to and verse_from > verse_to:
self.adjustComboBox(verse_from, verse_count, self.AdvancedToVerse) self.adjustComboBox(verse_from, verse_count, self.advancedToVerse)
else: else:
self.adjustComboBox(1, verse_count, self.AdvancedToVerse) self.adjustComboBox(1, verse_count, self.advancedToVerse)
def onAdvancedFromChapter(self): def onAdvancedFromChapter(self):
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.advancedBookComboBox.currentText())
chapter_from = int(self.AdvancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book, verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_from) chapter_from)
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse) self.adjustComboBox(1, verse_count, self.advancedFromVerse)
if chapter_from > chapter_to: if chapter_from > chapter_to:
self.adjustComboBox(1, verse_count, self.AdvancedToVerse) self.adjustComboBox(1, verse_count, self.advancedToVerse)
self.adjustComboBox(chapter_from, self.chapter_count, self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter) self.advancedToChapter)
elif chapter_from == chapter_to: elif chapter_from == chapter_to:
self.adjustComboBox(chapter_from, self.chapter_count, self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter) self.advancedToChapter)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse, True) self.adjustComboBox(1, verse_count, self.advancedToVerse, True)
else: else:
self.adjustComboBox(chapter_from, self.chapter_count, self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter, True) self.advancedToChapter, True)
def adjustComboBox(self, range_from, range_to, combo, restore=False): def adjustComboBox(self, range_from, range_to, combo, restore=False):
""" """
@ -541,14 +533,14 @@ class BibleMediaItem(MediaManagerItem):
Does an advanced search and saves the search results. Does an advanced search and saves the search results.
""" """
log.debug(u'Advanced Search Button pressed') log.debug(u'Advanced Search Button pressed')
self.AdvancedSearchButton.setEnabled(False) self.advancedSearchButton.setEnabled(False)
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
second_bible = unicode(self.AdvancedSecondBibleComboBox.currentText()) second_bible = unicode(self.advancedSecondComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.advancedBookComboBox.currentText())
chapter_from = self.AdvancedFromChapter.currentText() chapter_from = self.advancedFromChapter.currentText()
chapter_to = self.AdvancedToChapter.currentText() chapter_to = self.advancedToChapter.currentText()
verse_from = self.AdvancedFromVerse.currentText() verse_from = self.advancedFromVerse.currentText()
verse_to = self.AdvancedToVerse.currentText() verse_to = self.advancedToVerse.currentText()
verse_separator = get_reference_match(u'sep_v_display') verse_separator = get_reference_match(u'sep_v_display')
range_separator = get_reference_match(u'sep_r_display') range_separator = get_reference_match(u'sep_r_display')
verse_range = chapter_from + verse_separator + verse_from + \ verse_range = chapter_from + verse_separator + verse_from + \
@ -558,7 +550,7 @@ class BibleMediaItem(MediaManagerItem):
if second_bible: if second_bible:
self.second_search_results = self.parent.manager.get_verses( self.second_search_results = self.parent.manager.get_verses(
second_bible, versetext) second_bible, versetext)
if self.ClearAdvancedSearchComboBox.currentIndex() == 0: if self.advancedClearComboBox.currentIndex() == 0:
self.listView.clear() self.listView.clear()
if self.listView.count() != 0: if self.listView.count() != 0:
# Check if the first item is a second bible item or not. # Check if the first item is a second bible item or not.
@ -578,7 +570,7 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
else: else:
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
self.AdvancedSearchButton.setEnabled(True) self.advancedSearchButton.setEnabled(True)
def onQuickSearchButton(self): def onQuickSearchButton(self):
""" """
@ -586,11 +578,11 @@ class BibleMediaItem(MediaManagerItem):
either be "Verse Search" or "Text Search". either be "Verse Search" or "Text Search".
""" """
log.debug(u'Quick Search Button pressed') log.debug(u'Quick Search Button pressed')
self.QuickSearchButton.setEnabled(False) self.quickSearchButton.setEnabled(False)
bible = unicode(self.QuickVersionComboBox.currentText()) bible = unicode(self.quickVersionComboBox.currentText())
second_bible = unicode(self.QuickSecondBibleComboBox.currentText()) second_bible = unicode(self.quickSecondComboBox.currentText())
text = unicode(self.QuickSearchEdit.text()) text = unicode(self.quickSearchEdit.text())
if self.QuickSearchComboBox.currentIndex() == 0: if self.quickSearchComboBox.currentIndex() == 0:
# We are doing a 'Verse Search'. # We are doing a 'Verse Search'.
self.search_results = self.parent.manager.get_verses(bible, text) self.search_results = self.parent.manager.get_verses(bible, text)
if second_bible and self.search_results: if second_bible and self.search_results:
@ -608,7 +600,7 @@ class BibleMediaItem(MediaManagerItem):
verse.verse)) verse.verse))
self.second_search_results = \ self.second_search_results = \
bibles[second_bible].get_verses(text) bibles[second_bible].get_verses(text)
if self.ClearQuickSearchComboBox.currentIndex() == 0: if self.quickClearComboBox.currentIndex() == 0:
self.listView.clear() self.listView.clear()
if self.listView.count() != 0 and self.search_results: if self.listView.count() != 0 and self.search_results:
bitem = self.listView.item(0) bitem = self.listView.item(0)
@ -627,13 +619,14 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
elif self.search_results: elif self.search_results:
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
self.QuickSearchButton.setEnabled(True) self.quickSearchButton.setEnabled(True)
def displayResults(self, bible, second_bible=u''): def displayResults(self, bible, second_bible=u''):
""" """
Displays the search results in the media manager. All data needed for Displays the search results in the media manager. All data needed for
further action is saved for/in each row. further action is saved for/in each row.
""" """
verse_separator = get_reference_match(u'sep_v_display')
version = self.parent.manager.get_meta_data(bible, u'Version') version = self.parent.manager.get_meta_data(bible, u'Version')
copyright = self.parent.manager.get_meta_data(bible, u'Copyright') copyright = self.parent.manager.get_meta_data(bible, u'Copyright')
permissions = self.parent.manager.get_meta_data(bible, u'Permissions') permissions = self.parent.manager.get_meta_data(bible, u'Permissions')
@ -669,8 +662,8 @@ class BibleMediaItem(MediaManagerItem):
} }
except IndexError: except IndexError:
break break
bible_text = u' %s %d:%d (%s, %s)' % (verse.book.name, bible_text = u' %s %d%s%d (%s, %s)' % (verse.book.name,
verse.chapter, verse.verse, version.value, verse.chapter, verse_separator, verse.verse, version.value,
second_version.value) second_version.value)
else: else:
vdict = { vdict = {
@ -688,8 +681,8 @@ class BibleMediaItem(MediaManagerItem):
'second_permissions': QtCore.QVariant(u''), 'second_permissions': QtCore.QVariant(u''),
'second_text': QtCore.QVariant(u'') 'second_text': QtCore.QVariant(u'')
} }
bible_text = u'%s %d:%d (%s)' % (verse.book.name, bible_text = u'%s %d%s%d (%s)' % (verse.book.name,
verse.chapter, verse.verse, version.value) verse.chapter, verse_separator, verse.verse, version.value)
bible_verse = QtGui.QListWidgetItem(bible_text) bible_verse = QtGui.QListWidgetItem(bible_text)
bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict)) bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict))
self.listView.addItem(bible_verse) self.listView.addItem(bible_verse)

View File

@ -43,8 +43,8 @@ Luke,Luke,Luke
John,John,John John,John,John
Acts,Acts,Acts Acts,Acts,Acts
Rom,Romans,Rom Rom,Romans,Rom
1Cor,1 Corinthans,1Cor 1Cor,1 Corinthians,1Cor
2Cor,2 Corinthans,2Cor 2Cor,2 Corinthians,2Cor
Gal,Galatians,Gal Gal,Galatians,Gal
Eph,Ephesians,Eph Eph,Ephesians,Eph
Phil,Philippians,Phil Phil,Philippians,Phil

1 Gen Genesis Gen
43 John John John
44 Acts Acts Acts
45 Rom Romans Rom
46 1Cor 1 Corinthans 1 Corinthians 1Cor
47 2Cor 2 Corinthans 2 Corinthians 2Cor
48 Gal Galatians Gal
49 Eph Ephesians Eph
50 Phil Philippians Phil

View File

@ -31,86 +31,73 @@ from openlp.core.lib import build_icon, translate
class Ui_CustomEditDialog(object): class Ui_CustomEditDialog(object):
def setupUi(self, customEditDialog): def setupUi(self, customEditDialog):
customEditDialog.setObjectName(u'customEditDialog') customEditDialog.setObjectName(u'customEditDialog')
customEditDialog.resize(590, 541) customEditDialog.resize(450, 350)
customEditDialog.setWindowIcon( customEditDialog.setWindowIcon(
build_icon(u':/icon/openlp.org-icon-32.bmp')) build_icon(u':/icon/openlp.org-icon-32.bmp'))
self.gridLayout = QtGui.QGridLayout(customEditDialog) self.dialogLayout = QtGui.QVBoxLayout(customEditDialog)
self.gridLayout.setObjectName(u'gridLayout') self.dialogLayout.setObjectName(u'dialogLayout')
self.horizontalLayout3 = QtGui.QHBoxLayout() self.titleLayout = QtGui.QHBoxLayout()
self.horizontalLayout3.setObjectName(u'horizontalLayout3') self.titleLayout.setObjectName(u'titleLayout')
self.titleLabel = QtGui.QLabel(customEditDialog)
self.titleLabel.setObjectName(u'titleLabel')
self.titleLayout.addWidget(self.titleLabel)
self.titleEdit = QtGui.QLineEdit(customEditDialog)
self.titleLabel.setBuddy(self.titleEdit)
self.titleEdit.setObjectName(u'titleEdit')
self.titleLayout.addWidget(self.titleEdit)
self.dialogLayout.addLayout(self.titleLayout)
self.centralLayout = QtGui.QHBoxLayout()
self.centralLayout.setObjectName(u'centralLayout')
self.slideListView = QtGui.QListWidget(customEditDialog)
self.slideListView.setAlternatingRowColors(True)
self.slideListView.setObjectName(u'slideListView')
self.centralLayout.addWidget(self.slideListView)
self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout')
self.addButton = QtGui.QPushButton(customEditDialog)
self.addButton.setObjectName(u'addButton')
self.buttonLayout.addWidget(self.addButton)
self.editButton = QtGui.QPushButton(customEditDialog)
self.editButton.setObjectName(u'editButton')
self.buttonLayout.addWidget(self.editButton)
self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton')
self.buttonLayout.addWidget(self.editAllButton)
self.deleteButton = QtGui.QPushButton(customEditDialog)
self.deleteButton.setObjectName(u'deleteButton')
self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch()
self.upButton = QtGui.QPushButton(customEditDialog)
self.upButton.setIcon(build_icon(u':/services/service_up.png'))
self.upButton.setObjectName(u'upButton')
self.buttonLayout.addWidget(self.upButton)
self.downButton = QtGui.QPushButton(customEditDialog)
self.downButton.setIcon(build_icon(u':/services/service_down.png'))
self.downButton.setObjectName(u'downButton')
self.buttonLayout.addWidget(self.downButton)
self.centralLayout.addLayout(self.buttonLayout)
self.dialogLayout.addLayout(self.centralLayout)
self.bottomFormLayout = QtGui.QFormLayout()
self.bottomFormLayout.setObjectName(u'bottomFormLayout')
self.themeLabel = QtGui.QLabel(customEditDialog) self.themeLabel = QtGui.QLabel(customEditDialog)
self.themeLabel.setObjectName(u'themeLabel') self.themeLabel.setObjectName(u'themeLabel')
self.horizontalLayout3.addWidget(self.themeLabel)
self.themeComboBox = QtGui.QComboBox(customEditDialog) self.themeComboBox = QtGui.QComboBox(customEditDialog)
self.themeLabel.setBuddy(self.themeComboBox) self.themeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.themeComboBox.setObjectName(u'themeComboBox') self.themeComboBox.setObjectName(u'themeComboBox')
self.horizontalLayout3.addWidget(self.themeComboBox) self.themeLabel.setBuddy(self.themeComboBox)
self.gridLayout.addLayout(self.horizontalLayout3, 2, 0, 1, 1) self.bottomFormLayout.addRow(self.themeLabel, self.themeComboBox)
self.horizontalLayout2 = QtGui.QHBoxLayout()
self.horizontalLayout2.setObjectName(u'horizontalLayout2')
self.creditLabel = QtGui.QLabel(customEditDialog) self.creditLabel = QtGui.QLabel(customEditDialog)
self.creditLabel.setObjectName(u'creditLabel') self.creditLabel.setObjectName(u'creditLabel')
self.horizontalLayout2.addWidget(self.creditLabel)
self.creditEdit = QtGui.QLineEdit(customEditDialog) self.creditEdit = QtGui.QLineEdit(customEditDialog)
self.creditLabel.setBuddy(self.creditEdit)
self.creditEdit.setObjectName(u'creditEdit') self.creditEdit.setObjectName(u'creditEdit')
self.horizontalLayout2.addWidget(self.creditEdit) self.creditLabel.setBuddy(self.creditEdit)
self.gridLayout.addLayout(self.horizontalLayout2, 3, 0, 1, 1) self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
self.dialogLayout.addLayout(self.bottomFormLayout)
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog) self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 1) self.dialogLayout.addWidget(self.buttonBox)
self.horizontalLayout4 = QtGui.QHBoxLayout()
self.horizontalLayout4.setObjectName(u'horizontalLayout4')
self.slideListView = QtGui.QListWidget(customEditDialog)
self.slideListView.setAlternatingRowColors(True)
self.slideListView.setObjectName(u'slideListView')
self.horizontalLayout4.addWidget(self.slideListView)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(u'verticalLayout')
self.addButton = QtGui.QPushButton(customEditDialog)
self.addButton.setObjectName(u'addButton')
self.verticalLayout.addWidget(self.addButton)
self.editButton = QtGui.QPushButton(customEditDialog)
self.editButton.setObjectName(u'editButton')
self.verticalLayout.addWidget(self.editButton)
self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton')
self.verticalLayout.addWidget(self.editAllButton)
self.deleteButton = QtGui.QPushButton(customEditDialog)
self.deleteButton.setObjectName(u'deleteButton')
self.verticalLayout.addWidget(self.deleteButton)
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.upButton = QtGui.QPushButton(customEditDialog)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(u':/services/service_up.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.upButton.setIcon(icon1)
self.upButton.setObjectName(u'upButton')
self.verticalLayout.addWidget(self.upButton)
self.downButton = QtGui.QPushButton(customEditDialog)
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(u':/services/service_down.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.downButton.setIcon(icon2)
self.downButton.setObjectName(u'downButton')
self.verticalLayout.addWidget(self.downButton)
self.horizontalLayout4.addLayout(self.verticalLayout)
self.gridLayout.addLayout(self.horizontalLayout4, 1, 0, 1, 1)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.titleLabel = QtGui.QLabel(customEditDialog)
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)
self.retranslateUi(customEditDialog) self.retranslateUi(customEditDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
customEditDialog.accept) customEditDialog.accept)
@ -152,4 +139,4 @@ class Ui_CustomEditDialog(object):
self.themeLabel.setText( self.themeLabel.setText(
translate('CustomPlugin.EditCustomForm', 'The&me:')) translate('CustomPlugin.EditCustomForm', 'The&me:'))
self.creditLabel.setText( self.creditLabel.setText(
translate('CustomPlugin.EditCustomForm', '&Credits:')) translate('CustomPlugin.EditCustomForm', '&Credits:'))

View File

@ -31,19 +31,20 @@ from openlp.core.lib import translate, SpellTextEdit
class Ui_CustomSlideEditDialog(object): class Ui_CustomSlideEditDialog(object):
def setupUi(self, customSlideEditDialog): def setupUi(self, customSlideEditDialog):
customSlideEditDialog.setObjectName(u'customSlideEditDialog') customSlideEditDialog.setObjectName(u'customSlideEditDialog')
customSlideEditDialog.resize(474, 442) customSlideEditDialog.resize(350, 300)
self.dialogLayout = QtGui.QVBoxLayout(customSlideEditDialog)
self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setObjectName(u'slideTextEdit')
self.dialogLayout.addWidget(self.slideTextEdit)
self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog) self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog)
self.buttonBox.setGeometry(QtCore.QRect(8, 407, 458, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349))
self.slideTextEdit.setObjectName(u'slideTextEdit')
self.splitButton = QtGui.QPushButton(customSlideEditDialog) self.splitButton = QtGui.QPushButton(customSlideEditDialog)
self.splitButton.setGeometry(QtCore.QRect(380, 370, 85, 27))
self.splitButton.setObjectName(u'splitButton') self.splitButton.setObjectName(u'splitButton')
self.buttonBox.addButton(self.splitButton,
QtGui.QDialogButtonBox.ActionRole)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(customSlideEditDialog) self.retranslateUi(customSlideEditDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
customSlideEditDialog.accept) customSlideEditDialog.accept)
@ -56,4 +57,4 @@ class Ui_CustomSlideEditDialog(object):
translate('CustomPlugin.EditCustomForm', 'Split Slide')) translate('CustomPlugin.EditCustomForm', 'Split Slide'))
self.splitButton.setToolTip( self.splitButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Split a slide into two ' translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
'by inserting a slide splitter.')) 'by inserting a slide splitter.'))

View File

@ -37,21 +37,17 @@ class CustomTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'CustomTab') self.setObjectName(u'CustomTab')
self.customLayout = QtGui.QFormLayout(self) SettingsTab.setupUi(self)
self.customLayout.setSpacing(8) self.customModeGroupBox = QtGui.QGroupBox(self.leftColumn)
self.customLayout.setMargin(8)
self.customLayout.setObjectName(u'customLayout')
self.customModeGroupBox = QtGui.QGroupBox(self)
self.customModeGroupBox.setObjectName(u'customModeGroupBox') self.customModeGroupBox.setObjectName(u'customModeGroupBox')
self.customModeLayout = QtGui.QVBoxLayout(self.customModeGroupBox) self.customModeLayout = QtGui.QFormLayout(self.customModeGroupBox)
self.customModeLayout.setSpacing(8)
self.customModeLayout.setMargin(8)
self.customModeLayout.setObjectName(u'customModeLayout') self.customModeLayout.setObjectName(u'customModeLayout')
self.displayFooterCheckBox = QtGui.QCheckBox(self.customModeGroupBox) self.displayFooterCheckBox = QtGui.QCheckBox(self.customModeGroupBox)
self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox') self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox')
self.customModeLayout.addWidget(self.displayFooterCheckBox) self.customModeLayout.addRow(self.displayFooterCheckBox)
self.customLayout.setWidget( self.leftLayout.addWidget(self.customModeGroupBox)
0, QtGui.QFormLayout.LabelRole, self.customModeGroupBox) self.leftLayout.addStretch()
self.rightLayout.addStretch()
QtCore.QObject.connect(self.displayFooterCheckBox, QtCore.QObject.connect(self.displayFooterCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onDisplayFooterCheckBoxChanged) self.onDisplayFooterCheckBoxChanged)
@ -76,4 +72,4 @@ class CustomTab(SettingsTab):
def save(self): def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/display footer', QtCore.QSettings().setValue(self.settingsSection + u'/display footer',
QtCore.QVariant(self.displayFooter)) QtCore.QVariant(self.displayFooter))

View File

@ -30,8 +30,7 @@ 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, BaseListWithDnD, build_icon, \
context_menu_action, ItemCapabilities, SettingsManager, translate, \ ItemCapabilities, SettingsManager, translate, check_item_selected, Receiver
check_item_selected
from openlp.core.utils import AppLocation, get_images_filter from openlp.core.utils import AppLocation, get_images_filter
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -63,6 +62,14 @@ class ImageMediaItem(MediaManagerItem):
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(translate('ImagePlugin.MediaItem', 'All Files'))) unicode(translate('ImagePlugin.MediaItem', 'All Files')))
self.replaceAction.setText(
translate('ImagePlugin.MediaItem', 'Replace Background'))
self.replaceAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Replace Live Background'))
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)
@ -88,35 +95,14 @@ class ImageMediaItem(MediaManagerItem):
def addListViewToToolBar(self): def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self) MediaManagerItem.addListViewToToolBar(self)
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.listView.addAction( self.listView.addAction(self.replaceAction)
context_menu_action(
self.listView, u':/slides/slide_blank.png',
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick))
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.ImageWidget = QtGui.QWidget(self) self.replaceAction = self.addToolbarButton(u'', u'',
sizePolicy = QtGui.QSizePolicy( u':/slides/slide_blank.png', self.onReplaceClick, False)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.resetAction = self.addToolbarButton(u'', u'',
sizePolicy.setHorizontalStretch(0) u':/system/system_close.png', self.onResetClick, False)
sizePolicy.setVerticalStretch(0) self.resetAction.setVisible(False)
sizePolicy.setHeightForWidth(
self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget')
self.blankButton = self.toolbar.addToolbarButton(
translate('ImagePlugin.MediaItem', 'Replace Background'),
u':/slides/slide_blank.png',
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick, False)
self.resetButton = self.toolbar.addToolbarButton(
translate('ImagePlugin.MediaItem', 'Reset Background'),
u':/system/system_close.png',
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
self.onResetClick, False)
# Add the song widget to the page layout.
self.pageLayout.addWidget(self.ImageWidget)
self.resetButton.setVisible(False)
def onDeleteClick(self): def onDeleteClick(self):
""" """
@ -204,10 +190,13 @@ class ImageMediaItem(MediaManagerItem):
return False return False
def onResetClick(self): def onResetClick(self):
self.resetButton.setVisible(False) self.resetAction.setVisible(False)
self.parent.liveController.display.resetImage() self.parent.liveController.display.resetImage()
def onReplaceClick(self): def onReplaceClick(self):
"""
Called to replace Live backgound with the video selected
"""
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem', translate('ImagePlugin.MediaItem',
'You must select an image to replace the background with.')): 'You must select an image to replace the background with.')):
@ -217,13 +206,14 @@ class ImageMediaItem(MediaManagerItem):
if os.path.exists(filename): if os.path.exists(filename):
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)
self.parent.liveController.display.directImage(name, filename) self.parent.liveController.display.directImage(name, filename)
self.resetAction.setVisible(True)
else: else:
QtGui.QMessageBox.critical(self, Receiver.send_message(u'openlp_error_message', {
translate('ImagePlugin.MediaItem', 'Live Background Could ' u'title': translate('ImagePlugin.MediaItem',
'Not Be Replaced'), 'Live Background Error'),
unicode(translate('ImagePlugin.MediaItem', u'message': unicode(translate('ImagePlugin.MediaItem',
'The image %s no longer exists.')) % filename) 'There was a problem replacing your background, '
self.resetButton.setVisible(True) 'the image file "%s" no longer exists.')) % filename})
def onPreviewClick(self): def onPreviewClick(self):
MediaManagerItem.onPreviewClick(self) MediaManagerItem.onPreviewClick(self)

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate, check_item_selected, \ ItemCapabilities, SettingsManager, translate, check_item_selected, \
context_menu_action Receiver
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -63,6 +63,14 @@ class MediaMediaItem(MediaManagerItem):
self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem', self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
'Videos (%s);;Audio (%s);;All files (*)')) % \ 'Videos (%s);;Audio (%s);;All files (*)')) % \
(self.parent.video_list, self.parent.audio_list) (self.parent.video_list, self.parent.audio_list)
self.replaceAction.setText(
translate('MediaPlugin.MediaItem', 'Replace Background'))
self.replaceAction.setToolTip(
translate('MediaPlugin.MediaItem', 'Replace Live Background'))
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)
@ -73,47 +81,37 @@ class MediaMediaItem(MediaManagerItem):
def addListViewToToolBar(self): def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self) MediaManagerItem.addListViewToToolBar(self)
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.listView.addAction( self.listView.addAction(self.replaceAction)
context_menu_action(self.listView, u':/slides/slide_blank.png',
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick))
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.ImageWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget')
# Replace backgrounds do not work at present so remove functionality. # Replace backgrounds do not work at present so remove functionality.
self.blankButton = self.toolbar.addToolbarButton( self.replaceAction = self.addToolbarButton(u'', u'',
translate('MediaPlugin.MediaItem', 'Replace Background'), u':/slides/slide_blank.png', self.onReplaceClick, False)
u':/slides/slide_blank.png', self.resetAction = self.addToolbarButton(u'', u'',
translate('MediaPlugin.MediaItem', 'Replace Live Background'), u':/system/system_close.png', self.onResetClick, False)
self.onReplaceClick, False) self.resetAction.setVisible(False)
self.resetButton = self.toolbar.addToolbarButton(
u'Reset Background', u':/system/system_close.png',
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
self.onResetClick, False)
# Add the song widget to the page layout
self.pageLayout.addWidget(self.ImageWidget)
self.resetButton.setVisible(False)
def onResetClick(self): def onResetClick(self):
self.resetButton.setVisible(False) self.resetAction.setVisible(False)
self.parent.liveController.display.resetVideo() self.parent.liveController.display.resetVideo()
def onReplaceClick(self): def onReplaceClick(self):
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem', translate('MediaPlugin.MediaItem',
'You must select a media file to replace the background with.')): 'You must select a media file to replace the background with.')):
item = self.listView.currentItem() item = self.listView.currentItem()
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = unicode(item.data(QtCore.Qt.UserRole).toString())
self.parent.liveController.display.video(filename, 0, True) if os.path.exists(filename):
self.resetButton.setVisible(True) (path, name) = os.path.split(filename)
self.parent.liveController.display.video(filename, 0, True)
self.resetAction.setVisible(True)
else:
Receiver.send_message(u'openlp_error_message', {
u'title': translate('MediaPlugin.MediaItem',
'Live Background Error'),
u'message': unicode(translate('MediaPlugin.MediaItem',
'There was a problem replacing your background, '
'the media file "%s" no longer exists.')) % filename})
def generateSlideData(self, service_item, item=None, xmlVersion=False): def generateSlideData(self, service_item, item=None, xmlVersion=False):
if item is None: if item is None:

View File

@ -37,27 +37,23 @@ class MediaTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'MediaTab') self.setObjectName(u'MediaTab')
self.tabTitleVisible = translate('MediaPlugin.MediaTab', 'Media') SettingsTab.setupUi(self)
self.mediaLayout = QtGui.QFormLayout(self) self.mediaModeGroupBox = QtGui.QGroupBox(self.leftColumn)
self.mediaLayout.setSpacing(8)
self.mediaLayout.setMargin(8)
self.mediaLayout.setObjectName(u'mediaLayout')
self.mediaModeGroupBox = QtGui.QGroupBox(self)
self.mediaModeGroupBox.setObjectName(u'mediaModeGroupBox') self.mediaModeGroupBox.setObjectName(u'mediaModeGroupBox')
self.mediaModeLayout = QtGui.QVBoxLayout(self.mediaModeGroupBox) self.mediaModeLayout = QtGui.QFormLayout(self.mediaModeGroupBox)
self.mediaModeLayout.setSpacing(8)
self.mediaModeLayout.setMargin(8)
self.mediaModeLayout.setObjectName(u'mediaModeLayout') self.mediaModeLayout.setObjectName(u'mediaModeLayout')
self.usePhononCheckBox = QtGui.QCheckBox(self.mediaModeGroupBox) self.usePhononCheckBox = QtGui.QCheckBox(self.mediaModeGroupBox)
self.usePhononCheckBox.setObjectName(u'usePhononCheckBox') self.usePhononCheckBox.setObjectName(u'usePhononCheckBox')
self.mediaModeLayout.addWidget(self.usePhononCheckBox) self.mediaModeLayout.addRow(self.usePhononCheckBox)
self.mediaLayout.setWidget( self.leftLayout.addWidget(self.mediaModeGroupBox)
0, QtGui.QFormLayout.LabelRole, self.mediaModeGroupBox) self.leftLayout.addStretch()
self.rightLayout.addStretch()
QtCore.QObject.connect(self.usePhononCheckBox, QtCore.QObject.connect(self.usePhononCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onUsePhononCheckBoxChanged) self.onUsePhononCheckBoxChanged)
def retranslateUi(self): def retranslateUi(self):
self.tabTitleVisible = translate('MediaPlugin.MediaTab', 'Media')
self.mediaModeGroupBox.setTitle(translate('MediaPlugin.MediaTab', self.mediaModeGroupBox.setTitle(translate('MediaPlugin.MediaTab',
'Media Display')) 'Media Display'))
self.usePhononCheckBox.setText( self.usePhononCheckBox.setText(
@ -79,4 +75,4 @@ class MediaTab(SettingsTab):
if oldUsePhonon != self.usePhonon: if oldUsePhonon != self.usePhonon:
QtCore.QSettings().setValue(self.settingsSection + u'/use phonon', QtCore.QSettings().setValue(self.settingsSection + u'/use phonon',
QtCore.QVariant(self.usePhonon)) QtCore.QVariant(self.usePhonon))
Receiver.send_message(u'config_screen_changed') Receiver.send_message(u'config_screen_changed')

View File

@ -79,7 +79,7 @@ class MediaPlugin(Plugin):
return MediaTab(self.name) return MediaTab(self.name)
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object.
return MediaMediaItem(self, self, self.icon) return MediaMediaItem(self, self, self.icon)
def about(self): def about(self):

View File

@ -76,6 +76,8 @@ class PresentationMediaItem(MediaManagerItem):
'Select Presentation(s)') 'Select Presentation(s)')
self.Automatic = translate('PresentationPlugin.MediaItem', self.Automatic = translate('PresentationPlugin.MediaItem',
'Automatic') 'Automatic')
self.displayTypeLabel.setText(
translate('PresentationPlugin.MediaItem', 'Present using:'))
def buildFileMaskString(self): def buildFileMaskString(self):
""" """
@ -106,27 +108,22 @@ class PresentationMediaItem(MediaManagerItem):
""" """
Display custom media manager items for presentations Display custom media manager items for presentations
""" """
self.PresentationWidget = QtGui.QWidget(self) self.presentationWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy( self.presentationWidget.setObjectName(u'presentationWidget')
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.displayLayout = QtGui.QFormLayout(self.presentationWidget)
sizePolicy.setHorizontalStretch(0) self.displayLayout.setMargin(self.displayLayout.spacing())
sizePolicy.setVerticalStretch(0) self.displayLayout.setObjectName(u'displayLayout')
sizePolicy.setHeightForWidth( self.displayTypeLabel = QtGui.QLabel(self.presentationWidget)
self.PresentationWidget.sizePolicy().hasHeightForWidth()) self.displayTypeLabel.setObjectName(u'displayTypeLabel')
self.PresentationWidget.setSizePolicy(sizePolicy) self.displayTypeComboBox = QtGui.QComboBox(self.presentationWidget)
self.PresentationWidget.setObjectName(u'PresentationWidget') self.displayTypeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget) QtGui.QSizePolicy.Fixed)
self.DisplayLayout.setObjectName(u'DisplayLayout') self.displayTypeComboBox.setObjectName(u'displayTypeComboBox')
self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget) self.displayTypeLabel.setBuddy(self.displayTypeComboBox)
self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox') self.displayLayout.addRow(self.displayTypeLabel,
self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2) self.displayTypeComboBox)
self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
self.DisplayTypeLabel.setText(
translate('PresentationPlugin.MediaItem', 'Present using:'))
# Add the Presentation widget to the page layout # Add the Presentation widget to the page layout
self.pageLayout.addWidget(self.PresentationWidget) self.pageLayout.addWidget(self.presentationWidget)
def initialise(self): def initialise(self):
""" """
@ -151,19 +148,19 @@ class PresentationMediaItem(MediaManagerItem):
Load the combobox with the enabled presentation controllers, Load the combobox with the enabled presentation controllers,
allowing user to select a specific app if settings allow allowing user to select a specific app if settings allow
""" """
self.DisplayTypeComboBox.clear() self.displayTypeComboBox.clear()
for item in self.controllers: for item in self.controllers:
# load the drop down selection # load the drop down selection
if self.controllers[item].enabled(): if self.controllers[item].enabled():
self.DisplayTypeComboBox.addItem(item) self.displayTypeComboBox.addItem(item)
if self.DisplayTypeComboBox.count() > 1: if self.displayTypeComboBox.count() > 1:
self.DisplayTypeComboBox.insertItem(0, self.Automatic) self.displayTypeComboBox.insertItem(0, self.Automatic)
self.DisplayTypeComboBox.setCurrentIndex(0) self.displayTypeComboBox.setCurrentIndex(0)
if QtCore.QSettings().value(self.settingsSection + u'/override app', if QtCore.QSettings().value(self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
self.PresentationWidget.show() self.presentationWidget.show()
else: else:
self.PresentationWidget.hide() self.presentationWidget.hide()
def loadList(self, list, initialLoad=False): def loadList(self, list, initialLoad=False):
""" """
@ -247,8 +244,8 @@ class PresentationMediaItem(MediaManagerItem):
items = self.listView.selectedIndexes() items = self.listView.selectedIndexes()
if len(items) > 1: if len(items) > 1:
return False return False
service_item.title = unicode(self.DisplayTypeComboBox.currentText()) service_item.title = unicode(self.displayTypeComboBox.currentText())
service_item.shortname = unicode(self.DisplayTypeComboBox.currentText()) service_item.shortname = unicode(self.displayTypeComboBox.currentText())
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay) service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
shortname = service_item.shortname shortname = service_item.shortname
if shortname: if shortname:

View File

@ -44,76 +44,47 @@ class PresentationTab(SettingsTab):
Create the controls for the settings tab Create the controls for the settings tab
""" """
self.setObjectName(u'PresentationTab') self.setObjectName(u'PresentationTab')
self.PresentationLayout = QtGui.QHBoxLayout(self) SettingsTab.setupUi(self)
self.PresentationLayout.setSpacing(8) self.ControllersGroupBox = QtGui.QGroupBox(self.leftColumn)
self.PresentationLayout.setMargin(8) self.ControllersGroupBox.setObjectName(u'ControllersGroupBox')
self.PresentationLayout.setObjectName(u'PresentationLayout') self.ControllersLayout = QtGui.QVBoxLayout(self.ControllersGroupBox)
self.PresentationLeftWidget = QtGui.QWidget(self) self.ControllersLayout.setObjectName(u'ControllersLayout')
self.PresentationLeftWidget.setObjectName(u'PresentationLeftWidget')
self.PresentationLeftLayout = QtGui.QVBoxLayout(
self.PresentationLeftWidget)
self.PresentationLeftLayout.setObjectName(u'PresentationLeftLayout')
self.PresentationLeftLayout.setSpacing(8)
self.PresentationLeftLayout.setMargin(0)
self.VerseDisplayGroupBox = QtGui.QGroupBox(self)
self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox')
self.VerseDisplayLayout = QtGui.QVBoxLayout(self.VerseDisplayGroupBox)
self.VerseDisplayLayout.setMargin(8)
self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout')
self.PresenterCheckboxes = {} self.PresenterCheckboxes = {}
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
checkbox = QtGui.QCheckBox(self.VerseDisplayGroupBox) checkbox = QtGui.QCheckBox(self.ControllersGroupBox)
checkbox.setTristate(False)
checkbox.setEnabled(controller.available) checkbox.setEnabled(controller.available)
checkbox.setObjectName(controller.name + u'CheckBox') checkbox.setObjectName(controller.name + u'CheckBox')
self.PresenterCheckboxes[controller.name] = checkbox self.PresenterCheckboxes[controller.name] = checkbox
self.VerseDisplayLayout.addWidget(checkbox) self.ControllersLayout.addWidget(checkbox)
self.PresentationThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox) self.leftLayout.addWidget(self.ControllersGroupBox)
self.PresentationThemeWidget.setObjectName(u'PresentationThemeWidget') self.AdvancedGroupBox = QtGui.QGroupBox(self.leftColumn)
self.PresentationThemeLayout = QtGui.QHBoxLayout(
self.PresentationThemeWidget)
self.PresentationThemeLayout.setSpacing(8)
self.PresentationThemeLayout.setMargin(0)
self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout')
self.AdvancedGroupBox = QtGui.QGroupBox(self)
self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox') self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox')
self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox) self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox)
self.AdvancedLayout.setSpacing(8)
self.AdvancedLayout.setMargin(8)
self.AdvancedLayout.setObjectName(u'AdvancedLayout') self.AdvancedLayout.setObjectName(u'AdvancedLayout')
self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox) self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox)
self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox') self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox')
self.AdvancedLayout.addWidget(self.OverrideAppCheckBox) self.AdvancedLayout.addWidget(self.OverrideAppCheckBox)
self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox) self.leftLayout.addWidget(self.AdvancedGroupBox)
self.PresentationLeftLayout.addWidget(self.AdvancedGroupBox) self.leftLayout.addStretch()
self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20, self.rightLayout.addStretch()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer)
self.PresentationLayout.addWidget(self.PresentationLeftWidget)
self.PresentationRightWidget = QtGui.QWidget(self)
self.PresentationRightWidget.setObjectName(u'PresentationRightWidget')
self.PresentationRightLayout = QtGui.QVBoxLayout(
self.PresentationRightWidget)
self.PresentationRightLayout.setObjectName(u'PresentationRightLayout')
self.PresentationRightLayout.setSpacing(8)
self.PresentationRightLayout.setMargin(0)
self.PresentationRightSpacer = QtGui.QSpacerItem(50, 20,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.PresentationRightLayout.addItem(self.PresentationRightSpacer)
self.PresentationLayout.addWidget(self.PresentationRightWidget)
def retranslateUi(self): def retranslateUi(self):
""" """
Make any translation changes Make any translation changes
""" """
self.VerseDisplayGroupBox.setTitle( self.ControllersGroupBox.setTitle(
translate('PresentationPlugin.PresentationTab', translate('PresentationPlugin.PresentationTab',
'Available Controllers')) 'Available Controllers'))
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name] checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setText(controller.name) if controller.available:
checkbox.setText(controller.name)
else:
checkbox.setText(
unicode(translate('PresentationPlugin.PresentationTab',
'%s (unvailable)')) % controller.name)
self.AdvancedGroupBox.setTitle( self.AdvancedGroupBox.setTitle(
translate('PresentationPlugin.PresentationTab', translate('PresentationPlugin.PresentationTab',
'Advanced')) 'Advanced'))
@ -127,11 +98,10 @@ class PresentationTab(SettingsTab):
""" """
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
if controller.available: checkbox = self.PresenterCheckboxes[controller.name]
checkbox = self.PresenterCheckboxes[controller.name] checkbox.setChecked(QtCore.QSettings().value(
checkbox.setChecked(QtCore.QSettings().value( self.settingsSection + u'/' + controller.name,
self.settingsSection + u'/' + controller.name, QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0])
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0])
self.OverrideAppCheckBox.setChecked(QtCore.QSettings().value( self.OverrideAppCheckBox.setChecked(QtCore.QSettings().value(
self.settingsSection + u'/override app', self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0]) QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
@ -143,16 +113,18 @@ class PresentationTab(SettingsTab):
changed = False changed = False
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name] if controller.available:
setting_key = self.settingsSection + u'/' + controller.name checkbox = self.PresenterCheckboxes[controller.name]
if QtCore.QSettings().value(setting_key) != checkbox.checkState(): setting_key = self.settingsSection + u'/' + controller.name
changed = True if QtCore.QSettings().value(setting_key) != \
QtCore.QSettings().setValue(setting_key, checkbox.checkState():
QtCore.QVariant(checkbox.checkState())) changed = True
if checkbox.checkState() == QtCore.Qt.Checked: QtCore.QSettings().setValue(setting_key,
controller.start_process() QtCore.QVariant(checkbox.checkState()))
else: if checkbox.isChecked():
controller.kill() controller.start_process()
else:
controller.kill()
setting_key = self.settingsSection + u'/override app' setting_key = self.settingsSection + u'/override app'
if QtCore.QSettings().value(setting_key) != \ if QtCore.QSettings().value(setting_key) != \
self.OverrideAppCheckBox.checkState(): self.OverrideAppCheckBox.checkState():
@ -160,4 +132,4 @@ class PresentationTab(SettingsTab):
QtCore.QVariant(self.OverrideAppCheckBox.checkState())) QtCore.QVariant(self.OverrideAppCheckBox.checkState()))
changed = True changed = True
if changed: if changed:
Receiver.send_message(u'mediaitem_presentation_rebuild') Receiver.send_message(u'mediaitem_presentation_rebuild')

View File

@ -37,34 +37,38 @@ class RemoteTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'RemoteTab') self.setObjectName(u'RemoteTab')
self.remoteLayout = QtGui.QFormLayout(self) SettingsTab.setupUi(self)
self.remoteLayout.setSpacing(8) self.serverSettingsGroupBox = QtGui.QGroupBox(self.leftColumn)
self.remoteLayout.setMargin(8)
self.remoteLayout.setObjectName(u'remoteLayout')
self.serverSettingsGroupBox = QtGui.QGroupBox(self)
self.serverSettingsGroupBox.setObjectName(u'serverSettingsGroupBox') self.serverSettingsGroupBox.setObjectName(u'serverSettingsGroupBox')
self.serverSettingsLayout = QtGui.QFormLayout( self.serverSettingsLayout = QtGui.QFormLayout(
self.serverSettingsGroupBox) self.serverSettingsGroupBox)
self.serverSettingsLayout.setSpacing(8)
self.serverSettingsLayout.setMargin(8)
self.serverSettingsLayout.setObjectName(u'serverSettingsLayout') self.serverSettingsLayout.setObjectName(u'serverSettingsLayout')
self.addressLabel = QtGui.QLabel(self.serverSettingsGroupBox)
self.addressLabel.setObjectName(u'addressLabel')
self.addressEdit = QtGui.QLineEdit(self.serverSettingsGroupBox) self.addressEdit = QtGui.QLineEdit(self.serverSettingsGroupBox)
self.addressEdit.setSizePolicy(QtGui.QSizePolicy.Preferred,
QtGui.QSizePolicy.Fixed)
self.addressEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(
u'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'), self))
self.addressEdit.setObjectName(u'addressEdit') self.addressEdit.setObjectName(u'addressEdit')
self.serverSettingsLayout.addRow( self.serverSettingsLayout.addRow(self.addressLabel, self.addressEdit)
translate('RemotePlugin.RemoteTab', 'Serve on IP address:'), self.portLabel = QtGui.QLabel(self.serverSettingsGroupBox)
self.addressEdit) self.portLabel.setObjectName(u'portLabel')
self.portSpinBox = QtGui.QSpinBox(self.serverSettingsGroupBox) self.portSpinBox = QtGui.QSpinBox(self.serverSettingsGroupBox)
self.portSpinBox.setObjectName(u'portSpinBox')
self.portSpinBox.setMaximum(32767) self.portSpinBox.setMaximum(32767)
self.serverSettingsLayout.addRow( self.portSpinBox.setObjectName(u'portSpinBox')
translate('RemotePlugin.RemoteTab', 'Port number:'), self.serverSettingsLayout.addRow(self.portLabel, self.portSpinBox)
self.portSpinBox) self.leftLayout.addWidget(self.serverSettingsGroupBox)
self.remoteLayout.setWidget( self.leftLayout.addStretch()
0, QtGui.QFormLayout.LabelRole, self.serverSettingsGroupBox) self.rightLayout.addStretch()
def retranslateUi(self): def retranslateUi(self):
self.serverSettingsGroupBox.setTitle( self.serverSettingsGroupBox.setTitle(
translate('RemotePlugin.RemoteTab', 'Server Settings')) translate('RemotePlugin.RemoteTab', 'Server Settings'))
self.addressLabel.setText(translate('RemotePlugin.RemoteTab',
'Serve on IP address:'))
self.portLabel.setText(translate('RemotePlugin.RemoteTab',
'Port number:'))
def load(self): def load(self):
self.portSpinBox.setValue( self.portSpinBox.setValue(
@ -78,4 +82,4 @@ class RemoteTab(SettingsTab):
QtCore.QSettings().setValue(self.settingsSection + u'/port', QtCore.QSettings().setValue(self.settingsSection + u'/port',
QtCore.QVariant(self.portSpinBox.value())) QtCore.QVariant(self.portSpinBox.value()))
QtCore.QSettings().setValue(self.settingsSection + u'/ip address', QtCore.QSettings().setValue(self.settingsSection + u'/ip address',
QtCore.QVariant(self.addressEdit.text())) QtCore.QVariant(self.addressEdit.text()))

View File

@ -29,58 +29,51 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_AuthorsDialog(object): class Ui_AuthorsDialog(object):
def setupUi(self, AuthorsDialog): def setupUi(self, authorsDialog):
AuthorsDialog.setObjectName(u'AuthorsDialog') authorsDialog.setObjectName(u'AuthorsDialog')
AuthorsDialog.resize(393, 147) authorsDialog.resize(300, 10)
self.AuthorsLayout = QtGui.QFormLayout(AuthorsDialog) self.dialogLayout = QtGui.QVBoxLayout(authorsDialog)
self.AuthorsLayout.setMargin(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.AuthorsLayout.setSpacing(8) self.authorLayout = QtGui.QFormLayout()
self.AuthorsLayout.setObjectName(u'AuthorsLayout') self.authorLayout.setObjectName(u'authorLayout')
self.FirstNameLabel = QtGui.QLabel(AuthorsDialog) self.firstNameLabel = QtGui.QLabel(authorsDialog)
self.FirstNameLabel.setObjectName(u'FirstNameLabel') self.firstNameLabel.setObjectName(u'firstNameLabel')
self.AuthorsLayout.setWidget(0, self.firstNameEdit = QtGui.QLineEdit(authorsDialog)
QtGui.QFormLayout.LabelRole, self.FirstNameLabel) self.firstNameEdit.setObjectName(u'firstNameEdit')
self.FirstNameEdit = QtGui.QLineEdit(AuthorsDialog) self.firstNameLabel.setBuddy(self.firstNameEdit)
self.FirstNameEdit.setObjectName(u'FirstNameEdit') self.authorLayout.addRow(self.firstNameLabel, self.firstNameEdit)
self.AuthorsLayout.setWidget(0, self.lastNameLabel = QtGui.QLabel(authorsDialog)
QtGui.QFormLayout.FieldRole, self.FirstNameEdit) self.lastNameLabel.setObjectName(u'lastNameLabel')
self.LastNameLabel = QtGui.QLabel(AuthorsDialog) self.lastNameEdit = QtGui.QLineEdit(authorsDialog)
self.LastNameLabel.setObjectName(u'LastNameLabel') self.lastNameEdit.setObjectName(u'lastNameEdit')
self.AuthorsLayout.setWidget(1, self.lastNameLabel.setBuddy(self.lastNameEdit)
QtGui.QFormLayout.LabelRole, self.LastNameLabel) self.authorLayout.addRow(self.lastNameLabel, self.lastNameEdit)
self.LastNameEdit = QtGui.QLineEdit(AuthorsDialog) self.displayLabel = QtGui.QLabel(authorsDialog)
self.LastNameEdit.setObjectName(u'LastNameEdit') self.displayLabel.setObjectName(u'displayLabel')
self.AuthorsLayout.setWidget(1, self.displayEdit = QtGui.QLineEdit(authorsDialog)
QtGui.QFormLayout.FieldRole, self.LastNameEdit) self.displayEdit.setObjectName(u'displayEdit')
self.DisplayLabel = QtGui.QLabel(AuthorsDialog) self.displayLabel.setBuddy(self.displayEdit)
self.DisplayLabel.setObjectName(u'DisplayLabel') self.authorLayout.addRow(self.displayLabel, self.displayEdit)
self.AuthorsLayout.setWidget(2, self.dialogLayout.addLayout(self.authorLayout)
QtGui.QFormLayout.LabelRole, self.DisplayLabel) self.buttonBox = QtGui.QDialogButtonBox(authorsDialog)
self.DisplayEdit = QtGui.QLineEdit(AuthorsDialog) self.buttonBox.setStandardButtons(
self.DisplayEdit.setObjectName(u'DisplayEdit') QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.AuthorsLayout.setWidget(2, self.buttonBox.setObjectName(u'buttonBox')
QtGui.QFormLayout.FieldRole, self.DisplayEdit) self.dialogLayout.addWidget(self.buttonBox)
self.AuthorButtonBox = QtGui.QDialogButtonBox(AuthorsDialog) self.retranslateUi(authorsDialog)
self.AuthorButtonBox.setOrientation(QtCore.Qt.Horizontal) authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
self.AuthorButtonBox.setStandardButtons( QtCore.QObject.connect(self.buttonBox,
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) QtCore.SIGNAL(u'accepted()'), authorsDialog.accept)
self.AuthorButtonBox.setObjectName(u'AuthorButtonBox') QtCore.QObject.connect(self.buttonBox,
self.AuthorsLayout.setWidget(3, QtCore.SIGNAL(u'rejected()'), authorsDialog.reject)
QtGui.QFormLayout.FieldRole, self.AuthorButtonBox) QtCore.QMetaObject.connectSlotsByName(authorsDialog)
self.retranslateUi(AuthorsDialog) def retranslateUi(self, authorsDialog):
QtCore.QObject.connect(self.AuthorButtonBox, authorsDialog.setWindowTitle(
QtCore.SIGNAL(u'accepted()'), AuthorsDialog.accept)
QtCore.QObject.connect(self.AuthorButtonBox,
QtCore.SIGNAL(u'rejected()'), AuthorsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(AuthorsDialog)
def retranslateUi(self, AuthorsDialog):
AuthorsDialog.setWindowTitle(
translate('SongsPlugin.AuthorsForm', 'Author Maintenance')) translate('SongsPlugin.AuthorsForm', 'Author Maintenance'))
self.DisplayLabel.setText( self.displayLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Display name:')) translate('SongsPlugin.AuthorsForm', 'Display name:'))
self.FirstNameLabel.setText( self.firstNameLabel.setText(
translate('SongsPlugin.AuthorsForm', 'First name:')) translate('SongsPlugin.AuthorsForm', 'First name:'))
self.LastNameLabel.setText( self.lastNameLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Last name:')) translate('SongsPlugin.AuthorsForm', 'Last name:'))

View File

@ -40,36 +40,36 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
self._autoDisplayName = False self._autoDisplayName = False
QtCore.QObject.connect(self.FirstNameEdit, QtCore.QObject.connect(self.firstNameEdit,
QtCore.SIGNAL(u'textEdited(QString)'), QtCore.SIGNAL(u'textEdited(QString)'),
self.onFirstNameEditTextEdited) self.onFirstNameEditTextEdited)
QtCore.QObject.connect(self.LastNameEdit, QtCore.QObject.connect(self.lastNameEdit,
QtCore.SIGNAL(u'textEdited(QString)'), QtCore.SIGNAL(u'textEdited(QString)'),
self.onLastNameEditTextEdited) self.onLastNameEditTextEdited)
def exec_(self, clear=True): def exec_(self, clear=True):
if clear: if clear:
self.FirstNameEdit.clear() self.firstNameEdit.clear()
self.LastNameEdit.clear() self.lastNameEdit.clear()
self.DisplayEdit.clear() self.displayEdit.clear()
self.FirstNameEdit.setFocus() self.firstNameEdit.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def onFirstNameEditTextEdited(self, text): def onFirstNameEditTextEdited(self, text):
if not self._autoDisplayName: if not self._autoDisplayName:
return return
display_name = text display_name = text
if self.LastNameEdit.text() != u'': if self.lastNameEdit.text() != u'':
display_name = display_name + u' ' + self.LastNameEdit.text() display_name = display_name + u' ' + self.lastNameEdit.text()
self.DisplayEdit.setText(display_name) self.displayEdit.setText(display_name)
def onLastNameEditTextEdited(self, text): def onLastNameEditTextEdited(self, text):
if not self._autoDisplayName: if not self._autoDisplayName:
return return
display_name = text display_name = text
if self.FirstNameEdit.text() != u'': if self.firstNameEdit.text() != u'':
display_name = self.FirstNameEdit.text() + u' ' + display_name display_name = self.firstNameEdit.text() + u' ' + display_name
self.DisplayEdit.setText(display_name) self.displayEdit.setText(display_name)
def autoDisplayName(self): def autoDisplayName(self):
return self._autoDisplayName return self._autoDisplayName
@ -78,21 +78,21 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
self._autoDisplayName = on self._autoDisplayName = on
def accept(self): def accept(self):
if not self.FirstNameEdit.text(): if not self.firstNameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'), self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm', translate('SongsPlugin.AuthorsForm',
'You need to type in the first name of the author.')) 'You need to type in the first name of the author.'))
self.FirstNameEdit.setFocus() self.firstNameEdit.setFocus()
return False return False
elif not self.LastNameEdit.text(): elif not self.lastNameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'), self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm', translate('SongsPlugin.AuthorsForm',
'You need to type in the last name of the author.')) 'You need to type in the last name of the author.'))
self.LastNameEdit.setFocus() self.lastNameEdit.setFocus()
return False return False
elif not self.DisplayEdit.text(): elif not self.displayEdit.text():
if QtGui.QMessageBox.critical( if QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'), self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm', translate('SongsPlugin.AuthorsForm',
@ -101,11 +101,11 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
) == QtGui.QMessageBox.Yes: ) == QtGui.QMessageBox.Yes:
self.DisplayEdit.setText(self.FirstNameEdit.text() + \ self.displayEdit.setText(self.firstNameEdit.text() + \
u' ' + self.LastNameEdit.text()) u' ' + self.lastNameEdit.text())
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)
else: else:
self.DisplayEdit.setFocus() self.displayEdit.setFocus()
return False return False
else: else:
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)

View File

@ -29,445 +29,310 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
class Ui_EditSongDialog(object): class Ui_EditSongDialog(object):
def setupUi(self, EditSongDialog): def setupUi(self, editSongDialog):
EditSongDialog.setObjectName(u'EditSongDialog') editSongDialog.setObjectName(u'editSongDialog')
EditSongDialog.resize(645, 417) editSongDialog.resize(650, 400)
icon = build_icon(u':/icon/openlp.org-icon-32.bmp') editSongDialog.setWindowIcon(
EditSongDialog.setWindowIcon(icon) build_icon(u':/icon/openlp.org-icon-32.bmp'))
EditSongDialog.setModal(True) editSongDialog.setModal(True)
self.verticalLayout = QtGui.QVBoxLayout(EditSongDialog) self.dialogLayout = QtGui.QVBoxLayout(editSongDialog)
self.verticalLayout.setMargin(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.verticalLayout.setObjectName(u'verticalLayout') self.songTabWidget = QtGui.QTabWidget(editSongDialog)
self.SongTabWidget = QtGui.QTabWidget(EditSongDialog) self.songTabWidget.setObjectName(u'songTabWidget')
self.SongTabWidget.setObjectName(u'SongTabWidget') # lyrics tab
self.LyricsTab = QtGui.QWidget() self.lyricsTab = QtGui.QWidget()
self.LyricsTab.setObjectName(u'LyricsTab') self.lyricsTab.setObjectName(u'lyricsTab')
self.LyricsTabLayout = QtGui.QGridLayout(self.LyricsTab) self.lyricsTabLayout = QtGui.QGridLayout(self.lyricsTab)
self.LyricsTabLayout.setMargin(8) self.lyricsTabLayout.setObjectName(u'lyricsTabLayout')
self.LyricsTabLayout.setSpacing(8) self.titleLabel = QtGui.QLabel(self.lyricsTab)
self.LyricsTabLayout.setObjectName(u'LyricsTabLayout') self.titleLabel.setObjectName(u'titleLabel')
self.TitleLabel = QtGui.QLabel(self.LyricsTab) self.lyricsTabLayout.addWidget(self.titleLabel, 0, 0)
self.TitleLabel.setObjectName(u'TitleLabel') self.titleEdit = QtGui.QLineEdit(self.lyricsTab)
self.LyricsTabLayout.addWidget(self.TitleLabel, 0, 0, 1, 1) self.titleEdit.setObjectName(u'titleEdit')
self.TitleEditItem = QtGui.QLineEdit(self.LyricsTab) self.titleLabel.setBuddy(self.titleEdit)
self.TitleLabel.setBuddy(self.TitleEditItem) self.lyricsTabLayout.addWidget(self.titleEdit, 0, 1, 1, 2)
sizePolicy = QtGui.QSizePolicy( self.alternativeTitleLabel = QtGui.QLabel(self.lyricsTab)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) self.alternativeTitleLabel.setObjectName(u'alternativeTitleLabel')
sizePolicy.setHorizontalStretch(0) self.lyricsTabLayout.addWidget(self.alternativeTitleLabel, 1, 0)
sizePolicy.setVerticalStretch(0) self.alternativeEdit = QtGui.QLineEdit(self.lyricsTab)
sizePolicy.setHeightForWidth( self.alternativeEdit.setObjectName(u'alternativeEdit')
self.TitleEditItem.sizePolicy().hasHeightForWidth()) self.alternativeTitleLabel.setBuddy(self.alternativeEdit)
self.TitleEditItem.setSizePolicy(sizePolicy) self.lyricsTabLayout.addWidget(self.alternativeEdit, 1, 1, 1, 2)
self.TitleEditItem.setObjectName(u'TitleEditItem') self.lyricsLabel = QtGui.QLabel(self.lyricsTab)
self.LyricsTabLayout.addWidget(self.TitleEditItem, 0, 1, 1, 2) self.lyricsLabel.setFixedHeight(self.titleEdit.sizeHint().height())
self.AlternativeTitleLabel = QtGui.QLabel(self.LyricsTab) self.lyricsLabel.setObjectName(u'lyricsLabel')
self.AlternativeTitleLabel.setObjectName(u'AlternativeTitleLabel') self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0,
self.LyricsTabLayout.addWidget(self.AlternativeTitleLabel, 1, 0, 1, 1) QtCore.Qt.AlignTop)
self.AlternativeEdit = QtGui.QLineEdit(self.LyricsTab) self.verseListWidget = QtGui.QTableWidget(self.lyricsTab)
self.AlternativeTitleLabel.setBuddy(self.AlternativeEdit) self.verseListWidget.horizontalHeader().setVisible(False)
self.AlternativeEdit.setObjectName(u'AlternativeEdit') self.verseListWidget.setAlternatingRowColors(True)
self.LyricsTabLayout.addWidget(self.AlternativeEdit, 1, 1, 1, 2) self.verseListWidget.setColumnCount(1)
self.LyricsLabel = QtGui.QLabel(self.LyricsTab) self.verseListWidget.setSelectionBehavior(
self.LyricsLabel.setAlignment( QtGui.QAbstractItemView.SelectRows)
QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.verseListWidget.setEditTriggers(
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)
self.VerseListWidget.setEditTriggers(
QtGui.QAbstractItemView.NoEditTriggers) QtGui.QAbstractItemView.NoEditTriggers)
self.VerseListWidget.setAlternatingRowColors(True) self.verseListWidget.setObjectName(u'verseListWidget')
self.VerseListWidget.setObjectName(u'VerseListWidget') self.lyricsLabel.setBuddy(self.verseListWidget)
self.LyricsTabLayout.addWidget(self.VerseListWidget, 2, 1, 1, 1) self.lyricsTabLayout.addWidget(self.verseListWidget, 2, 1)
self.VerseOrderLabel = QtGui.QLabel(self.LyricsTab) self.verseOrderLabel = QtGui.QLabel(self.lyricsTab)
self.VerseOrderLabel.setObjectName(u'VerseOrderLabel') self.verseOrderLabel.setObjectName(u'verseOrderLabel')
self.LyricsTabLayout.addWidget(self.VerseOrderLabel, 4, 0, 1, 1) self.lyricsTabLayout.addWidget(self.verseOrderLabel, 3, 0)
self.VerseOrderEdit = QtGui.QLineEdit(self.LyricsTab) self.verseOrderEdit = QtGui.QLineEdit(self.lyricsTab)
self.VerseOrderLabel.setBuddy(self.VerseOrderEdit) self.verseOrderEdit.setObjectName(u'verseOrderEdit')
self.VerseOrderEdit.setObjectName(u'VerseOrderEdit') self.verseOrderLabel.setBuddy(self.verseOrderEdit)
self.LyricsTabLayout.addWidget(self.VerseOrderEdit, 4, 1, 1, 2) self.lyricsTabLayout.addWidget(self.verseOrderEdit, 3, 1, 1, 2)
self.VerseButtonWidget = QtGui.QWidget(self.LyricsTab) self.verseButtonsLayout = QtGui.QVBoxLayout()
self.VerseButtonWidget.setObjectName(u'VerseButtonWidget') self.verseButtonsLayout.setObjectName(u'verseButtonsLayout')
self.VerseButtonsLayout = QtGui.QVBoxLayout(self.VerseButtonWidget) self.verseAddButton = QtGui.QPushButton(self.lyricsTab)
self.VerseButtonsLayout.setSpacing(8) self.verseAddButton.setObjectName(u'verseAddButton')
self.VerseButtonsLayout.setMargin(0) self.verseButtonsLayout.addWidget(self.verseAddButton)
self.VerseButtonsLayout.setObjectName(u'VerseButtonsLayout') self.verseEditButton = QtGui.QPushButton(self.lyricsTab)
self.VerseAddButton = QtGui.QPushButton(self.VerseButtonWidget) self.verseEditButton.setObjectName(u'verseEditButton')
self.VerseAddButton.setObjectName(u'VerseAddButton') self.verseButtonsLayout.addWidget(self.verseEditButton)
self.VerseButtonsLayout.addWidget(self.VerseAddButton) self.verseEditAllButton = QtGui.QPushButton(self.lyricsTab)
self.VerseEditButton = QtGui.QPushButton(self.VerseButtonWidget) self.verseEditAllButton.setObjectName(u'verseEditAllButton')
self.VerseEditButton.setObjectName(u'VerseEditButton') self.verseButtonsLayout.addWidget(self.verseEditAllButton)
self.VerseButtonsLayout.addWidget(self.VerseEditButton) self.verseDeleteButton = QtGui.QPushButton(self.lyricsTab)
self.VerseEditAllButton = QtGui.QPushButton(self.VerseButtonWidget) self.verseDeleteButton.setObjectName(u'verseDeleteButton')
self.VerseEditAllButton.setObjectName(u'VerseEditAllButton') self.verseButtonsLayout.addWidget(self.verseDeleteButton)
self.VerseButtonsLayout.addWidget(self.VerseEditAllButton) self.verseButtonsLayout.addStretch()
self.VerseDeleteButton = QtGui.QPushButton(self.VerseButtonWidget) self.lyricsTabLayout.addLayout(self.verseButtonsLayout, 2, 2)
self.VerseDeleteButton.setObjectName(u'VerseDeleteButton') self.songTabWidget.addTab(self.lyricsTab, u'')
self.VerseButtonsLayout.addWidget(self.VerseDeleteButton) # authors tab
spacerItem = QtGui.QSpacerItem(20, 40, self.authorsTab = QtGui.QWidget()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.authorsTab.setObjectName(u'authorsTab')
self.VerseButtonsLayout.addItem(spacerItem) self.authorsTabLayout = QtGui.QHBoxLayout(self.authorsTab)
self.LyricsTabLayout.addWidget(self.VerseButtonWidget, 2, 2, 1, 1) self.authorsTabLayout.setObjectName(u'authorsTabLayout')
self.SongTabWidget.addTab(self.LyricsTab, u'') self.authorsLeftLayout = QtGui.QVBoxLayout()
self.AuthorsTab = QtGui.QWidget() self.authorsLeftLayout.setObjectName(u'authorsLeftLayout')
self.AuthorsTab.setObjectName(u'AuthorsTab') self.authorsGroupBox = QtGui.QGroupBox(self.authorsTab)
self.AuthorsTabLayout = QtGui.QHBoxLayout(self.AuthorsTab) self.authorsGroupBox.setObjectName(u'authorsGroupBox')
self.AuthorsTabLayout.setSpacing(8) self.authorsLayout = QtGui.QVBoxLayout(self.authorsGroupBox)
self.AuthorsTabLayout.setMargin(8) self.authorsLayout.setObjectName(u'authorsLayout')
self.AuthorsTabLayout.setObjectName(u'AuthorsTabLayout') self.authorAddLayout = QtGui.QHBoxLayout()
self.AuthorsMaintenanceWidget = QtGui.QWidget(self.AuthorsTab) self.authorAddLayout.setObjectName(u'authorAddLayout')
self.AuthorsMaintenanceWidget.setObjectName(u'AuthorsMaintenanceWidget') self.authorsComboBox = QtGui.QComboBox(self.authorsGroupBox)
self.AuthorsMaintenanceLayout = QtGui.QVBoxLayout( self.authorsComboBox.setSizeAdjustPolicy(
self.AuthorsMaintenanceWidget)
self.AuthorsMaintenanceLayout.setSpacing(8)
self.AuthorsMaintenanceLayout.setMargin(0)
self.AuthorsMaintenanceLayout.setObjectName(u'AuthorsMaintenanceLayout')
self.AuthorsGroupBox = QtGui.QGroupBox(self.AuthorsMaintenanceWidget)
self.AuthorsGroupBox.setObjectName(u'AuthorsGroupBox')
self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsGroupBox)
self.AuthorsLayout.setSpacing(8)
self.AuthorsLayout.setMargin(8)
self.AuthorsLayout.setObjectName(u'AuthorsLayout')
self.AuthorAddWidget = QtGui.QWidget(self.AuthorsGroupBox)
self.AuthorAddWidget.setObjectName(u'AuthorAddWidget')
self.AuthorAddLayout = QtGui.QHBoxLayout(self.AuthorAddWidget)
self.AuthorAddLayout.setSpacing(8)
self.AuthorAddLayout.setMargin(0)
self.AuthorAddLayout.setObjectName(u'AuthorAddLayout')
self.AuthorsSelectionComboItem = QtGui.QComboBox(self.AuthorAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth())
self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy)
self.AuthorsSelectionComboItem.setEditable(True)
self.AuthorsSelectionComboItem.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.AuthorsSelectionComboItem.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength) QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AuthorsSelectionComboItem.setMinimumContentsLength(8) self.authorsComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
self.AuthorsSelectionComboItem.setObjectName(
u'AuthorsSelectionComboItem')
self.AuthorAddLayout.addWidget(self.AuthorsSelectionComboItem)
self.AuthorAddButton = QtGui.QPushButton(self.AuthorAddWidget)
self.AuthorAddButton.setMaximumSize(QtCore.QSize(110, 16777215))
self.AuthorAddButton.setObjectName(u'AuthorAddButton')
self.AuthorAddLayout.addWidget(self.AuthorAddButton)
self.AuthorsLayout.addWidget(self.AuthorAddWidget)
self.AuthorsListView = QtGui.QListWidget(self.AuthorsGroupBox)
self.AuthorsListView.setAlternatingRowColors(True)
self.AuthorsListView.setObjectName(u'AuthorsListView')
self.AuthorsLayout.addWidget(self.AuthorsListView)
self.AuthorRemoveWidget = QtGui.QWidget(self.AuthorsGroupBox)
self.AuthorRemoveWidget.setObjectName(u'AuthorRemoveWidget')
self.AuthorRemoveLayout = QtGui.QHBoxLayout(self.AuthorRemoveWidget)
self.AuthorRemoveLayout.setSpacing(8)
self.AuthorRemoveLayout.setMargin(0)
self.AuthorRemoveLayout.setObjectName(u'AuthorRemoveLayout')
spacerItem1 = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AuthorRemoveLayout.addItem(spacerItem1)
self.AuthorRemoveButton = QtGui.QPushButton(self.AuthorRemoveWidget)
self.AuthorRemoveButton.setObjectName(u'AuthorRemoveButton')
self.AuthorRemoveLayout.addWidget(self.AuthorRemoveButton)
self.AuthorsLayout.addWidget(self.AuthorRemoveWidget)
self.AuthorsMaintenanceLayout.addWidget(self.AuthorsGroupBox)
self.MaintenanceWidget = QtGui.QWidget(self.AuthorsMaintenanceWidget)
self.MaintenanceWidget.setObjectName(u'MaintenanceWidget')
self.MaintenanceLayout = QtGui.QHBoxLayout(self.MaintenanceWidget)
self.MaintenanceLayout.setSpacing(0)
self.MaintenanceLayout.setMargin(0)
self.MaintenanceLayout.setObjectName(u'MaintenanceLayout')
self.MaintenanceButton = QtGui.QPushButton(self.MaintenanceWidget)
self.MaintenanceButton.setObjectName(u'MaintenanceButton')
self.MaintenanceLayout.addWidget(self.MaintenanceButton)
spacerItem2 = QtGui.QSpacerItem(66, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.MaintenanceLayout.addItem(spacerItem2)
self.AuthorsMaintenanceLayout.addWidget(self.MaintenanceWidget)
self.AuthorsTabLayout.addWidget(self.AuthorsMaintenanceWidget)
self.TopicBookWidget = QtGui.QWidget(self.AuthorsTab)
self.TopicBookWidget.setObjectName(u'TopicBookWidget')
self.TopicBookLayout = QtGui.QVBoxLayout(self.TopicBookWidget)
self.TopicBookLayout.setSpacing(8)
self.TopicBookLayout.setMargin(0)
self.TopicBookLayout.setObjectName(u'TopicBookLayout')
self.TopicGroupBox = QtGui.QGroupBox(self.TopicBookWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TopicGroupBox.sizePolicy().hasHeightForWidth())
self.TopicGroupBox.setSizePolicy(sizePolicy)
self.TopicGroupBox.setObjectName(u'TopicGroupBox')
self.TopicLayout = QtGui.QVBoxLayout(self.TopicGroupBox)
self.TopicLayout.setSpacing(8)
self.TopicLayout.setMargin(8)
self.TopicLayout.setObjectName(u'TopicLayout')
self.TopicAddWidget = QtGui.QWidget(self.TopicGroupBox)
self.TopicAddWidget.setObjectName(u'TopicAddWidget')
self.TopicAddLayout = QtGui.QHBoxLayout(self.TopicAddWidget)
self.TopicAddLayout.setSpacing(8)
self.TopicAddLayout.setMargin(0)
self.TopicAddLayout.setObjectName(u'TopicAddLayout')
self.SongTopicCombo = QtGui.QComboBox(self.TopicAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.SongTopicCombo.sizePolicy().hasHeightForWidth())
self.SongTopicCombo.setEditable(True)
self.SongTopicCombo.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.SongTopicCombo.setSizePolicy(sizePolicy)
self.SongTopicCombo.setObjectName(u'SongTopicCombo')
self.TopicAddLayout.addWidget(self.SongTopicCombo)
self.TopicAddButton = QtGui.QPushButton(self.TopicAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TopicAddButton.sizePolicy().hasHeightForWidth())
self.TopicAddButton.setSizePolicy(sizePolicy)
self.TopicAddButton.setObjectName(u'TopicAddButton')
self.TopicAddLayout.addWidget(self.TopicAddButton)
self.TopicLayout.addWidget(self.TopicAddWidget)
self.TopicsListView = QtGui.QListWidget(self.TopicGroupBox)
self.TopicsListView.setAlternatingRowColors(True)
self.TopicsListView.setObjectName(u'TopicsListView')
self.TopicLayout.addWidget(self.TopicsListView)
self.TopicRemoveWidget = QtGui.QWidget(self.TopicGroupBox)
self.TopicRemoveWidget.setObjectName(u'TopicRemoveWidget')
self.TopicRemoveLayout = QtGui.QHBoxLayout(self.TopicRemoveWidget)
self.TopicRemoveLayout.setSpacing(8)
self.TopicRemoveLayout.setMargin(0)
self.TopicRemoveLayout.setObjectName(u'TopicRemoveLayout')
spacerItem3 = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TopicRemoveLayout.addItem(spacerItem3)
self.TopicRemoveButton = QtGui.QPushButton(self.TopicRemoveWidget)
self.TopicRemoveButton.setObjectName(u'TopicRemoveButton')
self.TopicRemoveLayout.addWidget(self.TopicRemoveButton)
self.TopicLayout.addWidget(self.TopicRemoveWidget)
self.TopicBookLayout.addWidget(self.TopicGroupBox)
self.SongBookGroup = QtGui.QGroupBox(self.TopicBookWidget)
self.SongBookGroup.setObjectName(u'SongBookGroup')
self.SongbookLayout = QtGui.QFormLayout(self.SongBookGroup)
self.SongbookLayout.setMargin(8)
self.SongbookLayout.setSpacing(8)
self.SongbookLayout.setObjectName(u'SongbookLayout')
self.SongbookNameLabel = QtGui.QLabel(self.SongBookGroup)
self.SongbookCombo = QtGui.QComboBox(self.SongBookGroup)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
QtGui.QSizePolicy.Fixed) QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) self.authorsComboBox.setEditable(True)
sizePolicy.setVerticalStretch(0) self.authorsComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
sizePolicy.setHeightForWidth( self.authorsComboBox.setObjectName(u'authorsComboBox')
self.SongbookCombo.sizePolicy().hasHeightForWidth()) self.authorAddLayout.addWidget(self.authorsComboBox)
self.SongbookCombo.setEditable(True) self.authorAddButton = QtGui.QPushButton(self.authorsGroupBox)
self.SongbookCombo.setInsertPolicy(QtGui.QComboBox.NoInsert) self.authorAddButton.setObjectName(u'authorAddButton')
self.SongbookCombo.setSizePolicy(sizePolicy) self.authorAddLayout.addWidget(self.authorAddButton)
self.SongbookCombo.setObjectName(u'SongbookCombo') self.authorsLayout.addLayout(self.authorAddLayout)
self.SongbookLayout.addRow(self.SongbookNameLabel, self.SongbookCombo) self.authorsListView = QtGui.QListWidget(self.authorsGroupBox)
self.songBookNumberLabel = QtGui.QLabel(self.SongBookGroup) self.authorsListView.setAlternatingRowColors(True)
self.songBookNumberEdit = QtGui.QLineEdit(self.SongBookGroup) self.authorsListView.setObjectName(u'authorsListView')
self.SongbookLayout.addRow(self.songBookNumberLabel, self.authorsLayout.addWidget(self.authorsListView)
self.authorRemoveLayout = QtGui.QHBoxLayout()
self.authorRemoveLayout.setObjectName(u'authorRemoveLayout')
self.authorRemoveLayout.addStretch()
self.authorRemoveButton = QtGui.QPushButton(self.authorsGroupBox)
self.authorRemoveButton.setObjectName(u'authorRemoveButton')
self.authorRemoveLayout.addWidget(self.authorRemoveButton)
self.authorsLayout.addLayout(self.authorRemoveLayout)
self.authorsLeftLayout.addWidget(self.authorsGroupBox)
self.maintenanceLayout = QtGui.QHBoxLayout()
self.maintenanceLayout.setObjectName(u'maintenanceLayout')
self.maintenanceButton = QtGui.QPushButton(self.authorsTab)
self.maintenanceButton.setObjectName(u'maintenanceButton')
self.maintenanceLayout.addWidget(self.maintenanceButton)
self.maintenanceLayout.addStretch()
self.authorsLeftLayout.addLayout(self.maintenanceLayout)
self.authorsTabLayout.addLayout(self.authorsLeftLayout)
self.authorsRightLayout = QtGui.QVBoxLayout()
self.authorsRightLayout.setObjectName(u'authorsRightLayout')
self.topicsGroupBox = QtGui.QGroupBox(self.authorsTab)
self.topicsGroupBox.setObjectName(u'topicsGroupBox')
self.topicsLayout = QtGui.QVBoxLayout(self.topicsGroupBox)
self.topicsLayout.setObjectName(u'topicsLayout')
self.topicAddLayout = QtGui.QHBoxLayout()
self.topicAddLayout.setObjectName(u'topicAddLayout')
self.topicsComboBox = QtGui.QComboBox(self.topicsGroupBox)
self.topicsComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.topicsComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Fixed)
self.topicsComboBox.setEditable(True)
self.topicsComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.topicsComboBox.setObjectName(u'topicsComboBox')
self.topicAddLayout.addWidget(self.topicsComboBox)
self.topicAddButton = QtGui.QPushButton(self.topicsGroupBox)
self.topicAddButton.setObjectName(u'topicAddButton')
self.topicAddLayout.addWidget(self.topicAddButton)
self.topicsLayout.addLayout(self.topicAddLayout)
self.topicsListView = QtGui.QListWidget(self.topicsGroupBox)
self.topicsListView.setAlternatingRowColors(True)
self.topicsListView.setObjectName(u'topicsListView')
self.topicsLayout.addWidget(self.topicsListView)
self.topicRemoveLayout = QtGui.QHBoxLayout()
self.topicRemoveLayout.setObjectName(u'topicRemoveLayout')
self.topicRemoveLayout.addStretch()
self.topicRemoveButton = QtGui.QPushButton(self.topicsGroupBox)
self.topicRemoveButton.setObjectName(u'topicRemoveButton')
self.topicRemoveLayout.addWidget(self.topicRemoveButton)
self.topicsLayout.addLayout(self.topicRemoveLayout)
self.authorsRightLayout.addWidget(self.topicsGroupBox)
self.songBookGroupBox = QtGui.QGroupBox(self.authorsTab)
self.songBookGroupBox.setObjectName(u'songBookGroupBox')
self.songBookLayout = QtGui.QFormLayout(self.songBookGroupBox)
self.songBookLayout.setObjectName(u'songBookLayout')
self.songBookNameLabel = QtGui.QLabel(self.songBookGroupBox)
self.songBookNameLabel.setObjectName(u'songBookNameLabel')
self.songBookComboBox = QtGui.QComboBox(self.songBookGroupBox)
self.songBookComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Fixed)
self.songBookComboBox.setEditable(True)
self.songBookComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.songBookComboBox.setObjectName(u'songBookComboBox')
self.songBookNameLabel.setBuddy(self.songBookComboBox)
self.songBookLayout.addRow(self.songBookNameLabel,
self.songBookComboBox)
self.songBookNumberLabel = QtGui.QLabel(self.songBookGroupBox)
self.songBookNumberLabel.setObjectName(u'songBookNumberLabel')
self.songBookNumberEdit = QtGui.QLineEdit(self.songBookGroupBox)
self.songBookNumberEdit.setObjectName(u'songBookNumberEdit')
self.songBookNumberLabel.setBuddy(self.songBookNumberEdit)
self.songBookLayout.addRow(self.songBookNumberLabel,
self.songBookNumberEdit) self.songBookNumberEdit)
self.TopicBookLayout.addWidget(self.SongBookGroup) self.authorsRightLayout.addWidget(self.songBookGroupBox)
self.AuthorsTabLayout.addWidget(self.TopicBookWidget) self.authorsTabLayout.addLayout(self.authorsRightLayout)
self.SongTabWidget.addTab(self.AuthorsTab, u'') self.songTabWidget.addTab(self.authorsTab, u'')
self.ThemeTab = QtGui.QWidget() # theme tab
self.ThemeTab.setObjectName(u'ThemeTab') self.themeTab = QtGui.QWidget()
self.ThemeTabLayout = QtGui.QVBoxLayout(self.ThemeTab) self.themeTab.setObjectName(u'themeTab')
self.ThemeTabLayout.setSpacing(8) self.themeTabLayout = QtGui.QHBoxLayout(self.themeTab)
self.ThemeTabLayout.setMargin(8) self.themeTabLayout.setObjectName(u'themeTabLayout')
self.ThemeTabLayout.setObjectName(u'ThemeTabLayout') self.themeLeftLayout = QtGui.QVBoxLayout()
self.ThemeCopyCommentsWidget = QtGui.QWidget(self.ThemeTab) self.themeLeftLayout.setObjectName(u'themeLeftLayout')
self.ThemeCopyCommentsWidget.setObjectName(u'ThemeCopyCommentsWidget') self.themeGroupBox = QtGui.QGroupBox(self.themeTab)
self.ThemeCopyCommentsLayout = QtGui.QHBoxLayout( self.themeGroupBox.setObjectName(u'themeGroupBox')
self.ThemeCopyCommentsWidget) self.themeLayout = QtGui.QHBoxLayout(self.themeGroupBox)
self.ThemeCopyCommentsLayout.setSpacing(8) self.themeLayout.setObjectName(u'themeLayout')
self.ThemeCopyCommentsLayout.setMargin(0) self.themeComboBox = QtGui.QComboBox(self.themeGroupBox)
self.ThemeCopyCommentsLayout.setObjectName(u'ThemeCopyCommentsLayout') self.themeComboBox.setSizeAdjustPolicy(
self.TextWidget = QtGui.QWidget(self.ThemeCopyCommentsWidget) QtGui.QComboBox.AdjustToMinimumContentsLength)
sizePolicy = QtGui.QSizePolicy( self.themeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) self.themeComboBox.setEditable(True)
sizePolicy.setVerticalStretch(0) self.themeComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
sizePolicy.setHeightForWidth( self.themeComboBox.setObjectName(u'themeComboBox')
self.TextWidget.sizePolicy().hasHeightForWidth()) self.themeLayout.addWidget(self.themeComboBox)
self.TextWidget.setSizePolicy(sizePolicy) self.themeAddButton = QtGui.QPushButton(self.themeGroupBox)
self.TextWidget.setObjectName(u'TextWidget') self.themeAddButton.setObjectName(u'themeAddButton')
self.DetailsLayout = QtGui.QVBoxLayout(self.TextWidget) self.themeLayout.addWidget(self.themeAddButton)
self.DetailsLayout.setSpacing(8) self.themeLeftLayout.addWidget(self.themeGroupBox)
self.DetailsLayout.setMargin(0) self.rightsGroupBox = QtGui.QGroupBox(self.themeTab)
self.DetailsLayout.setObjectName(u'DetailsLayout') self.rightsGroupBox.setObjectName(u'rightsGroupBox')
self.ThemeGroupBox = QtGui.QGroupBox(self.TextWidget) self.rightsLayout = QtGui.QVBoxLayout(self.rightsGroupBox)
self.ThemeGroupBox.setObjectName(u'ThemeGroupBox') self.rightsLayout.setObjectName(u'rightsLayout')
self.ThemeLayout = QtGui.QHBoxLayout(self.ThemeGroupBox) self.copyrightLayout = QtGui.QHBoxLayout()
self.ThemeLayout.setSpacing(8) self.copyrightLayout.setObjectName(u'copyrightLayout')
self.ThemeLayout.setMargin(8) self.copyrightEdit = QtGui.QLineEdit(self.rightsGroupBox)
self.ThemeLayout.setObjectName(u'ThemeLayout') self.copyrightEdit.setObjectName(u'copyrightEdit')
self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox) self.copyrightLayout.addWidget(self.copyrightEdit)
self.ThemeSelectionComboItem.setEditable(True) self.copyrightInsertButton = QtGui.QToolButton(self.rightsGroupBox)
self.ThemeSelectionComboItem.setInsertPolicy(QtGui.QComboBox.NoInsert) self.copyrightInsertButton.setObjectName(u'copyrightInsertButton')
self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem') self.copyrightLayout.addWidget(self.copyrightInsertButton)
self.ThemeLayout.addWidget(self.ThemeSelectionComboItem) self.rightsLayout.addLayout(self.copyrightLayout)
self.ThemeAddButton = QtGui.QPushButton(self.ThemeGroupBox) self.CCLILayout = QtGui.QHBoxLayout()
self.ThemeAddButton.setMaximumSize(QtCore.QSize(110, 16777215))
self.ThemeAddButton.setObjectName(u'ThemeAddButton')
self.ThemeLayout.addWidget(self.ThemeAddButton)
self.DetailsLayout.addWidget(self.ThemeGroupBox)
self.CopyrightGroupBox = QtGui.QGroupBox(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.CopyrightGroupBox.sizePolicy().hasHeightForWidth())
self.CopyrightGroupBox.setSizePolicy(sizePolicy)
self.CopyrightGroupBox.setObjectName(u'CopyrightGroupBox')
self.CopyrightLayout = QtGui.QVBoxLayout(self.CopyrightGroupBox)
self.CopyrightLayout.setSpacing(8)
self.CopyrightLayout.setMargin(8)
self.CopyrightLayout.setObjectName(u'CopyrightLayout')
self.CopyrightWidget = QtGui.QWidget(self.CopyrightGroupBox)
self.CopyrightWidget.setObjectName(u'CopyrightWidget')
self.CopyLayout = QtGui.QHBoxLayout(self.CopyrightWidget)
self.CopyLayout.setSpacing(8)
self.CopyLayout.setMargin(0)
self.CopyLayout.setObjectName(u'CopyLayout')
self.CopyrightEditItem = QtGui.QLineEdit(self.CopyrightWidget)
self.CopyrightEditItem.setObjectName(u'CopyrightEditItem')
self.CopyLayout.addWidget(self.CopyrightEditItem)
self.CopyrightInsertButton = QtGui.QPushButton(self.CopyrightWidget)
self.CopyrightInsertButton.setMaximumSize(QtCore.QSize(29, 16777215))
self.CopyrightInsertButton.setObjectName(u'CopyrightInsertButton')
self.CopyLayout.addWidget(self.CopyrightInsertButton)
self.CopyrightLayout.addWidget(self.CopyrightWidget)
self.CcliWidget = QtGui.QWidget(self.CopyrightGroupBox)
self.CcliWidget.setObjectName(u'CcliWidget')
self.CCLILayout = QtGui.QHBoxLayout(self.CcliWidget)
self.CCLILayout.setSpacing(8)
self.CCLILayout.setMargin(0)
self.CCLILayout.setObjectName(u'CCLILayout') self.CCLILayout.setObjectName(u'CCLILayout')
self.CCLILabel = QtGui.QLabel(self.CcliWidget) self.CCLILabel = QtGui.QLabel(self.rightsGroupBox)
self.CCLILabel.setObjectName(u'CCLILabel') self.CCLILabel.setObjectName(u'CCLILabel')
self.CCLILayout.addWidget(self.CCLILabel) self.CCLILayout.addWidget(self.CCLILabel)
self.CCLNumberEdit = QtGui.QLineEdit(self.CcliWidget) self.CCLNumberEdit = QtGui.QLineEdit(self.rightsGroupBox)
self.CCLNumberEdit.setValidator(QtGui.QIntValidator())
self.CCLNumberEdit.setObjectName(u'CCLNumberEdit') self.CCLNumberEdit.setObjectName(u'CCLNumberEdit')
self.CCLILayout.addWidget(self.CCLNumberEdit) self.CCLILayout.addWidget(self.CCLNumberEdit)
self.CopyrightLayout.addWidget(self.CcliWidget) self.rightsLayout.addLayout(self.CCLILayout)
self.DetailsLayout.addWidget(self.CopyrightGroupBox) self.themeLeftLayout.addWidget(self.rightsGroupBox)
spacerItem4 = QtGui.QSpacerItem(20, 40, self.themeLeftLayout.addStretch()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.themeTabLayout.addLayout(self.themeLeftLayout)
self.DetailsLayout.addItem(spacerItem4) self.commentsGroupBox = QtGui.QGroupBox(self.themeTab)
self.ThemeCopyCommentsLayout.addWidget(self.TextWidget) self.commentsGroupBox.setObjectName(u'commentsGroupBox')
self.CommentsGroupBox = QtGui.QGroupBox(self.ThemeCopyCommentsWidget) self.commentsLayout = QtGui.QVBoxLayout(self.commentsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, self.commentsLayout.setObjectName(u'commentsLayout')
QtGui.QSizePolicy.Preferred) self.commentsEdit = QtGui.QTextEdit(self.commentsGroupBox)
sizePolicy.setHorizontalStretch(0) self.commentsEdit.setObjectName(u'commentsEdit')
sizePolicy.setVerticalStretch(0) self.commentsLayout.addWidget(self.commentsEdit)
sizePolicy.setHeightForWidth( self.themeTabLayout.addWidget(self.commentsGroupBox)
self.CommentsGroupBox.sizePolicy().hasHeightForWidth()) self.songTabWidget.addTab(self.themeTab, u'')
self.CommentsGroupBox.setSizePolicy(sizePolicy) self.dialogLayout.addWidget(self.songTabWidget)
self.CommentsGroupBox.setObjectName(u'CommentsGroupBox') self.buttonBox = QtGui.QDialogButtonBox(editSongDialog)
self.CommentsLayout = QtGui.QVBoxLayout(self.CommentsGroupBox) self.buttonBox.setStandardButtons(
self.CommentsLayout.setSpacing(0)
self.CommentsLayout.setMargin(8)
self.CommentsLayout.setObjectName(u'CommentsLayout')
self.CommentsEdit = QtGui.QTextEdit(self.CommentsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.CommentsEdit.sizePolicy().hasHeightForWidth())
self.CommentsEdit.setSizePolicy(sizePolicy)
self.CommentsEdit.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.CommentsEdit.setObjectName(u'CommentsEdit')
self.CommentsLayout.addWidget(self.CommentsEdit)
self.ThemeCopyCommentsLayout.addWidget(self.CommentsGroupBox)
self.ThemeTabLayout.addWidget(self.ThemeCopyCommentsWidget)
self.SongTabWidget.addTab(self.ThemeTab, u'')
self.verticalLayout.addWidget(self.SongTabWidget)
self.ButtonBox = QtGui.QDialogButtonBox(EditSongDialog)
self.ButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName(u'ButtonBox') self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.ButtonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(EditSongDialog) self.retranslateUi(editSongDialog)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), EditSongDialog.closePressed) QtCore.SIGNAL(u'rejected()'), editSongDialog.closePressed)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept) QtCore.SIGNAL(u'accepted()'), editSongDialog.accept)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog) QtCore.QMetaObject.connectSlotsByName(editSongDialog)
def retranslateUi(self, EditSongDialog): def retranslateUi(self, editSongDialog):
EditSongDialog.setWindowTitle( editSongDialog.setWindowTitle(
translate('SongsPlugin.EditSongForm', 'Song Editor')) translate('SongsPlugin.EditSongForm', 'Song Editor'))
self.TitleLabel.setText( self.titleLabel.setText(
translate('SongsPlugin.EditSongForm', '&Title:')) translate('SongsPlugin.EditSongForm', '&Title:'))
self.AlternativeTitleLabel.setText( self.alternativeTitleLabel.setText(
translate('SongsPlugin.EditSongForm', 'Alt&ernate title:')) translate('SongsPlugin.EditSongForm', 'Alt&ernate title:'))
self.LyricsLabel.setText( self.lyricsLabel.setText(
translate('SongsPlugin.EditSongForm', '&Lyrics:')) translate('SongsPlugin.EditSongForm', '&Lyrics:'))
self.VerseOrderLabel.setText( self.verseOrderLabel.setText(
translate('SongsPlugin.EditSongForm', '&Verse order:')) translate('SongsPlugin.EditSongForm', '&Verse order:'))
self.VerseAddButton.setText( self.verseAddButton.setText(
translate('SongsPlugin.EditSongForm', '&Add')) translate('SongsPlugin.EditSongForm', '&Add'))
self.VerseEditButton.setText( self.verseEditButton.setText(
translate('SongsPlugin.EditSongForm', '&Edit')) translate('SongsPlugin.EditSongForm', '&Edit'))
self.VerseEditAllButton.setText( self.verseEditAllButton.setText(
translate('SongsPlugin.EditSongForm', 'Ed&it All')) translate('SongsPlugin.EditSongForm', 'Ed&it All'))
self.VerseDeleteButton.setText( self.verseDeleteButton.setText(
translate('SongsPlugin.EditSongForm', '&Delete')) translate('SongsPlugin.EditSongForm', '&Delete'))
self.SongTabWidget.setTabText( self.songTabWidget.setTabText(
self.SongTabWidget.indexOf(self.LyricsTab), self.songTabWidget.indexOf(self.lyricsTab),
translate('SongsPlugin.EditSongForm', 'Title && Lyrics')) translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
self.AuthorsGroupBox.setTitle( self.authorsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Authors')) translate('SongsPlugin.EditSongForm', 'Authors'))
self.AuthorAddButton.setText( self.authorAddButton.setText(
translate('SongsPlugin.EditSongForm', '&Add to Song')) translate('SongsPlugin.EditSongForm', '&Add to Song'))
self.AuthorRemoveButton.setText( self.authorRemoveButton.setText(
translate('SongsPlugin.EditSongForm', '&Remove')) translate('SongsPlugin.EditSongForm', '&Remove'))
self.MaintenanceButton.setText(translate('SongsPlugin.EditSongForm', self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm',
'&Manage Authors, Topics, Song Books')) '&Manage Authors, Topics, Song Books'))
self.TopicGroupBox.setTitle( self.topicsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Topic')) translate('SongsPlugin.EditSongForm', 'Topic'))
self.TopicAddButton.setText( self.topicAddButton.setText(
translate('SongsPlugin.EditSongForm', 'A&dd to Song')) translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
self.TopicRemoveButton.setText( self.topicRemoveButton.setText(
translate('SongsPlugin.EditSongForm', 'R&emove')) translate('SongsPlugin.EditSongForm', 'R&emove'))
self.SongBookGroup.setTitle( self.songBookGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Song Book')) translate('SongsPlugin.EditSongForm', 'Song Book'))
self.SongbookNameLabel.setText(translate('SongsPlugin.EditSongForm', self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm',
'Book:')) 'Book:'))
self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm', self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm',
'Number:')) 'Number:'))
self.SongTabWidget.setTabText( self.songTabWidget.setTabText(
self.SongTabWidget.indexOf(self.AuthorsTab), self.songTabWidget.indexOf(self.authorsTab),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'Authors, Topics && Song Book')) 'Authors, Topics && Song Book'))
self.ThemeGroupBox.setTitle( self.themeGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Theme')) translate('SongsPlugin.EditSongForm', 'Theme'))
self.ThemeAddButton.setText( self.themeAddButton.setText(
translate('SongsPlugin.EditSongForm', 'New &Theme')) translate('SongsPlugin.EditSongForm', 'New &Theme'))
self.CopyrightGroupBox.setTitle( self.rightsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Copyright Information')) translate('SongsPlugin.EditSongForm', 'Copyright Information'))
self.CopyrightInsertButton.setText( self.copyrightInsertButton.setText(
translate('SongsPlugin.EditSongForm', '\xa9')) translate('SongsPlugin.EditSongForm', '\xa9'))
self.CCLILabel.setText( self.CCLILabel.setText(
translate('SongsPlugin.EditSongForm', 'CCLI number:')) translate('SongsPlugin.EditSongForm', 'CCLI number:'))
self.CommentsGroupBox.setTitle( self.commentsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Comments')) translate('SongsPlugin.EditSongForm', 'Comments'))
self.SongTabWidget.setTabText( self.songTabWidget.setTabText(
self.SongTabWidget.indexOf(self.ThemeTab), self.songTabWidget.indexOf(self.themeTab),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'Theme, Copyright Info && Comments')) 'Theme, Copyright Info && Comments'))

View File

@ -54,40 +54,40 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.width = 400 self.width = 400
self.setupUi(self) self.setupUi(self)
# Connecting signals and slots # Connecting signals and slots
QtCore.QObject.connect(self.AuthorAddButton, QtCore.QObject.connect(self.authorAddButton,
QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked)
QtCore.QObject.connect(self.AuthorRemoveButton, QtCore.QObject.connect(self.authorRemoveButton,
QtCore.SIGNAL(u'clicked()'), self.onAuthorRemoveButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onAuthorRemoveButtonClicked)
QtCore.QObject.connect(self.AuthorsListView, QtCore.QObject.connect(self.authorsListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onAuthorsListViewPressed) self.onAuthorsListViewPressed)
QtCore.QObject.connect(self.TopicAddButton, QtCore.QObject.connect(self.topicAddButton,
QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked)
QtCore.QObject.connect(self.TopicRemoveButton, QtCore.QObject.connect(self.topicRemoveButton,
QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked)
QtCore.QObject.connect(self.TopicsListView, QtCore.QObject.connect(self.topicsListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onTopicListViewPressed) self.onTopicListViewPressed)
QtCore.QObject.connect(self.CopyrightInsertButton, QtCore.QObject.connect(self.copyrightInsertButton,
QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered) QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered)
QtCore.QObject.connect(self.VerseAddButton, QtCore.QObject.connect(self.verseAddButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseAddButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseAddButtonClicked)
QtCore.QObject.connect(self.VerseListWidget, QtCore.QObject.connect(self.verseListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onVerseEditButtonClicked) self.onVerseEditButtonClicked)
QtCore.QObject.connect(self.VerseEditButton, QtCore.QObject.connect(self.verseEditButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseEditButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseEditButtonClicked)
QtCore.QObject.connect(self.VerseEditAllButton, QtCore.QObject.connect(self.verseEditAllButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseEditAllButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseEditAllButtonClicked)
QtCore.QObject.connect(self.VerseDeleteButton, QtCore.QObject.connect(self.verseDeleteButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked)
QtCore.QObject.connect(self.VerseListWidget, QtCore.QObject.connect(self.verseListWidget,
QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
self.onVerseListViewPressed) self.onVerseListViewPressed)
QtCore.QObject.connect(self.ThemeAddButton, QtCore.QObject.connect(self.themeAddButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.parent.parent.renderManager.theme_manager.onAddTheme) self.parent.parent.renderManager.theme_manager.onAddTheme)
QtCore.QObject.connect(self.MaintenanceButton, QtCore.QObject.connect(self.maintenanceButton,
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
@ -95,102 +95,102 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.previewButton.setObjectName(u'previewButton') self.previewButton.setObjectName(u'previewButton')
self.previewButton.setText( self.previewButton.setText(
translate('SongsPlugin.EditSongForm', 'Save && Preview')) translate('SongsPlugin.EditSongForm', 'Save && Preview'))
self.ButtonBox.addButton( self.buttonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole) self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview) QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
# Create other objects and forms # Create other objects and forms
self.manager = manager self.manager = manager
self.verse_form = EditVerseForm(self) self.verse_form = EditVerseForm(self)
self.initialise() self.initialise()
self.AuthorsListView.setSortingEnabled(False) self.authorsListView.setSortingEnabled(False)
self.AuthorsListView.setAlternatingRowColors(True) self.authorsListView.setAlternatingRowColors(True)
self.TopicsListView.setSortingEnabled(False) self.topicsListView.setSortingEnabled(False)
self.TopicsListView.setAlternatingRowColors(True) self.topicsListView.setAlternatingRowColors(True)
self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE) self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE)
self.whitespace = re.compile(r'\W+', re.UNICODE) self.whitespace = re.compile(r'\W+', re.UNICODE)
def initialise(self): def initialise(self):
self.VerseEditButton.setEnabled(False) self.verseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.verseDeleteButton.setEnabled(False)
self.AuthorRemoveButton.setEnabled(False) self.authorRemoveButton.setEnabled(False)
self.TopicRemoveButton.setEnabled(False) self.topicRemoveButton.setEnabled(False)
def loadAuthors(self): def loadAuthors(self):
authors = self.manager.get_all_objects(Author, authors = self.manager.get_all_objects(Author,
order_by_ref=Author.display_name) order_by_ref=Author.display_name)
self.AuthorsSelectionComboItem.clear() self.authorsComboBox.clear()
self.AuthorsSelectionComboItem.addItem(u'') self.authorsComboBox.addItem(u'')
self.authors = [] self.authors = []
for author in authors: for author in authors:
row = self.AuthorsSelectionComboItem.count() row = self.authorsComboBox.count()
self.AuthorsSelectionComboItem.addItem(author.display_name) self.authorsComboBox.addItem(author.display_name)
self.AuthorsSelectionComboItem.setItemData( self.authorsComboBox.setItemData(
row, QtCore.QVariant(author.id)) row, QtCore.QVariant(author.id))
self.authors.append(author.display_name) self.authors.append(author.display_name)
completer = QtGui.QCompleter(self.authors) completer = QtGui.QCompleter(self.authors)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.AuthorsSelectionComboItem.setCompleter(completer) self.authorsComboBox.setCompleter(completer)
def loadTopics(self): def loadTopics(self):
topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name) topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
self.SongTopicCombo.clear() self.topicsComboBox.clear()
self.SongTopicCombo.addItem(u'') self.topicsComboBox.addItem(u'')
self.topics = [] self.topics = []
for topic in topics: for topic in topics:
row = self.SongTopicCombo.count() row = self.topicsComboBox.count()
self.SongTopicCombo.addItem(topic.name) self.topicsComboBox.addItem(topic.name)
self.topics.append(topic.name) self.topics.append(topic.name)
self.SongTopicCombo.setItemData(row, QtCore.QVariant(topic.id)) self.topicsComboBox.setItemData(row, QtCore.QVariant(topic.id))
completer = QtGui.QCompleter(self.topics) completer = QtGui.QCompleter(self.topics)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongTopicCombo.setCompleter(completer) self.topicsComboBox.setCompleter(completer)
def loadBooks(self): def loadBooks(self):
books = self.manager.get_all_objects(Book, order_by_ref=Book.name) books = self.manager.get_all_objects(Book, order_by_ref=Book.name)
self.SongbookCombo.clear() self.songBookComboBox.clear()
self.SongbookCombo.addItem(u'') self.songBookComboBox.addItem(u'')
self.books = [] self.books = []
for book in books: for book in books:
row = self.SongbookCombo.count() row = self.songBookComboBox.count()
self.SongbookCombo.addItem(book.name) self.songBookComboBox.addItem(book.name)
self.books.append(book.name) self.books.append(book.name)
self.SongbookCombo.setItemData(row, QtCore.QVariant(book.id)) self.songBookComboBox.setItemData(row, QtCore.QVariant(book.id))
completer = QtGui.QCompleter(self.books) completer = QtGui.QCompleter(self.books)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongbookCombo.setCompleter(completer) self.songBookComboBox.setCompleter(completer)
def loadThemes(self, theme_list): def loadThemes(self, theme_list):
self.ThemeSelectionComboItem.clear() self.themeComboBox.clear()
self.ThemeSelectionComboItem.addItem(u'') self.themeComboBox.addItem(u'')
self.themes = [] self.themes = []
for theme in theme_list: for theme in theme_list:
self.ThemeSelectionComboItem.addItem(theme) self.themeComboBox.addItem(theme)
self.themes.append(theme) self.themes.append(theme)
completer = QtGui.QCompleter(self.themes) completer = QtGui.QCompleter(self.themes)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.ThemeSelectionComboItem.setCompleter(completer) self.themeComboBox.setCompleter(completer)
def newSong(self): def newSong(self):
log.debug(u'New Song') log.debug(u'New Song')
self.initialise() self.initialise()
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.TitleEditItem.setText(u'') self.titleEdit.setText(u'')
self.AlternativeEdit.setText(u'') self.alternativeEdit.setText(u'')
self.CopyrightEditItem.setText(u'') self.copyrightEdit.setText(u'')
self.VerseOrderEdit.setText(u'') self.verseOrderEdit.setText(u'')
self.CommentsEdit.setText(u'') self.commentsEdit.setText(u'')
self.CCLNumberEdit.setText(u'') self.CCLNumberEdit.setText(u'')
self.VerseListWidget.clear() self.verseListWidget.clear()
self.VerseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
self.AuthorsListView.clear() self.authorsListView.clear()
self.TopicsListView.clear() self.topicsListView.clear()
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.songBookNumberEdit.setText(u'') self.songBookNumberEdit.setText(u'')
self.loadAuthors() self.loadAuthors()
self.loadTopics() self.loadTopics()
self.loadBooks() self.loadBooks()
self.ThemeSelectionComboItem.setCurrentIndex(0) self.themeComboBox.setCurrentIndex(0)
# it's a new song to preview is not possible # it's a new song to preview is not possible
self.previewButton.setVisible(False) self.previewButton.setVisible(False)
@ -206,46 +206,46 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
""" """
log.debug(u'Load Song') log.debug(u'Load Song')
self.initialise() self.initialise()
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.loadAuthors() self.loadAuthors()
self.loadTopics() self.loadTopics()
self.loadBooks() self.loadBooks()
self.song = self.manager.get_object(Song, id) self.song = self.manager.get_object(Song, id)
self.TitleEditItem.setText(self.song.title) self.titleEdit.setText(self.song.title)
if self.song.alternate_title: if self.song.alternate_title:
self.AlternativeEdit.setText(self.song.alternate_title) self.alternativeEdit.setText(self.song.alternate_title)
else: else:
self.AlternativeEdit.setText(u'') self.alternativeEdit.setText(u'')
if self.song.song_book_id != 0: if self.song.song_book_id != 0:
book_name = self.manager.get_object(Book, self.song.song_book_id) book_name = self.manager.get_object(Book, self.song.song_book_id)
id = self.SongbookCombo.findText( id = self.songBookComboBox.findText(
unicode(book_name.name), QtCore.Qt.MatchExactly) unicode(book_name.name), QtCore.Qt.MatchExactly)
if id == -1: if id == -1:
# Not Found # Not Found
id = 0 id = 0
self.SongbookCombo.setCurrentIndex(id) self.songBookComboBox.setCurrentIndex(id)
if self.song.theme_name: if self.song.theme_name:
id = self.ThemeSelectionComboItem.findText( id = self.themeComboBox.findText(
unicode(self.song.theme_name), QtCore.Qt.MatchExactly) unicode(self.song.theme_name), QtCore.Qt.MatchExactly)
if id == -1: if id == -1:
# Not Found # Not Found
id = 0 id = 0
self.song.theme_name = None self.song.theme_name = None
self.ThemeSelectionComboItem.setCurrentIndex(id) self.themeComboBox.setCurrentIndex(id)
if self.song.copyright: if self.song.copyright:
self.CopyrightEditItem.setText(self.song.copyright) self.copyrightEdit.setText(self.song.copyright)
else: else:
self.CopyrightEditItem.setText(u'') self.copyrightEdit.setText(u'')
self.VerseListWidget.clear() self.verseListWidget.clear()
self.VerseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
if self.song.verse_order: if self.song.verse_order:
self.VerseOrderEdit.setText(self.song.verse_order) self.verseOrderEdit.setText(self.song.verse_order)
else: else:
self.VerseOrderEdit.setText(u'') self.verseOrderEdit.setText(u'')
if self.song.comments: if self.song.comments:
self.CommentsEdit.setPlainText(self.song.comments) self.commentsEdit.setPlainText(self.song.comments)
else: else:
self.CommentsEdit.setPlainText(u'') self.commentsEdit.setPlainText(u'')
if self.song.ccli_number: if self.song.ccli_number:
self.CCLNumberEdit.setText(self.song.ccli_number) self.CCLNumberEdit.setText(self.song.ccli_number)
else: else:
@ -256,9 +256,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.songBookNumberEdit.setText(u'') self.songBookNumberEdit.setText(u'')
# lazy xml migration for now # lazy xml migration for now
self.VerseListWidget.clear() self.verseListWidget.clear()
self.VerseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
self.VerseListWidget.setColumnWidth(0, self.width) self.verseListWidget.setColumnWidth(0, self.width)
# This is just because occasionally the lyrics come back as a "buffer" # This is just because occasionally the lyrics come back as a "buffer"
if isinstance(self.song.lyrics, buffer): if isinstance(self.song.lyrics, buffer):
self.song.lyrics = unicode(self.song.lyrics) self.song.lyrics = unicode(self.song.lyrics)
@ -266,37 +266,37 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
songXML = SongXMLParser(self.song.lyrics) songXML = SongXMLParser(self.song.lyrics)
verseList = songXML.get_verses() verseList = songXML.get_verses()
for count, verse in enumerate(verseList): for count, verse in enumerate(verseList):
self.VerseListWidget.setRowCount( self.verseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1) self.verseListWidget.rowCount() + 1)
variant = u'%s:%s' % (verse[0][u'type'], verse[0][u'label']) variant = u'%s:%s' % (verse[0][u'type'], verse[0][u'label'])
item = QtGui.QTableWidgetItem(verse[1]) item = QtGui.QTableWidgetItem(verse[1])
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.setItem(count, 0, item) self.verseListWidget.setItem(count, 0, item)
else: else:
verses = self.song.lyrics.split(u'\n\n') verses = self.song.lyrics.split(u'\n\n')
for count, verse in enumerate(verses): for count, verse in enumerate(verses):
self.VerseListWidget.setRowCount( self.verseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1) self.verseListWidget.rowCount() + 1)
item = QtGui.QTableWidgetItem(verse) item = QtGui.QTableWidgetItem(verse)
variant = u'%s:%s' % \ variant = u'%s:%s' % \
(VerseType.to_string(VerseType.Verse), unicode(count + 1)) (VerseType.to_string(VerseType.Verse), unicode(count + 1))
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.setItem(count, 0, item) self.verseListWidget.setItem(count, 0, item)
self.VerseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.tagRows() self.tagRows()
# clear the results # clear the results
self.AuthorsListView.clear() self.authorsListView.clear()
for author in self.song.authors: for author in self.song.authors:
author_name = QtGui.QListWidgetItem(unicode(author.display_name)) author_name = QtGui.QListWidgetItem(unicode(author.display_name))
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_name) self.authorsListView.addItem(author_name)
# clear the results # clear the results
self.TopicsListView.clear() self.topicsListView.clear()
for topic in self.song.topics: for topic in self.song.topics:
topic_name = QtGui.QListWidgetItem(unicode(topic.name)) topic_name = QtGui.QListWidgetItem(unicode(topic.name))
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id)) topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_name) self.topicsListView.addItem(topic_name)
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
# if not preview hide the preview button # if not preview hide the preview button
self.previewButton.setVisible(False) self.previewButton.setVisible(False)
if preview: if preview:
@ -307,17 +307,17 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
Tag the Song List rows based on the verse list Tag the Song List rows based on the verse list
""" """
rowLabel = [] rowLabel = []
for row in range(0, self.VerseListWidget.rowCount()): for row in range(0, self.verseListWidget.rowCount()):
item = self.VerseListWidget.item(row, 0) item = self.verseListWidget.item(row, 0)
data = unicode(item.data(QtCore.Qt.UserRole).toString()) data = unicode(item.data(QtCore.Qt.UserRole).toString())
bit = data.split(u':') bit = data.split(u':')
rowTag = u'%s%s' % (bit[0][0:1], bit[1]) rowTag = u'%s%s' % (bit[0][0:1], bit[1])
rowLabel.append(rowTag) rowLabel.append(rowTag)
self.VerseListWidget.setVerticalHeaderLabels(rowLabel) self.verseListWidget.setVerticalHeaderLabels(rowLabel)
def onAuthorAddButtonClicked(self): def onAuthorAddButtonClicked(self):
item = int(self.AuthorsSelectionComboItem.currentIndex()) item = int(self.authorsComboBox.currentIndex())
text = unicode(self.AuthorsSelectionComboItem.currentText()) text = unicode(self.authorsComboBox.currentText())
if item == 0 and text: if item == 0 and text:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Author'), translate('SongsPlugin.EditSongForm', 'Add Author'),
@ -336,15 +336,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
unicode(author.display_name)) unicode(author.display_name))
author_item.setData(QtCore.Qt.UserRole, author_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(author.id)) QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_item) self.authorsListView.addItem(author_item)
self.loadAuthors() self.loadAuthors()
self.AuthorsSelectionComboItem.setCurrentIndex(0) self.authorsComboBox.setCurrentIndex(0)
else: else:
return return
elif item > 0: elif item > 0:
item_id = (self.AuthorsSelectionComboItem.itemData(item)).toInt()[0] item_id = (self.authorsComboBox.itemData(item)).toInt()[0]
author = self.manager.get_object(Author, item_id) author = self.manager.get_object(Author, item_id)
if self.AuthorsListView.findItems(unicode(author.display_name), if self.authorsListView.findItems(unicode(author.display_name),
QtCore.Qt.MatchExactly): QtCore.Qt.MatchExactly):
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Error'), translate('SongsPlugin.EditSongForm', 'Error'),
@ -355,8 +355,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
author.display_name)) author.display_name))
author_item.setData(QtCore.Qt.UserRole, author_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(author.id)) QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_item) self.authorsListView.addItem(author_item)
self.AuthorsSelectionComboItem.setCurrentIndex(0) self.authorsComboBox.setCurrentIndex(0)
else: else:
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'No Author Selected'), translate('SongsPlugin.EditSongForm', 'No Author Selected'),
@ -366,18 +366,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'Song" button to add the new author.')) 'Song" button to add the new author.'))
def onAuthorsListViewPressed(self): def onAuthorsListViewPressed(self):
if self.AuthorsListView.count() > 1: if self.authorsListView.count() > 1:
self.AuthorRemoveButton.setEnabled(True) self.authorRemoveButton.setEnabled(True)
def onAuthorRemoveButtonClicked(self): def onAuthorRemoveButtonClicked(self):
self.AuthorRemoveButton.setEnabled(False) self.authorRemoveButton.setEnabled(False)
item = self.AuthorsListView.currentItem() item = self.authorsListView.currentItem()
row = self.AuthorsListView.row(item) row = self.authorsListView.row(item)
self.AuthorsListView.takeItem(row) self.authorsListView.takeItem(row)
def onTopicAddButtonClicked(self): def onTopicAddButtonClicked(self):
item = int(self.SongTopicCombo.currentIndex()) item = int(self.topicsComboBox.currentIndex())
text = unicode(self.SongTopicCombo.currentText()) text = unicode(self.topicsComboBox.currentText())
if item == 0 and text: if item == 0 and text:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Topic'), translate('SongsPlugin.EditSongForm', 'Add Topic'),
@ -390,15 +390,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
topic_item = QtGui.QListWidgetItem(unicode(topic.name)) topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole, topic_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(topic.id)) QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_item) self.topicsListView.addItem(topic_item)
self.loadTopics() self.loadTopics()
self.SongTopicCombo.setCurrentIndex(0) self.topicsComboBox.setCurrentIndex(0)
else: else:
return return
elif item > 0: elif item > 0:
item_id = (self.SongTopicCombo.itemData(item)).toInt()[0] item_id = (self.topicsComboBox.itemData(item)).toInt()[0]
topic = self.manager.get_object(Topic, item_id) topic = self.manager.get_object(Topic, item_id)
if self.TopicsListView.findItems(unicode(topic.name), if self.topicsListView.findItems(unicode(topic.name),
QtCore.Qt.MatchExactly): QtCore.Qt.MatchExactly):
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Error'), translate('SongsPlugin.EditSongForm', 'Error'),
@ -408,8 +408,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
topic_item = QtGui.QListWidgetItem(unicode(topic.name)) topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole, topic_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(topic.id)) QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_item) self.topicsListView.addItem(topic_item)
self.SongTopicCombo.setCurrentIndex(0) self.topicsComboBox.setCurrentIndex(0)
else: else:
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'No Topic Selected'), translate('SongsPlugin.EditSongForm', 'No Topic Selected'),
@ -419,17 +419,17 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'button to add the new topic.')) 'button to add the new topic.'))
def onTopicListViewPressed(self): def onTopicListViewPressed(self):
self.TopicRemoveButton.setEnabled(True) self.topicRemoveButton.setEnabled(True)
def onTopicRemoveButtonClicked(self): def onTopicRemoveButtonClicked(self):
self.TopicRemoveButton.setEnabled(False) self.topicRemoveButton.setEnabled(False)
item = self.TopicsListView.currentItem() item = self.topicsListView.currentItem()
row = self.TopicsListView.row(item) row = self.topicsListView.row(item)
self.TopicsListView.takeItem(row) self.topicsListView.takeItem(row)
def onVerseListViewPressed(self): def onVerseListViewPressed(self):
self.VerseEditButton.setEnabled(True) self.verseEditButton.setEnabled(True)
self.VerseDeleteButton.setEnabled(True) self.verseDeleteButton.setEnabled(True)
def onVerseAddButtonClicked(self): def onVerseAddButtonClicked(self):
self.verse_form.setVerse(u'', True) self.verse_form.setVerse(u'', True)
@ -439,16 +439,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = QtGui.QTableWidgetItem(afterText) item = QtGui.QTableWidgetItem(afterText)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
item.setText(afterText) item.setText(afterText)
self.VerseListWidget.setRowCount( self.verseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1) self.verseListWidget.rowCount() + 1)
self.VerseListWidget.setItem( self.verseListWidget.setItem(
int(self.VerseListWidget.rowCount() - 1), 0, item) int(self.verseListWidget.rowCount() - 1), 0, item)
self.VerseListWidget.setColumnWidth(0, self.width) self.verseListWidget.setColumnWidth(0, self.width)
self.VerseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.tagRows() self.tagRows()
def onVerseEditButtonClicked(self): def onVerseEditButtonClicked(self):
item = self.VerseListWidget.currentItem() item = self.verseListWidget.currentItem()
if item: if item:
tempText = item.text() tempText = item.text()
verseId = unicode(item.data(QtCore.Qt.UserRole).toString()) verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
@ -462,24 +462,24 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')): if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
tempList = {} tempList = {}
tempId = {} tempId = {}
for row in range(0, self.VerseListWidget.rowCount()): for row in range(0, self.verseListWidget.rowCount()):
tempList[row] = self.VerseListWidget.item(row, 0).text() tempList[row] = self.verseListWidget.item(row, 0).text()
tempId[row] = self.VerseListWidget.item(row, 0).\ tempId[row] = self.verseListWidget.item(row, 0).\
data(QtCore.Qt.UserRole) data(QtCore.Qt.UserRole)
self.VerseListWidget.clear() self.verseListWidget.clear()
for row in range (0, len(tempList)): for row in range (0, len(tempList)):
item = QtGui.QTableWidgetItem(tempList[row], 0) item = QtGui.QTableWidgetItem(tempList[row], 0)
item.setData(QtCore.Qt.UserRole, tempId[row]) item.setData(QtCore.Qt.UserRole, tempId[row])
self.VerseListWidget.setItem(row, 0, item) self.verseListWidget.setItem(row, 0, item)
self.VerseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint() self.verseListWidget.repaint()
self.tagRows() self.tagRows()
def onVerseEditAllButtonClicked(self): def onVerseEditAllButtonClicked(self):
verse_list = u'' verse_list = u''
if self.VerseListWidget.rowCount() > 0: if self.verseListWidget.rowCount() > 0:
for row in range(0, self.VerseListWidget.rowCount()): for row in range(0, self.verseListWidget.rowCount()):
item = self.VerseListWidget.item(row, 0) item = self.verseListWidget.item(row, 0)
field = unicode(item.data(QtCore.Qt.UserRole).toString()) field = unicode(item.data(QtCore.Qt.UserRole).toString())
verse_list += u'---[%s]---\n' % field verse_list += u'---[%s]---\n' % field
verse_list += item.text() verse_list += item.text()
@ -490,8 +490,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.verse_form.exec_(): if self.verse_form.exec_():
verse_list = self.verse_form.getVerseAll() verse_list = self.verse_form.getVerseAll()
verse_list = unicode(verse_list.replace(u'\r\n', u'\n')) verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
self.VerseListWidget.clear() self.verseListWidget.clear()
self.VerseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
for row in self.findVerseSplit.split(verse_list): for row in self.findVerseSplit.split(verse_list):
for match in row.split(u'---['): for match in row.split(u'---['):
for count, parts in enumerate(match.split(u']---\n')): for count, parts in enumerate(match.split(u']---\n')):
@ -506,22 +506,22 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = QtGui.QTableWidgetItem(parts) item = QtGui.QTableWidgetItem(parts)
item.setData(QtCore.Qt.UserRole, item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(variant)) QtCore.QVariant(variant))
self.VerseListWidget.setRowCount( self.verseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1) self.verseListWidget.rowCount() + 1)
self.VerseListWidget.setItem( self.verseListWidget.setItem(
int(self.VerseListWidget.rowCount() - 1), int(self.verseListWidget.rowCount() - 1),
0, item) 0, item)
self.VerseListWidget.setColumnWidth(0, self.width) self.verseListWidget.setColumnWidth(0, self.width)
self.VerseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint() self.verseListWidget.repaint()
self.tagRows() self.tagRows()
self.VerseEditButton.setEnabled(False) self.verseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.verseDeleteButton.setEnabled(False)
def onVerseDeleteButtonClicked(self): def onVerseDeleteButtonClicked(self):
self.VerseListWidget.removeRow(self.VerseListWidget.currentRow()) self.verseListWidget.removeRow(self.verseListWidget.currentRow())
self.VerseEditButton.setEnabled(False) self.verseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.verseDeleteButton.setEnabled(False)
def _validate_song(self): def _validate_song(self):
""" """
@ -530,25 +530,25 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
""" """
log.debug(u'Validate Song') log.debug(u'Validate Song')
# Lets be nice and assume the data is correct. # Lets be nice and assume the data is correct.
if len(self.TitleEditItem.displayText()) == 0: if len(self.titleEdit.displayText()) == 0:
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.TitleEditItem.setFocus() self.titleEdit.setFocus()
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'), translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'You need to type in a song title.')) 'You need to type in a song title.'))
return False return False
if self.VerseListWidget.rowCount() == 0: if self.verseListWidget.rowCount() == 0:
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.VerseListWidget.setFocus() self.verseListWidget.setFocus()
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'), translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'You need to type in at least one verse.')) 'You need to type in at least one verse.'))
return False return False
if self.AuthorsListView.count() == 0: if self.authorsListView.count() == 0:
self.SongTabWidget.setCurrentIndex(1) self.songTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus() self.authorsListView.setFocus()
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Warning'), translate('SongsPlugin.EditSongForm', 'Warning'),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
@ -564,8 +564,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
order.append(item.lower()) order.append(item.lower())
verses = [] verses = []
verse_names = [] verse_names = []
for index in range (0, self.VerseListWidget.rowCount()): for index in range (0, self.verseListWidget.rowCount()):
verse = self.VerseListWidget.item(index, 0) verse = self.verseListWidget.item(index, 0)
verse = unicode(verse.data(QtCore.Qt.UserRole).toString()) verse = unicode(verse.data(QtCore.Qt.UserRole).toString())
if verse not in verse_names: if verse not in verse_names:
verses.append( verses.append(
@ -573,8 +573,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verse_names.append(verse) verse_names.append(verse)
for count, item in enumerate(order): for count, item in enumerate(order):
if item not in verses: if item not in verses:
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus() self.verseOrderEdit.setFocus()
valid = verses.pop(0) valid = verses.pop(0)
for verse in verses: for verse in verses:
valid = valid + u', ' + verse valid = valid + u', ' + verse
@ -587,8 +587,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
return False return False
for count, verse in enumerate(verses): for count, verse in enumerate(verses):
if verse not in order: if verse not in order:
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus() self.verseOrderEdit.setFocus()
answer = QtGui.QMessageBox.warning(self, answer = QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Warning'), translate('SongsPlugin.EditSongForm', 'Warning'),
unicode(translate('SongsPlugin.EditSongForm', unicode(translate('SongsPlugin.EditSongForm',
@ -601,17 +601,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
return True return True
def onCopyrightInsertButtonTriggered(self): def onCopyrightInsertButtonTriggered(self):
text = self.CopyrightEditItem.text() text = self.copyrightEdit.text()
pos = self.CopyrightEditItem.cursorPosition() pos = self.copyrightEdit.cursorPosition()
text = text[:pos] + '\xa9' + text[pos:] sign = translate('SongsPlugin.EditSongForm', '\xa9')
self.CopyrightEditItem.setText(text) text = text[:pos] + sign + text[pos:]
self.CopyrightEditItem.setFocus() self.copyrightEdit.setText(text)
self.CopyrightEditItem.setCursorPosition(pos + 1) self.copyrightEdit.setFocus()
self.copyrightEdit.setCursorPosition(pos + len(sign))
def onMaintenanceButtonClicked(self): def onMaintenanceButtonClicked(self):
temp_song_book = None temp_song_book = None
item = int(self.SongbookCombo.currentIndex()) item = int(self.songBookComboBox.currentIndex())
text = unicode(self.SongbookCombo.currentText()) text = unicode(self.songBookComboBox.currentText())
if item == 0 and text: if item == 0 and text:
temp_song_book = text temp_song_book = text
self.parent.song_maintenance_form.exec_() self.parent.song_maintenance_form.exec_()
@ -619,7 +620,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadBooks() self.loadBooks()
self.loadTopics() self.loadTopics()
if temp_song_book: if temp_song_book:
self.SongbookCombo.setEditText(temp_song_book) self.songBookComboBox.setEditText(temp_song_book)
def onPreview(self, button): def onPreview(self, button):
""" """
@ -659,9 +660,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.clearCaches() self.clearCaches()
if not self.song: if not self.song:
self.song = Song() self.song = Song()
item = int(self.SongbookCombo.currentIndex()) item = int(self.songBookComboBox.currentIndex())
text = unicode(self.SongbookCombo.currentText()) text = unicode(self.songBookComboBox.currentText())
if self.SongbookCombo.findText(text, QtCore.Qt.MatchExactly) < 0: if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Book'), translate('SongsPlugin.EditSongForm', 'Add Book'),
translate('SongsPlugin.EditSongForm', 'This song book does ' translate('SongsPlugin.EditSongForm', 'This song book does '
@ -684,25 +685,25 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
``preview`` ``preview``
Should be ``True`` if the song is also previewed (boolean). Should be ``True`` if the song is also previewed (boolean).
""" """
self.song.title = unicode(self.TitleEditItem.text()) self.song.title = unicode(self.titleEdit.text())
self.song.alternate_title = unicode(self.AlternativeEdit.text()) self.song.alternate_title = unicode(self.alternativeEdit.text())
self.song.copyright = unicode(self.CopyrightEditItem.text()) self.song.copyright = unicode(self.copyrightEdit.text())
if self.song.alternate_title: if self.song.alternate_title:
self.song.search_title = self.song.title + u'@' + \ self.song.search_title = self.song.title + u'@' + \
self.song.alternate_title self.song.alternate_title
else: else:
self.song.search_title = self.song.title self.song.search_title = self.song.title
self.song.comments = unicode(self.CommentsEdit.toPlainText()) self.song.comments = unicode(self.commentsEdit.toPlainText())
self.song.verse_order = unicode(self.VerseOrderEdit.text()) self.song.verse_order = unicode(self.verseOrderEdit.text())
self.song.ccli_number = unicode(self.CCLNumberEdit.text()) self.song.ccli_number = unicode(self.CCLNumberEdit.text())
self.song.song_number = unicode(self.songBookNumberEdit.text()) self.song.song_number = unicode(self.songBookNumberEdit.text())
book_name = unicode(self.SongbookCombo.currentText()) book_name = unicode(self.songBookComboBox.currentText())
if book_name: if book_name:
self.song.book = self.manager.get_object_filtered(Book, self.song.book = self.manager.get_object_filtered(Book,
Book.name == book_name) Book.name == book_name)
else: else:
self.song.book = None self.song.book = None
theme_name = unicode(self.ThemeSelectionComboItem.currentText()) theme_name = unicode(self.themeComboBox.currentText())
if theme_name: if theme_name:
self.song.theme_name = theme_name self.song.theme_name = theme_name
else: else:
@ -711,14 +712,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.processLyrics() self.processLyrics()
self.processTitle() self.processTitle()
self.song.authors = [] self.song.authors = []
for row in range(self.AuthorsListView.count()): for row in range(self.authorsListView.count()):
item = self.AuthorsListView.item(row) item = self.authorsListView.item(row)
authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0] authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.song.authors.append(self.manager.get_object(Author, self.song.authors.append(self.manager.get_object(Author,
authorId)) authorId))
self.song.topics = [] self.song.topics = []
for row in range(self.TopicsListView.count()): for row in range(self.topicsListView.count()):
item = self.TopicsListView.item(row) item = self.topicsListView.item(row)
topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0] topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.song.topics.append(self.manager.get_object(Topic, topicId)) self.song.topics.append(self.manager.get_object(Topic, topicId))
self.manager.save_object(self.song) self.manager.save_object(self.song)
@ -733,13 +734,13 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
sxml = SongXMLBuilder() sxml = SongXMLBuilder()
text = u'' text = u''
multiple = [] multiple = []
for i in range(0, self.VerseListWidget.rowCount()): for i in range(0, self.verseListWidget.rowCount()):
item = self.VerseListWidget.item(i, 0) item = self.verseListWidget.item(i, 0)
verseId = unicode(item.data(QtCore.Qt.UserRole).toString()) verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
bits = verseId.split(u':') bits = verseId.split(u':')
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text())) sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
text = text + self.whitespace.sub(u' ', text = text + self.whitespace.sub(u' ',
unicode(self.VerseListWidget.item(i, 0).text())) + u' ' unicode(self.verseListWidget.item(i, 0).text())) + u' '
if (bits[1] > u'1') and (bits[0][0] not in multiple): if (bits[1] > u'1') and (bits[0][0] not in multiple):
multiple.append(bits[0][0]) multiple.append(bits[0][0])
self.song.search_lyrics = text.lower() self.song.search_lyrics = text.lower()

View File

@ -32,31 +32,22 @@ from openlp.plugins.songs.lib import VerseType
class Ui_EditVerseDialog(object): class Ui_EditVerseDialog(object):
def setupUi(self, editVerseDialog): def setupUi(self, editVerseDialog):
editVerseDialog.setObjectName(u'editVerseDialog') editVerseDialog.setObjectName(u'editVerseDialog')
editVerseDialog.resize(474, 442) editVerseDialog.resize(400, 400)
editVerseDialog.setModal(True) editVerseDialog.setModal(True)
self.editVerseLayout = QtGui.QVBoxLayout(editVerseDialog) self.dialogLayout = QtGui.QVBoxLayout(editVerseDialog)
self.editVerseLayout.setSpacing(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.editVerseLayout.setMargin(8)
self.editVerseLayout.setObjectName(u'editVerseLayout')
self.verseTextEdit = SpellTextEdit(editVerseDialog) self.verseTextEdit = SpellTextEdit(editVerseDialog)
self.verseTextEdit.setObjectName(u'verseTextEdit') self.verseTextEdit.setObjectName(u'verseTextEdit')
self.editVerseLayout.addWidget(self.verseTextEdit) self.dialogLayout.addWidget(self.verseTextEdit)
self.verseTypeLayout = QtGui.QHBoxLayout() self.verseTypeLayout = QtGui.QHBoxLayout()
self.verseTypeLayout.setSpacing(8)
self.verseTypeLayout.setObjectName(u'verseTypeLayout') self.verseTypeLayout.setObjectName(u'verseTypeLayout')
self.verseTypeLabel = QtGui.QLabel(editVerseDialog) self.verseTypeLabel = QtGui.QLabel(editVerseDialog)
self.verseTypeLabel.setObjectName(u'verseTypeLabel') self.verseTypeLabel.setObjectName(u'verseTypeLabel')
self.verseTypeLayout.addWidget(self.verseTypeLabel) self.verseTypeLayout.addWidget(self.verseTypeLabel)
self.verseTypeComboBox = QtGui.QComboBox(editVerseDialog) self.verseTypeComboBox = QtGui.QComboBox(editVerseDialog)
self.verseTypeComboBox.addItems([u'', u'', u'', u'', u'', u'', u''])
self.verseTypeComboBox.setObjectName(u'verseTypeComboBox') self.verseTypeComboBox.setObjectName(u'verseTypeComboBox')
self.verseTypeLabel.setBuddy(self.verseTypeComboBox) self.verseTypeLabel.setBuddy(self.verseTypeComboBox)
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeLayout.addWidget(self.verseTypeComboBox) self.verseTypeLayout.addWidget(self.verseTypeComboBox)
self.verseNumberBox = QtGui.QSpinBox(editVerseDialog) self.verseNumberBox = QtGui.QSpinBox(editVerseDialog)
self.verseNumberBox.setMinimum(1) self.verseNumberBox.setMinimum(1)
@ -66,21 +57,18 @@ class Ui_EditVerseDialog(object):
self.insertButton.setIcon(build_icon(u':/general/general_add.png')) self.insertButton.setIcon(build_icon(u':/general/general_add.png'))
self.insertButton.setObjectName(u'insertButton') self.insertButton.setObjectName(u'insertButton')
self.verseTypeLayout.addWidget(self.insertButton) self.verseTypeLayout.addWidget(self.insertButton)
self.verseTypeSpacer = QtGui.QSpacerItem(40, 20, self.verseTypeLayout.addStretch()
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.dialogLayout.addLayout(self.verseTypeLayout)
self.verseTypeLayout.addItem(self.verseTypeSpacer) self.buttonBox = QtGui.QDialogButtonBox(editVerseDialog)
self.editVerseLayout.addLayout(self.verseTypeLayout) self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.editButtonBox = QtGui.QDialogButtonBox(editVerseDialog) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
self.editButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.editButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
self.editButtonBox.setObjectName(u'editButtonBox') self.buttonBox.setObjectName(u'buttonBox')
self.editVerseLayout.addWidget(self.editButtonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(editVerseDialog) self.retranslateUi(editVerseDialog)
QtCore.QObject.connect(self.editButtonBox, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
editVerseDialog.accept) editVerseDialog.accept)
QtCore.QObject.connect(self.editButtonBox, QtCore.SIGNAL(u'rejected()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
editVerseDialog.reject) editVerseDialog.reject)
QtCore.QMetaObject.connectSlotsByName(editVerseDialog) QtCore.QMetaObject.connectSlotsByName(editVerseDialog)
@ -104,4 +92,4 @@ class Ui_EditVerseDialog(object):
self.verseTypeComboBox.setItemText(6, self.verseTypeComboBox.setItemText(6,
VerseType.to_string(VerseType.Other)) VerseType.to_string(VerseType.Other))
self.insertButton.setText( self.insertButton.setText(
translate('SongsPlugin.EditVerseForm', '&Insert')) translate('SongsPlugin.EditVerseForm', '&Insert'))

View File

@ -172,4 +172,4 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'You need to type some text in to the verse.')) 'You need to type some text in to the verse.'))
return False return False
QtGui.QDialog.accept(self) QtGui.QDialog.accept(self)

View File

@ -29,49 +29,42 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_SongBookDialog(object): class Ui_SongBookDialog(object):
def setupUi(self, SongBookDialog): def setupUi(self, songBookDialog):
SongBookDialog.setObjectName(u'SongBookDialog') songBookDialog.setObjectName(u'songBookDialog')
SongBookDialog.resize(367, 120) songBookDialog.resize(300, 10)
self.SongBookLayout = QtGui.QFormLayout(SongBookDialog) self.dialogLayout = QtGui.QVBoxLayout(songBookDialog)
self.SongBookLayout.setMargin(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.SongBookLayout.setSpacing(8) self.bookLayout = QtGui.QFormLayout()
self.SongBookLayout.setObjectName(u'SongBookLayout') self.bookLayout.setObjectName(u'bookLayout')
self.NameLabel = QtGui.QLabel(SongBookDialog) self.nameLabel = QtGui.QLabel(songBookDialog)
self.NameLabel.setObjectName(u'NameLabel') self.nameLabel.setObjectName(u'nameLabel')
self.SongBookLayout.setWidget(0, self.nameEdit = QtGui.QLineEdit(songBookDialog)
QtGui.QFormLayout.LabelRole, self.NameLabel) self.nameEdit.setObjectName(u'nameEdit')
self.NameEdit = QtGui.QLineEdit(SongBookDialog) self.nameLabel.setBuddy(self.nameEdit)
self.NameEdit.setObjectName(u'NameEdit') self.bookLayout.addRow(self.nameLabel, self.nameEdit)
self.NameLabel.setBuddy(self.NameEdit) self.publisherLabel = QtGui.QLabel(songBookDialog)
self.SongBookLayout.setWidget(0, self.publisherLabel.setObjectName(u'publisherLabel')
QtGui.QFormLayout.FieldRole, self.NameEdit) self.publisherEdit = QtGui.QLineEdit(songBookDialog)
self.PublisherLabel = QtGui.QLabel(SongBookDialog) self.publisherEdit.setObjectName(u'publisherEdit')
self.PublisherLabel.setObjectName(u'PublisherLabel') self.publisherLabel.setBuddy(self.publisherEdit)
self.SongBookLayout.setWidget(1, self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
QtGui.QFormLayout.LabelRole, self.PublisherLabel) self.dialogLayout.addLayout(self.bookLayout)
self.PublisherEdit = QtGui.QLineEdit(SongBookDialog) self.buttonBox = QtGui.QDialogButtonBox(songBookDialog)
self.PublisherEdit.setObjectName(u'PublisherEdit') self.buttonBox.setStandardButtons(
self.PublisherLabel.setBuddy(self.PublisherEdit)
self.SongBookLayout.setWidget(1,
QtGui.QFormLayout.FieldRole, self.PublisherEdit)
self.ButtonBox = QtGui.QDialogButtonBox(SongBookDialog)
self.ButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.ButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.ButtonBox.setObjectName(u'ButtonBox') self.buttonBox.setObjectName(u'buttonBox')
self.SongBookLayout.setWidget(2, self.dialogLayout.addWidget(self.buttonBox)
QtGui.QFormLayout.FieldRole, self.ButtonBox) self.retranslateUi(songBookDialog)
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), songBookDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), songBookDialog.reject)
QtCore.QMetaObject.connectSlotsByName(songBookDialog)
self.retranslateUi(SongBookDialog) def retranslateUi(self, songBookDialog):
QtCore.QObject.connect(self.ButtonBox, songBookDialog.setWindowTitle(
QtCore.SIGNAL(u'accepted()'), SongBookDialog.accept)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'rejected()'), SongBookDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SongBookDialog)
def retranslateUi(self, SongBookDialog):
SongBookDialog.setWindowTitle(
translate('SongsPlugin.SongBookForm', 'Song Book Maintenance')) translate('SongsPlugin.SongBookForm', 'Song Book Maintenance'))
self.NameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:')) self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
self.PublisherLabel.setText( self.publisherLabel.setText(
translate('SongsPlugin.SongBookForm', '&Publisher:')) translate('SongsPlugin.SongBookForm', '&Publisher:'))

View File

@ -42,18 +42,18 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
def exec_(self, clear=True): def exec_(self, clear=True):
if clear: if clear:
self.NameEdit.clear() self.nameEdit.clear()
self.PublisherEdit.clear() self.publisherEdit.clear()
self.NameEdit.setFocus() self.nameEdit.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def accept(self): def accept(self):
if not self.NameEdit.text(): if not self.nameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.SongBookForm', 'Error'), self, translate('SongsPlugin.SongBookForm', 'Error'),
translate('SongsPlugin.SongBookForm', translate('SongsPlugin.SongBookForm',
'You need to type in a name for the book.')) 'You need to type in a name for the book.'))
self.NameEdit.setFocus() self.nameEdit.setFocus()
return False return False
else: else:
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)

View File

@ -29,211 +29,145 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
class Ui_SongMaintenanceDialog(object): class Ui_SongMaintenanceDialog(object):
def setupUi(self, SongMaintenanceDialog): def setupUi(self, songMaintenanceDialog):
SongMaintenanceDialog.setObjectName(u'SongMaintenanceDialog') songMaintenanceDialog.setObjectName(u'songMaintenanceDialog')
SongMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal) songMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
SongMaintenanceDialog.resize(582, 361) songMaintenanceDialog.resize(10, 350)
self.DialogLayout = QtGui.QVBoxLayout(SongMaintenanceDialog) self.dialogLayout = QtGui.QGridLayout(songMaintenanceDialog)
self.DialogLayout.setSpacing(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.DialogLayout.setMargin(8) self.typeListWidget = QtGui.QListWidget(songMaintenanceDialog)
self.DialogLayout.setObjectName(u'DialogLayout') # Caution: fixed widget width
self.ContentWidget = QtGui.QWidget(SongMaintenanceDialog) self.typeListWidget.setFixedWidth(172)
self.ContentWidget.setObjectName(u'ContentWidget') self.typeListWidget.setIconSize(QtCore.QSize(32, 32))
self.ContentLayout = QtGui.QHBoxLayout(self.ContentWidget) self.typeListWidget.setUniformItemSizes(True)
self.ContentLayout.setSpacing(8) self.typeListWidget.setObjectName(u'typeListWidget')
self.ContentLayout.setMargin(0) self.listItemAuthors = QtGui.QListWidgetItem(self.typeListWidget)
self.ContentLayout.setObjectName(u'ContentLayout') self.listItemAuthors.setIcon(
self.TypeListWidget = QtGui.QListWidget(self.ContentWidget) build_icon(u':/songs/author_maintenance.png'))
sizePolicy = QtGui.QSizePolicy( self.listItemTopics = QtGui.QListWidgetItem(self.typeListWidget)
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) self.listItemTopics.setIcon(
sizePolicy.setHorizontalStretch(0) build_icon(u':/songs/topic_maintenance.png'))
sizePolicy.setVerticalStretch(0) self.listItemBooks = QtGui.QListWidgetItem(self.typeListWidget)
sizePolicy.setHeightForWidth( self.listItemBooks.setIcon(
self.TypeListWidget.sizePolicy().hasHeightForWidth()) build_icon(u':/songs/book_maintenance.png'))
self.TypeListWidget.setSizePolicy(sizePolicy) self.dialogLayout.addWidget(self.typeListWidget, 0, 0)
self.TypeListWidget.setViewMode(QtGui.QListView.ListMode) self.stackedLayout = QtGui.QStackedLayout()
self.TypeListWidget.setIconSize(QtCore.QSize(32, 32)) self.stackedLayout.setObjectName(u'stackedLayout')
self.TypeListWidget.setMovement(QtGui.QListView.Static) # authors page
self.TypeListWidget.setMaximumWidth(172) self.authorsPage = QtGui.QWidget(songMaintenanceDialog)
self.TypeListWidget.setSpacing(0) self.authorsPage.setObjectName(u'authorsPage')
self.TypeListWidget.setSortingEnabled(False) self.authorsLayout = QtGui.QVBoxLayout(self.authorsPage)
self.TypeListWidget.setUniformItemSizes(True) self.authorsLayout.setObjectName(u'authorsLayout')
self.TypeListWidget.setObjectName(u'TypeListWidget') self.authorsListWidget = QtGui.QListWidget(self.authorsPage)
icon = build_icon(u':/songs/author_maintenance.png') self.authorsListWidget.setObjectName(u'authorsListWidget')
item = QtGui.QListWidgetItem(self.TypeListWidget) self.authorsLayout.addWidget(self.authorsListWidget)
item.setIcon(icon) self.authorsButtonsLayout = QtGui.QHBoxLayout()
icon1 = build_icon(u':/songs/topic_maintenance.png') self.authorsButtonsLayout.setObjectName(u'authorsButtonsLayout')
item = QtGui.QListWidgetItem(self.TypeListWidget) self.authorsButtonsLayout.addStretch()
item.setIcon(icon1) self.authorsAddButton = QtGui.QPushButton(self.authorsPage)
icon2 = build_icon(u':/songs/book_maintenance.png') self.authorsAddButton.setIcon(build_icon(u':/songs/author_add.png'))
item = QtGui.QListWidgetItem(self.TypeListWidget) self.authorsAddButton.setObjectName(u'authorsAddButton')
item.setIcon(icon2) self.authorsButtonsLayout.addWidget(self.authorsAddButton)
self.ContentLayout.addWidget(self.TypeListWidget) self.authorsEditButton = QtGui.QPushButton(self.authorsPage)
self.TypeStackedWidget = QtGui.QStackedWidget(self.ContentWidget) self.authorsEditButton.setIcon(build_icon(u':/songs/author_edit.png'))
self.TypeStackedWidget.setObjectName(u'TypeStackedWidget') self.authorsEditButton.setObjectName(u'authorsEditButton')
self.AuthorsPage = QtGui.QWidget() self.authorsButtonsLayout.addWidget(self.authorsEditButton)
self.AuthorsPage.setObjectName(u'AuthorsPage') self.authorsDeleteButton = QtGui.QPushButton(self.authorsPage)
self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsPage) self.authorsDeleteButton.setIcon(
self.AuthorsLayout.setSpacing(4) build_icon(u':/songs/author_delete.png'))
self.AuthorsLayout.setMargin(0) self.authorsDeleteButton.setObjectName(u'authorsDeleteButton')
self.AuthorsLayout.setObjectName(u'AuthorsLayout') self.authorsButtonsLayout.addWidget(self.authorsDeleteButton)
self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage) self.authorsLayout.addLayout(self.authorsButtonsLayout)
self.AuthorsListWidget.setObjectName(u'AuthorsListWidget') self.stackedLayout.addWidget(self.authorsPage)
self.AuthorsLayout.addWidget(self.AuthorsListWidget) # topics page
self.AuthorButtonWidget = QtGui.QWidget(self.AuthorsPage) self.topicsPage = QtGui.QWidget(songMaintenanceDialog)
self.AuthorButtonWidget.setObjectName(u'AuthorButtonWidget') self.topicsPage.setObjectName(u'topicsPage')
self.AuthorButtonsLayout = QtGui.QHBoxLayout(self.AuthorButtonWidget) self.topicsLayout = QtGui.QVBoxLayout(self.topicsPage)
self.AuthorButtonsLayout.setSpacing(8) self.topicsLayout.setObjectName(u'topicsLayout')
self.AuthorButtonsLayout.setMargin(0) self.topicsListWidget = QtGui.QListWidget(self.topicsPage)
self.AuthorButtonsLayout.setObjectName(u'AuthorButtonsLayout') self.topicsListWidget.setObjectName(u'topicsListWidget')
spacerItem = QtGui.QSpacerItem(40, 20, self.topicsLayout.addWidget(self.topicsListWidget)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.topicsButtonsLayout = QtGui.QHBoxLayout()
self.AuthorButtonsLayout.addItem(spacerItem) self.topicsButtonsLayout.setObjectName(u'topicsButtonLayout')
self.AuthorAddButton = QtGui.QPushButton(self.AuthorButtonWidget) self.topicsButtonsLayout.addStretch()
icon3 = build_icon(u':/songs/author_add.png') self.topicsAddButton = QtGui.QPushButton(self.topicsPage)
self.AuthorAddButton.setIcon(icon3) self.topicsAddButton.setIcon(build_icon(u':/songs/topic_add.png'))
self.AuthorAddButton.setObjectName(u'AuthorAddButton') self.topicsAddButton.setObjectName(u'topicsAddButton')
self.AuthorButtonsLayout.addWidget(self.AuthorAddButton) self.topicsButtonsLayout.addWidget(self.topicsAddButton)
self.AuthorEditButton = QtGui.QPushButton(self.AuthorButtonWidget) self.topicsEditButton = QtGui.QPushButton(self.topicsPage)
icon4 = build_icon(u':/songs/author_edit.png') self.topicsEditButton.setIcon(build_icon(u':/songs/topic_edit.png'))
self.AuthorEditButton.setIcon(icon4) self.topicsEditButton.setObjectName(u'topicsEditButton')
self.AuthorEditButton.setObjectName(u'AuthorEditButton') self.topicsButtonsLayout.addWidget(self.topicsEditButton)
self.AuthorButtonsLayout.addWidget(self.AuthorEditButton) self.topicsDeleteButton = QtGui.QPushButton(self.topicsPage)
self.AuthorDeleteButton = QtGui.QPushButton(self.AuthorButtonWidget) self.topicsDeleteButton.setIcon(build_icon(u':/songs/topic_delete.png'))
icon5 = build_icon(u':/songs/author_delete.png') self.topicsDeleteButton.setObjectName(u'topicsDeleteButton')
self.AuthorDeleteButton.setIcon(icon5) self.topicsButtonsLayout.addWidget(self.topicsDeleteButton)
self.AuthorDeleteButton.setObjectName(u'AuthorDeleteButton') self.topicsLayout.addLayout(self.topicsButtonsLayout)
self.AuthorButtonsLayout.addWidget(self.AuthorDeleteButton) self.stackedLayout.addWidget(self.topicsPage)
self.AuthorsLayout.addWidget(self.AuthorButtonWidget) # song books page
self.AuthorsLine = QtGui.QFrame(self.AuthorsPage) self.booksPage = QtGui.QWidget(songMaintenanceDialog)
self.AuthorsLine.setFrameShape(QtGui.QFrame.HLine) self.booksPage.setObjectName(u'booksPage')
self.AuthorsLine.setFrameShadow(QtGui.QFrame.Sunken) self.booksLayout = QtGui.QVBoxLayout(self.booksPage)
self.AuthorsLine.setObjectName(u'AuthorsLine') self.booksLayout.setObjectName(u'booksLayout')
self.AuthorsLayout.addWidget(self.AuthorsLine) self.booksListWidget = QtGui.QListWidget(self.booksPage)
self.TypeStackedWidget.addWidget(self.AuthorsPage) self.booksListWidget.setObjectName(u'booksListWidget')
self.TopicsPage = QtGui.QWidget() self.booksLayout.addWidget(self.booksListWidget)
self.TopicsPage.setObjectName(u'TopicsPage') self.booksButtonsLayout = QtGui.QHBoxLayout()
self.TopicLayout = QtGui.QVBoxLayout(self.TopicsPage) self.booksButtonsLayout.setObjectName(u'booksButtonLayout')
self.TopicLayout.setSpacing(4) self.booksButtonsLayout.addStretch()
self.TopicLayout.setMargin(0) self.booksAddButton = QtGui.QPushButton(self.booksPage)
self.TopicLayout.setObjectName(u'TopicLayout') self.booksAddButton.setIcon(build_icon(u':/songs/book_add.png'))
self.TopicsListWidget = QtGui.QListWidget(self.TopicsPage) self.booksAddButton.setObjectName(u'booksAddButton')
self.TopicsListWidget.setObjectName(u'TopicsListWidget') self.booksButtonsLayout.addWidget(self.booksAddButton)
self.TopicLayout.addWidget(self.TopicsListWidget) self.booksEditButton = QtGui.QPushButton(self.booksPage)
self.TopicButtonWidget = QtGui.QWidget(self.TopicsPage) self.booksEditButton.setIcon(build_icon(u':/songs/book_edit.png'))
self.TopicButtonWidget.setObjectName(u'TopicButtonWidget') self.booksEditButton.setObjectName(u'booksEditButton')
self.TopicButtonLayout = QtGui.QHBoxLayout(self.TopicButtonWidget) self.booksButtonsLayout.addWidget(self.booksEditButton)
self.TopicButtonLayout.setSpacing(8) self.booksDeleteButton = QtGui.QPushButton(self.booksPage)
self.TopicButtonLayout.setMargin(0) self.booksDeleteButton.setIcon(build_icon(u':/songs/book_delete.png'))
self.TopicButtonLayout.setObjectName(u'TopicButtonLayout') self.booksDeleteButton.setObjectName(u'booksDeleteButton')
TopicSpacerItem = QtGui.QSpacerItem(54, 20, self.booksButtonsLayout.addWidget(self.booksDeleteButton)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.booksLayout.addLayout(self.booksButtonsLayout)
self.TopicButtonLayout.addItem(TopicSpacerItem) self.stackedLayout.addWidget(self.booksPage)
self.TopicAddButton = QtGui.QPushButton(self.TopicButtonWidget) #
icon6 = build_icon(u':/songs/topic_add.png') self.dialogLayout.addLayout(self.stackedLayout, 0, 1)
self.TopicAddButton.setIcon(icon6) self.buttonBox = QtGui.QDialogButtonBox(songMaintenanceDialog)
self.TopicAddButton.setObjectName(u'TopicAddButton') self.buttonBox.addButton(QtGui.QDialogButtonBox.Close)
self.TopicButtonLayout.addWidget(self.TopicAddButton) self.buttonBox.setObjectName(u'buttonBox')
self.TopicEditButton = QtGui.QPushButton(self.TopicButtonWidget) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
icon7 = build_icon(u':/songs/topic_edit.png') self.retranslateUi(songMaintenanceDialog)
self.TopicEditButton.setIcon(icon7) self.stackedLayout.setCurrentIndex(0)
self.TopicEditButton.setObjectName(u'TopicEditButton') QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
self.TopicButtonLayout.addWidget(self.TopicEditButton) songMaintenanceDialog.accept)
self.TopicDeleteButton = QtGui.QPushButton(self.TopicButtonWidget) QtCore.QObject.connect(self.typeListWidget,
icon8 = build_icon(u':/songs/topic_delete.png')
self.TopicDeleteButton.setIcon(icon8)
self.TopicDeleteButton.setObjectName(u'TopicDeleteButton')
self.TopicButtonLayout.addWidget(self.TopicDeleteButton)
self.TopicLayout.addWidget(self.TopicButtonWidget)
self.TopicsLine = QtGui.QFrame(self.TopicsPage)
self.TopicsLine.setFrameShape(QtGui.QFrame.HLine)
self.TopicsLine.setFrameShadow(QtGui.QFrame.Sunken)
self.TopicsLine.setObjectName(u'TopicsLine')
self.TopicLayout.addWidget(self.TopicsLine)
self.TypeStackedWidget.addWidget(self.TopicsPage)
self.BooksPage = QtGui.QWidget()
self.BooksPage.setObjectName(u'BooksPage')
self.BookLayout = QtGui.QVBoxLayout(self.BooksPage)
self.BookLayout.setSpacing(4)
self.BookLayout.setMargin(0)
self.BookLayout.setObjectName(u'BookLayout')
self.BooksListWidget = QtGui.QListWidget(self.BooksPage)
self.BooksListWidget.setObjectName(u'BooksListWidget')
self.BookLayout.addWidget(self.BooksListWidget)
self.BookButtonWidget = QtGui.QWidget(self.BooksPage)
self.BookButtonWidget.setObjectName(u'BookButtonWidget')
self.BookButtonLayout = QtGui.QHBoxLayout(self.BookButtonWidget)
self.BookButtonLayout.setSpacing(8)
self.BookButtonLayout.setMargin(0)
self.BookButtonLayout.setObjectName(u'BookButtonLayout')
spacerItem2 = QtGui.QSpacerItem(54, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.BookButtonLayout.addItem(spacerItem2)
self.BookAddButton = QtGui.QPushButton(self.BookButtonWidget)
icon9 = build_icon(u':/songs/book_add.png')
self.BookAddButton.setIcon(icon9)
self.BookAddButton.setObjectName(u'BookAddButton')
self.BookButtonLayout.addWidget(self.BookAddButton)
self.BookEditButton = QtGui.QPushButton(self.BookButtonWidget)
icon10 = build_icon(u':/songs/book_edit.png')
self.BookEditButton.setIcon(icon10)
self.BookEditButton.setObjectName(u'BookEditButton')
self.BookButtonLayout.addWidget(self.BookEditButton)
self.BookDeleteButton = QtGui.QPushButton(self.BookButtonWidget)
icon11 = build_icon(u':/songs/book_delete.png')
self.BookDeleteButton.setIcon(icon11)
self.BookDeleteButton.setObjectName(u'BookDeleteButton')
self.BookButtonLayout.addWidget(self.BookDeleteButton)
self.BookLayout.addWidget(self.BookButtonWidget)
self.BooksLine = QtGui.QFrame(self.BooksPage)
self.BooksLine.setFrameShape(QtGui.QFrame.HLine)
self.BooksLine.setFrameShadow(QtGui.QFrame.Sunken)
self.BooksLine.setObjectName(u'BooksLine')
self.BookLayout.addWidget(self.BooksLine)
self.TypeStackedWidget.addWidget(self.BooksPage)
self.ContentLayout.addWidget(self.TypeStackedWidget)
self.DialogLayout.addWidget(self.ContentWidget)
self.MaintenanceButtonBox = QtGui.QDialogButtonBox(
SongMaintenanceDialog)
self.MaintenanceButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.MaintenanceButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Close)
self.MaintenanceButtonBox.setObjectName(u'MaintenanceButtonBox')
self.DialogLayout.addWidget(self.MaintenanceButtonBox)
self.retranslateUi(SongMaintenanceDialog)
self.TypeStackedWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.MaintenanceButtonBox,
QtCore.SIGNAL(u'rejected()'), SongMaintenanceDialog.accept)
QtCore.QObject.connect(self.TypeListWidget,
QtCore.SIGNAL(u'currentRowChanged(int)'), QtCore.SIGNAL(u'currentRowChanged(int)'),
self.TypeStackedWidget.setCurrentIndex) self.stackedLayout.setCurrentIndex)
QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog) QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog)
def retranslateUi(self, SongMaintenanceDialog): def retranslateUi(self, songMaintenanceDialog):
SongMaintenanceDialog.setWindowTitle( songMaintenanceDialog.setWindowTitle(
translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance')) translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance'))
self.TypeListWidget.item(0).setText( self.listItemAuthors.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Authors')) translate('SongsPlugin.SongMaintenanceForm', 'Authors'))
self.TypeListWidget.item(1).setText( self.listItemTopics.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Topics')) translate('SongsPlugin.SongMaintenanceForm', 'Topics'))
self.TypeListWidget.item(2).setText( self.listItemBooks.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Song Books')) translate('SongsPlugin.SongMaintenanceForm', 'Song Books'))
self.AuthorAddButton.setText( self.authorsAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add')) translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.AuthorEditButton.setText( self.authorsEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit')) translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.AuthorDeleteButton.setText( self.authorsDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete')) translate('SongsPlugin.SongMaintenanceForm', '&Delete'))
self.TopicAddButton.setText( self.topicsAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add')) translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.TopicEditButton.setText( self.topicsEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit')) translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.TopicDeleteButton.setText( self.topicsDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete')) translate('SongsPlugin.SongMaintenanceForm', '&Delete'))
self.BookAddButton.setText( self.booksAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add')) translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.BookEditButton.setText( self.booksEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit')) translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.BookDeleteButton.setText( self.booksDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete')) translate('SongsPlugin.SongMaintenanceForm', '&Delete'))

View File

@ -46,31 +46,31 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform = AuthorsForm(self) self.authorform = AuthorsForm(self)
self.topicform = TopicsForm(self) self.topicform = TopicsForm(self)
self.bookform = SongBookForm(self) self.bookform = SongBookForm(self)
QtCore.QObject.connect(self.AuthorAddButton, QtCore.QObject.connect(self.authorsAddButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick) QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick)
QtCore.QObject.connect(self.TopicAddButton, QtCore.QObject.connect(self.topicsAddButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick) QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick)
QtCore.QObject.connect(self.BookAddButton, QtCore.QObject.connect(self.booksAddButton,
QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick) QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick)
QtCore.QObject.connect(self.AuthorEditButton, QtCore.QObject.connect(self.authorsEditButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick) QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick)
QtCore.QObject.connect(self.TopicEditButton, QtCore.QObject.connect(self.topicsEditButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick) QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick)
QtCore.QObject.connect(self.BookEditButton, QtCore.QObject.connect(self.booksEditButton,
QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick) QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick)
QtCore.QObject.connect(self.AuthorDeleteButton, QtCore.QObject.connect(self.authorsDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick) QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick)
QtCore.QObject.connect(self.TopicDeleteButton, QtCore.QObject.connect(self.topicsDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick) QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick)
QtCore.QObject.connect(self.BookDeleteButton, QtCore.QObject.connect(self.booksDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick) QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick)
def exec_(self): def exec_(self):
self.TypeListWidget.setCurrentRow(0) self.typeListWidget.setCurrentRow(0)
self.resetAuthors() self.resetAuthors()
self.resetTopics() self.resetTopics()
self.resetBooks() self.resetBooks()
self.TypeListWidget.setFocus() self.typeListWidget.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def _getCurrentItemId(self, ListWidget): def _getCurrentItemId(self, ListWidget):
@ -101,7 +101,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
Reloads the Authors list. Reloads the Authors list.
""" """
self.AuthorsListWidget.clear() self.authorsListWidget.clear()
authors = self.manager.get_all_objects(Author, authors = self.manager.get_all_objects(Author,
order_by_ref=Author.display_name) order_by_ref=Author.display_name)
for author in authors: for author in authors:
@ -109,50 +109,50 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
author_name = QtGui.QListWidgetItem(author.display_name) author_name = QtGui.QListWidgetItem(author.display_name)
else: else:
author_name = QtGui.QListWidgetItem( author_name = QtGui.QListWidgetItem(
u' '.join(author.first_name, author.last_name)) u' '.join([author.first_name, author.last_name]))
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
self.AuthorsListWidget.addItem(author_name) self.authorsListWidget.addItem(author_name)
if self.AuthorsListWidget.count() == 0: if self.authorsListWidget.count() == 0:
self.AuthorDeleteButton.setEnabled(False) self.authorsDeleteButton.setEnabled(False)
self.AuthorEditButton.setEnabled(False) self.authorsEditButton.setEnabled(False)
else: else:
self.AuthorDeleteButton.setEnabled(True) self.authorsDeleteButton.setEnabled(True)
self.AuthorEditButton.setEnabled(True) self.authorsEditButton.setEnabled(True)
def resetTopics(self): def resetTopics(self):
""" """
Reloads the Topics list. Reloads the Topics list.
""" """
self.TopicsListWidget.clear() self.topicsListWidget.clear()
topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name) topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
for topic in topics: for topic in topics:
topic_name = QtGui.QListWidgetItem(topic.name) topic_name = QtGui.QListWidgetItem(topic.name)
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id)) topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
self.TopicsListWidget.addItem(topic_name) self.topicsListWidget.addItem(topic_name)
if self.TopicsListWidget.count() == 0: if self.topicsListWidget.count() == 0:
self.TopicDeleteButton.setEnabled(False) self.topicsDeleteButton.setEnabled(False)
self.TopicEditButton.setEnabled(False) self.topicsEditButton.setEnabled(False)
else: else:
self.TopicDeleteButton.setEnabled(True) self.topicsDeleteButton.setEnabled(True)
self.TopicEditButton.setEnabled(True) self.topicsEditButton.setEnabled(True)
def resetBooks(self): def resetBooks(self):
""" """
Reloads the Books list. Reloads the Books list.
""" """
self.BooksListWidget.clear() self.booksListWidget.clear()
books = self.manager.get_all_objects(Book, order_by_ref=Book.name) books = self.manager.get_all_objects(Book, order_by_ref=Book.name)
for book in books: for book in books:
book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name, book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name,
book.publisher)) book.publisher))
book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id)) book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
self.BooksListWidget.addItem(book_name) self.booksListWidget.addItem(book_name)
if self.BooksListWidget.count() == 0: if self.booksListWidget.count() == 0:
self.BookDeleteButton.setEnabled(False) self.booksDeleteButton.setEnabled(False)
self.BookEditButton.setEnabled(False) self.booksEditButton.setEnabled(False)
else: else:
self.BookDeleteButton.setEnabled(True) self.booksDeleteButton.setEnabled(True)
self.BookEditButton.setEnabled(True) self.booksEditButton.setEnabled(True)
def checkAuthor(self, new_author, edit=False): def checkAuthor(self, new_author, edit=False):
""" """
@ -222,9 +222,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.setAutoDisplayName(True) self.authorform.setAutoDisplayName(True)
if self.authorform.exec_(): if self.authorform.exec_():
author = Author.populate( author = Author.populate(
first_name=unicode(self.authorform.FirstNameEdit.text()), first_name=unicode(self.authorform.firstNameEdit.text()),
last_name=unicode(self.authorform.LastNameEdit.text()), last_name=unicode(self.authorform.lastNameEdit.text()),
display_name=unicode(self.authorform.DisplayEdit.text())) display_name=unicode(self.authorform.displayEdit.text()))
if self.checkAuthor(author): if self.checkAuthor(author):
if self.manager.save_object(author): if self.manager.save_object(author):
self.resetAuthors() self.resetAuthors()
@ -241,7 +241,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onTopicAddButtonClick(self): def onTopicAddButtonClick(self):
if self.topicform.exec_(): if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text())) topic = Topic.populate(name=unicode(self.topicform.nameEdit.text()))
if self.checkTopic(topic): if self.checkTopic(topic):
if self.manager.save_object(topic): if self.manager.save_object(topic):
self.resetTopics() self.resetTopics()
@ -258,8 +258,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onBookAddButtonClick(self): def onBookAddButtonClick(self):
if self.bookform.exec_(): if self.bookform.exec_():
book = Book.populate(name=unicode(self.bookform.NameEdit.text()), book = Book.populate(name=unicode(self.bookform.nameEdit.text()),
publisher=unicode(self.bookform.PublisherEdit.text())) publisher=unicode(self.bookform.publisherEdit.text()))
if self.checkBook(book): if self.checkBook(book):
if self.manager.save_object(book): if self.manager.save_object(book):
self.resetBooks() self.resetBooks()
@ -275,13 +275,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'This book already exists.')) 'This book already exists.'))
def onAuthorEditButtonClick(self): def onAuthorEditButtonClick(self):
author_id = self._getCurrentItemId(self.AuthorsListWidget) author_id = self._getCurrentItemId(self.authorsListWidget)
if author_id != -1: if author_id != -1:
author = self.manager.get_object(Author, author_id) author = self.manager.get_object(Author, author_id)
self.authorform.setAutoDisplayName(False) self.authorform.setAutoDisplayName(False)
self.authorform.FirstNameEdit.setText(author.first_name) self.authorform.firstNameEdit.setText(author.first_name)
self.authorform.LastNameEdit.setText(author.last_name) self.authorform.lastNameEdit.setText(author.last_name)
self.authorform.DisplayEdit.setText(author.display_name) self.authorform.displayEdit.setText(author.display_name)
# Save the author's first and last name as well as the display name # Save the author's first and last name as well as the display name
# for the case that they have to be restored. # for the case that they have to be restored.
temp_first_name = author.first_name temp_first_name = author.first_name
@ -289,10 +289,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
temp_display_name = author.display_name temp_display_name = author.display_name
if self.authorform.exec_(False): if self.authorform.exec_(False):
author.first_name = unicode( author.first_name = unicode(
self.authorform.FirstNameEdit.text()) self.authorform.firstNameEdit.text())
author.last_name = unicode(self.authorform.LastNameEdit.text()) author.last_name = unicode(self.authorform.lastNameEdit.text())
author.display_name = unicode( author.display_name = unicode(
self.authorform.DisplayEdit.text()) self.authorform.displayEdit.text())
if self.checkAuthor(author, True): if self.checkAuthor(author, True):
if self.manager.save_object(author): if self.manager.save_object(author):
self.resetAuthors() self.resetAuthors()
@ -328,14 +328,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'author already exists.')) 'author already exists.'))
def onTopicEditButtonClick(self): def onTopicEditButtonClick(self):
topic_id = self._getCurrentItemId(self.TopicsListWidget) topic_id = self._getCurrentItemId(self.topicsListWidget)
if topic_id != -1: if topic_id != -1:
topic = self.manager.get_object(Topic, topic_id) topic = self.manager.get_object(Topic, topic_id)
self.topicform.NameEdit.setText(topic.name) self.topicform.nameEdit.setText(topic.name)
# Save the topic's name for the case that he has to be restored. # Save the topic's name for the case that he has to be restored.
temp_name = topic.name temp_name = topic.name
if self.topicform.exec_(False): if self.topicform.exec_(False):
topic.name = unicode(self.topicform.NameEdit.text()) topic.name = unicode(self.topicform.nameEdit.text())
if self.checkTopic(topic, True): if self.checkTopic(topic, True):
if self.manager.save_object(topic): if self.manager.save_object(topic):
self.resetTopics() self.resetTopics()
@ -365,20 +365,20 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'already exists.')) 'already exists.'))
def onBookEditButtonClick(self): def onBookEditButtonClick(self):
book_id = self._getCurrentItemId(self.BooksListWidget) book_id = self._getCurrentItemId(self.booksListWidget)
if book_id != -1: if book_id != -1:
book = self.manager.get_object(Book, book_id) book = self.manager.get_object(Book, book_id)
if book.publisher is None: if book.publisher is None:
book.publisher = u'' book.publisher = u''
self.bookform.NameEdit.setText(book.name) self.bookform.nameEdit.setText(book.name)
self.bookform.PublisherEdit.setText(book.publisher) self.bookform.publisherEdit.setText(book.publisher)
# Save the book's name and publisher for the case that they have to # Save the book's name and publisher for the case that they have to
# be restored. # be restored.
temp_name = book.name temp_name = book.name
temp_publisher = book.publisher temp_publisher = book.publisher
if self.bookform.exec_(False): if self.bookform.exec_(False):
book.name = unicode(self.bookform.NameEdit.text()) book.name = unicode(self.bookform.nameEdit.text())
book.publisher = unicode(self.bookform.PublisherEdit.text()) book.publisher = unicode(self.bookform.publisherEdit.text())
if self.checkBook(book, True): if self.checkBook(book, True):
if self.manager.save_object(book): if self.manager.save_object(book):
self.resetBooks() self.resetBooks()
@ -466,7 +466,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
Delete the author if the author is not attached to any songs. Delete the author if the author is not attached to any songs.
""" """
self._deleteItem(Author, self.AuthorsListWidget, self.resetAuthors, self._deleteItem(Author, self.authorsListWidget, self.resetAuthors,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected author?'), 'Are you sure you want to delete the selected author?'),
@ -479,7 +479,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
Delete the Book is the Book is not attached to any songs. Delete the Book is the Book is not attached to any songs.
""" """
self._deleteItem(Topic, self.TopicsListWidget, self.resetTopics, self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected topic?'), 'Are you sure you want to delete the selected topic?'),
@ -492,7 +492,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
Delete the Book is the Book is not attached to any songs. Delete the Book is the Book is not attached to any songs.
""" """
self._deleteItem(Book, self.BooksListWidget, self.resetBooks, self._deleteItem(Book, self.booksListWidget, self.resetBooks,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected book?'), 'Are you sure you want to delete the selected book?'),

View File

@ -29,40 +29,35 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_TopicsDialog(object): class Ui_TopicsDialog(object):
def setupUi(self, TopicsDialog): def setupUi(self, topicsDialog):
TopicsDialog.setObjectName(u'TopicsDialog') topicsDialog.setObjectName(u'topicsDialog')
TopicsDialog.resize(365, 77) topicsDialog.resize(300, 10)
self.TopicLayout = QtGui.QFormLayout(TopicsDialog) self.dialogLayout = QtGui.QVBoxLayout(topicsDialog)
self.TopicLayout.setFieldGrowthPolicy( self.dialogLayout.setObjectName(u'dialogLayout')
QtGui.QFormLayout.ExpandingFieldsGrow) self.nameLayout = QtGui.QFormLayout()
self.TopicLayout.setMargin(8) self.nameLayout.setObjectName(u'nameLayout')
self.TopicLayout.setSpacing(8) self.nameLabel = QtGui.QLabel(topicsDialog)
self.TopicLayout.setObjectName(u'TopicLayout') self.nameLabel.setObjectName(u'nameLabel')
self.NameLabel = QtGui.QLabel(TopicsDialog) self.nameEdit = QtGui.QLineEdit(topicsDialog)
self.NameLabel.setObjectName(u'NameLabel') self.nameEdit.setObjectName(u'nameEdit')
self.TopicLayout.setWidget(0, self.nameLabel.setBuddy(self.nameEdit)
QtGui.QFormLayout.LabelRole, self.NameLabel) self.nameLayout.addRow(self.nameLabel, self.nameEdit)
self.NameEdit = QtGui.QLineEdit(TopicsDialog) self.dialogLayout.addLayout(self.nameLayout)
self.NameEdit.setObjectName(u'NameEdit') self.buttonBox = QtGui.QDialogButtonBox(topicsDialog)
self.TopicLayout.setWidget(0, self.buttonBox.setStandardButtons(
QtGui.QFormLayout.FieldRole, self.NameEdit)
self.TopicButtonBox = QtGui.QDialogButtonBox(TopicsDialog)
self.TopicButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.TopicButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.TopicButtonBox.setObjectName(u'TopicButtonBox') self.buttonBox.setObjectName(u'buttonBox')
self.TopicLayout.setWidget(1, self.dialogLayout.addWidget(self.buttonBox)
QtGui.QFormLayout.FieldRole, self.TopicButtonBox) self.retranslateUi(topicsDialog)
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), topicsDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), topicsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(topicsDialog)
self.retranslateUi(TopicsDialog) def retranslateUi(self, topicsDialog):
QtCore.QObject.connect(self.TopicButtonBox, topicsDialog.setWindowTitle(
QtCore.SIGNAL(u'accepted()'), TopicsDialog.accept)
QtCore.QObject.connect(self.TopicButtonBox,
QtCore.SIGNAL(u'rejected()'), TopicsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(TopicsDialog)
def retranslateUi(self, TopicsDialog):
TopicsDialog.setWindowTitle(
translate('SongsPlugin.TopicsForm', 'Topic Maintenance')) translate('SongsPlugin.TopicsForm', 'Topic Maintenance'))
self.NameLabel.setText( self.nameLabel.setText(
translate('SongsPlugin.TopicsForm', 'Topic name:')) translate('SongsPlugin.TopicsForm', 'Topic name:'))

View File

@ -42,17 +42,17 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
def exec_(self, clear=True): def exec_(self, clear=True):
if clear: if clear:
self.NameEdit.clear() self.nameEdit.clear()
self.NameEdit.setFocus() self.nameEdit.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def accept(self): def accept(self):
if not self.NameEdit.text(): if not self.nameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.TopicsForm', 'Error'), self, translate('SongsPlugin.TopicsForm', 'Error'),
translate('SongsPlugin.TopicsForm', translate('SongsPlugin.TopicsForm',
'You need to type in a topic name.')) 'You need to type in a topic name.'))
self.NameEdit.setFocus() self.nameEdit.setFocus()
return False return False
else: else:
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)

View File

@ -24,6 +24,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from PyQt4 import QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class VerseType(object): class VerseType(object):
@ -123,7 +124,58 @@ class VerseType(object):
unicode(VerseType.to_string(VerseType.Other)).lower(): unicode(VerseType.to_string(VerseType.Other)).lower():
return VerseType.Other return VerseType.Other
def retrieve_windows_encoding(recommendation=None):
# map chardet result to compatible windows standard code page
codepage_mapping = {'IBM866': u'cp866', 'TIS-620': u'cp874',
'SHIFT_JIS': u'cp932', 'GB2312': u'cp936', 'HZ-GB-2312': u'cp936',
'EUC-KR': u'cp949', 'Big5': u'cp950', 'ISO-8859-2': u'cp1250',
'windows-1250': u'cp1250', 'windows-1251': u'cp1251',
'windows-1252': u'cp1252', 'ISO-8859-7': u'cp1253',
'windows-1253': u'cp1253', 'ISO-8859-8': u'cp1255',
'windows-1255': u'cp1255'}
if recommendation in codepage_mapping:
recommendation = codepage_mapping[recommendation]
# Show dialog for encoding selection
encodings = [(u'cp1256', translate('SongsPlugin', 'Arabic (CP-1256)')),
(u'cp1257', translate('SongsPlugin', 'Baltic (CP-1257)')),
(u'cp1250', translate('SongsPlugin', 'Central European (CP-1250)')),
(u'cp1251', translate('SongsPlugin', 'Cyrillic (CP-1251)')),
(u'cp1253', translate('SongsPlugin', 'Greek (CP-1253)')),
(u'cp1255', translate('SongsPlugin', 'Hebrew (CP-1255)')),
(u'cp932', translate('SongsPlugin', 'Japanese (CP-932)')),
(u'cp949', translate('SongsPlugin', 'Korean (CP-949)')),
(u'cp936', translate('SongsPlugin', 'Simplified Chinese (CP-936)')),
(u'cp874', translate('SongsPlugin', 'Thai (CP-874)')),
(u'cp950', translate('SongsPlugin', 'Traditional Chinese (CP-950)')),
(u'cp1254', translate('SongsPlugin', 'Turkish (CP-1254)')),
(u'cp1258', translate('SongsPlugin', 'Vietnam (CP-1258)')),
(u'cp1252', translate('SongsPlugin', 'Western European (CP-1252)'))]
recommended_index = -1
if recommendation:
for index in range(len(encodings)):
if recommendation == encodings[index][0]:
recommended_index = index
break
if recommended_index > 0:
choice = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin', 'Character Encoding'),
translate('SongsPlugin', 'The codepage setting is responsible\n'
'for the correct character representation.\n'
'Usually you are fine with the preselected choise.'),
[pair[1] for pair in encodings], recommended_index, False)
else:
choice = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin', 'Character Encoding'),
translate('SongsPlugin', 'Please choose the character encoding.\n'
'The encoding is responsible for the correct character '
'representation.'), [pair[1] for pair in encodings], 0, False)
if not choice[1]:
return None
return filter(lambda item: item[1] == choice[0], encodings)[0][0]
from xml import OpenLyricsBuilder, OpenLyricsParser, SongXMLBuilder, \ from xml import OpenLyricsBuilder, OpenLyricsParser, SongXMLBuilder, \
SongXMLParser SongXMLParser
from songstab import SongsTab from songstab import SongsTab
from mediaitem import SongMediaItem from mediaitem import SongMediaItem

View File

@ -32,6 +32,7 @@ import os
import struct import struct
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport from songimport import SongImport
def strip_rtf(blob, encoding): def strip_rtf(blob, encoding):
@ -163,22 +164,25 @@ class EasyWorshipSongImport(SongImport):
self.encoding = u'cp1250' self.encoding = u'cp1250'
# The following codepage to actual encoding mappings have not been # The following codepage to actual encoding mappings have not been
# observed, but merely guessed. Actual example files are needed. # observed, but merely guessed. Actual example files are needed.
#if code_page == 737: elif code_page == 737:
# self.encoding = u'cp1253' self.encoding = u'cp1253'
#if code_page == 775: elif code_page == 775:
# self.encoding = u'cp1257' self.encoding = u'cp1257'
#if code_page == 855: elif code_page == 855:
# self.encoding = u'cp1251' self.encoding = u'cp1251'
#if code_page == 857: elif code_page == 857:
# self.encoding = u'cp1254' self.encoding = u'cp1254'
#if code_page == 866: elif code_page == 866:
# self.encoding = u'cp1251' self.encoding = u'cp1251'
#if code_page == 869: elif code_page == 869:
# self.encoding = u'cp1253' self.encoding = u'cp1253'
#if code_page == 862: elif code_page == 862:
# self.encoding = u'cp1255' self.encoding = u'cp1255'
#if code_page == 874: elif code_page == 874:
# self.encoding = u'cp874' self.encoding = u'cp874'
self.encoding = retrieve_windows_encoding(self.encoding)
if not self.encoding:
return False
# There does not appear to be a _reliable_ way of getting the number # There does not appear to be a _reliable_ way of getting the number
# of songs/records, so let's use file blocks for measuring progress. # of songs/records, so let's use file blocks for measuring progress.
total_blocks = (db_size - header_size) / (block_size * 1024) total_blocks = (db_size - header_size) / (block_size * 1024)
@ -347,4 +351,4 @@ class EasyWorshipSongImport(SongImport):
return u'' return u''
return self.memo_file.read(blob_size) return self.memo_file.read(blob_size)
else: else:
return 0 return 0

View File

@ -76,46 +76,37 @@ class SongMediaItem(MediaManagerItem):
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.addToolbarSeparator() self.addToolbarSeparator()
## Song Maintenance Button ## ## Song Maintenance Button ##
self.addToolbarButton( self.maintenanceAction = self.addToolbarButton(u'', u'',
translate('SongsPlugin.MediaItem', 'Song Maintenance'),
translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books'),
':/songs/song_maintenance.png', self.onSongMaintenanceClick) ':/songs/song_maintenance.png', self.onSongMaintenanceClick)
self.pageLayout.setSpacing(4) self.searchWidget = QtGui.QWidget(self)
self.SearchLayout = QtGui.QFormLayout() self.searchWidget.setObjectName(u'searchWidget')
self.SearchLayout.setMargin(0) self.searchLayout = QtGui.QVBoxLayout(self.searchWidget)
self.SearchLayout.setSpacing(4) self.searchLayout.setObjectName(u'searchLayout')
self.SearchLayout.setObjectName(u'SearchLayout') self.searchTextLayout = QtGui.QFormLayout()
self.SearchTextLabel = QtGui.QLabel(self) self.searchTextLayout.setObjectName(u'searchTextLayout')
self.SearchTextLabel.setAlignment( self.searchTextLabel = QtGui.QLabel(self.searchWidget)
QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft) self.searchTextLabel.setObjectName(u'searchTextLabel')
self.SearchTextLabel.setObjectName(u'SearchTextLabel') self.searchTextEdit = SearchEdit(self.searchWidget)
self.SearchLayout.setWidget( self.searchTextEdit.setObjectName(u'searchTextEdit')
0, QtGui.QFormLayout.LabelRole, self.SearchTextLabel) self.searchTextLabel.setBuddy(self.searchTextEdit)
self.SearchTextEdit = SearchEdit(self) self.searchTextLayout.addRow(self.searchTextLabel, self.searchTextEdit)
self.SearchTextEdit.setObjectName(u'SearchTextEdit') self.searchLayout.addLayout(self.searchTextLayout)
self.SearchLayout.setWidget( self.searchButtonLayout = QtGui.QHBoxLayout()
0, QtGui.QFormLayout.FieldRole, self.SearchTextEdit) self.searchButtonLayout.setObjectName(u'searchButtonLayout')
self.pageLayout.addLayout(self.SearchLayout) self.searchButtonLayout.addStretch()
self.SearchButtonLayout = QtGui.QHBoxLayout() self.searchTextButton = QtGui.QPushButton(self.searchWidget)
self.SearchButtonLayout.setMargin(0) self.searchTextButton.setObjectName(u'searchTextButton')
self.SearchButtonLayout.setSpacing(4) self.searchButtonLayout.addWidget(self.searchTextButton)
self.SearchButtonLayout.setObjectName(u'SearchButtonLayout') self.searchLayout.addLayout(self.searchButtonLayout)
self.SearchButtonSpacer = QtGui.QSpacerItem(40, 20, self.pageLayout.addWidget(self.searchWidget)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.SearchButtonLayout.addItem(self.SearchButtonSpacer)
self.SearchTextButton = QtGui.QPushButton(self)
self.SearchTextButton.setObjectName(u'SearchTextButton')
self.SearchButtonLayout.addWidget(self.SearchTextButton)
self.pageLayout.addLayout(self.SearchButtonLayout)
# Signals and slots # Signals and slots
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'plugin_list_refresh'), self.onSearchTextButtonClick) QtCore.SIGNAL(u'plugin_list_refresh'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick) QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextButton, QtCore.QObject.connect(self.searchTextButton,
QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick) QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'), QtCore.SIGNAL(u'textChanged(const QString&)'),
self.onSearchTextEditChanged) self.onSearchTextEditChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -128,9 +119,9 @@ class SongMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'songs_edit'), self.onRemoteEdit) QtCore.SIGNAL(u'songs_edit'), self.onRemoteEdit)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'songs_edit_clear'), self.onRemoteEditClear) QtCore.SIGNAL(u'songs_edit_clear'), self.onRemoteEditClear)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'searchTypeChanged(int)'), QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClick) self.onSearchTextButtonClick)
@ -146,25 +137,32 @@ class SongMediaItem(MediaManagerItem):
QtCore.QVariant(u'True')).toBool() QtCore.QVariant(u'True')).toBool()
def retranslateUi(self): def retranslateUi(self):
self.SearchTextLabel.setText( self.searchTextLabel.setText(
translate('SongsPlugin.MediaItem', 'Search:')) translate('SongsPlugin.MediaItem', 'Search:'))
self.SearchTextButton.setText( self.searchTextButton.setText(
translate('SongsPlugin.MediaItem', 'Search')) translate('SongsPlugin.MediaItem', 'Search'))
self.maintenanceAction.setText(
translate('SongsPlugin.MediaItem', 'Song Maintenance'))
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books'))
def initialise(self): def initialise(self):
self.SearchTextEdit.setSearchTypes([ self.searchTextEdit.setSearchTypes([
(1, u':/songs/song_search_all.png', translate('SongsPlugin.MediaItem', 'Entire Song')), (1, u':/songs/song_search_all.png',
(2, u':/songs/song_search_title.png', translate('SongsPlugin.MediaItem', 'Titles')), translate('SongsPlugin.MediaItem', 'Entire Song')),
(3, u':/songs/song_search_lyrics.png', translate('SongsPlugin.MediaItem', 'Lyrics')), (2, u':/songs/song_search_title.png',
(4, u':/songs/song_search_author.png', translate('SongsPlugin.MediaItem', 'Authors')) translate('SongsPlugin.MediaItem', 'Titles')),
]) (3, u':/songs/song_search_lyrics.png',
translate('SongsPlugin.MediaItem', 'Lyrics')),
(4, u':/songs/song_search_author.png',
translate('SongsPlugin.MediaItem', 'Authors'))])
self.configUpdated() self.configUpdated()
def onSearchTextButtonClick(self): def onSearchTextButtonClick(self):
search_keywords = unicode(self.SearchTextEdit.displayText()) search_keywords = unicode(self.searchTextEdit.displayText())
search_results = [] search_results = []
# search_type = self.SearchTypeComboBox.currentIndex() # search_type = self.searchTypeComboBox.currentIndex()
search_type = self.SearchTextEdit.currentSearchType() search_type = self.searchTextEdit.currentSearchType()
if search_type == 1: if search_type == 1:
log.debug(u'Entire Song Search') log.debug(u'Entire Song Search')
search_results = self.parent.manager.get_all_objects(Song, search_results = self.parent.manager.get_all_objects(Song,
@ -243,7 +241,7 @@ class SongMediaItem(MediaManagerItem):
""" """
Clear the search text. Clear the search text.
""" """
self.SearchTextEdit.clear() self.searchTextEdit.clear()
self.onSearchTextButtonClick() self.onSearchTextButtonClick()
def onSearchTextEditChanged(self, text): def onSearchTextEditChanged(self, text):
@ -254,9 +252,9 @@ class SongMediaItem(MediaManagerItem):
""" """
if self.searchAsYouType: if self.searchAsYouType:
search_length = 1 search_length = 1
if self.SearchTextEdit.currentSearchType() == 1: if self.searchTextEdit.currentSearchType() == 1:
search_length = 3 search_length = 3
elif self.SearchTextEdit.currentSearchType() == 3: elif self.searchTextEdit.currentSearchType() == 3:
search_length = 7 search_length = 7
if len(text) > search_length: if len(text) > search_length:
self.onSearchTextButtonClick() self.onSearchTextButtonClick()

View File

@ -28,13 +28,12 @@ The :mod:`olp1import` module provides the functionality for importing
openlp.org 1.x song databases into the current installation database. openlp.org 1.x song databases into the current installation database.
""" """
from PyQt4 import QtGui
import logging import logging
from chardet.universaldetector import UniversalDetector from chardet.universaldetector import UniversalDetector
import sqlite import sqlite
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport from songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -185,64 +184,4 @@ class OpenLP1SongImport(SongImport):
detector.close() detector.close()
return detector.result[u'encoding'] return detector.result[u'encoding']
detector.close() detector.close()
guess = detector.result[u'encoding'] return retrieve_windows_encoding(detector.result[u'encoding'])
# map chardet result to compatible windows standard code page
codepage_mapping = {'IBM866': u'cp866', 'TIS-620': u'cp874',
'SHIFT_JIS': u'cp932', 'GB2312': u'cp936', 'HZ-GB-2312': u'cp936',
'EUC-KR': u'cp949', 'Big5': u'cp950', 'ISO-8859-2': u'cp1250',
'windows-1250': u'cp1250', 'windows-1251': u'cp1251',
'windows-1252': u'cp1252', 'ISO-8859-7': u'cp1253',
'windows-1253': u'cp1253', 'ISO-8859-8': u'cp1255',
'windows-1255': u'cp1255'}
if guess in codepage_mapping:
guess = codepage_mapping[guess]
else:
guess = u'cp1252'
# Show dialog for encoding selection
encodings = [(u'cp1256', translate('SongsPlugin.OpenLP1SongImport',
'Arabic (CP-1256)')),
(u'cp1257', translate('SongsPlugin.OpenLP1SongImport',
'Baltic (CP-1257)')),
(u'cp1250', translate('SongsPlugin.OpenLP1SongImport',
'Central European (CP-1250)')),
(u'cp1251', translate('SongsPlugin.OpenLP1SongImport',
'Cyrillic (CP-1251)')),
(u'cp1253', translate('SongsPlugin.OpenLP1SongImport',
'Greek (CP-1253)')),
(u'cp1255', translate('SongsPlugin.OpenLP1SongImport',
'Hebrew (CP-1255)')),
(u'cp932', translate('SongsPlugin.OpenLP1SongImport',
'Japanese (CP-932)')),
(u'cp949', translate('SongsPlugin.OpenLP1SongImport',
'Korean (CP-949)')),
(u'cp936', translate('SongsPlugin.OpenLP1SongImport',
'Simplified Chinese (CP-936)')),
(u'cp874', translate('SongsPlugin.OpenLP1SongImport',
'Thai (CP-874)')),
(u'cp950', translate('SongsPlugin.OpenLP1SongImport',
'Traditional Chinese (CP-950)')),
(u'cp1254', translate('SongsPlugin.OpenLP1SongImport',
'Turkish (CP-1254)')),
(u'cp1258', translate('SongsPlugin.OpenLP1SongImport',
'Vietnam (CP-1258)')),
(u'cp1252', translate('SongsPlugin.OpenLP1SongImport',
'Western European (CP-1252)'))]
encoding_index = 0
for index in range(len(encodings)):
if guess == encodings[index][0]:
encoding_index = index
break
chosen_encoding = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin.OpenLP1SongImport',
'Database Character Encoding'),
translate('SongsPlugin.OpenLP1SongImport',
'The codepage setting is responsible\n'
'for the correct character representation.\n'
'Usually you are fine with the preselected choise.'),
[pair[1] for pair in encodings], encoding_index, False)
if not chosen_encoding[1]:
return None
return filter(lambda item: item[1] == chosen_encoding[0],
encodings)[0][0]

View File

@ -27,10 +27,11 @@
The :mod:`songbeamerimport` module provides the functionality for importing The :mod:`songbeamerimport` module provides the functionality for importing
SongBeamer songs into the OpenLP database. SongBeamer songs into the OpenLP database.
""" """
import logging
import os
import chardet import chardet
import codecs import codecs
import logging
import os
import re
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib.songimport import SongImport from openlp.plugins.songs.lib.songimport import SongImport
@ -151,23 +152,25 @@ class SongBeamerImport(SongImport):
(u'</i>', u'{/it}'), (u'</i>', u'{/it}'),
(u'<u>', u'{u}'), (u'<u>', u'{u}'),
(u'</u>', u'{/u}'), (u'</u>', u'{/u}'),
(u'<br>', u'{st}'),
(u'</br>', u'{st}'),
(u'</ br>', u'{st}'),
(u'<p>', u'{p}'), (u'<p>', u'{p}'),
(u'</p>', u'{/p}'), (u'</p>', u'{/p}'),
(u'<super>', u'{su}'), (u'<super>', u'{su}'),
(u'</super>', u'{/su}'), (u'</super>', u'{/su}'),
(u'<sub>', u'{sb}'), (u'<sub>', u'{sb}'),
(u'</sub>', u'{/sb}'), (u'</sub>', u'{/sb}'),
(u'<wordwrap>', u''), (u'<[/]?br.*?>', u'{st}'),
(u'</wordwrap>', u''), (u'<[/]?wordwrap>', u''),
(u'<strike>', u''), (u'<[/]?strike>', u''),
(u'</strike>', u'') (u'<[/]?h.*?>', u''),
(u'<[/]?s.*?>', u''),
(u'<[/]?linespacing.*?>', u''),
(u'<[/]?c.*?>', u''),
(u'<align.*?>', u''),
(u'<valign.*?>', u'')
] ]
for pair in tag_pairs: for pair in tag_pairs:
self.current_verse = self.current_verse.replace(pair[0], pair[1]) self.current_verse = re.compile(pair[0]).sub(pair[1],
# TODO: check for unsupported tags (see wiki) and remove them as well. self.current_verse)
def parse_tags(self, line): def parse_tags(self, line):
""" """

View File

@ -37,15 +37,10 @@ class SongsTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'SongsTab') self.setObjectName(u'SongsTab')
self.SongsLayout = QtGui.QFormLayout(self) SettingsTab.setupUi(self)
self.SongsLayout.setSpacing(8) self.SongsModeGroupBox = QtGui.QGroupBox(self.leftColumn)
self.SongsLayout.setMargin(8)
self.SongsLayout.setObjectName(u'SongsLayout')
self.SongsModeGroupBox = QtGui.QGroupBox(self)
self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox') self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox')
self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox) self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox)
self.SongsModeLayout.setSpacing(8)
self.SongsModeLayout.setMargin(8)
self.SongsModeLayout.setObjectName(u'SongsModeLayout') self.SongsModeLayout.setObjectName(u'SongsModeLayout')
self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox) self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox') self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
@ -61,8 +56,9 @@ class SongsTab(SettingsTab):
self.SongAddFromServiceCheckBox.setObjectName( self.SongAddFromServiceCheckBox.setObjectName(
u'SongAddFromServiceCheckBox') u'SongAddFromServiceCheckBox')
self.SongsModeLayout.addWidget(self.SongAddFromServiceCheckBox) self.SongsModeLayout.addWidget(self.SongAddFromServiceCheckBox)
self.SongsLayout.setWidget( self.leftLayout.addWidget(self.SongsModeGroupBox)
0, QtGui.QFormLayout.LabelRole, self.SongsModeGroupBox) self.leftLayout.addStretch()
self.rightLayout.addStretch()
QtCore.QObject.connect(self.SearchAsTypeCheckBox, QtCore.QObject.connect(self.SearchAsTypeCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onSearchAsTypeCheckBoxChanged) self.onSearchAsTypeCheckBoxChanged)
@ -139,4 +135,4 @@ class SongsTab(SettingsTab):
QtCore.QVariant(self.update_edit)) QtCore.QVariant(self.update_edit))
settings.setValue(u'add song from service', settings.setValue(u'add song from service',
QtCore.QVariant(self.update_load)) QtCore.QVariant(self.update_load))
settings.endGroup() settings.endGroup()