当前位置: 首页>>代码示例>>Python>>正文


Python aqt.utils方法代码示例

本文整理汇总了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) 
开发者ID:Stvad,项目名称:CrowdAnki,代码行数:23,代码来源:change_model_dialog.py

示例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) 
开发者ID:Stvad,项目名称:CrowdAnki,代码行数:18,代码来源:change_model_dialog.py

示例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") 
开发者ID:Stvad,项目名称:CrowdAnki,代码行数:7,代码来源:change_model_dialog.py

示例4: on_help

# 需要导入模块: import aqt [as 别名]
# 或者: from aqt import utils [as 别名]
def on_help():
        aqt.utils.openHelp("browsermisc") 
开发者ID:Stvad,项目名称:CrowdAnki,代码行数:4,代码来源:change_model_dialog.py

示例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 
开发者ID:Stvad,项目名称:CrowdAnki,代码行数:11,代码来源:anki_importer.py


注:本文中的aqt.utils方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。