Fix song edit form and cleanups

bzr-revno: 1259
This commit is contained in:
Jon Tibble 2011-02-01 19:02:42 +00:00
commit 3109b4afb4
8 changed files with 53 additions and 54 deletions

View File

@ -87,10 +87,10 @@ class Ui_MainWindow(object):
self.screens, True)
previewVisible = QtCore.QSettings().value(
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
self.previewController.Panel.setVisible(previewVisible)
self.previewController.panel.setVisible(previewVisible)
liveVisible = QtCore.QSettings().value(u'user interface/live panel',
QtCore.QVariant(True)).toBool()
self.liveController.Panel.setVisible(liveVisible)
self.liveController.panel.setVisible(liveVisible)
# Create menu
self.MenuBar = QtGui.QMenuBar(mainWindow)
self.MenuBar.setObjectName(u'MenuBar')
@ -939,7 +939,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
True - Visible
False - Hidden
"""
self.previewController.Panel.setVisible(visible)
self.previewController.panel.setVisible(visible)
QtCore.QSettings().setValue(u'user interface/preview panel',
QtCore.QVariant(visible))
self.ViewPreviewPanel.setChecked(visible)
@ -954,7 +954,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
True - Visible
False - Hidden
"""
self.liveController.Panel.setVisible(visible)
self.liveController.panel.setVisible(visible)
QtCore.QSettings().setValue(u'user interface/live panel',
QtCore.QVariant(visible))
self.ViewLivePanel.setChecked(visible)

View File

@ -27,9 +27,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import save_cancel_button_box, translate
from servicenotedialog import Ui_ServiceNoteEdit
class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit):
class ServiceNoteForm(QtGui.QDialog):
"""
This is the form that is used to edit the verses of the song.
"""

View File

@ -77,14 +77,14 @@ class SlideController(QtGui.QWidget):
self.selectedRow = 0
self.serviceItem = None
self.alertTab = None
self.Panel = QtGui.QWidget(parent.ControlSplitter)
self.panel = QtGui.QWidget(parent.ControlSplitter)
self.slideList = {}
# Layout for holding panel
self.panelLayout = QtGui.QVBoxLayout(self.Panel)
self.panelLayout = QtGui.QVBoxLayout(self.panel)
self.panelLayout.setSpacing(0)
self.panelLayout.setMargin(0)
# Type label for the top of the slide controller
self.typeLabel = QtGui.QLabel(self.Panel)
self.typeLabel = QtGui.QLabel(self.panel)
if self.isLive:
self.typeLabel.setText(translate('OpenLP.SlideController', 'Live'))
self.split = 1
@ -98,7 +98,7 @@ class SlideController(QtGui.QWidget):
self.typeLabel.setAlignment(QtCore.Qt.AlignCenter)
self.panelLayout.addWidget(self.typeLabel)
# Splitter
self.splitter = QtGui.QSplitter(self.Panel)
self.splitter = QtGui.QSplitter(self.panel)
self.splitter.setOrientation(QtCore.Qt.Vertical)
self.panelLayout.addWidget(self.splitter)
# Actual controller section
@ -185,13 +185,13 @@ class SlideController(QtGui.QWidget):
u'Stop Loop', u':/media/media_stop.png',
translate('OpenLP.SlideController', 'Stop continuous loop'),
self.onStopLoop)
self.DelaySpinBox = QtGui.QSpinBox()
self.DelaySpinBox.setMinimum(1)
self.DelaySpinBox.setMaximum(180)
self.toolbar.addToolbarWidget(u'Image SpinBox', self.DelaySpinBox)
self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController',
self.delaySpinBox = QtGui.QSpinBox()
self.delaySpinBox.setMinimum(1)
self.delaySpinBox.setMaximum(180)
self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox)
self.delaySpinBox.setSuffix(translate('OpenLP.SlideController',
's'))
self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController',
self.delaySpinBox.setToolTip(translate('OpenLP.SlideController',
'Delay between slides in seconds'))
else:
self.toolbar.addToolbarSeparator(u'Close Separator')
@ -486,7 +486,7 @@ class SlideController(QtGui.QWidget):
self.onSlideSelected()
def receiveSpinDelay(self, value):
self.DelaySpinBox.setValue(int(value))
self.delaySpinBox.setValue(int(value))
def enableToolBar(self, item):
"""
@ -998,7 +998,7 @@ class SlideController(QtGui.QWidget):
"""
if self.previewListWidget.rowCount() > 1:
self.timer_id = self.startTimer(
int(self.DelaySpinBox.value()) * 1000)
int(self.delaySpinBox.value()) * 1000)
self.toolbar.actions[u'Stop Loop'].setVisible(True)
self.toolbar.actions[u'Start Loop'].setVisible(False)

