- started to work on Paint Area in Paint Tool
This commit is contained in:
parent
470ce658a4
commit
7a6c0541be
@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
- replaced setFixedWidth calls with setMinimumWidth
|
- replaced setFixedWidth calls with setMinimumWidth
|
||||||
- recoded the camlib.Geometry.isolation_geometry() function
|
- recoded the camlib.Geometry.isolation_geometry() function
|
||||||
|
- started to work on Paint Area in Paint Tool
|
||||||
|
|
||||||
6.08.2019
|
6.08.2019
|
||||||
|
|
||||||
|
@ -3255,9 +3255,9 @@ class ToolsPreferencesUI(QtWidgets.QWidget):
|
|||||||
self.setLayout(self.layout)
|
self.setLayout(self.layout)
|
||||||
|
|
||||||
self.tools_ncc_group = ToolsNCCPrefGroupUI()
|
self.tools_ncc_group = ToolsNCCPrefGroupUI()
|
||||||
self.tools_ncc_group.setMinimumWidth(200)
|
self.tools_ncc_group.setMinimumWidth(220)
|
||||||
self.tools_paint_group = ToolsPaintPrefGroupUI()
|
self.tools_paint_group = ToolsPaintPrefGroupUI()
|
||||||
self.tools_paint_group.setMinimumWidth(200)
|
self.tools_paint_group.setMinimumWidth(220)
|
||||||
|
|
||||||
self.tools_cutout_group = ToolsCutoutPrefGroupUI()
|
self.tools_cutout_group = ToolsCutoutPrefGroupUI()
|
||||||
self.tools_cutout_group.setMinimumWidth(220)
|
self.tools_cutout_group.setMinimumWidth(220)
|
||||||
@ -6126,8 +6126,8 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
|
|||||||
grid0.addWidget(selectlabel, 6, 0)
|
grid0.addWidget(selectlabel, 6, 0)
|
||||||
self.selectmethod_combo = RadioSet([
|
self.selectmethod_combo = RadioSet([
|
||||||
{"label": _("Single"), "value": "single"},
|
{"label": _("Single"), "value": "single"},
|
||||||
{"label": _("All"), "value": "all"},
|
{"label": _("Area"), "value": "area"},
|
||||||
# {"label": "Rectangle", "value": "rectangle"}
|
{"label": _("All"), "value": "all"}
|
||||||
])
|
])
|
||||||
grid0.addWidget(self.selectmethod_combo, 6, 1)
|
grid0.addWidget(self.selectmethod_combo, 6, 1)
|
||||||
|
|
||||||
|
@ -245,8 +245,8 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
# grid3 = QtWidgets.QGridLayout()
|
# grid3 = QtWidgets.QGridLayout()
|
||||||
self.selectmethod_combo = RadioSet([
|
self.selectmethod_combo = RadioSet([
|
||||||
{"label": _("Single"), "value": "single"},
|
{"label": _("Single"), "value": "single"},
|
||||||
{"label": _("All"), "value": "all"},
|
{"label": _("Area"), "value": "area"},
|
||||||
# {"label": "Rectangle", "value": "rectangle"}
|
{"label": _("All"), "value": "all"}
|
||||||
])
|
])
|
||||||
grid3.addWidget(self.selectmethod_combo, 7, 1)
|
grid3.addWidget(self.selectmethod_combo, 7, 1)
|
||||||
|
|
||||||
@ -353,6 +353,10 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.addtool_btn.setDisabled(True)
|
self.addtool_btn.setDisabled(True)
|
||||||
self.deltool_btn.setDisabled(True)
|
self.deltool_btn.setDisabled(True)
|
||||||
self.tools_table.setContextMenuPolicy(Qt.NoContextMenu)
|
self.tools_table.setContextMenuPolicy(Qt.NoContextMenu)
|
||||||
|
if self.selectmethod_combo.get_value() == 'area':
|
||||||
|
# disable rest-machining for single polygon painting
|
||||||
|
self.rest_cb.set_value(False)
|
||||||
|
self.rest_cb.setDisabled(True)
|
||||||
else:
|
else:
|
||||||
self.rest_cb.setDisabled(False)
|
self.rest_cb.setDisabled(False)
|
||||||
self.addtool_entry.setDisabled(False)
|
self.addtool_entry.setDisabled(False)
|
||||||
@ -433,7 +437,6 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.tools_table.setContextMenuPolicy(Qt.NoContextMenu)
|
self.tools_table.setContextMenuPolicy(Qt.NoContextMenu)
|
||||||
|
|
||||||
def build_ui(self):
|
def build_ui(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# if connected, disconnect the signal from the slot on item_changed as it creates issues
|
# if connected, disconnect the signal from the slot on item_changed as it creates issues
|
||||||
self.tools_table.itemChanged.disconnect()
|
self.tools_table.itemChanged.disconnect()
|
||||||
@ -787,7 +790,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
connect=connect,
|
connect=connect,
|
||||||
contour=contour)
|
contour=contour)
|
||||||
|
|
||||||
if select_method == "single":
|
elif select_method == "single":
|
||||||
self.app.inform.emit(_("[WARNING_NOTCL] Click inside the desired polygon."))
|
self.app.inform.emit(_("[WARNING_NOTCL] Click inside the desired polygon."))
|
||||||
|
|
||||||
# use the first tool in the tool table; get the diameter
|
# use the first tool in the tool table; get the diameter
|
||||||
@ -815,6 +818,34 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.app.plotcanvas.vis_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
self.app.plotcanvas.vis_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||||
self.app.plotcanvas.vis_connect('mouse_press', doit)
|
self.app.plotcanvas.vis_connect('mouse_press', doit)
|
||||||
|
|
||||||
|
elif select_method == "area":
|
||||||
|
self.app.inform.emit(_("[WARNING_NOTCL] Click the start point of the paint area."))
|
||||||
|
|
||||||
|
# use the first tool in the tool table; get the diameter
|
||||||
|
tooldia = float('%.4f' % float(self.tools_table.item(0, 1).text()))
|
||||||
|
|
||||||
|
# To be called after clicking on the plot.
|
||||||
|
def doit(event):
|
||||||
|
# do paint single only for left mouse clicks
|
||||||
|
if event.button == 1:
|
||||||
|
self.app.inform.emit(_("Painting polygon..."))
|
||||||
|
self.app.plotcanvas.vis_disconnect('mouse_press', doit)
|
||||||
|
|
||||||
|
pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||||
|
if self.app.grid_status():
|
||||||
|
pos = self.app.geo_editor.snap(pos[0], pos[1])
|
||||||
|
|
||||||
|
self.paint_poly(self.paint_obj,
|
||||||
|
inside_pt=[pos[0], pos[1]],
|
||||||
|
tooldia=tooldia,
|
||||||
|
overlap=overlap,
|
||||||
|
connect=connect,
|
||||||
|
contour=contour)
|
||||||
|
self.app.plotcanvas.vis_connect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||||
|
|
||||||
|
self.app.plotcanvas.vis_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||||
|
self.app.plotcanvas.vis_connect('mouse_press', doit)
|
||||||
|
|
||||||
def paint_poly(self, obj, inside_pt, tooldia, overlap, outname=None, connect=True, contour=True):
|
def paint_poly(self, obj, inside_pt, tooldia, overlap, outname=None, connect=True, contour=True):
|
||||||
"""
|
"""
|
||||||
Paints a polygon selected by clicking on its interior.
|
Paints a polygon selected by clicking on its interior.
|
||||||
|
Loading…
Reference in New Issue
Block a user