本文整理匯總了Python中aqt.utils方法的典型用法代碼示例。如果您正苦於以下問題:Python aqt.utils方法的具體用法?Python aqt.utils怎麽用?Python aqt.utils使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類aqt
的用法示例。
在下文中一共展示了aqt.utils方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import aqt [as 別名]
# 或者: from aqt import utils [as 別名]
def __init__(self, collection, note_id_list, old_model=None, parent=None):
QDialog.__init__(self, parent)
self.collection = collection
self.note_id_list = note_id_list
self.old_model = old_model
if self.old_model is None:
first_note = Note(collection, id=note_id_list[0])
self.old_model = first_note.model()
# todo consider extracting UI file
self.form = aqt.forms.changemodel.Ui_Dialog()
self.form.setupUi(self)
self.setWindowModality(Qt.WindowModal)
self.setup()
self.pauseUpdate = False
self.model_changed(self.collection.models.current())
aqt.utils.restoreGeom(self, "changeModel")
anki.hooks.addHook("reset", self.on_reset)
anki.hooks.addHook("currentModelChanged", self.on_reset)
示例2: accept
# 需要導入模塊: import aqt [as 別名]
# 或者: from aqt import utils [as 別名]
def accept(self):
# check maps
field_map = self.get_field_map()
templates_map = self.get_template_map()
if any(True for template in list(templates_map.values()) if template is None) and \
not aqt.utils.askUser(_(
"Any cards mapped to nothing will be deleted. "
"If a note has no remaining cards, it will be lost. "
"Are you sure you want to continue?")):
return
self.collection.models.change(self.old_model, self.note_id_list, self.targetModel, field_map, templates_map)
self.cleanup()
QDialog.accept(self)
示例3: cleanup
# 需要導入模塊: import aqt [as 別名]
# 或者: from aqt import utils [as 別名]
def cleanup(self):
anki.hooks.remHook("reset", self.on_reset)
anki.hooks.remHook("currentModelChanged", self.on_reset)
self.modelChooser.cleanup()
aqt.utils.saveGeom(self, "changeModel")
示例4: on_help
# 需要導入模塊: import aqt [as 別名]
# 或者: from aqt import utils [as 別名]
def on_help():
aqt.utils.openHelp("browsermisc")
示例5: import_deck_from_path
# 需要導入模塊: import aqt [as 別名]
# 或者: from aqt import utils [as 別名]
def import_deck_from_path(collection, directory_path, import_media=True):
importer = AnkiJsonImporter(collection)
try:
importer.load_from_directory(directory_path, import_media)
aqt.utils.showInfo("Import of {} deck was successful".format(directory_path.name))
except ValueError as error:
aqt.utils.showWarning("Error: {}. While trying to import deck from directory {}".format(
error.args[0], directory_path))
raise