View File

@ -29,12 +29,11 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon
class Ui_ThemeWizard(object):
def setupUi(self, ThemeWizard):
ThemeWizard.setObjectName(u'OpenLP.ThemeWizard')
ThemeWizard.setModal(True)
ThemeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
ThemeWizard.setOptions(
QtGui.QWizard.IndependentPages |
def setupUi(self, themeWizard):
themeWizard.setObjectName(u'OpenLP.ThemeWizard')
themeWizard.setModal(True)
themeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
themeWizard.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage)
# Welcome Page
self.welcomePage = QtGui.QWizardPage()
@ -52,7 +51,7 @@ class Ui_ThemeWizard(object):
self.informationLabel.setObjectName(u'InformationLabel')
self.welcomeLayout.addWidget(self.informationLabel)
self.welcomeLayout.addStretch()
ThemeWizard.addPage(self.welcomePage)
themeWizard.addPage(self.welcomePage)
# Background Page
self.backgroundPage = QtGui.QWizardPage()
self.backgroundPage.setObjectName(u'BackgroundPage')
@ -142,7 +141,7 @@ class Ui_ThemeWizard(object):
self.imageSpacer)
self.backgroundStack.addWidget(self.imageWidget)
self.backgroundLayout.addLayout(self.backgroundStack)
ThemeWizard.addPage(self.backgroundPage)
themeWizard.addPage(self.backgroundPage)
# Main Area Page
self.mainAreaPage = QtGui.QWizardPage()
self.mainAreaPage.setObjectName(u'MainAreaPage')
@ -225,7 +224,7 @@ class Ui_ThemeWizard(object):
self.shadowSizeSpinBox.setObjectName(u'ShadowSizeSpinBox')
self.shadowLayout.addWidget(self.shadowSizeSpinBox)
self.mainAreaLayout.addRow(self.shadowCheckBox, self.shadowLayout)
ThemeWizard.addPage(self.mainAreaPage)
themeWizard.addPage(self.mainAreaPage)
# Footer Area Page
self.footerAreaPage = QtGui.QWizardPage()
self.footerAreaPage.setObjectName(u'FooterAreaPage')
@ -251,7 +250,7 @@ class Ui_ThemeWizard(object):
self.footerSizeSpinBox.setObjectName(u'FooterSizeSpinBox')
self.footerAreaLayout.addRow(self.footerSizeLabel,
self.footerSizeSpinBox)
ThemeWizard.addPage(self.footerAreaPage)
themeWizard.addPage(self.footerAreaPage)
# Alignment Page
self.alignmentPage = QtGui.QWizardPage()
self.alignmentPage.setObjectName(u'AlignmentPage')
@ -276,7 +275,7 @@ class Ui_ThemeWizard(object):
self.transitionsCheckBox.setObjectName(u'TransitionsCheckBox')
self.alignmentLayout.addRow(self.transitionsLabel,
self.transitionsCheckBox)
ThemeWizard.addPage(self.alignmentPage)
themeWizard.addPage(self.alignmentPage)
# Area Position Page
self.areaPositionPage = QtGui.QWizardPage()
self.areaPositionPage.setObjectName(u'AreaPositionPage')
@ -352,7 +351,7 @@ class Ui_ThemeWizard(object):
self.footerPositionLayout.addRow(self.footerHeightLabel,
self.footerHeightSpinBox)
self.areaPositionLayout.addWidget(self.footerPositionGroupBox)
ThemeWizard.addPage(self.areaPositionPage)
themeWizard.addPage(self.areaPositionPage)
# Preview Page
self.previewPage = QtGui.QWizardPage()
self.previewPage.setObjectName(u'PreviewPage')
@ -381,9 +380,8 @@ class Ui_ThemeWizard(object):
self.previewBoxLabel.setObjectName(u'PreviewBoxLabel')
self.previewAreaLayout.addWidget(self.previewBoxLabel)
self.previewLayout.addWidget(self.previewArea)
ThemeWizard.addPage(self.previewPage)
self.retranslateUi(ThemeWizard)
themeWizard.addPage(self.previewPage)
self.retranslateUi(themeWizard)
QtCore.QObject.connect(self.backgroundComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.backgroundStack,
QtCore.SLOT(u'setCurrentIndex(int)'))
@ -423,10 +421,10 @@ class Ui_ThemeWizard(object):
QtCore.QObject.connect(self.footerPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.footerHeightSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QMetaObject.connectSlotsByName(ThemeWizard)
QtCore.QMetaObject.connectSlotsByName(themeWizard)
def retranslateUi(self, ThemeWizard):
ThemeWizard.setWindowTitle(
def retranslateUi(self, themeWizard):
themeWizard.setWindowTitle(
translate('OpenLP.ThemeWizard', 'Theme Wizard'))
self.titleLabel.setText(
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \

View File

@ -525,7 +525,7 @@ class BibleMediaItem(MediaManagerItem):
if self.advancedClearComboBox.currentIndex() == 0:
self.listView.clear()
if self.listView.count() != 0:
self.__checkSecondBible()
self.__checkSecondBible(bible, second_bible)
else:
self.displayResults(bible, second_bible)
Receiver.send_message(u'cursor_normal')
@ -565,14 +565,14 @@ class BibleMediaItem(MediaManagerItem):
if self.quickClearComboBox.currentIndex() == 0:
self.listView.clear()
if self.listView.count() != 0 and self.search_results:
self.__checkSecondBible()
self.__checkSecondBible(bible, second_bible)
elif self.search_results:
self.displayResults(bible, second_bible)
self.quickSearchButton.setEnabled(True)
Receiver.send_message(u'cursor_normal')
Receiver.send_message(u'openlp_process_events')
def __checkSecondBible(self):
def __checkSecondBible(self, bible, second_bible):
"""
Check if the first item is a second bible item or not.
"""

View File

@ -648,6 +648,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
Free up autocompletion memory on dialog exit
"""
log.debug (u'SongEditForm.clearCaches')
self.authors = []
self.themes = []
self.books = []
@ -657,20 +658,21 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
Exit Dialog and do not save
"""
log.debug (u'SongEditForm.reject')
Receiver.send_message(u'songs_edit_clear')
self.clearCaches()
self.close()
QtGui.QDialog.reject(self)
def accept(self):
"""
Exit Dialog and save song if valid
"""
log.debug(u'accept')
log.debug(u'SongEditForm.accept')
self.clearCaches()
if self._validate_song():
self.saveSong()
Receiver.send_message(u'songs_load_list')
self.close()
QtGui.QDialog.accept(self)
def saveSong(self, preview=False):
"""

View File

@ -94,8 +94,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.typeListWidget.setFocus()
return QtGui.QDialog.exec_(self)
def _getCurrentItemId(self, ListWidget):
item = ListWidget.currentItem()
def _getCurrentItemId(self, listWidget):
item = listWidget.currentItem()
if item:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
return item_id
@ -390,13 +390,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
book.name = temp_name
book.publisher = temp_publisher
def __mergeObjects(self, object, merge, reset):
def __mergeObjects(self, dbObject, merge, reset):
"""
Utility method to merge two objects to leave one in the database.
"""
Receiver.send_message(u'cursor_busy')
Receiver.send_message(u'openlp_process_events')
merge(object)
merge(dbObject)
reset()
Receiver.send_message(u'songs_load_list')
Receiver.send_message(u'cursor_normal')

View File

@ -140,25 +140,25 @@ class EasiSlidesImport(SongImport):
``song``
The current song being imported.
"""
copyright = []
self.__add_copyright_element(copyright, song.Copyright)
self.__add_copyright_element(copyright, song.LicenceAdmin1)
self.__add_copyright_element(copyright, song.LicenceAdmin2)
self.add_copyright(u' '.join(copyright))
copyright_list = []
self.__add_copyright_element(copyright_list, song.Copyright)
self.__add_copyright_element(copyright_list, song.LicenceAdmin1)
self.__add_copyright_element(copyright_list, song.LicenceAdmin2)
self.add_copyright(u' '.join(copyright_list))
def __add_copyright_element(self, copyright, element):
def __add_copyright_element(self, copyright_list, element):
"""
Add a piece of copyright to the total copyright information for the
song.
``copyright``
``copyright_list``
The array to add the information to.
``element``
The imported variable to get the data from.
"""
try:
copyright.append(unicode(element).strip())
copyright_list.append(unicode(element).strip())
except UnicodeDecodeError:
log.exception(u'Unicode error decoding %s' % element)
self._success = False