Repository: gaphor/gaphor
Issue: Inverting direction causes error

### Describe the bug

Inverting the direction for an association cause error message.

### To Reproduce
1. Create class diagram
2. Add two classes
3. Create association between classes
4. Give association a name
5. Enable show direction
6. Press invert direction button

The following error is being displayed:

Gaphor version:         2.19.3
Operating System:       Linux (6.2.0-25-generic)
Display:                X11Display
Python version:         3.10.12
GTK version:            4.10.3
Adwaita version:        1.3.2
GtkSourceView version:  5.8.0
Cairo version:          1.16.0
Pango version:          1.50.14
PyGObject version:      3.44.1
Pycairo version:        1.24.0
pygit2/libgit2 version: 1.12.2  / 1.6.4


Errors:

Time since application startup: 0:00:36
|Traceback (most recent call last):
|  File "/app/lib/python3.10/site-packages/gaphor/transaction.py", line 160, in _transactional
|    return func(*args, **kwargs)
|           │     │       └ {}
|           │     └ (<gaphor.UML.classes.associationpropertypages.AssociationPropertyPage object at 0x7f0a9f09c4c0>, <Gtk.Button object at 0x7f0a9f0...
|           └ <function AssociationPropertyPage._on_invert_direction_change at 0x7f0acc159240>
|  File "/app/lib/python3.10/site-packages/gaphor/UML/classes/associationpropertypages.py", line 153, in _on_invert_direction_change
|    self.item.invert_direction()
|    └ <gaphor.UML.classes.associationpropertypages.AssociationPropertyPage object at 0x7f0a9f09c4c0>
|  File "/app/lib/python3.10/site-packages/gaphor/UML/classes/association.py", line 140, in invert_direction
|    self.subject.memberEnd.swap(
|  File "/app/lib/python3.10/site-packages/gaphor/core/modeling/collection.py", line 124, in swap
|    self.object.handle(AssociationUpdated(self.object, self.property))
|    │                  │                  │            └ collection([<gaphor.UML.uml.Property element 949946b2-24d5-11ee-8557-05081acc7ff3>, <gaphor.UML.uml.Property element 949a10cf-24...
|    │                  │                  └ collection([<gaphor.UML.uml.Property element 949946b2-24d5-11ee-8557-05081acc7ff3>, <gaphor.UML.uml.Property element 949a10cf-24...
|    │                  └ <class 'gaphor.core.modeling.event.AssociationUpdated'>
|    └ collection([<gaphor.UML.uml.Property element 949946b2-24d5-11ee-8557-05081acc7ff3>, <gaphor.UML.uml.Property element 949a10cf-24...
|  File "/app/lib/python3.10/site-packages/gaphor/core/modeling/element.py", line 174, in handle
|    model.handle(event)
|    │            └ <gaphor.core.modeling.event.AssociationUpdated object at 0x7f0a9f08f4c0>
|    └ <gaphor.core.modeling.elementfactory.ElementFactory object at 0x7f0a9594f2b0>
|  File "/app/lib/python3.10/site-packages/gaphor/core/modeling/elementfactory.py", line 226, in handle
|    self.event_manager.handle(event)
|    │                         └ <gaphor.core.modeling.event.AssociationUpdated object at 0x7f0a9f08f4c0>
|    └ <gaphor.core.modeling.elementfactory.ElementFactory object at 0x7f0a9594f2b0>
|  File "/app/lib/python3.10/site-packages/gaphor/core/eventmanager.py", line 83, in handle
|    self._events.handle(queue.pop())
|    │                   └ deque([])
|    └ <gaphor.core.eventmanager.EventManager object at 0x7f0a95bede70>
|  File "/app/lib/python3.10/site-packages/generic/event.py", line 61, in handle
|    raise ExceptionGroup("Error while handling events", exceptions)
|          │                                             └ [TypeError("AssociationPropertyPage._on_end_navigability_change() missing 1 required positional argument: 'end'")]
|          └ <class 'exceptiongroup.ExceptionGroup'>
|exceptiongroup.ExceptionGroup: Error while handling events (1 sub-exception)
└─┬──────────────────────────────╌┄┈
  |Traceback (most recent call last):
  |  File "/app/lib/python3.10/site-packages/generic/event.py", line 57, in handle
  |    handler(event)
  |    │       └ <gaphor.core.modeling.event.AssociationUpdated object at 0x7f0a9f08f4c0>
  |    └ <bound method ElementDispatcher.on_element_change_event of <gaphor.core.modeling.elementdispatcher.ElementDispatcher object at 0...
  |  File "/app/lib/python3.10/site-packages/gaphor/core/modeling/elementdispatcher.py", line 240, in on_element_change_event
  |    handler(event)
  |    │       └ <gaphor.core.modeling.event.AssociationUpdated object at 0x7f0a9f08f4c0>
  |    └ <function AssociationPropertyPage.construct.<locals>.restore_nav_handler at 0x7f0a9f091630>
  |  File "/app/lib/python3.10/site-packages/gaphor/UML/classes/associationpropertypages.py", line 131, in restore_nav_handler
  |    self._on_end_navigability_change(combo, end)
  |    │                                │      └ <gaphor.UML.classes.association.AssociationEnd object at 0x7f0a958a0340>
  |    │                                └ <Gtk.DropDown object at 0x7f0a959c0800 (GtkDropDown at 0x55dc19b76c80)>
  |    └ <gaphor.UML.classes.associationpropertypages.AssociationPropertyPage object at 0x7f0a9f09c4c0>
  |  File "/app/lib/python3.10/site-packages/gaphor/transaction.py", line 160, in _transactional
  |    return func(*args, **kwargs)
  |           │     │       └ {}
  |           │     └ (<gaphor.UML.classes.associationpropertypages.AssociationPropertyPage object at 0x7f0a9f09c4c0>, <Gtk.DropDown object at 0x7f0a9...
  |           └ <function AssociationPropertyPage._on_end_navigability_change at 0x7f0acc159480>
  |TypeError: AssociationPropertyPage._on_end_navigability_change() missing 1 required positional argument: 'end'
  └─────────────────────────────╌┄┈
Time since application startup: 0:00:40
|Traceback (most recent call last):
|  File "/app/lib/python3.10/site-packages/gaphor/transaction.py", line 160, in _transactional
|    return func(*args, **kwargs)
|           │     │       └ {}
|           │     └ (<gaphor.UML.classes.associationpropertypages.AssociationPropertyPage object at 0x7f0a9f09c4c0>, <Gtk.Button object at 0x7f0a9f0...
|           └ <function AssociationPropertyPage._on_invert_direction_change at 0x7f0acc159240>
|  File "/app/lib/python3.10/site-packages/gaphor/UML/classes/associationpropertypages.py", line 153, in _on_invert_direction_change
|    self.item.invert_direction()
|    └ <gaphor.UML.classes.associationpropertypages.AssociationPropertyPage object at 0x7f0a9f09c4c0>
|  File "/app/lib/python3.10/site-packages/gaphor/UML/classes/association.py", line 140, in invert_direction
|    self.subject.memberEnd.swap(
|  File "/app/lib/python3.10/site-packages/gaphor/core/modeling/collection.py", line 124, in swap
|    self.object.handle(AssociationUpdated(self.object, self.property))
|    │                  │                  │            └ collection([<gaphor.UML.uml.Property element 949946b2-24d5-11ee-8557-05081acc7ff3>, <gaphor.UML.uml.Property element 949a10cf-24...
|    │                  │                  └ collection([<gaphor.UML.uml.Property element 949946b2-24d5-11ee-8557-05081acc7ff3>, <gaphor.UML.uml.Property element 949a10cf-24...
|    │                  └ <class 'gaphor.core.modeling.event.AssociationUpdated'>
|    └ collection([<gaphor.UML.uml.Property element 949946b2-24d5-11ee-8557-05081acc7ff3>, <gaphor.UML.uml.Property element 949a10cf-24...
|  File "/app/lib/python3.10/site-packages/gaphor/core/modeling/element.py", line 174, in handle
|    model.handle(event)
|    │            └ <gaphor.core.modeling.event.AssociationUpdated object at 0x7f0a9f08fa90>
|    └ <gaphor.core.modeling.elementfactory.ElementFactory object at 0x7f0a9594f2b0>
|  File "/app/lib/python3.10/site-packages/gaphor/core/modeling/elementfactory.py", line 226, in handle
|    self.event_manager.handle(event)
|    │                         └ <gaphor.core.modeling.event.AssociationUpdated object at 0x7f0a9f08fa90>
|    └ <gaphor.core.modeling.elementfactory.ElementFactory object at 0x7f0a9594f2b0>
|  File "/app/lib/python3.10/site-packages/gaphor/core/eventmanager.py", line 83, in handle
|    self._events.handle(queue.pop())
|    │                   └ deque([])
|    └ <gaphor.core.eventmanager.EventManager object at 0x7f0a95bede70>
|  File "/app/lib/python3.10/site-packages/generic/event.py", line 61, in handle
|    raise ExceptionGroup("Error while handling events", exceptions)
|          │                                             └ [TypeError("AssociationPropertyPage._on_end_navigability_change() missing 1 required positional argument: 'end'")]
|          └ <class 'exceptiongroup.ExceptionGroup'>
|exceptiongroup.ExceptionGroup: Error while handling events (1 sub-exception)
└─┬──────────────────────────────╌┄┈
  |Traceback (most recent call last):
  |  File "/app/lib/python3.10/site-packages/generic/event.py", line 57, in handle
  |    handler(event)
  |    │       └ <gaphor.core.modeling.event.AssociationUpdated object at 0x7f0a9f08fa90>
  |    └ <bound method ElementDispatcher.on_element_change_event of <gaphor.core.modeling.elementdispatcher.ElementDispatcher object at 0...
  |  File "/app/lib/python3.10/site-packages/gaphor/core/modeling/elementdispatcher.py", line 240, in on_element_change_event
  |    handler(event)
  |    │       └ <gaphor.core.modeling.event.AssociationUpdated object at 0x7f0a9f08fa90>
  |    └ <function AssociationPropertyPage.construct.<locals>.restore_nav_handler at 0x7f0a9f091630>
  |  File "/app/lib/python3.10/site-packages/gaphor/UML/classes/associationpropertypages.py", line 131, in restore_nav_handler
  |    self._on_end_navigability_change(combo, end)
  |    │                                │      └ <gaphor.UML.classes.association.AssociationEnd object at 0x7f0a958a0340>
  |    │                                └ <Gtk.DropDown object at 0x7f0a959c0800 (GtkDropDown at 0x55dc19b76c80)>
  |    └ <gaphor.UML.classes.associationpropertypages.AssociationPropertyPage object at 0x7f0a9f09c4c0>
  |  File "/app/lib/python3.10/site-packages/gaphor/transaction.py", line 160, in _transactional
  |    return func(*args, **kwargs)
  |           │     │       └ {}
  |           │     └ (<gaphor.UML.classes.associationpropertypages.AssociationPropertyPage object at 0x7f0a9f09c4c0>, <Gtk.DropDown object at 0x7f0a9...
  |           └ <function AssociationPropertyPage._on_end_navigability_change at 0x7f0acc159480>
  |TypeError: AssociationPropertyPage._on_end_navigability_change() missing 1 required positional argument: 'end'
  └─────────────────────────────╌┄┈


### Expected behavior
No error, shall invert the direction.

### OS
- [X] Linux (Ubuntu)
- [ ] macOS
- [ ] Windows

### Version
Version of Gaphor: latest main


Changed files:
gaphor/UML/classes/associationpropertypages.py

diff --git a/gaphor/UML/classes/associationpropertypages.py b/gaphor/UML/classes/associationpropertypages.py
index b2fe18d15..e27c46e75 100644
--- a/gaphor/UML/classes/associationpropertypages.py
+++ b/gaphor/UML/classes/associationpropertypages.py
@@ -128,7 +128,7 @@ class AssociationPropertyPage(PropertyPageBase):
         def restore_nav_handler(event):
             for end_name, end in (("head", head), ("tail", tail)):
                 combo = builder.get_object(f"{end_name}-navigation")
-                self._on_end_navigability_change(combo, end)
+                self._on_end_navigability_change(combo, None, end)
 
         # Watch on association end:
         self.watcher.watch("memberEnd[Property].name", name_handler).watch(