From 08786fdcec59e744a6687cd7f7b9d26f84dde42a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 4 Nov 2009 22:06:46 +0200 Subject: [PATCH] Fixed incorrect showing of image based on splash screen configuration. Fixed a bug where the display screen's image would not resize when the display screen was set to another desktop. --- openlp/core/ui/maindisplay.py | 28 ++++++++++++++-------------- openlp/core/ui/mainwindow.py | 6 ++++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 77b34c255..125cf99be 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -136,7 +136,8 @@ class MainDisplay(DisplayLabel): Sets up the screen on a particular screen. @param (integer) screen This is the screen number. """ - log.debug(u'Setup %s for %s ' %(self.screens, screenNumber) ) + log.debug(u'Setup %s for %s ' %(self.screens, screenNumber)) + self.setVisible(False) screen = self.screens[screenNumber] if screen[u'number'] != screenNumber: # We will most probably never actually hit this bit, but just in @@ -154,19 +155,18 @@ class MainDisplay(DisplayLabel): self.setVisible(False) self.primary = True #Build a custom splash screen - if str_to_bool(self.parent.generalConfig.get_config(u'show splash', u'True')): - self.InitialFrame = QtGui.QImage( - screen[u'size'].width(), screen[u'size'].height(), - QtGui.QImage.Format_ARGB32_Premultiplied) - splash_image = QtGui.QImage(u':/graphics/openlp-splash-screen.png') - painter_image = QtGui.QPainter() - painter_image.begin(self.InitialFrame) - painter_image.fillRect(self.InitialFrame.rect(), QtCore.Qt.white) - painter_image.drawImage( - (screen[u'size'].width() - splash_image.width()) / 2, - (screen[u'size'].height() - splash_image.height()) / 2, - splash_image) - self.frameView(self.InitialFrame) + self.InitialFrame = QtGui.QImage( + screen[u'size'].width(), screen[u'size'].height(), + QtGui.QImage.Format_ARGB32_Premultiplied) + splash_image = QtGui.QImage(u':/graphics/openlp-splash-screen.png') + painter_image = QtGui.QPainter() + painter_image.begin(self.InitialFrame) + painter_image.fillRect(self.InitialFrame.rect(), QtCore.Qt.white) + painter_image.drawImage( + (screen[u'size'].width() - splash_image.width()) / 2, + (screen[u'size'].height() - splash_image.height()) / 2, + splash_image) + self.frameView(self.InitialFrame) #Build a Black screen painter = QtGui.QPainter() self.blankFrame = QtGui.QImage( diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index a2c6c6070..3179ad438 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -544,7 +544,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): monitor number does not exist. """ screen_number = int(self.generalConfig.get_config(u'Monitor', 0)) - monitor_exists = False for screen in self.screenList: if screen[u'number'] == screen_number: @@ -560,7 +559,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.showMaximized() screen_number = self.getMonitorNumber() self.mainDisplay.setup(screen_number) - self.setFocus() + if self.mainDisplay.isVisible(): + self.mainDisplay.setFocus() + self.activateWindow() if str_to_bool(self.generalConfig.get_config(u'Auto Open', False)): self.ServiceManagerContents.onLoadService(True) if str_to_bool(self.generalConfig.get_config(u'Screen Blank', False)) \ @@ -601,6 +602,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if updated_display != self.RenderManager.current_display: self.RenderManager.update_display(updated_display) self.mainDisplay.setup(updated_display) + self.activateWindow() def closeEvent(self, event): """