From e061c4364a0f695be00e9046708c3b2d836cba6f Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Fri, 16 Aug 2019 17:21:31 +0300 Subject: [PATCH] - each CNCJob object has now it's own text_collection for the annotations which allow the individual enabling and disabling of the annotations --- FlatCAMObj.py | 13 ++++++++----- README.md | 2 +- flatcamGUI/PlotCanvas.py | 7 +++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index dafe7b24..cc6ebdad 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -5363,7 +5363,9 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob): # from predecessors. self.ser_attrs += ['options', 'kind', 'cnc_tools', 'multitool'] - self.annotation = self.app.plotcanvas.new_text_group() + self.text_col = self.app.plotcanvas.new_text_collection() + self.text_col.enabled = True + self.annotation = self.app.plotcanvas.new_text_group(collection=self.text_col) def build_ui(self): self.ui_disconnect() @@ -5985,15 +5987,16 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob): self.annotation.clear(update=True) if self.ui.annotation_cb.get_value() and self.ui.plot_cb.get_value(): - self.annotation.enabled = True + self.text_col.enabled = True else: - self.annotation.enabled = False + self.text_col.enabled = False + self.annotation.redraw() def on_annotation_change(self): if self.ui.annotation_cb.get_value(): - self.app.plotcanvas.text_collection.enabled = True + self.text_col.enabled = True else: - self.app.plotcanvas.text_collection.enabled = False + self.text_col.enabled = False # kind = self.ui.cncplot_method_combo.get_value() # self.plot(kind=kind) self.annotation.redraw() diff --git a/README.md b/README.md index abe1c999..e8f66b5c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ CAD program, and create G-Code for Isolation routing. - updated the default values to more convenient ones - remade the enable/disable plots functions to work only where it needs to (no sense in disabling a plot already disabled) - made sure that if multi depth is choosed when creating GCode then if the multidepth is more than the depth of cut only one cut is made (to the depth of cut) - +- each CNCJob object has now it's own text_collection for the annotations which allow the individual enabling and disabling of the annotations 15.08.2019 diff --git a/flatcamGUI/PlotCanvas.py b/flatcamGUI/PlotCanvas.py index f914be7b..31e37317 100644 --- a/flatcamGUI/PlotCanvas.py +++ b/flatcamGUI/PlotCanvas.py @@ -183,8 +183,11 @@ class PlotCanvas(QtCore.QObject): c.antialias = 0 return c - def new_text_group(self): - return TextGroup(self.text_collection) + def new_text_group(self, collection=None): + if collection: + return TextGroup(collection) + else: + return TextGroup(self.text_collection) def new_text_collection(self, **kwargs): return TextCollection(parent=self.vispy_canvas.view.scene, **kwargs)