- refactored the is_legacy object to use_3d_engine

- made sure that there is no longer a double action when toggling the object visibility ('plot' attribute)
This commit is contained in:
Marius Stanciu
2021-10-31 14:05:00 +02:00
committed by Marius
parent 25bca44996
commit bb089eb657
34 changed files with 321 additions and 366 deletions

View File

@@ -241,7 +241,7 @@ class ExclusionAreas(QtCore.QObject):
self.app.log.debug("+ Adding Exclusion Areas")
# Storage for shapes, storage that can be used by FlatCAm tools for utility geometry
# VisPy visuals
if self.app.is_legacy is False:
if self.app.use_3d_engine:
try:
self.exclusion_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1)
except AttributeError:
@@ -310,7 +310,7 @@ class ExclusionAreas(QtCore.QObject):
self.solid_geometry = solid_geo
self.obj_type = obj_type
if self.app.is_legacy is False:
if self.app.use_3d_engine:
self.app.plotcanvas.graph_event_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
self.app.plotcanvas.graph_event_disconnect('mouse_move', self.app.on_mouse_move_over_plot)
self.app.plotcanvas.graph_event_disconnect('mouse_release', self.app.on_mouse_click_release_over_plot)
@@ -333,7 +333,7 @@ class ExclusionAreas(QtCore.QObject):
:return: None
:rtype:
"""
if self.app.is_legacy is False:
if self.app.use_3d_engine:
event_pos = event.pos
# event_is_dragging = event.is_dragging
right_button = 2
@@ -475,7 +475,7 @@ class ExclusionAreas(QtCore.QObject):
# AppTool.delete_tool_selection_shape(self, shapes_storage=self.exclusion_shapes)
if self.app.is_legacy is False:
if self.app.use_3d_engine:
self.app.plotcanvas.graph_event_disconnect('mouse_release', self.on_mouse_release)
self.app.plotcanvas.graph_event_disconnect('mouse_move', self.on_mouse_move)
# self.app.plotcanvas.graph_event_disconnect('key_press', self.on_key_press)
@@ -529,7 +529,7 @@ class ExclusionAreas(QtCore.QObject):
:return: None
:rtype:
"""
if self.app.is_legacy is False:
if self.app.use_3d_engine:
self.app.plotcanvas.graph_event_disconnect('mouse_release', self.on_mouse_release)
self.app.plotcanvas.graph_event_disconnect('mouse_move', self.on_mouse_move)
else:
@@ -564,7 +564,7 @@ class ExclusionAreas(QtCore.QObject):
"""
shape_type = self.shape_type_button.get_value()
if self.app.is_legacy is False:
if self.app.use_3d_engine:
event_pos = event.pos
event_is_dragging = event.is_dragging
# right_button = 2
@@ -697,7 +697,7 @@ class ExclusionAreas(QtCore.QObject):
if isinstance(geo_el['shape'], Polygon):
self.exclusion_shapes.add(
geo_el['shape'], color=color, face_color=color_t, update=True, layer=0, tolerance=None)
if self.app.is_legacy is True:
if self.app.use_3d_engine:
self.exclusion_shapes.redraw()
# if there are still some exclusion areas in the storage