From a89b4f593123483e0f4898bbbb91a5e25613b217 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 8 Apr 2012 13:43:14 +0200 Subject: [PATCH 1/6] fixed bug 803602 (Quick Tab for Bibles does not resize correctly) Fixes: https://launchpad.net/bugs/803602 --- openlp/plugins/bibles/lib/mediaitem.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 159fbd0d7..3ad90d662 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -28,7 +28,7 @@ import logging import locale -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore, QtGui, Qt from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ translate, create_separated_list @@ -199,6 +199,8 @@ class BibleMediaItem(MediaManagerItem): self.quickLayout.addWidget( self.quickSearchLabel, 0, 0, QtCore.Qt.AlignRight) self.quickSearchEdit = SearchEdit(self.quickTab) + self.quickSearchEdit.setSizePolicy( + Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Ignored) self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) self.quickLayout.addWidget(self.quickSearchEdit, 0, 1, 1, 2) From 6ad7a867ccc6a22090e55e694377b28676c1809c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 8 Apr 2012 14:53:11 +0200 Subject: [PATCH 2/6] fixed bug 970436 ('Display if a single screen' always in effect) Fixes: https://launchpad.net/bugs/970436 --- openlp/core/ui/maindisplay.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index ef6ded3fa..cf3598dbd 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -356,9 +356,11 @@ class MainDisplay(Display): else: # Single screen active if self.screens.display_count == 1: - # Only make visible if setting enabled + # Only make visible if setting enabled. if QtCore.QSettings().value(u'general/display on monitor', - QtCore.QVariant(True)).toBool(): + QtCore.QVariant(True)).toBool() or \ + QtCore.QSettings().value(u'general/override position', + QtCore.QVariant(False)).toBool(): self.setVisible(True) else: self.setVisible(True) @@ -429,9 +431,11 @@ class MainDisplay(Display): """ log.debug(u'hideDisplay mode = %d', mode) if self.screens.display_count == 1: - # Only make visible if setting enabled + # Only make visible if setting enabled. if not QtCore.QSettings().value(u'general/display on monitor', - QtCore.QVariant(True)).toBool(): + QtCore.QVariant(True)).toBool() and not \ + QtCore.QSettings().value(u'general/override position', + QtCore.QVariant(False)).toBool(): return if mode == HideMode.Screen: self.frame.evaluateJavaScript(u'show_blank("desktop");') @@ -454,9 +458,11 @@ class MainDisplay(Display): """ log.debug(u'showDisplay') if self.screens.display_count == 1: - # Only make visible if setting enabled + # Only make visible if setting enabled. if not QtCore.QSettings().value(u'general/display on monitor', - QtCore.QVariant(True)).toBool(): + QtCore.QVariant(True)).toBool() and not \ + QtCore.QSettings().value(u'general/override position', + QtCore.QVariant(False)).toBool(): return self.frame.evaluateJavaScript('show_blank("show");') if self.isHidden(): From aa8457dd6e86535445717ded7db89548bfb52349 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 9 Apr 2012 12:01:06 +0200 Subject: [PATCH 3/6] reverted changes and fixed the bug differently --- openlp/core/ui/generaltab.py | 27 ++++++++++++--------------- openlp/core/ui/maindisplay.py | 18 ++++++------------ 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index b4d424b10..423c6239f 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -65,42 +65,42 @@ class GeneralTab(SettingsTab): self.monitorComboBox = QtGui.QComboBox(self.monitorGroupBox) self.monitorComboBox.setObjectName(u'monitorComboBox') self.monitorLayout.addWidget(self.monitorComboBox, 1, 1, 1, 4) - self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox) - self.displayOnMonitorCheck.setObjectName(u'monitorComboBox') - self.monitorLayout.addWidget(self.displayOnMonitorCheck, 2, 1, 1, 4) # Display Position self.overrideRadioButton = QtGui.QRadioButton(self.monitorGroupBox) self.overrideRadioButton.setObjectName(u'overrideRadioButton') - self.monitorLayout.addWidget(self.overrideRadioButton, 3, 0, 1, 5) + self.monitorLayout.addWidget(self.overrideRadioButton, 2, 0, 1, 5) # Custom position self.customXLabel = QtGui.QLabel(self.monitorGroupBox) self.customXLabel.setObjectName(u'customXLabel') - self.monitorLayout.addWidget(self.customXLabel, 4, 1) + self.monitorLayout.addWidget(self.customXLabel, 3, 1) self.customXValueEdit = QtGui.QSpinBox(self.monitorGroupBox) self.customXValueEdit.setObjectName(u'customXValueEdit') self.customXValueEdit.setRange(-9999, 9999) - self.monitorLayout.addWidget(self.customXValueEdit, 5, 1) + self.monitorLayout.addWidget(self.customXValueEdit, 4, 1) self.customYLabel = QtGui.QLabel(self.monitorGroupBox) self.customYLabel.setObjectName(u'customYLabel') - self.monitorLayout.addWidget(self.customYLabel, 4, 2) + self.monitorLayout.addWidget(self.customYLabel, 3, 2) self.customYValueEdit = QtGui.QSpinBox(self.monitorGroupBox) self.customYValueEdit.setObjectName(u'customYValueEdit') self.customYValueEdit.setRange(-9999, 9999) - self.monitorLayout.addWidget(self.customYValueEdit, 5, 2) + self.monitorLayout.addWidget(self.customYValueEdit, 4, 2) self.customWidthLabel = QtGui.QLabel(self.monitorGroupBox) self.customWidthLabel.setObjectName(u'customWidthLabel') - self.monitorLayout.addWidget(self.customWidthLabel, 4, 3) + self.monitorLayout.addWidget(self.customWidthLabel, 3, 3) self.customWidthValueEdit = QtGui.QSpinBox(self.monitorGroupBox) self.customWidthValueEdit.setObjectName(u'customWidthValueEdit') self.customWidthValueEdit.setMaximum(9999) - self.monitorLayout.addWidget(self.customWidthValueEdit, 5, 3) + self.monitorLayout.addWidget(self.customWidthValueEdit, 4, 3) self.customHeightLabel = QtGui.QLabel(self.monitorGroupBox) self.customHeightLabel.setObjectName(u'customHeightLabel') - self.monitorLayout.addWidget(self.customHeightLabel, 4, 4) + self.monitorLayout.addWidget(self.customHeightLabel, 3, 4) self.customHeightValueEdit = QtGui.QSpinBox(self.monitorGroupBox) self.customHeightValueEdit.setObjectName(u'customHeightValueEdit') self.customHeightValueEdit.setMaximum(9999) - self.monitorLayout.addWidget(self.customHeightValueEdit, 5, 4) + self.monitorLayout.addWidget(self.customHeightValueEdit, 4, 4) + self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox) + self.displayOnMonitorCheck.setObjectName(u'monitorComboBox') + self.monitorLayout.addWidget(self.displayOnMonitorCheck, 5, 0, 1, 5) # Set up the stretchiness of each column, so that the first column # less stretchy (and therefore smaller) than the others self.monitorLayout.setColumnStretch(0, 1) @@ -314,8 +314,6 @@ class GeneralTab(SettingsTab): u'audio repeat list', QtCore.QVariant(False)).toBool()) settings.endGroup() self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked()) - self.displayOnMonitorCheck.setDisabled( - self.overrideRadioButton.isChecked()) self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked()) self.customYValueEdit.setEnabled(self.overrideRadioButton.isChecked()) self.customHeightValueEdit.setEnabled( @@ -408,7 +406,6 @@ class GeneralTab(SettingsTab): The state of the check box (boolean). """ self.monitorComboBox.setDisabled(checked) - self.displayOnMonitorCheck.setDisabled(checked) self.customXValueEdit.setEnabled(checked) self.customYValueEdit.setEnabled(checked) self.customHeightValueEdit.setEnabled(checked) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index cf3598dbd..ef6ded3fa 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -356,11 +356,9 @@ class MainDisplay(Display): else: # Single screen active if self.screens.display_count == 1: - # Only make visible if setting enabled. + # Only make visible if setting enabled if QtCore.QSettings().value(u'general/display on monitor', - QtCore.QVariant(True)).toBool() or \ - QtCore.QSettings().value(u'general/override position', - QtCore.QVariant(False)).toBool(): + QtCore.QVariant(True)).toBool(): self.setVisible(True) else: self.setVisible(True) @@ -431,11 +429,9 @@ class MainDisplay(Display): """ log.debug(u'hideDisplay mode = %d', mode) if self.screens.display_count == 1: - # Only make visible if setting enabled. + # Only make visible if setting enabled if not QtCore.QSettings().value(u'general/display on monitor', - QtCore.QVariant(True)).toBool() and not \ - QtCore.QSettings().value(u'general/override position', - QtCore.QVariant(False)).toBool(): + QtCore.QVariant(True)).toBool(): return if mode == HideMode.Screen: self.frame.evaluateJavaScript(u'show_blank("desktop");') @@ -458,11 +454,9 @@ class MainDisplay(Display): """ log.debug(u'showDisplay') if self.screens.display_count == 1: - # Only make visible if setting enabled. + # Only make visible if setting enabled if not QtCore.QSettings().value(u'general/display on monitor', - QtCore.QVariant(True)).toBool() and not \ - QtCore.QSettings().value(u'general/override position', - QtCore.QVariant(False)).toBool(): + QtCore.QVariant(True)).toBool(): return self.frame.evaluateJavaScript('show_blank("show");') if self.isHidden(): From 4ec49627db520328cbd144d344ec92fb533c2f34 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 9 Apr 2012 12:22:47 +0200 Subject: [PATCH 4/6] fixed comments, simplification, removed not needed attribute --- openlp/core/ui/maindisplay.py | 40 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index ef6ded3fa..15fb9eefe 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -221,11 +221,6 @@ class MainDisplay(Display): self.webView.setHtml(build_html(serviceItem, self.screen, self.isLive, None, plugins=self.plugins)) self.__hideMouse() - # To display or not to display? - if not self.screen[u'primary']: - self.primary = False - else: - self.primary = True log.debug(u'Finished MainDisplay setup') def text(self, slide): @@ -253,10 +248,10 @@ class MainDisplay(Display): log.debug(u'alert to display') # First we convert <>& marks to html variants, then apply # formattingtags, finally we double all backslashes for JavaScript. - text_prepared = expand_tags(cgi.escape(text)) \ - .replace(u'\\', u'\\\\').replace(u'\"', u'\\\"') - if self.height() != self.screen[u'size'].height() or \ - not self.isVisible(): + text_prepared = expand_tags( + cgi.escape(text)).replace(u'\\', u'\\\\').replace(u'\"', u'\\\"') + if self.height() != self.screen[u'size'].height() or not \ + self.isVisible(): shrink = True js = u'show_alert("%s", "%s")' % (text_prepared, u'top') else: @@ -336,7 +331,7 @@ class MainDisplay(Display): """ log.debug(u'preview for %s', self.isLive) Receiver.send_message(u'openlp_process_events') - # We must have a service item to preview + # We must have a service item to preview. if self.isLive and hasattr(self, u'serviceItem'): # Wait for the fade to finish before geting the preview. # Important otherwise preview will have incorrect text if at all! @@ -345,7 +340,7 @@ class MainDisplay(Display): while self.frame.evaluateJavaScript(u'show_text_complete()') \ .toString() == u'false': Receiver.send_message(u'openlp_process_events') - # Wait for the webview to update before geting the preview. + # Wait for the webview to update before getting the preview. # Important otherwise first preview will miss the background ! while not self.webLoaded: Receiver.send_message(u'openlp_process_events') @@ -356,7 +351,7 @@ class MainDisplay(Display): else: # Single screen active if self.screens.display_count == 1: - # Only make visible if setting enabled + # Only make visible if setting enabled. if QtCore.QSettings().value(u'general/display on monitor', QtCore.QVariant(True)).toBool(): self.setVisible(True) @@ -374,9 +369,9 @@ class MainDisplay(Display): self.initialFrame = None self.serviceItem = serviceItem background = None - # We have an image override so keep the image till the theme changes + # We have an image override so keep the image till the theme changes. if self.override: - # We have an video override so allow it to be stopped + # We have an video override so allow it to be stopped. if u'video' in self.override: Receiver.send_message(u'video_background_replaced') self.override = {} @@ -429,7 +424,7 @@ class MainDisplay(Display): """ log.debug(u'hideDisplay mode = %d', mode) if self.screens.display_count == 1: - # Only make visible if setting enabled + # Only make visible if setting enabled. if not QtCore.QSettings().value(u'general/display on monitor', QtCore.QVariant(True)).toBool(): return @@ -454,7 +449,7 @@ class MainDisplay(Display): """ log.debug(u'showDisplay') if self.screens.display_count == 1: - # Only make visible if setting enabled + # Only make visible if setting enabled. if not QtCore.QSettings().value(u'general/display on monitor', QtCore.QVariant(True)).toBool(): return @@ -462,12 +457,14 @@ class MainDisplay(Display): if self.isHidden(): self.setVisible(True) self.hideMode = None - # Trigger actions when display is active again + # Trigger actions when display is active again. if self.isLive: Receiver.send_message(u'live_display_active') def __hideMouse(self): - # Hide mouse cursor when moved over display if enabled in settings + """ + Hide mouse cursor when moved over display. + """ if QtCore.QSettings().value(u'advanced/hide mouse', QtCore.QVariant(False)).toBool(): self.setCursor(QtCore.Qt.BlankCursor) @@ -569,13 +566,12 @@ class AudioPlayer(QtCore.QObject): """ Add another file to the playlist. - ``filename`` - The file to add to the playlist. + ``filenames`` + A list with files to be added to the playlist. """ if not isinstance(filenames, list): filenames = [filenames] - for filename in filenames: - self.playlist.append(Phonon.MediaSource(filename)) + self.playlist.extend(map(Phonon.MediaSource, filenames)) def next(self): if not self.repeat and self.currentIndex + 1 == len(self.playlist): From 268e808b8d84ef006c10d5f90d32b5b6cb8ec3c0 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 9 Apr 2012 12:52:24 +0200 Subject: [PATCH 5/6] swapped flags, do not import Qt --- openlp/plugins/bibles/lib/mediaitem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 3ad90d662..aa12cc913 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -28,7 +28,7 @@ import logging import locale -from PyQt4 import QtCore, QtGui, Qt +from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ translate, create_separated_list @@ -200,7 +200,7 @@ class BibleMediaItem(MediaManagerItem): self.quickSearchLabel, 0, 0, QtCore.Qt.AlignRight) self.quickSearchEdit = SearchEdit(self.quickTab) self.quickSearchEdit.setSizePolicy( - Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Ignored) + QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Expanding) self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) self.quickLayout.addWidget(self.quickSearchEdit, 0, 1, 1, 2) From 3aa216109547aa697b541ac221cd00c4a0b37d64 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 9 Apr 2012 13:36:26 +0200 Subject: [PATCH 6/6] fixed bug --- openlp/plugins/bibles/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index aa12cc913..00b7b01ef 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -200,7 +200,7 @@ class BibleMediaItem(MediaManagerItem): self.quickSearchLabel, 0, 0, QtCore.Qt.AlignRight) self.quickSearchEdit = SearchEdit(self.quickTab) self.quickSearchEdit.setSizePolicy( - QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Expanding) + QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Fixed) self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) self.quickLayout.addWidget(self.quickSearchEdit, 0, 1, 1, 2)