diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index d033282fa..a192a6062 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -60,10 +60,6 @@ class MainDisplay(QtGui.QWidget): Sets up the screen on a particular screen. @param (integer) screen This is the screen number. """ - # Temporary fix until I can speak to Tim Bentley. - if screenNumber not in self.screens: - screenNumber = 0 - # /Temporary fix screen = self.screens[screenNumber] if screen[u'number'] != screenNumber: # We will most probably never actually hit this bit, but just in @@ -79,20 +75,23 @@ class MainDisplay(QtGui.QWidget): else: self.showMinimized() #Build a custom splash screen - self.InitialFrame = QtGui.QImage(screen[u'size'].width(), - screen[u'size'].height(), QtGui.QImage.Format_ARGB32_Premultiplied) + 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) + 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(screen[u'size'].width(), - screen[u'size'].height(), QtGui.QImage.Format_ARGB32_Premultiplied) + self.blankFrame = QtGui.QImage( + screen[u'size'].width(), screen[u'size'].height(), + QtGui.QImage.Format_ARGB32_Premultiplied) painter.begin(self.blankFrame) painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 7bf3ae243..37459a347 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -22,10 +22,11 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.ui import AboutForm, SettingsForm, AlertForm, ServiceManager, \ - ThemeManager, MainDisplay, SlideController -from openlp.core.lib import translate, Plugin, MediaManagerItem, SettingsTab, \ - EventManager, RenderManager, PluginConfig, SettingsManager, PluginManager +from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \ + ServiceManager, ThemeManager, MainDisplay, SlideController +from openlp.core.lib import translate, Plugin, MediaManagerItem, \ + SettingsTab, EventManager, RenderManager, PluginConfig, \ + SettingsManager, PluginManager class MainWindow(object): """ @@ -63,7 +64,7 @@ class MainWindow(object): #RenderManager needs to call ThemeManager and #ThemeManager needs to call RenderManager self.RenderManager = RenderManager(self.ThemeManagerContents, - self.screenList, int(self.generalConfig.get_config(u'Monitor', 0))) + self.screenList, self.getMonitorNumber()) log.info(u'Load Plugins') #make the controllers available to the plugins self.plugin_helpers[u'preview'] = self.PreviewController @@ -96,12 +97,25 @@ class MainWindow(object): log.info(u'Load Themes') self.ThemeManagerContents.loadThemes() + def getMonitorNumber(self): + """ + Set up the default behaviour of the monitor configuration in + here. Currently it is set to default to monitor 0 if the saved + monitor number does not exist. + """ + screen_number = int(self.generalConfig.get_config(u'Monitor', 0)) + if screen_number not in self.screenList: + screen_number = 0 + return screen_number + def show(self): """ Show the main form, as well as the display form """ self.mainWindow.showMaximized() - self.mainDisplay.setup(self.settingsForm.GeneralTab.MonitorNumber) + screen_number = self.getMonitorNumber() + self.mainDisplay.setup(screen_number) + self.mainWindow.setFocus() def onHelpAboutItemClicked(self): """ @@ -120,7 +134,7 @@ class MainWindow(object): Show the Settings dialog """ self.settingsForm.exec_() - screen_number = int(self.generalConfig.get_config(u'Monitor', 0)) + screen_number = self.getMonitorNumber() self.RenderManager.update_display(screen_number) self.mainDisplay.setup(screen_number) @@ -155,24 +169,22 @@ class MainWindow(object): log.info(u'cleanup plugins') self.plugin_manager.initialise_plugins() - def OosChanged(self, reset = False, oosName = None): + def OosChanged(self, reset=False, oosName=None): """ Hook to change the title if the OOS has been changed reset - tells if the OOS has been cleared or saved oosName - is the name of the OOS (if it has one) """ + if not oosName: + service_name = u'(Unsaved Service)' + else: + service_name = oosName if reset == True: self.oosNotSaved = False - if oosName is None: - title = self.mainTitle - else: - title = self.mainTitle + u' - (' + oosName + u')' + title = u'%s - %s' % (self.mainTitle, service_name) else: self.oosNotSaved = True - if oosName is None: - title = self.mainTitle + u' - *' - else: - title = self.mainTitle + u' - *(' + oosName + u')' + title = u'%s - %s*' % (self.mainTitle, service_name) self.mainWindow.setWindowTitle(title) def setupUi(self): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 95e959b7b..1f3c37c27 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -24,9 +24,12 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import OpenLPToolbar, translate, buildIcon class SlideList(QtGui.QTableWidget): - - def __init__(self,parent=None,name=None): - QtGui.QTableWidget.__init__(self,parent.Controller) + """ + Customised version of QTableWidget which can respond to keyboard + events. + """ + def __init__(self, parent=None, name=None): + QtGui.QTableWidget.__init__(self, parent.Controller) self.parent = parent def keyPressEvent(self, event): @@ -56,7 +59,7 @@ class SlideController(QtGui.QWidget): global log log = logging.getLogger(u'SlideController') - def __init__(self, parent, isLive=False): + def __init__(self, parent, isLive=False): """ Set up the Slide Controller. """