コード例 #1
0
 def testCreation(self):
     layout = WidgetUtils.addLayout()
     WidgetUtils.addLineEdit(layout, None, self.callback)
     WidgetUtils.addProgressBar(layout, None, callback=self.callback)
     WidgetUtils.addButton(layout, None, "Button", self.callback)
     WidgetUtils.addLabel(layout, None, "Name")
     WidgetUtils.addCheckbox(layout, None, "name", self.callback)
コード例 #2
0
ファイル: test_WidgetUtils.py プロジェクト: FHilty/moose
 def testCreation(self):
     layout = WidgetUtils.addLayout()
     WidgetUtils.addLineEdit(layout, None, self.callback)
     WidgetUtils.addProgressBar(layout, None, callback=self.callback)
     WidgetUtils.addButton(layout, None, "Button", self.callback)
     WidgetUtils.addLabel(layout, None, "Name")
     WidgetUtils.addCheckbox(layout, None, "name", self.callback)
コード例 #3
0
    def __init__(self, **kwds):
        super(ExecuteOptionsPlugin, self).__init__(**kwds)

        self._preferences.addInt("execute/maxRecentWorkingDirs",
                "Max recent working directories",
                10,
                1,
                50,
                "Set the maximum number of recent working directories that have been used.",
                )
        self._preferences.addInt("execute/maxRecentExes",
                "Max recent executables",
                10,
                1,
                50,
                "Set the maximum number of recent executables that have been used.",
                )
        self._preferences.addInt("execute/maxRecentArgs",
                "Max recent command line arguments",
                10,
                1,
                50,
                "Set the maximum number of recent command line arguments that have been used.",
                )
        self._preferences.addBool("execute/mpiEnabled",
                "Enable MPI by default",
                False,
                "Set the MPI checkbox on by default",
                )
        self._preferences.addString("execute/mpiArgs",
                "Default mpi command",
                "mpiexec -n 2",
                "Set the default MPI command to run",
                )
        self._preferences.addBool("execute/threadsEnabled",
                "Enable threads by default",
                False,
                "Set the threads checkbox on by default",
                )
        self._preferences.addString("execute/threadsArgs",
                "Default threads arguments",
                "--n-threads=2",
                "Set the default threads arguments",
                )

        self.all_exe_layout = WidgetUtils.addLayout(grid=True)
        self.setLayout(self.all_exe_layout)

        self.working_label = WidgetUtils.addLabel(None, self, "Working Directory")
        self.all_exe_layout.addWidget(self.working_label, 0, 0)
        self.choose_working_button = WidgetUtils.addButton(None, self, "Choose", self._chooseWorkingDir)
        self.all_exe_layout.addWidget(self.choose_working_button, 0, 1)
        self.working_line = WidgetUtils.addLineEdit(None, self, None, readonly=True)
        self.working_line.setText(os.getcwd())
        self.all_exe_layout.addWidget(self.working_line, 0, 2)

        self.exe_label = WidgetUtils.addLabel(None, self, "Executable")
        self.all_exe_layout.addWidget(self.exe_label, 1, 0)
        self.choose_exe_button = WidgetUtils.addButton(None, self, "Choose", self._chooseExecutable)
        self.all_exe_layout.addWidget(self.choose_exe_button, 1, 1)
        self.exe_line = WidgetUtils.addLineEdit(None, self, None, readonly=True)
        self.all_exe_layout.addWidget(self.exe_line, 1, 2)

        self.args_label = WidgetUtils.addLabel(None, self, "Extra Arguments")
        self.all_exe_layout.addWidget(self.args_label, 2, 0)
        self.args_line = WidgetUtils.addLineEdit(None, self, None)
        self.all_exe_layout.addWidget(self.args_line, 2, 2)

        self.mpi_label = WidgetUtils.addLabel(None, self, "Use MPI")
        self.all_exe_layout.addWidget(self.mpi_label, 3, 0)
        self.mpi_checkbox = WidgetUtils.addCheckbox(None, self, "", None)
        self.mpi_checkbox.setChecked(self._preferences.value("execute/mpiEnabled"))
        self.all_exe_layout.addWidget(self.mpi_checkbox, 3, 1, alignment=Qt.AlignHCenter)
        self.mpi_line = WidgetUtils.addLineEdit(None, self, None)
        self.mpi_line.setText(self._preferences.value("execute/mpiArgs"))
        self.mpi_line.cursorPositionChanged.connect(self._mpiLineCursorChanged)
        self.all_exe_layout.addWidget(self.mpi_line, 3, 2)

        self.threads_label = WidgetUtils.addLabel(None, self, "Use Threads")
        self.all_exe_layout.addWidget(self.threads_label, 4, 0)
        self.threads_checkbox = WidgetUtils.addCheckbox(None, self, "", None)
        self.threads_checkbox.setChecked(self._preferences.value("execute/threadsEnabled"))
        self.all_exe_layout.addWidget(self.threads_checkbox, 4, 1, alignment=Qt.AlignHCenter)
        self.threads_line = WidgetUtils.addLineEdit(None, self, None)
        self.threads_line.setText(self._preferences.value("execute/threadsArgs"))
        self.threads_line.cursorPositionChanged.connect(self._threadsLineCursorChanged)
        self.all_exe_layout.addWidget(self.threads_line, 4, 2)

        self.csv_label = WidgetUtils.addLabel(None, self, "Postprocessor CSV Output")
        self.all_exe_layout.addWidget(self.csv_label, 5, 0)
        self.csv_checkbox = WidgetUtils.addCheckbox(None, self, "", None)
        self.all_exe_layout.addWidget(self.csv_checkbox, 5, 1, alignment=Qt.AlignHCenter)
        self.csv_checkbox.setCheckState(Qt.Checked)

        self.recover_label = WidgetUtils.addLabel(None, self, "Recover")
        self.all_exe_layout.addWidget(self.recover_label, 6, 0)
        self.recover_checkbox = WidgetUtils.addCheckbox(None, self, "", None)
        self.all_exe_layout.addWidget(self.recover_checkbox, 6, 1, alignment=Qt.AlignHCenter)

        self._recent_exe_menu = None
        self._recent_working_menu = None
        self._recent_args_menu = None
        self._exe_watcher = QFileSystemWatcher()
        self._exe_watcher.fileChanged.connect(self.setExecutablePath)

        self._loading_dialog = QMessageBox(parent=self)
        self._loading_dialog.setWindowTitle("Loading executable")
        self._loading_dialog.setStandardButtons(QMessageBox.NoButton) # get rid of the OK button
        self._loading_dialog.setWindowModality(Qt.ApplicationModal)
        self._loading_dialog.setIcon(QMessageBox.Information)
        self._loading_dialog.setText("Loading executable")

        self.setup()
