← 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:
    Tim Bentley (trb143)
    Raoul Snyman (raoul-snyman)

-- 
https://code.launchpad.net/~trb143/openlp/working/+merge/18221
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2010-01-24 13:58:39 +0000
+++ openlp.pyw	2010-01-28 17:41:15 +0000
@@ -68,6 +68,10 @@
     global log
     log.info(u'OpenLP Application Loaded')
 
+    def notify(self, obj, evt):
+        #TODO needed for presentation exceptions
+        return QtGui.QApplication.notify(self, obj, evt)
+
     def run(self):
         """
         Run the OpenLP application.
@@ -131,6 +135,7 @@
         if show_splash:
             # now kill the splashscreen
             self.splash.finish(self.mainWindow)
+        self.mainWindow.repaint()
         self.mainWindow.versionCheck()
         return self.exec_()
 

=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py	2010-01-22 17:54:08 +0000
+++ openlp/core/lib/rendermanager.py	2010-01-28 17:41:15 +0000
@@ -64,8 +64,6 @@
         self.theme_level = u''
         self.override_background = None
         self.themedata = None
-        self.save_bg_frame = None
-        self.override_background_changed = False
 
     def update_display(self, screen_number):
         """
@@ -134,22 +132,6 @@
             self.calculate_default(self.screens.current[u'size'])
             self.renderer.set_theme(self.themedata)
             self.build_text_rectangle(self.themedata)
-        #Replace the background image from renderer with one from image
-        if self.override_background:
-            if self.save_bg_frame is None:
-                self.save_bg_frame = self.renderer.bg_frame
-            if self.override_background_changed:
-                self.renderer.bg_frame = resize_image(
-                    self.override_background, self.width, self.height)
-                self.override_background_changed = False
-        else:
-            if self.override_background_changed:
-                self.renderer.bg_frame = resize_image(
-                    self.override_background, self.width, self.height)
-                self.override_background_changed = False
-            if self.save_bg_frame:
-                self.renderer.bg_frame = self.save_bg_frame
-                self.save_bg_frame = None
 
     def build_text_rectangle(self, theme):
         """

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2010-01-24 15:18:26 +0000
+++ openlp/core/ui/maindisplay.py	2010-01-28 17:41:15 +0000
@@ -30,7 +30,7 @@
 from PyQt4 import QtCore, QtGui
 from PyQt4.phonon import Phonon
 
-from openlp.core.lib import Receiver
+from openlp.core.lib import Receiver, resize_image
 
 class DisplayWidget(QtGui.QWidget):
     """
@@ -96,10 +96,12 @@
         self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
         Phonon.createPath(self.mediaObject, self.video)
         Phonon.createPath(self.mediaObject, self.audio)
-        self.display = QtGui.QLabel(self)
-        self.display.setScaledContents(True)
-        self.alertDisplay = QtGui.QLabel(self)
-        self.alertDisplay.setScaledContents(True)
+        self.display_image = QtGui.QLabel(self)
+        self.display_image.setScaledContents(True)
+        self.display_text = QtGui.QLabel(self)
+        self.display_text.setScaledContents(True)
+        self.display_alert = QtGui.QLabel(self)
+        self.display_alert.setScaledContents(True)
         self.primary = True
         self.displayBlank = False
         self.blankFrame = None
@@ -123,7 +125,7 @@
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'media_play'), self.onMediaPlay)
         QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'media_pause'), self.onMediaPaws)
+            QtCore.SIGNAL(u'media_pause'), self.onMediaPause)
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'media_stop'), self.onMediaStop)
 
@@ -139,11 +141,13 @@
         self.setGeometry(self.screen[u'size'])
         self.alertScreenPosition = self.screen[u'size'].height() * 0.9
         self.alertHeight = self.screen[u'size'].height() - self.alertScreenPosition
-        self.alertDisplay.setGeometry(
+        self.display_alert.setGeometry(
             QtCore.QRect(0, self.alertScreenPosition,
                         self.screen[u'size'].width(),self.alertHeight))
         self.video.setGeometry(self.screen[u'size'])
-        self.display.resize(self.screen[u'size'].width(),
+        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())
         #Build a custom splash screen
         self.InitialFrame = QtGui.QImage(
@@ -158,7 +162,8 @@
             (self.screen[u'size'].width() - splash_image.width()) / 2,
             (self.screen[u'size'].height() - splash_image.height()) / 2,
             splash_image)
-        self.frameView(self.InitialFrame)
+        self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.InitialFrame))
+        self.repaint()
         #Build a Black screen
         painter = QtGui.QPainter()
         self.blankFrame = QtGui.QImage(
@@ -166,11 +171,14 @@
             self.screen[u'size'].height(),
             QtGui.QImage.Format_ARGB32_Premultiplied)
         painter.begin(self.blankFrame)
