Commit Graph

66 Commits

Author SHA1 Message Date
Arjan Molenaar
cbd4e62371 Move diagram update from update_now() to update()
`update_now()` is part if the protocol that Gaphas views use
to communicate with the model (`Diagram`).

By decoupling those we can move away from a model where diagram
updates are done asynchronously.
We need our updates to happen within the context of a transaction.

A possitive side effect may be that tearing, when moveing something in a
diagram, is a thing of the past.
2024-03-24 15:54:25 +01:00
Arjan Molenaar
05abbb3414 Cleanup in test_undo 2024-03-24 15:54:25 +01:00
Arjan Molenaar
aa7e1d34d8 Fix undoing pasted data
* Connected items are no longer unlinked directly
* Connectors are smarter at finding out the diagram

The latter is needed, since a diagram can be set to None before
connections are actually removed from the diagram.
2024-02-03 13:52:07 +01:00
Arjan Molenaar
1413928833 Add failing test for undoing pasted data 2024-02-03 12:37:55 +01:00
Arjan Molenaar
095e806826 Lift minimal Python version to 3.11
Remove uses of exceptiongroup module. 3.11 has native support for those.
2024-01-17 18:23:42 +01:00
Dan Yeaw
45986ad94c
Enable import sort checks 2023-11-24 14:20:06 -05:00
Arjan Molenaar
9ad62aba1b
Test what happens if the undo is performed from an event handler 2023-05-11 11:34:30 +02:00
Arjan Molenaar
dc80bc6738
Avoid infinite rollback loops
It makes no sense trying to roll back a transaction that's
already being rolled back.
2023-05-11 11:18:53 +02:00
Arjan Molenaar
564093c80a
Fix infinite loop when undoing a removed applied stereotype 2023-05-10 22:03:15 +02:00
Dan Yeaw
eafb7f2b86
Replace flake8, isort, docformatter with ruff 2023-01-29 20:49:08 -05:00
Arjan Molenaar
df501a47a4
Add failing test for handle reconnect on same element 2022-10-03 12:07:59 +02:00
Arjan Molenaar
7103e5a1f4
Remove connected items from the diagram
E.g. when a class is removed, also remove the connected associations and
dependencies.
2022-09-10 11:59:43 +02:00
Arjan Molenaar
a9c7d6e4c2
Make ElementFactory create method idempotent
This allows us to create a diagram, required for
Presentation elements, and later in the undo transaction
"create" the same diagram.
An extra check is done for the type, to avoid unexpected
behaviors.
2022-04-12 17:40:35 +02:00
Arjan Molenaar
4a6721f88c
Create a failing test for issue #1457
A cyclic dependency causes the diagram to be removed when an item is
removed from the diagram.

The diagram can't be found while undoing.
2022-04-12 17:04:10 +02:00
Sourcery AI
7e064a465d 'Refactored by Sourcery' 2022-03-31 08:47:43 +02:00
Arjan Molenaar
bd21b14cab Queue events so creating a Reflexive Message can be undone
When handling events before the next we get a consistent record of
events that can be replayed in reverse order to undo an operation.
2022-03-31 08:47:43 +02:00
Arjan Molenaar
3466c2f2d2
Move presentation creation to element factory
Alongside all other model elements
2021-06-02 21:13:31 +02:00
Arjan Molenaar
374d2bf4de
Create diagram items after model items have been created 2021-05-25 22:49:39 +02:00
Arjan Molenaar
b46f80bde3
Add test for diagram delete and undo 2021-05-24 22:19:44 +02:00
Dan Yeaw
18e7d3f772
Fix expected number of elements for undo tests
Signed-off-by: Dan Yeaw <dan@yeaw.me>
2021-04-04 07:44:50 -04:00
Arjan Molenaar
ca85a7eb79
Split big undo test 2021-04-04 12:02:21 +02:00
Arjan Molenaar
555de03749
Fix undo of attributes and enumerations
By setting the default value on unlink.

Fixes #643.
2021-02-11 21:46:40 +01:00
Arjan Molenaar
d753312896
Do not set min-width in inline styles
Instead provide it to the constructor.