コード例 #4
0
    def __init__(self, **kwds):
        super(ExecuteOptionsPlugin, self).__init__(**kwds)

        self._preferences.addInt("execute/maxRecentWorkingDirs",
                "Max recent working directories",
                10,
                1,
                50,
                "Set the maximum number of recent working directories that have been used.",
                )
        self._preferences.addInt("execute/maxRecentExes",
                "Max recent executables",
                10,
                1,
                50,
                "Set the maximum number of recent executables that have been used.",
                )
        self._preferences.addInt("execute/maxRecentArgs",
                "Max recent command line arguments",
                10,
                1,
                50,
                "Set the maximum number of recent command line arguments that have been used.",
                )
        self._preferences.addBool("execute/allowTestObjects",
                "Allow using test objects",
                False,
                "Allow using test objects by default",
                )
        self._preferences.addBool("execute/mpiEnabled",
                "Enable MPI by default",
                False,
                "Set the MPI checkbox on by default",
                )
        self._preferences.addString("execute/mpiArgs",
                "Default mpi command",
                "mpiexec -n 2",
                "Set the default MPI command to run",
                )
        self._preferences.addBool("execute/threadsEnabled",
                "Enable threads by default",
                False,
                "Set the threads checkbox on by default",
                )
        self._preferences.addString("execute/threadsArgs",
                "Default threads arguments",
                "--n-threads=2",
                "Set the default threads arguments",
                )

        self.all_exe_layout = WidgetUtils.addLayout(grid=True)
        self.setLayout(self.all_exe_layout)

        self.working_label = WidgetUtils.addLabel(None, self, "Working Directory")
        self.all_exe_layout.addWidget(self.working_label, 0, 0)
        self.choose_working_button = WidgetUtils.addButton(None, self, "Choose", self._chooseWorkingDir)
        self.all_exe_layout.addWidget(self.choose_working_button, 0, 1)
        self.working_line = WidgetUtils.addLineEdit(None, self, None, readonly=True)
        self.working_line.setText(os.getcwd())
        self.all_exe_layout.addWidget(self.working_line, 0, 2)

        self.exe_label = WidgetUtils.addLabel(None, self, "Executable")
        self.all_exe_layout.addWidget(self.exe_label, 1, 0)
        self.choose_exe_button = WidgetUtils.addButton(None, self, "Choose", self._chooseExecutable)
        self.all_exe_layout.addWidget(self.choose_exe_button, 1, 1)
        self.exe_line = WidgetUtils.addLineEdit(None, self, None, readonly=True)
        self.all_exe_layout.addWidget(self.exe_line, 1, 2)

        self.args_label = WidgetUtils.addLabel(None, self, "Extra Arguments")
        self.all_exe_layout.addWidget(self.args_label, 2, 0)
        self.args_line = WidgetUtils.addLineEdit(None, self, None)
        self.all_exe_layout.addWidget(self.args_line, 2, 2)

        self.test_label = WidgetUtils.addLabel(None, self, "Allow test objects")
        self.all_exe_layout.addWidget(self.test_label, 3, 0)
        self.test_checkbox = WidgetUtils.addCheckbox(None, self, "", self._allowTestObjects)
        self.test_checkbox.setChecked(self._preferences.value("execute/allowTestObjects"))
        self.all_exe_layout.addWidget(self.test_checkbox, 3, 1, alignment=Qt.AlignHCenter)

        self.mpi_label = WidgetUtils.addLabel(None, self, "Use MPI")
        self.all_exe_layout.addWidget(self.mpi_label, 4, 0)
        self.mpi_checkbox = WidgetUtils.addCheckbox(None, self, "", None)
        self.mpi_checkbox.setChecked(self._preferences.value("execute/mpiEnabled"))
        self.all_exe_layout.addWidget(self.mpi_checkbox, 4, 1, alignment=Qt.AlignHCenter)
        self.mpi_line = WidgetUtils.addLineEdit(None, self, None)
        self.mpi_line.setText(self._preferences.value("execute/mpiArgs"))
        self.mpi_line.cursorPositionChanged.connect(self._mpiLineCursorChanged)
        self.all_exe_layout.addWidget(self.mpi_line, 4, 2)

        self.threads_label = WidgetUtils.addLabel(None, self, "Use Threads")
        self.all_exe_layout.addWidget(self.threads_label, 5, 0)
        self.threads_checkbox = WidgetUtils.addCheckbox(None, self, "", None)
        self.threads_checkbox.setChecked(self._preferences.value("execute/threadsEnabled"))
        self.all_exe_layout.addWidget(self.threads_checkbox, 5, 1, alignment=Qt.AlignHCenter)
        self.threads_line = WidgetUtils.addLineEdit(None, self, None)
        self.threads_line.setText(self._preferences.value("execute/threadsArgs"))
        self.threads_line.cursorPositionChanged.connect(self._threadsLineCursorChanged)
        self.all_exe_layout.addWidget(self.threads_line, 5, 2)

        self.csv_label = WidgetUtils.addLabel(None, self, "Postprocessor CSV Output")
        self.all_exe_layout.addWidget(self.csv_label, 6, 0)
        self.csv_checkbox = WidgetUtils.addCheckbox(None, self, "", None)
        self.all_exe_layout.addWidget(self.csv_checkbox, 6, 1, alignment=Qt.AlignHCenter)
        self.csv_checkbox.setCheckState(Qt.Checked)

        self.recover_label = WidgetUtils.addLabel(None, self, "Recover")
        self.all_exe_layout.addWidget(self.recover_label, 7, 0)
        self.recover_checkbox = WidgetUtils.addCheckbox(None, self, "", None)
        self.all_exe_layout.addWidget(self.recover_checkbox, 7, 1, alignment=Qt.AlignHCenter)

        self._recent_exe_menu = None
        self._recent_working_menu = None
        self._recent_args_menu = None
        self._exe_watcher = QFileSystemWatcher()
        self._exe_watcher.fileChanged.connect(self.setExecutablePath)

        self._loading_dialog = QMessageBox(parent=self)
        self._loading_dialog.setWindowTitle("Loading executable")
        self._loading_dialog.setStandardButtons(QMessageBox.NoButton) # get rid of the OK button
        self._loading_dialog.setWindowModality(Qt.ApplicationModal)
        self._loading_dialog.setIcon(QMessageBox.Information)
        self._loading_dialog.setText("Loading executable")

        self.setup()