← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

    Requested reviews:
    OpenLP Core (openlp-core)


Fixes and cleanups
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/14358
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2009-11-01 15:31:22 +0000
+++ openlp/core/lib/mediamanageritem.py	2009-11-03 14:15:24 +0000
@@ -358,6 +358,10 @@
             u'to be defined by the plugin')
 
     def onPreviewClick(self):
+        if not self.ListView.selectedIndexes():
+            QtGui.QMessageBox.information(self,
+                self.trUtf8(u'No items selected...'),
+                self.trUtf8(u'You must select one or more items'))
         log.debug(self.PluginNameShort + u' Preview Requested')
         service_item = self.buildServiceItem()
         if service_item is not None:
@@ -365,6 +369,10 @@
             self.parent.preview_controller.addServiceItem(service_item)
 
     def onLiveClick(self):
+        if not self.ListView.selectedIndexes():
+            QtGui.QMessageBox.information(self,
+                self.trUtf8(u'No items selected...'),
+                self.trUtf8(u'You must select one or more items'))
         log.debug(self.PluginNameShort + u' Live Requested')
         service_item = self.buildServiceItem()
         if service_item is not None:
@@ -373,6 +381,10 @@
             self.parent.live_controller.addServiceItem(service_item)
 
     def onAddClick(self):
+        if not self.ListView.selectedIndexes():
+            QtGui.QMessageBox.information(self,
+                self.trUtf8(u'No items selected...'),
+                self.trUtf8(u'You must select one or more items'))
         log.debug(self.PluginNameShort + u' Add Requested')
         service_item = self.buildServiceItem()
         if service_item is not None:

=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2009-10-30 20:21:36 +0000
+++ openlp/core/lib/renderer.py	2009-11-03 14:15:24 +0000
@@ -76,7 +76,6 @@
         self.theme_name = theme.theme_name
         self._set_theme_font()
         if theme.background_type == u'image':
-            print theme.background_filename
             if theme.background_filename is not None:
                 self.set_bg_image(theme.background_filename)
 

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2009-11-02 18:05:52 +0000
+++ openlp/core/ui/maindisplay.py	2009-11-03 14:15:24 +0000
@@ -94,15 +94,15 @@
         self.layout.setObjectName(u'layout')
         self.mediaObject = Phonon.MediaObject(self)
         self.video = Phonon.VideoWidget()
+        self.video.setVisible(False)
         self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
-        self.video.setFullScreen(True)
         Phonon.createPath(self.mediaObject, self.video)
         Phonon.createPath(self.mediaObject, self.audio)
         self.layout.insertWidget(0, self.video)
         self.display = QtGui.QLabel(self)
         self.display.setScaledContents(True)
         self.layout.insertWidget(0, self.display)
-        self.primary = False
+        self.primary = True
         self.displayBlank = False
         self.blankFrame = None
         self.frame = None
@@ -272,6 +272,7 @@
         self.firstTime = True
         self.mediaLoaded = True
         self.display.hide()
+        self.video.setFullScreen(True)
         self.mediaObject.play()
         if self.primary:
             self.setVisible(True)
@@ -292,4 +293,5 @@
         self.mediaObject.stop()
         self.mediaObject.clearQueue()
         self.mediaLoaded = False
+        self.video.setVisible(False)
         self.display.show()

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2009-11-01 15:31:22 +0000
+++ openlp/core/ui/servicemanager.py	2009-11-03 14:15:24 +0000
@@ -99,17 +99,6 @@
         mimeData.setText(u'ServiceManager')
         dropAction = drag.start(QtCore.Qt.CopyAction)
 
-class Iter(QtGui.QTreeWidgetItemIterator):
-    def __init__(self, *args):
-        QtGui.QTreeWidgetItemIterator.__init__(self, *args)
-
-    def next(self):
-        self.__iadd__(1)
-        value = self.value()
-        if value:
-            return self.value()
-        else:
-            return None
 
 class ServiceManager(QtGui.QWidget):
     """
@@ -248,23 +237,22 @@
         Moves the selection up the window
         Called by the up arrow
         """
-        it = Iter(self.ServiceManagerList)
-        item = it.value()
+        serviceIterator = QTreeWidgetItemIterator(self.ServiceManagerList)
         tempItem = None
         setLastItem = False
-        while item is not None:
-            if item.isSelected() and tempItem is None:
+        while serviceIterator:
+            if serviceIterator.isSelected() and tempItem is None:
                 setLastItem = True
-                item.setSelected(False)
-            if item.isSelected():
+                serviceIterator.setSelected(False)
+            if serviceIterator.isSelected():
                 #We are on the first record
                 if tempItem is not None:
                     tempItem.setSelected(True)
-                    item.setSelected(False)
+                    serviceIterator.setSelected(False)
             else:
-                tempItem = item
-            lastItem = item
-            item = it.next()
+                tempItem = serviceIterator
+            lastItem = serviceIterator
+            ++serviceIterator
         #Top Item was selected so set the last one
         if setLastItem:
             lastItem.setSelected(True)
@@ -274,18 +262,17 @@
         Moves the selection down the window
         Called by the down arrow
         """
-        it = Iter(self.ServiceManagerList)
-        item = it.value()
-        firstItem = item
+        serviceIterator = QTreeWidgetItemIterator(self.ServiceManagerList)
+        firstItem = serviceIterator
         setSelected = False
-        while item is not None:
+        while serviceIterator:
             if setSelected:
                 setSelected = False
-                item.setSelected(True)
-            elif item.isSelected():
-                item.setSelected(False)
+                serviceIterator.setSelected(True)
+            elif serviceIterator.isSelected():
+                serviceIterator.setSelected(False)
                 setSelected = True
-            item = it.next()
+            ++serviceIterator
         if setSelected:
             firstItem.setSelected(True)
 

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2009-10-30 17:44:16 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2009-11-03 14:15:24 +0000
@@ -160,9 +160,11 @@
 
     def onPreviewClick(self):
         if self.overrideActive:
+            if not self.ListView.selectedIndexes():
+                QtGui.QMessageBox.information(self,
+                    self.trUtf8(u'No items selected...'),
+                    self.trUtf8(u'You must select one or more items'))
             items = self.ListView.selectedIndexes()
-            if len(items) == 0:
-                return False
             for item in items:
                 bitem = self.ListView.item(item.row())
                 filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2009-11-02 17:24:27 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2009-11-03 14:15:24 +0000
@@ -50,9 +50,9 @@
         # this next is a class, not an instance of a class - it will
         # be instanced by the base MediaManagerItem
         self.ListViewWithDnD_class = MediaListView
-        self.ServiceItemIconName = u':/media/media_video.png'
         self.PreviewFunction = self.video_get_preview
         MediaManagerItem.__init__(self, parent, icon, title)
+        self.ServiceItemIconName = u':/media/media_video.png'
         self.MainDisplay = self.parent.live_controller.parent.mainDisplay
 
     def initPluginNameVisible(self):


Follow ups