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


Python ExecutableInfo.valid方法代码示例

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


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

示例1: setExecutablePath

# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import valid [as 别名]
    def setExecutablePath(self, app_path):
        """
        The user select a new executable path.
        Input:
            app_path: The path of the executable.
        """
        if not app_path:
            return

        self._loading_dialog.setInformativeText(app_path)
        self._loading_dialog.show()
        self._loading_dialog.raise_()
        QApplication.processEvents()

        app_info = ExecutableInfo()
        app_info.setPath(app_path, self.test_checkbox.isChecked())

        QApplication.processEvents()

        if app_info.valid():
            self.exe_line.setText(app_path)
            self.executableInfoChanged.emit(app_info)
            self.executableChanged.emit(app_path)
            files = self._exe_watcher.files()
            if files:
                self._exe_watcher.removePaths(files)
            self._exe_watcher.addPath(app_path)
        self._updateRecentExe(app_path, not app_info.valid())
        self._loading_dialog.hide()
开发者ID:aeslaughter,项目名称:moose,代码行数:31,代码来源:ExecuteOptionsPlugin.py

示例2: testIncompatible

# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import valid [as 别名]
    def testIncompatible(self):
        t = InputTree(ExecutableInfo())
        app_info = ExecutableInfo()
        # The original tree wasn't set, any new changes
        # are not incompatible
        self.assertFalse(t.incompatibleChanges(app_info))
        app_info.json_data = {"bad_block": None}
        self.assertFalse(t.incompatibleChanges(app_info))

        # Current tree is good, new one is not
        app_info.json_data = None
        t = self.createTree(input_file=self.simple_diffusion)
        self.assertTrue(t.incompatibleChanges(app_info))
        app_info.json_data = {"bad_block": None}
        self.assertFalse(app_info.valid())
        self.assertTrue(t.incompatibleChanges(app_info))
        app_info.path ="foo"
        self.assertTrue(app_info.valid())
        self.assertTrue(t.incompatibleChanges(app_info)) # No / which causes an exception
        app_info.path_map = t.app_info.path_map.copy()
        self.assertFalse(t.incompatibleChanges(app_info)) # Should be the same, no problems

        # Simulate removing /BCs/*/<types>/DirichletBC/boundary
        # This should be fine since users can have extra parameters
        # in their input file
        root = app_info.path_map["/"]
        bcs = root.children["BCs"]
        pname = "boundary"
        tmp = bcs.star_node.types["DirichletBC"]
        p = tmp.parameters[pname]
        p.user_added = True
        tmp.removeUserParam(pname)
        p = bcs.star_node.parameters[pname]
        p.user_added = True
        bcs.star_node.removeUserParam(pname)
        tmp_tree = InputTree(app_info)

        tmp_tree.setInputFileData(t.getInputFileString())
        left = tmp_tree.getBlockInfo("/BCs/left")
        self.assertTrue(left.user_added)
        boundary = left.parameters["boundary"]
        self.assertTrue(boundary.user_added)
        self.assertTrue(boundary.set_in_input_file)
        self.assertFalse(t.incompatibleChanges(app_info))

        # Simulate removing /BCs syntax
        # This should cause a problem
        del app_info.path_map["/BCs"]
        root.children_list.remove("BCs")
        del root.children["BCs"]
        self.assertTrue(t.incompatibleChanges(app_info)) # Errors when reading the input file
开发者ID:zachmprince,项目名称:moose,代码行数:53,代码来源:test_InputTree.py

示例3: newWidget

# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import valid [as 别名]
 def newWidget(self):
     app_info = ExecutableInfo()
     app_info.setPath(Testing.find_moose_test_exe())
     self.assertTrue(app_info.valid())
     w = InputFileEditor()
     w.executableInfoChanged(app_info)
     w.setInputFile(self.test_input_file)
     return w
开发者ID:aeslaughter,项目名称:moose,代码行数:10,代码来源:test_InputFileEditor.py

示例4: newWidget

# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import valid [as 别名]
 def newWidget(self):
     main_win = QMainWindow()
     w = InputFileEditorWithMesh(size=[640,640])
     main_win.setCentralWidget(w)
     app_info = ExecutableInfo()
     app_info.setPath(Testing.find_moose_test_exe())
     self.assertTrue(app_info.valid())
     w.onExecutableInfoChanged(app_info)
     menubar = main_win.menuBar()
     menubar.setNativeMenuBar(False)
     w.addToMainMenu(menubar)
     w.setEnabled(True)
     main_win.show()
     w.numTimeStepsChanged.connect(self.timeStepChanged)
     return main_win, w
开发者ID:,项目名称:,代码行数:17,代码来源:

示例5: testInfo

# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import valid [as 别名]
    def testInfo(self):
        e = ExecutableInfo()
        e.clearCache()
        e.setPath("")
        self.assertFalse(e.valid())
        e.setPath("no_exist")
        self.assertFalse(e.valid())

        exe_path = Testing.find_moose_test_exe()
        e.setPath(exe_path)
        self.assertTrue(e.valid())

        e.setPath(exe_path)
        self.assertTrue(e.valid())

        e.setPath("")
        self.assertTrue(e.valid())

        e.setPath("no_exist")
        self.assertFalse(e.valid())

        # this should hit the cache
        e.setPath(exe_path)
        self.assertTrue(e.valid())
开发者ID:,项目名称:,代码行数:26,代码来源:

示例6: create_tree

# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import valid [as 别名]
 def create_tree(self):
     app_info = ExecutableInfo()
     app_info.setPath(Testing.find_moose_test_exe())
     self.assertTrue(app_info.valid())
     input_tree = InputTree(app_info)
     return input_tree
开发者ID:zachmprince,项目名称:moose,代码行数:8,代码来源:test_TimeStepEstimate.py

示例7: Tests

# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import valid [as 别名]
class Tests(Testing.PeacockTester):
    qapp = QApplication([])

    def setUp(self):
        super(Tests, self).setUp()
        self.test_input_file = "../../common/fsp_test.i"
        self.app_info = ExecutableInfo()
        self.app_info.setPath(Testing.find_moose_test_exe())
        self.tree = InputTree(self.app_info)
        self.tree.setInputFile(self.test_input_file)
        self.assertTrue(self.app_info.valid())
        self.block_list_requested = 0
        self.block_removed_count = 0
        self.last_block_removed = 0
        self.block_cloned_count = 0
        self.last_block_cloned = 0
        self.editing_finished = False
        self.block_changed_count = 0
        self.last_block_changed = 0

    def newWidget(self, path):
        b = self.tree.getBlockInfo(path)
        e = BlockEditor(b, self.tree.app_info.type_to_block_map)
        e.needBlockList.connect(lambda paths: self.needBlockList(e, paths))
        e.removeBlock.connect(self.removeBlock)
        e.cloneBlock.connect(self.cloneBlock)
        e.blockChanged.connect(self.blockChanged)
        e.editingFinished.connect(self.editingFinished)
        self.editing_finished = False
        return e

    def blockChanged(self, block):
        self.block_changed_count += 1
        self.last_block_changed = block

    def editingFinished(self):
        self.editing_finished = True

    def removeBlock(self, block):
        self.block_removed_count += 1
        self.last_block_removed = block

    def cloneBlock(self, block):
        self.block_cloned_count += 1
        self.last_block_cloned = block

    def needBlockList(self, e, blocks):
        self.block_list_requested += 1
        for b in blocks:
            e.setWatchedBlockList(b, ["child0", "child1", "child2"])

    def newCounter(self, node):
        self.new_node = node
        self.new_node_counter += 1

    def checkParamEditor(self, e, has_params, has_types):
        if has_types:
            self.assertTrue(isinstance(e.param_editor, ParamsByType))
        elif has_params:
            self.assertTrue(isinstance(e.param_editor, ParamsByGroup))
        else:
            self.assertTrue(isinstance(e.param_editor, ParamsTable))

    def checkButton(self, button, exists, enabled):
        if button is None:
            self.assertTrue(button is None and not exists)
        else:
            self.assertTrue(button is not None and exists)
        if button:
            self.assertEqual(button.isEnabled(), enabled)

    def checkWidget(self,
            e,
            apply_button=True,
            apply_enabled=False,
            user_block=False,
            reset_button=True,
            reset_enabled=False,
            new_param_button=True,
            new_param_enabled=True,
            has_params=False,
            has_types=False,
            comments=""
            ):
        self.checkParamEditor(e, has_params, has_types)
        self.checkButton(e.clone_button, user_block, True)
        self.checkButton(e.apply_button, apply_button, apply_enabled)
        self.checkButton(e.remove_button, user_block, True)
        self.checkButton(e.reset_button, reset_button, reset_enabled)
        self.checkButton(e.new_parameter_button, new_param_button, new_param_enabled)
        self.assertEqual(e.comment_edit.getComments(), comments)

    def testBlockComments(self):
        b = BlockInfo(None, "/Foo", True, "")
        c = "some comments"
        e = BlockEditor(b, self.tree.app_info.type_to_block_map)
        self.checkWidget(e)
        self.assertEqual(b.comments, "")
        e.comment_edit.setComments(c)
        self.checkWidget(e, apply_enabled=True, reset_enabled=True, comments=c)
#.........这里部分代码省略.........
开发者ID:zachmprince,项目名称:moose,代码行数:103,代码来源:test_BlockEditor.py


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