- fixed MultiColor checkbox in Excellon Object to work in Legacy Mode (2D)

- modified the visibility change in Excellon UI to no longer do plot() when doing visibility toggle for one of the tools but only a visibility change in the shapes properties
This commit is contained in:
Marius Stanciu
2020-07-21 06:01:04 +03:00
committed by Marius
parent e99dd967fe
commit e57820f707
4 changed files with 84 additions and 82 deletions

View File

@@ -145,7 +145,9 @@ class ShapeGroup(object):
:param kwargs: keyword arguments
Arguments for ShapeCollection.add function
"""
self._indexes.append(self._collection.add(**kwargs))
key = self._collection.add(**kwargs)
self._indexes.append(key)
return key
def remove(self, idx, update=False):
self._indexes.remove(idx)
@@ -196,6 +198,17 @@ class ShapeGroup(object):
self._collection.redraw([])
def update_visibility(self, state, indexes=None):
if indexes:
for i in indexes:
if i in self._indexes:
self._collection.data[i]['visible'] = state
else:
for i in self._indexes:
self._collection.data[i]['visible'] = state
self._collection.redraw([])
class ShapeCollectionVisual(CompoundVisual):
@@ -326,6 +339,19 @@ class ShapeCollectionVisual(CompoundVisual):
if update:
self.__update()
def update_visibility(self, state:bool, indexes=None) -> None:
# Lock sub-visuals updates
self.update_lock.acquire(True)
if indexes is None:
for k, data in list(self.data.items()):
self.data[k]['visible'] = state
else:
for k, data in list(self.data.items()):
if k in indexes:
self.data[k]['visible'] = state
self.update_lock.release()
def update_color(self, new_mesh_color=None, new_line_color=None, indexes=None):
if new_mesh_color is None and new_line_color is None:
return
@@ -533,7 +559,7 @@ class ShapeCollectionVisual(CompoundVisual):
self.results_lock.release()
if update_colors is None:
if update_colors is None or update_colors is False:
self.__update()
else:
try: