diff --git a/openlp.pyw b/openlp.pyw index 85ba81fba..6712dc419 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -34,7 +34,8 @@ from subprocess import Popen, PIPE from PyQt4 import QtCore, QtGui -from openlp.core.lib import Receiver, check_directory_exists +from openlp.core.lib import Receiver, translate, check_directory_exists +from openlp.core.lib.ui import information_message_box from openlp.core.resources import qInitResources from openlp.core.ui.mainwindow import MainWindow from openlp.core.ui.exceptionform import ExceptionForm @@ -166,6 +167,9 @@ class OpenLP(QtGui.QApplication): QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor) + QtCore.QObject.connect(self.desktop(), + QtCore.SIGNAL(u'screenCountChanged(int)'), + self.onScreenCountChanged) self.setOrganizationName(u'OpenLP') self.setOrganizationDomain(u'openlp.org') self.setApplicationName(u'OpenLP') @@ -225,6 +229,15 @@ class OpenLP(QtGui.QApplication): """ self.restoreOverrideCursor() + def onScreenCountChanged(self): + """ + Called when the user changes the monitor set up. + """ + information_message_box( + message=translate('OpenLP','You have changed the monitor set up. ' + 'You have to restart OpenLP in order to change the live display ' + 'monitor.')) + def main(): """ The main function which parses command line options and then runs diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index c127d810d..9555e0533 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -58,6 +58,7 @@ class UiStrings(object): 'Abbreviated font pointsize unit') Image = translate('OpenLP.Ui', 'Image') Import = translate('OpenLP.Ui', 'Import') + Information = translate('OpenLP.Ui', 'Information') LengthTime = unicode(translate('OpenLP.Ui', 'Length %s')) Live = translate('OpenLP.Ui', 'Live') LiveBGError = translate('OpenLP.Ui', 'Live Background Error') @@ -173,6 +174,32 @@ def critical_error_message_box(title=None, message=None, parent=None, data[u'title'] = title if title else UiStrings.Error return Receiver.send_message(u'openlp_error_message', data) +def information_message_box(title=None, message=None, parent=None, + question=False): + """ + Provides a standard information message box for notes that OpenLP displays + to users. + + ``title`` + The title for the message box. + + ``message`` + The message to display to the user. + + ``parent`` + The parent UI element to attach the dialog to. + + ``question`` + Should this message box question the user. + """ + if question: + return QtGui.QMessageBox.critical(parent, UiStrings.Information, + message, QtGui.QMessageBox.StandardButtons( + QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) + data = {u'message': message} + data[u'title'] = title if title else UiStrings.Information + return Receiver.send_message(u'openlp_information_message', data) + def media_item_combo_box(parent, name): """ Provide a standard combo box for media items.