- 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

This commit is contained in:
Marius Stanciu
2022-09-25 05:44:43 +03:00
committed by Marius
parent 565c839460
commit 9b08191660
7 changed files with 25 additions and 7 deletions

View File

@@ -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):
"""

View File

@@ -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

View File

@@ -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,

View File

@@ -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)