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


Python mw.state方法代码示例

本文整理汇总了Python中aqt.mw.state方法的典型用法代码示例。如果您正苦于以下问题:Python mw.state方法的具体用法?Python mw.state怎么用?Python mw.state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aqt.mw的用法示例。


在下文中一共展示了mw.state方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: refresh

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def refresh(self, reload=False):
        """
        Refresh display by re-enabling night or normal mode,
        regenerate customizable css strings.
        """
        state = self.config.state_on.value

        if not self.profile_loaded:
            alert(ERROR_NO_PROFILE)
            return

        try:
            if state:
                if reload:
                    self.off()
                self.on()
            else:
                self.off()
        except Exception:
            alert(ERROR_SWITCH % traceback.format_exc())
            return

        # Reload current screen.
        if mw.state == 'review':
            mw.moveToState('overview')
            mw.moveToState('review')
        if mw.state == 'deckBrowser':
            mw.deckBrowser.refresh()
        if mw.state == 'overview':
            mw.overview.refresh()

        # Redraw toolbar (should be always visible).
        mw.toolbar.draw()
        self.update_menu()
        return True 
开发者ID:krassowski,项目名称:Anki-Night-Mode,代码行数:37,代码来源:night_mode.py

示例2: getCollapse

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def getCollapse(self):
        # We reload the deck. The collapsed state may have changed.
        self.deck = mw.col.decks.get(self.did)
        prefix = "+" if self.deck['collapsed'] else "-"
        # deck link
        if self.children:
            return collapse_children_html(self.did, self.deck["name"], prefix)
        else:
            return collapse_no_child 
开发者ID:Arthur-Milchior,项目名称:anki-enhance-main-window,代码行数:11,代码来源:node.py

示例3: onRefreshTimer

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def onRefreshTimer():
    if mw.state == "deckBrowser":
        mw.deckBrowser._renderPage()  # was refresh, but we're disabling that 
开发者ID:Arthur-Milchior,项目名称:anki-enhance-main-window,代码行数:5,代码来源:node.py

示例4: viewingIrText

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def viewingIrText():
    return (
        isIrCard(mw.reviewer.card)
        and (mw.reviewer.state == 'question')
        and (mw.state == 'review')
    ) 
开发者ID:luoliyan,项目名称:incremental-reading,代码行数:8,代码来源:util.py

示例5: zoomIn

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def zoomIn(self):
        if viewingIrText():
            cid = str(mw.reviewer.card.id)

            if cid not in self.settings['zoom']:
                self.settings['zoom'][cid] = 1

            self.settings['zoom'][cid] += self.settings['zoomStep']
            mw.web.setZoomFactor(self.settings['zoom'][cid])
        elif mw.state == 'review':
            self.zoomFactor += self.settings['zoomStep']
            mw.web.setZoomFactor(self.zoomFactor)
        else:
            self.settings['generalZoom'] += self.settings['zoomStep']
            mw.web.setZoomFactor(self.settings['generalZoom']) 
开发者ID:luoliyan,项目名称:incremental-reading,代码行数:17,代码来源:view.py

示例6: zoomOut

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def zoomOut(self):
        if viewingIrText():
            cid = str(mw.reviewer.card.id)

            if cid not in self.settings['zoom']:
                self.settings['zoom'][cid] = 1

            self.settings['zoom'][cid] -= self.settings['zoomStep']
            mw.web.setZoomFactor(self.settings['zoom'][cid])
        elif mw.state == 'review':
            self.zoomFactor -= self.settings['zoomStep']
            mw.web.setZoomFactor(self.zoomFactor)
        else:
            self.settings['generalZoom'] -= self.settings['zoomStep']
            mw.web.setZoomFactor(self.settings['generalZoom']) 
开发者ID:luoliyan,项目名称:incremental-reading,代码行数:17,代码来源:view.py

示例7: resetZoom

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def resetZoom(self, state, *args):
        if not hasattr(self, 'settings'):
            return

        if state in ['deckBrowser', 'overview']:
            mw.web.setZoomFactor(self.settings['generalZoom'])
        elif state == 'review' and not isIrCard(mw.reviewer.card):
            self.setZoom(self.zoomFactor) 
开发者ID:luoliyan,项目名称:incremental-reading,代码行数:10,代码来源:view.py

示例8: quickSwitchDeck

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def quickSwitchDeck(drc):
    # get info on current decks
    oldid = mw.col.decks.current()["id"]
    dl = mw.col.sched.deckDueList()
    cnt = mw.col.decks.count()
    # find index of current deck in duelist
    for i, deck in enumerate(dl):
        if deck[1] == oldid:
            idx = i
            break
    i = idx + drc
    newid = oldid
    # iterate through decks and skip based on configuration
    while (i != idx):
        if i == cnt:
            # reached end of list
            i = 0
        did = dl[i][1]
        crds = dl[i][2] + dl[i][3] + dl[i][4]
        i += drc
        if deck_switcher_skip_filtered and mw.col.decks.isDyn(did):
            continue
        if crds > 0 or not deck_switcher_skip_empty:
            newid = did
            break
    # set new did
    mw.col.decks.select(newid)
    # uncollapse parent decks if applicable
    parents = mw.col.decks.parents(newid)
    for parent in parents:
        if parent["collapsed"]:
            mw.col.decks.collapse(parent["id"])
    # refresh view
    if mw.state == "deckBrowser":
        mw.deckBrowser.refresh()
    else:
        mw.onOverview()

# Set up menu entries and hotkeys 
开发者ID:glutanimate,项目名称:anki-addons-misc,代码行数:41,代码来源:overview_deck_switcher.py

示例9: insert_reviewer_more_action

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def insert_reviewer_more_action(self, m):
    #self is Reviewer
    if mw.state != "review":
        return
    a = m.addAction('Browse Creation of This Card')
    a.setShortcut(QKeySequence("c"))
    a.triggered.connect(lambda _, s=mw.reviewer: browse_this_card(s))
    a = m.addAction('Browse Creation of Last Card')
    a.triggered.connect(lambda _, s=mw.reviewer: browse_last_card(s)) 
开发者ID:glutanimate,项目名称:anki-addons-misc,代码行数:11,代码来源:reviewer_browse_creation.py

示例10: searchTerm

# 需要导入模块: from aqt import mw [as 别名]
# 或者: from aqt.mw import state [as 别名]
def searchTerm(self):
    text = selectedText(self)
    if text:
        text = re.sub(r'\[[^\]]+?\]', '', text)
        text = text.strip()
        if not mw.miaDictionary or not mw.miaDictionary.isVisible():
            dictionaryInit(text)
        mw.miaDictionary.ensureVisible()
        mw.miaDictionary.initSearch(text)
        if self.title == 'main webview':
            if mw.state == 'review':
                mw.miaDictionary.dict.setReviewer(mw.reviewer)
        elif self.title == 'editor':
            target = getTarget(type(self.parentEditor.parentWindow).__name__)
            mw.miaDictionary.dict.setCurrentEditor(self.parentEditor, target) 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:17,代码来源:main.py


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