Skip to content
Snippets Groups Projects
Commit 889f9122 authored by Pierre-Olivier Autran's avatar Pierre-Olivier Autran
Browse files

Merge branch 'Fix_1219' into 'main'

modify modify need_to_update_widget

Closes #1219

See merge request tomotools/tomwer!845
parents 95f159a5 dcffb067
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,9 @@ class PosEditorOverOneAxis(qt.QWidget):
def _deleteSpinBox(self, tomo_obj):
identifier_as_str = tomo_obj.get_identifier().to_str()
if identifier_as_str in self._tomoObjtoSpinBoxes:
del self._tomoObjtoSpinBoxes[identifier_as_str]
spinBox = self._tomoObjtoSpinBoxes.pop(identifier_as_str)
spinBox.deleteLater()
if identifier_as_str in self.__spinBoxescallback:
del self.__spinBoxescallback[identifier_as_str]
def removeTomoObj(self, tomo_obj):
......@@ -142,11 +144,9 @@ class PosEditorOverOneAxis(qt.QWidget):
identifier_as_str = tomo_obj.get_identifier().to_str()
spinBox = self._tomoObjtoSpinBoxes[identifier_as_str]
model_index = self._tomoObjsTableView.model().createIndex(i_pos, 2)
needs_to_update_widget = (
needs_to_update_widget
or self._tomoObjsTableView.indexWidget(model_index)
not in (None, spinBox)
)
if self._tomoObjsTableView.indexWidget(model_index) not in (None, spinBox):
needs_to_update_widget = True
break
for i_pos, tomo_obj in enumerate(ordered_objs):
identifier_as_str = tomo_obj.get_identifier().to_str()
......@@ -155,11 +155,10 @@ class PosEditorOverOneAxis(qt.QWidget):
if needs_to_update_widget:
# if items have been reordered then we must recreated SpinBoxes otherwise if we try
# to change order then Qt will end up with a seg fault which seems to come from
# otherwirtting the cell and trying to reuse them
# overwriting the cell and trying to reuse them
self._deleteSpinBox(tomo_obj=tomo_obj)
spinBox = self._createSpinBox(tomo_obj=tomo_obj)
self._tomoObjsTableView.setIndexWidget(model_index, spinBox)
# end update spin box positions
class EditableAxisOrderedTomoObjsModel(AxisOrderedTomoObjsModel):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment