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


Python utils.isWin方法代码示例

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


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

示例1: _wrapWithBgColour

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def _wrapWithBgColour(editor, color):
    """
    Wrap the selected text in an appropriate tag with a background color.
    """
    # On Linux, the standard 'hiliteColor' method works. On Windows and OSX
    # the formatting seems to get filtered out

    editor.web.eval("""
        if (!setFormat('hiliteColor', '%s')) {
            setFormat('backcolor', '%s');
        }
        """ % (color, color))

    if isWin or isMac:
        # remove all Apple style classes, which is needed for
        # text highlighting on platforms other than Linux
        editor.web.eval("""
            var matches = document.querySelectorAll(".Apple-style-span");
            for (var i = 0; i < matches.length; i++) {
                matches[i].removeAttribute("class");
            }
        """)


# UI element creation 
开发者ID:glutanimate,项目名称:mini-format-pack,代码行数:27,代码来源:main.py

示例2: loadGroupTable

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def loadGroupTable(self):
        self.dictGroups.setRowCount(0)
        dictGroups = self.getConfig()['DictionaryGroups']
        for groupName in dictGroups:
            rc = self.dictGroups.rowCount()
            self.dictGroups.setRowCount(rc + 1)
            self.dictGroups.setItem(rc, 0, QTableWidgetItem(groupName))
            editButton =  QPushButton("Edit");
            if isWin:
                editButton.setFixedWidth(40)
            else:
                editButton.setFixedWidth(50)
                editButton.setFixedHeight(30)
            editButton.clicked.connect(self.editGroupRow(rc))
            self.dictGroups.setCellWidget(rc, 1, editButton)   
            deleteButton =  QPushButton("X");
            if isWin:
                deleteButton.setFixedWidth(40)
            else:
                deleteButton.setFixedWidth(40)
                deleteButton.setFixedHeight(30)
            deleteButton.clicked.connect(self.removeGroupRow(rc))
            self.dictGroups.setCellWidget(rc, 2, deleteButton) 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:25,代码来源:addonSettings.py

示例3: loadTemplateTable

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def loadTemplateTable(self):
        self.exportTemplates.setRowCount(0)
        exportTemplates = self.getConfig()['ExportTemplates']
        for template in exportTemplates:
            rc = self.exportTemplates.rowCount()
            self.exportTemplates.setRowCount(rc + 1)
            self.exportTemplates.setItem(rc, 0, QTableWidgetItem(template))
            editButton =  QPushButton("Edit");
            if isWin:
                editButton.setFixedWidth(40)
            else:
                editButton.setFixedWidth(50)
                editButton.setFixedHeight(30)
            editButton.clicked.connect(self.editTempRow(rc))
            self.exportTemplates.setCellWidget(rc, 1, editButton)   
            deleteButton =  QPushButton("X");
            if isWin:
                deleteButton.setFixedWidth(40)
            else:
                deleteButton.setFixedWidth(40)
                deleteButton.setFixedHeight(30)
            deleteButton.clicked.connect(self.removeTempRow(rc))
            self.exportTemplates.setCellWidget(rc, 2, deleteButton) 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:25,代码来源:addonSettings.py

示例4: mungeForPlatform

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def mungeForPlatform(popen):
    if isWin:
        popen = [os.path.normpath(x) for x in popen]
        popen[0] += ".exe"
    elif not isMac:
        popen[0] += ".lin"
    return popen 
开发者ID:mass-immersion-approach,项目名称:MIA-Japanese-Add-on,代码行数:9,代码来源:reading.py

示例5: setup

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def setup(self):
        self.mecabCmd = mungeForPlatform(
            [os.path.join(supportDir, "mecab")] + mecabArgs + [
                '-d', supportDir, '-r', os.path.join(supportDir,"mecabrc"), '-b', BUFFER_SIZE ])
        self.mecabCmdAlt = mungeForPlatform([
            os.path.join(supportDir, "mecab"),
            "-r", os.path.join(supportDir, "mecabrc"),
            "-d", supportDir, '-b', BUFFER_SIZE
            ])
        os.environ['DYLD_LIBRARY_PATH'] = supportDir
        os.environ['LD_LIBRARY_PATH'] = supportDir
        if not isWin:
            os.chmod(self.mecabCmd[0], 0o755) 
开发者ID:mass-immersion-approach,项目名称:MIA-Japanese-Add-on,代码行数:15,代码来源:reading.py

示例6: openFileHandler

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def openFileHandler(file):
    try:
        if isWin:
            external_handler = external_handler_win
        else:
            external_handler = external_handler_unix
        subprocess.Popen([external_handler, file])
    except OSError:
        tooltip("External handler produced an error.<br>"
            "Please confirm that it is assigned correctly.") 
开发者ID:glutanimate,项目名称:anki-addons-misc,代码行数:12,代码来源:reviewer_file_hyperlinks.py

示例7: run

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def run(self):
        if isWin:
            self.listener = self.keyboard.Listener(
                on_press =self.on_press, on_release= self.on_release, mia = self.mw, suppress= True)
        else:
            self.listener = self.keyboard.Listener(
                on_press =self.on_press, on_release= self.on_release)
        self.listener.start() 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:10,代码来源:midict.py

示例8: loadNight

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def loadNight(self):
        if not isWin:
            self.setStyleSheet(self.getMacNightStyles())
            self.dictGroups.setStyleSheet(self.getMacNightComboStyle())
            self.sType.setStyleSheet(self.getMacNightComboStyle())
        else:   
            self.setStyleSheet(self.getOtherStyles())
            self.dictGroups.setStyleSheet(self.getComboStyle())
            self.sType.setStyleSheet(self.getComboStyle())
        self.setPalette(self.nightPalette)
        self.setAllIcons()
        if self.dict.addWindow:
            self.dict.addWindow.setColors()
        if self.historyBrowser:
            self.historyBrowser.setColors() 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:17,代码来源:midict.py

