gaphor/gaphas

JuggleError When Trying to Modify Gaphor Diagram

danyeaw opened this issue · 4 comments

Describe the bug
JuggleError when trying to modify a certain diagram in Gaphor.

Traceback (most recent call last):
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/decorators.py", line 133, in async_wrapper
    func(*args, **kwargs)
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/view/gtkview.py", line 310, in update
    model.update_now(dirty_items, dirty_matrix_items)
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/decorators.py", line 163, in wrapper
    return func(*args, **kwargs)
  File "/home/dan/Projects/gaphor/gaphor/core/modeling/diagram.py", line 376, in update_now
    self._connections.solve()
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/connections.py", line 73, in solve
    self._solver.solve()
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/solver/solver.py", line 181, in solve
    c.solve()
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/solver/constraint.py", line 107, in solve
    self.solve_for(wvar)
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/position.py", line 164, in solve_for
    self._orig_pos.x, self._orig_pos.y = self.matrix.inverse().transform_point(
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/position.py", line 64, in _set_y
    self._y.value = v
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/solver/variable.py", line 111, in set_value
    self.notify(oldval)
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/solver/variable.py", line 90, in notify
    handler(self, old)
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/solver/constraint.py", line 73, in _propagate
    self.notify()
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/solver/constraint.py", line 69, in notify
    handler(self)
  File "/home/dan/Projects/gaphor/.venv/lib/python3.9/site-packages/gaphas/solver/solver.py", line 135, in request_resolve_constraint
    raise JuggleError(
gaphas.solver.solver.JuggleError: Variable juggling detected, constraint <gaphas.constraint.EqualsConstraint object at 0x7fa84cb56850> resolved 101 times out of 400

To Reproduce
Steps to reproduce the behavior:

  1. Open Gaphor
  2. Open the models/RAAML.gaphor model
  3. Open the Profiles -> RAAML -> Methods -> FTA -> FTA Library -> Events -> Event diagram
  4. Try to disconnect the associations or modify the diagram

Expected behavior
Should be able to disconnect the associations or make other modifications

Screenshots
If applicable, add screenshots to help explain your problem.

OS

  • Linux (Please put in notes the specific distro)
  • MacOS
  • Windows

NOTES:

Version
Version of Gaphas:

Additional context
Add any other context about the problem here.

I am able to reproduce this on a fresh model as well, but not consistently. It seems to be somehow related to having Rectilinear selected and connecting and disconnecting the relationship (like a generalization) many times.

I can reproduce this behavior as well. I'm curious which constraints this involves.

The problem seems to be reproducable when two handles of the orthogonal association get really close together. It looks like the line is merges, although an orthogonal line should consist of at least 3 handles. With just two handles the line should become horizontal, but that doesn't work out ==> JuggleError.

Nice @amolenaar, thanks for the fix!