make sure we focus first field when adding next note (#605)

This commit is contained in:
Damien Elmes 2013-05-22 12:54:29 +09:00
parent e61e849e09
commit 04b010a6d1
2 changed files with 5 additions and 3 deletions

View file

@ -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:

View file

@ -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()