- added a new parameter in the Tool Film which control the thickness of the stroke width in the resulting SVG. It's a scale parameter.

- whatever was the visibility of the corresponding toolbar when we enter in the Editor, it will be set after exit from the Editor (either Geometry Editor or Excellon Editor).
- added ability to be detached for the tabs in the Notebook section (Project, Selected and Tool)
- added ability for all detachable tabs to be restored to the same position from where they were detached.
- restored the way the tools autoloaded the objects in the comboboxes
This commit is contained in:
Marius Stanciu
2019-02-04 20:49:37 +02:00
committed by Marius S
parent 166fa0470b
commit 713b584841
11 changed files with 129 additions and 50 deletions

View File

@@ -48,6 +48,8 @@ class ToolCutOut(FlatCAMTool):
self.obj_combo = QtWidgets.QComboBox()
self.obj_combo.setModel(self.app.collection)
self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.obj_combo.setCurrentIndex(1)
self.object_label = QtWidgets.QLabel("Object:")
self.object_label.setToolTip(
"Object to be cutout. "
@@ -201,7 +203,6 @@ class ToolCutOut(FlatCAMTool):
def set_tool_ui(self):
self.reset_fields()
self.obj_combo.setCurrentIndex(1)
self.dia.set_value(float(self.app.defaults["tools_cutouttooldia"]))
self.margin.set_value(float(self.app.defaults["tools_cutoutmargin"]))

View File

@@ -29,6 +29,7 @@ class DblSidedTool(FlatCAMTool):
self.gerber_object_combo = QtWidgets.QComboBox()
self.gerber_object_combo.setModel(self.app.collection)
self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.gerber_object_combo.setCurrentIndex(1)
self.botlay_label = QtWidgets.QLabel("<b>GERBER:</b>")
self.botlay_label.setToolTip(
@@ -52,6 +53,7 @@ class DblSidedTool(FlatCAMTool):
self.exc_object_combo = QtWidgets.QComboBox()
self.exc_object_combo.setModel(self.app.collection)
self.exc_object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
self.exc_object_combo.setCurrentIndex(1)
self.excobj_label = QtWidgets.QLabel("<b>EXCELLON:</b>")
self.excobj_label.setToolTip(
@@ -262,9 +264,6 @@ class DblSidedTool(FlatCAMTool):
def set_tool_ui(self):
self.reset_fields()
self.gerber_object_combo.setCurrentIndex(1)
self.exc_object_combo.setCurrentIndex(1)
self.point_entry.set_value("")
self.alignment_holes.set_value("")

View File

@@ -43,6 +43,8 @@ class Film(FlatCAMTool):
self.tf_object_combo = QtWidgets.QComboBox()
self.tf_object_combo.setModel(self.app.collection)
self.tf_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.tf_object_combo.setCurrentIndex(1)
self.tf_object_label = QtWidgets.QLabel("Film Object:")
self.tf_object_label.setToolTip(
"Object for which to create the film."
@@ -74,6 +76,7 @@ class Film(FlatCAMTool):
self.tf_box_combo = QtWidgets.QComboBox()
self.tf_box_combo.setModel(self.app.collection)
self.tf_box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.tf_box_combo.setCurrentIndex(1)
self.tf_box_combo_label = QtWidgets.QLabel("Box Object:")
self.tf_box_combo_label.setToolTip(
@@ -113,6 +116,15 @@ class Film(FlatCAMTool):
)
tf_form_layout.addRow(self.boundary_label, self.boundary_entry)
self.film_scale_entry = FCEntry()
self.film_scale_label = QtWidgets.QLabel("Scale Stroke:")
self.film_scale_label.setToolTip(
"Scale the line stroke thickness of each feature in the SVG file.\n"
"It means that the line that envelope each SVG feature will be thicker or thinner,\n"
"therefore the fine features may be more affected by this parameter."
)
tf_form_layout.addRow(self.film_scale_label, self.film_scale_entry)
# Buttons
hlay = QtWidgets.QHBoxLayout()
self.layout.addLayout(hlay)
@@ -157,19 +169,22 @@ class Film(FlatCAMTool):
def set_tool_ui(self):
self.reset_fields()
self.tf_object_combo.setCurrentIndex(1)
self.tf_box_combo.setCurrentIndex(1)
f_type = self.app.defaults["tools_film_type"] if self.app.defaults["tools_film_type"] else 'neg'
self.film_type.set_value(str(f_type))
b_entry = self.app.defaults[ "tools_film_boundary"] if self.app.defaults[ "tools_film_boundary"] else 0.0
self.boundary_entry.set_value(float(b_entry))
scale_stroke_width = self.app.defaults["tools_film_scale"] if self.app.defaults["tools_film_scale"] else 0.0
self.film_scale_entry.set_value(int(scale_stroke_width))
def on_film_creation(self):
try:
name = self.tf_object_combo.currentText()
except:
self.app.inform.emit("[ERROR_NOTCL] No FlatCAM object selected. Load an object for Film and retry.")
return
try:
boxname = self.tf_box_combo.currentText()
except:
@@ -187,6 +202,13 @@ class Film(FlatCAMTool):
"use a number.")
return
try:
scale_stroke_width = int(self.film_scale_entry.get_value())
except ValueError:
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
if border is None:
border = 0
@@ -207,7 +229,7 @@ class Film(FlatCAMTool):
self.app.inform.emit("[WARNING_NOTCL]Export SVG positive cancelled.")
return
else:
self.app.export_svg_black(name, boxname, filename)
self.app.export_svg_black(name, boxname, filename, scale_factor=scale_stroke_width)
else:
try:
filename, _ = QtWidgets.QFileDialog.getSaveFileName(
@@ -223,7 +245,7 @@ class Film(FlatCAMTool):
self.app.inform.emit("[WARNING_NOTCL]Export SVG negative cancelled.")
return
else:
self.app.export_svg_negative(name, boxname, filename, border)
self.app.export_svg_negative(name, boxname, filename, border, scale_factor=scale_stroke_width)
def reset_fields(self):
self.tf_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))

View File

@@ -34,6 +34,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.object_combo = QtWidgets.QComboBox()
self.object_combo.setModel(self.app.collection)
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.object_combo.setCurrentIndex(1)
self.object_label = QtWidgets.QLabel("Gerber:")
self.object_label.setToolTip(
"Gerber object to be cleared of excess copper. "
@@ -246,8 +248,6 @@ class NonCopperClear(FlatCAMTool, Gerber):
def set_tool_ui(self):
self.tools_frame.show()
self.object_combo.setCurrentIndex(1)
self.ncc_overlap_entry.set_value(self.app.defaults["tools_nccoverlap"])
self.ncc_margin_entry.set_value(self.app.defaults["tools_nccmargin"])
self.ncc_method_radio.set_value(self.app.defaults["tools_nccmethod"])

View File

@@ -32,6 +32,8 @@ class ToolPaint(FlatCAMTool, Gerber):
self.object_combo = QtWidgets.QComboBox()
self.object_combo.setModel(self.app.collection)
self.object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
self.object_combo.setCurrentIndex(1)
self.object_label = QtWidgets.QLabel("Geometry:")
self.object_label.setToolTip(
"Geometry object to be painted. "
@@ -323,7 +325,6 @@ class ToolPaint(FlatCAMTool, Gerber):
def set_tool_ui(self):
self.tools_frame.show()
self.reset_fields()
self.object_combo.setCurrentIndex(1)
## Init the GUI interface
self.paintmargin_entry.set_value(self.default_data["paintmargin"])

View File

@@ -43,6 +43,8 @@ class Panelize(FlatCAMTool):
self.object_combo = QtWidgets.QComboBox()
self.object_combo.setModel(self.app.collection)
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.object_combo.setCurrentIndex(1)
self.object_label = QtWidgets.QLabel("Object:")
self.object_label.setToolTip(
"Object to be panelized. This means that it will\n"
@@ -74,6 +76,8 @@ class Panelize(FlatCAMTool):
self.box_combo = QtWidgets.QComboBox()
self.box_combo.setModel(self.app.collection)
self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.box_combo.setCurrentIndex(1)
self.box_combo_label = QtWidgets.QLabel("Box Object:")
self.box_combo_label.setToolTip(
"The actual object that is used a container for the\n "
@@ -187,8 +191,6 @@ class Panelize(FlatCAMTool):
def set_tool_ui(self):
self.reset_fields()
self.object_combo.setCurrentIndex(1)
self.box_combo.setCurrentIndex(1)
sp_c = self.app.defaults["tools_panelize_spacing_columns"] if \
self.app.defaults["tools_panelize_spacing_columns"] else 0.0