- 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:
@@ -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()))
|
||||
|
||||
Reference in New Issue
Block a user