Add a Busy Cursor

bzr-revno: 1181
This commit is contained in:
Tim Bentley 2011-01-01 13:43:04 +00:00
commit 377fe1ba7c
6 changed files with 39 additions and 5 deletions

View File

@ -162,6 +162,10 @@ class OpenLP(QtGui.QApplication):
#provide a listener for widgets to reqest a screen update. #provide a listener for widgets to reqest a screen update.
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor)
self.setOrganizationName(u'OpenLP') self.setOrganizationName(u'OpenLP')
self.setOrganizationDomain(u'openlp.org') self.setOrganizationDomain(u'openlp.org')
self.setApplicationName(u'OpenLP') self.setApplicationName(u'OpenLP')
@ -201,8 +205,21 @@ class OpenLP(QtGui.QApplication):
self.exceptionForm = ExceptionForm(self.mainWindow) self.exceptionForm = ExceptionForm(self.mainWindow)
self.exceptionForm.exceptionTextEdit.setPlainText( self.exceptionForm.exceptionTextEdit.setPlainText(
''.join(format_exception(exctype, value, traceback))) ''.join(format_exception(exctype, value, traceback)))
self.setNormalCursor()
self.exceptionForm.exec_() self.exceptionForm.exec_()
def setBusyCursor(self):
"""
Sets the Busy Cursor for the Application
"""
self.setOverrideCursor(QtCore.Qt.BusyCursor)
def setNormalCursor(self):
"""
Sets the Normal Cursor forthe Application
"""
self.restoreOverrideCursor()
def main(): def main():
""" """
The main function which parses command line options and then runs The main function which parses command line options and then runs

View File

@ -220,6 +220,21 @@ class EventReceiver(QtCore.QObject):
Waits for openlp to do something "interesting" and sends a Waits for openlp to do something "interesting" and sends a
remotes_poll_response signal when it does remotes_poll_response signal when it does
``openlp_critical_message``
Displays a standalong Critical Message
``openlp_error_message``
Displays a standalong Error Message
``openlp_information_message``
Displays a standalong Information Message
``cursor_busy``
Makes the cursor got to a busy form
``cursor_normal``
Resets the cursor to default
""" """
def __init__(self): def __init__(self):
""" """

View File

@ -349,11 +349,13 @@ class MediaManagerItem(QtGui.QWidget):
self.OnNewFileMasks) self.OnNewFileMasks)
log.info(u'New files(s) %s', unicode(files)) log.info(u'New files(s) %s', unicode(files))
if files: if files:
Receiver.send_message(u'cursor_busy')
self.loadList(files) self.loadList(files)
lastDir = os.path.split(unicode(files[0]))[0] lastDir = os.path.split(unicode(files[0]))[0]
SettingsManager.set_last_dir(self.settingsSection, lastDir) SettingsManager.set_last_dir(self.settingsSection, lastDir)
SettingsManager.set_list(self.settingsSection, SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
Receiver.send_message(u'cursor_normal')
def getFileList(self): def getFileList(self):
""" """

View File

@ -612,6 +612,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged) QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage) QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
Receiver.send_message(u'cursor_busy')
# Simple message boxes # Simple message boxes
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage) QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage)
@ -667,6 +668,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if savedPlugin != -1: if savedPlugin != -1:
self.MediaToolBox.setCurrentIndex(savedPlugin) self.MediaToolBox.setCurrentIndex(savedPlugin)
self.settingsForm.postSetUp() self.settingsForm.postSetUp()
Receiver.send_message(u'cursor_normal')
def setAutoLanguage(self, value): def setAutoLanguage(self, value):
self.LanguageGroup.setDisabled(value) self.LanguageGroup.setDisabled(value)

View File

@ -895,6 +895,7 @@ class ServiceManager(QtGui.QWidget):
Rebuild the service list as things have changed and a Rebuild the service list as things have changed and a
repaint is the easiest way to do this. repaint is the easiest way to do this.
""" """
Receiver.send_message(u'cursor_busy')
log.debug(u'regenerateServiceItems') log.debug(u'regenerateServiceItems')
# force reset of renderer as theme data has changed # force reset of renderer as theme data has changed
self.parent.renderManager.themedata = None self.parent.renderManager.themedata = None
@ -909,6 +910,7 @@ class ServiceManager(QtGui.QWidget):
# Set to False as items may have changed rendering # Set to False as items may have changed rendering
# does not impact the saved song so True may also be valid # does not impact the saved song so True may also be valid
self.setModified(True) self.setModified(True)
Receiver.send_message(u'cursor_normal')
def serviceItemUpdate(self, message): def serviceItemUpdate(self, message):
""" """

View File

@ -139,8 +139,6 @@ class ImageMediaItem(MediaManagerItem):
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
def loadList(self, list): def loadList(self, list):
self.listView.setCursor(QtCore.Qt.BusyCursor)
Receiver.send_message(u'openlp_process_events')
for file in list: for file in list:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
thumb = os.path.join(self.servicePath, filename) thumb = os.path.join(self.servicePath, filename)
@ -155,8 +153,6 @@ class ImageMediaItem(MediaManagerItem):
item_name.setIcon(icon) item_name.setIcon(icon)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
self.listView.addItem(item_name) self.listView.addItem(item_name)
self.listView.setCursor(QtCore.Qt.ArrowCursor)
Receiver.send_message(u'openlp_process_events')
def generateSlideData(self, service_item, item=None, xmlVersion=False): def generateSlideData(self, service_item, item=None, xmlVersion=False):
items = self.listView.selectedIndexes() items = self.listView.selectedIndexes()