mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -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):
|
||||
QMainWindow.__init__(self)
|
||||
self.errorOccurred = False
|
||||
self.inDbHandler = False
|
||||
if sys.platform.startswith("darwin"):
|
||||
qt_mac_set_menubar_icons(False)
|
||||
ankiqt.mw = self
|
||||
|
@ -429,6 +430,8 @@ new:
|
|||
|
||||
def refreshStatus(self):
|
||||
"If triggered when the deck is finished, reset state."
|
||||
if self.inDbHandler:
|
||||
return
|
||||
if self.state == "deckFinished":
|
||||
# don't try refresh if the deck is closed during a sync
|
||||
if self.deck:
|
||||
|
@ -2154,7 +2157,9 @@ it to your friends.
|
|||
if self.mainThread != QThread.currentThread():
|
||||
return
|
||||
self.setBusy()
|
||||
self.inDbHandler = True
|
||||
self.app.processEvents()
|
||||
self.inDbHandler = False
|
||||
|
||||
def onDbFinished(self):
|
||||
if self.mainThread != QThread.currentThread():
|
||||
|
@ -2164,11 +2169,13 @@ it to your friends.
|
|||
|
||||
def setBusy(self):
|
||||
if not self.busyCursor:
|
||||
self.setEnabled(False)
|
||||
self.app.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||
self.busyCursor = True
|
||||
|
||||
def unsetBusy(self):
|
||||
if self.busyCursor:
|
||||
self.setEnabled(True)
|
||||
self.app.restoreOverrideCursor()
|
||||
self.busyCursor = None
|
||||
|
||||
|
|
|
@ -252,6 +252,8 @@ You should aim to answer each question within<br>
|
|||
palette.setColor(QPalette.Highlight, QColor("#00ee00"))
|
||||
|
||||
def drawTimer(self):
|
||||
if self.main.inDbHandler:
|
||||
return
|
||||
if not self.main.config['showTimer']:
|
||||
return
|
||||
if not self.timer:
|
||||
|
@ -280,6 +282,8 @@ You should aim to answer each question within<br>
|
|||
self.timerFlashStart = time.time()
|
||||
|
||||
def updateCount(self):
|
||||
if self.main.inDbHandler:
|
||||
return
|
||||
if not self.main.deck:
|
||||
return
|
||||
if self.state in ("showQuestion", "showAnswer", "studyScreen"):
|
||||
|
|
Loading…
Reference in a new issue