Maybe at a later point let each modeling language provide it's own style
sheet.
2021-02-07 18:00:42 +01:00
Arjan Molenaar
e49cae8649
Order undo events
So create happens before properties, before unlink events.
2021-02-05 19:58:56 +01:00
Arjan Molenaar
c59f49b910
Add tests for undoing connected relationships 2021-01-09 21:22:23 +01:00
Arjan Molenaar
d8de125158
Bypass sanitizer service when undoing a transaction 2021-01-09 21:22:20 +01:00
Arjan Molenaar
628496b983
Made connection in a diagram reversible 2021-01-09 21:22:16 +01:00
Arjan Molenaar
d3d75a5184
Can undo matrix changes 2021-01-09 21:22:11 +01:00
Arjan Molenaar
4488139927
Add test to check for excessive output when performing an undo 2021-01-01 11:49:30 +01:00
Arjan Molenaar
9627c0431f
Add transactions to tests that use undo manager 2020-12-30 17:48:45 +01:00
Arjan Molenaar
fefb1c249c
Remove all occurrences of canvas from the tests 2020-12-24 09:41:20 +01:00
Arjan Molenaar
22afb61267 Update code now aspects live in their own package 2020-11-16 21:58:29 +01:00
Arjan Molenaar
eff93402e5
Sync Gaphor with latest Gaphas 3 changes
https://github.com/gaphor/gaphas/pull/145
2020-11-12 22:09:42 -05:00
Arjan Molenaar
2e293adbce
Update Gaphor with latest Gaphas code
* no more Item.normalize()
* canvas.update() has been removed -> updates via GtkView
* Painter code has been reorganized
2020-11-12 22:09:29 -05:00
Dan Yeaw
4776b53c40
Reformat docstrings
Signed-off-by: Dan Yeaw <dan@yeaw.me>
2020-09-07 15:28:20 -04:00
Arjan Molenaar
836284c409 Fix #408 where undo on diagram items breaks the model
diagram items end up in the ElementFactory, because they emited
ElementCreated and ElementDeleted events.
2020-08-18 17:00:09 +02:00
Arjan Molenaar
e440e5315d Fix tests to handle omni-presence of Style sheets 2020-07-13 22:23:17 +02:00
Dan Yeaw
485c93bbc7
Remove unused imports
Signed-off-by: Dan Yeaw <dan@yeaw.me>
2020-07-04 16:09:39 -04:00
Arjan Molenaar
15d0ed6965 Bump Gaphas dependency to 2.1 2020-06-22 08:21:40 +02:00
Sourcery AI
75fbd1bf46 Refactored by Sourcery 2020-06-02 13:53:01 +00:00
Arjan Molenaar
5ea8cac035 Move gaphor.diagram.* items to UML package
Hotfix gaphor.core.modeling.elementdispatcher, since it has an explicit
dependency on the UML model. Should be moved out into a ModelProvider
service of some sort.
2020-04-12 23:11:31 +02:00
Arjan Molenaar
f84d7b8e31 Move EventManager to gaphor.core 2020-04-08 21:48:49 +02:00
Arjan Molenaar
f4591d7de9 Move ElementFactory to gaphor.core.modeling 2020-04-08 21:23:45 +02:00
Arjan Molenaar
7417ed1d72 Let old TestCase use sessions only
Convert test_undo to pytest and remove test_issue_132.
2020-01-30 10:01:51 +01:00
Dan Yeaw
05481db043
Sort imports 2019-11-09 20:27:01 -05:00
Dan Yeaw
913cdf334e
Change assert statements to pytest format
Signed-off-by: Dan Yeaw <dan@yeaw.me>
2019-05-25 22:41:46 -04:00
Arjan Molenaar
363600f463 Make imports more specific
Do not import from gaphor.diagram.items, but from their specific modules/packages.
2019-05-20 22:39:01 +02:00
Arjan Molenaar
553cc84a62 Remove comment, no longer applicable 2019-03-23 20:43:01 +01:00
Arjan Molenaar
815e1c5454 Restructure transaction test
This way there are no "left overs" that cause other tests to fail.
2019-03-11 20:32:44 +01:00
Dan Yeaw
f55e582299
Remove futurize dependency, drop support for Python 2
Signed-off-by: Dan Yeaw <dan@yeaw.me>
2019-02-23 22:06:02 -05:00