Busy cursor

This commit is contained in:
Kovid Goyal 2007-10-25 16:29:19 +00:00
parent 0e23eed1b7
commit fbd0b6003e
2 changed files with 5 additions and 3 deletions

View File

@ -109,7 +109,7 @@ class FetchMetadata(QDialog, Ui_FetchMetadata):
# args.extend(('--publisher', self.publisher)) # args.extend(('--publisher', self.publisher))
self.fetch.setEnabled(False) self.fetch.setEnabled(False)
self.setCursor(Qt.WaitCursor)
QCoreApplication.instance().processEvents() QCoreApplication.instance().processEvents()
args.append(key) args.append(key)
@ -125,7 +125,7 @@ class FetchMetadata(QDialog, Ui_FetchMetadata):
self.matches.selectionModel().select(self.model.index(0, 0), self.matches.selectionModel().select(self.model.index(0, 0),
QItemSelectionModel.Select | QItemSelectionModel.Rows) QItemSelectionModel.Select | QItemSelectionModel.Rows)
self.fetch.setEnabled(True) self.fetch.setEnabled(True)
self.unsetCursor()
def selected_book(self): def selected_book(self):

View File

@ -18,7 +18,7 @@ add/remove formats
''' '''
import os, urllib import os, urllib
from PyQt4.QtCore import SIGNAL, QObject, QCoreApplication from PyQt4.QtCore import SIGNAL, QObject, QCoreApplication, Qt
from PyQt4.QtGui import QPixmap, QListWidgetItem, QErrorMessage, QDialog from PyQt4.QtGui import QPixmap, QListWidgetItem, QErrorMessage, QDialog
@ -204,6 +204,7 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog):
isbn = qstring_to_unicode(self.isbn.text()) isbn = qstring_to_unicode(self.isbn.text())
if isbn: if isbn:
self.fetch_cover_button.setEnabled(False) self.fetch_cover_button.setEnabled(False)
self.setCursor(Qt.WaitCursor)
QCoreApplication.instance().processEvents() QCoreApplication.instance().processEvents()
try: try:
src = urllib.urlopen('http://www.librarything.com/isbn/'+isbn).read() src = urllib.urlopen('http://www.librarything.com/isbn/'+isbn).read()
@ -222,6 +223,7 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog):
error_dialog(self, 'Could not fetch cover', 'Could not fetch cover. Error %s'%(err,)).exec_() error_dialog(self, 'Could not fetch cover', 'Could not fetch cover. Error %s'%(err,)).exec_()
finally: finally:
self.fetch_cover_button.setEnabled(True) self.fetch_cover_button.setEnabled(True)
self.unsetCursor()
else: else:
error_dialog(self, 'Cannot fetch cover', 'You must specify the ISBN identifier for this book.').exec_() error_dialog(self, 'Cannot fetch cover', 'You must specify the ISBN identifier for this book.').exec_()