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


Python Analyzer.getResultsForFunction方法代码示例

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


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

示例1: MainWindow

# 需要导入模块: from Analyzer import Analyzer [as 别名]
# 或者: from Analyzer.Analyzer import getResultsForFunction [as 别名]

#.........这里部分代码省略.........
            directory = os.path.abspath(os.path.join(str(self.analyzer.resultDirectories[-1]), os.path.pardir))
        directory = QFileDialog.getExistingDirectory(
            self, "Select a directory to scan", directory, QFileDialog.ShowDirsOnly
        )
        if not os.path.exists(directory) or directory in self.analyzer.resultDirectories:
            return

        self.analyzer.addResultDirectory(directory)
        self.addSolutionForSelection(self.analyzer.getResultName(directory))

        settings = QSettings()
        settings.setValue(MainWindow.__PREF_DIR__, QVariant(self.analyzer.resultDirectories))

    def removeResult(self):
        layout = self.solutionSelector.layout()
        for i in xrange(layout.count() - 1, -1, -1):
            item = layout.itemAt(i)
            if not item.widget().isChecked():  # and self.analyzer.resultNames[i] != Analyzer.__PARETO__:
                item.widget().setVisible(False)
                layout.removeItem(item)
                self.analyzer.removeResultDirectory(self.analyzer.resultDirectories[i])
        layout.update()

        settings = QSettings()
        settings.setValue(MainWindow.__PREF_DIR__, QVariant(self.analyzer.resultDirectories))

    def solutionSelected(self):
        selection = self.functionWidget.currentItem()
        if selection is None:
            return
        self.showSolution(str(selection.text()))

    def showSolution(self, functionName):
        self.currentSolution = self.analyzer.getResultsForFunction(functionName)
        self.metrics.clear()
        self._showSolution()

    def addSolutionForSelection(self, name):
        solution = QCheckBox(name)
        solution.setChecked(True)
        solution.stateChanged.connect(self._showSolution)
        self.solutionSelector.layout().addWidget(solution)
        self.solutionSelector.layout().update()

    def _updateSolutionSelection(self):
        self.clearWidget(self.solutionSelector)

        for directory in self.analyzer.resultDirectories:
            self.addSolutionForSelection(self.analyzer.getResultName(directory))

    def _showSolution(self):
        sol = self.currentSolution
        if sol is None:
            return

        if len(sol.variableImplementation) == 0 and self.showVariablesRadio.isEnabled():
            self.showVariablesRadio.setEnabled(False)
            if self.showVariablesRadio.isChecked():
                self.showSolutionsRadio.setChecked(True)
        else:
            self.showVariablesRadio.setEnabled(True)

        if len(sol.functionImplementation) == 0 and self.showSolutionsRadio.isEnabled():
            self.showSolutionsRadio.setEnabled(False)
            if self.showSolutionsRadio.isChecked():
                self.showVariablesRadio.setChecked(True)
开发者ID:wkoder,项目名称:mooi,代码行数:70,代码来源:UI.py


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