Skip to content

Commit f6d05e6

Browse files
committed
Update to the new fill-outline behaviour
Update to pcb2gcode 9e9fe6f: * Select the correct outline image filename when vectorial is enabled * Disable the outline-width doubleSpinBox when both fill-outline and vectorial are enabled * Fix pcb2gcode image error
1 parent 2dec8ff commit f6d05e6

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

mainwindow.cpp

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ MainWindow::MainWindow(QWidget *parent) :
4444
scene(this),
4545
loadingIcon(":/images/loading.gif"),
4646
imagesFolder(QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
47-
"/pcb2gcode-" + QString::number(QCoreApplication::applicationPid()))
47+
"/pcb2gcode-" + QString::number(QCoreApplication::applicationPid())),
48+
restarted(false)
4849
{
4950
checkPcb2gcodeVersion();
5051

@@ -153,7 +154,7 @@ MainWindow::MainWindow(QWidget *parent) :
153154
connect(ui->vectorialCheckBox, SIGNAL(toggled(bool)), this, SLOT(bridgesAvailable()));
154155
connect(ui->vectorialCheckBox, SIGNAL(toggled(bool)), ui->voronoiCheckBox, SLOT(setEnabled(bool)));
155156
connect(ui->voronoiCheckBox, SIGNAL(toggled(bool)), this, SLOT(voronoiEnable(bool)));
156-
connect(ui->filloutlineCheckBox, SIGNAL(toggled(bool)), ui->outlinewidthDoubleSpinBox, SLOT(setEnabled(bool)));
157+
connect(ui->filloutlineCheckBox, SIGNAL(toggled(bool)), this, SLOT(fillOutlineEnable(bool)));
157158
connect(ui->optimiseCheckBox, SIGNAL(toggled(bool)), this, SLOT(bridgesAvailable()));
158159
connect(ui->milldrillCheckBox, SIGNAL(toggled(bool)), ui->milldrilldiameterDoubleSpinBox, SLOT(setEnabled(bool)));
159160
connect(ui->softwareComboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(updateAlCustomEnableState(QString)));
@@ -245,9 +246,16 @@ void MainWindow::vectorialEnable(bool enable)
245246
{
246247
if (ui->voronoiCheckBox->isChecked())
247248
ui->extrapassesSpinBox->setEnabled(false);
249+
250+
ui->outlinewidthDoubleSpinBox->setEnabled(false);
248251
}
249252
else
253+
{
254+
if (ui->filloutlineCheckBox->isChecked())
255+
ui->outlinewidthDoubleSpinBox->setEnabled(true);
256+
250257
ui->extrapassesSpinBox->setEnabled(true);
258+
}
251259
}
252260

253261
void MainWindow::voronoiEnable(bool enable)
@@ -256,6 +264,12 @@ void MainWindow::voronoiEnable(bool enable)
256264
ui->offsetDoubleSpinBox->setEnabled(!enable);
257265
}
258266

267+
void MainWindow::fillOutlineEnable(bool enable)
268+
{
269+
if (!ui->vectorialCheckBox->isChecked())
270+
ui->outlinewidthDoubleSpinBox->setEnabled(enable);
271+
}
272+
259273
void MainWindow::bridgesAvailable()
260274
{
261275
bool bridgesEnabled = ui->vectorialCheckBox->isChecked() || ui->optimiseCheckBox->isChecked();
@@ -318,9 +332,6 @@ void MainWindow::generateImages()
318332
QStringList arguments;
319333
bool found_output_dir = false;
320334

321-
loadingIcon.start();
322-
ui->loadingLabel->show();
323-
324335
arguments += getCmdLineArguments();
325336

326337
for (QStringList::iterator i = arguments.begin(); i != arguments.end(); i++)
@@ -339,7 +350,14 @@ void MainWindow::generateImages()
339350
arguments << "--no-export" << "--noconfigfile";
340351

341352
if (pcb2gcodeImageProcess.state() != QProcess::NotRunning)
353+
{
354+
restarted = true;
342355
pcb2gcodeImageProcess.kill();
356+
pcb2gcodeImageProcess.waitForFinished(1000);
357+
}
358+
359+
loadingIcon.start();
360+
ui->loadingLabel->show();
343361

344362
currentImagesFolder = imagesFolder;
345363
vectorial = ui->vectorialCheckBox->isChecked();
@@ -389,9 +407,10 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
389407
addImageFile(dir, tr("Input front"), "original_front");
390408
addImageFile(dir, tr("Input back"), "original_back");
391409
addImageFile(dir, tr("Input drill"), "original_drill");
392-
addImageFile(dir, tr("Input outline"), fillOutline ? "outline_filled" : "original_outline");
410+
addImageFile(dir, tr("Input outline"), (fillOutline && !vectorial) ? "outline_filled" : "original_outline");
411+
addImageFile(dir, tr("Input outline"), "original_outline");
393412
}
394-
else if (sender() != static_cast<QObject *>(&pcb2gcodeProcess)) //Errors from pcb2gcodeProcess are printed in outputWindow
413+
else if (sender() != static_cast<QObject *>(&pcb2gcodeProcess) && !restarted) //Errors from pcb2gcodeProcess are printed in outputWindow
395414
{
396415
QMessageBox::critical(this, "Error",
397416
tr("Error while processing input files (error code ") +
@@ -408,6 +427,8 @@ void MainWindow::imagesGenerated(int exitCode, QProcess::ExitStatus exitStatus)
408427
}
409428
else
410429
ui->imageComboBox->setEnabled(false);
430+
431+
restarted = false;
411432
}
412433

413434
void MainWindow::imageSelected(int index)
@@ -565,7 +586,11 @@ void MainWindow::startPcb2gcode()
565586
QStringList arguments;
566587

567588
if (pcb2gcodeImageProcess.state() != QProcess::NotRunning)
589+
{
590+
restarted = true;
568591
pcb2gcodeImageProcess.kill();
592+
pcb2gcodeImageProcess.waitForFinished(1000);
593+
}
569594

570595
if( ui->outputDirLineEdit->text().isEmpty() )
571596
getOutputDirectory();

mainwindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class MainWindow : public QMainWindow
5454
private slots:
5555
void vectorialEnable(bool enable);
5656
void voronoiEnable(bool disable);
57+
void fillOutlineEnable(bool enable);
5758
void bridgesAvailable();
5859
void changeMetricInputUnits(bool metric);
5960
void startPcb2gcode();
@@ -117,6 +118,7 @@ private slots:
117118
QString currentImagesFolder;
118119
bool vectorial;
119120
bool fillOutline;
121+
bool restarted;
120122

121123
argAction args[6];
122124

mainwindow.ui

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,9 @@
16291629
</item>
16301630
<item row="10" column="1">
16311631
<widget class="QDoubleSpinBox" name="outlinewidthDoubleSpinBox">
1632+
<property name="enabled">
1633+
<bool>false</bool>
1634+
</property>
16321635
<property name="toolTip">
16331636
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;--outline-width&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Thickness of the lines that form the outline (if fill-outline is given)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
16341637
</property>

0 commit comments

Comments
 (0)