mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
make sure we focus first field when adding next note (#605)
This commit is contained in:
parent
e61e849e09
commit
04b010a6d1
2 changed files with 5 additions and 3 deletions
|
@ -76,7 +76,7 @@ class AddCards(QDialog):
|
|||
def setupNewNote(self, set=True):
|
||||
f = self.mw.col.newNote()
|
||||
if set:
|
||||
self.editor.setNote(f)
|
||||
self.editor.setNote(f, focus=True)
|
||||
return f
|
||||
|
||||
def onReset(self, model=None, keep=False):
|
||||
|
@ -96,7 +96,7 @@ class AddCards(QDialog):
|
|||
except IndexError:
|
||||
break
|
||||
self.editor.currentField = 0
|
||||
self.editor.setNote(note)
|
||||
self.editor.setNote(note, focus=True)
|
||||
|
||||
def removeTempNote(self, note):
|
||||
if not note or not note.id:
|
||||
|
|
|
@ -538,7 +538,6 @@ class Editor(object):
|
|||
def onUpdate():
|
||||
self.stealFocus = True
|
||||
self.loadNote()
|
||||
self.stealFocus = False
|
||||
self.checkValid()
|
||||
self.mw.progress.timer(100, onUpdate, False)
|
||||
else:
|
||||
|
@ -584,6 +583,8 @@ class Editor(object):
|
|||
self.note = note
|
||||
self.currentField = 0
|
||||
self.disableButtons()
|
||||
if focus:
|
||||
self.stealFocus = True
|
||||
# change timer
|
||||
if self.note:
|
||||
self.web.setHtml(_html % (
|
||||
|
@ -617,6 +618,7 @@ class Editor(object):
|
|||
self.widget.show()
|
||||
if self.stealFocus:
|
||||
self.web.setFocus()
|
||||
self.stealFocus = False
|
||||
|
||||
def focus(self):
|
||||
self.web.setFocus()
|
||||
|
|
Loading…
Reference in a new issue