← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/working into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/working into lp:openlp.

    Requested reviews:
    OpenLP Core (openlp-core)


Fixed up issues with screen blanking and videos.
Amended code around screen blanking and the toolbar button.
Added space in media list as noticed by mhub
-- 
https://code.launchpad.net/~trb143/openlp/working/+merge/17975
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2010-01-22 18:59:36 +0000
+++ openlp.pyw	2010-01-24 16:34:13 +0000
@@ -28,7 +28,7 @@
 import sys
 import logging
 
-from logging.handlers import RotatingFileHandler
+from logging import FileHandler
 from optparse import OptionParser
 from PyQt4 import QtCore, QtGui
 
@@ -154,7 +154,7 @@
                       help="Set the Qt4 style (passed directly to Qt4).")
     # Set up logging
     filename = u'openlp.log'
-    logfile = RotatingFileHandler(filename, maxBytes=200000, backupCount=5)
+    logfile = FileHandler(filename)
     logfile.setFormatter(logging.Formatter(
         u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
     log.addHandler(logfile)

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2010-01-22 17:54:08 +0000
+++ openlp/core/ui/maindisplay.py	2010-01-24 16:34:13 +0000
@@ -208,9 +208,11 @@
                     self.repaint()
                     self.frame = frame[u'trans']
                 self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
+                self.display_frame = frame[u'main']
                 self.repaint()
             else:
                 self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
+                self.display_frame = frame
             if not self.isVisible():
                 self.setVisible(True)
                 self.showFullScreen()
@@ -221,11 +223,11 @@
             self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
         else:
             self.displayBlank = False
-            if self.frame:
-                self.frameView(self.frame)
-        if blanked != self.parent.LiveController.blankButton.isChecked():
-            self.parent.LiveController.blankButton.setChecked(self.displayBlank)
-        self.parent.generalConfig.set_config(u'screen blank', self.displayBlank)
+            if self.display_frame:
+                self.frameView(self.display_frame)
+#        if blanked != self.parent.LiveController.blankButton.isChecked():
+#            self.parent.LiveController.blankButton.setChecked(self.displayBlank)
+#        self.parent.generalConfig.set_config(u'screen blank', self.displayBlank)
 
     def displayAlert(self, text=u''):
         """
@@ -236,7 +238,7 @@
         """
         log.debug(u'display alert called %s' % text)
         self.alertList.append(text)
-        if self.timer_id != 0:
+        if self.timer_id != 0 or self.mediaLoaded:
             return
         self.generateAlert()
 
@@ -296,9 +298,11 @@
         log.debug(u'Play the new media, Live ')
         if not self.mediaLoaded and not self.displayBlank:
             self.blankDisplay()
+            self.display_frame = self.blankFrame
         self.firstTime = True
         self.mediaLoaded = True
         self.display.hide()
+        self.alertDisplay.hide()
         self.video.setFullScreen(True)
         self.video.setVisible(True)
         self.mediaObject.play()
@@ -312,6 +316,7 @@
     def onMediaStop(self):
         log.debug(u'Media stopped by user')
         self.mediaObject.stop()
+        self.onMediaFinish()
 
     def onMediaFinish(self):
         log.debug(u'Reached end of media playlist')
@@ -322,3 +327,4 @@
         self.mediaLoaded = False
         self.video.setVisible(False)
         self.display.show()
+        self.blankDisplay(False)

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2010-01-22 17:54:08 +0000
+++ openlp/core/ui/mainwindow.py	2010-01-24 16:34:13 +0000
@@ -545,7 +545,7 @@
         if app_version != version:
             version_text = unicode(self.trUtf8('OpenLP version %s has been updated '
                 'to version %s\n\nYou can obtain the latest version from http://openlp.org'))
-            QtGui.QMessageBox.question(None,
+            QtGui.QMessageBox.question(self,
                 self.trUtf8('OpenLP Version Updated'),
                 version_text % (app_version, version),
                 QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
@@ -576,12 +576,12 @@
             self.ServiceManagerContents.onLoadService(True)
         if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \
         and str_to_bool(self.generalConfig.get_config(u'blank warning', False)):
-            QtGui.QMessageBox.question(None,
+            self.LiveController.onBlankDisplay(True)
+            QtGui.QMessageBox.question(self,
                 self.trUtf8('OpenLP Main Display Blanked'),
                 self.trUtf8('The Main Display has been blanked out'),
                 QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
                 QtGui.QMessageBox.Ok)
-            self.LiveController.blankButton.setChecked(True)
 
     def onHelpAboutItemClicked(self):
         """
@@ -620,7 +620,7 @@
         Hook to close the main window and display windows on exit
         """
         if self.serviceNotSaved:
-            ret = QtGui.QMessageBox.question(None,
+            ret = QtGui.QMessageBox.question(self,
                 self.trUtf8('Save Changes to Service?'),
                 self.trUtf8('Your service has changed, do you want to save those changes?'),
                 QtGui.QMessageBox.StandardButtons(

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2009-12-31 12:52:01 +0000
+++ openlp/core/ui/servicemanager.py	2010-01-24 16:34:13 +0000
@@ -348,7 +348,7 @@
         if self.parent.serviceNotSaved and \
             str_to_bool(PluginConfig(u'General').
                         get_config(u'save prompt', u'False')):
-            ret = QtGui.QMessageBox.question(None,
+            ret = QtGui.QMessageBox.question(self,
                 self.trUtf8('Save Changes to Service?'),
                 self.trUtf8('Your service is unsaved, do you want to save those '
                             'changes before creating a new one ?'),
@@ -697,4 +697,4 @@
         theme = unicode(self.sender().text())
         item, count = self.findServiceItem()
         self.serviceItems[item][u'service_item'].theme = theme
-        self.regenerateServiceItems()
\ No newline at end of file
+        self.regenerateServiceItems()

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2010-01-16 07:22:50 +0000
+++ openlp/core/ui/slidecontroller.py	2010-01-24 16:34:13 +0000
@@ -164,9 +164,9 @@
             self.Toolbar.addToolbarSeparator(u'Close Separator')
             self.blankButton = self.Toolbar.addToolbarButton(
                 u'Blank Screen', u':/slides/slide_close.png',
-                self.trUtf8('Blank Screen'), self.onBlankScreen, True)
+                self.trUtf8('Blank Screen'), self.onBlankDisplay, True)
             QtCore.QObject.connect(Receiver.get_receiver(),
-                QtCore.SIGNAL(u'live_slide_blank'), self.onBlankDisplay)
+                QtCore.SIGNAL(u'live_slide_blank'), self.blankScreen)
         if not self.isLive:
             self.Toolbar.addToolbarSeparator(u'Close Separator')
             self.Toolbar.addToolbarButton(
@@ -441,7 +441,6 @@
                         self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag),
                             self.onSongBarHandler)
                 item.setText(frame[u'text'])
-                #print {u'x':frame[u'text']}
             else:
                 label = QtGui.QLabel()
                 label.setMargin(4)
@@ -486,12 +485,19 @@
             self.PreviewListWidget.selectRow(0)
             self.onSlideSelected()
 
-    def onBlankDisplay(self):
-        self.blankButton.setChecked(self.parent.mainDisplay.displayBlank)
+    def onBlankDisplay(self, force=False):
+        """
+        Handle the blank screen button
+        """
+        if force:
+            self.blankButton.setChecked(True)
+        self.blankScreen(self.blankButton.isChecked())
+        self.parent.generalConfig.set_config(u'screen blank',
+                                            self.blankButton.isChecked())
 
-    def onBlankScreen(self, blanked):
+    def blankScreen(self, blanked=False):
         """
-        Blank the screen.
+        Blank the display screen.
         """
         if self.serviceItem is not None:
             if self.serviceItem.is_command():
@@ -550,7 +556,7 @@
     def grabMainDisplay(self):
         rm = self.parent.RenderManager
         winid = QtGui.QApplication.desktop().winId()
-        rect = rm.screen_list[rm.current_display][u'size']
+        rect = rm.screens.current[u'size']
         winimg = QtGui.QPixmap.grabWindow(winid, rect.x(),
             rect.y(), rect.width(), rect.height())
         self.SlidePreview.setPixmap(winimg)
@@ -666,7 +672,7 @@
 
     def onMediaStop(self):
         if self.isLive:
-            Receiver.send_message(u'%s_stop'% self.serviceItem.name.lower())
+            Receiver.send_message(u'%s_stop'% self.serviceItem.name.lower(), self.isLive)
         else:
             self.mediaObject.stop()
             self.video.hide()

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2010-01-09 09:34:06 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2010-01-24 16:34:13 +0000
@@ -61,7 +61,7 @@
 
     def retranslateUi(self):
         self.OnNewPrompt = self.trUtf8('Select Media')
-        self.OnNewFileMasks = self.trUtf8('Videos (*.avi *.mpeg *.mpg *.wmv'
+        self.OnNewFileMasks = self.trUtf8('Videos (*.avi *.mpeg *.mpg *.wmv '
             '*.mov *.mp4 *.flv);;Audio (*.ogg *.mp3 *.wma *.wav *.flac)'
             ';;All files (*)')
 

=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py	2010-01-16 07:22:50 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py	2010-01-24 16:34:13 +0000
@@ -232,13 +232,13 @@
         """
         if self.document:
             if self.presentation:
-                self.presentation.end()
-                self.presentation = None
-            try:
-                self.document.dispose()
-            except:
-                #We tried!
-                pass
+                try:
+                    self.presentation.end()
+                    self.presentation = None
+                    self.document.dispose()
+                except:
+                    #We tried!
+                    pass
             self.document = None
 
     def is_loaded(self):


Follow ups