← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~j-corwin/openlp/present into lp:openlp

 

Jonathan Corwin has proposed merging lp:~j-corwin/openlp/present into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #598361 AttributeError: 'NoneType' object has no attribute 'isPaused'
  https://bugs.launchpad.net/bugs/598361
  #608149 Presentations are not intuitive
  https://bugs.launchpad.net/bugs/608149


[Bug 608149] [NEW] Presentations are not intuitive

1. Presentation Controllers (PPT/Impress etc) are now enabled by default
2. The dropdown list to choose the controller is now hidden by default, and can be made visible in the options
3. It is no longer necessary to restart OpenLP when enabling/disabling controllers
-- 
https://code.launchpad.net/~j-corwin/openlp/present/+merge/30593
Your team OpenLP Core is requested to review the proposed merge of lp:~j-corwin/openlp/present into lp:openlp.
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2010-07-12 10:59:48 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2010-07-21 22:52:43 +0000
@@ -29,7 +29,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
-    SettingsManager, translate, check_item_selected
+    SettingsManager, translate, check_item_selected,  Receiver
 from openlp.plugins.presentations.lib import MessageListener
 
 log = logging.getLogger(__name__)
@@ -67,7 +67,9 @@
         self.ListViewWithDnD_class = PresentationListView
         MediaManagerItem.__init__(self, parent, icon, title)
         self.message_listener = MessageListener(self)
-
+        QtCore.QObject.connect(Receiver.get_receiver(),
+            QtCore.SIGNAL(u'mediaitem_presentation_rebuild'), self.rebuild)
+        
     def retranslateUi(self):
         """
         The name of the plugin media displayed in UI
@@ -76,9 +78,12 @@
             'Select Presentation(s)')
         self.Automatic = translate('PresentationPlugin.MediaItem',
             'Automatic')
+        self.buildFileMaskString()
+
+    def buildFileMaskString(self):
         fileType = u''
         for controller in self.controllers:
-            if self.controllers[controller].enabled:
+            if self.controllers[controller].enabled():
                 types = self.controllers[controller].supports + \
                     self.controllers[controller].alsosupports
                 for type in types:
@@ -131,13 +136,26 @@
         list = SettingsManager.load_list(
             self.settingsSection, u'presentations')
         self.loadList(list, True)
+        self.populateDisplayTypes()
+
+    def rebuild(self):
+        self.populateDisplayTypes()
+        self.buildFileMaskString()
+
+    def populateDisplayTypes(self):
+        self.DisplayTypeComboBox.clear()
         for item in self.controllers:
             #load the drop down selection
-            if self.controllers[item].enabled:
+            if self.controllers[item].enabled():
                 self.DisplayTypeComboBox.addItem(item)
         if self.DisplayTypeComboBox.count() > 1:
             self.DisplayTypeComboBox.insertItem(0, self.Automatic)
             self.DisplayTypeComboBox.setCurrentIndex(0)
+        if QtCore.QSettings().value(self.settingsSection + u'/override app', 
+            QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:          
+            self.PresentationWidget.show()
+        else:
+            self.PresentationWidget.hide()
 
     def loadList(self, list, initialLoad=False):
         """
@@ -262,11 +280,11 @@
         if not filetype:
             return None
         for controller in self.controllers:
-            if self.controllers[controller].enabled:
+            if self.controllers[controller].enabled():
                 if filetype in self.controllers[controller].supports:
                     return controller
         for controller in self.controllers:
-            if self.controllers[controller].enabled:
+            if self.controllers[controller].enabled():
                 if filetype in self.controllers[controller].alsosupports:
                     return controller
         return None

=== modified file 'openlp/plugins/presentations/lib/presentationcontroller.py'
--- openlp/plugins/presentations/lib/presentationcontroller.py	2010-07-10 22:21:14 +0000
+++ openlp/plugins/presentations/lib/presentationcontroller.py	2010-07-21 22:52:43 +0000
@@ -109,13 +109,6 @@
         self.name = name
         self.settings_section = self.plugin.settingsSection
         self.available = self.check_available()
