How to use aqt - 10 common examples

To help you get started, we’ve selected a few aqt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github luoliyan / incremental-reading / ir / util.py View on Github external
def addMenu(fullPath):
    if not hasattr(mw, 'customMenus'):
        mw.customMenus = {}

    if len(fullPath.split('::')) == 2:
        menuPath, submenuPath = fullPath.split('::')
        hasSubmenu = True
    else:
        menuPath = fullPath
        hasSubmenu = False

    if menuPath not in mw.customMenus:
        menu = QMenu('&' + menuPath, mw)
        mw.customMenus[menuPath] = menu
        mw.form.menubar.insertMenu(mw.form.menuTools.menuAction(), menu)

    if hasSubmenu and (fullPath not in mw.customMenus):
        submenu = QMenu('&' + submenuPath, mw)
        mw.customMenus[fullPath] = submenu
        mw.customMenus[menuPath].addMenu(submenu)
github luoliyan / incremental-reading / ir / gui.py View on Github external
self.noteTypeComboBox.addItem('')
        self.noteTypeComboBox.addItems(modelNames)
        self.noteTypeComboBox.currentIndexChanged.connect(
            self._updateFieldLists
        )

        newButton = QPushButton('New')
        newButton.clicked.connect(self._clearQuickKeysTab)
        setButton = QPushButton('Set')
        setButton.clicked.connect(self._setQuickKey)
        unsetButton = QPushButton('Unset')
        unsetButton.clicked.connect(self._unsetQuickKey)

        tagsLabel = QLabel('Tags')
        self.tagsEditBox = TagEdit(mw)
        self.tagsEditBox.setCol(mw.col)
        tagsLayout = QHBoxLayout()
        tagsLayout.addWidget(tagsLabel)
        tagsLayout.addWidget(self.tagsEditBox)

        buttonLayout = QHBoxLayout()
        buttonLayout.addStretch()
        buttonLayout.addWidget(newButton)
        buttonLayout.addWidget(setButton)
        buttonLayout.addWidget(unsetButton)

        layout = QVBoxLayout()
        layout.addWidget(self.quickKeysComboBox)
        layout.addLayout(destDeckLayout)
        layout.addLayout(noteTypeLayout)
        layout.addLayout(textFieldLayout)
        layout.addLayout(sourceFieldLayout)
github megachweng / Anki-Youdao / Youdao-Anki.py View on Github external
def clickSync(self, sig=None):
        if sig is None:
            self.Option = "syncFromWordBook"
        else:
            self.Option = sig
        settings = self.getSettingsFromUI(self)
        self.settings = settings
        if settings[0] == '' or settings[1] == '':
            self.tabWidget.setCurrentIndex(1)
            showInfo('\n\nPlease enter your Username and Password!')
        elif settings[2] == '':
            showInfo('\n\nPlease enter Deckname!')
        elif askUser('Sync Now?'):
            # [0username, 1password, 2deckname, 3uk, 4us, 5phrase, 6phraseExplain]
            self.saveSettings(settings[0], settings[1], settings[2], settings[3], settings[4], settings[5], settings[6])

            self.tabWidget.setEnabled(False)
            self.sync.setText("Wait")

            # stop the previous thread first
            if self.thread is not None:
                self.thread.terminate()
            # download the data!
            self.thread = YoudaoDownloader(self)
            self.thread.start()
            while not self.thread.isFinished():
                mw.app.processEvents()
                self.thread.wait(50)
github brumar / anknotes / anknotes / settings.py View on Github external
update_evernote_query_notebook)

    # Evernote Query: Use Notebook
    evernote_query_use_notebook = QCheckBox(" ", self)
    evernote_query_use_notebook.setChecked(mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_NOTEBOOK, False))
    evernote_query_use_notebook.stateChanged.connect(update_evernote_query_use_notebook)

    # Add Form Row for Notebook
    hbox = QHBoxLayout()
    hbox.addWidget(evernote_query_use_notebook)
    hbox.addWidget(evernote_query_notebook)
    form.addRow("Notebook:", hbox)

    # Evernote Query: Note Title
    evernote_query_note_title = QLineEdit()
    evernote_query_note_title.setText(mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_NOTE_TITLE, ""))
    evernote_query_note_title.connect(evernote_query_note_title,
                                      SIGNAL("textEdited(QString)"),
                                      update_evernote_query_note_title)

    # Evernote Query: Use Note Title
    evernote_query_use_note_title = QCheckBox(" ", self)
    evernote_query_use_note_title.setChecked(mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_NOTE_TITLE, False))
    evernote_query_use_note_title.stateChanged.connect(update_evernote_query_use_note_title)

    # Add Form Row for Note Title
    hbox = QHBoxLayout()
    hbox.addWidget(evernote_query_use_note_title)
    hbox.addWidget(evernote_query_note_title)
    form.addRow("Note Title:", hbox)

    # Evernote Query: Last Updated Type
