mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
delay update of scroll widget, if change timer fires while deleting, delay
This commit is contained in:
parent
ba9279c126
commit
b15bc9ef61
1 changed files with 13 additions and 0 deletions
|
@ -396,6 +396,14 @@ class FactEditor(object):
|
|||
# update fields
|
||||
self.loadFields(check)
|
||||
self.parent.setUpdatesEnabled(True)
|
||||
# update with timer so we don't delete old one in event handler
|
||||
self.scrollUpdateTimer = QTimer(self.parent)
|
||||
self.scrollUpdateTimer.setSingleShot(True)
|
||||
self.parent.connect(self.scrollUpdateTimer,
|
||||
SIGNAL("timeout()"), self.onScrollUpdate)
|
||||
self.scrollUpdateTimer.start(0)
|
||||
|
||||
def onScrollUpdate(self):
|
||||
self.fieldsScroll.setWidget(self.fieldsFrame)
|
||||
|
||||
def needToRedraw(self):
|
||||
|
@ -481,8 +489,13 @@ class FactEditor(object):
|
|||
self.onChangeTimer)
|
||||
|
||||
def onChangeTimer(self):
|
||||
from ankiqt import mw
|
||||
interval = 250
|
||||
if not self.fact:
|
||||
return
|
||||
if mw.inDbHandler:
|
||||
self.changeTimer.start(interval)
|
||||
return
|
||||
self.saveFields()
|
||||
self.checkValid()
|
||||
if self.onChange:
|
||||
|
|
Loading…
Reference in a new issue