Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagram metadata #2082

Merged
merged 8 commits into from
Feb 16, 2023
Merged

Diagram metadata #2082

merged 8 commits into from
Feb 16, 2023

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Feb 11, 2023

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Chore (refactoring, formatting, local variables, other cleanup)
  • Documentation content changes

What is the current behavior?

Issue Number: #803

What is the new behavior?

Add a diagram item that can provide diagram meta data.

  • Should this diagram item be backed by a model element, or is this data really diagram specific?
  • Add Property page to edit fields in metadata block
  • Hide unused fields?

Other information

@amolenaar amolenaar marked this pull request as draft February 11, 2023 16:46
@github-actions github-actions bot added the python Pull requests that update Python code label Feb 11, 2023
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 11, 2023

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.81%.

Quality metrics Before After Change
Complexity 2.53 ⭐ 3.21 ⭐ 0.68 👎
Method Length 61.42 🙂 63.42 🙂 2.00 👎
Working memory 6.85 🙂 7.33 🙂 0.48 👎
Quality 74.00% 🙂 72.19% 🙂 -1.81% 👎
Other metrics Before After Change
Lines 839 988 149
Changed files Quality Before Quality After Quality Change
gaphor/UML/tests/test_diagramitems.py 88.56% ⭐ 88.53% ⭐ -0.03% 👎
gaphor/diagram/diagramtoolbox.py 69.83% 🙂 72.04% 🙂 2.21% 👍
gaphor/diagram/shapes.py 67.26% 🙂 63.64% 🙂 -3.62% 👎
gaphor/diagram/general/__init__.py 87.34% ⭐ 85.46% ⭐ -1.88% 👎
gaphor/diagram/general/generalpropertypages.py 75.45% ⭐ 78.99% ⭐ 3.54% 👍
gaphor/diagram/general/tests/test_generalpropertypages.py 90.38% ⭐ 90.86% ⭐ 0.48% 👍
gaphor/diagram/tests/test_shapes.py 84.01% ⭐ 83.39% ⭐ -0.62% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
gaphor/diagram/shapes.py Box.draw_vertical 18 🙂 294 ⛔ 19 ⛔ 25.36% 😞 Try splitting into smaller methods. Extract out complex expressions
gaphor/diagram/shapes.py Box.draw_horizontal 17 🙂 264 ⛔ 19 ⛔ 27.33% 😞 Try splitting into smaller methods. Extract out complex expressions
gaphor/diagram/shapes.py IconBox.child_pos 7 ⭐ 178 😞 13 😞 48.11% 😞 Try splitting into smaller methods. Extract out complex expressions
gaphor/diagram/shapes.py Box.size 6 ⭐ 117 🙂 14 😞 54.21% 🙂 Extract out complex expressions
gaphor/diagram/shapes.py ellipse 1 ⭐ 147 😞 12 😞 58.61% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@amolenaar amolenaar marked this pull request as ready for review February 12, 2023 23:12
@danyeaw danyeaw added the feature A new feature label Feb 13, 2023
@danyeaw
Copy link
Member

danyeaw commented Feb 13, 2023

How do I add metadata to a diagram?

2 similar comments
@danyeaw
Copy link
Member

danyeaw commented Feb 13, 2023

How do I add metadata to a diagram?

@danyeaw
Copy link
Member

danyeaw commented Feb 13, 2023

How do I add metadata to a diagram?

@amolenaar
Copy link
Member Author

I forgot: it still needs a proper icon.

@amolenaar
Copy link
Member Author

@danyeaw @vanillajonathan Added an icon.

image

NB. All fields are saved in the diagram item. There's no model element with "shared" data.

@vanillajonathan
Copy link
Contributor

Looks good, maybe the Gtk.Entry for the license could have proposals for some SPDX license identifiers such as CC-PDDC. CC0-1.0, CC-BY-NC-4.0, CC-BY-NC-SA-4.0, CC-BY-SA-4.0, GFDL-1.3-or-later.

Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fantastic, I really like how it turned out! It is simple to add metadata to a diagram, and I think it was the right approach to save it to the diagram instead of creating a separate element.

I have two minor comments about naming.

gaphor/diagram/general/metadata.py Outdated Show resolved Hide resolved
gaphor/diagram/general/metadata.py Outdated Show resolved Hide resolved
@amolenaar
Copy link
Member Author

amolenaar commented Feb 15, 2023

Looks good, maybe the Gtk.Entry for the license could have proposals for some SPDX license identifiers such as CC-PDDC. CC0-1.0, CC-BY-NC-4.0, CC-BY-NC-SA-4.0, CC-BY-SA-4.0, GFDL-1.3-or-later.

I'd like to postpone this until we get rid of the GTK3 code. GTK4 does not have a nice editable dropdown by itself (GtkComboBoxText is deprecated).

@danyeaw danyeaw merged commit 50f1cc8 into main Feb 16, 2023
@danyeaw danyeaw deleted the diagram-metadata branch February 16, 2023 01:03
@vanillajonathan
Copy link
Contributor

Looks good, maybe the Gtk.Entry for the license could have proposals for some SPDX license identifiers such as CC-PDDC. CC0-1.0, CC-BY-NC-4.0, CC-BY-NC-SA-4.0, CC-BY-SA-4.0, GFDL-1.3-or-later.

I'd like to postpone this until we get rid of the GTK3 code. GTK4 does not have a nice editable dropdown by itself (GtkComboBoxText is deprecated).

GTK 3 have EntryCompletion for the Gtk.Entry widget. GTK 4 also have EntryCompletionbut it is deprecated since 4.1.0.

https://discourse.gnome.org/t/replacement-for-entrycompletion/13505

@amolenaar amolenaar added this to the 2.17 milestone Mar 6, 2023
@danyeaw danyeaw mentioned this pull request Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants