Skip to content
Snippets Groups Projects
Commit 2e45d526 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

Better error handling in superposition dialog to avoid crashing the GUI

parent c6ff3211
Branches
Tags
No related merge requests found
...@@ -212,6 +212,10 @@ class SceneMenu(QMenu): ...@@ -212,6 +212,10 @@ class SceneMenu(QMenu):
gfx_ent_1.UpdatePositions() gfx_ent_1.UpdatePositions()
gfx.Scene().CenterOn(gfx_ent_2) gfx.Scene().CenterOn(gfx_ent_2)
LogScript('RMSD: %.3f'%sd.rmsd) LogScript('RMSD: %.3f'%sd.rmsd)
elif sd.superposition_error != None:
LogScript('Superposition Failed: ' + sd.superposition_error)
else:
LogScript('Superposition Failed!')
class WindowMenu(QMenu): class WindowMenu(QMenu):
def __init__(self, parent=None): def __init__(self, parent=None):
......
...@@ -122,6 +122,7 @@ class SuperpositionDialog(QtWidgets.QDialog): ...@@ -122,6 +122,7 @@ class SuperpositionDialog(QtWidgets.QDialog):
self.rmsd_superposed_atoms = None self.rmsd_superposed_atoms = None
self.rmsd = None self.rmsd = None
self.fraction_superposed = None self.fraction_superposed = None
self.superposition_error = None
self._mmethod_dict = {'number': 'number', self._mmethod_dict = {'number': 'number',
'index': 'index', 'index': 'index',
'local alignment': 'local-aln', 'local alignment': 'local-aln',
...@@ -223,11 +224,16 @@ class SuperpositionDialog(QtWidgets.QDialog): ...@@ -223,11 +224,16 @@ class SuperpositionDialog(QtWidgets.QDialog):
view_one = self._chain_one.selected_chain view_one = self._chain_one.selected_chain
view_two = self._chain_two.selected_chain view_two = self._chain_two.selected_chain
atoms = self._GetAtomSelection() atoms = self._GetAtomSelection()
sp = Superpose(view_two, view_one, try:
self._mmethod_dict[str(self._methods.currentText())], sp = Superpose(view_two, view_one,
atoms, iterative=self._iterative, self._mmethod_dict[str(self._methods.currentText())],
max_iterations=self._it_in.value(), atoms, iterative=self._iterative,
distance_threshold=self._dist_in.value()) max_iterations=self._it_in.value(),
distance_threshold=self._dist_in.value())
except Exception as e:
# mark as failed by setting superposition_error and let caller handle it
self.superposition_error = str(e)
return
self.rmsd = sp.rmsd self.rmsd = sp.rmsd
if self._iterative: if self._iterative:
self.rmsd_superposed_atoms = sp.rmsd_superposed_atoms self.rmsd_superposed_atoms = sp.rmsd_superposed_atoms
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment