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.
QtCore.QObject.connect(Receiver.get_receiver(),
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.setOrganizationDomain(u'openlp.org')
self.setApplicationName(u'OpenLP')
@ -201,8 +205,21 @@ class OpenLP(QtGui.QApplication):
self.exceptionForm = ExceptionForm(self.mainWindow)
self.exceptionForm.exceptionTextEdit.setPlainText(
''.join(format_exception(exctype, value, traceback)))
self.setNormalCursor()
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():
"""
The main function which parses command line options and then runs
@ -264,4 +281,4 @@ if __name__ == u'__main__':
"""
Instantiate and run the application.
"""
main()
main()

View File

@ -220,6 +220,21 @@ class EventReceiver(QtCore.QObject):
Waits for openlp to do something "interesting" and sends a
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):
"""

View File

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

View File

@ -612,6 +612,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
Receiver.send_message(u'cursor_busy')
# Simple message boxes
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage)
@ -667,6 +668,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if savedPlugin != -1:
self.MediaToolBox.setCurrentIndex(savedPlugin)
self.settingsForm.postSetUp()
Receiver.send_message(u'cursor_normal')
def setAutoLanguage(self, 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
repaint is the easiest way to do this.
"""
Receiver.send_message(u'cursor_busy')
log.debug(u'regenerateServiceItems')
# force reset of renderer as theme data has changed
self.parent.renderManager.themedata = None
@ -909,6 +910,7 @@ class ServiceManager(QtGui.QWidget):
# Set to False as items may have changed rendering
# does not impact the saved song so True may also be valid
self.setModified(True)
Receiver.send_message(u'cursor_normal')
def serviceItemUpdate(self, message):
"""

View File

@ -139,8 +139,6 @@ class ImageMediaItem(MediaManagerItem):
self.settingsSection, self.getFileList())
def loadList(self, list):
self.listView.setCursor(QtCore.Qt.BusyCursor)
Receiver.send_message(u'openlp_process_events')
for file in list:
filename = os.path.split(unicode(file))[1]
thumb = os.path.join(self.servicePath, filename)
@ -155,8 +153,6 @@ class ImageMediaItem(MediaManagerItem):
item_name.setIcon(icon)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
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):
items = self.listView.selectedIndexes()