From b52ead934d0ba612c748836d105fc0155ce7822a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 1 Jan 2011 11:44:16 +0000 Subject: [PATCH] Add Cursor management --- openlp.pyw | 21 ++++++++++++++++++- openlp/core/ui/mainwindow.py | 2 ++ openlp/core/ui/servicemanager.py | 4 +++- openlp/plugins/images/lib/mediaitem.py | 6 ++---- openlp/plugins/presentations/lib/mediaitem.py | 2 ++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 8cc7a16a6..888cdae9f 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -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() \ No newline at end of file + main() diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index a378dd633..88b4305a2 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -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) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index e2c1a765b..0e104a0eb 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -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) \ No newline at end of file + Receiver.send_message(u'servicemanager_list_response', data) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 170ac3b74..1c48e3eb6 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -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() diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index e832f1a10..9b8c2c1a9 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -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): """