示例9: captureKey

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def captureKey(keyList):
    key = keyList[0]
    char = str(key)
    if char not in mw.currentlyPressed:
            mw.currentlyPressed.append(char)
    if isWin:
        if 'Key.ctrl_l' in mw.currentlyPressed and "'c'" in mw.currentlyPressed and'Key.space'  in mw.currentlyPressed:
            mw.hkThread.handleSystemSearch()
            mw.currentlyPressed = []
        elif 'Key.ctrl_l' in mw.currentlyPressed and "'c'" in mw.currentlyPressed and 'Key.alt_l' in mw.currentlyPressed:
            mw.hkThread.handleSentenceExport()
            mw.currentlyPressed = []
        elif 'Key.ctrl_l' in mw.currentlyPressed and 'Key.enter' in mw.currentlyPressed:
            mw.hkThread.attemptAddCard()
            mw.currentlyPressed = []
        elif 'Key.ctrl_l' in mw.currentlyPressed and 'Key.shift' in mw.currentlyPressed and "'v'" in mw.currentlyPressed:
            mw.hkThread.handleImageExport()
            mw.currentlyPressed = []
    elif isLin:
        if 'Key.ctrl' in mw.currentlyPressed and "'c'" in mw.currentlyPressed and'Key.space'  in mw.currentlyPressed:
            mw.hkThread.handleSystemSearch()
            mw.currentlyPressed = []
        elif 'Key.ctrl' in mw.currentlyPressed and "'c'" in mw.currentlyPressed and 'Key.alt' in mw.currentlyPressed:
            mw.hkThread.handleSentenceExport()
            mw.currentlyPressed = []
        elif 'Key.ctrl' in mw.currentlyPressed and 'Key.enter' in mw.currentlyPressed:
            mw.hkThread.attemptAddCard()
            mw.currentlyPressed = []
        elif 'Key.ctrl' in mw.currentlyPressed and 'Key.shift' in mw.currentlyPressed and "'v'" in mw.currentlyPressed:
            mw.hkThread.handleImageExport()
            mw.currentlyPressed = []
    else:
        if ('Key.cmd' in mw.currentlyPressed or 'Key.cmd_r' in mw.currentlyPressed)  and "'c'" in mw.currentlyPressed and "'b'"  in mw.currentlyPressed:
            mw.hkThread.handleSystemSearch()
            mw.currentlyPressed = []
        elif ('Key.cmd' in mw.currentlyPressed or 'Key.cmd_r' in mw.currentlyPressed) and "'c'" in mw.currentlyPressed and 'Key.ctrl' in mw.currentlyPressed:
            mw.hkThread.handleSentenceExport()
            mw.currentlyPressed = []
        elif ('Key.cmd' in mw.currentlyPressed or 'Key.cmd_r' in mw.currentlyPressed) and 'Key.enter' in mw.currentlyPressed:
            mw.hkThread.attemptAddCard()
            mw.currentlyPressed = []
        elif ('Key.cmd' in mw.currentlyPressed or 'Key.cmd_r' in mw.currentlyPressed) and 'Key.shift' in mw.currentlyPressed and "'v'" in mw.currentlyPressed:
            mw.hkThread.handleImageExport()
            mw.currentlyPressed = [] 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:46,代码来源:main.py

示例10: setupView

# 需要导入模块: from anki import utils [as 别名]
# 或者: from anki.utils import isWin [as 别名]
def setupView(self):
        layoutV = QVBoxLayout()
        layoutH = QHBoxLayout()
        layoutH.addWidget(self.dictGroups)
        
        layoutH.addWidget(self.sType)
        
        layoutH.addWidget(self.search)
        layoutH.addWidget(self.searchButton)
        if not isWin:
            self.dictGroups.setFixedSize(108,38)
            self.search.setFixedSize(104, 38)
            self.sType.setFixedSize(92,38)

        else: 
            self.sType.setFixedHeight(38)
            self.dictGroups.setFixedSize(110,38)
            self.search.setFixedSize(114, 38)

        layoutH.setContentsMargins(1,1,0,0)
        layoutH.setSpacing(1)
        self.layoutH2.addWidget(self.openSB)
        
        self.layoutH2.addWidget(self.minusB)
        self.layoutH2.addWidget(self.plusB)
        self.layoutH2.addWidget(self.tabB)
        self.layoutH2.addWidget(self.histB)
        self.layoutH2.addWidget(self.conjToggler)
        self.layoutH2.addWidget(self.nightModeToggler)
        self.layoutH2.addWidget(self.setB)
        targetLabel = QLabel(' Target:')
        targetLabel.setFixedHeight(38)
        self.layoutH2.addWidget(targetLabel)
        self.currentTarget.setFixedHeight(38)
        self.layoutH2.addWidget(self.currentTarget)
        if not self.config['showTarget']:
            self.currentTarget.hide()
            targetLabel.hide()
        self.layoutH2.addStretch()
        self.layoutH2.setContentsMargins(0,1,0,0)
        self.layoutH2.setSpacing(1)
        self.mainHLay.setContentsMargins(0,0,0,0)
        self.mainHLay.addLayout(layoutH) 
        self.mainHLay.addLayout(self.layoutH2) 
        self.mainHLay.addStretch()
        layoutV.addLayout(self.mainHLay) 
        layoutV.addWidget(self.dict)
        layoutV.setContentsMargins(0,0,0,0)
        layoutV.setSpacing(1)
        return layoutV 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:52,代码来源:midict.py


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