Merge branch 'python'
This commit is contained in:
commit
f802708af4
7 changed files with 174 additions and 1 deletions
|
|
@ -15,7 +15,8 @@ MainWindow::MainWindow(QWidget *parent):
|
|||
codeEditor(this),
|
||||
pythonOutput(this),
|
||||
currentFilePath(""),
|
||||
isFileModified(false)
|
||||
isFileModified(false),
|
||||
pythonRunner(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
enumerateDevices();
|
||||
|
|
@ -49,6 +50,11 @@ MainWindow::MainWindow(QWidget *parent):
|
|||
isFileModified = true;
|
||||
updateStatus();
|
||||
});
|
||||
|
||||
// Connect Run and Stop buttons
|
||||
pythonRunner = new PythonRunner(&pythonOutput, this);
|
||||
connect(ui->pushButtonRun, &QPushButton::clicked, this, &MainWindow::onPushButtonRunClicked);
|
||||
connect(ui->pushButtonStop, &QPushButton::clicked, this, &MainWindow::onPushButtonStopClicked);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
@ -226,6 +232,19 @@ void MainWindow::enumerateDevices()
|
|||
generateExample();
|
||||
}
|
||||
|
||||
void MainWindow::onPushButtonRunClicked() {
|
||||
QString scriptContent = codeEditor.toPlainText();
|
||||
pythonRunner->runScript(scriptContent);
|
||||
ui->pushButtonRun->setEnabled(false);
|
||||
ui->pushButtonStop->setEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::onPushButtonStopClicked() {
|
||||
pythonRunner->stopScript();
|
||||
ui->pushButtonRun->setEnabled(true);
|
||||
ui->pushButtonStop->setEnabled(false);
|
||||
}
|
||||
|
||||
void MainWindow::generateExample()
|
||||
{
|
||||
QString example =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue