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

Feature/add shortcuts to diagram modes #8

Open
wants to merge 67 commits into
base: master
Choose a base branch
from

Conversation

justin2wilson
Copy link

@justin2wilson justin2wilson commented Aug 1, 2024

This MR adds keyboard shortcuts to various actions on the UI.

BobObara and others added 30 commits March 13, 2024 14:30
Added a virtual method to qtBaseTaskNode to setup a context menu for a qtTaskNode.
8136ca7 ENH: Added the ability to override context menus for qtTaskNodes

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3000
Also added an iterator section to an existing test.

Closes #530
767b5a9 BUG: Fixing Iterator API for ValueItems

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Reviewed-by: David Thompson <[email protected]>
Merge-request: !3001
SMTK XML Attribute File now supports instantiation of templates inside the Analyses
XML Element Block.
On some systems the layout was not allowing the contents to fully utilize the space available.
The widget now uses 2 layouts - a VBox for the toolbar (if needed) and a HBox for the drawer and diagram itself.
014d8f4 ENH: Replaced GridLayout in qtDiagram

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Reviewed-by: David Thompson <[email protected]>
Merge-request: !3005
6501704 Fix a reference-to-temporary issue.
fe03bef Fix a connect mode crash; allow modes to observe operations.

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3006
837e48a ENH: Added Template Support When Defining Analyses

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3004
You can now specify a category constraint as a category expression instead of defining it as sets of included and excluded category names.
This not only provided greater flexibility but is also easier to define.  For example in an SBT file this would like the following:

          <CategoryExpression InheritanceMode="Or">(a &amp; !b) &amp; (d | 'category with spaces') </CategoryExpression>

Note that in XML &amp; represents &

In this example the expression will match if the test set of categories contains **a** and either **d** or **category with spaces** but not **b**

Also bumped the file versions of both the XML (to version 8) and JSON (version 7) for Attribute Resources in order to support these changes.
71d276f ENH: Supporting Category Expressions

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3007
This one is actually in the source tree.
937102f smtk/attribute: install the `categories/Grammar.h` header

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Acked-by: Robert M. O'Bara <[email protected]>
Merge-request: !3008
ff1731a smtk/io: fix `XmlV8StringWriter.h` filename typo

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Acked-by: Robert M. O'Bara <[email protected]>
Merge-request: !3009
This updates the bundle to agree with the Xcode usage now deployed on
machines.
d1a4899 ci: update superbuild bundle for Xcode update

Acked-by: Kitware Robot <[email protected]>
Merge-request: !3010
d1a4899 ci: update superbuild bundle for Xcode update

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3010
This allows the Diagram Drawer to be resizable.
You can now use the following symbols to represent logical operators:

* And
  * ∧, *, &
* Or
  * ∨, +, |
* Complement
  * ¬, ~, !

Also expressions can now have white spaces at the beginning and end of the expression.
a09e8d4 ENH:  Expanding the symbols that can be used in Category Expressions

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3013
66596af ENH: Adding Splitter to Diagram UI

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3012
Starting in Version 8 XML Template Files, you can now define vector-based Properties on Attribute Resources and Attributes.
Currently vector of doubles and vectors of strings are supported but this can be easily extended.

Here is an example and is available in the data/attributes/attribute_collections directory as propertiesExample.sbt.

.. code-block:: XML

<SMTK_AttributeResource Version="8">
  <Properties>
    <Property Name="pi" Type="Int"> 42 </Property>
    <Property Name="pd" Type="double"> 3.141 </Property>
    <Property Name="ps" Type="STRING">Test string</Property>
    <Property Name="pb" Type="bool"> YES </Property>
    <Property Name="animals" Type="vector[string]">
      <Value>the dog</Value>
      <Value>a cat</Value>
    </Property>
  </Properties>
  <Definitions>
    <AttDef Type="Test"/>
  </Definitions>
  <Attributes>
    <Att Name="foo" Type="Test">
      <Properties>
        <Property Name="pi" Type="int"> 69 </Property>
        <Property Name="pd" Type="Double"> 3.141 </Property>
        <Property Name="ps" Type="String"></Property>
        <Property Name="pb" Type="Bool"> 1 </Property>
        <Property Name="pvd" Type="vector[double]">
          <Value>10.0</Value>
          <Value>20.0</Value>
        </Property>
      </Properties>
    </Att>
  </Attributes>
