Fix some bugs in script system when using multiple scripts

This commit is contained in:
Collin Kidder
2017-09-03 21:13:12 -04:00
parent 8b3a22ccb0
commit 74cbcded53
3 changed files with 12 additions and 9 deletions
+10 -1
View File
@@ -43,6 +43,9 @@ ScriptingWindow::ScriptingWindow(const QVector<CANFrame> *frames, QWidget *paren
elapsedTime.start();
valuesTimer.start(1000);
ui->tableVariables->insertColumn(0);
ui->tableVariables->insertColumn(1);
}
ScriptingWindow::~ScriptingWindow()
@@ -117,6 +120,13 @@ void ScriptingWindow::showEvent(QShowEvent* event)
void ScriptingWindow::changeCurrentScript()
{
ui->tableVariables->clear();
for (int i = 0; i < ui->tableVariables->rowCount(); i++) ui->tableVariables->removeRow(0);
QStringList labels;
labels.append("Parameter");
labels.append("Value");
ui->tableVariables->setHorizontalHeaderLabels(labels);
int sel = ui->listLoadedScripts->currentRow();
if (sel < 0) return;
@@ -130,7 +140,6 @@ void ScriptingWindow::changeCurrentScript()
currentScript = container;
editor->setPlainText(container->scriptText);
editor->setEnabled(true);
ui->tableVariables->clear();
connect(this, SIGNAL(updateValueTable(QTableWidget*)), currentScript, SLOT(updateValuesTable(QTableWidget*)));
connect(this, SIGNAL(updatedParameter(QString,QString)), currentScript, SLOT(updateParameter(QString,QString)));
}