From 460964c3712558c16e0b4e48a2db5381a60e24b8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 23 Apr 2010 17:03:12 +0100 Subject: [PATCH 01/24] fixes --- openlp.pyw | 8 +++++++- openlp/core/lib/mediamanageritem.py | 2 +- openlp/core/lib/renderer.py | 3 ++- openlp/core/ui/servicemanager.py | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 528923862..1726c806f 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -193,7 +193,13 @@ def main(): qInitResources() # Now create and actually run the application. app = OpenLP(qt_args) - sys.exit(app.run()) + try: + a = app.run() + print a + except: + log.exception(u'it went bang') + + sys.exit(a) if __name__ == u'__main__': """ diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 05ce36ad1..c12d6bc6b 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -425,7 +425,7 @@ class MediaManagerItem(QtGui.QWidget): else: #Is it posssible to process multiple list items to generate multiple #service items? - if self.singleServiceItem: + if self.singleServiceItem or self.remoteTriggered: log.debug(self.PluginNameShort + u' Add requested') service_item = self.buildServiceItem() if service_item: diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index f574ed6a8..beec5389c 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -244,7 +244,8 @@ class Renderer(object): bbox1 = self._render_lines_unaligned(footer_lines, True) # reset the frame. first time do not worry about what you paint on. self._frame = QtGui.QImage(self.bg_frame) - self._frameOp = QtGui.QImage(self.bg_frame) + if self._theme.display_slideTransition: + self._frameOp = QtGui.QImage(self.bg_frame) x, y = self._correctAlignment(self._rect, bbox) bbox = self._render_lines_unaligned(lines, False, (x, y), True) if footer_lines: diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 27ca95d0e..21d31644b 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -653,6 +653,7 @@ class ServiceManager(QtGui.QWidget): """ sitem, count = self.findServiceItem() item.render() + print self.remoteEditTriggered if self.remoteEditTriggered: item.merge(self.serviceItems[sitem][u'service_item']) self.serviceItems[sitem][u'service_item'] = item From a29ea3f8616262eea3cb29d6d1245ed01fdf3c22 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 24 Apr 2010 08:21:35 +0100 Subject: [PATCH 02/24] Add line spacing adjustment to renderer Remove .thumbnail directories --- openlp.pyw | 10 ++-------- openlp/core/lib/renderer.py | 23 +++++++++++++---------- openlp/core/lib/themexmlhandler.py | 8 ++++++-- openlp/core/ui/amendthemedialog.py | 15 ++++++++++++--- openlp/core/ui/amendthemeform.py | 20 +++++++++++++++++--- openlp/core/ui/thememanager.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 2 +- 7 files changed, 52 insertions(+), 28 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 0f546261f..5cbfea1df 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -193,16 +193,10 @@ def main(): qInitResources() # Now create and actually run the application. app = OpenLP(qt_args) - try: - a = app.run() - print a - except: - log.exception(u'it went bang') - - sys.exit(a) + sys.exit(app.run()) if __name__ == u'__main__': """ Instantiate and run the application. """ - main() \ No newline at end of file + main() diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index beec5389c..43db25d64 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -464,10 +464,11 @@ class Renderer(object): # now draw the text, and any outlines/shadows if self._theme.display_shadow: self._get_extent_and_render(line, footer, - tlcorner=(x + display_shadow_size, y + display_shadow_size), - draw=True, color = self._theme.display_shadow_color) - self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=True, - outline_size=display_outline_size) + tlcorner=(x + display_shadow_size, + y + display_shadow_size), + draw=True, color = self._theme.display_shadow_color) + self._get_extent_and_render(line, footer, tlcorner=(x, y), + draw=True, outline_size=display_outline_size) y += h if linenum == 0: self._first_line_right_extent = rightextent @@ -533,7 +534,7 @@ class Renderer(object): font = self.mainFont metrics = QtGui.QFontMetrics(font) w = metrics.width(line) - h = metrics.height() + h = metrics.height() + int(self._theme.font_main_line_adjustment) if draw: self.painter.setFont(font) if color is None: @@ -544,27 +545,29 @@ class Renderer(object): else: pen = QtGui.QColor(color) x, y = tlcorner + rowpos = y + metrics.ascent() if self._theme.display_outline and outline_size != 0 and not footer: path = QtGui.QPainterPath() - path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line) + path.addText(QtCore.QPointF(x, rowpos), font, line) self.painter.setBrush(self.painter.pen().brush()) self.painter.setPen(QtGui.QPen( QtGui.QColor(self._theme.display_outline_color), outline_size)) self.painter.drawPath(path) self.painter.setPen(pen) - self.painter.drawText(x, y + metrics.ascent(), line) + self.painter.drawText(x, rowpos, line) if self._theme.display_slideTransition: # Print 2nd image with 70% weight if self._theme.display_outline and outline_size != 0 and not footer: path = QtGui.QPainterPath() - path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line) + path.addText(QtCore.QPointF(x, rowpos), font, line) self.painter2.setBrush(self.painter2.pen().brush()) self.painter2.setPen(QtGui.QPen( - QtGui.QColor(self._theme.display_outline_color), outline_size)) + QtGui.QColor(self._theme.display_outline_color), + outline_size)) self.painter2.drawPath(path) self.painter2.setFont(font) self.painter2.setPen(pen) - self.painter2.drawText(x, y + metrics.ascent(), line) + self.painter2.drawText(x, rowpos, line) return (w, h) def snoop_Image(self, image, image2=None): diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index c30184328..a96cc7355 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -53,6 +53,7 @@ blankthemexml=\ Normal False 0 + 0 @@ -62,6 +63,7 @@ blankthemexml=\ Normal False 0 + 0 @@ -171,8 +173,8 @@ class ThemeXML(object): self.child_element(background, u'filename', filename) def add_font(self, name, color, proportion, override, fonttype=u'main', - weight=u'Normal', italics=u'False', indentation=0, xpos=0, ypos=0, - width=0, height=0): + weight=u'Normal', italics=u'False', indentation=0, line_adjustment=0, + xpos=0, ypos=0, width=0, height=0): """ Add a Font. @@ -227,6 +229,8 @@ class ThemeXML(object): self.child_element(background, u'italics', italics) #Create indentation name element self.child_element(background, u'indentation', unicode(indentation)) + #Create indentation name element + self.child_element(background, u'line_adjustment', unicode(line_adjustment)) #Create Location element element = self.theme_xml.createElement(u'location') diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index 65d675cd1..438542192 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -178,16 +178,24 @@ class Ui_AmendThemeDialog(object): self.FontMainWeightLabel.setObjectName("FontMainWeightLabel") self.MainFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontMainWeightLabel) self.MainLeftLayout.addWidget(self.FontMainGroupBox) + self.FontMainWrapLineAdjustmentLabel = QtGui.QLabel(self.FontMainGroupBox) + self.FontMainWrapLineAdjustmentLabel.setObjectName("FontMainWrapLineAdjustmentLabel") + self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapLineAdjustmentLabel) + self.FontMainLineAdjustmentSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) + self.FontMainLineAdjustmentSpinBox.setObjectName("FontMainLineAdjustmentSpinBox") + self.FontMainLineAdjustmentSpinBox.setMaximum(30) + self.FontMainLineAdjustmentSpinBox.setMinimum(-30) + self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineAdjustmentSpinBox) self.FontMainWrapIndentationLabel = QtGui.QLabel(self.FontMainGroupBox) self.FontMainWrapIndentationLabel.setObjectName("FontMainWrapIndentationLabel") - self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapIndentationLabel) + self.MainFontLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.FontMainWrapIndentationLabel) self.FontMainLineSpacingSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) self.FontMainLineSpacingSpinBox.setObjectName("FontMainLineSpacingSpinBox") self.FontMainLineSpacingSpinBox.setMaximum(10) - self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineSpacingSpinBox) + self.MainFontLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.FontMainLineSpacingSpinBox) self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox) self.FontMainLinesPageLabel.setObjectName("FontMainLinesPageLabel") - self.MainFontLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.FontMainLinesPageLabel) + self.MainFontLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.FontMainLinesPageLabel) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.MainLeftLayout.addItem(spacerItem1) self.FontMainLayout.addWidget(self.MainLeftWidget) @@ -620,6 +628,7 @@ class Ui_AmendThemeDialog(object): self.FontMainSize.setText(self.trUtf8('Size:')) self.FontMainSizeSpinBox.setSuffix(self.trUtf8('pt')) self.FontMainWrapIndentationLabel.setText(self.trUtf8('Wrap Indentation')) + self.FontMainWrapLineAdjustmentLabel.setText(self.trUtf8('Adjust Line Spacing')) self.FontMainWeightComboBox.setItemText(0, self.trUtf8('Normal')) self.FontMainWeightComboBox.setItemText(1, self.trUtf8('Bold')) self.FontMainWeightComboBox.setItemText(2, self.trUtf8('Italics')) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 03c2df3f5..c43d27cb5 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -101,6 +101,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.QObject.connect(self.FontMainHeightSpinBox, QtCore.SIGNAL(u'editingFinished()'), self.onFontMainHeightSpinBoxChanged) + QtCore.QObject.connect(self.FontMainLineAdjustmentSpinBox, + QtCore.SIGNAL(u'editingFinished()'), + self.onFontMainLineAdjustmentSpinBoxChanged) QtCore.QObject.connect(self.FontMainLineSpacingSpinBox, QtCore.SIGNAL(u'editingFinished()'), self.onFontMainLineSpacingSpinBoxChanged) @@ -163,6 +166,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.font_main_weight), unicode(self.theme.font_main_italics), unicode(self.theme.font_main_indentation), + unicode(self.theme.font_main_line_adjustment), unicode(self.theme.font_main_x), unicode(self.theme.font_main_y), unicode(self.theme.font_main_width), @@ -173,7 +177,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.font_footer_override), u'footer', unicode(self.theme.font_footer_weight), unicode(self.theme.font_footer_italics), - 0, + 0, # indentation + 0, # line adjustment unicode(self.theme.font_footer_x), unicode(self.theme.font_footer_y), unicode(self.theme.font_footer_width), @@ -261,6 +266,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.FontMainYSpinBox.setValue(self.theme.font_main_y) self.FontMainWidthSpinBox.setValue(self.theme.font_main_width) self.FontMainHeightSpinBox.setValue(self.theme.font_main_height) + self.FontMainLineAdjustmentSpinBox.setValue( + self.theme.font_main_line_adjustment) self.FontMainLineSpacingSpinBox.setValue( self.theme.font_main_indentation) self.stateChanging(self.theme) @@ -281,6 +288,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_main_width = self.FontMainWidthSpinBox.value() self.previewTheme() + def onFontMainLineAdjustmentSpinBoxChanged(self): + if self.theme.font_main_line_adjustment != \ + self.FontMainLineAdjustmentSpinBox.value(): + self.theme.font_main_line_adjustment = \ + self.FontMainLineAdjustmentSpinBox.value() + self.previewTheme() + def onFontMainLineSpacingSpinBoxChanged(self): if self.theme.font_main_indentation != \ self.FontMainLineSpacingSpinBox.value(): @@ -687,7 +701,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): if self.allowPreview: #calculate main number of rows metrics = self._getThemeMetrics() - line_height = metrics.height() + line_height = metrics.height() \ + + int(self.theme.font_main_line_adjustment) if self.theme.display_shadow: line_height += int(self.theme.display_shadow_size) if self.theme.display_outline: @@ -700,7 +715,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): page_length)) page_length_text = unicode(self.trUtf8('Slide Height is %s rows')) self.FontMainLinesPageLabel.setText(page_length_text % page_length) - #a=c frame = self.thememanager.generateImage(self.theme) self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index a651c6211..247dd8394 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -107,7 +107,7 @@ class ThemeManager(QtGui.QWidget): self.themelist = [] self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') self.checkThemesExists(self.path) - self.thumbPath = os.path.join(self.path, u'.thumbnails') + self.thumbPath = os.path.join(self.path, u'thumbnails') self.checkThemesExists(self.thumbPath) self.amendThemeForm.path = self.path # Last little bits of setting up diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 914a6ce20..9c19c8122 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -76,7 +76,7 @@ class ImageMediaItem(MediaManagerItem): QtGui.QAbstractItemView.ExtendedSelection) self.ListView.setIconSize(QtCore.QSize(88,50)) self.servicePath = os.path.join( - self.parent.config.get_data_path(), u'.thumbnails') + self.parent.config.get_data_path(), u'thumbnails') if not os.path.exists(self.servicePath): os.mkdir(self.servicePath) self.loadList(self.parent.config.load_list(self.ConfigSection)) From d7e060c503b0d87fe9d2ecbb06ed75bd88306a95 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 24 Apr 2010 19:42:01 +0100 Subject: [PATCH 03/24] Start to add ability to set display screen size for a session --- openlp/core/ui/amendthemedialog.py | 2 - openlp/core/ui/maindisplay.py | 14 +- openlp/core/ui/screen.py | 16 ++ openlp/core/ui/slidecontroller.py | 63 ++++--- openlp/plugins/display/__init__.py | 24 +++ openlp/plugins/display/displaysplugin.py | 117 +++++++++++++ openlp/plugins/display/forms/__init__.py | 26 +++ openlp/plugins/display/forms/displaydialog.py | 82 +++++++++ openlp/plugins/display/forms/displayform.py | 163 ++++++++++++++++++ resources/forms/displaydialog.ui | 151 ++++++++++++++++ 10 files changed, 630 insertions(+), 28 deletions(-) create mode 100644 openlp/plugins/display/__init__.py create mode 100644 openlp/plugins/display/displaysplugin.py create mode 100644 openlp/plugins/display/forms/__init__.py create mode 100644 openlp/plugins/display/forms/displaydialog.py create mode 100644 openlp/plugins/display/forms/displayform.py create mode 100644 resources/forms/displaydialog.ui diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index 438542192..c713eb608 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -183,8 +183,6 @@ class Ui_AmendThemeDialog(object): self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapLineAdjustmentLabel) self.FontMainLineAdjustmentSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) self.FontMainLineAdjustmentSpinBox.setObjectName("FontMainLineAdjustmentSpinBox") - self.FontMainLineAdjustmentSpinBox.setMaximum(30) - self.FontMainLineAdjustmentSpinBox.setMinimum(-30) self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineAdjustmentSpinBox) self.FontMainWrapIndentationLabel = QtGui.QLabel(self.FontMainGroupBox) self.FontMainWrapIndentationLabel.setObjectName("FontMainWrapIndentationLabel") diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 5e7071449..6dfa7a83c 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -137,6 +137,10 @@ class MainDisplay(DisplayWidget): QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'maindisplay_hide_theme'), self.hideThemeDisplay) +# QtCore.QObject.connect(Receiver.get_receiver(), +# QtCore.SIGNAL(u'maindisplay_show_theme'), self.showThemeDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'videodisplay_start'), self.hideDisplay) @@ -208,6 +212,14 @@ class MainDisplay(DisplayWidget): self.display_text.setPixmap(self.transparent) self.moveToTop() + def hideThemeDisplay(self): + log.debug(u'hideDisplay') + a=c + self.display_image.setPixmap(self.transparent) + self.display_alert.setPixmap(self.transparent) + self.display_text.setPixmap(self.transparent) + self.moveToTop() + def moveToTop(self): log.debug(u'moveToTop') self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint \ @@ -365,7 +377,7 @@ class VideoDisplay(Phonon.VideoWidget): def onMediaQueue(self, message): log.debug(u'VideoDisplay Queue new media message %s' % message) - file = os.path.join(message[0].get_frame_path(), + file = os.path.join(message[0].get_frame_path(), message[0].get_frame_title()) source = self.mediaObject.setCurrentSource(Phonon.MediaSource(file)) self.onMediaPlay() diff --git a/openlp/core/ui/screen.py b/openlp/core/ui/screen.py index 32cc5ba50..c498d46cb 100644 --- a/openlp/core/ui/screen.py +++ b/openlp/core/ui/screen.py @@ -64,7 +64,23 @@ class ScreenList(object): self.current_display = 0 else: self.current = self.screen_list[number] + self.override = self.current self.preview = self.current self.current_display = number if self.display_count == 1: self.preview = self.screen_list[0] + + def set_override_display(self): + """ + replace the current size with the override values + user wants to have their own screen attributes + """ + self.current = self.override + self.preview = self.current + + def reset_current(self): + """ + replace the current values with the correct values + user wants to use the correct screen attributes + """ + self.set_current_display(self.current_display) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 2b34a7c0d..a41c56387 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -234,6 +234,16 @@ class SlideController(QtGui.QWidget): self.Mediabar.addToolbarButton( u'Media Stop', u':/slides/media_playback_stop.png', self.trUtf8('Start playing media'), self.onMediaStop) + if self.isLive: + self.blankButton = self.Mediabar.addToolbarButton( + u'Blank Screen', u':/slides/slide_blank.png', + self.trUtf8('Blank Screen'), self.onBlankDisplay, True) + self.themeButton = self.Mediabar.addToolbarButton( + u'Display Theme', u':/slides/slide_theme.png', + self.trUtf8('Theme Screen'), self.onThemeDisplay, True) + self.hideButton = self.Mediabar.addToolbarButton( + u'Hide screen', u':/slides/slide_desktop.png', + self.trUtf8('Hide Screen'), self.onHideDisplay, True) if not self.isLive: self.seekSlider = Phonon.SeekSlider() self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) @@ -259,7 +269,7 @@ class SlideController(QtGui.QWidget): self.PreviewFrame = QtGui.QFrame(self.Splitter) self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225)) self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy( - QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Label)) self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken) @@ -316,26 +326,26 @@ class SlideController(QtGui.QWidget): QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.type_prefix), self.onStopLoop) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_first' % self.type_prefix), + QtCore.SIGNAL(u'slidecontroller_%s_first' % self.type_prefix), self.onSlideSelectedFirst) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_next' % self.type_prefix), + QtCore.SIGNAL(u'slidecontroller_%s_next' % self.type_prefix), self.onSlideSelectedNext) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.type_prefix), + QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.type_prefix), self.onSlideSelectedPrevious) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_next_noloop' % self.type_prefix), + QtCore.SIGNAL(u'slidecontroller_%s_next_noloop' % self.type_prefix), self.onSlideSelectedNextNoloop) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_previous_noloop' % + QtCore.SIGNAL(u'slidecontroller_%s_previous_noloop' % self.type_prefix), self.onSlideSelectedPreviousNoloop) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_last' % self.type_prefix), + QtCore.SIGNAL(u'slidecontroller_%s_last' % self.type_prefix), self.onSlideSelectedLast) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_change' % self.type_prefix), + QtCore.SIGNAL(u'slidecontroller_%s_change' % self.type_prefix), self.onSlideChange) QtCore.QObject.connect(self.Splitter, QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter) @@ -481,7 +491,7 @@ class SlideController(QtGui.QWidget): blanked = self.blankButton.isChecked() else: blanked = False - Receiver.send_message(u'%s_start' % serviceItem.name.lower(), + Receiver.send_message(u'%s_start' % serviceItem.name.lower(), [serviceItem, self.isLive, blanked, slideno]) self.slideList = {} width = self.parent.ControlSplitter.sizes()[self.split] @@ -554,9 +564,9 @@ class SlideController(QtGui.QWidget): self.enableToolBar(serviceItem) self.onSlideSelected() self.PreviewListWidget.setFocus() - Receiver.send_message(u'%s_%s_started' % - (self.serviceItem.name.lower(), - 'live' if self.isLive else 'preview'), + Receiver.send_message(u'%s_%s_started' % + (self.serviceItem.name.lower(), + 'live' if self.isLive else 'preview'), [serviceItem]) log.log(15, u'Display Rendering took %4s' % (time.time() - before)) @@ -567,7 +577,7 @@ class SlideController(QtGui.QWidget): """ if not self.serviceItem: return - Receiver.send_message(u'%s_first' % self.serviceItem.name.lower(), + Receiver.send_message(u'%s_first' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive]) if self.serviceItem.is_command(): self.updatePreview() @@ -593,7 +603,10 @@ class SlideController(QtGui.QWidget): log.debug(u'onThemeDisplay %d' % force) if force: self.themeButton.setChecked(True) - self.blankScreen(HideMode.Theme, self.themeButton.isChecked()) + if self.themeButton.isChecked(): + Receiver.send_message(u'maindisplay_show_theme') + else: + Receiver.send_message(u'maindisplay_hide_theme') def onHideDisplay(self, force=False): """ @@ -603,9 +616,9 @@ class SlideController(QtGui.QWidget): if force: self.hideButton.setChecked(True) if self.hideButton.isChecked(): - self.parent.mainDisplay.hideDisplay() + Receiver.send_message(u'maindisplay_hide') else: - self.parent.mainDisplay.showDisplay() + Receiver.send_message(u'maindisplay_show') def blankScreen(self, blankType, blanked=False): """ @@ -613,15 +626,15 @@ class SlideController(QtGui.QWidget): """ if self.serviceItem is not None: if blanked: - Receiver.send_message(u'%s_blank' % self.serviceItem.name.lower(), + Receiver.send_message(u'%s_blank' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive]) else: - Receiver.send_message(u'%s_unblank' - % self.serviceItem.name.lower(), + Receiver.send_message(u'%s_unblank' + % self.serviceItem.name.lower(), [self.serviceItem, self.isLive]) - self.parent.mainDisplay.blankDisplay(blankType, blanked) + self.parent.displayManager.mainDisplay.blankDisplay(blankType, blanked) else: - self.parent.mainDisplay.blankDisplay(blankType, blanked) + self.parent.displayManager.mainDisplay.blankDisplay(blankType, blanked) def onSlideSelected(self): """ @@ -685,7 +698,7 @@ class SlideController(QtGui.QWidget): """ if not self.serviceItem: return - Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(), + Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive]) if self.serviceItem.is_command(): self.updatePreview() @@ -709,7 +722,7 @@ class SlideController(QtGui.QWidget): """ if not self.serviceItem: return - Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(), + Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive]) if self.serviceItem.is_command(): self.updatePreview() @@ -729,7 +742,7 @@ class SlideController(QtGui.QWidget): """ if not self.serviceItem: return - Receiver.send_message(u'%s_last' % self.serviceItem.name.lower(), + Receiver.send_message(u'%s_last' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive]) if self.serviceItem.is_command(): self.updatePreview() @@ -775,7 +788,7 @@ class SlideController(QtGui.QWidget): def onMediaStart(self, item): if self.isLive: - Receiver.send_message(u'videodisplay_start', + Receiver.send_message(u'videodisplay_start', [item, self.blankButton.isChecked()]) else: self.mediaObject.stop() diff --git a/openlp/plugins/display/__init__.py b/openlp/plugins/display/__init__.py new file mode 100644 index 000000000..1a348a0df --- /dev/null +++ b/openlp/plugins/display/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # +# Thompson, Jon Tibble, Carsten Tinggaard # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### diff --git a/openlp/plugins/display/displaysplugin.py b/openlp/plugins/display/displaysplugin.py new file mode 100644 index 000000000..052b28b5e --- /dev/null +++ b/openlp/plugins/display/displaysplugin.py @@ -0,0 +1,117 @@ +from openlp.plugins.alerts.forms import AlertsTab, AlertForm# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # +# Thompson, Jon Tibble, Carsten Tinggaard # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from datetime import datetime +import logging + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import Plugin, Receiver, str_to_bool, build_icon +from openlp.plugins.display.forms import DisplayForm + +log = logging.getLogger(__name__) + +class DisplayPlugin(Plugin): + log.info(u'Display Plugin loaded') + + def __init__(self, plugin_helpers): + Plugin.__init__(self, u'Display', u'1.9.1', plugin_helpers) + self.weight = -2 + self.icon = build_icon(u':/media/media_image.png') + + def add_tools_menu_item(self, tools_menu): + """ + Give the Display plugin the opportunity to add items to the + **Tools** menu. + + ``tools_menu`` + The actual **Tools** menu item, so that your actions can + use it as their parent. + """ + log.info(u'add tools menu') + self.toolsMenu = tools_menu + self.DisplayMenu = QtGui.QMenu(tools_menu) + self.DisplayMenu.setObjectName(u'DisplayMenu') + self.DisplayMenu.setTitle(tools_menu.trUtf8('&Override Display')) + #Display Delete + self.DisplayOverride = QtGui.QAction(tools_menu) + self.DisplayOverride.setText( + tools_menu.trUtf8('&Change Display Attributes')) + self.DisplayOverride.setStatusTip( + tools_menu.trUtf8('Amend the display attributes')) + self.DisplayOverride.setObjectName(u'DisplayOverride') + #Display activation + DisplayIcon = build_icon(u':/tools/tools_alert.png') + self.DisplayStatus = QtGui.QAction(tools_menu) + self.DisplayStatus.setIcon(DisplayIcon) + self.DisplayStatus.setCheckable(True) + self.DisplayStatus.setChecked(False) + self.DisplayStatus.setText(tools_menu.trUtf8('Use Display Override')) + self.DisplayStatus.setStatusTip( + tools_menu.trUtf8('Change start/stop using Display Override')) + self.DisplayStatus.setShortcut(u'FX') + self.DisplayStatus.setObjectName(u'DisplayStatus') + #Add Menus together + self.toolsMenu.addAction(self.DisplayMenu.menuAction()) + self.DisplayMenu.addAction(self.DisplayStatus) + self.DisplayMenu.addSeparator() + self.DisplayMenu.addAction(self.DisplayOverride) + # Signals and slots + QtCore.QObject.connect(self.DisplayStatus, + QtCore.SIGNAL(u'visibilityChanged(bool)'), + self.DisplayStatus.setChecked) + QtCore.QObject.connect(self.DisplayStatus, + QtCore.SIGNAL(u'triggered(bool)'), + self.toggleDisplayState) + QtCore.QObject.connect(self.DisplayOverride, + QtCore.SIGNAL(u'triggered()'), self.onDisplayOverride) + self.DisplayMenu.menuAction().setVisible(False) + + def initialise(self): + log.info(u'Display Initialising') + Plugin.initialise(self) + self.DisplayStatus.setChecked(False) + self.screens = self.maindisplay.screens + self.displayform = DisplayForm(self, self.screens) + self.DisplayMenu.menuAction().setVisible(True) + + def finalise(self): + log.info(u'Plugin Finalise') + self.DisplayMenu.menuAction().setVisible(False) + + def toggleDisplayState(self): + Receiver.send_message(u'config_screen_changed') + + def onDisplayOverride(self): + self.displayform.initialise() + self.displayform.exec_() + if self.DisplayStatus.isChecked(): + Receiver.send_message(u'config_screen_changed') + + def about(self): + about_text = self.trUtf8('Display Plugin
This plugin ' + 'allows the dimensions of the live display to be changed.\n' + 'These changes are not stored.') + return about_text diff --git a/openlp/plugins/display/forms/__init__.py b/openlp/plugins/display/forms/__init__.py new file mode 100644 index 000000000..e6a60c3a2 --- /dev/null +++ b/openlp/plugins/display/forms/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # +# Thompson, Jon Tibble, Carsten Tinggaard # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from displayform import DisplayForm diff --git a/openlp/plugins/display/forms/displaydialog.py b/openlp/plugins/display/forms/displaydialog.py new file mode 100644 index 000000000..8c145b73f --- /dev/null +++ b/openlp/plugins/display/forms/displaydialog.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'displaydialog.ui' +# +# Created: Sat Apr 24 17:20:48 2010 +# by: PyQt4 UI code generator 4.7.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_DisplaysDialog(object): + def setupUi(self, DisplaysDialog): + DisplaysDialog.setObjectName("DisplaysDialog") + DisplaysDialog.resize(327, 224) + self.OkpushButton = QtGui.QPushButton(DisplaysDialog) + self.OkpushButton.setGeometry(QtCore.QRect(210, 200, 97, 24)) + self.OkpushButton.setObjectName("OkpushButton") + self.widget = QtGui.QWidget(DisplaysDialog) + self.widget.setGeometry(QtCore.QRect(10, 0, 301, 191)) + self.widget.setObjectName("widget") + self.verticalLayout = QtGui.QVBoxLayout(self.widget) + self.verticalLayout.setObjectName("verticalLayout") + self.CurrentGroupBox = QtGui.QGroupBox(self.widget) + self.CurrentGroupBox.setObjectName("CurrentGroupBox") + self.layoutWidget = QtGui.QWidget(self.CurrentGroupBox) + self.layoutWidget.setGeometry(QtCore.QRect(20, 30, 261, 17)) + self.layoutWidget.setObjectName("layoutWidget") + self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget) + self.horizontalLayout.setObjectName("horizontalLayout") + self.Xpos = QtGui.QLabel(self.layoutWidget) + self.Xpos.setAlignment(QtCore.Qt.AlignCenter) + self.Xpos.setObjectName("Xpos") + self.horizontalLayout.addWidget(self.Xpos) + self.Ypos = QtGui.QLabel(self.layoutWidget) + self.Ypos.setAlignment(QtCore.Qt.AlignCenter) + self.Ypos.setObjectName("Ypos") + self.horizontalLayout.addWidget(self.Ypos) + self.Height = QtGui.QLabel(self.layoutWidget) + self.Height.setAlignment(QtCore.Qt.AlignCenter) + self.Height.setObjectName("Height") + self.horizontalLayout.addWidget(self.Height) + self.Width = QtGui.QLabel(self.layoutWidget) + self.Width.setAlignment(QtCore.Qt.AlignCenter) + self.Width.setObjectName("Width") + self.horizontalLayout.addWidget(self.Width) + self.verticalLayout.addWidget(self.CurrentGroupBox) + self.CurrentGroupBox_2 = QtGui.QGroupBox(self.widget) + self.CurrentGroupBox_2.setObjectName("CurrentGroupBox_2") + self.layoutWidget1 = QtGui.QWidget(self.CurrentGroupBox_2) + self.layoutWidget1.setGeometry(QtCore.QRect(20, 30, 261, 27)) + self.layoutWidget1.setObjectName("layoutWidget1") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.layoutWidget1) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.XposEdit = QtGui.QLineEdit(self.layoutWidget1) + self.XposEdit.setObjectName("XposEdit") + self.horizontalLayout_2.addWidget(self.XposEdit) + self.YposEdit = QtGui.QLineEdit(self.layoutWidget1) + self.YposEdit.setObjectName("YposEdit") + self.horizontalLayout_2.addWidget(self.YposEdit) + self.HeightEdit = QtGui.QLineEdit(self.layoutWidget1) + self.HeightEdit.setObjectName("HeightEdit") + self.horizontalLayout_2.addWidget(self.HeightEdit) + self.WidthEdit = QtGui.QLineEdit(self.layoutWidget1) + self.WidthEdit.setObjectName("WidthEdit") + self.horizontalLayout_2.addWidget(self.WidthEdit) + self.verticalLayout.addWidget(self.CurrentGroupBox_2) + + self.retranslateUi(DisplaysDialog) + QtCore.QObject.connect(self.OkpushButton, QtCore.SIGNAL("pressed()"), DisplaysDialog.close) + QtCore.QMetaObject.connectSlotsByName(DisplaysDialog) + + def retranslateUi(self, DisplaysDialog): + DisplaysDialog.setWindowTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Display Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.OkpushButton.setText(QtGui.QApplication.translate("DisplaysDialog", "Ok", None, QtGui.QApplication.UnicodeUTF8)) + self.CurrentGroupBox.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Default Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.Xpos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.Ypos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.Height.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.Width.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.CurrentGroupBox_2.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Settings", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/openlp/plugins/display/forms/displayform.py b/openlp/plugins/display/forms/displayform.py new file mode 100644 index 000000000..cb6550a84 --- /dev/null +++ b/openlp/plugins/display/forms/displayform.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # +# Thompson, Jon Tibble, Carsten Tinggaard # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtGui, QtCore + +from openlp.plugins.alerts.lib.models import AlertItem + +from displaydialog import Ui_DisplaysDialog + +class DisplayForm(QtGui.QDialog, Ui_DisplaysDialog): + """ + Class documentation goes here. + """ + def __init__(self, parent, screens): + """ + Constructor + """ + self.parent = parent + self.screens = screens + self.item_id = None + QtGui.QDialog.__init__(self, None) + self.setupUi(self) +# QtCore.QObject.connect(self.DisplayButton, +# QtCore.SIGNAL(u'clicked()'), +# self.onDisplayClicked) +# QtCore.QObject.connect(self.DisplayCloseButton, +# QtCore.SIGNAL(u'clicked()'), +# self.onDisplayCloseClicked) +# QtCore.QObject.connect(self.AlertTextEdit, +# QtCore.SIGNAL(u'textChanged(const QString&)'), +# self.onTextChanged) +# QtCore.QObject.connect(self.NewButton, +# QtCore.SIGNAL(u'clicked()'), +# self.onNewClick) +# QtCore.QObject.connect(self.DeleteButton, +# QtCore.SIGNAL(u'clicked()'), +# self.onDeleteClick) +# QtCore.QObject.connect(self.SaveButton, +# QtCore.SIGNAL(u'clicked()'), +# self.onSaveClick) +# QtCore.QObject.connect(self.AlertListWidget, +# QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), +# self.onDoubleClick) +# QtCore.QObject.connect(self.AlertListWidget, +# QtCore.SIGNAL(u'clicked(QModelIndex)'), +# self.onSingleClick) + + def initialise(self): + self.Xpos.setText(unicode(self.screens.current[u'size'].x())) + self.Ypos.setText(unicode(self.screens.current[u'size'].y())) + self.Height.setText(unicode(self.screens.current[u'size'].height())) + self.Width.setText(unicode(self.screens.current[u'size'].width())) + self.XposEdit.setText(unicode(self.screens.override[u'size'].x())) + self.YposEdit.setText(unicode(self.screens.override[u'size'].y())) + self.HeightEdit.setText(unicode(self.screens.override[u'size'].height())) + self.WidthEdit.setText(unicode(self.screens.override[u'size'].width())) + + def close(self): + self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()),\ + int(self.YposEdit.text()), int(self.WidthEdit.text()),\ + int(self.HeightEdit.text())) + return QtGui.QDialog.close(self) + + def onDisplayClicked(self): + if self.triggerAlert(unicode(self.AlertTextEdit.text())): + self.loadList() + + def onDisplayCloseClicked(self): + if self.triggerAlert(unicode(self.AlertTextEdit.text())): + self.close() + + def onDeleteClick(self): + item = self.AlertListWidget.currentItem() + if item: + item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] + self.parent.manager.delete_alert(item_id) + row = self.AlertListWidget.row(item) + self.AlertListWidget.takeItem(row) + self.AlertTextEdit.setText(u'') + self.SaveButton.setEnabled(False) + self.DeleteButton.setEnabled(False) + self.EditButton.setEnabled(False) + + def onNewClick(self): + if len(self.AlertTextEdit.text()) == 0: + QtGui.QMessageBox.information(self, + self.trUtf8('Item selected to Add'), + self.trUtf8('Missing data')) + else: + alert = AlertItem() + alert.text = unicode(self.AlertTextEdit.text()) + self.manager.save_alert(alert) + self.AlertTextEdit.setText(u'') + self.loadList() + + def onSaveClick(self): + if self.item_id: + alert = self.manager.get_alert(self.item_id) + alert.text = unicode(self.AlertTextEdit.text()) + self.manager.save_alert(alert) + self.item_id = None + self.loadList() + else: + self.onNewClick() + + def onTextChanged(self): + #Data has changed by editing it so potential storage required + self.SaveButton.setEnabled(True) + + def onDoubleClick(self): + """ + List item has been double clicked to display it + """ + items = self.AlertListWidget.selectedIndexes() + for item in items: + bitem = self.AlertListWidget.item(item.row()) + self.triggerAlert(bitem.text()) + self.AlertTextEdit.setText(bitem.text()) + self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] + self.SaveButton.setEnabled(False) + self.DeleteButton.setEnabled(True) + + def onSingleClick(self): + """ + List item has been single clicked to add it to + the edit field so it can be changed. + """ + items = self.AlertListWidget.selectedIndexes() + for item in items: + bitem = self.AlertListWidget.item(item.row()) + self.AlertTextEdit.setText(bitem.text()) + self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] + self.SaveButton.setEnabled(False) + self.DeleteButton.setEnabled(True) + + def triggerAlert(self, text): + if text: + text = text.replace(u'<>', unicode(self.ParameterEdit.text())) + self.parent.alertsmanager.displayAlert(text) + return True + return False diff --git a/resources/forms/displaydialog.ui b/resources/forms/displaydialog.ui new file mode 100644 index 000000000..a8feb7842 --- /dev/null +++ b/resources/forms/displaydialog.ui @@ -0,0 +1,151 @@ + + + DisplaysDialog + + + + 0 + 0 + 327 + 224 + + + + Amend Display Settings + + + + + 210 + 200 + 97 + 24 + + + + Ok + + + + + + 10 + 0 + 301 + 191 + + + + + + + Default Settings + + + + + 20 + 30 + 261 + 17 + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + Amend Settings + + + + + 20 + 30 + 261 + 27 + + + + + + + + + + + + + + + + + + + + + + + + + + OkpushButton + pressed() + DisplaysDialog + close() + + + 258 + 211 + + + 163 + 111 + + + + + From b0763714c810ae12fbabe04e6dc6a5ec3ea0903e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 24 Apr 2010 20:57:29 +0100 Subject: [PATCH 04/24] Fix up object copy and get to work. --- openlp/core/ui/screen.py | 15 ++- openlp/plugins/display/displaysplugin.py | 5 + openlp/plugins/display/forms/displayform.py | 103 -------------------- 3 files changed, 15 insertions(+), 108 deletions(-) diff --git a/openlp/core/ui/screen.py b/openlp/core/ui/screen.py index c498d46cb..19c4e01b5 100644 --- a/openlp/core/ui/screen.py +++ b/openlp/core/ui/screen.py @@ -24,6 +24,7 @@ ############################################################################### import logging +import copy log = logging.getLogger(__name__) @@ -36,6 +37,7 @@ class ScreenList(object): def __init__(self): self.preview = None self.current = None + self.override = None self.screen_list = [] self.display_count = 0 #actual display number @@ -59,13 +61,14 @@ class ScreenList(object): """ Set up the current screen dimensions """ + log.debug(u'set_override_display %s', number, ) if number + 1 > self.display_count: self.current = self.screen_list[0] self.current_display = 0 else: self.current = self.screen_list[number] - self.override = self.current - self.preview = self.current + self.override = copy.deepcopy(self.current) + self.preview = copy.deepcopy(self.current) self.current_display = number if self.display_count == 1: self.preview = self.screen_list[0] @@ -75,12 +78,14 @@ class ScreenList(object): replace the current size with the override values user wants to have their own screen attributes """ - self.current = self.override - self.preview = self.current + log.debug(u'set_override_display') + self.current = copy.deepcopy(self.override) + self.preview = copy.deepcopy(self.current) - def reset_current(self): + def reset_current_display(self): """ replace the current values with the correct values user wants to use the correct screen attributes """ + log.debug(u'reset_current_display') self.set_current_display(self.current_display) diff --git a/openlp/plugins/display/displaysplugin.py b/openlp/plugins/display/displaysplugin.py index 052b28b5e..d55e1a27b 100644 --- a/openlp/plugins/display/displaysplugin.py +++ b/openlp/plugins/display/displaysplugin.py @@ -102,6 +102,11 @@ class DisplayPlugin(Plugin): self.DisplayMenu.menuAction().setVisible(False) def toggleDisplayState(self): + log.info(u'toggleDisplayState') + if self.DisplayStatus.isChecked(): + self.screens.set_override_display() + else: + self.screens.reset_current_display() Receiver.send_message(u'config_screen_changed') def onDisplayOverride(self): diff --git a/openlp/plugins/display/forms/displayform.py b/openlp/plugins/display/forms/displayform.py index cb6550a84..b1ae02b0a 100644 --- a/openlp/plugins/display/forms/displayform.py +++ b/openlp/plugins/display/forms/displayform.py @@ -42,30 +42,6 @@ class DisplayForm(QtGui.QDialog, Ui_DisplaysDialog): self.item_id = None QtGui.QDialog.__init__(self, None) self.setupUi(self) -# QtCore.QObject.connect(self.DisplayButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onDisplayClicked) -# QtCore.QObject.connect(self.DisplayCloseButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onDisplayCloseClicked) -# QtCore.QObject.connect(self.AlertTextEdit, -# QtCore.SIGNAL(u'textChanged(const QString&)'), -# self.onTextChanged) -# QtCore.QObject.connect(self.NewButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onNewClick) -# QtCore.QObject.connect(self.DeleteButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onDeleteClick) -# QtCore.QObject.connect(self.SaveButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onSaveClick) -# QtCore.QObject.connect(self.AlertListWidget, -# QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), -# self.onDoubleClick) -# QtCore.QObject.connect(self.AlertListWidget, -# QtCore.SIGNAL(u'clicked(QModelIndex)'), -# self.onSingleClick) def initialise(self): self.Xpos.setText(unicode(self.screens.current[u'size'].x())) @@ -82,82 +58,3 @@ class DisplayForm(QtGui.QDialog, Ui_DisplaysDialog): int(self.YposEdit.text()), int(self.WidthEdit.text()),\ int(self.HeightEdit.text())) return QtGui.QDialog.close(self) - - def onDisplayClicked(self): - if self.triggerAlert(unicode(self.AlertTextEdit.text())): - self.loadList() - - def onDisplayCloseClicked(self): - if self.triggerAlert(unicode(self.AlertTextEdit.text())): - self.close() - - def onDeleteClick(self): - item = self.AlertListWidget.currentItem() - if item: - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] - self.parent.manager.delete_alert(item_id) - row = self.AlertListWidget.row(item) - self.AlertListWidget.takeItem(row) - self.AlertTextEdit.setText(u'') - self.SaveButton.setEnabled(False) - self.DeleteButton.setEnabled(False) - self.EditButton.setEnabled(False) - - def onNewClick(self): - if len(self.AlertTextEdit.text()) == 0: - QtGui.QMessageBox.information(self, - self.trUtf8('Item selected to Add'), - self.trUtf8('Missing data')) - else: - alert = AlertItem() - alert.text = unicode(self.AlertTextEdit.text()) - self.manager.save_alert(alert) - self.AlertTextEdit.setText(u'') - self.loadList() - - def onSaveClick(self): - if self.item_id: - alert = self.manager.get_alert(self.item_id) - alert.text = unicode(self.AlertTextEdit.text()) - self.manager.save_alert(alert) - self.item_id = None - self.loadList() - else: - self.onNewClick() - - def onTextChanged(self): - #Data has changed by editing it so potential storage required - self.SaveButton.setEnabled(True) - - def onDoubleClick(self): - """ - List item has been double clicked to display it - """ - items = self.AlertListWidget.selectedIndexes() - for item in items: - bitem = self.AlertListWidget.item(item.row()) - self.triggerAlert(bitem.text()) - self.AlertTextEdit.setText(bitem.text()) - self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] - self.SaveButton.setEnabled(False) - self.DeleteButton.setEnabled(True) - - def onSingleClick(self): - """ - List item has been single clicked to add it to - the edit field so it can be changed. - """ - items = self.AlertListWidget.selectedIndexes() - for item in items: - bitem = self.AlertListWidget.item(item.row()) - self.AlertTextEdit.setText(bitem.text()) - self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] - self.SaveButton.setEnabled(False) - self.DeleteButton.setEnabled(True) - - def triggerAlert(self, text): - if text: - text = text.replace(u'<>', unicode(self.ParameterEdit.text())) - self.parent.alertsmanager.displayAlert(text) - return True - return False From d0c6cf96394021bb3370b9478d76cb430996068b Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 27 Apr 2010 20:59:44 +0100 Subject: [PATCH 05/24] move display to core --- openlp/core/ui/__init__.py | 1 + openlp/core/ui/generaltab.py | 2 +- openlp/core/ui/maindisplay.py | 3 +- openlp/core/ui/screen.py | 4 + openlp/core/ui/settingsform.py | 5 +- openlp/plugins/display/forms/displayform.py | 3 +- resources/forms/displaydialog.ui | 151 ---------- resources/forms/displaytab.ui | 295 ++++++++++++++++++++ 8 files changed, 309 insertions(+), 155 deletions(-) delete mode 100644 resources/forms/displaydialog.ui create mode 100644 resources/forms/displaytab.ui diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 675c57476..0c1ec731a 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -33,6 +33,7 @@ from maindisplay import DisplayManager from amendthemeform import AmendThemeForm from slidecontroller import SlideController from splashscreen import SplashScreen +from displaytab import DisplayTab from generaltab import GeneralTab from themestab import ThemesTab from aboutform import AboutForm diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index f7e87e879..75e06d691 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -172,7 +172,7 @@ class GeneralTab(SettingsTab): def retranslateUi(self): self.MonitorGroupBox.setTitle(self.trUtf8('Monitors')) self.MonitorLabel.setText(self.trUtf8('Select monitor for output display:')) - self.DisplayOnMonitorCheck.setText(self.trUtf8('Display if in single screen')) + self.DisplayOnMonitorCheck.setText(self.trUtf8('Display if a single screen')) self.StartupGroupBox.setTitle(self.trUtf8('Application Startup')) self.WarningCheckBox.setText(self.trUtf8('Show blank screen warning')) self.AutoOpenCheckBox.setText(self.trUtf8('Automatically open the last service')) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 6dfa7a83c..85db0ed12 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -214,7 +214,6 @@ class MainDisplay(DisplayWidget): def hideThemeDisplay(self): log.debug(u'hideDisplay') - a=c self.display_image.setPixmap(self.transparent) self.display_alert.setPixmap(self.transparent) self.display_text.setPixmap(self.transparent) @@ -336,6 +335,8 @@ class VideoDisplay(Phonon.VideoWidget): self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory) Phonon.createPath(self.mediaObject, self) Phonon.createPath(self.mediaObject, self.audioObject) + self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint \ + | QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'videodisplay_start'), self.onMediaQueue) QtCore.QObject.connect(Receiver.get_receiver(), diff --git a/openlp/core/ui/screen.py b/openlp/core/ui/screen.py index 19c4e01b5..0c8679205 100644 --- a/openlp/core/ui/screen.py +++ b/openlp/core/ui/screen.py @@ -80,6 +80,10 @@ class ScreenList(object): """ log.debug(u'set_override_display') self.current = copy.deepcopy(self.override) + print self.screen_list + print self.current + self.current[u'primary'] = True + print self.current self.preview = copy.deepcopy(self.current) def reset_current_display(self): diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index c86525a54..f923c9d7d 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -27,7 +27,7 @@ import logging from PyQt4 import QtGui -from openlp.core.ui import GeneralTab, ThemesTab +from openlp.core.ui import GeneralTab, ThemesTab, DisplayTab from settingsdialog import Ui_SettingsDialog log = logging.getLogger(__name__) @@ -43,6 +43,9 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): # Themes tab self.ThemesTab = ThemesTab(mainWindow) self.addTab(u'Themes', self.ThemesTab) + # Display tab + self.DisplayTab = DisplayTab(screens) + self.addTab(u'Display', self.DisplayTab) def addTab(self, name, tab): log.info(u'Adding %s tab' % tab.tabTitle) diff --git a/openlp/plugins/display/forms/displayform.py b/openlp/plugins/display/forms/displayform.py index b1ae02b0a..a7fa60b6e 100644 --- a/openlp/plugins/display/forms/displayform.py +++ b/openlp/plugins/display/forms/displayform.py @@ -44,7 +44,8 @@ class DisplayForm(QtGui.QDialog, Ui_DisplaysDialog): self.setupUi(self) def initialise(self): - self.Xpos.setText(unicode(self.screens.current[u'size'].x())) + xpos = int(self.config.get_config(u'x position', unicode(self.screens.current[u'size'].x()))) + self.Xpos.setText(xpos) self.Ypos.setText(unicode(self.screens.current[u'size'].y())) self.Height.setText(unicode(self.screens.current[u'size'].height())) self.Width.setText(unicode(self.screens.current[u'size'].width())) diff --git a/resources/forms/displaydialog.ui b/resources/forms/displaydialog.ui deleted file mode 100644 index a8feb7842..000000000 --- a/resources/forms/displaydialog.ui +++ /dev/null @@ -1,151 +0,0 @@ - - - DisplaysDialog - - - - 0 - 0 - 327 - 224 - - - - Amend Display Settings - - - - - 210 - 200 - 97 - 24 - - - - Ok - - - - - - 10 - 0 - 301 - 191 - - - - - - - Default Settings - - - - - 20 - 30 - 261 - 17 - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - - - - - Amend Settings - - - - - 20 - 30 - 261 - 27 - - - - - - - - - - - - - - - - - - - - - - - - - - OkpushButton - pressed() - DisplaysDialog - close() - - - 258 - 211 - - - 163 - 111 - - - - - diff --git a/resources/forms/displaytab.ui b/resources/forms/displaytab.ui new file mode 100644 index 000000000..7d2d78798 --- /dev/null +++ b/resources/forms/displaytab.ui @@ -0,0 +1,295 @@ + + + DisplaysDialog + + + + 0 + 0 + 620 + 716 + + + + Amend Display Settings + + + + + 0 + 40 + 241 + 79 + + + + + + + Default Settings + + + + + + + + X + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + Y + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + + 100 + 16777215 + + + + Height + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + Width + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + + + + 0 + 130 + 248 + 87 + + + + + 500 + 16777215 + + + + Amend Settings + + + + + + + + X + + + Qt::AlignCenter + + + + + + + + 50 + 16777215 + + + + 4 + + + + + + + + + + + Y + + + Qt::AlignCenter + + + + + + + + 50 + 16777215 + + + + 4 + + + + + + + + + + + Height + + + Qt::AlignCenter + + + + + + + + 50 + 16777215 + + + + 4 + + + + + + + + + QLayout::SetMinimumSize + + + + + + 100 + 16777215 + + + + Width + + + Qt::AlignCenter + + + + + + + + 60 + 16777215 + + + + + + + + layoutWidget + YAmendLabel + HeightAmendLabel + WidthAmendLabel + YAmendLabel + + + + + 0 + 10 + 191 + 23 + + + + Override Output Display + + + + + + From 17ee4f00facaec1fa6d057a7fae0680ecdb59723 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 28 Apr 2010 17:41:04 +0100 Subject: [PATCH 06/24] remove plugin --- openlp/core/ui/screen.py | 4 - openlp/plugins/display/__init__.py | 24 ---- openlp/plugins/display/displaysplugin.py | 122 ------------------ openlp/plugins/display/forms/__init__.py | 26 ---- openlp/plugins/display/forms/displaydialog.py | 82 ------------ openlp/plugins/display/forms/displayform.py | 61 --------- 6 files changed, 319 deletions(-) delete mode 100644 openlp/plugins/display/__init__.py delete mode 100644 openlp/plugins/display/displaysplugin.py delete mode 100644 openlp/plugins/display/forms/__init__.py delete mode 100644 openlp/plugins/display/forms/displaydialog.py delete mode 100644 openlp/plugins/display/forms/displayform.py diff --git a/openlp/core/ui/screen.py b/openlp/core/ui/screen.py index 0c8679205..19c4e01b5 100644 --- a/openlp/core/ui/screen.py +++ b/openlp/core/ui/screen.py @@ -80,10 +80,6 @@ class ScreenList(object): """ log.debug(u'set_override_display') self.current = copy.deepcopy(self.override) - print self.screen_list - print self.current - self.current[u'primary'] = True - print self.current self.preview = copy.deepcopy(self.current) def reset_current_display(self): diff --git a/openlp/plugins/display/__init__.py b/openlp/plugins/display/__init__.py deleted file mode 100644 index 1a348a0df..000000000 --- a/openlp/plugins/display/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### diff --git a/openlp/plugins/display/displaysplugin.py b/openlp/plugins/display/displaysplugin.py deleted file mode 100644 index d55e1a27b..000000000 --- a/openlp/plugins/display/displaysplugin.py +++ /dev/null @@ -1,122 +0,0 @@ -from openlp.plugins.alerts.forms import AlertsTab, AlertForm# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -from datetime import datetime -import logging - -from PyQt4 import QtCore, QtGui - -from openlp.core.lib import Plugin, Receiver, str_to_bool, build_icon -from openlp.plugins.display.forms import DisplayForm - -log = logging.getLogger(__name__) - -class DisplayPlugin(Plugin): - log.info(u'Display Plugin loaded') - - def __init__(self, plugin_helpers): - Plugin.__init__(self, u'Display', u'1.9.1', plugin_helpers) - self.weight = -2 - self.icon = build_icon(u':/media/media_image.png') - - def add_tools_menu_item(self, tools_menu): - """ - Give the Display plugin the opportunity to add items to the - **Tools** menu. - - ``tools_menu`` - The actual **Tools** menu item, so that your actions can - use it as their parent. - """ - log.info(u'add tools menu') - self.toolsMenu = tools_menu - self.DisplayMenu = QtGui.QMenu(tools_menu) - self.DisplayMenu.setObjectName(u'DisplayMenu') - self.DisplayMenu.setTitle(tools_menu.trUtf8('&Override Display')) - #Display Delete - self.DisplayOverride = QtGui.QAction(tools_menu) - self.DisplayOverride.setText( - tools_menu.trUtf8('&Change Display Attributes')) - self.DisplayOverride.setStatusTip( - tools_menu.trUtf8('Amend the display attributes')) - self.DisplayOverride.setObjectName(u'DisplayOverride') - #Display activation - DisplayIcon = build_icon(u':/tools/tools_alert.png') - self.DisplayStatus = QtGui.QAction(tools_menu) - self.DisplayStatus.setIcon(DisplayIcon) - self.DisplayStatus.setCheckable(True) - self.DisplayStatus.setChecked(False) - self.DisplayStatus.setText(tools_menu.trUtf8('Use Display Override')) - self.DisplayStatus.setStatusTip( - tools_menu.trUtf8('Change start/stop using Display Override')) - self.DisplayStatus.setShortcut(u'FX') - self.DisplayStatus.setObjectName(u'DisplayStatus') - #Add Menus together - self.toolsMenu.addAction(self.DisplayMenu.menuAction()) - self.DisplayMenu.addAction(self.DisplayStatus) - self.DisplayMenu.addSeparator() - self.DisplayMenu.addAction(self.DisplayOverride) - # Signals and slots - QtCore.QObject.connect(self.DisplayStatus, - QtCore.SIGNAL(u'visibilityChanged(bool)'), - self.DisplayStatus.setChecked) - QtCore.QObject.connect(self.DisplayStatus, - QtCore.SIGNAL(u'triggered(bool)'), - self.toggleDisplayState) - QtCore.QObject.connect(self.DisplayOverride, - QtCore.SIGNAL(u'triggered()'), self.onDisplayOverride) - self.DisplayMenu.menuAction().setVisible(False) - - def initialise(self): - log.info(u'Display Initialising') - Plugin.initialise(self) - self.DisplayStatus.setChecked(False) - self.screens = self.maindisplay.screens - self.displayform = DisplayForm(self, self.screens) - self.DisplayMenu.menuAction().setVisible(True) - - def finalise(self): - log.info(u'Plugin Finalise') - self.DisplayMenu.menuAction().setVisible(False) - - def toggleDisplayState(self): - log.info(u'toggleDisplayState') - if self.DisplayStatus.isChecked(): - self.screens.set_override_display() - else: - self.screens.reset_current_display() - Receiver.send_message(u'config_screen_changed') - - def onDisplayOverride(self): - self.displayform.initialise() - self.displayform.exec_() - if self.DisplayStatus.isChecked(): - Receiver.send_message(u'config_screen_changed') - - def about(self): - about_text = self.trUtf8('Display Plugin
This plugin ' - 'allows the dimensions of the live display to be changed.\n' - 'These changes are not stored.') - return about_text diff --git a/openlp/plugins/display/forms/__init__.py b/openlp/plugins/display/forms/__init__.py deleted file mode 100644 index e6a60c3a2..000000000 --- a/openlp/plugins/display/forms/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -from displayform import DisplayForm diff --git a/openlp/plugins/display/forms/displaydialog.py b/openlp/plugins/display/forms/displaydialog.py deleted file mode 100644 index 8c145b73f..000000000 --- a/openlp/plugins/display/forms/displaydialog.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'displaydialog.ui' -# -# Created: Sat Apr 24 17:20:48 2010 -# by: PyQt4 UI code generator 4.7.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -class Ui_DisplaysDialog(object): - def setupUi(self, DisplaysDialog): - DisplaysDialog.setObjectName("DisplaysDialog") - DisplaysDialog.resize(327, 224) - self.OkpushButton = QtGui.QPushButton(DisplaysDialog) - self.OkpushButton.setGeometry(QtCore.QRect(210, 200, 97, 24)) - self.OkpushButton.setObjectName("OkpushButton") - self.widget = QtGui.QWidget(DisplaysDialog) - self.widget.setGeometry(QtCore.QRect(10, 0, 301, 191)) - self.widget.setObjectName("widget") - self.verticalLayout = QtGui.QVBoxLayout(self.widget) - self.verticalLayout.setObjectName("verticalLayout") - self.CurrentGroupBox = QtGui.QGroupBox(self.widget) - self.CurrentGroupBox.setObjectName("CurrentGroupBox") - self.layoutWidget = QtGui.QWidget(self.CurrentGroupBox) - self.layoutWidget.setGeometry(QtCore.QRect(20, 30, 261, 17)) - self.layoutWidget.setObjectName("layoutWidget") - self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget) - self.horizontalLayout.setObjectName("horizontalLayout") - self.Xpos = QtGui.QLabel(self.layoutWidget) - self.Xpos.setAlignment(QtCore.Qt.AlignCenter) - self.Xpos.setObjectName("Xpos") - self.horizontalLayout.addWidget(self.Xpos) - self.Ypos = QtGui.QLabel(self.layoutWidget) - self.Ypos.setAlignment(QtCore.Qt.AlignCenter) - self.Ypos.setObjectName("Ypos") - self.horizontalLayout.addWidget(self.Ypos) - self.Height = QtGui.QLabel(self.layoutWidget) - self.Height.setAlignment(QtCore.Qt.AlignCenter) - self.Height.setObjectName("Height") - self.horizontalLayout.addWidget(self.Height) - self.Width = QtGui.QLabel(self.layoutWidget) - self.Width.setAlignment(QtCore.Qt.AlignCenter) - self.Width.setObjectName("Width") - self.horizontalLayout.addWidget(self.Width) - self.verticalLayout.addWidget(self.CurrentGroupBox) - self.CurrentGroupBox_2 = QtGui.QGroupBox(self.widget) - self.CurrentGroupBox_2.setObjectName("CurrentGroupBox_2") - self.layoutWidget1 = QtGui.QWidget(self.CurrentGroupBox_2) - self.layoutWidget1.setGeometry(QtCore.QRect(20, 30, 261, 27)) - self.layoutWidget1.setObjectName("layoutWidget1") - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.layoutWidget1) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.XposEdit = QtGui.QLineEdit(self.layoutWidget1) - self.XposEdit.setObjectName("XposEdit") - self.horizontalLayout_2.addWidget(self.XposEdit) - self.YposEdit = QtGui.QLineEdit(self.layoutWidget1) - self.YposEdit.setObjectName("YposEdit") - self.horizontalLayout_2.addWidget(self.YposEdit) - self.HeightEdit = QtGui.QLineEdit(self.layoutWidget1) - self.HeightEdit.setObjectName("HeightEdit") - self.horizontalLayout_2.addWidget(self.HeightEdit) - self.WidthEdit = QtGui.QLineEdit(self.layoutWidget1) - self.WidthEdit.setObjectName("WidthEdit") - self.horizontalLayout_2.addWidget(self.WidthEdit) - self.verticalLayout.addWidget(self.CurrentGroupBox_2) - - self.retranslateUi(DisplaysDialog) - QtCore.QObject.connect(self.OkpushButton, QtCore.SIGNAL("pressed()"), DisplaysDialog.close) - QtCore.QMetaObject.connectSlotsByName(DisplaysDialog) - - def retranslateUi(self, DisplaysDialog): - DisplaysDialog.setWindowTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Display Settings", None, QtGui.QApplication.UnicodeUTF8)) - self.OkpushButton.setText(QtGui.QApplication.translate("DisplaysDialog", "Ok", None, QtGui.QApplication.UnicodeUTF8)) - self.CurrentGroupBox.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Default Settings", None, QtGui.QApplication.UnicodeUTF8)) - self.Xpos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) - self.Ypos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) - self.Height.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) - self.Width.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) - self.CurrentGroupBox_2.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Settings", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/openlp/plugins/display/forms/displayform.py b/openlp/plugins/display/forms/displayform.py deleted file mode 100644 index a7fa60b6e..000000000 --- a/openlp/plugins/display/forms/displayform.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -from PyQt4 import QtGui, QtCore - -from openlp.plugins.alerts.lib.models import AlertItem - -from displaydialog import Ui_DisplaysDialog - -class DisplayForm(QtGui.QDialog, Ui_DisplaysDialog): - """ - Class documentation goes here. - """ - def __init__(self, parent, screens): - """ - Constructor - """ - self.parent = parent - self.screens = screens - self.item_id = None - QtGui.QDialog.__init__(self, None) - self.setupUi(self) - - def initialise(self): - xpos = int(self.config.get_config(u'x position', unicode(self.screens.current[u'size'].x()))) - self.Xpos.setText(xpos) - self.Ypos.setText(unicode(self.screens.current[u'size'].y())) - self.Height.setText(unicode(self.screens.current[u'size'].height())) - self.Width.setText(unicode(self.screens.current[u'size'].width())) - self.XposEdit.setText(unicode(self.screens.override[u'size'].x())) - self.YposEdit.setText(unicode(self.screens.override[u'size'].y())) - self.HeightEdit.setText(unicode(self.screens.override[u'size'].height())) - self.WidthEdit.setText(unicode(self.screens.override[u'size'].width())) - - def close(self): - self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()),\ - int(self.YposEdit.text()), int(self.WidthEdit.text()),\ - int(self.HeightEdit.text())) - return QtGui.QDialog.close(self) From d19d3eb213e60a417fec21b0b7adb30b60f450df Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 28 Apr 2010 18:00:05 +0100 Subject: [PATCH 07/24] Fix video display --- openlp/core/ui/maindisplay.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 85db0ed12..319a7da92 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -335,7 +335,7 @@ class VideoDisplay(Phonon.VideoWidget): self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory) Phonon.createPath(self.mediaObject, self) Phonon.createPath(self.mediaObject, self.audioObject) - self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint \ + self.setWindowFlags(QtCore.Qt.WindowStaysOnBottomHint \ | QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'videodisplay_start'), self.onMediaQueue) @@ -347,6 +347,7 @@ class VideoDisplay(Phonon.VideoWidget): QtCore.SIGNAL(u'videodisplay_stop'), self.onMediaStop) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.setup) + self.setVisible(False) def keyPressEvent(self, event): if type(event) == QtGui.QKeyEvent: @@ -364,12 +365,11 @@ class VideoDisplay(Phonon.VideoWidget): """ log.debug(u'VideoDisplay Setup %s for %s ' %(self.screens, self.screens.monitor_number)) - self.setVisible(False) self.screen = self.screens.current #Sort out screen locations and sizes self.setGeometry(self.screen[u'size']) # To display or not to display? - if not self.screen[u'primary']: + if not self.screen[u'primary'] and self.isVisible(): self.showFullScreen() self.primary = False else: @@ -403,3 +403,4 @@ class VideoDisplay(Phonon.VideoWidget): log.debug(u'VideoDisplay Reached end of media playlist') self.mediaObject.clearQueue() self.setVisible(False) + From 92ef8471b03a69a0204bc1cc9029af1d604ffc96 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 28 Apr 2010 19:17:51 +0100 Subject: [PATCH 08/24] Add new tab for display sizing --- openlp/core/ui/displaytab.py | 235 ++++++++++++++++++++++++++++++++++ resources/forms/displaytab.py | 150 ++++++++++++++++++++++ 2 files changed, 385 insertions(+) create mode 100644 openlp/core/ui/displaytab.py create mode 100644 resources/forms/displaytab.py diff --git a/openlp/core/ui/displaytab.py b/openlp/core/ui/displaytab.py new file mode 100644 index 000000000..38a0baa91 --- /dev/null +++ b/openlp/core/ui/displaytab.py @@ -0,0 +1,235 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # +# Thompson, Jon Tibble, Carsten Tinggaard # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtGui, QtCore + +from openlp.core.lib import SettingsTab, Receiver + +class DisplayTab(SettingsTab): + """ + Class documentation goes here. + """ + def __init__(self, screens): + """ + Constructor + """ + self.screens = screens + SettingsTab.__init__(self, u'Display') + + def setupUi(self): + self.tabTitleVisible = self.trUtf8('Displays') + self.layoutWidget = QtGui.QWidget(self) + self.layoutWidget.setGeometry(QtCore.QRect(0, 40, 241, 79)) + self.layoutWidget.setObjectName("layoutWidget") + self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) + self.verticalLayout.setObjectName("verticalLayout") + self.CurrentGroupBox = QtGui.QGroupBox(self.layoutWidget) + self.CurrentGroupBox.setObjectName("CurrentGroupBox") + self.horizontalLayout = QtGui.QHBoxLayout(self.CurrentGroupBox) + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout_6 = QtGui.QVBoxLayout() + self.verticalLayout_6.setObjectName("verticalLayout_6") + self.XLabel = QtGui.QLabel(self.CurrentGroupBox) + self.XLabel.setAlignment(QtCore.Qt.AlignCenter) + self.XLabel.setObjectName("XLabel") + self.verticalLayout_6.addWidget(self.XLabel) + self.Xpos = QtGui.QLabel(self.CurrentGroupBox) + self.Xpos.setAlignment(QtCore.Qt.AlignCenter) + self.Xpos.setObjectName("Xpos") + self.verticalLayout_6.addWidget(self.Xpos) + self.horizontalLayout.addLayout(self.verticalLayout_6) + self.verticalLayout_7 = QtGui.QVBoxLayout() + self.verticalLayout_7.setObjectName("verticalLayout_7") + self.YLabel = QtGui.QLabel(self.CurrentGroupBox) + self.YLabel.setAlignment(QtCore.Qt.AlignCenter) + self.YLabel.setObjectName("YLabel") + self.verticalLayout_7.addWidget(self.YLabel) + self.Ypos = QtGui.QLabel(self.CurrentGroupBox) + self.Ypos.setAlignment(QtCore.Qt.AlignCenter) + self.Ypos.setObjectName("Ypos") + self.verticalLayout_7.addWidget(self.Ypos) + self.horizontalLayout.addLayout(self.verticalLayout_7) + self.verticalLayout_9 = QtGui.QVBoxLayout() + self.verticalLayout_9.setObjectName("verticalLayout_9") + self.HeightLabel = QtGui.QLabel(self.CurrentGroupBox) + self.HeightLabel.setMaximumSize(QtCore.QSize(100, 16777215)) + self.HeightLabel.setAlignment(QtCore.Qt.AlignCenter) + self.HeightLabel.setObjectName("HeightLabel") + self.verticalLayout_9.addWidget(self.HeightLabel) + self.Height = QtGui.QLabel(self.CurrentGroupBox) + self.Height.setAlignment(QtCore.Qt.AlignCenter) + self.Height.setObjectName("Height") + self.verticalLayout_9.addWidget(self.Height) + self.horizontalLayout.addLayout(self.verticalLayout_9) + self.verticalLayout_8 = QtGui.QVBoxLayout() + self.verticalLayout_8.setObjectName("verticalLayout_8") + self.WidthLabel = QtGui.QLabel(self.CurrentGroupBox) + self.WidthLabel.setAlignment(QtCore.Qt.AlignCenter) + self.WidthLabel.setObjectName("WidthLabel") + self.verticalLayout_8.addWidget(self.WidthLabel) + self.Width = QtGui.QLabel(self.CurrentGroupBox) + self.Width.setAlignment(QtCore.Qt.AlignCenter) + self.Width.setObjectName("Width") + self.verticalLayout_8.addWidget(self.Width) + self.horizontalLayout.addLayout(self.verticalLayout_8) + self.verticalLayout.addWidget(self.CurrentGroupBox) + self.CurrentGroupBox_2 = QtGui.QGroupBox(self) + self.CurrentGroupBox_2.setGeometry(QtCore.QRect(0, 130, 248, 87)) + self.CurrentGroupBox_2.setMaximumSize(QtCore.QSize(500, 16777215)) + self.CurrentGroupBox_2.setObjectName("CurrentGroupBox_2") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.CurrentGroupBox_2) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.XAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) + self.XAmendLabel.setAlignment(QtCore.Qt.AlignCenter) + self.XAmendLabel.setObjectName("XAmendLabel") + self.verticalLayout_2.addWidget(self.XAmendLabel) + self.XposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) + self.XposEdit.setMaximumSize(QtCore.QSize(50, 16777215)) + self.XposEdit.setMaxLength(4) + self.XposEdit.setObjectName("XposEdit") + self.verticalLayout_2.addWidget(self.XposEdit) + self.horizontalLayout_2.addLayout(self.verticalLayout_2) + self.verticalLayout_3 = QtGui.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.YAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) + self.YAmendLabel.setAlignment(QtCore.Qt.AlignCenter) + self.YAmendLabel.setObjectName("YAmendLabel") + self.verticalLayout_3.addWidget(self.YAmendLabel) + self.YposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) + self.YposEdit.setMaximumSize(QtCore.QSize(50, 16777215)) + self.YposEdit.setMaxLength(4) + self.YposEdit.setObjectName("YposEdit") + self.verticalLayout_3.addWidget(self.YposEdit) + self.horizontalLayout_2.addLayout(self.verticalLayout_3) + self.verticalLayout_4 = QtGui.QVBoxLayout() + self.verticalLayout_4.setObjectName("verticalLayout_4") + self.HeightAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) + self.HeightAmendLabel.setAlignment(QtCore.Qt.AlignCenter) + self.HeightAmendLabel.setObjectName("HeightAmendLabel") + self.verticalLayout_4.addWidget(self.HeightAmendLabel) + self.HeightEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) + self.HeightEdit.setMaximumSize(QtCore.QSize(50, 16777215)) + self.HeightEdit.setMaxLength(4) + self.HeightEdit.setObjectName("HeightEdit") + self.verticalLayout_4.addWidget(self.HeightEdit) + self.horizontalLayout_2.addLayout(self.verticalLayout_4) + self.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize) + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.WidthAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) + self.WidthAmendLabel.setMaximumSize(QtCore.QSize(100, 16777215)) + self.WidthAmendLabel.setAlignment(QtCore.Qt.AlignCenter) + self.WidthAmendLabel.setObjectName("WidthAmendLabel") + self.verticalLayout_5.addWidget(self.WidthAmendLabel) + self.WidthEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) + self.WidthEdit.setMaximumSize(QtCore.QSize(60, 16777215)) + self.WidthEdit.setObjectName("WidthEdit") + self.verticalLayout_5.addWidget(self.WidthEdit) + self.horizontalLayout_2.addLayout(self.verticalLayout_5) + self.OverrideCheckBox = QtGui.QCheckBox(self) + self.OverrideCheckBox.setGeometry(QtCore.QRect(0, 10, 191, 23)) + self.OverrideCheckBox.setObjectName("OverrideCheckBox") + QtCore.QMetaObject.connectSlotsByName(self) + QtCore.QObject.connect(self.OverrideCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onOverrideCheckBoxChanged) + + def retranslateUi(self): + self.setWindowTitle(QtGui.QApplication.translate("self", "Amend Display Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.CurrentGroupBox.setTitle(QtGui.QApplication.translate("self", "Default Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.XLabel.setText(QtGui.QApplication.translate("self", "X", None, QtGui.QApplication.UnicodeUTF8)) + self.Xpos.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.YLabel.setText(QtGui.QApplication.translate("self", "Y", None, QtGui.QApplication.UnicodeUTF8)) + self.Ypos.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.HeightLabel.setText(QtGui.QApplication.translate("self", "Height", None, QtGui.QApplication.UnicodeUTF8)) + self.Height.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.WidthLabel.setText(QtGui.QApplication.translate("self", "Width", None, QtGui.QApplication.UnicodeUTF8)) + self.Width.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.CurrentGroupBox_2.setTitle(QtGui.QApplication.translate("self", "Amend Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.XAmendLabel.setText(QtGui.QApplication.translate("self", "X", None, QtGui.QApplication.UnicodeUTF8)) + self.YAmendLabel.setText(QtGui.QApplication.translate("self", "Y", None, QtGui.QApplication.UnicodeUTF8)) + self.HeightAmendLabel.setText(QtGui.QApplication.translate("self", "Height", None, QtGui.QApplication.UnicodeUTF8)) + self.WidthAmendLabel.setText(QtGui.QApplication.translate("self", "Width", None, QtGui.QApplication.UnicodeUTF8)) + self.OverrideCheckBox.setText(QtGui.QApplication.translate("self", "Override Output Display", None, QtGui.QApplication.UnicodeUTF8)) + + def load(self): + settings = QtCore.QSettings() + settings.beginGroup(self.settingsSection) + self.Xpos.setText(unicode(self.screens.current[u'size'].x())) + self.Ypos.setText(unicode(self.screens.current[u'size'].y())) + self.Height.setText(unicode(self.screens.current[u'size'].height())) + self.Width.setText(unicode(self.screens.current[u'size'].width())) + xpos = settings.value(u'x position', + QtCore.QVariant(self.screens.current[u'size'].x())).toString() + self.XposEdit.setText(xpos) + ypos = settings.value(u'y position', + QtCore.QVariant(self.screens.current[u'size'].y())).toString() + self.YposEdit.setText(ypos) + height = settings.value(u'height', + QtCore.QVariant(self.screens.current[u'size'].height())).toString() + self.HeightEdit.setText(height) + width = settings.value(u'width', + QtCore.QVariant(self.screens.current[u'size'].width())).toString() + self.WidthEdit.setText(width) + self.amend_display = settings.value(u'amend display', + QtCore.QVariant(False)).toBool() + self.OverrideCheckBox.setChecked(self.amend_display) + self.amend_display_start = self.amend_display + + def onOverrideCheckBoxChanged(self, check_state): + self.amend_display = False + # we have a set value convert to True/False + if check_state == QtCore.Qt.Checked: + self.amend_display = True + + def save(self): + settings = QtCore.QSettings() + settings.beginGroup(self.settingsSection) + settings.setValue('x position', + QtCore.QVariant(self.XposEdit.text())) + settings.setValue('y position', + QtCore.QVariant(self.YposEdit.text())) + settings.setValue('height', + QtCore.QVariant(self.HeightEdit.text())) + settings.setValue('width', + QtCore.QVariant(self.WidthEdit.text())) + settings.setValue('amend display', + QtCore.QVariant(self.amend_display)) + self.postSetUp() + + def postSetUp(self): + self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()),\ + int(self.YposEdit.text()), int(self.WidthEdit.text()),\ + int(self.HeightEdit.text())) + if self.amend_display: + self.screens.set_override_display() + else: + self.screens.reset_current_display() + #only trigger event if data has changed in this edit session + if self.amend_display_start != self.amend_display: + self.amend_display_start = self.amend_display + Receiver.send_message(u'config_screen_changed') diff --git a/resources/forms/displaytab.py b/resources/forms/displaytab.py new file mode 100644 index 000000000..80ff2fdd5 --- /dev/null +++ b/resources/forms/displaytab.py @@ -0,0 +1,150 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'displaytab.ui' +# +# Created: Tue Apr 27 06:10:08 2010 +# by: PyQt4 UI code generator 4.7.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_DisplaysDialog(object): + def setupUi(self, DisplaysDialog): + DisplaysDialog.setObjectName("DisplaysDialog") + DisplaysDialog.resize(620, 716) + self.layoutWidget = QtGui.QWidget(DisplaysDialog) + self.layoutWidget.setGeometry(QtCore.QRect(0, 40, 241, 79)) + self.layoutWidget.setObjectName("layoutWidget") + self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) + self.verticalLayout.setObjectName("verticalLayout") + self.CurrentGroupBox = QtGui.QGroupBox(self.layoutWidget) + self.CurrentGroupBox.setObjectName("CurrentGroupBox") + self.horizontalLayout = QtGui.QHBoxLayout(self.CurrentGroupBox) + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout_6 = QtGui.QVBoxLayout() + self.verticalLayout_6.setObjectName("verticalLayout_6") + self.XLabel = QtGui.QLabel(self.CurrentGroupBox) + self.XLabel.setAlignment(QtCore.Qt.AlignCenter) + self.XLabel.setObjectName("XLabel") + self.verticalLayout_6.addWidget(self.XLabel) + self.Xpos = QtGui.QLabel(self.CurrentGroupBox) + self.Xpos.setAlignment(QtCore.Qt.AlignCenter) + self.Xpos.setObjectName("Xpos") + self.verticalLayout_6.addWidget(self.Xpos) + self.horizontalLayout.addLayout(self.verticalLayout_6) + self.verticalLayout_7 = QtGui.QVBoxLayout() + self.verticalLayout_7.setObjectName("verticalLayout_7") + self.YLabel = QtGui.QLabel(self.CurrentGroupBox) + self.YLabel.setAlignment(QtCore.Qt.AlignCenter) + self.YLabel.setObjectName("YLabel") + self.verticalLayout_7.addWidget(self.YLabel) + self.Ypos = QtGui.QLabel(self.CurrentGroupBox) + self.Ypos.setAlignment(QtCore.Qt.AlignCenter) + self.Ypos.setObjectName("Ypos") + self.verticalLayout_7.addWidget(self.Ypos) + self.horizontalLayout.addLayout(self.verticalLayout_7) + self.verticalLayout_9 = QtGui.QVBoxLayout() + self.verticalLayout_9.setObjectName("verticalLayout_9") + self.HeightLabel = QtGui.QLabel(self.CurrentGroupBox) + self.HeightLabel.setMaximumSize(QtCore.QSize(100, 16777215)) + self.HeightLabel.setAlignment(QtCore.Qt.AlignCenter) + self.HeightLabel.setObjectName("HeightLabel") + self.verticalLayout_9.addWidget(self.HeightLabel) + self.Height = QtGui.QLabel(self.CurrentGroupBox) + self.Height.setAlignment(QtCore.Qt.AlignCenter) + self.Height.setObjectName("Height") + self.verticalLayout_9.addWidget(self.Height) + self.horizontalLayout.addLayout(self.verticalLayout_9) + self.verticalLayout_8 = QtGui.QVBoxLayout() + self.verticalLayout_8.setObjectName("verticalLayout_8") + self.WidthLabel = QtGui.QLabel(self.CurrentGroupBox) + self.WidthLabel.setAlignment(QtCore.Qt.AlignCenter) + self.WidthLabel.setObjectName("WidthLabel") + self.verticalLayout_8.addWidget(self.WidthLabel) + self.Width = QtGui.QLabel(self.CurrentGroupBox) + self.Width.setAlignment(QtCore.Qt.AlignCenter) + self.Width.setObjectName("Width") + self.verticalLayout_8.addWidget(self.Width) + self.horizontalLayout.addLayout(self.verticalLayout_8) + self.verticalLayout.addWidget(self.CurrentGroupBox) + self.CurrentGroupBox_2 = QtGui.QGroupBox(DisplaysDialog) + self.CurrentGroupBox_2.setGeometry(QtCore.QRect(0, 130, 248, 87)) + self.CurrentGroupBox_2.setMaximumSize(QtCore.QSize(500, 16777215)) + self.CurrentGroupBox_2.setObjectName("CurrentGroupBox_2") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.CurrentGroupBox_2) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.XAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) + self.XAmendLabel.setAlignment(QtCore.Qt.AlignCenter) + self.XAmendLabel.setObjectName("XAmendLabel") + self.verticalLayout_2.addWidget(self.XAmendLabel) + self.XposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) + self.XposEdit.setMaximumSize(QtCore.QSize(50, 16777215)) + self.XposEdit.setMaxLength(4) + self.XposEdit.setObjectName("XposEdit") + self.verticalLayout_2.addWidget(self.XposEdit) + self.horizontalLayout_2.addLayout(self.verticalLayout_2) + self.verticalLayout_3 = QtGui.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.YAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) + self.YAmendLabel.setAlignment(QtCore.Qt.AlignCenter) + self.YAmendLabel.setObjectName("YAmendLabel") + self.verticalLayout_3.addWidget(self.YAmendLabel) + self.YposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) + self.YposEdit.setMaximumSize(QtCore.QSize(50, 16777215)) + self.YposEdit.setMaxLength(4) + self.YposEdit.setObjectName("YposEdit") + self.verticalLayout_3.addWidget(self.YposEdit) + self.horizontalLayout_2.addLayout(self.verticalLayout_3) + self.verticalLayout_4 = QtGui.QVBoxLayout() + self.verticalLayout_4.setObjectName("verticalLayout_4") + self.HeightAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) + self.HeightAmendLabel.setAlignment(QtCore.Qt.AlignCenter) + self.HeightAmendLabel.setObjectName("HeightAmendLabel") + self.verticalLayout_4.addWidget(self.HeightAmendLabel) + self.HeightEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) + self.HeightEdit.setMaximumSize(QtCore.QSize(50, 16777215)) + self.HeightEdit.setMaxLength(4) + self.HeightEdit.setObjectName("HeightEdit") + self.verticalLayout_4.addWidget(self.HeightEdit) + self.horizontalLayout_2.addLayout(self.verticalLayout_4) + self.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize) + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.WidthAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) + self.WidthAmendLabel.setMaximumSize(QtCore.QSize(100, 16777215)) + self.WidthAmendLabel.setAlignment(QtCore.Qt.AlignCenter) + self.WidthAmendLabel.setObjectName("WidthAmendLabel") + self.verticalLayout_5.addWidget(self.WidthAmendLabel) + self.WidthEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) + self.WidthEdit.setMaximumSize(QtCore.QSize(60, 16777215)) + self.WidthEdit.setObjectName("WidthEdit") + self.verticalLayout_5.addWidget(self.WidthEdit) + self.horizontalLayout_2.addLayout(self.verticalLayout_5) + self.OverrideCheckBox = QtGui.QCheckBox(DisplaysDialog) + self.OverrideCheckBox.setGeometry(QtCore.QRect(0, 10, 191, 23)) + self.OverrideCheckBox.setObjectName("OverrideCheckBox") + + self.retranslateUi(DisplaysDialog) + QtCore.QMetaObject.connectSlotsByName(DisplaysDialog) + + def retranslateUi(self, DisplaysDialog): + DisplaysDialog.setWindowTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Display Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.CurrentGroupBox.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Default Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.XLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "X", None, QtGui.QApplication.UnicodeUTF8)) + self.Xpos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.YLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Y", None, QtGui.QApplication.UnicodeUTF8)) + self.Ypos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.HeightLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Height", None, QtGui.QApplication.UnicodeUTF8)) + self.Height.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.WidthLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Width", None, QtGui.QApplication.UnicodeUTF8)) + self.Width.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.CurrentGroupBox_2.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.XAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "X", None, QtGui.QApplication.UnicodeUTF8)) + self.YAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Y", None, QtGui.QApplication.UnicodeUTF8)) + self.HeightAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Height", None, QtGui.QApplication.UnicodeUTF8)) + self.WidthAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Width", None, QtGui.QApplication.UnicodeUTF8)) + self.OverrideCheckBox.setText(QtGui.QApplication.translate("DisplaysDialog", "Override Output Display", None, QtGui.QApplication.UnicodeUTF8)) + From 39a4593bd3323f40515816e106bd55b630ceff71 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 29 Apr 2010 20:33:45 +0100 Subject: [PATCH 09/24] Fix up display buttons --- openlp/core/ui/maindisplay.py | 98 +++++++++++++++++++++---------- openlp/core/ui/mainwindow.py | 1 + openlp/core/ui/slidecontroller.py | 68 +++++++++++---------- 3 files changed, 104 insertions(+), 63 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index a459fb72f..f3bad6bb1 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -40,6 +40,7 @@ class DisplayManager(QtGui.QWidget): Wrapper class to hold the display widgets. I will provide API's in future to access the screens allow for extra displays to be added. + RenderManager is poked in by MainWindow """ def __init__(self, screens): QtGui.QWidget.__init__(self) @@ -130,17 +131,14 @@ class MainDisplay(DisplayWidget): self.displayBlank = False self.blankFrame = None self.frame = None - self.firstTime = True - self.hasTransition = False - self.mediaBackground = False + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'maindisplay_blank'), self.blankDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_hide_theme'), self.hideThemeDisplay) -# QtCore.QObject.connect(Receiver.get_receiver(), -# QtCore.SIGNAL(u'maindisplay_show_theme'), self.showThemeDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'videodisplay_start'), self.hideDisplay) @@ -153,12 +151,12 @@ class MainDisplay(DisplayWidget): self.setVisible(False) self.screen = self.screens.current #Sort out screen locations and sizes - self.setGeometry(self.screen[u'size']) self.display_alert.setGeometry(self.screen[u'size']) self.display_image.resize(self.screen[u'size'].width(), self.screen[u'size'].height()) self.display_text.resize(self.screen[u'size'].width(), self.screen[u'size'].height()) + self.setGeometry(self.screen[u'size']) #Build a custom splash screen self.InitialFrame = QtGui.QImage( self.screen[u'size'].width(), @@ -205,16 +203,65 @@ class MainDisplay(DisplayWidget): else: self.showFullScreen() + def blankDisplay(self):#, blankType=HideMode.Blank, blanked=True): + log.debug(u'Blank main Display ') + """ + Hide the display by making all layers transparent + Store the images so they can be replaced when required + """ + self.storeImage = QtGui.QPixmap(self.display_image.pixmap()) + self.storeText = QtGui.QPixmap(self.display_text.pixmap()) + self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) + self.display_alert.setPixmap(self.transparent) + self.display_text.setPixmap(self.transparent) + self.moveToTop() +# if blanked: +# self.displayBlank = True +# if blankType == HideMode.Blank: +# self.display_text.setPixmap( +# QtGui.QPixmap.fromImage(self.blankFrame)) +# elif blankType == HideMode.Theme: +# theme = self.parent.RenderManager.renderer.bg_frame +# if not theme: +# theme = self.blankFrame +# self.display_text.setPixmap(QtGui.QPixmap.fromImage(theme)) +# self.waitingFrame = None +# self.waitingFrameTrans = False +# else: +# self.displayBlank = False +# if self.waitingFrame: +# self.frameView(self.waitingFrame, self.waitingFrameTrans) +# elif self.display_frame: +# self.frameView(self.display_frame) + def hideDisplay(self): + """ + Hide the display by making all layers transparent + Store the images so they can be replaced when required + """ log.debug(u'hideDisplay') + self.storeImage = QtGui.QPixmap(self.display_image.pixmap()) + self.storeText = QtGui.QPixmap(self.display_text.pixmap()) self.display_image.setPixmap(self.transparent) self.display_alert.setPixmap(self.transparent) self.display_text.setPixmap(self.transparent) self.moveToTop() def hideThemeDisplay(self): + """ + Hide the display by making all layers transparent + Add the theme background to the image layer unless it has + not been generated in which case make it black. + Store the images so they can be replaced when required + """ log.debug(u'hideDisplay') - self.display_image.setPixmap(self.transparent) + self.storeImage = QtGui.QPixmap(self.display_image.pixmap()) + self.storeText = QtGui.QPixmap(self.display_text.pixmap()) + if self.parent.renderManager.renderer.bg_frame: + self.display_image.setPixmap(QtGui.QPixmap.fromImage(\ + self.parent.renderManager.renderer.bg_frame)) + else: + self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) self.display_alert.setPixmap(self.transparent) self.display_text.setPixmap(self.transparent) self.moveToTop() @@ -226,10 +273,20 @@ class MainDisplay(DisplayWidget): self.show() def showDisplay(self): + """ + Show the stored layers so the screen reappears as it was + originally. + Make the stored images None to release memory. + """ log.debug(u'showDisplay') - if not self.primary: - self.setVisible(True) - self.showFullScreen() + if self.storeImage: + self.display_image.setPixmap(self.storeImage) + self.display_alert.setPixmap(self.transparent) + if self.storeText: + self.display_text.setPixmap(self.storeText) + self.storeImage = None + self.store = None + self.moveToTop() Receiver.send_message(u'maindisplay_active') def addImageWithText(self, frame): @@ -291,27 +348,6 @@ class MainDisplay(DisplayWidget): self.waitingFrame = frame self.waitingFrameTrans = transition - def blankDisplay(self, blankType=HideMode.Blank, blanked=True): - log.debug(u'Blank main Display %d' % blanked) - if blanked: - self.displayBlank = True - if blankType == HideMode.Blank: - self.display_text.setPixmap( - QtGui.QPixmap.fromImage(self.blankFrame)) - elif blankType == HideMode.Theme: - theme = self.parent.RenderManager.renderer.bg_frame - if not theme: - theme = self.blankFrame - self.display_text.setPixmap(QtGui.QPixmap.fromImage(theme)) - self.waitingFrame = None - self.waitingFrameTrans = False - else: - self.displayBlank = False - if self.waitingFrame: - self.frameView(self.waitingFrame, self.waitingFrameTrans) - elif self.display_frame: - self.frameView(self.display_frame) - class VideoDisplay(Phonon.VideoWidget): """ This is the form that is used to display videos on the projector. diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 44341244d..d1294d7cd 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -505,6 +505,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): #ThemeManager needs to call RenderManager self.RenderManager = RenderManager( self.ThemeManagerContents, self.screens) + self.displayManager.renderManager = self.RenderManager #Define the media Dock Manager self.mediaDockManager = MediaDockManager(self.MediaToolBox) log.info(u'Load Plugins') diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 529aad36f..c5326aaa8 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -199,8 +199,6 @@ class SlideController(QtGui.QWidget): self.hideButton = self.Toolbar.addToolbarButton( u'Hide screen', u':/slides/slide_desktop.png', self.trUtf8('Hide Screen'), self.onHideDisplay, True) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'maindisplay_blank'), self.blankScreen) if not self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarButton( @@ -590,58 +588,64 @@ class SlideController(QtGui.QWidget): self.PreviewListWidget.selectRow(0) self.onSlideSelected() - def onBlankDisplay(self, force=False): + def onBlankDisplay(self, checked): """ Handle the blank screen button """ - log.debug(u'onBlankDisplay %d' % force) - if force: - self.blankButton.setChecked(True) - self.blankScreen(HideMode.Blank, self.blankButton.isChecked()) + log.debug(u'onBlankDisplay %d' % checked) + self.hideButton.setChecked(False) + self.themeButton.setChecked(False) QtCore.QSettings().setValue( self.generalSettingsSection + u'/screen blank', - QtCore.QVariant(self.blankButton.isChecked())) + QtCore.QVariant(checked)) + if checked: + Receiver.send_message(u'maindisplay_blank') + else: + Receiver.send_message(u'maindisplay_show') - def onThemeDisplay(self, force=False): + def onThemeDisplay(self, checked): """ Handle the Theme screen button """ - log.debug(u'onThemeDisplay %d' % force) - if force: - self.themeButton.setChecked(True) - if self.themeButton.isChecked(): - Receiver.send_message(u'maindisplay_show_theme') - else: + log.debug(u'onThemeDisplay %d' % checked) + self.blankButton.setChecked(False) + self.hideButton.setChecked(False) + if checked: Receiver.send_message(u'maindisplay_hide_theme') + else: + Receiver.send_message(u'maindisplay_show') - def onHideDisplay(self, force=False): + def onHideDisplay(self, checked): """ Handle the Hide screen button """ - log.debug(u'onHideDisplay %d' % force) - if force: - self.hideButton.setChecked(True) - if self.hideButton.isChecked(): + log.debug(u'onHideDisplay %d' % checked) + self.blankButton.setChecked(False) + self.themeButton.setChecked(False) + if checked: Receiver.send_message(u'maindisplay_hide') else: Receiver.send_message(u'maindisplay_show') - def blankScreen(self, blankType, blanked=False): + def blankScreen(self, checked): """ Blank the display screen. """ - if self.serviceItem is not None: - if blanked: - Receiver.send_message( - u'%s_blank' % self.serviceItem.name.lower(), - [self.serviceItem, self.isLive]) - else: - Receiver.send_message(u'%s_unblank' - % self.serviceItem.name.lower(), - [self.serviceItem, self.isLive]) - self.parent.displayManager.mainDisplay.blankDisplay(blankType, blanked) + self.hideButton.setChecked(False) + self.themeButton.setChecked(False) +# if self.serviceItem is not None: +# if checked: +# Receiver.send_message( +# u'%s_blank' % self.serviceItem.name.lower(), +# [self.serviceItem, self.isLive]) +# else: +# Receiver.send_message(u'%s_unblank' +# % self.serviceItem.name.lower(), +# [self.serviceItem, self.isLive]) + if checked: + Receiver.send_message(u'maindisplay_blank') else: - self.parent.displayManager.mainDisplay.blankDisplay(blankType, blanked) + Receiver.send_message(u'maindisplay_show4') def onSlideSelected(self): """ From 4e6c56c43019f2e49bb1d26a2259daedb3aa6e05 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 29 Apr 2010 21:56:27 +0100 Subject: [PATCH 10/24] Video clean ups and bug fixes from 800 --- openlp/core/lib/serviceitem.py | 1 - openlp/core/ui/__init__.py | 10 ++ openlp/core/ui/maindisplay.py | 93 +++++++------------ openlp/core/ui/slidecontroller.py | 61 ++++++------ openlp/plugins/images/lib/mediaitem.py | 2 +- openlp/plugins/media/lib/mediaitem.py | 3 +- openlp/plugins/presentations/lib/mediaitem.py | 3 +- 7 files changed, 74 insertions(+), 99 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 4374f98aa..25f08717f 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -49,7 +49,6 @@ class ItemCapabilities(object): RequiresMedia = 4 AllowsLoop = 5 - class ServiceItem(object): """ The service item is a base class for the plugins to use to interact with diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 0c1ec731a..76b84503e 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -23,6 +23,16 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +class HideMode(object): + """ + This is basically an enumeration class which specifies the mode of a Bible. + Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to + be downloaded from the Internet on an as-needed basis. + """ + Blank = 1 + Theme = 2 + Screen = 3 + from slidecontroller import HideMode from servicenoteform import ServiceNoteForm from serviceitemeditform import ServiceItemEditForm diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index f3bad6bb1..321e28e1b 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -131,16 +131,10 @@ class MainDisplay(DisplayWidget): self.displayBlank = False self.blankFrame = None self.frame = None - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'maindisplay_blank'), self.blankDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'maindisplay_hide_theme'), self.hideThemeDisplay) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'videodisplay_start'), self.hideDisplay) def setup(self): """ @@ -203,67 +197,26 @@ class MainDisplay(DisplayWidget): else: self.showFullScreen() - def blankDisplay(self):#, blankType=HideMode.Blank, blanked=True): - log.debug(u'Blank main Display ') + def hideDisplay(self, mode=HideMode.Screen): """ Hide the display by making all layers transparent Store the images so they can be replaced when required """ + log.debug(u'hideDisplay mode = %d', mode) self.storeImage = QtGui.QPixmap(self.display_image.pixmap()) self.storeText = QtGui.QPixmap(self.display_text.pixmap()) - self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) self.display_alert.setPixmap(self.transparent) self.display_text.setPixmap(self.transparent) - self.moveToTop() -# if blanked: -# self.displayBlank = True -# if blankType == HideMode.Blank: -# self.display_text.setPixmap( -# QtGui.QPixmap.fromImage(self.blankFrame)) -# elif blankType == HideMode.Theme: -# theme = self.parent.RenderManager.renderer.bg_frame -# if not theme: -# theme = self.blankFrame -# self.display_text.setPixmap(QtGui.QPixmap.fromImage(theme)) -# self.waitingFrame = None -# self.waitingFrameTrans = False -# else: -# self.displayBlank = False -# if self.waitingFrame: -# self.frameView(self.waitingFrame, self.waitingFrameTrans) -# elif self.display_frame: -# self.frameView(self.display_frame) - - def hideDisplay(self): - """ - Hide the display by making all layers transparent - Store the images so they can be replaced when required - """ - log.debug(u'hideDisplay') - self.storeImage = QtGui.QPixmap(self.display_image.pixmap()) - self.storeText = QtGui.QPixmap(self.display_text.pixmap()) - self.display_image.setPixmap(self.transparent) - self.display_alert.setPixmap(self.transparent) - self.display_text.setPixmap(self.transparent) - self.moveToTop() - - def hideThemeDisplay(self): - """ - Hide the display by making all layers transparent - Add the theme background to the image layer unless it has - not been generated in which case make it black. - Store the images so they can be replaced when required - """ - log.debug(u'hideDisplay') - self.storeImage = QtGui.QPixmap(self.display_image.pixmap()) - self.storeText = QtGui.QPixmap(self.display_text.pixmap()) - if self.parent.renderManager.renderer.bg_frame: - self.display_image.setPixmap(QtGui.QPixmap.fromImage(\ - self.parent.renderManager.renderer.bg_frame)) - else: + if mode == HideMode.Screen: + self.display_image.setPixmap(self.transparent) + elif mode == HideMode.Blank: self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) - self.display_alert.setPixmap(self.transparent) - self.display_text.setPixmap(self.transparent) + else: + if self.parent.renderManager.renderer.bg_frame: + self.display_image.setPixmap(QtGui.QPixmap.fromImage(\ + self.parent.renderManager.renderer.bg_frame)) + else: + self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) self.moveToTop() def moveToTop(self): @@ -370,6 +323,7 @@ class VideoDisplay(Phonon.VideoWidget): self.setWindowTitle(u'OpenLP Video Display') self.parent = parent self.screens = screens + self.hidden = False self.mediaObject = Phonon.MediaObject() self.setAspectRatio(aspect) self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory) @@ -377,6 +331,10 @@ class VideoDisplay(Phonon.VideoWidget): Phonon.createPath(self.mediaObject, self.audioObject) self.setWindowFlags(QtCore.Qt.WindowStaysOnBottomHint \ | QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'maindisplay_hide'), self.mediaHide) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'maindisplay_show'), self.mediaShow) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'videodisplay_start'), self.onMediaQueue) QtCore.QObject.connect(Receiver.get_receiver(), @@ -421,10 +379,15 @@ class VideoDisplay(Phonon.VideoWidget): file = os.path.join(message[0].get_frame_path(), message[0].get_frame_title()) source = self.mediaObject.setCurrentSource(Phonon.MediaSource(file)) - self.onMediaPlay() + self._play() def onMediaPlay(self): - log.debug(u'VideoDisplay Play the new media, Live ') + if not self.hidden: + log.debug(u'VideoDisplay Play the new media, Live ') + self._play() + + def _play(self): + log.debug(u'VideoDisplay _play called') self.mediaObject.play() self.setVisible(True) self.showFullScreen() @@ -444,3 +407,13 @@ class VideoDisplay(Phonon.VideoWidget): self.mediaObject.clearQueue() self.setVisible(False) + def mediaHide(self): + self.mediaObject.pause() + self.hidden = True + self.setVisible(False) + + def mediaShow(self): + if self.hidden: + self.hidden = False + self._play() + diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index c5326aaa8..32b301111 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -30,18 +30,9 @@ import os from PyQt4 import QtCore, QtGui from PyQt4.phonon import Phonon -from openlp.core.lib import ItemCapabilities - -class HideMode(object): - """ - This is basically an enumeration class which specifies the mode of a Bible. - Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to - be downloaded from the Internet on an as-needed basis. - """ - Blank = 1 - Theme = 2 - -from openlp.core.lib import OpenLPToolbar, Receiver, resize_image +from openlp.core.ui import HideMode +from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \ +ItemCapabilities log = logging.getLogger(__name__) @@ -599,7 +590,7 @@ class SlideController(QtGui.QWidget): self.generalSettingsSection + u'/screen blank', QtCore.QVariant(checked)) if checked: - Receiver.send_message(u'maindisplay_blank') + Receiver.send_message(u'maindisplay_hide', HideMode.Blank) else: Receiver.send_message(u'maindisplay_show') @@ -611,7 +602,7 @@ class SlideController(QtGui.QWidget): self.blankButton.setChecked(False) self.hideButton.setChecked(False) if checked: - Receiver.send_message(u'maindisplay_hide_theme') + Receiver.send_message(u'maindisplay_hide', HideMode.Theme) else: Receiver.send_message(u'maindisplay_show') @@ -623,30 +614,10 @@ class SlideController(QtGui.QWidget): self.blankButton.setChecked(False) self.themeButton.setChecked(False) if checked: - Receiver.send_message(u'maindisplay_hide') + Receiver.send_message(u'maindisplay_hide', HideMode.Screen) else: Receiver.send_message(u'maindisplay_show') - def blankScreen(self, checked): - """ - Blank the display screen. - """ - self.hideButton.setChecked(False) - self.themeButton.setChecked(False) -# if self.serviceItem is not None: -# if checked: -# Receiver.send_message( -# u'%s_blank' % self.serviceItem.name.lower(), -# [self.serviceItem, self.isLive]) -# else: -# Receiver.send_message(u'%s_unblank' -# % self.serviceItem.name.lower(), -# [self.serviceItem, self.isLive]) - if checked: - Receiver.send_message(u'maindisplay_blank') - else: - Receiver.send_message(u'maindisplay_show4') - def onSlideSelected(self): """ Generate the preview when you click on a slide. @@ -787,6 +758,9 @@ class SlideController(QtGui.QWidget): self.onSlideSelectedNext() def onEditSong(self): + """ + From the preview display requires the service Item to be editied + """ self.songEdit = True Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(), u'P:%s' % self.serviceItem.editId) @@ -801,9 +775,14 @@ class SlideController(QtGui.QWidget): self.serviceItem, row) def onMediaStart(self, item): + """ + Respond to the arrival of a media service item + """ + log.debug(u'SlideController onMediaStart') if self.isLive: Receiver.send_message(u'videodisplay_start', [item, self.blankButton.isChecked()]) + Receiver.send_message(u'maindisplay_hide', HideMode.Screen) else: self.mediaObject.stop() self.mediaObject.clearQueue() @@ -814,12 +793,20 @@ class SlideController(QtGui.QWidget): self.onMediaPlay() def onMediaPause(self): + """ + Respond to the Pause from the media Toolbar + """ + log.debug(u'SlideController onMediaPause') if self.isLive: Receiver.send_message(u'videodisplay_pause') else: self.mediaObject.pause() def onMediaPlay(self): + """ + Respond to the Play from the media Toolbar + """ + log.debug(u'SlideController onMediaPlay') if self.isLive: Receiver.send_message(u'videodisplay_play') else: @@ -828,6 +815,10 @@ class SlideController(QtGui.QWidget): self.mediaObject.play() def onMediaStop(self): + """ + Respond to the Stop from the media Toolbar + """ + log.debug(u'SlideController onMediaStop') if self.isLive: Receiver.send_message(u'videodisplay_stop') else: diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index e3a3084c4..0907a8222 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -122,7 +122,7 @@ class ImageMediaItem(MediaManagerItem): #if not present do not worry pass self.ListView.takeItem(item.row()) - SettingsManager.set_list( + SettingsManager.set_list(self.SettingsSection,\ self.SettingsSection, self.getFileList()) def loadList(self, list): diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index f594fe54c..fc7895fb1 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -97,7 +97,8 @@ class MediaMediaItem(MediaManagerItem): if item: row = self.ListView.row(item) self.ListView.takeItem(row) - SettingsManager.set_list(self.SettingsSection, self.getFileList()) + SettingsManager.set_list(self.SettingsSection, \ + self.SettingsSection, self.getFileList()) def loadList(self, list): for file in list: diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index f547f0633..3b91b3b94 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -167,7 +167,8 @@ class PresentationMediaItem(MediaManagerItem): if item: row = self.ListView.row(item) self.ListView.takeItem(row) - SettingsManager.set_list(self.SettingsSection, self.getFileList()) + SettingsManager.set_list(self.SettingsSection,\ + self.SettingsSection, self.getFileList()) filepath = unicode((item.data(QtCore.Qt.UserRole)).toString()) #not sure of this has errors #John please can you look at . From 22b00a130f4ed0b5f8954b874c1cc19f58ff09ed Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 30 Apr 2010 02:31:41 +0100 Subject: [PATCH 11/24] Make settings_sections consistent --- openlp/core/lib/mediamanageritem.py | 18 +++++------- openlp/core/lib/settingstab.py | 2 +- openlp/core/ui/generaltab.py | 6 ++-- openlp/core/ui/mainwindow.py | 29 ++++++++++++------- openlp/core/ui/mediadockmanager.py | 5 ++-- openlp/core/ui/servicemanager.py | 29 ++++++++++--------- openlp/core/ui/slidecontroller.py | 6 ++-- openlp/core/ui/thememanager.py | 18 ++++++------ openlp/core/ui/themestab.py | 6 ++-- openlp/plugins/alerts/forms/alertstab.py | 4 +-- openlp/plugins/bibles/lib/biblestab.py | 4 +-- openlp/plugins/bibles/lib/mediaitem.py | 3 +- openlp/plugins/custom/lib/customtab.py | 4 +-- openlp/plugins/custom/lib/mediaitem.py | 3 +- openlp/plugins/images/lib/imagetab.py | 4 +-- openlp/plugins/images/lib/mediaitem.py | 9 +++--- openlp/plugins/media/lib/mediaitem.py | 6 ++-- openlp/plugins/presentations/lib/mediaitem.py | 15 ++++++---- .../presentations/lib/presentationtab.py | 4 +-- openlp/plugins/remotes/lib/remotetab.py | 4 +-- openlp/plugins/songs/lib/mediaitem.py | 3 +- openlp/plugins/songs/lib/songstab.py | 4 +-- .../songusage/forms/songusagedetailform.py | 7 ++--- 23 files changed, 97 insertions(+), 96 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 2d16687f4..83937160e 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -70,11 +70,6 @@ class MediaManagerItem(QtGui.QWidget): The user visible name for a plugin which should use a suitable translation function. - ``self.SettingsSection`` - The section in the configuration where the items in the media - manager are stored. This could potentially be - ``self.PluginNameShort.lower()``. - ``self.OnNewPrompt`` Defaults to *'Select Image(s)'*. @@ -103,6 +98,7 @@ class MediaManagerItem(QtGui.QWidget): """ QtGui.QWidget.__init__(self) self.parent = parent + self.settings_section = title.lower() if type(icon) is QtGui.QIcon: self.icon = icon elif type(icon) is types.StringType: @@ -335,20 +331,20 @@ class MediaManagerItem(QtGui.QWidget): def onFileClick(self): files = QtGui.QFileDialog.getOpenFileNames( self, self.OnNewPrompt, - SettingsManager.get_last_dir(self.SettingsSection), + SettingsManager.get_last_dir(self.settings_section), self.OnNewFileMasks) log.info(u'New files(s) %s', unicode(files)) if files: self.loadList(files) - dir, filename = os.path.split(unicode(files[0])) - SettingsManager.set_last_dir(self.SettingsSection, dir) - SettingsManager.set_list( - self.SettingsSection, self.SettingsSection, self.getFileList()) + dir = os.path.split(unicode(files[0]))[0] + SettingsManager.set_last_dir(self.settings_section, dir) + SettingsManager.set_list(self.settings_section, + self.settings_section, self.getFileList()) def getFileList(self): count = 0 filelist = [] - while count < self.ListView.count(): + while count < self.ListView.count(): bitem = self.ListView.item(count) filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) filelist.append(filename) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 0b862d9f8..8b9cc4261 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -40,7 +40,7 @@ class SettingsTab(QtGui.QWidget): QtGui.QWidget.__init__(self) self.tabTitle = title self.tabTitleVisible = None - self.settingsSection = self.tabTitle.lower() + self.settings_section = self.tabTitle.lower() self.setupUi() self.retranslateUi() self.initialise() diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 005e588ac..e622dad78 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -42,7 +42,7 @@ class GeneralTab(SettingsTab): If not set before default to last screen. """ settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) self.MonitorNumber = settings.value(u'monitor', QtCore.QVariant(self.screens.monitor_number)).toInt()[0] self.screens.set_current_display(self.MonitorNumber) @@ -229,7 +229,7 @@ class GeneralTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) for screen in self.screens.screen_list: screen_name = u'%s %d' % (self.trUtf8('Screen'), screen[u'number'] + 1) @@ -268,7 +268,7 @@ class GeneralTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber)) settings.setValue(u'display on monitor', QtCore.QVariant(self.DisplayOnMonitor)) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index f3ceb18be..13567a7d9 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -424,8 +424,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtGui.QMainWindow.__init__(self) self.screens = screens self.applicationVersion = applicationVersion - self.generalSettingsSection = u'general' - self.uiSettingsSection = u'user interface' + # Set up settings sections for the main application + # (not for use by plugins) + self.ui_settings_section = u'user interface' + self.general_settings_section = u'general' + self.service_settings_section = u'servicemanager' + self.songs_settings_section = u'songs' self.serviceNotSaved = False self.settingsmanager = SettingsManager(screens) self.displayManager = DisplayManager(screens) @@ -570,7 +574,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if self.displayManager.mainDisplay.isVisible(): self.displayManager.mainDisplay.setFocus() self.activateWindow() - if QtCore.QSettings().value(self.generalSettingsSection + u'/auto open', + if QtCore.QSettings().value( + self.general_settings_section + u'/auto open', QtCore.QVariant(False)).toBool(): self.ServiceManagerContents.onLoadService(True) @@ -580,7 +585,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): Triggered by delay thread. """ settings = QtCore.QSettings() - settings.beginGroup(self.generalSettingsSection) + settings.beginGroup(self.general_settings_section) if settings.value(u'screen blank', QtCore.QVariant(False)).toBool() \ and settings.value(u'blank warning', QtCore.QVariant(False)).toBool(): self.LiveController.onBlankDisplay(True) @@ -725,9 +730,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def loadSettings(self): log.debug(u'Loading QSettings') settings = QtCore.QSettings() - self.recentFiles = settings.value( - self.generalSettingsSection + u'/recent files').toStringList() - settings.beginGroup(self.uiSettingsSection) + settings.beginGroup(self.general_settings_section) + self.recentFiles = settings.value(u'recent files').toStringList() + settings.endGroup() + settings.beginGroup(self.ui_settings_section) self.move(settings.value(u'main window position', QtCore.QVariant(QtCore.QPoint(0, 0))).toPoint()) self.restoreGeometry( @@ -738,11 +744,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def saveSettings(self): log.debug(u'Saving QSettings') settings = QtCore.QSettings() + settings.beginGroup(self.general_settings_section) recentFiles = QtCore.QVariant(self.recentFiles) \ if self.recentFiles else QtCore.QVariant() - settings.setValue( - self.generalSettingsSection + u'/recent files', recentFiles) - settings.beginGroup(self.uiSettingsSection) + settings.setValue(u'recent files', recentFiles) + settings.endGroup() + settings.beginGroup(self.ui_settings_section) settings.setValue(u'main window position', QtCore.QVariant(self.pos())) settings.setValue(u'main window state', @@ -772,7 +779,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def addRecentFile(self, filename): recentFileCount = QtCore.QSettings().value( - self.generalSettingsSection + u'/max recent files', + self.general_settings_section + u'/max recent files', QtCore.QVariant(4)).toInt()[0] if filename and not self.recentFiles.contains(filename): self.recentFiles.prepend(QtCore.QString(filename)) diff --git a/openlp/core/ui/mediadockmanager.py b/openlp/core/ui/mediadockmanager.py index ae77cc43a..aece0729e 100644 --- a/openlp/core/ui/mediadockmanager.py +++ b/openlp/core/ui/mediadockmanager.py @@ -45,18 +45,17 @@ class MediaDockManager(object): log.debug(u'Inserting %s dock' % media_item.title) match = False for dock_index in range(0, self.media_dock.count()): - if self.media_dock.widget(dock_index).SettingsSection == \ + if self.media_dock.widget(dock_index).settings_section == \ media_item.title.lower(): match = True break if not match: self.media_dock.addItem(media_item, icon, media_item.title) - def remove_dock(self, name): log.debug(u'remove %s dock' % name) for dock_index in range(0, self.media_dock.count()): if self.media_dock.widget(dock_index): - if self.media_dock.widget(dock_index).SettingsSection == name: + if self.media_dock.widget(dock_index).settings_section == name: self.media_dock.widget(dock_index).hide() self.media_dock.removeItem(dock_index) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 45d007c17..2a4da68a4 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -99,8 +99,6 @@ class ServiceManager(QtGui.QWidget): """ QtGui.QWidget.__init__(self) self.parent = parent - self.settingsSection = u'servicemanager' - self.generalSettingsSection = self.parent.generalSettingsSection self.serviceItems = [] self.serviceName = u'' self.droppos = 0 @@ -193,7 +191,7 @@ class ServiceManager(QtGui.QWidget): QtCore.SIGNAL(u'config_updated'), self.regenerateServiceItems) # Last little bits of setting up self.service_theme = unicode(QtCore.QSettings().value( - self.settingsSection + u'/service theme', + self.parent.service_settings_section + u'/service theme', QtCore.QVariant(u'')).toString()) self.servicePath = AppLocation.get_section_data_path(u'servicemanager') #build the context menu @@ -406,7 +404,7 @@ class ServiceManager(QtGui.QWidget): Clear the list to create a new service """ if self.parent.serviceNotSaved and QtCore.QSettings().value( - self.generalSettingsSection + u'/save prompt', + self.parent.general_settings_section + u'/save prompt', QtCore.QVariant(False)).toBool(): ret = QtGui.QMessageBox.question(self, self.trUtf8('Save Changes to Service?'), @@ -491,17 +489,19 @@ class ServiceManager(QtGui.QWidget): if not quick or self.isNew: filename = QtGui.QFileDialog.getSaveFileName(self, self.trUtf8(u'Save Service'), - SettingsManager.get_last_dir(self.settingsSection), + SettingsManager.get_last_dir(self.parent.service_settings_section), self.trUtf8(u'OpenLP Service Files (*.osz)')) else: - filename = SettingsManager.get_last_dir(self.settingsSection) + filename = SettingsManager.get_last_dir( + self.parent.service_settings_section) if filename: splittedFile = filename.split(u'.') if splittedFile[-1] != u'osz': filename = filename + u'.osz' filename = unicode(filename) self.isNew = False - SettingsManager.set_last_dir(self.settingsSection, filename) + SettingsManager.set_last_dir( + self.parent.service_settings_section, filename) service = [] servicefile = filename + u'.osd' zip = None @@ -542,12 +542,13 @@ class ServiceManager(QtGui.QWidget): def onLoadService(self, lastService=False): if lastService: - filename = SettingsManager.get_last_dir(self.settingsSection) + filename = SettingsManager.get_last_dir( + self.parent.service_settings_section) else: filename = QtGui.QFileDialog.getOpenFileName( self, self.trUtf8('Open Service'), - SettingsManager.get_last_dir(self.settingsSection), - u'Services (*.osz)') + SettingsManager.get_last_dir( + self.parent.service_settings_section), u'Services (*.osz)') self.loadService(filename) def loadService(self, filename=None): @@ -576,7 +577,8 @@ class ServiceManager(QtGui.QWidget): filename = unicode(filename) name = filename.split(os.path.sep) if filename: - SettingsManager.set_last_dir(self.settingsSection, filename) + SettingsManager.set_last_dir( + self.parent.service_settings_section, filename) zip = None f = None try: @@ -645,7 +647,8 @@ class ServiceManager(QtGui.QWidget): """ self.service_theme = unicode(self.ThemeComboBox.currentText()) self.parent.RenderManager.set_service_theme(self.service_theme) - QtCore.QSettings().setValue(self.settingsSection + u'/service theme', + QtCore.QSettings().setValue( + self.parent.service_settings_section + u'/service theme', QtCore.QVariant(self.service_theme)) self.regenerateServiceItems() @@ -729,7 +732,7 @@ class ServiceManager(QtGui.QWidget): self.parent.LiveController.addServiceManagerItem( self.serviceItems[item][u'service_item'], count) if QtCore.QSettings().value( - self.generalSettingsSection + u'/auto preview', + self.parent.general_settings_section + u'/auto preview', QtCore.QVariant(False)).toBool(): item += 1 if self.serviceItems and item < len(self.serviceItems) and \ diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 811fd51e3..d84a64c2a 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -93,8 +93,6 @@ class SlideController(QtGui.QWidget): """ QtGui.QWidget.__init__(self, parent) self.settingsmanager = settingsmanager - self.generalSettingsSection = u'general' - self.songsSettingsSection = u'songs' self.isLive = isLive self.parent = parent self.mainDisplay = self.parent.displayManager.mainDisplay @@ -399,7 +397,7 @@ class SlideController(QtGui.QWidget): if item.is_text(): self.Toolbar.makeWidgetsInvisible(self.loop_list) if QtCore.QSettings().value( - self.songsSettingsSection + u'/show songbar', + self.parent.songs_settings_section + u'/show songbar', QtCore.QVariant(True)).toBool() and len(self.slideList) > 0: self.Toolbar.makeWidgetsVisible([u'Song Menu']) if item.is_capable(ItemCapabilities.AllowsLoop) and \ @@ -589,7 +587,7 @@ class SlideController(QtGui.QWidget): self.blankButton.setChecked(True) self.blankScreen(HideMode.Blank, self.blankButton.isChecked()) QtCore.QSettings().setValue( - self.generalSettingsSection + u'/screen blank', + self.parent.general_settings_section + u'/screen blank', QtCore.QVariant(self.blankButton.isChecked())) def onThemeDisplay(self, force=False): diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 797a6a27a..1d45415b6 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -47,7 +47,7 @@ class ThemeManager(QtGui.QWidget): def __init__(self, parent): QtGui.QWidget.__init__(self, parent) self.parent = parent - self.settingsSection = u'themes' + self.settings_section = u'themes' self.Layout = QtGui.QVBoxLayout(self) self.Layout.setSpacing(0) self.Layout.setMargin(0) @@ -106,14 +106,14 @@ class ThemeManager(QtGui.QWidget): QtCore.SIGNAL(u'theme_update_global'), self.changeGlobalFromTab) #Variables self.themelist = [] - self.path = AppLocation.get_section_data_path(self.settingsSection) + self.path = AppLocation.get_section_data_path(self.settings_section) self.checkThemesExists(self.path) self.thumbPath = os.path.join(self.path, u'.thumbnails') self.checkThemesExists(self.thumbPath) self.amendThemeForm.path = self.path # Last little bits of setting up self.global_theme = unicode(QtCore.QSettings().value( - self.settingsSection + u'/global theme', + self.settings_section + u'/global theme', QtCore.QVariant(u'')).toString()) def changeGlobalFromTab(self, themeName): @@ -147,7 +147,7 @@ class ThemeManager(QtGui.QWidget): name = u'%s (%s)' % (self.global_theme, self.trUtf8('default')) self.ThemeListWidget.item(count).setText(name) QtCore.QSettings().setValue( - self.settingsSection + u'/global theme', + self.settings_section + u'/global theme', QtCore.QVariant(self.global_theme)) Receiver.send_message(u'theme_update_global', self.global_theme) self.pushThemes() @@ -170,7 +170,7 @@ class ThemeManager(QtGui.QWidget): def onDeleteTheme(self): self.global_theme = unicode(QtCore.QSettings().value( - self.settingsSection + u'/global theme', + self.settings_section + u'/global theme', QtCore.QVariant(u'')).toString()) item = self.ThemeListWidget.currentItem() if item: @@ -224,10 +224,10 @@ class ThemeManager(QtGui.QWidget): theme = unicode(item.data(QtCore.Qt.UserRole).toString()) path = QtGui.QFileDialog.getExistingDirectory(self, unicode(self.trUtf8('Save Theme - (%s)')) % theme, - SettingsManager.get_last_dir(self.settingsSection, 1)) + SettingsManager.get_last_dir(self.settings_section, 1)) path = unicode(path) if path: - SettingsManager.set_last_dir(self.settingsSection, path, 1) + SettingsManager.set_last_dir(self.settings_section, path, 1) themePath = os.path.join(path, theme + u'.theme') zip = None try: @@ -247,12 +247,12 @@ class ThemeManager(QtGui.QWidget): def onImportTheme(self): files = QtGui.QFileDialog.getOpenFileNames( self, self.trUtf8('Select Theme Import File'), - SettingsManager.get_last_dir(self.settingsSection), u'Theme (*.*)') + SettingsManager.get_last_dir(self.settings_section), u'Theme (*.*)') log.info(u'New Themes %s', unicode(files)) if files: for file in files: SettingsManager.set_last_dir( - self.settingsSection, unicode(file)) + self.settings_section, unicode(file)) self.unzipTheme(file, self.path) self.loadThemes() diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index dba07eb6d..09e6cadaa 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -124,7 +124,7 @@ class ThemesTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) self.theme_level = settings.value( u'theme level', QtCore.QVariant(ThemeLevel.Global)).toInt()[0] self.global_theme = unicode(settings.value( @@ -139,7 +139,7 @@ class ThemesTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) settings.setValue(u'theme level', QtCore.QVariant(self.theme_level)) settings.setValue(u'global theme', @@ -179,7 +179,7 @@ class ThemesTab(SettingsTab): """ #reload as may have been triggered by the ThemeManager self.global_theme = unicode(QtCore.QSettings().value( - self.settingsSection + u'/global theme', + self.settings_section + u'/global theme', QtCore.QVariant(u'')).toString()) self.DefaultComboBox.clear() for theme in theme_list: diff --git a/openlp/plugins/alerts/forms/alertstab.py b/openlp/plugins/alerts/forms/alertstab.py index 7cda09488..53b8d2a7a 100644 --- a/openlp/plugins/alerts/forms/alertstab.py +++ b/openlp/plugins/alerts/forms/alertstab.py @@ -229,7 +229,7 @@ class AlertsTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) self.timeout = settings.value(u'timeout', QtCore.QVariant(5)).toInt()[0] self.font_color = unicode(settings.value( u'font color', QtCore.QVariant(u'#ffffff')).toString()) @@ -260,7 +260,7 @@ class AlertsTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) self.font_face = self.FontComboBox.currentFont().family() settings.setValue(u'background color', QtCore.QVariant(self.bg_color)) settings.setValue(u'font color', QtCore.QVariant(self.font_color)) diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 80e0cef5e..7d3b7eb8c 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -189,7 +189,7 @@ class BiblesTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) self.show_new_chapters = settings.value( u'display new chapter', QtCore.QVariant(False)).toBool() self.display_style = settings.value( @@ -208,7 +208,7 @@ class BiblesTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) settings.setValue(u'display new chapter', QtCore.QVariant(self.show_new_chapters)) settings.setValue(u'display brackets', diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index c448e5066..228e39d5a 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -54,7 +54,6 @@ class BibleMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): self.PluginNameShort = u'Bible' - self.SettingsSection = title.lower() self.IconPath = u'songs/song' self.ListViewWithDnD_class = BibleListView self.lastReference = [] @@ -276,7 +275,7 @@ class BibleMediaItem(MediaManagerItem): self.SearchProgress.setObjectName(u'SearchProgress') def configUpdated(self): - if QtCore.QSettings().value(self.SettingsSection + u'/dual bibles', + if QtCore.QSettings().value(self.settings_section + u'/dual bibles', QtCore.QVariant(False)).toBool(): self.AdvancedSecondBibleLabel.setVisible(True) self.AdvancedSecondBibleComboBox.setVisible(True) diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 2b6cedfbf..2917487ff 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -67,10 +67,10 @@ class CustomTab(SettingsTab): def load(self): self.displayFooter = QtCore.QSettings().value( - self.settingsSection + u'/display footer', + self.settings_section + u'/display footer', QtCore.QVariant(True)).toBool() self.DisplayFooterCheckBox.setChecked(self.displayFooter) def save(self): - QtCore.QSettings().setValue(self.settingsSection + u'/display footer', + QtCore.QSettings().setValue(self.settings_section + u'/display footer', QtCore.QVariant(self.displayFooter)) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index c1f4ff1e6..171317e1b 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -45,7 +45,6 @@ class CustomMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): self.PluginNameShort = u'Custom' - self.SettingsSection = title.lower() self.IconPath = u'custom/custom' # this next is a class, not an instance of a class - it will # be instanced by the base MediaManagerItem @@ -164,7 +163,7 @@ class CustomMediaItem(MediaManagerItem): service_item.title = title for slide in raw_slides: service_item.add_from_text(slide[:30], slide) - if QtCore.QSettings().value(self.SettingsSection + u'/display footer', + if QtCore.QSettings().value(self.settings_section + u'/display footer', QtCore.QVariant(True)).toBool() or credit: raw_footer.append(title + u' ' + credit) else: diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 346d28b16..0cc531c0c 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -72,12 +72,12 @@ class ImageTab(SettingsTab): def load(self): self.loop_delay = QtCore.QSettings().value( - self.settingsSection + u'/loop delay', + self.settings_section + u'/loop delay', QtCore.QVariant(5)).toInt()[0] self.TimeoutSpinBox.setValue(self.loop_delay) def save(self): - QtCore.QSettings().setValue(self.settingsSection + u'/loop delay', + QtCore.QSettings().setValue(self.settings_section + u'/loop delay', QtCore.QVariant(self.loop_delay)) Receiver.send_message(u'slidecontroller_live_spin_delay', self.loop_delay) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 32ed5edb6..e417d6960 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -49,7 +49,6 @@ class ImageMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): self.PluginNameShort = u'Image' - self.SettingsSection = title.lower() self.IconPath = u'images/image' # this next is a class, not an instance of a class - it will # be instanced by the base MediaManagerItem @@ -78,12 +77,12 @@ class ImageMediaItem(MediaManagerItem): QtGui.QAbstractItemView.ExtendedSelection) self.ListView.setIconSize(QtCore.QSize(88,50)) self.servicePath = os.path.join( - AppLocation.get_section_data_path(self.SettingsSection), + AppLocation.get_section_data_path(self.settings_section), u'.thumbnails') if not os.path.exists(self.servicePath): os.mkdir(self.servicePath) self.loadList(SettingsManager.load_list( - self.SettingsSection, self.SettingsSection)) + self.settings_section, self.settings_section)) def addListViewToToolBar(self): MediaManagerItem.addListViewToToolBar(self) @@ -122,8 +121,8 @@ class ImageMediaItem(MediaManagerItem): #if not present do not worry pass self.ListView.takeItem(item.row()) - SettingsManager.set_list( - self.SettingsSection, self.getFileList()) + SettingsManager.set_list(self.settings_section, + self.settings_section, self.getFileList()) def loadList(self, list): for file in list: diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index f594fe54c..dee49f429 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -47,7 +47,6 @@ class MediaMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): self.PluginNameShort = u'Media' self.IconPath = u'images/image' - self.SettingsSection = title.lower() # this next is a class, not an instance of a class - it will # be instanced by the base MediaManagerItem self.ListViewWithDnD_class = MediaListView @@ -90,14 +89,15 @@ class MediaMediaItem(MediaManagerItem): QtGui.QAbstractItemView.ExtendedSelection) self.ListView.setIconSize(QtCore.QSize(88,50)) self.loadList(SettingsManager.load_list( - self.SettingsSection, self.SettingsSection)) + self.settings_section, self.settings_section)) def onDeleteClick(self): item = self.ListView.currentItem() if item: row = self.ListView.row(item) self.ListView.takeItem(row) - SettingsManager.set_list(self.SettingsSection, self.getFileList()) + SettingsManager.set_list(self.settings_section, + self.settings_section, self.getFileList()) def loadList(self, list): for file in list: diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index f547f0633..e8ac32a44 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -52,7 +52,6 @@ class PresentationMediaItem(MediaManagerItem): def __init__(self, parent, icon, title, controllers): self.controllers = controllers self.PluginNameShort = u'Presentation' - self.SettingsSection = title.lower() self.IconPath = u'presentations/presentation' self.Automatic = u'' # this next is a class, not an instance of a class - it will @@ -107,11 +106,12 @@ class PresentationMediaItem(MediaManagerItem): def initialise(self): self.servicePath = os.path.join( - AppLocation.get_section_data_path(self.SettingsSection), + AppLocation.get_section_data_path(self.settings_section), u'thumbnails') if not os.path.exists(self.servicePath): os.mkdir(self.servicePath) - list = SettingsManager.load_list(self.SettingsSection, u'presentations') + list = SettingsManager.load_list( + self.settings_section, u'presentations') self.loadList(list) for item in self.controllers: #load the drop down selection @@ -139,11 +139,13 @@ class PresentationMediaItem(MediaManagerItem): icon = None for controller in self.controllers: thumbPath = os.path.join( - AppLocation.get_section_data_path(self.SettingsSection), + AppLocation.get_section_data_path( + self.settings_section), u'thumbnails', controller, filename) thumb = os.path.join(thumbPath, u'slide1.png') preview = os.path.join( - AppLocation.get_section_data_path(self.SettingsSection), + AppLocation.get_section_data_path( + self.settings_section), controller, u'thumbnails', filename, u'slide1.png') if os.path.exists(preview): if os.path.exists(thumb): @@ -167,7 +169,8 @@ class PresentationMediaItem(MediaManagerItem): if item: row = self.ListView.row(item) self.ListView.takeItem(row) - SettingsManager.set_list(self.SettingsSection, self.getFileList()) + SettingsManager.set_list(self.settings_section, + self.settings_section, self.getFileList()) filepath = unicode((item.data(QtCore.Qt.UserRole)).toString()) #not sure of this has errors #John please can you look at . diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index ebcbb3d7b..998753a59 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -101,7 +101,7 @@ class PresentationTab(SettingsTab): if controller.available: checkbox = self.PresenterCheckboxes[controller.name] checkbox.setChecked(QtCore.QSettings().value( - self.settingsSection + u'/' + controller.name, + self.settings_section + u'/' + controller.name, QtCore.QVariant(0)).toInt()[0]) def save(self): @@ -109,5 +109,5 @@ class PresentationTab(SettingsTab): controller = self.controllers[key] checkbox = self.PresenterCheckboxes[controller.name] QtCore.QSettings().setValue( - self.settingsSection + u'/' + controller.name, + self.settings_section + u'/' + controller.name, QtCore.QVariant(checkbox.checkState())) diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index abdda065f..2e38c1e2b 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -57,9 +57,9 @@ class RemoteTab(SettingsTab): def load(self): self.RemotePortSpinBox.setValue( - QtCore.QSettings().value(self.settingsSection + u'/remote port', + QtCore.QSettings().value(self.settings_section + u'/remote port', QtCore.QVariant(4316)).toInt()[0]) def save(self): - QtCore.QSettings().setValue(self.settingsSection + u'/remote port', + QtCore.QSettings().setValue(self.settings_section + u'/remote port', QtCore.QVariant(self.RemotePortSpinBox.value())) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 84af7e6d0..6a99c4ef7 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -46,7 +46,6 @@ class SongMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): self.PluginNameShort = u'Song' - self.SettingsSection = title.lower() self.IconPath = u'songs/song' self.ListViewWithDnD_class = SongListView MediaManagerItem.__init__(self, parent, icon, title) @@ -134,7 +133,7 @@ class SongMediaItem(MediaManagerItem): def configUpdated(self): self.searchAsYouType = QtCore.QSettings().value( - self.SettingsSection + u'/search as type', + self.settings_section + u'/search as type', QtCore.QVariant(u'False')).toBool() def retranslateUi(self): diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index 38bdd791d..36438f6fc 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -81,7 +81,7 @@ class SongsTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) self.song_search = settings.value( u'search as type', QtCore.QVariant(False)).toBool() self.song_bar = settings.value( @@ -92,7 +92,7 @@ class SongsTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) settings.setValue(u'search as type', QtCore.QVariant(self.song_search)) settings.setValue(u'display songbar', QtCore.QVariant(self.song_bar)) settings.endGroup() diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py index 97359807f..c6156e55c 100644 --- a/openlp/plugins/songusage/forms/songusagedetailform.py +++ b/openlp/plugins/songusage/forms/songusagedetailform.py @@ -45,7 +45,6 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): """ QtGui.QDialog.__init__(self, None) self.parent = parent - self.settingsSection = u'songusage' self.setupUi(self) def initialise(self): @@ -57,15 +56,15 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): self.FromDate.setSelectedDate(fromDate) self.ToDate.setSelectedDate(toDate) self.FileLineEdit.setText( - SettingsManager.get_last_dir(self.settingsSection, 1)) + SettingsManager.get_last_dir(self.parent.settings_section, 1)) def defineOutputLocation(self): path = QtGui.QFileDialog.getExistingDirectory(self, self.trUtf8('Output File Location'), - SettingsManager.get_last_dir(self.settingsSection, 1)) + SettingsManager.get_last_dir(self.parent.settings_section, 1)) path = unicode(path) if path != u'': - SettingsManager.set_last_dir(self.settingsSection, path, 1) + SettingsManager.set_last_dir(self.parent.settings_section, path, 1) self.FileLineEdit.setText(path) def accept(self): From a582d097520553079b2f95b8c4c3a6cdca13907e Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 30 Apr 2010 02:35:41 +0100 Subject: [PATCH 12/24] Make plugin tab file locations consistent --- openlp/plugins/alerts/forms/__init__.py | 1 - openlp/plugins/alerts/lib/__init__.py | 1 + openlp/plugins/alerts/{forms => lib}/alertstab.py | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename openlp/plugins/alerts/{forms => lib}/alertstab.py (100%) diff --git a/openlp/plugins/alerts/forms/__init__.py b/openlp/plugins/alerts/forms/__init__.py index 2ef91059f..9cccd8a01 100644 --- a/openlp/plugins/alerts/forms/__init__.py +++ b/openlp/plugins/alerts/forms/__init__.py @@ -23,5 +23,4 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from alertstab import AlertsTab from alertform import AlertForm diff --git a/openlp/plugins/alerts/lib/__init__.py b/openlp/plugins/alerts/lib/__init__.py index 59a27b28e..81a2641f6 100644 --- a/openlp/plugins/alerts/lib/__init__.py +++ b/openlp/plugins/alerts/lib/__init__.py @@ -24,4 +24,5 @@ ############################################################################### from alertsmanager import AlertsManager +from alertstab import AlertsTab from manager import DBManager diff --git a/openlp/plugins/alerts/forms/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py similarity index 100% rename from openlp/plugins/alerts/forms/alertstab.py rename to openlp/plugins/alerts/lib/alertstab.py From 8d6a624c6cd6d1bf79359cbe0ed7c41c3cf805a2 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 30 Apr 2010 02:43:05 +0100 Subject: [PATCH 13/24] Fix break --- openlp/plugins/alerts/alertsplugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 2ec2db506..b3c72cc3f 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -28,8 +28,8 @@ import logging from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, build_icon, PluginStatus -from openlp.plugins.alerts.lib import AlertsManager, DBManager -from openlp.plugins.alerts.forms import AlertsTab, AlertForm +from openlp.plugins.alerts.lib import AlertsManager, AlertsTab, DBManager +from openlp.plugins.alerts.forms import AlertForm log = logging.getLogger(__name__) From c6a7549d12a158be45af078007dfe4ee6b003d25 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 30 Apr 2010 02:59:15 +0100 Subject: [PATCH 14/24] Make settings_section/last directory entries consistent --- openlp/core/ui/servicemanager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 2a4da68a4..56ac3e8b4 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1,3 +1,4 @@ +import os.path # -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 @@ -501,7 +502,8 @@ class ServiceManager(QtGui.QWidget): filename = unicode(filename) self.isNew = False SettingsManager.set_last_dir( - self.parent.service_settings_section, filename) + self.parent.service_settings_section, + os.path.split(filename)[0]) service = [] servicefile = filename + u'.osd' zip = None @@ -578,7 +580,8 @@ class ServiceManager(QtGui.QWidget): name = filename.split(os.path.sep) if filename: SettingsManager.set_last_dir( - self.parent.service_settings_section, filename) + self.parent.service_settings_section, + os.path.split(filename)[0]) zip = None f = None try: From d28498611d0a0a5109374f93f76b24c5c164e5fa Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 30 Apr 2010 06:16:06 +0100 Subject: [PATCH 15/24] Fix up video playing so main screen is hidden on start --- openlp/core/ui/maindisplay.py | 8 ++++++++ openlp/core/ui/slidecontroller.py | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 321e28e1b..652a70de0 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -131,6 +131,8 @@ class MainDisplay(DisplayWidget): self.displayBlank = False self.blankFrame = None self.frame = None + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'videodisplay_start'), self.hideDisplayForVideo) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay) QtCore.QObject.connect(Receiver.get_receiver(), @@ -197,6 +199,12 @@ class MainDisplay(DisplayWidget): else: self.showFullScreen() + def hideDisplayForVideo(self): + """ + Hides the main display if for the video to be played + """ + self.hideDisplay(HideMode.Screen) + def hideDisplay(self, mode=HideMode.Screen): """ Hide the display by making all layers transparent diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 32b301111..ca4d34826 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -782,7 +782,6 @@ class SlideController(QtGui.QWidget): if self.isLive: Receiver.send_message(u'videodisplay_start', [item, self.blankButton.isChecked()]) - Receiver.send_message(u'maindisplay_hide', HideMode.Screen) else: self.mediaObject.stop() self.mediaObject.clearQueue() From 591dc0735494059049abd212959071cce3c236ac Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 30 Apr 2010 06:50:52 +0100 Subject: [PATCH 16/24] Fix up presentations so they work again --- .../presentations/lib/messagelistener.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 8a1ddc8c7..eb31660f0 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -217,7 +217,7 @@ class MessageListener(object): isLive, item = self.decode_message(message) log.debug(u'Startup called with message %s' % message) isBlank = message[2] - file = os.path.join(item.get_frame_path(), + file = os.path.join(item.get_frame_path(), item.get_frame_title()) self.handler = item.title if self.handler == self.mediaitem.Automatic: @@ -231,14 +231,17 @@ class MessageListener(object): controller.addHandler(self.controllers[self.handler], file, isBlank) def decode_message(self, message): - return message[1], message[0] - - def slide(self, message): - isLive, item = self.decode_message(message) - if isLive: - self.liveHandler.slide(slide, live) + if len(message) == 3: + return message[1], message[0], message[2] else: - self.previewHandler.slide(slide, live) + return message[1], message[0] + + def slide(self, message): + isLive, item, slide = self.decode_message(message) + if isLive: + self.liveHandler.slide(slide, isLive) + else: + self.previewHandler.slide(slide, isLive) def first(self, message): isLive, item = self.decode_message(message) @@ -285,6 +288,6 @@ class MessageListener(object): isLive, item = self.decode_message(message) if isLive: self.liveHandler.unblank() - + def timeout(self): self.liveHandler.poll() From 8e630c5adf3409406eda9eceeb64673c1358ea79 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 30 Apr 2010 10:38:17 +0100 Subject: [PATCH 17/24] Fixes --- openlp/core/ui/slidecontroller.py | 2 ++ openlp/plugins/presentations/lib/messagelistener.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index ca4d34826..f4f355483 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -591,8 +591,10 @@ class SlideController(QtGui.QWidget): QtCore.QVariant(checked)) if checked: Receiver.send_message(u'maindisplay_hide', HideMode.Blank) + Receiver.send_message(u'presentation_blank') else: Receiver.send_message(u'maindisplay_show') + Receiver.send_message(u'presentation_unblank') def onThemeDisplay(self, checked): """ diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index eb31660f0..8bfd53bb7 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -215,7 +215,7 @@ class MessageListener(object): Save the handler as any new presentations start here """ isLive, item = self.decode_message(message) - log.debug(u'Startup called with message %s' % message) + log.debug(u'Startup called with message ' % message) isBlank = message[2] file = os.path.join(item.get_frame_path(), item.get_frame_title()) From c42054ec870f9f315bc6f427b206626db7b5f523 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 30 Apr 2010 15:30:07 +0100 Subject: [PATCH 18/24] Fix up final 802 fallout --- openlp/core/ui/displaytab.py | 4 ++-- openlp/core/ui/slidecontroller.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/displaytab.py b/openlp/core/ui/displaytab.py index 38a0baa91..b38ff0842 100644 --- a/openlp/core/ui/displaytab.py +++ b/openlp/core/ui/displaytab.py @@ -178,7 +178,7 @@ class DisplayTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) self.Xpos.setText(unicode(self.screens.current[u'size'].x())) self.Ypos.setText(unicode(self.screens.current[u'size'].y())) self.Height.setText(unicode(self.screens.current[u'size'].height())) @@ -208,7 +208,7 @@ class DisplayTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) + settings.beginGroup(self.settings_section) settings.setValue('x position', QtCore.QVariant(self.XposEdit.text())) settings.setValue('y position', diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index cbb854b85..a3bc31bf2 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -585,7 +585,7 @@ class SlideController(QtGui.QWidget): self.hideButton.setChecked(False) self.themeButton.setChecked(False) QtCore.QSettings().setValue( - self.parent.generalSettingsSection + u'/screen blank', + self.parent.general_settings_section + u'/screen blank', QtCore.QVariant(checked)) if checked: Receiver.send_message(u'maindisplay_hide', HideMode.Blank) From 932560e81db9ed6ceaa8e64b27d12286efd0f330 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 30 Apr 2010 15:49:27 +0100 Subject: [PATCH 19/24] Fix missing %s --- openlp/plugins/presentations/lib/messagelistener.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 8bfd53bb7..eb31660f0 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -215,7 +215,7 @@ class MessageListener(object): Save the handler as any new presentations start here """ isLive, item = self.decode_message(message) - log.debug(u'Startup called with message ' % message) + log.debug(u'Startup called with message %s' % message) isBlank = message[2] file = os.path.join(item.get_frame_path(), item.get_frame_title()) From 387e281da0e49ee418b301db6e05d1d8c9fc9716 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 30 Apr 2010 16:41:48 +0100 Subject: [PATCH 20/24] Fix up bugs from last merge --- openlp/core/ui/slidecontroller.py | 23 ++++- resources/forms/displaytab.py | 150 ------------------------------ 2 files changed, 21 insertions(+), 152 deletions(-) delete mode 100644 resources/forms/displaytab.py diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index a3bc31bf2..a35257f75 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -589,10 +589,10 @@ class SlideController(QtGui.QWidget): QtCore.QVariant(checked)) if checked: Receiver.send_message(u'maindisplay_hide', HideMode.Blank) - Receiver.send_message(u'presentation_blank') + self.blankPlugin(True) else: Receiver.send_message(u'maindisplay_show') - Receiver.send_message(u'presentation_unblank') + self.blankPlugin(False) def onThemeDisplay(self, checked): """ @@ -603,8 +603,10 @@ class SlideController(QtGui.QWidget): self.hideButton.setChecked(False) if checked: Receiver.send_message(u'maindisplay_hide', HideMode.Theme) + self.blankPlugin(True) else: Receiver.send_message(u'maindisplay_show') + self.blankPlugin(False) def onHideDisplay(self, checked): """ @@ -615,8 +617,25 @@ class SlideController(QtGui.QWidget): self.themeButton.setChecked(False) if checked: Receiver.send_message(u'maindisplay_hide', HideMode.Screen) + self.blankPlugin(True) else: Receiver.send_message(u'maindisplay_show') + self.blankPlugin(False) + + def blankPlugin(self, blank): + """ + Blank the display screen. + """ + if self.serviceItem is not None: + if blank: + Receiver.send_message(u'%s_blank' + % self.serviceItem.name.lower(), + [self.serviceItem, self.isLive]) + else: + Receiver.send_message(u'%s_unblank' + % self.serviceItem.name.lower(), + [self.serviceItem, self.isLive]) + def onSlideSelected(self): """ diff --git a/resources/forms/displaytab.py b/resources/forms/displaytab.py deleted file mode 100644 index 80ff2fdd5..000000000 --- a/resources/forms/displaytab.py +++ /dev/null @@ -1,150 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'displaytab.ui' -# -# Created: Tue Apr 27 06:10:08 2010 -# by: PyQt4 UI code generator 4.7.3 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -class Ui_DisplaysDialog(object): - def setupUi(self, DisplaysDialog): - DisplaysDialog.setObjectName("DisplaysDialog") - DisplaysDialog.resize(620, 716) - self.layoutWidget = QtGui.QWidget(DisplaysDialog) - self.layoutWidget.setGeometry(QtCore.QRect(0, 40, 241, 79)) - self.layoutWidget.setObjectName("layoutWidget") - self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) - self.verticalLayout.setObjectName("verticalLayout") - self.CurrentGroupBox = QtGui.QGroupBox(self.layoutWidget) - self.CurrentGroupBox.setObjectName("CurrentGroupBox") - self.horizontalLayout = QtGui.QHBoxLayout(self.CurrentGroupBox) - self.horizontalLayout.setObjectName("horizontalLayout") - self.verticalLayout_6 = QtGui.QVBoxLayout() - self.verticalLayout_6.setObjectName("verticalLayout_6") - self.XLabel = QtGui.QLabel(self.CurrentGroupBox) - self.XLabel.setAlignment(QtCore.Qt.AlignCenter) - self.XLabel.setObjectName("XLabel") - self.verticalLayout_6.addWidget(self.XLabel) - self.Xpos = QtGui.QLabel(self.CurrentGroupBox) - self.Xpos.setAlignment(QtCore.Qt.AlignCenter) - self.Xpos.setObjectName("Xpos") - self.verticalLayout_6.addWidget(self.Xpos) - self.horizontalLayout.addLayout(self.verticalLayout_6) - self.verticalLayout_7 = QtGui.QVBoxLayout() - self.verticalLayout_7.setObjectName("verticalLayout_7") - self.YLabel = QtGui.QLabel(self.CurrentGroupBox) - self.YLabel.setAlignment(QtCore.Qt.AlignCenter) - self.YLabel.setObjectName("YLabel") - self.verticalLayout_7.addWidget(self.YLabel) - self.Ypos = QtGui.QLabel(self.CurrentGroupBox) - self.Ypos.setAlignment(QtCore.Qt.AlignCenter) - self.Ypos.setObjectName("Ypos") - self.verticalLayout_7.addWidget(self.Ypos) - self.horizontalLayout.addLayout(self.verticalLayout_7) - self.verticalLayout_9 = QtGui.QVBoxLayout() - self.verticalLayout_9.setObjectName("verticalLayout_9") - self.HeightLabel = QtGui.QLabel(self.CurrentGroupBox) - self.HeightLabel.setMaximumSize(QtCore.QSize(100, 16777215)) - self.HeightLabel.setAlignment(QtCore.Qt.AlignCenter) - self.HeightLabel.setObjectName("HeightLabel") - self.verticalLayout_9.addWidget(self.HeightLabel) - self.Height = QtGui.QLabel(self.CurrentGroupBox) - self.Height.setAlignment(QtCore.Qt.AlignCenter) - self.Height.setObjectName("Height") - self.verticalLayout_9.addWidget(self.Height) - self.horizontalLayout.addLayout(self.verticalLayout_9) - self.verticalLayout_8 = QtGui.QVBoxLayout() - self.verticalLayout_8.setObjectName("verticalLayout_8") - self.WidthLabel = QtGui.QLabel(self.CurrentGroupBox) - self.WidthLabel.setAlignment(QtCore.Qt.AlignCenter) - self.WidthLabel.setObjectName("WidthLabel") - self.verticalLayout_8.addWidget(self.WidthLabel) - self.Width = QtGui.QLabel(self.CurrentGroupBox) - self.Width.setAlignment(QtCore.Qt.AlignCenter) - self.Width.setObjectName("Width") - self.verticalLayout_8.addWidget(self.Width) - self.horizontalLayout.addLayout(self.verticalLayout_8) - self.verticalLayout.addWidget(self.CurrentGroupBox) - self.CurrentGroupBox_2 = QtGui.QGroupBox(DisplaysDialog) - self.CurrentGroupBox_2.setGeometry(QtCore.QRect(0, 130, 248, 87)) - self.CurrentGroupBox_2.setMaximumSize(QtCore.QSize(500, 16777215)) - self.CurrentGroupBox_2.setObjectName("CurrentGroupBox_2") - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.CurrentGroupBox_2) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.XAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) - self.XAmendLabel.setAlignment(QtCore.Qt.AlignCenter) - self.XAmendLabel.setObjectName("XAmendLabel") - self.verticalLayout_2.addWidget(self.XAmendLabel) - self.XposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) - self.XposEdit.setMaximumSize(QtCore.QSize(50, 16777215)) - self.XposEdit.setMaxLength(4) - self.XposEdit.setObjectName("XposEdit") - self.verticalLayout_2.addWidget(self.XposEdit) - self.horizontalLayout_2.addLayout(self.verticalLayout_2) - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.YAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) - self.YAmendLabel.setAlignment(QtCore.Qt.AlignCenter) - self.YAmendLabel.setObjectName("YAmendLabel") - self.verticalLayout_3.addWidget(self.YAmendLabel) - self.YposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) - self.YposEdit.setMaximumSize(QtCore.QSize(50, 16777215)) - self.YposEdit.setMaxLength(4) - self.YposEdit.setObjectName("YposEdit") - self.verticalLayout_3.addWidget(self.YposEdit) - self.horizontalLayout_2.addLayout(self.verticalLayout_3) - self.verticalLayout_4 = QtGui.QVBoxLayout() - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.HeightAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) - self.HeightAmendLabel.setAlignment(QtCore.Qt.AlignCenter) - self.HeightAmendLabel.setObjectName("HeightAmendLabel") - self.verticalLayout_4.addWidget(self.HeightAmendLabel) - self.HeightEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) - self.HeightEdit.setMaximumSize(QtCore.QSize(50, 16777215)) - self.HeightEdit.setMaxLength(4) - self.HeightEdit.setObjectName("HeightEdit") - self.verticalLayout_4.addWidget(self.HeightEdit) - self.horizontalLayout_2.addLayout(self.verticalLayout_4) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize) - self.verticalLayout_5.setObjectName("verticalLayout_5") - self.WidthAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) - self.WidthAmendLabel.setMaximumSize(QtCore.QSize(100, 16777215)) - self.WidthAmendLabel.setAlignment(QtCore.Qt.AlignCenter) - self.WidthAmendLabel.setObjectName("WidthAmendLabel") - self.verticalLayout_5.addWidget(self.WidthAmendLabel) - self.WidthEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) - self.WidthEdit.setMaximumSize(QtCore.QSize(60, 16777215)) - self.WidthEdit.setObjectName("WidthEdit") - self.verticalLayout_5.addWidget(self.WidthEdit) - self.horizontalLayout_2.addLayout(self.verticalLayout_5) - self.OverrideCheckBox = QtGui.QCheckBox(DisplaysDialog) - self.OverrideCheckBox.setGeometry(QtCore.QRect(0, 10, 191, 23)) - self.OverrideCheckBox.setObjectName("OverrideCheckBox") - - self.retranslateUi(DisplaysDialog) - QtCore.QMetaObject.connectSlotsByName(DisplaysDialog) - - def retranslateUi(self, DisplaysDialog): - DisplaysDialog.setWindowTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Display Settings", None, QtGui.QApplication.UnicodeUTF8)) - self.CurrentGroupBox.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Default Settings", None, QtGui.QApplication.UnicodeUTF8)) - self.XLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "X", None, QtGui.QApplication.UnicodeUTF8)) - self.Xpos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) - self.YLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Y", None, QtGui.QApplication.UnicodeUTF8)) - self.Ypos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) - self.HeightLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Height", None, QtGui.QApplication.UnicodeUTF8)) - self.Height.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) - self.WidthLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Width", None, QtGui.QApplication.UnicodeUTF8)) - self.Width.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8)) - self.CurrentGroupBox_2.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Settings", None, QtGui.QApplication.UnicodeUTF8)) - self.XAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "X", None, QtGui.QApplication.UnicodeUTF8)) - self.YAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Y", None, QtGui.QApplication.UnicodeUTF8)) - self.HeightAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Height", None, QtGui.QApplication.UnicodeUTF8)) - self.WidthAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Width", None, QtGui.QApplication.UnicodeUTF8)) - self.OverrideCheckBox.setText(QtGui.QApplication.translate("DisplaysDialog", "Override Output Display", None, QtGui.QApplication.UnicodeUTF8)) - From 09da62f9cc633da67e8dd9ed55450030be2b0657 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 30 Apr 2010 17:30:25 +0100 Subject: [PATCH 21/24] Text over video --- openlp/core/ui/maindisplay.py | 9 ++++ openlp/plugins/media/lib/mediaitem.py | 45 ++++++++++++++++++- openlp/plugins/presentations/lib/mediaitem.py | 1 + 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 652a70de0..c4fe167d8 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -137,6 +137,8 @@ class MainDisplay(DisplayWidget): QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'videodisplay_background'), self.hideDisplayForVideo) def setup(self): """ @@ -351,6 +353,8 @@ class VideoDisplay(Phonon.VideoWidget): QtCore.SIGNAL(u'videodisplay_pause'), self.onMediaPause) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'videodisplay_stop'), self.onMediaStop) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'videodisplay_background'), self.onMediaBackground) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.setup) self.setVisible(False) @@ -382,6 +386,11 @@ class VideoDisplay(Phonon.VideoWidget): self.setVisible(False) self.primary = True + def onMediaBackground(self, message): + log.debug(u'VideoDisplay Queue new media message %s' % message) + source = self.mediaObject.setCurrentSource(Phonon.MediaSource(message)) + self._play() + def onMediaQueue(self, message): log.debug(u'VideoDisplay Queue new media message %s' % message) file = os.path.join(message[0].get_frame_path(), diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index dee49f429..7afe52cae 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -29,7 +29,7 @@ import os from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ - ItemCapabilities, SettingsManager + ItemCapabilities, SettingsManager, contextMenuAction, Receiver log = logging.getLogger(__name__) @@ -47,6 +47,7 @@ class MediaMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): self.PluginNameShort = u'Media' self.IconPath = u'images/image' + self.background = False # this next is a class, not an instance of a class - it will # be instanced by the base MediaManagerItem self.ListViewWithDnD_class = MediaListView @@ -71,6 +72,48 @@ class MediaMediaItem(MediaManagerItem): self.hasNewIcon = False self.hasEditIcon = False + def addListViewToToolBar(self): + MediaManagerItem.addListViewToToolBar(self) + self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) + self.ListView.addAction( + contextMenuAction( + self.ListView, u':/slides/slide_blank.png', + self.trUtf8('Replace Live Background'), + self.onReplaceClick)) + + 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') + self.blankButton = self.Toolbar.addToolbarButton( + u'Replace Background', u':/slides/slide_blank.png', + self.trUtf8('Replace Live Background'), self.onReplaceClick, False) + # Add the song widget to the page layout + self.PageLayout.addWidget(self.ImageWidget) + + def onReplaceClick(self): + if self.background: + self.background = False + Receiver.send_message(u'videodisplay_stop') + else: + self.background = True + if not self.ListView.selectedIndexes(): + QtGui.QMessageBox.information(self, + self.trUtf8('No item selected'), + self.trUtf8('You must select one item')) + items = self.ListView.selectedIndexes() + for item in items: + bitem = self.ListView.item(item.row()) + filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) + Receiver.send_message(u'videodisplay_background', filename) + + def generateSlideData(self, service_item, item=None): if item is None: item = self.ListView.currentItem() diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index e8ac32a44..62f81e5d5 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -108,6 +108,7 @@ class PresentationMediaItem(MediaManagerItem): self.servicePath = os.path.join( AppLocation.get_section_data_path(self.settings_section), u'thumbnails') + self.ListView.setIconSize(QtCore.QSize(88,50)) if not os.path.exists(self.servicePath): os.mkdir(self.servicePath) list = SettingsManager.load_list( From 79180c7f1c0df831651e5f2b80acf89a3ceda148 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 30 Apr 2010 17:57:53 +0100 Subject: [PATCH 22/24] Text over video with loop --- openlp/core/ui/maindisplay.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index c4fe167d8..1907a55b0 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -334,6 +334,7 @@ class VideoDisplay(Phonon.VideoWidget): self.parent = parent self.screens = screens self.hidden = False + self.background = False self.mediaObject = Phonon.MediaObject() self.setAspectRatio(aspect) self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory) @@ -357,6 +358,8 @@ class VideoDisplay(Phonon.VideoWidget): QtCore.SIGNAL(u'videodisplay_background'), self.onMediaBackground) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.setup) + QtCore.QObject.connect(self.mediaObject, + QtCore.SIGNAL(u'finished()'), self.onMediaBackground) self.setVisible(False) def keyPressEvent(self, event): @@ -387,8 +390,12 @@ class VideoDisplay(Phonon.VideoWidget): self.primary = True def onMediaBackground(self, message): + if not message: + message = self.message log.debug(u'VideoDisplay Queue new media message %s' % message) source = self.mediaObject.setCurrentSource(Phonon.MediaSource(message)) + self.message = message + self.background = True self._play() def onMediaQueue(self, message): @@ -416,6 +423,8 @@ class VideoDisplay(Phonon.VideoWidget): def onMediaStop(self): log.debug(u'VideoDisplay Media stopped by user') + self.background = False + self.message = None self.mediaObject.stop() self.onMediaFinish() From b81160768bca31c65fddfd4c88f91a60646c21a8 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 30 Apr 2010 22:00:17 +0100 Subject: [PATCH 23/24] Coding style fixes --- openlp/core/lib/baselistwithdnd.py | 3 +- openlp/core/lib/renderer.py | 13 +++--- openlp/core/ui/amendthemeform.py | 10 ++--- openlp/core/ui/maindisplay.py | 45 +++++++++---------- openlp/core/ui/servicemanager.py | 5 +-- openlp/core/ui/slidecontroller.py | 11 +++-- openlp/core/ui/thememanager.py | 2 +- openlp/migration/migratesongs.py | 6 +-- openlp/plugins/bibles/lib/db.py | 2 +- openlp/plugins/bibles/lib/osis.py | 2 +- openlp/plugins/custom/forms/editcustomform.py | 2 +- openlp/plugins/media/lib/mediaitem.py | 1 - .../presentations/lib/impresscontroller.py | 6 +-- .../presentations/lib/messagelistener.py | 2 +- .../presentations/lib/powerpointcontroller.py | 9 ++-- .../presentations/lib/pptviewcontroller.py | 8 ++-- .../lib/presentationcontroller.py | 6 +-- openlp/plugins/songs/forms/editsongform.py | 11 +++-- openlp/plugins/songs/lib/songxml.py | 2 +- 19 files changed, 70 insertions(+), 76 deletions(-) diff --git a/openlp/core/lib/baselistwithdnd.py b/openlp/core/lib/baselistwithdnd.py index bc043082c..d34eada98 100644 --- a/openlp/core/lib/baselistwithdnd.py +++ b/openlp/core/lib/baselistwithdnd.py @@ -48,5 +48,4 @@ class BaseListWithDnD(QtGui.QListWidget): mimeData = QtCore.QMimeData() drag.setMimeData(mimeData) mimeData.setText(self.PluginName) - dropAction = drag.start(QtCore.Qt.CopyAction) - + drag.start(QtCore.Qt.CopyAction) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 43db25d64..75229f780 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -117,8 +117,7 @@ class Renderer(object): QtGui.QImage.Format_ARGB32_Premultiplied) if self._bg_image_filename and not self.bg_image: self.bg_image = resize_image(self._bg_image_filename, - self._frame.width(), - self._frame.height()) + self._frame.width(), self._frame.height()) if self.bg_frame is None: self._generate_background_frame() @@ -223,7 +222,7 @@ class Renderer(object): ``rect_footer`` The footer text block. """ - log.debug(u'set_text_rectangle %s , %s' %(rect_main, rect_footer) ) + log.debug(u'set_text_rectangle %s , %s' % (rect_main, rect_footer)) self._rect = rect_main self._rect_footer = rect_footer @@ -268,8 +267,8 @@ class Renderer(object): QtGui.QPixmap(self._frame.width(), self._frame.height()) self.bg_frame.fill(QtCore.Qt.transparent) else: - self.bg_frame = QtGui.QImage(self._frame.width(), self._frame.height(), - QtGui.QImage.Format_ARGB32_Premultiplied) + self.bg_frame = QtGui.QImage(self._frame.width(), + self._frame.height(), QtGui.QImage.Format_ARGB32_Premultiplied) log.debug(u'render background %s start', self._theme.background_type) painter = QtGui.QPainter() painter.begin(self.bg_frame) @@ -550,8 +549,8 @@ class Renderer(object): path = QtGui.QPainterPath() path.addText(QtCore.QPointF(x, rowpos), font, line) self.painter.setBrush(self.painter.pen().brush()) - self.painter.setPen(QtGui.QPen( - QtGui.QColor(self._theme.display_outline_color), outline_size)) + self.painter.setPen(QtGui.QPen(QtGui.QColor( + self._theme.display_outline_color), outline_size)) self.painter.drawPath(path) self.painter.setPen(pen) self.painter.drawText(x, rowpos, line) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index c43d27cb5..fab72c312 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -133,7 +133,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL(u'editingFinished()'), self.onOutlineSpinBoxChanged) QtCore.QObject.connect(self.SlideTransitionCheckedBox, - QtCore.SIGNAL(u'stateChanged(int)'), self.onSlideTransitionCheckedBoxChanged) + QtCore.SIGNAL(u'stateChanged(int)'), + self.onSlideTransitionCheckedBoxChanged) def accept(self): new_theme = ThemeXML() @@ -145,10 +146,10 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): new_theme.add_background_transparent() else: if self.theme.background_type == u'solid': - new_theme.add_background_solid( \ + new_theme.add_background_solid( unicode(self.theme.background_color)) elif self.theme.background_type == u'gradient': - new_theme.add_background_gradient( \ + new_theme.add_background_gradient( unicode(self.theme.background_startColor), unicode(self.theme.background_endColor), self.theme.background_direction) @@ -158,7 +159,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): new_theme.add_background_image(filename) save_to = os.path.join(self.path, theme_name, filename) save_from = self.theme.background_filename - new_theme.add_font(unicode(self.theme.font_main_name), unicode(self.theme.font_main_color), unicode(self.theme.font_main_proportion), @@ -182,7 +182,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.font_footer_x), unicode(self.theme.font_footer_y), unicode(self.theme.font_footer_width), - unicode(self.theme.font_footer_height) ) + unicode(self.theme.font_footer_height)) new_theme.add_display(unicode(self.theme.display_shadow), unicode(self.theme.display_shadow_color), unicode(self.theme.display_outline), diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 1907a55b0..31c75e186 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -34,7 +34,6 @@ from openlp.core.ui import HideMode log = logging.getLogger(__name__) - class DisplayManager(QtGui.QWidget): """ Wrapper class to hold the display widgets. @@ -144,16 +143,16 @@ class MainDisplay(DisplayWidget): """ Sets up the screen on a particular screen. """ - log.debug(u'Setup %s for %s ' %(self.screens, - self.screens.monitor_number)) + log.debug(u'Setup %s for %s ' % ( + self.screens, self.screens.monitor_number)) self.setVisible(False) self.screen = self.screens.current #Sort out screen locations and sizes self.display_alert.setGeometry(self.screen[u'size']) - self.display_image.resize(self.screen[u'size'].width(), - self.screen[u'size'].height()) - self.display_text.resize(self.screen[u'size'].width(), - self.screen[u'size'].height()) + self.display_image.resize( + self.screen[u'size'].width(), self.screen[u'size'].height()) + self.display_text.resize( + self.screen[u'size'].width(), self.screen[u'size'].height()) self.setGeometry(self.screen[u'size']) #Build a custom splash screen self.InitialFrame = QtGui.QImage( @@ -179,8 +178,8 @@ class MainDisplay(DisplayWidget): painter.begin(self.blankFrame) painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black) #build a blank transparent image - self.transparent = QtGui.QPixmap(self.screen[u'size'].width(), - self.screen[u'size'].height()) + self.transparent = QtGui.QPixmap( + self.screen[u'size'].width(), self.screen[u'size'].height()) self.transparent.fill(QtCore.Qt.transparent) self.display_alert.setPixmap(self.transparent) self.display_text.setPixmap(self.transparent) @@ -220,19 +219,21 @@ class MainDisplay(DisplayWidget): if mode == HideMode.Screen: self.display_image.setPixmap(self.transparent) elif mode == HideMode.Blank: - self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) + self.display_image.setPixmap( + QtGui.QPixmap.fromImage(self.blankFrame)) else: if self.parent.renderManager.renderer.bg_frame: - self.display_image.setPixmap(QtGui.QPixmap.fromImage(\ + self.display_image.setPixmap(QtGui.QPixmap.fromImage( self.parent.renderManager.renderer.bg_frame)) else: - self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) + self.display_image.setPixmap( + QtGui.QPixmap.fromImage(self.blankFrame)) self.moveToTop() def moveToTop(self): log.debug(u'moveToTop') - self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint \ - | QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog) + self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | + QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog) self.show() def showDisplay(self): @@ -254,9 +255,8 @@ class MainDisplay(DisplayWidget): def addImageWithText(self, frame): log.debug(u'addImageWithText') - frame = resize_image(frame, - self.screen[u'size'].width(), - self.screen[u'size'].height() ) + frame = resize_image( + frame, self.screen[u'size'].width(), self.screen[u'size'].height()) self.display_image.setPixmap(QtGui.QPixmap.fromImage(frame)) self.moveToTop() @@ -340,8 +340,8 @@ class VideoDisplay(Phonon.VideoWidget): self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory) Phonon.createPath(self.mediaObject, self) Phonon.createPath(self.mediaObject, self.audioObject) - self.setWindowFlags(QtCore.Qt.WindowStaysOnBottomHint \ - | QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog) + self.setWindowFlags(QtCore.Qt.WindowStaysOnBottomHint | + QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_hide'), self.mediaHide) QtCore.QObject.connect(Receiver.get_receiver(), @@ -376,7 +376,7 @@ class VideoDisplay(Phonon.VideoWidget): """ Sets up the screen on a particular screen. """ - log.debug(u'VideoDisplay Setup %s for %s ' %(self.screens, + log.debug(u'VideoDisplay Setup %s for %s ' % (self.screens, self.screens.monitor_number)) self.screen = self.screens.current #Sort out screen locations and sizes @@ -393,7 +393,7 @@ class VideoDisplay(Phonon.VideoWidget): if not message: message = self.message log.debug(u'VideoDisplay Queue new media message %s' % message) - source = self.mediaObject.setCurrentSource(Phonon.MediaSource(message)) + self.mediaObject.setCurrentSource(Phonon.MediaSource(message)) self.message = message self.background = True self._play() @@ -402,7 +402,7 @@ class VideoDisplay(Phonon.VideoWidget): log.debug(u'VideoDisplay Queue new media message %s' % message) file = os.path.join(message[0].get_frame_path(), message[0].get_frame_title()) - source = self.mediaObject.setCurrentSource(Phonon.MediaSource(file)) + self.mediaObject.setCurrentSource(Phonon.MediaSource(file)) self._play() def onMediaPlay(self): @@ -442,4 +442,3 @@ class VideoDisplay(Phonon.VideoWidget): if self.hidden: self.hidden = False self._play() - diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 56ac3e8b4..b85301f8f 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1,4 +1,3 @@ -import os.path # -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 @@ -85,7 +84,7 @@ class ServiceManagerList(QtGui.QTreeWidget): mimeData = QtCore.QMimeData() drag.setMimeData(mimeData) mimeData.setText(u'ServiceManager') - dropAction = drag.start(QtCore.Qt.CopyAction) + drag.start(QtCore.Qt.CopyAction) class ServiceManager(QtGui.QWidget): """ @@ -797,7 +796,7 @@ class ServiceManager(QtGui.QWidget): plugin = event.mimeData().text() item = self.ServiceManagerList.itemAt(event.pos()) if plugin == u'ServiceManager': - startpos, startCount = self.findServiceItem() + startpos, startCount = self.findServiceItem() if item is None: endpos = len(self.serviceItems) else: diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index a35257f75..6648bed00 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -200,7 +200,7 @@ class SlideController(QtGui.QWidget): if isLive: self.Toolbar.addToolbarSeparator(u'Loop Separator') self.Toolbar.addToolbarButton( - u'Start Loop', u':/media/media_time.png', + u'Start Loop', u':/media/media_time.png', self.trUtf8('Start continuous loop'), self.onStartLoop) self.Toolbar.addToolbarButton( u'Stop Loop', u':/media/media_stop.png', @@ -217,13 +217,13 @@ class SlideController(QtGui.QWidget): #Build a Media ToolBar self.Mediabar = OpenLPToolbar(self) self.Mediabar.addToolbarButton( - u'Media Start', u':/slides/media_playback_start.png', + u'Media Start', u':/slides/media_playback_start.png', self.trUtf8('Start playing media'), self.onMediaPlay) self.Mediabar.addToolbarButton( - u'Media Pause', u':/slides/media_playback_pause.png', + u'Media Pause', u':/slides/media_playback_pause.png', self.trUtf8('Start playing media'), self.onMediaPause) self.Mediabar.addToolbarButton( - u'Media Stop', u':/slides/media_playback_stop.png', + u'Media Stop', u':/slides/media_playback_stop.png', self.trUtf8('Start playing media'), self.onMediaStop) if self.isLive: self.blankButton = self.Mediabar.addToolbarButton( @@ -636,7 +636,6 @@ class SlideController(QtGui.QWidget): % self.serviceItem.name.lower(), [self.serviceItem, self.isLive]) - def onSlideSelected(self): """ Generate the preview when you click on a slide. @@ -727,7 +726,7 @@ class SlideController(QtGui.QWidget): if not self.serviceItem: return Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(), - [self.serviceItem, self.isLive]) + [self.serviceItem, self.isLive]) if self.serviceItem.is_command(): self.updatePreview() else: diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index b6ed2366d..8c3897fd1 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -295,7 +295,7 @@ class ThemeManager(QtGui.QWidget): self.pushThemes() def pushThemes(self): - Receiver.send_message(u'theme_update_list', self.getThemes() ) + Receiver.send_message(u'theme_update_list', self.getThemes()) def getThemes(self): return self.themelist diff --git a/openlp/migration/migratesongs.py b/openlp/migration/migratesongs.py index a46f50a54..b43b1e68a 100644 --- a/openlp/migration/migratesongs.py +++ b/openlp/migration/migratesongs.py @@ -47,7 +47,7 @@ def init_models(url): mapper(TAuthor, temp_authors_table) mapper(Book, song_books_table) mapper(Song, songs_table, - properties={'authors': relation(Author, backref='songs', + properties={'authors': relation(Author, backref='songs', secondary=authors_songs_table), 'book': relation(Book, backref='songs'), 'topics': relation(Topic, backref='songs', @@ -156,13 +156,13 @@ class MigrateSongs(): print songs_temp.songtitle aa = self.session.execute( u'select * from songauthors_temp where songid =' + \ - unicode(songs_temp.songid) ) + unicode(songs_temp.songid)) for row in aa: a = row['authorid'] authors_temp = self.session.query(TAuthor).get(a) bb = self.session.execute( u'select * from authors where display_name = \"%s\"' % \ - unicode(authors_temp.authorname) ).fetchone() + unicode(authors_temp.authorname)).fetchone() if bb is None: author = Author() author.display_name = authors_temp.authorname diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index c95884693..79a650541 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -111,7 +111,7 @@ class BibleDB(QtCore.QObject): ``old_filename`` The "dirty" file name or version name. """ - if not isinstance(old_filename, unicode): + if not isinstance(old_filename, unicode): old_filename = unicode(old_filename, u'utf-8') old_filename = re.sub(r'[^\w]+', u'_', old_filename).strip(u'_') return old_filename + u'.sqlite' diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index bddf04a5a..104e2adb8 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -165,7 +165,7 @@ class OSISBible(BibleDB): verse_text = verse_text.replace(u'', u'')\ .replace(u'', u'').replace(u'', u'')\ .replace(u'', u'').replace(u'', u'')\ - .replace(u'', u'').replace(u'', u'') + .replace(u'', u'').replace(u'', u'') verse_text = self.spaces_regex.sub(u' ', verse_text) self.create_verse(db_book.id, chapter, verse, verse_text) Receiver.send_message(u'openlp_process_events') diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index eff6bc835..373c29794 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -271,4 +271,4 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): if self.VerseTextEdit.toPlainText(): self.VerseTextEdit.setFocus() return False, self.trUtf8('You have unsaved data, please save or clear') - return True, u'' + return True, u'' diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 7afe52cae..4f9c5e486 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -113,7 +113,6 @@ class MediaMediaItem(MediaManagerItem): filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) Receiver.send_message(u'videodisplay_background', filename) - def generateSlideData(self, service_item, item=None): if item is None: item = self.ListView.currentItem() diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 92717b6d7..a1a025c02 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -47,7 +47,7 @@ else: from PyQt4 import QtCore -from presentationcontroller import PresentationController, PresentationDocument +from presentationcontroller import PresentationController, PresentationDocument log = logging.getLogger(__name__) @@ -171,13 +171,13 @@ class ImpressController(PresentationController): def add_doc(self, name): log.debug(u'Add Doc OpenOffice') - doc = ImpressDocument(self, name) + doc = ImpressDocument(self, name) self.docs.append(doc) return doc class ImpressDocument(PresentationDocument): - def __init__(self, controller, presentation): + def __init__(self, controller, presentation): log.debug(u'Init Presentation OpenOffice') self.controller = controller self.document = None diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index eb31660f0..b15f25642 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -44,7 +44,7 @@ class Controller(object): self.doc = None log.info(u'%s controller loaded' % live) - def addHandler(self, controller, file, isBlank): + def addHandler(self, controller, file, isBlank): log.debug(u'Live = %s, addHandler %s' % (self.isLive, file)) self.controller = controller if self.doc is not None: diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 67870574d..3ea95f509 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -31,7 +31,7 @@ if os.name == u'nt': import _winreg import win32ui -from presentationcontroller import PresentationController, PresentationDocument +from presentationcontroller import PresentationController, PresentationDocument log = logging.getLogger(__name__) @@ -62,7 +62,8 @@ class PowerpointController(PresentationController): log.debug(u'check_available') if os.name == u'nt': try: - _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, u'PowerPoint.Application').Close() + _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, + u'PowerPoint.Application').Close() return True except: pass @@ -96,13 +97,13 @@ class PowerpointController(PresentationController): def add_doc(self, name): log.debug(u'Add Doc PowerPoint') - doc = PowerpointDocument(self, name) + doc = PowerpointDocument(self, name) self.docs.append(doc) return doc class PowerpointDocument(PresentationDocument): - def __init__(self, controller, presentation): + def __init__(self, controller, presentation): log.debug(u'Init Presentation Powerpoint') self.presentation = None self.controller = controller diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 455e1c601..e45fac45f 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -82,7 +82,8 @@ class PptviewController(PresentationController): if self.process: return log.debug(u'start PPTView') - self.process = cdll.LoadLibrary(r'openlp\plugins\presentations\lib\pptviewlib\pptviewlib.dll') + self.process = cdll.LoadLibrary( + r'openlp\plugins\presentations\lib\pptviewlib\pptviewlib.dll') def kill(self): """ @@ -94,13 +95,12 @@ class PptviewController(PresentationController): def add_doc(self, name): log.debug(u'Add Doc PPTView') - doc = PptviewDocument(self, name) + doc = PptviewDocument(self, name) self.docs.append(doc) return doc class PptviewDocument(PresentationDocument): - - def __init__(self, controller, presentation): + def __init__(self, controller, presentation): log.debug(u'Init Presentation PowerPoint') self.presentation = None self.pptid = None diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index fa6e9474d..1407820bc 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -210,7 +210,7 @@ class PresentationDocument(object): Returns a path to an image containing a preview for the requested slide """ - def __init__(self, controller, name): + def __init__(self, controller, name): self.slidenumber = 0 self.controller = controller self.store_filename(name) @@ -243,10 +243,10 @@ class PresentationDocument(object): if not os.path.isdir(self.thumbnailpath): os.mkdir(self.thumbnailpath) - def get_file_name(self, presentation): + def get_file_name(self, presentation): return os.path.split(presentation)[1] - def get_thumbnail_path(self, presentation): + def get_thumbnail_path(self, presentation): return os.path.join( self.controller.thumbnailroot, self.get_file_name(presentation)) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 8e8e873a6..4c3f78e2f 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -150,8 +150,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def loadBooks(self): books = self.songmanager.get_books() booksCompleter = QtGui.QCompleter( - [book.name for book in books], - self.SongbookCombo) + [book.name for book in books], self.SongbookCombo) booksCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); self.SongbookCombo.setCompleter(booksCompleter); self.SongbookCombo.clear() @@ -340,7 +339,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.verse_form.setVerse(u'', self.VerseListWidget.count() + 1, True) if self.verse_form.exec_(): afterText, verse, subVerse = self.verse_form.getVerse() - data = u'%s:%s' %(verse, subVerse) + data = u'%s:%s' % (verse, subVerse) item = QtGui.QListWidgetItem(afterText) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data)) item.setText(afterText) @@ -351,11 +350,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): if item: tempText = item.text() verseId = unicode((item.data(QtCore.Qt.UserRole)).toString()) - self.verse_form.setVerse(tempText, \ - self.VerseListWidget.count(), True, verseId) + self.verse_form.setVerse( + tempText, self.VerseListWidget.count(), True, verseId) if self.verse_form.exec_(): afterText, verse, subVerse = self.verse_form.getVerse() - data = u'%s:%s' %(verse, subVerse) + data = u'%s:%s' % (verse, subVerse) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data)) item.setText(afterText) #number of lines has change so repaint the list moving the data diff --git a/openlp/plugins/songs/lib/songxml.py b/openlp/plugins/songs/lib/songxml.py index 71506ff2d..2dc55ff7d 100644 --- a/openlp/plugins/songs/lib/songxml.py +++ b/openlp/plugins/songs/lib/songxml.py @@ -137,7 +137,7 @@ class _OpenSong(XmlRootClass): newtag = "Pre-chorus" else: newtag = t - s = (u'# %s %s'%(newtag, c)).rstrip() + s = (u'# %s %s' % (newtag, c)).rstrip() res.append(s) res.append(l[1:]) if (len(l) == 0) and (not tagPending): From 5a7e36b5bcd00f74da4597e0f63a791997756e67 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 30 Apr 2010 23:38:15 +0100 Subject: [PATCH 24/24] Correct settingsSection naming convention --- openlp/core/lib/mediamanageritem.py | 10 ++++----- openlp/core/lib/plugin.py | 8 +++---- openlp/core/lib/settingstab.py | 2 +- openlp/core/ui/displaytab.py | 4 ++-- openlp/core/ui/generaltab.py | 6 ++--- openlp/core/ui/mainwindow.py | 22 +++++++++---------- openlp/core/ui/mediadockmanager.py | 4 ++-- openlp/core/ui/servicemanager.py | 20 ++++++++--------- openlp/core/ui/slidecontroller.py | 4 ++-- openlp/core/ui/thememanager.py | 18 +++++++-------- openlp/core/ui/themestab.py | 6 ++--- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/alerts/lib/alertstab.py | 4 ++-- .../plugins/bibles/forms/importwizardform.py | 6 ++--- openlp/plugins/bibles/lib/biblestab.py | 4 ++-- openlp/plugins/bibles/lib/manager.py | 8 +++---- openlp/plugins/bibles/lib/mediaitem.py | 2 +- openlp/plugins/custom/lib/customtab.py | 4 ++-- openlp/plugins/custom/lib/mediaitem.py | 2 +- openlp/plugins/images/lib/imagetab.py | 4 ++-- openlp/plugins/images/lib/mediaitem.py | 8 +++---- openlp/plugins/media/lib/mediaitem.py | 6 ++--- openlp/plugins/presentations/lib/mediaitem.py | 12 +++++----- .../lib/presentationcontroller.py | 6 ++--- .../presentations/lib/presentationtab.py | 4 ++-- openlp/plugins/remotes/lib/remotetab.py | 4 ++-- openlp/plugins/remotes/remoteplugin.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/songstab.py | 4 ++-- .../songusage/forms/songusagedetailform.py | 6 ++--- openlp/plugins/songusage/songusageplugin.py | 4 ++-- resources/pyinstaller/hook-lxml.objectify.py | 2 +- 32 files changed, 100 insertions(+), 100 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 83937160e..33901fb80 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -98,7 +98,7 @@ class MediaManagerItem(QtGui.QWidget): """ QtGui.QWidget.__init__(self) self.parent = parent - self.settings_section = title.lower() + self.settingsSection = title.lower() if type(icon) is QtGui.QIcon: self.icon = icon elif type(icon) is types.StringType: @@ -331,15 +331,15 @@ class MediaManagerItem(QtGui.QWidget): def onFileClick(self): files = QtGui.QFileDialog.getOpenFileNames( self, self.OnNewPrompt, - SettingsManager.get_last_dir(self.settings_section), + SettingsManager.get_last_dir(self.settingsSection), self.OnNewFileMasks) log.info(u'New files(s) %s', unicode(files)) if files: self.loadList(files) dir = os.path.split(unicode(files[0]))[0] - SettingsManager.set_last_dir(self.settings_section, dir) - SettingsManager.set_list(self.settings_section, - self.settings_section, self.getFileList()) + SettingsManager.set_last_dir(self.settingsSection, dir) + SettingsManager.set_list(self.settingsSection, + self.settingsSection, self.getFileList()) def getFileList(self): count = 0 diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index c7a257700..c1e06f780 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -51,7 +51,7 @@ class Plugin(QtCore.QObject): ``version`` The version number of this iteration of the plugin. - ``settings_section`` + ``settingsSection`` The namespace to store settings for the plugin. ``icon`` @@ -116,7 +116,7 @@ class Plugin(QtCore.QObject): self.name = name if version: self.version = version - self.settings_section = self.name.lower() + self.settingsSection = self.name.lower() self.icon = None self.weight = 0 self.status = PluginStatus.Inactive @@ -147,7 +147,7 @@ class Plugin(QtCore.QObject): Sets the status of the plugin """ self.status = QtCore.QSettings().value( - self.settings_section + u'/status', + self.settingsSection + u'/status', QtCore.QVariant(PluginStatus.Inactive)).toInt()[0] def toggle_status(self, new_status): @@ -156,7 +156,7 @@ class Plugin(QtCore.QObject): """ self.status = new_status QtCore.QSettings().setValue( - self.settings_section + u'/status', QtCore.QVariant(self.status)) + self.settingsSection + u'/status', QtCore.QVariant(self.status)) def is_active(self): """ diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 8b9cc4261..0b862d9f8 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -40,7 +40,7 @@ class SettingsTab(QtGui.QWidget): QtGui.QWidget.__init__(self) self.tabTitle = title self.tabTitleVisible = None - self.settings_section = self.tabTitle.lower() + self.settingsSection = self.tabTitle.lower() self.setupUi() self.retranslateUi() self.initialise() diff --git a/openlp/core/ui/displaytab.py b/openlp/core/ui/displaytab.py index b38ff0842..38a0baa91 100644 --- a/openlp/core/ui/displaytab.py +++ b/openlp/core/ui/displaytab.py @@ -178,7 +178,7 @@ class DisplayTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) self.Xpos.setText(unicode(self.screens.current[u'size'].x())) self.Ypos.setText(unicode(self.screens.current[u'size'].y())) self.Height.setText(unicode(self.screens.current[u'size'].height())) @@ -208,7 +208,7 @@ class DisplayTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) settings.setValue('x position', QtCore.QVariant(self.XposEdit.text())) settings.setValue('y position', diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 4616a62ba..ac4f92336 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -42,7 +42,7 @@ class GeneralTab(SettingsTab): If not set before default to last screen. """ settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) self.MonitorNumber = settings.value(u'monitor', QtCore.QVariant(self.screens.monitor_number)).toInt()[0] self.screens.set_current_display(self.MonitorNumber) @@ -229,7 +229,7 @@ class GeneralTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) for screen in self.screens.screen_list: screen_name = u'%s %d' % (self.trUtf8('Screen'), screen[u'number'] + 1) @@ -268,7 +268,7 @@ class GeneralTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber)) settings.setValue(u'display on monitor', QtCore.QVariant(self.DisplayOnMonitor)) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 7c5f3ce24..df275dd20 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -426,10 +426,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.applicationVersion = applicationVersion # Set up settings sections for the main application # (not for use by plugins) - self.ui_settings_section = u'user interface' - self.general_settings_section = u'general' - self.service_settings_section = u'servicemanager' - self.songs_settings_section = u'songs' + self.uiSettingsSection = u'user interface' + self.generalSettingsSection = u'general' + self.serviceSettingsSection = u'servicemanager' + self.songsSettingsSection = u'songs' self.serviceNotSaved = False self.settingsmanager = SettingsManager(screens) self.displayManager = DisplayManager(screens) @@ -576,7 +576,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.displayManager.mainDisplay.setFocus() self.activateWindow() if QtCore.QSettings().value( - self.general_settings_section + u'/auto open', + self.generalSettingsSection + u'/auto open', QtCore.QVariant(False)).toBool(): self.ServiceManagerContents.onLoadService(True) @@ -586,7 +586,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): Triggered by delay thread. """ settings = QtCore.QSettings() - settings.beginGroup(self.general_settings_section) + settings.beginGroup(self.generalSettingsSection) if settings.value(u'screen blank', QtCore.QVariant(False)).toBool() \ and settings.value(u'blank warning', QtCore.QVariant(False)).toBool(): self.LiveController.onBlankDisplay(True) @@ -731,10 +731,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def loadSettings(self): log.debug(u'Loading QSettings') settings = QtCore.QSettings() - settings.beginGroup(self.general_settings_section) + settings.beginGroup(self.generalSettingsSection) self.recentFiles = settings.value(u'recent files').toStringList() settings.endGroup() - settings.beginGroup(self.ui_settings_section) + settings.beginGroup(self.uiSettingsSection) self.move(settings.value(u'main window position', QtCore.QVariant(QtCore.QPoint(0, 0))).toPoint()) self.restoreGeometry( @@ -745,12 +745,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def saveSettings(self): log.debug(u'Saving QSettings') settings = QtCore.QSettings() - settings.beginGroup(self.general_settings_section) + settings.beginGroup(self.generalSettingsSection) recentFiles = QtCore.QVariant(self.recentFiles) \ if self.recentFiles else QtCore.QVariant() settings.setValue(u'recent files', recentFiles) settings.endGroup() - settings.beginGroup(self.ui_settings_section) + settings.beginGroup(self.uiSettingsSection) settings.setValue(u'main window position', QtCore.QVariant(self.pos())) settings.setValue(u'main window state', @@ -780,7 +780,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def addRecentFile(self, filename): recentFileCount = QtCore.QSettings().value( - self.general_settings_section + u'/max recent files', + self.generalSettingsSection + u'/max recent files', QtCore.QVariant(4)).toInt()[0] if filename and not self.recentFiles.contains(filename): self.recentFiles.prepend(QtCore.QString(filename)) diff --git a/openlp/core/ui/mediadockmanager.py b/openlp/core/ui/mediadockmanager.py index aece0729e..782383cd4 100644 --- a/openlp/core/ui/mediadockmanager.py +++ b/openlp/core/ui/mediadockmanager.py @@ -45,7 +45,7 @@ class MediaDockManager(object): log.debug(u'Inserting %s dock' % media_item.title) match = False for dock_index in range(0, self.media_dock.count()): - if self.media_dock.widget(dock_index).settings_section == \ + if self.media_dock.widget(dock_index).settingsSection == \ media_item.title.lower(): match = True break @@ -56,6 +56,6 @@ class MediaDockManager(object): log.debug(u'remove %s dock' % name) for dock_index in range(0, self.media_dock.count()): if self.media_dock.widget(dock_index): - if self.media_dock.widget(dock_index).settings_section == name: + if self.media_dock.widget(dock_index).settingsSection == name: self.media_dock.widget(dock_index).hide() self.media_dock.removeItem(dock_index) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index b85301f8f..a92e923d5 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -191,7 +191,7 @@ class ServiceManager(QtGui.QWidget): QtCore.SIGNAL(u'config_updated'), self.regenerateServiceItems) # Last little bits of setting up self.service_theme = unicode(QtCore.QSettings().value( - self.parent.service_settings_section + u'/service theme', + self.parent.serviceSettingsSection + u'/service theme', QtCore.QVariant(u'')).toString()) self.servicePath = AppLocation.get_section_data_path(u'servicemanager') #build the context menu @@ -404,7 +404,7 @@ class ServiceManager(QtGui.QWidget): Clear the list to create a new service """ if self.parent.serviceNotSaved and QtCore.QSettings().value( - self.parent.general_settings_section + u'/save prompt', + self.parent.generalSettingsSection + u'/save prompt', QtCore.QVariant(False)).toBool(): ret = QtGui.QMessageBox.question(self, self.trUtf8('Save Changes to Service?'), @@ -489,11 +489,11 @@ class ServiceManager(QtGui.QWidget): if not quick or self.isNew: filename = QtGui.QFileDialog.getSaveFileName(self, self.trUtf8(u'Save Service'), - SettingsManager.get_last_dir(self.parent.service_settings_section), + SettingsManager.get_last_dir(self.parent.serviceSettingsSection), self.trUtf8(u'OpenLP Service Files (*.osz)')) else: filename = SettingsManager.get_last_dir( - self.parent.service_settings_section) + self.parent.serviceSettingsSection) if filename: splittedFile = filename.split(u'.') if splittedFile[-1] != u'osz': @@ -501,7 +501,7 @@ class ServiceManager(QtGui.QWidget): filename = unicode(filename) self.isNew = False SettingsManager.set_last_dir( - self.parent.service_settings_section, + self.parent.serviceSettingsSection, os.path.split(filename)[0]) service = [] servicefile = filename + u'.osd' @@ -544,12 +544,12 @@ class ServiceManager(QtGui.QWidget): def onLoadService(self, lastService=False): if lastService: filename = SettingsManager.get_last_dir( - self.parent.service_settings_section) + self.parent.serviceSettingsSection) else: filename = QtGui.QFileDialog.getOpenFileName( self, self.trUtf8('Open Service'), SettingsManager.get_last_dir( - self.parent.service_settings_section), u'Services (*.osz)') + self.parent.serviceSettingsSection), u'Services (*.osz)') self.loadService(filename) def loadService(self, filename=None): @@ -579,7 +579,7 @@ class ServiceManager(QtGui.QWidget): name = filename.split(os.path.sep) if filename: SettingsManager.set_last_dir( - self.parent.service_settings_section, + self.parent.serviceSettingsSection, os.path.split(filename)[0]) zip = None f = None @@ -650,7 +650,7 @@ class ServiceManager(QtGui.QWidget): self.service_theme = unicode(self.ThemeComboBox.currentText()) self.parent.RenderManager.set_service_theme(self.service_theme) QtCore.QSettings().setValue( - self.parent.service_settings_section + u'/service theme', + self.parent.serviceSettingsSection + u'/service theme', QtCore.QVariant(self.service_theme)) self.regenerateServiceItems() @@ -734,7 +734,7 @@ class ServiceManager(QtGui.QWidget): self.parent.LiveController.addServiceManagerItem( self.serviceItems[item][u'service_item'], count) if QtCore.QSettings().value( - self.parent.general_settings_section + u'/auto preview', + self.parent.generalSettingsSection + u'/auto preview', QtCore.QVariant(False)).toBool(): item += 1 if self.serviceItems and item < len(self.serviceItems) and \ diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 6648bed00..8a0fa5641 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -396,7 +396,7 @@ class SlideController(QtGui.QWidget): if item.is_text(): self.Toolbar.makeWidgetsInvisible(self.loop_list) if QtCore.QSettings().value( - self.parent.songs_settings_section + u'/show songbar', + self.parent.songsSettingsSection + u'/show songbar', QtCore.QVariant(True)).toBool() and len(self.slideList) > 0: self.Toolbar.makeWidgetsVisible([u'Song Menu']) if item.is_capable(ItemCapabilities.AllowsLoop) and \ @@ -585,7 +585,7 @@ class SlideController(QtGui.QWidget): self.hideButton.setChecked(False) self.themeButton.setChecked(False) QtCore.QSettings().setValue( - self.parent.general_settings_section + u'/screen blank', + self.parent.generalSettingsSection + u'/screen blank', QtCore.QVariant(checked)) if checked: Receiver.send_message(u'maindisplay_hide', HideMode.Blank) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 8c3897fd1..4b356f758 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -47,7 +47,7 @@ class ThemeManager(QtGui.QWidget): def __init__(self, parent): QtGui.QWidget.__init__(self, parent) self.parent = parent - self.settings_section = u'themes' + self.settingsSection = u'themes' self.Layout = QtGui.QVBoxLayout(self) self.Layout.setSpacing(0) self.Layout.setMargin(0) @@ -106,14 +106,14 @@ class ThemeManager(QtGui.QWidget): QtCore.SIGNAL(u'theme_update_global'), self.changeGlobalFromTab) #Variables self.themelist = [] - self.path = AppLocation.get_section_data_path(self.settings_section) + self.path = AppLocation.get_section_data_path(self.settingsSection) self.checkThemesExists(self.path) self.thumbPath = os.path.join(self.path, u'thumbnails') self.checkThemesExists(self.thumbPath) self.amendThemeForm.path = self.path # Last little bits of setting up self.global_theme = unicode(QtCore.QSettings().value( - self.settings_section + u'/global theme', + self.settingsSection + u'/global theme', QtCore.QVariant(u'')).toString()) def changeGlobalFromTab(self, themeName): @@ -147,7 +147,7 @@ class ThemeManager(QtGui.QWidget): name = u'%s (%s)' % (self.global_theme, self.trUtf8('default')) self.ThemeListWidget.item(count).setText(name) QtCore.QSettings().setValue( - self.settings_section + u'/global theme', + self.settingsSection + u'/global theme', QtCore.QVariant(self.global_theme)) Receiver.send_message(u'theme_update_global', self.global_theme) self.pushThemes() @@ -170,7 +170,7 @@ class ThemeManager(QtGui.QWidget): def onDeleteTheme(self): self.global_theme = unicode(QtCore.QSettings().value( - self.settings_section + u'/global theme', + self.settingsSection + u'/global theme', QtCore.QVariant(u'')).toString()) item = self.ThemeListWidget.currentItem() if item: @@ -224,10 +224,10 @@ class ThemeManager(QtGui.QWidget): theme = unicode(item.data(QtCore.Qt.UserRole).toString()) path = QtGui.QFileDialog.getExistingDirectory(self, unicode(self.trUtf8('Save Theme - (%s)')) % theme, - SettingsManager.get_last_dir(self.settings_section, 1)) + SettingsManager.get_last_dir(self.settingsSection, 1)) path = unicode(path) if path: - SettingsManager.set_last_dir(self.settings_section, path, 1) + SettingsManager.set_last_dir(self.settingsSection, path, 1) themePath = os.path.join(path, theme + u'.theme') zip = None try: @@ -247,12 +247,12 @@ class ThemeManager(QtGui.QWidget): def onImportTheme(self): files = QtGui.QFileDialog.getOpenFileNames( self, self.trUtf8('Select Theme Import File'), - SettingsManager.get_last_dir(self.settings_section), u'Theme (*.*)') + SettingsManager.get_last_dir(self.settingsSection), u'Theme (*.*)') log.info(u'New Themes %s', unicode(files)) if files: for file in files: SettingsManager.set_last_dir( - self.settings_section, unicode(file)) + self.settingsSection, unicode(file)) self.unzipTheme(file, self.path) self.loadThemes() diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 09e6cadaa..dba07eb6d 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -124,7 +124,7 @@ class ThemesTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) self.theme_level = settings.value( u'theme level', QtCore.QVariant(ThemeLevel.Global)).toInt()[0] self.global_theme = unicode(settings.value( @@ -139,7 +139,7 @@ class ThemesTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) settings.setValue(u'theme level', QtCore.QVariant(self.theme_level)) settings.setValue(u'global theme', @@ -179,7 +179,7 @@ class ThemesTab(SettingsTab): """ #reload as may have been triggered by the ThemeManager self.global_theme = unicode(QtCore.QSettings().value( - self.settings_section + u'/global theme', + self.settingsSection + u'/global theme', QtCore.QVariant(u'')).toString()) self.DefaultComboBox.clear() for theme in theme_list: diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index b3c72cc3f..f97540029 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -84,7 +84,7 @@ class alertsPlugin(Plugin): def togglealertsState(self): self.alertsActive = not self.alertsActive QtCore.QSettings().setValue( - self.settings_section + u'/active', + self.settingsSection + u'/active', QtCore.QVariant(self.alertsActive)) def onAlertsTrigger(self): diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 53b8d2a7a..7cda09488 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -229,7 +229,7 @@ class AlertsTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) self.timeout = settings.value(u'timeout', QtCore.QVariant(5)).toInt()[0] self.font_color = unicode(settings.value( u'font color', QtCore.QVariant(u'#ffffff')).toString()) @@ -260,7 +260,7 @@ class AlertsTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) self.font_face = self.FontComboBox.currentFont().family() settings.setValue(u'background color', QtCore.QVariant(self.bg_color)) settings.setValue(u'font color', QtCore.QVariant(self.font_color)) diff --git a/openlp/plugins/bibles/forms/importwizardform.py b/openlp/plugins/bibles/forms/importwizardform.py index d3e8acd73..f5dbc8ee0 100644 --- a/openlp/plugins/bibles/forms/importwizardform.py +++ b/openlp/plugins/bibles/forms/importwizardform.py @@ -274,7 +274,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): def setDefaults(self): settings = QtCore.QSettings() - settings.beginGroup(self.bibleplugin.settings_section) + settings.beginGroup(self.bibleplugin.settingsSection) self.setField(u'source_format', QtCore.QVariant(0)) self.setField(u'osis_location', QtCore.QVariant('')) self.setField(u'csv_booksfile', QtCore.QVariant('')) @@ -345,11 +345,11 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): def getFileName(self, title, editbox): filename = QtGui.QFileDialog.getOpenFileName(self, title, - SettingsManager.get_last_dir(self.bibleplugin.settings_section, 1)) + SettingsManager.get_last_dir(self.bibleplugin.settingsSection, 1)) if filename: editbox.setText(filename) SettingsManager.set_last_dir( - self.bibleplugin.settings_section, filename, 1) + self.bibleplugin.settingsSection, filename, 1) def incrementProgressBar(self, status_text): log.debug(u'IncrementBar %s', status_text) diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 7d3b7eb8c..80e0cef5e 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -189,7 +189,7 @@ class BiblesTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) self.show_new_chapters = settings.value( u'display new chapter', QtCore.QVariant(False)).toBool() self.display_style = settings.value( @@ -208,7 +208,7 @@ class BiblesTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) settings.setValue(u'display new chapter', QtCore.QVariant(self.show_new_chapters)) settings.setValue(u'display brackets', diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index d8fe3e156..8a87288f3 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -109,12 +109,12 @@ class BibleManager(object): """ log.debug(u'Bible Initialising') self.parent = parent - self.settings_section = u'bibles' + self.settingsSection = u'bibles' self.web = u'Web' self.db_cache = None - self.path = AppLocation.get_section_data_path(self.settings_section) + self.path = AppLocation.get_section_data_path(self.settingsSection) self.proxy_name = unicode( - QtCore.QSettings().value(self.settings_section + u'/proxy name', + QtCore.QSettings().value(self.settingsSection + u'/proxy name', QtCore.QVariant(u'')).toString()) self.suffix = u'.sqlite' self.import_wizard = None @@ -128,7 +128,7 @@ class BibleManager(object): BibleDB class. """ log.debug(u'Reload bibles') - files = SettingsManager.get_files(self.settings_section, self.suffix) + files = SettingsManager.get_files(self.settingsSection, self.suffix) log.debug(u'Bible Files %s', files) self.db_cache = {} for filename in files: diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 228e39d5a..4ed28032c 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -275,7 +275,7 @@ class BibleMediaItem(MediaManagerItem): self.SearchProgress.setObjectName(u'SearchProgress') def configUpdated(self): - if QtCore.QSettings().value(self.settings_section + u'/dual bibles', + if QtCore.QSettings().value(self.settingsSection + u'/dual bibles', QtCore.QVariant(False)).toBool(): self.AdvancedSecondBibleLabel.setVisible(True) self.AdvancedSecondBibleComboBox.setVisible(True) diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 2917487ff..2b6cedfbf 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -67,10 +67,10 @@ class CustomTab(SettingsTab): def load(self): self.displayFooter = QtCore.QSettings().value( - self.settings_section + u'/display footer', + self.settingsSection + u'/display footer', QtCore.QVariant(True)).toBool() self.DisplayFooterCheckBox.setChecked(self.displayFooter) def save(self): - QtCore.QSettings().setValue(self.settings_section + u'/display footer', + QtCore.QSettings().setValue(self.settingsSection + u'/display footer', QtCore.QVariant(self.displayFooter)) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 171317e1b..599d73625 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -163,7 +163,7 @@ class CustomMediaItem(MediaManagerItem): service_item.title = title for slide in raw_slides: service_item.add_from_text(slide[:30], slide) - if QtCore.QSettings().value(self.settings_section + u'/display footer', + if QtCore.QSettings().value(self.settingsSection + u'/display footer', QtCore.QVariant(True)).toBool() or credit: raw_footer.append(title + u' ' + credit) else: diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 0cc531c0c..346d28b16 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -72,12 +72,12 @@ class ImageTab(SettingsTab): def load(self): self.loop_delay = QtCore.QSettings().value( - self.settings_section + u'/loop delay', + self.settingsSection + u'/loop delay', QtCore.QVariant(5)).toInt()[0] self.TimeoutSpinBox.setValue(self.loop_delay) def save(self): - QtCore.QSettings().setValue(self.settings_section + u'/loop delay', + QtCore.QSettings().setValue(self.settingsSection + u'/loop delay', QtCore.QVariant(self.loop_delay)) Receiver.send_message(u'slidecontroller_live_spin_delay', self.loop_delay) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index c230b15f7..bcf2bd015 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -77,12 +77,12 @@ class ImageMediaItem(MediaManagerItem): QtGui.QAbstractItemView.ExtendedSelection) self.ListView.setIconSize(QtCore.QSize(88,50)) self.servicePath = os.path.join( - AppLocation.get_section_data_path(self.settings_section), + AppLocation.get_section_data_path(self.settingsSection), u'thumbnails') if not os.path.exists(self.servicePath): os.mkdir(self.servicePath) self.loadList(SettingsManager.load_list( - self.settings_section, self.settings_section)) + self.settingsSection, self.settingsSection)) def addListViewToToolBar(self): MediaManagerItem.addListViewToToolBar(self) @@ -121,8 +121,8 @@ class ImageMediaItem(MediaManagerItem): #if not present do not worry pass self.ListView.takeItem(item.row()) - SettingsManager.set_list(self.settings_section, - self.settings_section, self.getFileList()) + SettingsManager.set_list(self.settingsSection, + self.settingsSection, self.getFileList()) def loadList(self, list): for file in list: diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 4f9c5e486..3ba632239 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -131,15 +131,15 @@ class MediaMediaItem(MediaManagerItem): QtGui.QAbstractItemView.ExtendedSelection) self.ListView.setIconSize(QtCore.QSize(88,50)) self.loadList(SettingsManager.load_list( - self.settings_section, self.settings_section)) + self.settingsSection, self.settingsSection)) def onDeleteClick(self): item = self.ListView.currentItem() if item: row = self.ListView.row(item) self.ListView.takeItem(row) - SettingsManager.set_list(self.settings_section, - self.settings_section, self.getFileList()) + SettingsManager.set_list(self.settingsSection, + self.settingsSection, self.getFileList()) def loadList(self, list): for file in list: diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 62f81e5d5..408b33670 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -106,13 +106,13 @@ class PresentationMediaItem(MediaManagerItem): def initialise(self): self.servicePath = os.path.join( - AppLocation.get_section_data_path(self.settings_section), + AppLocation.get_section_data_path(self.settingsSection), u'thumbnails') self.ListView.setIconSize(QtCore.QSize(88,50)) if not os.path.exists(self.servicePath): os.mkdir(self.servicePath) list = SettingsManager.load_list( - self.settings_section, u'presentations') + self.settingsSection, u'presentations') self.loadList(list) for item in self.controllers: #load the drop down selection @@ -141,12 +141,12 @@ class PresentationMediaItem(MediaManagerItem): for controller in self.controllers: thumbPath = os.path.join( AppLocation.get_section_data_path( - self.settings_section), + self.settingsSection), u'thumbnails', controller, filename) thumb = os.path.join(thumbPath, u'slide1.png') preview = os.path.join( AppLocation.get_section_data_path( - self.settings_section), + self.settingsSection), controller, u'thumbnails', filename, u'slide1.png') if os.path.exists(preview): if os.path.exists(thumb): @@ -170,8 +170,8 @@ class PresentationMediaItem(MediaManagerItem): if item: row = self.ListView.row(item) self.ListView.takeItem(row) - SettingsManager.set_list(self.settings_section, - self.settings_section, self.getFileList()) + SettingsManager.set_list(self.settingsSection, + self.settingsSection, self.getFileList()) filepath = unicode((item.data(QtCore.Qt.UserRole)).toString()) #not sure of this has errors #John please can you look at . diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 1407820bc..84a3d83a2 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -100,16 +100,16 @@ class PresentationController(object): self.docs = [] self.plugin = plugin self.name = name - self.settings_section = self.plugin.settings_section + self.settingsSection = self.plugin.settingsSection self.available = self.check_available() if self.available: self.enabled = QtCore.QSettings().value( - self.settings_section + u'/' + name, + self.settingsSection + u'/' + name, QtCore.Qt.Unchecked).toInt()[0] == QtCore.Qt.Checked else: self.enabled = False self.thumbnailroot = os.path.join( - AppLocation.get_section_data_path(self.settings_section), + AppLocation.get_section_data_path(self.settingsSection), name, u'thumbnails') self.thumbnailprefix = u'slide' if not os.path.isdir(self.thumbnailroot): diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index 998753a59..ebcbb3d7b 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -101,7 +101,7 @@ class PresentationTab(SettingsTab): if controller.available: checkbox = self.PresenterCheckboxes[controller.name] checkbox.setChecked(QtCore.QSettings().value( - self.settings_section + u'/' + controller.name, + self.settingsSection + u'/' + controller.name, QtCore.QVariant(0)).toInt()[0]) def save(self): @@ -109,5 +109,5 @@ class PresentationTab(SettingsTab): controller = self.controllers[key] checkbox = self.PresenterCheckboxes[controller.name] QtCore.QSettings().setValue( - self.settings_section + u'/' + controller.name, + self.settingsSection + u'/' + controller.name, QtCore.QVariant(checkbox.checkState())) diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 2e38c1e2b..abdda065f 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -57,9 +57,9 @@ class RemoteTab(SettingsTab): def load(self): self.RemotePortSpinBox.setValue( - QtCore.QSettings().value(self.settings_section + u'/remote port', + QtCore.QSettings().value(self.settingsSection + u'/remote port', QtCore.QVariant(4316)).toInt()[0]) def save(self): - QtCore.QSettings().setValue(self.settings_section + u'/remote port', + QtCore.QSettings().setValue(self.settingsSection + u'/remote port', QtCore.QVariant(self.RemotePortSpinBox.value())) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 8bc91c824..7e95ff3bb 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -46,7 +46,7 @@ class RemotesPlugin(Plugin): self.insert_toolbox_item() self.server = QtNetwork.QUdpSocket() self.server.bind( - QtCore.QSettings().value(self.settings_section + u'/remote port', + QtCore.QSettings().value(self.settingsSection + u'/remote port', QtCore.QVariant(4316)).toInt()[0]) QtCore.QObject.connect(self.server, QtCore.SIGNAL(u'readyRead()'), self.readData) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 6a99c4ef7..040a6b26f 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -133,7 +133,7 @@ class SongMediaItem(MediaManagerItem): def configUpdated(self): self.searchAsYouType = QtCore.QSettings().value( - self.settings_section + u'/search as type', + self.settingsSection + u'/search as type', QtCore.QVariant(u'False')).toBool() def retranslateUi(self): diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index 36438f6fc..38bdd791d 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -81,7 +81,7 @@ class SongsTab(SettingsTab): def load(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) self.song_search = settings.value( u'search as type', QtCore.QVariant(False)).toBool() self.song_bar = settings.value( @@ -92,7 +92,7 @@ class SongsTab(SettingsTab): def save(self): settings = QtCore.QSettings() - settings.beginGroup(self.settings_section) + settings.beginGroup(self.settingsSection) settings.setValue(u'search as type', QtCore.QVariant(self.song_search)) settings.setValue(u'display songbar', QtCore.QVariant(self.song_bar)) settings.endGroup() diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py index c6156e55c..31971f465 100644 --- a/openlp/plugins/songusage/forms/songusagedetailform.py +++ b/openlp/plugins/songusage/forms/songusagedetailform.py @@ -56,15 +56,15 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): self.FromDate.setSelectedDate(fromDate) self.ToDate.setSelectedDate(toDate) self.FileLineEdit.setText( - SettingsManager.get_last_dir(self.parent.settings_section, 1)) + SettingsManager.get_last_dir(self.parent.settingsSection, 1)) def defineOutputLocation(self): path = QtGui.QFileDialog.getExistingDirectory(self, self.trUtf8('Output File Location'), - SettingsManager.get_last_dir(self.parent.settings_section, 1)) + SettingsManager.get_last_dir(self.parent.settingsSection, 1)) path = unicode(path) if path != u'': - SettingsManager.set_last_dir(self.parent.settings_section, path, 1) + SettingsManager.set_last_dir(self.parent.settingsSection, path, 1) self.FileLineEdit.setText(path) def accept(self): diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index da557e81e..aa753e163 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -111,7 +111,7 @@ class SongUsagePlugin(Plugin): QtCore.SIGNAL(u'slidecontroller_live_started'), self.onReceiveSongUsage) self.SongUsageActive = QtCore.QSettings().value( - self.settings_section + u'/active', + self.settingsSection + u'/active', QtCore.QVariant(False)).toBool() self.SongUsageStatus.setChecked(self.SongUsageActive) if self.songusagemanager is None: @@ -128,7 +128,7 @@ class SongUsagePlugin(Plugin): def toggleSongUsageState(self): self.SongUsageActive = not self.SongUsageActive - QtCore.QSettings().setValue(self.settings_section + u'/active', + QtCore.QSettings().setValue(self.settingsSection + u'/active', QtCore.QVariant(self.SongUsageActive)) def onReceiveSongUsage(self, items): diff --git a/resources/pyinstaller/hook-lxml.objectify.py b/resources/pyinstaller/hook-lxml.objectify.py index 071a0dca4..9d83432df 100644 --- a/resources/pyinstaller/hook-lxml.objectify.py +++ b/resources/pyinstaller/hook-lxml.objectify.py @@ -1 +1 @@ -hiddenimports = ['lxml.etree'] +hiddenimports = ['lxml.etree']