diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eeb6133..51058606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM Evo beta ================================================= +25.09.2022 + +- added a new setting in Preferences ("3D compatibility") controlled by a checkbox. If the checkbox is checked then multithreading is disabled for the 3D mode (lower performance but perhaps more compatibility, especially for Linux) - this was done from the research done by Matti Eiden on bitbucket + 10.09.2022 - hided the main UI on application quit to create a user experience of a shutdown without lag diff --git a/appGUI/PlotCanvas.py b/appGUI/PlotCanvas.py index 717b7d3c..b01884d8 100644 --- a/appGUI/PlotCanvas.py +++ b/appGUI/PlotCanvas.py @@ -511,7 +511,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): # sc = ShapeCollection(parent=self.view.scene, pool=self.app.pool, **kwargs) # self.shape_collections.append(sc) # return sc - return ShapeCollection(parent=self.view.scene, pool=self.fcapp.pool, **kwargs) + return ShapeCollection(parent=self.view.scene, pool=self.fcapp.pool, fcoptions=self.fcapp.options, **kwargs) def new_cursor(self, big=None): """ diff --git a/appGUI/VisPyVisuals.py b/appGUI/VisPyVisuals.py index 727b8877..08818141 100644 --- a/appGUI/VisPyVisuals.py +++ b/appGUI/VisPyVisuals.py @@ -230,7 +230,7 @@ class ShapeGroup(object): class ShapeCollectionVisual(CompoundVisual): - def __init__(self, linewidth=1, triangulation='vispy', layers=3, pool=None, **kwargs): + def __init__(self, linewidth=1, triangulation='vispy', layers=3, pool=None, fcoptions=None, **kwargs): """ Represents collection of shapes to draw on VisPy scene :param linewidth: float @@ -244,6 +244,8 @@ class ShapeCollectionVisual(CompoundVisual): Each layer adds 2 visuals on VisPy scene. Be careful: more layers cause less fps :param kwargs: """ + self.fc_options = fcoptions + self.data = {} self.last_key = -1 @@ -329,11 +331,14 @@ class ShapeCollectionVisual(CompoundVisual): if linewidth: self._line_width = linewidth - # Add data to process pool if pool exists - try: - self.results[key] = self.pool.map_async(_update_shape_buffers, [self.data[key]]) - except Exception: + if self.fc_options and self.fc_options["global_graphic_engine_3d_no_mp"] is True: self.data[key] = _update_shape_buffers(self.data[key]) + else: + # Add data to process pool if pool exists + try: + self.results[key] = self.pool.map_async(_update_shape_buffers, [self.data[key]]) + except Exception: + self.data[key] = _update_shape_buffers(self.data[key]) if update: self.redraw() # redraw() waits for pool process end diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index a8b3c978..f6b9e37e 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -57,6 +57,7 @@ class PreferencesUIManager(QtCore.QObject): "decimals_metric": self.ui.general_pref_form.general_app_group.precision_metric_entry, "units": self.ui.general_pref_form.general_app_group.units_radio, "global_graphic_engine": self.ui.general_pref_form.general_app_group.ge_radio, + "global_graphic_engine_3d_no_mp": self.ui.general_pref_form.general_app_group.ge_comp_cb, "global_app_level": self.ui.general_pref_form.general_app_group.app_level_radio, "global_log_verbose": self.ui.general_pref_form.general_app_group.verbose_combo, "global_portable": self.ui.general_pref_form.general_app_group.portability_cb, diff --git a/appGUI/preferences/general/GeneralAppPrefGroupUI.py b/appGUI/preferences/general/GeneralAppPrefGroupUI.py index a5346b49..16d67696 100644 --- a/appGUI/preferences/general/GeneralAppPrefGroupUI.py +++ b/appGUI/preferences/general/GeneralAppPrefGroupUI.py @@ -102,6 +102,12 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): grid1.addWidget(self.ge_label, 0, 0) grid1.addWidget(self.ge_radio, 0, 1) + self.ge_comp_cb = FCCheckBox(_("3D Compatibility")) + self.ge_comp_cb.setToolTip(_("Check this if you have problems in 3D mode. Works only for 3D mode.\n" + "It will disable performance mods but perhaps add more compatibility.")) + + grid1.addWidget(self.ge_comp_cb, 1, 0, 1, 2) + # separator_line = QtWidgets.QFrame() # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) # separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) diff --git a/appObjects/AppObjectTemplate.py b/appObjects/AppObjectTemplate.py index c198302a..efc98e1f 100644 --- a/appObjects/AppObjectTemplate.py +++ b/appObjects/AppObjectTemplate.py @@ -94,7 +94,8 @@ class FlatCAMObj(QtCore.QObject): if self.app.use_3d_engine: self.shapes = self.app.plotcanvas.new_shape_group() - self.mark_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1, pool=self.app.pool) + self.mark_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1, pool=self.app.pool, + fcoptions=self.app.options) else: self.shapes = ShapeCollectionLegacy(obj=self, app=self.app, name=name) self.mark_shapes = ShapeCollectionLegacy(obj=self, app=self.app, name=name + "_mark_shapes") diff --git a/defaults.py b/defaults.py index 67c8f401..32135555 100644 --- a/defaults.py +++ b/defaults.py @@ -85,6 +85,7 @@ class AppDefaults: "decimals_inch": 4, "decimals_metric": 4, "global_graphic_engine": '3D', + "global_graphic_engine_3d_no_mp": False, "global_app_level": 'b', "global_log_verbose": 2,