- added 2Sided Tool default values in Edit -> Preferences -> Tools

This commit is contained in:
Marius Stanciu
2019-01-29 22:33:04 +02:00
committed by Marius S
parent e3d51c9da5
commit 369d9256da
4 changed files with 107 additions and 21 deletions

View File

@@ -409,7 +409,11 @@ class App(QtCore.QObject):
"tools_paintmethod": self.tools_defaults_form.tools_paint_group.paintmethod_combo,
"tools_selectmethod": self.tools_defaults_form.tools_paint_group.selectmethod_combo,
"tools_pathconnect": self.tools_defaults_form.tools_paint_group.pathconnect_cb,
"tools_paintcontour": self.tools_defaults_form.tools_paint_group.contour_cb
"tools_paintcontour": self.tools_defaults_form.tools_paint_group.contour_cb,
"tools_2sided_mirror_axis": self.tools_defaults_form.tools_2sided_group.mirror_axis_radio,
"tools_2sided_axis_loc": self.tools_defaults_form.tools_2sided_group.axis_location_radio,
"tools_2sided_drilldia": self.tools_defaults_form.tools_2sided_group.drill_dia_entry,
}
# loads postprocessors
self.postprocessors = load_postprocessors(self)
@@ -570,7 +574,11 @@ class App(QtCore.QObject):
"tools_paintmethod": "seed",
"tools_selectmethod": "single",
"tools_pathconnect": True,
"tools_paintcontour": True
"tools_paintcontour": True,
"tools_2sided_mirror_axis": "X",
"tools_2sided_axis_loc": "point",
"tools_2sided_drilldia": 1,
})
@@ -686,7 +694,7 @@ class App(QtCore.QObject):
"tools_cutoutmargin": self.tools_options_form.tools_cutout_group.cutout_margin_entry,
"tools_cutoutgapsize": self.tools_options_form.tools_cutout_group.cutout_gap_entry,
"tools_gaps_rect": self.tools_options_form.tools_cutout_group.gaps_radio,
"tools_gaps_rect": self.tools_options_form.tools_cutout_group.gaps_combo,
"tools_gaps_ff": self.tools_options_form.tools_cutout_group.gaps_combo,
"tools_painttooldia": self.tools_options_form.tools_paint_group.painttooldia_entry,
"tools_paintoverlap": self.tools_options_form.tools_paint_group.paintoverlap_entry,
@@ -694,7 +702,11 @@ class App(QtCore.QObject):
"tools_paintmethod": self.tools_options_form.tools_paint_group.paintmethod_combo,
"tools_selectmethod": self.tools_options_form.tools_paint_group.selectmethod_combo,
"tools_pathconnect": self.tools_options_form.tools_paint_group.pathconnect_cb,
"tools_paintcontour": self.tools_options_form.tools_paint_group.contour_cb
"tools_paintcontour": self.tools_options_form.tools_paint_group.contour_cb,
"tools_2sided_mirror_axis": self.tools_options_form.tools_2sided_group.mirror_axis_radio,
"tools_2sided_axis_loc": self.tools_options_form.tools_2sided_group.axis_location_radio,
"tools_2sided_drilldia": self.tools_options_form.tools_2sided_group.drill_dia_entry
}
for name in list(self.postprocessors.keys()):
@@ -792,7 +804,11 @@ class App(QtCore.QObject):
"tools_paintmethod": "seed",
"tools_selectmethod": "single",
"tools_pathconnect": True,
"tools_paintcontour": True
"tools_paintcontour": True,
"tools_2sided_mirror_axis": "X",
"tools_2sided_axis_loc": 'point',
"tools_2sided_drilldia": 1
})

View File

@@ -978,13 +978,20 @@ class ToolsPreferencesUI(QtWidgets.QWidget):
self.tools_cutout_group = ToolsCutoutPrefGroupUI()
self.tools_cutout_group.setFixedWidth(260)
self.tools_2sided_group = Tools2sidedPrefGroupUI()
self.tools_2sided_group.setFixedWidth(260)
self.vlay = QtWidgets.QVBoxLayout()
self.vlay.addWidget(self.tools_ncc_group)
self.vlay.addWidget(self.tools_paint_group)
self.layout.addLayout(self.vlay)
self.vlay1 = QtWidgets.QVBoxLayout()
self.vlay1.addWidget(self.tools_cutout_group)
self.vlay1.addWidget(self.tools_2sided_group)
self.layout.addLayout(self.vlay)
self.layout.addLayout(self.vlay1)
self.layout.addWidget(self.tools_cutout_group)
self.layout.addStretch()
class CNCJobPreferencesUI(QtWidgets.QWidget):
@@ -2556,6 +2563,63 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
self.layout.addStretch()
class Tools2sidedPrefGroupUI(OptionsGroupUI):
def __init__(self, parent=None):
# OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
super(Tools2sidedPrefGroupUI, self).__init__(self)
self.setTitle(str("2Sided Tool Options"))
## Board cuttout
self.dblsided_label = QtWidgets.QLabel("<b>Double Sided:</b>")
self.dblsided_label.setToolTip(
"A tool to help in creating a double sided\n"
"PCB using alignment holes."
)
self.layout.addWidget(self.dblsided_label)
grid0 = QtWidgets.QGridLayout()
self.layout.addLayout(grid0)
## Drill diameter for alignment holes
self.drill_dia_entry = LengthEntry()
self.dd_label = QtWidgets.QLabel("Drill diam.:")
self.dd_label.setToolTip(
"Diameter of the drill for the "
"alignment holes."
)
grid0.addWidget(self.dd_label, 0, 0)
grid0.addWidget(self.drill_dia_entry, 0, 1)
## Axis
self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
{'label': 'Y', 'value': 'Y'}])
self.mirax_label = QtWidgets.QLabel("Mirror Axis:")
self.mirax_label.setToolTip(
"Mirror vertically (X) or horizontally (Y)."
)
# grid_lay.addRow("Mirror Axis:", self.mirror_axis)
self.empty_lb1 = QtWidgets.QLabel("")
grid0.addWidget(self.empty_lb1, 1, 0)
grid0.addWidget(self.mirax_label, 2, 0)
grid0.addWidget(self.mirror_axis_radio, 2, 1)
## Axis Location
self.axis_location_radio = RadioSet([{'label': 'Point', 'value': 'point'},
{'label': 'Box', 'value': 'box'}])
self.axloc_label = QtWidgets.QLabel("Axis Ref:")
self.axloc_label.setToolTip(
"The axis should pass through a <b>point</b> or cut\n "
"a specified <b>box</b> (in a Geometry object) in \n"
"the middle."
)
# grid_lay.addRow("Axis Location:", self.axis_location)
grid0.addWidget(self.axloc_label, 3, 0)
grid0.addWidget(self.axis_location_radio, 3, 1)
self.layout.addStretch()
class ToolsPaintPrefGroupUI(OptionsGroupUI):
def __init__(self, parent=None):
# OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)

View File

@@ -22,6 +22,7 @@ CAD program, and create G-Code for Isolation routing.
- added new option for Cutout Tool Freeform Gaps in Edit -> Preferences -> Tools
- fixed Freeform Cutout gaps issue (it was double than the value set)
- added protection so the Cutout (either Freeform or Rectangular) cannot be done on a multigeo Geometry
- added 2Sided Tool default values in Edit -> Preferences -> Tools
28.01.2018

View File

@@ -249,14 +249,27 @@ class DblSidedTool(FlatCAMTool):
self.drill_values = ""
## Initialize form
self.mirror_axis.set_value('X')
self.axis_location.set_value('point')
self.drill_dia.set_value(1)
self.set_ui()
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+D', **kwargs)
def run(self):
FlatCAMTool.run(self)
self.app.ui.notebook.setTabText(2, "2-Sided Tool")
self.reset_fields()
self.set_ui()
def set_ui(self):
## Initialize form
self.point_entry.set_value("")
self.alignment_holes.set_value("")
self.mirror_axis.set_value(self.app.defaults["tools_2sided_mirror_axis"])
self.axis_location.set_value(self.app.defaults["tools_2sided_axis_loc"])
self.drill_dia.set_value(self.app.defaults["tools_2sided_drilldia"])
def on_combo_box_type(self):
obj_type = self.box_combo_type.currentIndex()
self.box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
@@ -457,14 +470,6 @@ class DblSidedTool(FlatCAMTool):
self.drill_values = ""
self.point_entry.set_value("")
self.alignment_holes.set_value("")
## Initialize form
self.mirror_axis.set_value('X')
self.axis_location.set_value('point')
self.drill_dia.set_value(1)
def run(self):
FlatCAMTool.run(self)
self.app.ui.notebook.setTabText(2, "2-Sided Tool")
self.reset_fields()