github brumar / anknotes / anknotes / settings.py View on Github external
def generate_evernote_query():
    query = ""
    tags = mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_TAGS, SETTINGS.EVERNOTE_QUERY_TAGS_DEFAULT_VALUE).split(",")
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_NOTEBOOK, False):
        query += 'notebook:"%s" ' % mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_NOTEBOOK,
                                                    SETTINGS.EVERNOTE_QUERY_NOTEBOOK_DEFAULT_VALUE).strip()
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_ANY, True):
        query += "any: "
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_NOTE_TITLE, False):
        query_note_title = mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_NOTE_TITLE, "")
        if not query_note_title[:1] + query_note_title[-1:] == '""':
            query_note_title = '"%s"' % query_note_title
        query += 'intitle:%s ' % query_note_title
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_TAGS, True):
        for tag in tags:
            query += "tag:%s " % tag.strip()
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_LAST_UPDATED, False):
        query += " updated:%s " % evernote_query_last_updated_value_get_current_value()
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_SEARCH_TERMS, False):
github brumar / anknotes / anknotes / settings.py View on Github external
query = ""
    tags = mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_TAGS, SETTINGS.EVERNOTE_QUERY_TAGS_DEFAULT_VALUE).split(",")
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_NOTEBOOK, False):
        query += 'notebook:"%s" ' % mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_NOTEBOOK,
                                                    SETTINGS.EVERNOTE_QUERY_NOTEBOOK_DEFAULT_VALUE).strip()
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_ANY, True):
        query += "any: "
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_NOTE_TITLE, False):
        query_note_title = mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_NOTE_TITLE, "")
        if not query_note_title[:1] + query_note_title[-1:] == '""':
            query_note_title = '"%s"' % query_note_title
        query += 'intitle:%s ' % query_note_title
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_TAGS, True):
        for tag in tags:
            query += "tag:%s " % tag.strip()
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_LAST_UPDATED, False):
        query += " updated:%s " % evernote_query_last_updated_value_get_current_value()
    if mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_USE_SEARCH_TERMS, False):
        query += mw.col.conf.get(SETTINGS.EVERNOTE_QUERY_SEARCH_TERMS, "")
    return query
github rolph-recto / Anki-Quizlet / anki-quizlet.py View on Github external
search_url += "&creator={0}".format(self.user)
        search_url += "&page={0}".format(page)
        search_url += "&per_page={0}".format(QuizletWindow.RESULTS_PER_PAGE)
        search_url += "&sort={0}".format(self.sort)
        search_url += "&client_id={0}".format(QuizletWindow.__APIKEY)

        #stop the previous thread first
        if not self.thread == None:
            self.thread.terminate()

        #download the data!
        self.thread = QuizletDownloader(self, search_url)
        self.thread.start()

        while not self.thread.isFinished():
            mw.app.processEvents()
            self.thread.wait(50)

        self.results = self.thread.results

        #error with fetching data; don't display table
        if self.thread.error:
            self.setPage(QuizletWindow.RESULT_ERROR)
        #everything went through!
        else:
            self.setPage(page)
            self.loadResultsToTable()
            self.showTable()

        self.thread.terminate()
        self.thread = None
github sth2018 / FastWordQuery / addons / fastwq / service / base.py View on Github external
def _get_builer(key, func=None):
        LocalService._mutex_builder.lock()
        key = md5(key).hexdigest()
        if not func is None:
            if not LocalService._mdx_builders.has_key(key) or not LocalService._mdx_builders[key]:
                worker = _DictBuildWorker(func)
                worker.start()
                while not worker.isFinished():
                    mw.app.processEvents()
                    worker.wait(100)
                LocalService._mdx_builders[key] = worker.builder
        LocalService._mutex_builder.unlock()
        return LocalService._mdx_builders[key]
github megachweng / Anki-Youdao / Youdao-Anki.py View on Github external
showInfo('\n\nPlease enter Deckname!')
        elif askUser('Sync Now?'):
            # [0username, 1password, 2deckname, 3uk, 4us, 5phrase, 6phraseExplain]
            self.saveSettings(settings[0], settings[1], settings[2], settings[3], settings[4], settings[5], settings[6])

            self.tabWidget.setEnabled(False)
            self.sync.setText("Wait")

            # stop the previous thread first
            if self.thread is not None:
                self.thread.terminate()
            # download the data!
            self.thread = YoudaoDownloader(self)
            self.thread.start()
            while not self.thread.isFinished():
                mw.app.processEvents()
                self.thread.wait(50)

            # error with fetching data
            if self.thread.error is 1:
                showInfo("authenticate failed!")
            elif self.thread.error is 2:
                showInfo("Can not fetch data!")
            else:
                result = json.loads(self.thread.results)
                self.debug.appendPlainText('414: Loaded downloader results')
                # save data to Anki Card
                self.syncYoudao(result, settings[2])
                self.setupHistoryList()
            self.thread.terminate()
            self.thread = None
            self.sync.setText('Sync')
github finalion / WordQuery / wquery / service / localservice.py View on Github external
def index_all(self):
        mw.progress.start(immediate=True, label="Index building...")
        index_thread = self.MdxIndexer(self, self._dict_paths)
        index_thread.start()
        while not index_thread.isFinished():
            mw.app.processEvents()
            index_thread.wait(100)
        mw.progress.finish()