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. #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')
@ -203,6 +207,21 @@ class OpenLP(QtGui.QApplication):
''.join(format_exception(exctype, value, traceback))) ''.join(format_exception(exctype, value, traceback)))
self.exceptionForm.exec_() 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(): def main():
""" """
The main function which parses command line options and then runs The main function which parses command line options and then runs
@ -264,4 +283,4 @@ if __name__ == u'__main__':
""" """
Instantiate and run the application. 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.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')
# warning cyclic dependency # warning cyclic dependency
# RenderManager needs to call ThemeManager and # RenderManager needs to call ThemeManager and
# ThemeManager needs to call RenderManager # ThemeManager needs to call RenderManager
@ -659,6 +660,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

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

View File

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