What about this one?
This commit is contained in:
parent
3991603bf4
commit
50736ecf1d
12
aqt/utils.py
12
aqt/utils.py
@ -184,13 +184,18 @@ class GetTextDialog(QDialog):
|
|||||||
def helpRequested(self):
|
def helpRequested(self):
|
||||||
openHelp(self.help)
|
openHelp(self.help)
|
||||||
|
|
||||||
def getText(prompt, parent=None, help=None, edit=None, default="", title="Anki"):
|
def getText(prompt, parent=None, help=None, edit=None, default="",
|
||||||
|
title="Anki", geomKey=None, **kwargs):
|
||||||
if not parent:
|
if not parent:
|
||||||
parent = aqt.mw.app.activeWindow() or aqt.mw
|
parent = aqt.mw.app.activeWindow() or aqt.mw
|
||||||
d = GetTextDialog(parent, prompt, help=help, edit=edit,
|
d = GetTextDialog(parent, prompt, help=help, edit=edit,
|
||||||
default=default, title=title)
|
default=default, title=title, **kwargs)
|
||||||
d.setWindowModality(Qt.WindowModal)
|
d.setWindowModality(Qt.WindowModal)
|
||||||
|
if geomKey:
|
||||||
|
restoreGeom(d, geomKey)
|
||||||
ret = d.exec_()
|
ret = d.exec_()
|
||||||
|
if geomKey and ret:
|
||||||
|
saveGeom(d, geomKey)
|
||||||
return (str(d.l.text()), ret)
|
return (str(d.l.text()), ret)
|
||||||
|
|
||||||
def getOnlyText(*args, **kwargs):
|
def getOnlyText(*args, **kwargs):
|
||||||
@ -224,7 +229,8 @@ def getTag(parent, deck, question, tags="user", **kwargs):
|
|||||||
from aqt.tagedit import TagEdit
|
from aqt.tagedit import TagEdit
|
||||||
te = TagEdit(parent)
|
te = TagEdit(parent)
|
||||||
te.setCol(deck)
|
te.setCol(deck)
|
||||||
ret = getText(question, parent, edit=te, **kwargs)
|
ret = getText(question, parent, edit=te,
|
||||||
|
geomKey='getTag', **kwargs)
|
||||||
te.hideCompleter()
|
te.hideCompleter()
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user