+        #TODO make black when testing finished
         painter.fillRect(self.blankFrame.rect(), QtCore.Qt.red)
-        #buid a blank transparent image
+        #build a blank transparent image
         self.transparent = QtGui.QPixmap(self.screen[u'size'].width(),
                                          self.screen[u'size'].height())
         self.transparent.fill(QtCore.Qt.transparent)
+        self.display_alert.setPixmap(self.transparent)
+        self.frameView(self.transparent)
         # To display or not to display?
         if not self.screen[u'primary']:
             self.showFullScreen()
@@ -182,6 +190,8 @@
     def resetDisplay(self):
         if self.primary:
             self.setVisible(False)
+        else:
+            self.showFullScreen()
 
     def hideDisplay(self):
         self.setVisible(False)
@@ -189,6 +199,17 @@
     def showDisplay(self):
         if not self.primary:
             self.setVisible(True)
+            self.showFullScreen()
+
+    def addImageWithText(self, frame):
+        frame = resize_image(frame,
+                    self.screen[u'size'].width(),
+                    self.screen[u'size'].height() )
+        self.display_image.setPixmap(QtGui.QPixmap.fromImage(frame))
+#        self.display_image.show()
+#        if not self.isVisible():
+#            self.setVisible(True)
+#            self.showFullScreen()
 
     def frameView(self, frame, transition=False):
         """
@@ -200,18 +221,21 @@
         if not self.displayBlank:
             if transition:
                 if self.frame is not None:
-                    self.display.setPixmap(QtGui.QPixmap.fromImage(self.frame))
+                    self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.frame))
                     self.repaint()
                 self.frame = None
                 if frame[u'trans'] is not None:
-                    self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'trans']))
+                    self.display_text.setPixmap(QtGui.QPixmap.fromImage(frame[u'trans']))
                     self.repaint()
                     self.frame = frame[u'trans']
-                self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
+                self.display_text.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
                 self.display_frame = frame[u'main']
                 self.repaint()
             else:
-                self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
+                if isinstance(frame, QtGui.QPixmap):
+                    self.display_text.setPixmap(frame)
+                else:
+                    self.display_text.setPixmap(QtGui.QPixmap.fromImage(frame))
                 self.display_frame = frame
             if not self.isVisible():
                 self.setVisible(True)
@@ -220,14 +244,12 @@
     def blankDisplay(self, blanked=True):
         if blanked:
             self.displayBlank = True
-            self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
+            self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
         else:
             self.displayBlank = False
             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''):
         """
@@ -237,8 +259,11 @@
             display text
         """
         log.debug(u'display alert called %s' % text)
+        self.parent.StatusBar.showMessage(self.trUtf8(u''))
         self.alertList.append(text)
         if self.timer_id != 0 or self.mediaLoaded:
+            self.parent.StatusBar.showMessage(\
+                    self.trUtf8(u'Alert message created and delayed'))
             return
         self.generateAlert()
 
@@ -270,22 +295,24 @@
         painter.drawText(
             x, y + metrics.height() - metrics.descent() - 1, text)
         painter.end()
-        self.alertDisplay.setPixmap(alertframe)
-        self.alertDisplay.setVisible(True)
+        self.display_alert.setPixmap(alertframe)
+        self.display_alert.setVisible(True)
         # check to see if we have a timer running
         if self.timer_id == 0:
             self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
 
     def timerEvent(self, event):
         if event.timerId() == self.timer_id:
-            self.alertDisplay.setPixmap(self.transparent)
+            self.display_alert.setPixmap(self.transparent)
         self.killTimer(self.timer_id)
         self.timer_id = 0
         self.generateAlert()
 
     def onMediaQueue(self, message):
         log.debug(u'Queue new media message %s' % message)
-        self.display.close()
+        self.display_image.close()
+        self.display_text.close()
+        self.display_alert.close()
         file = os.path.join(message[1], message[2])
         if self.firstTime:
             self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
@@ -301,15 +328,16 @@
             self.display_frame = self.blankFrame
         self.firstTime = True
         self.mediaLoaded = True
-        self.display.hide()
-        self.alertDisplay.hide()
+        self.display_image.hide()
+        self.display_text.hide()
+        self.display_alert.hide()
         self.video.setFullScreen(True)
         self.video.setVisible(True)
         self.mediaObject.play()
-        if self.primary:
-            self.setVisible(True)
+        self.setVisible(True)
+        self.hide()
 
-    def onMediaPaws(self):
+    def onMediaPause(self):
         log.debug(u'Media paused by user')
         self.mediaObject.pause()
 
@@ -320,11 +348,10 @@
 
     def onMediaFinish(self):
         log.debug(u'Reached end of media playlist')
-        if self.primary:
-            self.setVisible(False)
         self.mediaObject.stop()
         self.mediaObject.clearQueue()
         self.mediaLoaded = False
         self.video.setVisible(False)
-        self.display.show()
+        self.display_text.show()
+        self.display_image.show()
         self.blankDisplay(False)

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2010-01-24 16:28:18 +0000
+++ openlp/core/ui/mainwindow.py	2010-01-28 17:41:15 +0000
@@ -50,7 +50,6 @@
     border-color: palette(light);
   }
 """
-
 class Ui_MainWindow(object):
     def setupUi(self, MainWindow):
         """

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2010-01-22 17:54:08 +0000
+++ openlp/core/ui/thememanager.py	2010-01-28 17:41:15 +0000
@@ -249,32 +249,33 @@
         log.debug(u'Load themes from dir')
         self.themelist = []
         self.ThemeListWidget.clear()
-        for root, dirs, files in os.walk(self.path):
-            for name in files:
-                if name.endswith(u'.png'):
-                    #check to see file is in theme root directory
-                    theme = os.path.join(self.path, name)
-                    if os.path.exists(theme):
-                        (path, filename) = os.path.split(unicode(file))
-                        textName = os.path.splitext(name)[0]
-                        if textName == self.global_theme:
-                            name = u'%s (%s)' % (textName,
-                                self.trUtf8('default'))
-                        else:
-                            name = textName
-                        thumb = os.path.join(self.thumbPath, u'%s.png' % textName)
-                        item_name = QtGui.QListWidgetItem(name)
-                        if os.path.exists(thumb):
-                            icon = build_icon(thumb)
-                        else:
-                            icon = build_icon(theme)
-                            pixmap = icon.pixmap(QtCore.QSize(88,50))
-                            pixmap.save(thumb, u'png')
-                        item_name.setIcon(icon)
-                        item_name.setData(QtCore.Qt.UserRole,
-                            QtCore.QVariant(textName))
-                        self.ThemeListWidget.addItem(item_name)
-                        self.themelist.append(textName)
+        #root, dirs, files = os.walk(self.path)
+        dirList = os.listdir(self.path)
+        for name in dirList:
+            if name.endswith(u'.png'):
+                #check to see file is in theme root directory
+                theme = os.path.join(self.path, name)
+                if os.path.exists(theme):
+                    (path, filename) = os.path.split(unicode(file))
+                    textName = os.path.splitext(name)[0]
+                    if textName == self.global_theme:
+                        name = u'%s (%s)' % (textName,
+                            self.trUtf8('default'))
+                    else:
+                        name = textName
+                    thumb = os.path.join(self.thumbPath, u'%s.png' % textName)
+                    item_name = QtGui.QListWidgetItem(name)
+                    if os.path.exists(thumb):
+                        icon = build_icon(thumb)
+                    else:
+                        icon = build_icon(theme)
+                        pixmap = icon.pixmap(QtCore.QSize(88,50))
+                        pixmap.save(thumb, u'png')
+                    item_name.setIcon(icon)
+                    item_name.setData(QtCore.Qt.UserRole,
+                        QtCore.QVariant(textName))
+                    self.ThemeListWidget.addItem(item_name)
+                    self.themelist.append(textName)
         self.pushThemes()
 
     def pushThemes(self):

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2009-12-31 12:52:01 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2010-01-28 17:41:15 +0000
@@ -172,7 +172,6 @@
                 filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
                 self.OverrideLabel.setText(bitem.text())
                 frame = QtGui.QImage(unicode(filename))
-                self.parent.render_manager.override_background = frame
-                self.parent.render_manager.override_background_changed = True
+                self.parent.live_controller.parent.mainDisplay.addImageWithText(frame)
         else:
-            MediaManagerItem.onPreviewClick(self)
\ No newline at end of file
+            MediaManagerItem.onPreviewClick(self)

=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py	2010-01-23 09:49:01 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py	2010-01-28 17:41:15 +0000
@@ -256,7 +256,7 @@
             return False
         if self.controller is None:
             return False
-        return self.controller.isRunning() and self.controller.isActive()
+        return True
 
     def unblank_screen(self):
         return self.controller.resume()

=== modified file 'openlp/plugins/songusage/forms/songusagedeleteform.py'
--- openlp/plugins/songusage/forms/songusagedeleteform.py	2009-12-31 12:52:01 +0000
+++ openlp/plugins/songusage/forms/songusagedeleteform.py	2010-01-28 17:41:15 +0000
@@ -33,11 +33,11 @@
     """
     Class documentation goes here.
     """
-    def __init__(self, auditmanager, parent=None):
+    def __init__(self, songusagemanager, parent=None):
         """
         Constructor
         """
-        self.auditmanager = auditmanager
+        self.songusagemanager = songusagemanager
         QtGui.QDialog.__init__(self, parent)
         self.setupUi(self)
 
@@ -52,5 +52,5 @@
         if ret == QtGui.QMessageBox.Ok:
             qDeleteDate = self.DeleteCalendar.selectedDate()
             deleteDate = date(qDeleteDate.year(), qDeleteDate.month(), qDeleteDate.day())
-            self.auditmanager.delete_to_date(deleteDate)
-        self.close()
\ No newline at end of file
+            self.songusagemanager.delete_to_date(deleteDate)
+        self.close()

=== modified file 'openlp/plugins/songusage/forms/songusagedetailform.py'
--- openlp/plugins/songusage/forms/songusagedetailform.py	2009-12-31 12:52:01 +0000
+++ openlp/plugins/songusage/forms/songusagedetailform.py	2010-01-28 17:41:15 +0000
@@ -25,10 +25,14 @@
 import os
 
 from PyQt4 import QtCore, QtGui
+import logging
 
 from songusagedetaildialog import Ui_SongUsageDetailDialog
 
 class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
+    global log
+    log = logging.getLogger(u'SongUsageDetailForm')
+    log.info(u'SongUsage Detail Form loaded')
     """
     Class documentation goes here.
     """
@@ -106,19 +110,19 @@
         self.close()
 
     def detailedReport(self):
-        print "detailed"
-        filename = u'audit_det_%s_%s.txt' % \
+        log.debug(u'Detailed report generated')
+        filename = u'usage_detail_%s_%s.txt' % \
             (self.FromDateEdit.date().toString(u'ddMMyyyy'),
              self.ToDateEdit.date().toString(u'ddMMyyyy'))
-        audits = self.parent.auditmanager.get_all_audits()
+        usage = self.parent.songusagemanager.get_all_songusage()
         outname = os.path.join(unicode(self.FileLineEdit.text()), filename)
         file = None
         try:
             file = open(outname, u'w')
-            for audit in audits:
+            for instance in usage:
                 record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"\n' % \
-                    (audit.auditdate,audit.audittime, audit.title,
-                    audit.copyright, audit.ccl_number , audit.authors)
+                    (instance.usagedate,instance.usagetime, instance.title,
+                    instance.copyright, instance.ccl_number , instance.authors)
                 file.write(record)
         except:
             log.exception(u'Failed to write out audit records')
@@ -127,8 +131,7 @@
                 file.close()
 
     def summaryReport(self):
-        print "summary"
+        log.debug(u'Summary report generated')
         filename = u'audit_sum_%s_%s.txt' % \
             (self.FromDateEdit.date().toString(u'ddMMyyyy'),
              self.ToDateEdit.date().toString(u'ddMMyyyy'))
-        print filename
\ No newline at end of file

=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py	2009-12-31 12:52:01 +0000
+++ openlp/plugins/songusage/songusageplugin.py	2010-01-28 17:41:15 +0000
@@ -141,7 +141,7 @@
             SongUsageitem.authors = u''
             for author in SongUsageData[1]:
                 SongUsageitem.authors += author + u' '
-            self.songusagemanager.insert_SongUsage(SongUsageitem)
+            self.songusagemanager.insert_songusage(SongUsageitem)
 
     def onSongUsageDelete(self):
         self.SongUsagedeleteform.exec_()
@@ -154,4 +154,4 @@
         about_text = self.trUtf8('<b>SongUsage Plugin</b><br>This plugin '
             'records the use of songs and when they have been used during '
             'a live service')
-        return about_text
\ No newline at end of file
+        return about_text


Follow ups