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/renderer.py b/openlp/core/lib/renderer.py index f574ed6a8..43db25d64 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: @@ -463,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 @@ -532,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: @@ -543,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/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/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/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/__init__.py b/openlp/core/ui/__init__.py index 675c57476..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 @@ -33,6 +43,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/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index 65c7b21a5..00000f23d 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -179,16 +179,22 @@ 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.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) @@ -596,94 +602,95 @@ class Ui_AmendThemeDialog(object): AmendThemeForm.setTabOrder(self.HorizontalComboBox, self.VerticalComboBox) def retranslateUi(self, AmendThemeForm): - AmendThemeForm.setWindowTitle(translate('AmendThemeForm','Theme Maintenance')) - self.ThemeNameLabel.setText(translate('AmendThemeForm','Theme Name:')) - self.BackgroundLabel.setText(translate('AmendThemeForm','Background:')) - self.BackgroundComboBox.setItemText(0, translate('AmendThemeForm','Opaque')) - self.BackgroundComboBox.setItemText(1, translate('AmendThemeForm','Transparent')) - self.BackgroundTypeLabel.setText(translate('AmendThemeForm','Background Type:')) - self.BackgroundTypeComboBox.setItemText(0, translate('AmendThemeForm','Solid Color')) - self.BackgroundTypeComboBox.setItemText(1, translate('AmendThemeForm','Gradient')) - self.BackgroundTypeComboBox.setItemText(2, translate('AmendThemeForm','Image')) - self.Color1Label.setText(translate('AmendThemeForm','')) - self.Color2Label.setText(translate('AmendThemeForm','')) - self.ImageLabel.setText(translate('AmendThemeForm','Image:')) - self.GradientLabel.setText(translate('AmendThemeForm','Gradient :')) - self.GradientComboBox.setItemText(0, translate('AmendThemeForm','Horizontal')) - self.GradientComboBox.setItemText(1, translate('AmendThemeForm','Vertical')) - self.GradientComboBox.setItemText(2, translate('AmendThemeForm','Circular')) + AmendThemeForm.setWindowTitle(translate('AmendThemeForm', 'Theme Maintenance')) + self.ThemeNameLabel.setText(translate('AmendThemeForm', 'Theme Name:')) + self.BackgroundLabel.setText(translate('AmendThemeForm', 'Background:')) + self.BackgroundComboBox.setItemText(0, translate('AmendThemeForm', 'Opaque')) + self.BackgroundComboBox.setItemText(1, translate('AmendThemeForm', 'Transparent')) + self.BackgroundTypeLabel.setText(translate('AmendThemeForm', 'Background Type:')) + self.BackgroundTypeComboBox.setItemText(0, translate('AmendThemeForm', 'Solid Color')) + self.BackgroundTypeComboBox.setItemText(1, translate('AmendThemeForm', 'Gradient')) + self.BackgroundTypeComboBox.setItemText(2, translate('AmendThemeForm', 'Image')) + self.Color1Label.setText(translate('AmendThemeForm', '')) + self.Color2Label.setText(translate('AmendThemeForm', '')) + self.ImageLabel.setText(translate('AmendThemeForm', 'Image:')) + self.GradientLabel.setText(translate('AmendThemeForm', 'Gradient :')) + self.GradientComboBox.setItemText(0, translate('AmendThemeForm', 'Horizontal')) + self.GradientComboBox.setItemText(1, translate('AmendThemeForm', 'Vertical')) + self.GradientComboBox.setItemText(2, translate('AmendThemeForm', 'Circular')) self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.BackgroundTab), - translate('AmendThemeForm','Background')) - self.FontMainGroupBox.setTitle(translate('AmendThemeForm','Main Font')) - self.FontMainlabel.setText(translate('AmendThemeForm','Font:')) - self.FontMainColorLabel.setText(translate('AmendThemeForm','Font Color:')) - self.FontMainSize.setText(translate('AmendThemeForm','Size:')) - self.FontMainSizeSpinBox.setSuffix(translate('AmendThemeForm','pt')) - self.FontMainWrapIndentationLabel.setText(translate('AmendThemeForm','Wrap Indentation')) - self.FontMainWeightComboBox.setItemText(0, translate('AmendThemeForm','Normal')) - self.FontMainWeightComboBox.setItemText(1, translate('AmendThemeForm','Bold')) - self.FontMainWeightComboBox.setItemText(2, translate('AmendThemeForm','Italics')) - self.FontMainWeightComboBox.setItemText(3, translate('AmendThemeForm','Bold/Italics')) - self.FontMainWeightLabel.setText(translate('AmendThemeForm','Font Weight:')) - self.MainLocationGroupBox.setTitle(translate('AmendThemeForm','Display Location')) - self.DefaultLocationLabel.setText(translate('AmendThemeForm','Use Default Location:')) - self.FontMainXLabel.setText(translate('AmendThemeForm','X Position:')) - self.FontMainYLabel.setText(translate('AmendThemeForm','Y Position:')) - self.FontMainWidthLabel.setText(translate('AmendThemeForm','Width:')) - self.FontMainHeightLabel.setText(translate('AmendThemeForm','Height:')) - self.FontMainXSpinBox.setSuffix(translate('AmendThemeForm','px')) - self.FontMainYSpinBox.setSuffix(translate('AmendThemeForm','px')) - self.FontMainWidthSpinBox.setSuffix(translate('AmendThemeForm','px')) - self.FontMainHeightSpinBox.setSuffix(translate('AmendThemeForm','px')) + translate('AmendThemeForm', 'Background')) + self.FontMainGroupBox.setTitle(translate('AmendThemeForm', 'Main Font')) + self.FontMainlabel.setText(translate('AmendThemeForm', 'Font:')) + self.FontMainColorLabel.setText(translate('AmendThemeForm', 'Font Color:')) + self.FontMainSize.setText(translate('AmendThemeForm', 'Size:')) + self.FontMainSizeSpinBox.setSuffix(translate('AmendThemeForm', 'pt')) + self.FontMainWrapIndentationLabel.setText(translate('AmendThemeForm', 'Wrap Indentation')) + self.FontMainWrapLineAdjustmentLabel.setText(translate('AmendThemeForm', 'Adjust Line Spacing')) + self.FontMainWeightComboBox.setItemText(0, translate('AmendThemeForm', 'Normal')) + self.FontMainWeightComboBox.setItemText(1, translate('AmendThemeForm', 'Bold')) + self.FontMainWeightComboBox.setItemText(2, translate('AmendThemeForm', 'Italics')) + self.FontMainWeightComboBox.setItemText(3, translate('AmendThemeForm', 'Bold/Italics')) + self.FontMainWeightLabel.setText(translate('AmendThemeForm', 'Font Weight:')) + self.MainLocationGroupBox.setTitle(translate('AmendThemeForm', 'Display Location')) + self.DefaultLocationLabel.setText(translate('AmendThemeForm', 'Use Default Location:')) + self.FontMainXLabel.setText(translate('AmendThemeForm', 'X Position:')) + self.FontMainYLabel.setText(translate('AmendThemeForm', 'Y Position:')) + self.FontMainWidthLabel.setText(translate('AmendThemeForm', 'Width:')) + self.FontMainHeightLabel.setText(translate('AmendThemeForm', 'Height:')) + self.FontMainXSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.FontMainYSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.FontMainWidthSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.FontMainHeightSpinBox.setSuffix(translate('AmendThemeForm', 'px')) self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.FontMainTab), - translate('AmendThemeForm','Font Main')) - self.FooterFontGroupBox.setTitle(translate('AmendThemeForm','Footer Font')) - self.FontFooterLabel.setText(translate('AmendThemeForm','Font:')) - self.FontFooterColorLabel.setText(translate('AmendThemeForm','Font Color:')) - self.FontFooterSizeLabel.setText(translate('AmendThemeForm','Size:')) - self.FontFooterSizeSpinBox.setSuffix(translate('AmendThemeForm','pt')) - self.FontFooterWeightComboBox.setItemText(0, translate('AmendThemeForm','Normal')) - self.FontFooterWeightComboBox.setItemText(1, translate('AmendThemeForm','Bold')) - self.FontFooterWeightComboBox.setItemText(2, translate('AmendThemeForm','Italics')) - self.FontFooterWeightComboBox.setItemText(3, translate('AmendThemeForm','Bold/Italics')) - self.FontFooterWeightLabel.setText(translate('AmendThemeForm','Font Weight:')) - self.LocationFooterGroupBox.setTitle(translate('AmendThemeForm','Display Location')) - self.FontFooterDefaultLabel.setText(translate('AmendThemeForm','Use Default Location:')) - self.FontFooterXLabel.setText(translate('AmendThemeForm','X Position:')) - self.FontFooterYLabel.setText(translate('AmendThemeForm','Y Position:')) - self.FontFooterWidthLabel.setText(translate('AmendThemeForm','Width:')) - self.FontFooterHeightLabel.setText(translate('AmendThemeForm','Height:')) - self.FontFooterXSpinBox.setSuffix(translate('AmendThemeForm','px')) - self.FontFooterYSpinBox.setSuffix(translate('AmendThemeForm','px')) - self.FontFooterWidthSpinBox.setSuffix(translate('AmendThemeForm','px')) - self.FontFooterHeightSpinBox.setSuffix(translate('AmendThemeForm','px')) + translate('AmendThemeForm', 'Font Main')) + self.FooterFontGroupBox.setTitle(translate('AmendThemeForm', 'Footer Font')) + self.FontFooterLabel.setText(translate('AmendThemeForm', 'Font:')) + self.FontFooterColorLabel.setText(translate('AmendThemeForm', 'Font Color:')) + self.FontFooterSizeLabel.setText(translate('AmendThemeForm', 'Size:')) + self.FontFooterSizeSpinBox.setSuffix(translate('AmendThemeForm', 'pt')) + self.FontFooterWeightComboBox.setItemText(0, translate('AmendThemeForm', 'Normal')) + self.FontFooterWeightComboBox.setItemText(1, translate('AmendThemeForm', 'Bold')) + self.FontFooterWeightComboBox.setItemText(2, translate('AmendThemeForm', 'Italics')) + self.FontFooterWeightComboBox.setItemText(3, translate('AmendThemeForm', 'Bold/Italics')) + self.FontFooterWeightLabel.setText(translate('AmendThemeForm', 'Font Weight:')) + self.LocationFooterGroupBox.setTitle(translate('AmendThemeForm', 'Display Location')) + self.FontFooterDefaultLabel.setText(translate('AmendThemeForm', 'Use Default Location:')) + self.FontFooterXLabel.setText(translate('AmendThemeForm', 'X Position:')) + self.FontFooterYLabel.setText(translate('AmendThemeForm', 'Y Position:')) + self.FontFooterWidthLabel.setText(translate('AmendThemeForm', 'Width:')) + self.FontFooterHeightLabel.setText(translate('AmendThemeForm', 'Height:')) + self.FontFooterXSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.FontFooterYSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.FontFooterWidthSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.FontFooterHeightSpinBox.setSuffix(translate('AmendThemeForm', 'px')) self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.FontFooterTab), - translate('AmendThemeForm','Font Footer')) - self.OutlineGroupBox.setTitle(translate('AmendThemeForm','Outline')) - self.OutlineSpinBoxLabel.setText(translate('AmendThemeForm','Outline Size:')) - self.OutlineSpinBox.setSuffix(translate('AmendThemeForm','px')) - self.OutlineColorLabel.setText(translate('AmendThemeForm','Outline Color:')) - self.OutlineEnabledLabel.setText(translate('AmendThemeForm','Show Outline:')) - self.ShadowGroupBox.setTitle(translate('AmendThemeForm','Shadow')) - self.ShadowSpinBoxLabel.setText(translate('AmendThemeForm','Shadow Size:')) - self.ShadowSpinBox.setSuffix(translate('AmendThemeForm','px')) - self.ShadowColorLabel.setText(translate('AmendThemeForm','Shadow Color:')) - self.ShadowEnabledLabel.setText(translate('AmendThemeForm','Show Shadow:')) - self.AlignmentGroupBox.setTitle(translate('AmendThemeForm','Alignment')) - self.HorizontalLabel.setText(translate('AmendThemeForm','Horizontal Align:')) - self.HorizontalComboBox.setItemText(0, translate('AmendThemeForm','Left')) - self.HorizontalComboBox.setItemText(1, translate('AmendThemeForm','Right')) - self.HorizontalComboBox.setItemText(2, translate('AmendThemeForm','Center')) - self.VerticalLabel.setText(translate('AmendThemeForm','Vertical Align:')) - self.VerticalComboBox.setItemText(0, translate('AmendThemeForm','Top')) - self.VerticalComboBox.setItemText(1, translate('AmendThemeForm','Middle')) - self.VerticalComboBox.setItemText(2, translate('AmendThemeForm','Bottom')) - self.TransitionGroupBox.setTitle(translate('AmendThemeForm','Slide Transition')) - self.SlideTransitionCheckedBoxLabel.setText(translate('AmendThemeForm','Transition Active:')) + translate('AmendThemeForm', 'Font Footer')) + self.OutlineGroupBox.setTitle(translate('AmendThemeForm', 'Outline')) + self.OutlineSpinBoxLabel.setText(translate('AmendThemeForm', 'Outline Size:')) + self.OutlineSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.OutlineColorLabel.setText(translate('AmendThemeForm', 'Outline Color:')) + self.OutlineEnabledLabel.setText(translate('AmendThemeForm', 'Show Outline:')) + self.ShadowGroupBox.setTitle(translate('AmendThemeForm', 'Shadow')) + self.ShadowSpinBoxLabel.setText(translate('AmendThemeForm', 'Shadow Size:')) + self.ShadowSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.ShadowColorLabel.setText(translate('AmendThemeForm', 'Shadow Color:')) + self.ShadowEnabledLabel.setText(translate('AmendThemeForm', 'Show Shadow:')) + self.AlignmentGroupBox.setTitle(translate('AmendThemeForm', 'Alignment')) + self.HorizontalLabel.setText(translate('AmendThemeForm', 'Horizontal Align:')) + self.HorizontalComboBox.setItemText(0, translate('AmendThemeForm', 'Left')) + self.HorizontalComboBox.setItemText(1, translate('AmendThemeForm', 'Right')) + self.HorizontalComboBox.setItemText(2, translate('AmendThemeForm', 'Center')) + self.VerticalLabel.setText(translate('AmendThemeForm', 'Vertical Align:')) + self.VerticalComboBox.setItemText(0, translate('AmendThemeForm', 'Top')) + self.VerticalComboBox.setItemText(1, translate('AmendThemeForm', 'Middle')) + self.VerticalComboBox.setItemText(2, translate('AmendThemeForm', 'Bottom')) + self.TransitionGroupBox.setTitle(translate('AmendThemeForm', 'Slide Transition')) + self.SlideTransitionCheckedBoxLabel.setText(translate('AmendThemeForm', 'Transition Active:')) self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.OtherOptionsTab), - translate('AmendThemeForm','Other Options')) - self.PreviewGroupBox.setTitle(translate('AmendThemeForm','Preview')) + translate('AmendThemeForm', 'Other Options')) + self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview')) 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/displaytab.py b/openlp/core/ui/displaytab.py new file mode 100644 index 000000000..b38ff0842 --- /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.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())) + 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.settings_section) + 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/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 005e588ac..4616a62ba 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) @@ -181,7 +181,7 @@ class GeneralTab(SettingsTab): self.MonitorLabel.setText( self.trUtf8('Select monitor for output display:')) self.DisplayOnMonitorCheck.setText( - self.trUtf8('Display if in single screen')) + 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( @@ -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/maindisplay.py b/openlp/core/ui/maindisplay.py index 04f60fb7d..1907a55b0 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,15 +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'videodisplay_start'), self.hideDisplayForVideo) 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'videodisplay_start'), self.hideDisplay) + QtCore.SIGNAL(u'videodisplay_background'), self.hideDisplayForVideo) def setup(self): """ @@ -149,12 +149,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(), @@ -201,11 +201,32 @@ class MainDisplay(DisplayWidget): else: self.showFullScreen() - def hideDisplay(self): - log.debug(u'hideDisplay') - self.display_image.setPixmap(self.transparent) + 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 + 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_alert.setPixmap(self.transparent) self.display_text.setPixmap(self.transparent) + if mode == HideMode.Screen: + self.display_image.setPixmap(self.transparent) + elif mode == HideMode.Blank: + 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.parent.renderManager.renderer.bg_frame)) + else: + self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) self.moveToTop() def moveToTop(self): @@ -215,10 +236,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): @@ -280,27 +311,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. @@ -323,11 +333,19 @@ class VideoDisplay(Phonon.VideoWidget): self.setWindowTitle(u'OpenLP Video Display') 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) Phonon.createPath(self.mediaObject, self) 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(), @@ -336,8 +354,13 @@ 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) + QtCore.QObject.connect(self.mediaObject, + QtCore.SIGNAL(u'finished()'), self.onMediaBackground) + self.setVisible(False) def keyPressEvent(self, event): if type(event) == QtGui.QKeyEvent: @@ -355,27 +378,40 @@ 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: self.setVisible(False) 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): 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() + 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() @@ -387,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() @@ -394,3 +432,14 @@ class VideoDisplay(Phonon.VideoWidget): log.debug(u'VideoDisplay Reached end of media playlist') 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/mainwindow.py b/openlp/core/ui/mainwindow.py index 316dce34d..385369b04 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -242,12 +242,14 @@ class Ui_MainWindow(object): ContentsIcon = build_icon(u':/system/system_help_contents.png') self.HelpDocumentationItem.setIcon(ContentsIcon) self.HelpDocumentationItem.setObjectName(u'HelpDocumentationItem') + self.HelpDocumentationItem.setEnabled(False) self.HelpAboutItem = QtGui.QAction(MainWindow) AboutIcon = build_icon(u':/system/system_about.png') self.HelpAboutItem.setIcon(AboutIcon) self.HelpAboutItem.setObjectName(u'HelpAboutItem') self.HelpOnlineHelpItem = QtGui.QAction(MainWindow) self.HelpOnlineHelpItem.setObjectName(u'HelpOnlineHelpItem') + self.HelpOnlineHelpItem.setEnabled(False) self.HelpWebSiteItem = QtGui.QAction(MainWindow) self.HelpWebSiteItem.setObjectName(u'HelpWebSiteItem') #i18n Language Items @@ -440,8 +442,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) @@ -490,6 +496,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QObject.connect(self.PreviewController.Panel, QtCore.SIGNAL(u'visibilityChanged(bool)'), self.action_Preview_Panel.setChecked) + QtCore.QObject.connect(self.HelpWebSiteItem, + QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked) QtCore.QObject.connect(self.HelpAboutItem, QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked) QtCore.QObject.connect(self.PluginItem, @@ -528,6 +536,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') @@ -596,7 +605,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) @@ -606,7 +616,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) @@ -624,6 +634,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): vT = VersionThread(self, self.applicationVersion) vT.start() + def onHelpWebSiteClicked(self): + """ + Load the OpenLP website + """ + import webbrowser + webbrowser.open_new(u'http://openlp.org/') + def onHelpAboutItemClicked(self): """ Show the About form @@ -744,9 +761,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( @@ -757,11 +775,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', @@ -791,7 +810,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/screen.py b/openlp/core/ui/screen.py index 32cc5ba50..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,12 +61,31 @@ 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.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] + + def set_override_display(self): + """ + replace the current size with the override values + user wants to have their own screen attributes + """ + log.debug(u'set_override_display') + self.current = copy.deepcopy(self.override) + self.preview = copy.deepcopy(self.current) + + 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/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 45d007c17..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 @@ -99,8 +100,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 +192,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 +405,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 +490,20 @@ 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, + os.path.split(filename)[0]) service = [] servicefile = filename + u'.osd' zip = None @@ -542,12 +544,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 +579,9 @@ 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, + os.path.split(filename)[0]) zip = None f = None try: @@ -645,7 +650,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 +735,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/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/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 811fd51e3..a35257f75 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__) @@ -93,8 +84,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 @@ -199,8 +188,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( @@ -238,6 +225,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)) @@ -263,7 +260,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) @@ -320,26 +317,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) @@ -399,7 +396,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 \ @@ -486,7 +483,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] @@ -559,9 +556,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)) @@ -572,7 +569,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() @@ -580,55 +577,65 @@ 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())) + self.parent.general_settings_section + u'/screen blank', + QtCore.QVariant(checked)) + if checked: + Receiver.send_message(u'maindisplay_hide', HideMode.Blank) + self.blankPlugin(True) + else: + Receiver.send_message(u'maindisplay_show') + self.blankPlugin(False) - 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) - self.blankScreen(HideMode.Theme, self.themeButton.isChecked()) + log.debug(u'onThemeDisplay %d' % checked) + self.blankButton.setChecked(False) + 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, 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(): - self.mainDisplay.hideDisplay() + log.debug(u'onHideDisplay %d' % checked) + self.blankButton.setChecked(False) + self.themeButton.setChecked(False) + if checked: + Receiver.send_message(u'maindisplay_hide', HideMode.Screen) + self.blankPlugin(True) else: - self.mainDisplay.showDisplay() + Receiver.send_message(u'maindisplay_show') + self.blankPlugin(False) - def blankScreen(self, blankType, blanked=False): + def blankPlugin(self, blank): """ Blank the display screen. """ if self.serviceItem is not None: - if blanked: - Receiver.send_message( - u'%s_blank' % self.serviceItem.name.lower(), + 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(), + Receiver.send_message(u'%s_unblank' + % self.serviceItem.name.lower(), [self.serviceItem, self.isLive]) - self.mainDisplay.blankDisplay(blankType, blanked) - else: - self.mainDisplay.blankDisplay(blankType, blanked) + def onSlideSelected(self): """ @@ -695,7 +702,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() @@ -719,7 +726,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() @@ -739,7 +746,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() @@ -770,6 +777,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) @@ -784,8 +794,12 @@ 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', + Receiver.send_message(u'videodisplay_start', [item, self.blankButton.isChecked()]) else: self.mediaObject.stop() @@ -797,12 +811,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: @@ -811,6 +833,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/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 797a6a27a..b6ed2366d 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.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/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__) 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 99% rename from openlp/plugins/alerts/forms/alertstab.py rename to openlp/plugins/alerts/lib/alertstab.py index 7cda09488..53b8d2a7a 100644 --- a/openlp/plugins/alerts/forms/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.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..c230b15f7 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), - u'.thumbnails') + 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..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,7 +47,7 @@ class MediaMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): self.PluginNameShort = u'Media' self.IconPath = u'images/image' - self.SettingsSection = title.lower() + 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 @@ -72,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() @@ -90,14 +132,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..62f81e5d5 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,13 @@ 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') + self.ListView.setIconSize(QtCore.QSize(88,50)) 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 +140,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 +170,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/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() 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): 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 + + + + + +