← Back to team overview

openlp-core team mailing list archive

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

 

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

    Requested reviews:
    OpenLP Core (openlp-core)

-- 
https://code.launchpad.net/~trb143/openlp/fixes/+merge/14803
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2009-11-07 00:00:36 +0000
+++ openlp.pyw	2009-11-12 19:15:21 +0000
@@ -81,6 +81,8 @@
                 bits = unicode(line).split(u'-')
                 applicationVersion = {u'Full':unicode(line).rstrip(),
                     u'version':bits[0], u'build':bits[1]}
+            log.info(u'Openlp version %s build %s' %
+                (applicationVersion[u'version'],applicationVersion[u'build'] ))
         except:
                 applicationVersion = {u'Full':u'1.9.0-000',
                     u'version':u'1.9.0', u'build':u'000'}
@@ -139,6 +141,7 @@
     logfile.setFormatter(logging.Formatter(
         u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
     log.addHandler(logfile)
+    logging.addLevelName(15, u'Timer')
     # Parse command line options and deal with them.
     (options, args) = parser.parse_args()
     if options.debug:

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2009-11-05 17:03:37 +0000
+++ openlp/core/lib/serviceitem.py	2009-11-12 19:15:21 +0000
@@ -38,7 +38,6 @@
     Text = 1
     Image = 2
     Command = 3
-    Video = 4
 
 class ServiceItem(object):
     """
@@ -156,12 +155,6 @@
         self.service_frames.append(
             {u'title': frame_title, u'text': None, u'image': image})
 
-    def add_from_media(self, path, frame_title, image):
-        self.service_item_type = ServiceItemType.Video
-        self.service_item_path = path
-        self.service_frames.append(
-            {u'title': frame_title, u'text': None, u'image': image})
-
     def add_from_text(self, frame_title, raw_slide):
         """
         Add a text slide to the service item.
@@ -216,10 +209,7 @@
                 service_data.append(slide[u'title'])
         elif self.service_item_type == ServiceItemType.Command:
             for slide in self.service_frames:
-                service_data.append(slide[u'title'])
-        elif self.service_item_type == ServiceItemType.Video:
-            for slide in self.service_frames:
-                service_data.append(slide[u'title'])
+                service_data.append({u'title':slide[u'title'], u'image':slide[u'image']})
         return {u'header': service_header, u'data': service_data}
 
     def set_from_service(self, serviceitem, path=None):
@@ -252,10 +242,8 @@
                 self.add_from_image(path, text_image, real_image)
         elif self.service_item_type == ServiceItemType.Command:
             for text_image in serviceitem[u'serviceitem'][u'data']:
-                filename = os.path.join(path, text_image)
-                self.add_from_command(path, text_image)
-        elif self.service_item_type == ServiceItemType.Video:
-            pass
+                filename = os.path.join(path, text_image[u'title'])
+                self.add_from_command(path, text_image[u'title'], text_image[u'image'] )
 
     def merge(self, other):
         """
@@ -279,3 +267,17 @@
         """
         return self.uuid != other.uuid
 
+    def isSong(self):
+        return self.name == u'Songs'
+
+    def isMedia(self):
+        return self.name.lower() == u'media'
+
+    def isCommand(self):
+        return self.service_item_type == ServiceItemType.Command
+
+    def isImage(self):
+        return self.service_item_type == ServiceItemType.Image
+
+    def isText(self):
+        return self.service_item_type == ServiceItemType.Text

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2009-11-12 17:18:30 +0000
+++ openlp/core/ui/maindisplay.py	2009-11-12 19:15:21 +0000
@@ -24,6 +24,7 @@
 
 import logging
 import os
+import time
 
 from PyQt4 import QtCore, QtGui
 from PyQt4.phonon import Phonon
@@ -196,10 +197,16 @@
         if self.timer_id != 0 :
             self.displayAlert()
         elif not self.displayBlank:
+#            self.setWindowOpacity(0.5)
+#            self.show()
             self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
+#            QtCore.QTimer.singleShot(500, self.aa )
             if not self.isVisible():
                 self.setVisible(True)
                 self.showFullScreen()
+#
+#    def aa(self):
+#        self.setWindowOpacity(1)
 
     def blankDisplay(self):
         if not self.displayBlank:
@@ -262,17 +269,16 @@
             self.firstTime = False
         else:
             self.mediaObject.enqueue(Phonon.MediaSource(file))
-        self.onMediaPlay(message[3])
+        self.onMediaPlay()
 
-    def onMediaPlay(self, live=True):
-        log.debug(u'Play the new media, Live %s', live)
+    def onMediaPlay(self):
+        log.debug(u'Play the new media, Live ')
         if not self.mediaLoaded and not self.displayBlank:
             self.blankDisplay()
         self.firstTime = True
         self.mediaLoaded = True
-        if live:
-            self.display.hide()
-            self.video.setFullScreen(True)
+        self.display.hide()
+        self.video.setFullScreen(True)
         self.mediaObject.play()
         if self.primary:
             self.setVisible(True)

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2009-11-07 06:45:25 +0000
+++ openlp/core/ui/servicemanager.py	2009-11-12 19:15:21 +0000
@@ -56,7 +56,6 @@
 #        else:
 #            event.ignore()
 
-
     def keyPressEvent(self, event):
         if type(event) == QtGui.QKeyEvent:
             #here accept the event and do something
@@ -99,7 +98,6 @@
         mimeData.setText(u'ServiceManager')
         dropAction = drag.start(QtCore.Qt.CopyAction)
 
-
 class ServiceManager(QtGui.QWidget):
     """
     Manages the services.  This involves taking text strings from plugins and

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2009-11-10 06:13:59 +0000
+++ openlp/core/ui/slidecontroller.py	2009-11-12 19:15:21 +0000
@@ -230,7 +230,6 @@
         self.grid = QtGui.QGridLayout(self.PreviewFrame)
         self.grid.setMargin(8)
         self.grid.setObjectName(u'grid')
-
         self.SlideLayout = QtGui.QVBoxLayout()
         self.SlideLayout.setSpacing(0)
         self.SlideLayout.setMargin(0)
@@ -242,7 +241,6 @@
         Phonon.createPath(self.mediaObject, self.video)
         Phonon.createPath(self.mediaObject, self.audio)
         self.SlideLayout.insertWidget(0, self.video)
-
         # Actual preview screen
         self.SlidePreview = QtGui.QLabel(self)
         sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
@@ -260,9 +258,6 @@
         self.SlidePreview.setScaledContents(True)
         self.SlidePreview.setObjectName(u'SlidePreview')
         self.SlideLayout.insertWidget(0, self.SlidePreview)
-
-
-
         self.grid.addLayout(self.SlideLayout, 0, 0, 1, 1)
         # Signals
         QtCore.QObject.connect(self.PreviewListWidget,
@@ -350,9 +345,9 @@
         self.Songbar.setVisible(False)
         self.Mediabar.setVisible(False)
         self.Toolbar.makeWidgetsInvisible(self.image_list)
-        if item.service_item_type == ServiceItemType.Text:
+        if item.isText():
             self.Toolbar.makeWidgetsInvisible(self.image_list)
-            if item.name == u'Songs' and \
+            if item.isSong() and \
                 str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
                 for action in self.Songbar.actions:
                     self.Songbar.actions[action].setVisible(False)
@@ -367,12 +362,11 @@
                             #More than 20 verses hard luck
                             pass
                     self.Songbar.setVisible(True)
-        elif item.service_item_type == ServiceItemType.Image:
+        elif item.isImage():
             #Not sensible to allow loops with 1 frame
             if len(item.frames) > 1:
                 self.Toolbar.makeWidgetsVisible(self.image_list)
-        elif item.service_item_type == ServiceItemType.Command and \
-            item.name == u'Media':
+        elif item.isMedia():
             self.Toolbar.setVisible(False)
             self.Mediabar.setVisible(True)
             self.volumeSlider.setAudioOutput(self.parent.mainDisplay.audio)
@@ -384,10 +378,9 @@
         self.Toolbar.setVisible(True)
         self.Mediabar.setVisible(False)
         self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
-        if (item.name == u'Songs' or item.name == u'Custom') and item.fromPlugin:
+        if item.editEnabled and item.fromPlugin:
             self.Toolbar.makeWidgetsVisible(self.song_edit_list)
-        elif item.service_item_type == ServiceItemType.Command and \
-            item.name == u'Media':
+        elif item.isMedia():
             self.Toolbar.setVisible(False)
             self.Mediabar.setVisible(True)
             self.volumeSlider.setAudioOutput(self.audio)
@@ -400,21 +393,20 @@
         """
         log.debug(u'addServiceItem')
         #If old item was a command tell it to stop
-        if self.commandItem and \
-            self.commandItem.service_item_type == ServiceItemType.Command:
+        if self.commandItem and self.commandItem.isCommand():
             self.onMediaStop()
         self.commandItem = item
         before = time.time()
         item.render()
-        log.info(u'Rendering took %4s' % (time.time() - before))
+        log.log(15, u'Rendering took %4s' % (time.time() - before))
         self.enableToolBar(item)
-        if item.service_item_type == ServiceItemType.Command:
+        if item.isCommand():
             if self.isLive:
                 Receiver().send_message(u'%s_start' % item.name.lower(), \
                     [item.shortname, item.service_item_path,
                     item.service_frames[0][u'title'], self.isLive])
             else:
-                if item.name == u'Media':
+                if item.isMedia():
                     self.onMediaStart(item)
         slideno = 0
         if self.songEdit:
@@ -437,18 +429,17 @@
         """
         log.debug(u'addServiceManagerItem')
         #If old item was a command tell it to stop
-        if self.commandItem and \
-            self.commandItem.service_item_type == ServiceItemType.Command:
+        if self.commandItem and self.commandItem.isCommand():
             self.onMediaStop()
         self.commandItem = item
         self.enableToolBar(item)
-        if item.service_item_type == ServiceItemType.Command:
+        if item.isCommand():
             if self.isLive:
                 Receiver().send_message(u'%s_start' % item.name.lower(), \
                     [item.shortname, item.service_item_path,
                     item.service_frames[0][u'title'], slideno, self.isLive])
             else:
-                if item.name == u'Media':
+                if item.isMedia():
                     self.onMediaStart(item)
         self.displayServiceManagerItems(item, slideno)
 
@@ -495,7 +486,7 @@
             self.PreviewListWidget.selectRow(slideno)
         self.onSlideSelected()
         self.PreviewListWidget.setFocus()
-        log.info(u'Display Rendering took %4s' % (time.time() - before))
+        log.log(15, u'Display Rendering took %4s' % (time.time() - before))
         if self.serviceitem.audit and self.isLive:
             Receiver().send_message(u'songusage_live', self.serviceitem.audit)
         log.debug(u'displayServiceManagerItems End')
@@ -505,8 +496,7 @@
         """
         Go to the first slide.
         """
-        if self.commandItem and \
-            self.commandItem.service_item_type == ServiceItemType.Command:
+        if self.commandItem and self.commandItem.isCommand():
             Receiver().send_message(u'%s_first'% self.commandItem.name.lower())
             self.updatePreview()
         else:
@@ -517,8 +507,7 @@
         """
         Blank the screen.
         """
-        if self.commandItem and \
-            self.commandItem.service_item_type == ServiceItemType.Command:
+        if self.commandItem and self.commandItem.isCommand():
             if blanked:
                 Receiver().send_message(u'%s_blank'% self.commandItem.name.lower())
             else:
@@ -534,7 +523,7 @@
         row = self.PreviewListWidget.currentRow()
         self.row = 0
         if row > -1 and row < self.PreviewListWidget.rowCount():
-            if self.commandItem.service_item_type == ServiceItemType.Command:
+            if self.commandItem.isCommand():
                 Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row])
                 if self.isLive:
                     self.updatePreview()
@@ -544,7 +533,7 @@
                 if frame is None:
                     frame = self.serviceitem.render_individual(row)
                 self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
-                log.info(u'Slide Rendering took %4s' % (time.time() - before))
+                log.log(15, u'Slide Rendering took %4s' % (time.time() - before))
                 if self.isLive:
                     self.parent.mainDisplay.frameView(frame)
             self.row = row
@@ -563,22 +552,23 @@
             QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
             QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
         else:
-            label = self.PreviewListWidget.cellWidget(self.PreviewListWidget.currentRow(), 0)
+            label = self.PreviewListWidget.cellWidget(
+                self.PreviewListWidget.currentRow(), 0)
             self.SlidePreview.setPixmap(label.pixmap())
 
     def grabMainDisplay(self):
         rm = self.parent.RenderManager
         winid = QtGui.QApplication.desktop().winId()
         rect = rm.screen_list[rm.current_display][u'size']
-        winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
+        winimg = QtGui.QPixmap.grabWindow(winid, rect.x(),
+            rect.y(), rect.width(), rect.height())
         self.SlidePreview.setPixmap(winimg)
 
     def onSlideSelectedNext(self):
         """
         Go to the next slide.
         """
-        if self.commandItem and \
-            self.commandItem.service_item_type == ServiceItemType.Command:
+        if self.commandItem and self.commandItem.isCommand():
             Receiver().send_message(u'%s_next'% self.commandItem.name.lower())
             self.updatePreview()
         else:
@@ -592,8 +582,7 @@
         """
         Go to the previous slide.
         """
-        if self.commandItem and \
-            self.commandItem.service_item_type == ServiceItemType.Command:
+        if self.commandItem and self.commandItem.isCommand():
             Receiver().send_message(
                 u'%s_previous'% self.commandItem.name.lower())
             self.updatePreview()
@@ -608,8 +597,7 @@
         """
         Go to the last slide.
         """
-        if self.commandItem and \
-            self.commandItem.service_item_type == ServiceItemType.Command:
+        if self.commandItem and self.commandItem.isCommand():
             Receiver().send_message(u'%s_last'% self.commandItem.name.lower())
             self.updatePreview()
         else:

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2009-11-03 19:01:53 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2009-11-12 19:15:21 +0000
@@ -79,7 +79,7 @@
         items = self.ListView.selectedIndexes()
         if len(items) > 1:
             return False
-        service_item.title = self.trUtf8(u'Media')
+        service_item.title = unicode(self.trUtf8(u'Media'))
         for item in items:
             bitem = self.ListView.item(item.row())
             filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())


Follow ups