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

feat(data_hierarchy): implement changes for data type row #351

Merged

Conversation

jmurugan-fzj
Copy link
Contributor

@jmurugan-fzj jmurugan-fzj commented Oct 14, 2024

  • For "Data type" row: Modified to include a combo-box (listing all doc type labels), Add, Edit and Delete buttons

  • Add functionality

    • Should show the existing form with following entries:
      • Data type (LineEdit)
      • Title (LineEdit)
      • IRI (LineEdit)
      • Shortcut key combination (LineEdit)
      • Icon (LineEdit or drop-down for the list of icons?)
    • Removed "is structural type" checkbox from the form
  • Edit functionality

    • Edit form is an extension of add form, except for the data type entry which is read only. Also for "structure level type", icon and shortcut entries are read only items
  • Delete functionality

    • Similar as before, should be disabled for structural items
  • Structure level 0 & Structure level 1 are only supported, delete functionality should be disabled for both. Edit form for "structure level type" displays icon and shortcut as read only items

Summary by Sourcery

Refactor the data hierarchy editor to separate the creation and editing of data types into distinct dialogs, enhancing the user interface and validation. Introduce a singleton class for managing QTA icons and add comprehensive tests for the new features.

New Features:

  • Introduce a new dialog for editing existing data types, allowing users to modify attributes like IRI, title, shortcut, and icon.
  • Add a new dialog for creating data types with fields for data type, title, IRI, shortcut, and icon.
  • Implement a singleton class for managing QTA icons, ensuring only one instance is used throughout the application.

Enhancements:

  • Refactor the data hierarchy editor to separate the creation and editing of data types into distinct dialogs.
  • Improve the user interface by adding tooltips and disabling certain fields when editing existing data types.
  • Enhance the validation of data type information using a dedicated validator class.

Tests:

  • Add comprehensive unit tests for the new create and edit type dialogs, covering various scenarios and edge cases.
  • Introduce tests for the QTAIconsSingleton class to ensure correct initialization and icon management.
  • Implement tests for the DataTypeInfo and its validator to verify correct behavior and error handling.

Additional Info: Pyside6 version has been fixed to 6.7.3 since there is some incompatibility between the dependent libraries with the latest PySide6 6.8.0, The issue is already backlogged: PASTA APP crashes with segmentation fault

@jmurugan-fzj jmurugan-fzj linked an issue Oct 14, 2024 that may be closed by this pull request
@jmurugan-fzj jmurugan-fzj self-assigned this Oct 14, 2024
@jmurugan-fzj jmurugan-fzj added the enhancement New feature or request label Oct 14, 2024
Copy link

sourcery-ai bot commented Oct 14, 2024

Reviewer's Guide by Sourcery

This pull request implements significant changes to the data hierarchy editor dialog in the PASTA-ELN application. The changes focus on improving the functionality for creating and editing data types, enhancing the user interface, and refactoring the codebase for better maintainability.

User journey diagram for data type row changes

journey
    title User journey for data type row changes
    section Data Type Row
      User selects data type from combo-box: 5: User
      User clicks Add button: 5: User
      System displays form with data type, title, IRI, shortcut, icon: 5: System
      User fills form and submits: 5: User
      System saves new data type: 5: System
      User clicks Edit button: 5: User
      System displays form with read-only data type, icon, shortcut: 5: System
      User modifies title and IRI: 5: User
      System saves changes: 5: System
      User clicks Delete button: 5: User
      System checks if data type is structural: 5: System
      System disables delete for structural types: 5: System
Loading

File-Level Changes

Change Details Files
Refactored and enhanced the data hierarchy editor dialog
  • Replaced CreateTypeDialog with a more generic TypeDialog class
  • Implemented EditTypeDialog for editing existing data types
  • Updated UI elements and callbacks in DataHierarchyEditorDialog
  • Modified the data structure for storing data hierarchy types
  • Improved error handling and user feedback
pasta_eln/GUI/data_hierarchy/data_hierarchy_editor_dialog.py
pasta_eln/GUI/data_hierarchy/data_hierarchy_editor_dialog_base.py
tests/unit_tests/test_data_hierarchy_editor_dialog.py
Introduced new classes for managing data types and icons
  • Created DataTypeInfo class to represent data type information
  • Implemented DataTypeInfoValidator for validating DataTypeInfo instances
  • Added QTAIconsSingleton for managing icon collections
  • Created EditTypeDialog for editing existing data types
pasta_eln/dataverse/data_type_info.py
pasta_eln/dataverse/data_type_info_validator.py
pasta_eln/GUI/data_hierarchy/qtaicons_singleton.py
pasta_eln/GUI/data_hierarchy/edit_type_dialog.py
Updated utility functions and data structures
  • Modified can_delete_type function to handle structural levels differently
  • Updated generate_data_hierarchy_type function to use DataTypeInfo
  • Removed get_next_possible_structural_level_title function
  • Modified the structure of data hierarchy types in fixedStringsJson.py
pasta_eln/GUI/data_hierarchy/utility_functions.py
pasta_eln/fixedStringsJson.py
Expanded and updated test suite
  • Added new test files for DataTypeInfo, DataTypeInfoValidator, and QTAIconsSingleton
  • Updated existing tests to reflect changes in the data hierarchy editor dialog
  • Modified test fixtures and mocks to accommodate new class structures
tests/unit_tests/test_data_hierarchy_create_type_dialog.py
tests/unit_tests/test_data_hierarchy_edit_type_dialog.py
tests/unit_tests/test_data_hierarchy_type_dialog.py
tests/unit_tests/test_data_hierarchy_icon_names.py
tests/unit_tests/test_data_hierarchy_data_type_info.py
tests/unit_tests/test_data_hierarchy_data_type_info_validator.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jmurugan-fzj - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The refactoring to use a common TypeDialog base class for create and edit dialogs is a good improvement for code reuse and maintainability. Consider adding some high-level documentation explaining the class hierarchy and responsibilities.
  • The new icon selection functionality looks good, but it may be worth adding some user documentation or tooltips to explain how to use this feature effectively.
Here's what I looked at during the review
  • 🟡 General issues: 8 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 6 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@jmurugan-fzj
Copy link
Contributor Author

@SteffenBrinckmann Could you please do the review, had fixed all the failing problems and addressed valid comments from Sourcery too!

Copy link
Contributor

@SteffenBrinckmann SteffenBrinckmann left a comment

Choose a reason for hiding this comment

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

@jmurugan-fzj Pyside6.8.0.1 was released today, just 5 days after 6.8.0 and they usually do not release 4-digit releases. It makes me think, did the issue you encounter, occur to them too and they have fixed it. Can you try to relax the requirements (without =6.7.3) and see if it works now?

@jmurugan-fzj jmurugan-fzj merged commit 763574a into main Oct 15, 2024
10 checks passed
@jmurugan-fzj jmurugan-fzj deleted the 329-datahierarchy-editor-version-20-type-row-changes branch October 15, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datahierarchy editor version 2.0
2 participants