</SMTK_AttributeResource>
4ba3180 ENH: Supporting Vector Properties in XML Attribute Templates

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Reviewed-by: David Thompson <[email protected]>
Merge-request: !3014
DoubleItems can now have units explicitly assigned to them provided that their Definition does not
specify units.  This allows Items coming from the same Definition to have different units.

Modified API

* ``DoubleItemDefinition::hasSupportedUnits`` has been moved to ValueItemDefinition

Added API

* ValueItem
  * units() - returns the native units for the item
  * supportedUnits() - returns the supported units for the item.  If there is no Units System assigned to its definition or if its units are supported by the Units System, an empty string is returned else it returns its units.
* ValueItemDefinition
  * supportedUnits() - similar in concept as ValueItem's
* DoubleItem
  * setUnits() - explicitly sets the units of the item
  * units() - overridden to support explicit units
  * hasExplicitUnits() - returns true if the item has explicit units.

When changing the units of an Item, the system will see if the Item's current input string values are compatible, if they are not, the input value units are replaced with the new ones.

See smtk/attribute/testing/cxx/unitDoubleTest.cxx for an example.

Both XML and JSON formats have been updated to support this functionality as well as qtInputsItem.cxx, qtDoubleUnitsLineEdit{.h, .cxx}.
631e337 ENH: Supporting Explicit Units for DoubleItems

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3016
SMTK now supports the ability to assign a function to an Attribute Item that will
be used to determine if an Item is currently relevant.  ``Item::isRelevant``
method has been refactored and most of the original logic has been moved to a new method called ``Item::defaultIsRelevant``.
To set a custom relevancy function, use ``Item::setCustomIsRelevant``.

To determine if an Item is relevant you will still call ``isRelevant`` and it will use the custom relevancy function if one has been set, else it will call the default method.

Please see ``smtk/attribute/testing/cxx/customIsRelevantTest.cxx`` for an example of how to use this functionality.
vibraphone and others added 30 commits July 2, 2024 14:06
0ccb188 Fix #540 by using `units::PreferredUnits`.

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Acked-by: Robert M. O'Bara <[email protected]>
Merge-request: !3020
1. Attribute Resource Associations are now copied in ``copyFinalized()``

2. Attribute Active Categories are now copied in ``copyInitialized()``

3. Attribute Resource Analyses are now copied in ``copyInitialized()``
Also added assignment method to Analyses class.

4. Properties on Resources (in particular with Attribute and Graph Resources are now copied)
The issue was that source and copied resource uuids were not being added to the object mapping in
their clone methods.  **Note: All Resources that can be cloned will need to do this.**

5. Removed undefinedRole as the default role type when creating links. This lead
to mistakes where specified roles were not being used when creating between resources.
This role type has been removed. Resource based Links now use the same value to represent an Link with an invalid role type.
Also by default, links with invalid role types  will no longer be copied when a resource is copied.

smtk/resource/testing/python/testCloneResources.py has been updated to verify these changes.

Also replaced all std::cerr and std::cout statements in smtk/attribute/Resource.cxx with Logger messages.
57b3100 BUG: Adding Issues with Copying Attribute Resources

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3021
You can now assign units to Definitions and Attributes.  This can be useful when an Attribute
represents a concept that has units but does not have an explicit value.  For example, if an
Attribute represents a temperature field that would be created by a simulation, you may want to
assign a default unit to its Definition (such as Kelvin) but allow the user to change the
Attribute's units to Celsius.

The rules for assigning local units to an Attribute that override those inherited through its definition
are the same as the case of assigning a value with units to a ValueItem.
7fd49b5 ENH: Adding Units Support for Definitions and Attributes

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Reviewed-by: David Thompson <[email protected]>
Merge-request: !3023
The method will now the attribute specific copy options if they are provided.
Also removed explicit attribute copy options that are the defaults for the case no attribute copy options are provided.

Also added some additional outputs to the testCloneResources test.

This may be related to Issue #538
Closes #541
8391421 BUG: Attribute Resource Copy Finalize Ignoring Attribute Copy Options

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Reviewed-by: David Thompson <[email protected]>
Merge-request: !3024
0432f77 Add documentation of `qtItem` design patterns.
d6fd13c Fix an issue with the way 3-d widgets were updated.

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3025
5e9f789 Copy links properly.

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3026
Fixes sequencing issue with observers when operations are launched asynchronously.
:smtk:`smtk::attribute::Definition` now derives from :smtk:`smtk::resource::Component`.
This means that Definitions now have UUIDs and may also have properties.

**Note** You do not need to specify UUIDs in either the XML or JSON file formats.  If an
ID is not specified, one will be assigned to it.

