Add Cursor management

This commit is contained in:
Tim Bentley 2011-01-01 11:44:16 +00:00
parent a28e26d09e
commit b52ead934d
5 changed files with 29 additions and 6 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')
@ -203,6 +207,21 @@ class OpenLP(QtGui.QApplication):
''.join(format_exception(exctype, value, traceback)))
self.exceptionForm.exec_()
def setBusyCursor(self):
"""
Sets the Busy Cursor on the Main Window
"""
#a=c
self.setOverrideCursor(QtCore.Qt.BusyCursor)
#self.processEvents()
def setNormalCursor(self):
"""
Sets the Normal Cursor on the Main Window
"""
self.restoreOverrideCursor()
#self.processEvents()
def main():
"""
The main function which parses command line options and then runs
@ -264,4 +283,4 @@ if __name__ == u'__main__':
"""
Instantiate and run the application.
"""
main()
main()

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')
# warning cyclic dependency
# RenderManager needs to call ThemeManager and
# ThemeManager needs to call RenderManager
@ -659,6 +660,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

@ -571,6 +571,7 @@ class ServiceManager(QtGui.QWidget):
Used when moving items as the move takes place in supporting array,
and when regenerating all the items due to theme changes
"""
Receiver.send_message(u'cursor_busy')
# Correct order of items in array
count = 1
for item in self.serviceItems:
@ -614,6 +615,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceManagerList.setCurrentItem(treewidgetitem1)
item[u'expanded'] = temp
treewidgetitem.setExpanded(item[u'expanded'])
Receiver.send_message(u'cursor_normal')
def onSaveService(self, quick=False):
"""
@ -1119,4 +1121,4 @@ class ServiceManager(QtGui.QWidget):
data_item[u'notes'] = unicode(service_item.notes)
data_item[u'selected'] = (item == curitem)
data.append(data_item)
Receiver.send_message(u'servicemanager_list_response', data)
Receiver.send_message(u'servicemanager_list_response', data)

View File

@ -139,8 +139,7 @@ class ImageMediaItem(MediaManagerItem):
self.settingsSection, self.getFileList())
def loadList(self, list):
self.listView.setCursor(QtCore.Qt.BusyCursor)
Receiver.send_message(u'openlp_process_events')
Receiver.send_message(u'cursor_busy')
for file in list:
filename = os.path.split(unicode(file))[1]
thumb = os.path.join(self.servicePath, filename)
@ -155,8 +154,7 @@ 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')
Receiver.send_message(u'cursor_normal')
def generateSlideData(self, service_item, item=None, xmlVersion=False):
items = self.listView.selectedIndexes()

View File

@ -171,6 +171,7 @@ class PresentationMediaItem(MediaManagerItem):
This is called both on initial load of the plugin to populate with
existing files, and when the user adds new files via the media manager
"""
Receiver.send_message(u'cursor_busy')
currlist = self.getFileList()
titles = []
for file in currlist:
@ -215,6 +216,7 @@ class PresentationMediaItem(MediaManagerItem):
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
item_name.setIcon(icon)
self.listView.addItem(item_name)
Receiver.send_message(u'cursor_normal')
def onDeleteClick(self):
"""