How to use the aqt.mw.app.processEvents function in aqt

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 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()
github finalion / WordQuery / wquery / service / mdxservice.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()
github megachweng / Dict2Anki / Dict2Anki / window.py View on Github external
def __getCurrentWordList(self):
        if self.dictThread:
            self.dictThread.terminate()

        if self.dictionary.currentIndex():
            self.dictThread = Youdao()
        else:
            self.dictThread = Eudict()


        self.connect(self.dictThread,QtCore.SIGNAL('updateProgressBar_dict(int,int)'),self.updateProgressBar)

        self.dictThread.start()

        while not self.dictThread.isFinished():
            mw.app.processEvents()
            self.dictThread.wait(1)
        results = self.dictThread.results
        self.dictThread = None
        return results
github nigelkerr / wanikani2anki / wanikani.py View on Github external
tmpl = mm.newTemplate("WaniKanii Vocab (flipped)")
                 tmpl['qfmt'] = "<span style="\&quot;font-size:30px;\&quot;">{{Meaning}}</span>"
                 tmpl['afmt'] = "{{FrontSide}}\n\n<hr id="answer">\n\n"\
                     "<span style="\&quot;font-size:25px;\&quot;">{{Reading}}</span>"\
                     "<br><span style="\&quot;font-size:40px;\&quot;">"\
                     "{{Expression}}</span>"+tangorin
                 mm.addTemplate(wk_model, tmpl)
             mm.add(wk_model)
         mm.setCurrent(wk_model)
         wk_model['did'] = mw.col.decks.id(VOCAB_DECK)
         mm.save(wk_model)
         wki = VocabImporter(mw.col,vocabJson)
         wki.initMapping()
         wki.run()

    mw.app.processEvents()
    showInfo('Decks updated!')
    mw.deckBrowser.show()
github megachweng / Dict2Anki / Dict2Anki / note.py View on Github external
note['phrase' + str(index)] = phrase
                        note['phrase_explain' + str(index)] = term['phrases_explains'][index]
                        note['pplaceHolder' + str(index)] = "Tap To View"

                if term['sentences']:
                    for index, sentence in enumerate(term['sentences']):
                        note['sentence' + str(index)] = sentence
                        note['sentence_explain' + str(index)] = term['sentences_explains'][index]
                        note['splaceHolder' + str(index)] = "Tap To View"

                if term['image']:
                    if self.syncSettings['saveImage']:
                        note['image'] = """<div><img src="MG-{}.jpg"></div>""".format(term['term'])
                    else:
                        note['image'] = "<img src="{}">".format(term['image'])
                    mw.app.processEvents()
                mw.col.addNote(note)
            mw.col.reset()
            mw.reset()

        # start deleting notes

        if self.deleted:
            for term in self.deleted:
                cardID = mw.col.findCards("term:" + term )
                deckID = mw.col.decks.id(deckName)
                for cid in cardID:
                    nid = mw.col.db.scalar("select nid from cards where id = ? and did = ?", cid, deckID)
                    if nid is not None:
                        mw.col.db.execute("delete from cards where id =?", cid)
                        mw.col.db.execute("delete from notes where id =?", nid)
            mw.col.fixIntegrity()
github sth2018 / FastWordQuery / addons21 / fastwq / query / worker.py View on Github external
def update_progress(self):
        self.progress.update_labels(MapDict(
            type='count',
            words_number=self.counter,
            skips_number=self.skips,
            fails_number=self.fails,
            fields_number=self.fields
        ))
        mw.app.processEvents()