-        if self.available:
-            self.enabled = QtCore.QSettings().value(
-                self.settings_section + u'/' + name,
-                QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \
-                    QtCore.Qt.Checked
-        else:
-            self.enabled = False
         self.temp_folder = os.path.join(
             AppLocation.get_section_data_path(self.settings_section), name)
         self.thumbnail_folder = os.path.join(
@@ -127,6 +120,18 @@
         if not os.path.isdir(self.temp_folder):
             os.makedirs(self.temp_folder)
 
+    def enabled(self):
+        """
+        Return whether the controller is currently enabled
+        """
+        if self.available:
+            return QtCore.QSettings().value(
+                self.settings_section + u'/' + self.name,
+                QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
+                    QtCore.Qt.Checked
+        else:
+            return False
+
     def check_available(self):
         """
         Presentation app is able to run on this machine

=== modified file 'openlp/plugins/presentations/lib/presentationtab.py'
--- openlp/plugins/presentations/lib/presentationtab.py	2010-07-10 22:21:14 +0000
+++ openlp/plugins/presentations/lib/presentationtab.py	2010-07-21 22:52:43 +0000
@@ -25,7 +25,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import SettingsTab, translate
+from openlp.core.lib import Receiver, SettingsTab, translate
 
 class PresentationTab(SettingsTab):
     """
@@ -77,7 +77,17 @@
         self.PresentationThemeLayout.setSpacing(8)
         self.PresentationThemeLayout.setMargin(0)
         self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout')
+        self.AdvancedGroupBox = QtGui.QGroupBox(self)
+        self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox')
+        self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox)
+        self.AdvancedLayout.setSpacing(8)
+        self.AdvancedLayout.setMargin(8)
+        self.AdvancedLayout.setObjectName(u'AdvancedLayout')
+        self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox)
+        self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox')
+        self.AdvancedLayout.addWidget(self.OverrideAppCheckBox)
         self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox)
+        self.PresentationLeftLayout.addWidget(self.AdvancedGroupBox)
         self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20,
             QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
         self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer)
@@ -107,6 +117,12 @@
             checkbox.setText(
                 u'%s %s' % (controller.name,
                 translate('PresentationPlugin.PresentationTab', 'available')))
+        self.AdvancedGroupBox.setTitle(
+            translate('PresentationPlugin.PresentationTab',
+            'Advanced'))
+        self.OverrideAppCheckBox.setText(
+            translate('PresentationPlugin.PresentationTab',
+            'Allow presentation application to be overriden'))
 
     def load(self):
         """
@@ -118,15 +134,33 @@
                 checkbox = self.PresenterCheckboxes[controller.name]
                 checkbox.setChecked(QtCore.QSettings().value(
                     self.settingsSection + u'/' + controller.name,
-                    QtCore.QVariant(0)).toInt()[0])
+                    QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0])
+        self.OverrideAppCheckBox.setChecked(QtCore.QSettings().value(
+            self.settingsSection + u'/override app', 
+            QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
 
     def save(self):
         """
         Save the settings.
         """
+        changed = False
         for key in self.controllers:
             controller = self.controllers[key]
             checkbox = self.PresenterCheckboxes[controller.name]
-            QtCore.QSettings().setValue(
-                self.settingsSection + u'/' + controller.name,
-                QtCore.QVariant(checkbox.checkState()))
+            setting_key = self.settingsSection + u'/' + controller.name
+            if QtCore.QSettings().value(setting_key) != checkbox.checkState():
+                changed = True
+                QtCore.QSettings().setValue(setting_key,
+                    QtCore.QVariant(checkbox.checkState()))
+                if checkbox.checkState() == QtCore.Qt.Checked:
+                    controller.start_process()
+                else:
+                    controller.kill()
+        setting_key = self.settingsSection + u'/override app'
+        if QtCore.QSettings().value(setting_key) != \
+            self.OverrideAppCheckBox.checkState():
+            QtCore.QSettings().setValue(setting_key,
+                QtCore.QVariant(self.OverrideAppCheckBox.checkState()))
+            changed = True
+        if changed:
+            Receiver.send_message(u'mediaitem_presentation_rebuild')

=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py	2010-07-11 20:53:53 +0000
+++ openlp/plugins/presentations/presentationplugin.py	2010-07-21 22:52:43 +0000
@@ -67,7 +67,7 @@
         Plugin.initialise(self)
         self.insertToolboxItem()
         for controller in self.controllers:
-            if self.controllers[controller].enabled:
+            if self.controllers[controller].enabled():
                 self.controllers[controller].start_process()
 
     def finalise(self):
@@ -79,7 +79,7 @@
         #Ask each controller to tidy up
         for key in self.controllers:
             controller = self.controllers[key]
-            if controller.enabled:
+            if controller.enabled():
                 controller.kill()
         Plugin.finalise(self)
 


Follow ups