- in Tools: Paint, NCC and Copper Fill, when using the Area Selection, now the selected aras will stay drawn as markers until the user click RMB

- in legacy2D graphic engine, adding an utility geometry no longer draw the older ones, overwriting them
This commit is contained in:
Marius Stanciu
2019-10-28 15:03:21 +02:00
parent f9ad83ba29
commit b994ee9639
7 changed files with 95 additions and 11 deletions

View File

@@ -9,6 +9,8 @@
from PyQt5 import QtGui, QtCore, QtWidgets, QtWidgets
from PyQt5.QtCore import Qt
from shapely.geometry import Polygon
class FlatCAMTool(QtWidgets.QWidget):
@@ -90,3 +92,49 @@ class FlatCAMTool(QtWidgets.QWidget):
self.app.ui.tool_scroll_area.widget().setObjectName(self.toolName)
self.show()
def draw_tool_selection_shape(self, old_coords, coords, **kwargs):
"""
:param old_coords: old coordinates
:param coords: new coordinates
:return:
"""
if 'color' in kwargs:
color = kwargs['color']
else:
color = self.app.defaults['global_sel_line']
if 'face_color' in kwargs:
face_color = kwargs['face_color']
else:
face_color = self.app.defaults['global_sel_fill']
if 'face_alpha' in kwargs:
face_alpha = kwargs['face_alpha']
else:
face_alpha = 0.3
x0, y0 = old_coords
x1, y1 = coords
pt1 = (x0, y0)
pt2 = (x1, y0)
pt3 = (x1, y1)
pt4 = (x0, y1)
sel_rect = Polygon([pt1, pt2, pt3, pt4])
# color_t = Color(face_color)
# color_t.alpha = face_alpha
color_t = face_color[:-2] + str(hex(int(face_alpha * 255)))[2:]
self.app.tool_shapes.add(sel_rect, color=color, face_color=color_t, update=True,
layer=0, tolerance=None)
if self.app.is_legacy is True:
self.app.tool_shapes.redraw()
def delete_tool_selection_shape(self):
self.app.tool_shapes.clear()
self.app.tool_shapes.redraw()