mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
suppress timers in db progress handler, disable UI during progress
This commit is contained in:
parent
f45fccb93f
commit
ba9279c126
2 changed files with 11 additions and 0 deletions
|
@ -32,6 +32,7 @@ class AnkiQt(QMainWindow):
|
||||||
def __init__(self, app, config, args):
|
def __init__(self, app, config, args):
|
||||||
QMainWindow.__init__(self)
|
QMainWindow.__init__(self)
|
||||||
self.errorOccurred = False
|
self.errorOccurred = False
|
||||||
|
self.inDbHandler = False
|
||||||
if sys.platform.startswith("darwin"):
|
if sys.platform.startswith("darwin"):
|
||||||
qt_mac_set_menubar_icons(False)
|
qt_mac_set_menubar_icons(False)
|
||||||
ankiqt.mw = self
|
ankiqt.mw = self
|
||||||
|
@ -429,6 +430,8 @@ new:
|
||||||
|
|
||||||
def refreshStatus(self):
|
def refreshStatus(self):
|
||||||
"If triggered when the deck is finished, reset state."
|
"If triggered when the deck is finished, reset state."
|
||||||
|
if self.inDbHandler:
|
||||||
|
return
|
||||||
if self.state == "deckFinished":
|
if self.state == "deckFinished":
|
||||||
# don't try refresh if the deck is closed during a sync
|
# don't try refresh if the deck is closed during a sync
|
||||||
if self.deck:
|
if self.deck:
|
||||||
|
@ -2154,7 +2157,9 @@ it to your friends.
|
||||||
if self.mainThread != QThread.currentThread():
|
if self.mainThread != QThread.currentThread():
|
||||||
return
|
return
|
||||||
self.setBusy()
|
self.setBusy()
|
||||||
|
self.inDbHandler = True
|
||||||
self.app.processEvents()
|
self.app.processEvents()
|
||||||
|
self.inDbHandler = False
|
||||||
|
|
||||||
def onDbFinished(self):
|
def onDbFinished(self):
|
||||||
if self.mainThread != QThread.currentThread():
|
if self.mainThread != QThread.currentThread():
|
||||||
|
@ -2164,11 +2169,13 @@ it to your friends.
|
||||||
|
|
||||||
def setBusy(self):
|
def setBusy(self):
|
||||||
if not self.busyCursor:
|
if not self.busyCursor:
|
||||||
|
self.setEnabled(False)
|
||||||
self.app.setOverrideCursor(QCursor(Qt.WaitCursor))
|
self.app.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||||
self.busyCursor = True
|
self.busyCursor = True
|
||||||
|
|
||||||
def unsetBusy(self):
|
def unsetBusy(self):
|
||||||
if self.busyCursor:
|
if self.busyCursor:
|
||||||
|
self.setEnabled(True)
|
||||||
self.app.restoreOverrideCursor()
|
self.app.restoreOverrideCursor()
|
||||||
self.busyCursor = None
|
self.busyCursor = None
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,8 @@ You should aim to answer each question within<br>
|
||||||
palette.setColor(QPalette.Highlight, QColor("#00ee00"))
|
palette.setColor(QPalette.Highlight, QColor("#00ee00"))
|
||||||
|
|
||||||
def drawTimer(self):
|
def drawTimer(self):
|
||||||
|
if self.main.inDbHandler:
|
||||||
|
return
|
||||||
if not self.main.config['showTimer']:
|
if not self.main.config['showTimer']:
|
||||||
return
|
return
|
||||||
if not self.timer:
|
if not self.timer:
|
||||||
|
@ -280,6 +282,8 @@ You should aim to answer each question within<br>
|
||||||
self.timerFlashStart = time.time()
|
self.timerFlashStart = time.time()
|
||||||
|
|
||||||
def updateCount(self):
|
def updateCount(self):
|
||||||
|
if self.main.inDbHandler:
|
||||||
|
return
|
||||||
if not self.main.deck:
|
if not self.main.deck:
|
||||||
return
|
return
|
||||||
if self.state in ("showQuestion", "showAnswer", "studyScreen"):
|
if self.state in ("showQuestion", "showAnswer", "studyScreen"):
|
||||||
|
|
Loading…
Reference in a new issue