def testFromOptions(self): parser = argparse.ArgumentParser() parser.add_argument('arguments', type=str, metavar="N", nargs="*", ) InputFileEditorWithMesh.commandLineArgs(parser) main_win, w = self.newWidget() opts = {"cmd_line_options": parser.parse_args([])} self.assertEqual(w.vtkwin.isVisible(), False) abs_input_file = os.path.abspath(self.input_file) opts = {"cmd_line_options": parser.parse_args(['-i', self.input_file])} w.initialize(**opts) self.assertEqual(w.vtkwin.isVisible(), True) self.assertEqual(w.InputFileEditorPlugin.tree.input_filename, abs_input_file) w.InputFileEditorPlugin._clearInputFile() self.assertEqual(w.vtkwin.isVisible(), False) self.assertEqual(w.InputFileEditorPlugin.tree.input_filename, None) opts = {"cmd_line_options": parser.parse_args([self.input_file])} w.initialize(**opts) self.assertEqual(w.vtkwin.isVisible(), True) self.assertEqual(w.InputFileEditorPlugin.tree.input_filename, abs_input_file)
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.initialize() w.setEnabled(True) main_win.show() self.assertEqual(w.vtkwin.isVisible(), False) w.numTimeStepsChanged.connect(self.timeStepChanged) return main_win, w
def testFromOptions(self): parser = argparse.ArgumentParser() parser.add_argument('arguments', type=str, metavar="N", nargs="*", ) InputFileEditorWithMesh.commandLineArgs(parser) main_win, w = self.newWidget() abs_input_file = os.path.abspath(self.input_file) w.initialize(parser.parse_args(['-i', self.input_file])) self.assertEqual(w.InputFileEditorPlugin.tree.input_filename, abs_input_file) w.InputFileEditorPlugin._clearInputFile() self.assertEqual(w.InputFileEditorPlugin.tree.input_filename, None) w.initialize(parser.parse_args([self.input_file])) self.assertEqual(w.InputFileEditorPlugin.tree.input_filename, abs_input_file)
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