**Note** All previous JSON and XML files are supported by this change.  Version 8 XML and 7 JSON files and later
will support storing the IDs.  These formats will also support properties defined on Definitions.
As in the case for properties on the Resource and Attributes, the XML format only supports reading properties.

Developer changes
~~~~~~~~~~~~~~~~~~

** API Breakage: ** Since classes derived from the resource component class must provide a
method to return a shared pointer to a :smtk:`smtk::resource::Resource` instance via a member functions called
resource() and since the Definition class already had a method called resource() that returned a shared pointer
to its owning :smtk:`smtk::attribute::Resource`, this resulted in breaking API.  A new method called attributeResource()
was added to Definition that provides that same functionality as its original resource() method.  A simple name replacement is
all that is needed to resolve compilation errors resulting from this change.

:smtk:`smtk::attribute::Attribute::setId()` method was not being properly supported and now generates an error message if called.

The code used to parse property information in XML files has been relocated from the XMLV5Parser to its own file so it
can be reused.
fb78645 ENH: Attribute Definitions are now Resource Components

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !3027
d8a4da4 Changes to "CallObserversOnMain" behaviors.

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3022
d7f0c3e BUG: Fixing Issue with Copying Items using Expressions

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Reviewed-by: David Thompson <[email protected]>
Merge-request: !3030
1d01633 TESTING: Modifying Test for XML Support for Properties on Definitions

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !3028
…sers

Also modified unitXmlReaderProperties.cxx and propertiesExample.sbt to
test these enhancements.
883db23 ENH: Adding Support for vector of int and long Properties for XML Parsers

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Reviewed-by: David Thompson <[email protected]>
Merge-request: !3031
Using the new ``qtUnitsLineEdit`` class, end-users can now set units on an Attribute (assuming that its Definition supports units).
This required changes to ``qtAttribute`` to not consider an Attribute *empty* if it had no items to display but did have specified units.

New XML Attribute for controlling how Units are displayed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can use UnitsMode to indicate how an Attribute's units should be displayed.

* none - do not display the attribute's units
* viewOnly - display but do not allow the units to be changed
* editable - allow the user to edit the attribute's units

**Note** that these values are case insensitive

See DoubleItemExample.sbt as an example that demonstrates this new functionality.

Line Edit widget with unit completion
-------------------------------------

The ``qtUnitsLineEdit.cxx`` class is for entering strings that represent units.
The widget provides a units aware completer as well as color coding its background
based on the entry being a valid unit or if the unit is the default.
as in the case of  ``qtDoubleUnitsLineEdit.cxx`` class, it can make use of the unit-library's
``PreferredUnits`` class to suggest unit completions. This allows
workflow developers to provide a tailored list of suggested completions
rather than listing every available compatible unit.

Changes to ``qtBaseAttributeView`` and Derived View Classes
------------------------------------------------------------

* Added displayAttribute method that returns true if the attribute should be displayed based on its relevance.
* Changed displayItem to take in a ``const smtk::attribute::ItemDefinitionPtr&`` instead of a ``smtk::attribute::ItemDefinitionPtr`` **Note** that this does break API though it is very simple to update to the new API

Also added the ability to print out a reference item's acceptance/rejection criteria - for debugging purposes
6480331 ENH: Displaying Attribute with Units

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Reviewed-by: David Thompson <[email protected]>
Merge-request: !3032
Needed to use the latest version of Units Library that supports "*" units.
1861c0d ENH: Updated CI for SMTK

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !3033
Definitions can now be assigned "*" for their units. This indicates that
Attributes being defined by the Definition or Definitions derived from it can be assigned any unit that is supported by its units system.

Definitions can now inherit the units from their base Definition.  When overriding the units being inherited, by default a Definition's units must be compatible with the units coming from its base Definition, though the method provides an option to force units to be set even if they are not compatible.

Attributes whose Definition's units are "*" are initially considered unit-less.

Please see `unitAttributeUnits <https://gitlab.kitware.com/cmb/smtk/-/blob/master/smtk/attribute/testing/cxx/unitAttributeUnits.cxx>`_ for a simple example of using units with Attributes and Definitions.

**Note** The method Definition::setUnits has been renamed Definition::setLocalUnits to be in line with Attribute's API since as in the case of Attributes, Definitions can now inherit units from their base Definitions.

Also moved the validator for qtUnitsLineEdit out of qtAttribute and into qtUnitsLineEdit
ee7d27c ENH: Supporting Definitions that can take any units

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !3034
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants