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

✨Directly connect parameter inPort to its literal node #196

Merged
merged 5 commits into from
Sep 22, 2022

Conversation

AdrySky
Copy link
Contributor

@AdrySky AdrySky commented Sep 19, 2022

Description

This will automatically connect to its literal node when link is dropped from a parameter InPort. There are 2 type of implementation:

  1. Non-any type - Drag a link should automatically render the correct literal node.

non-any type literal

  1. any type - The literal node's type is render based on the first character of the given input.

any type literal

Types taken into consideration for any type are :

  1. 1 - Int
  2. . - Float
  3. " - String
  4. [ - List
  5. ( - Tuple
  6. { - dict
  7. !true / !True/ !1/ !t - True
  8. !false / !False / !0 / !nil - False

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

  1. Drag link from non-any type InPorts
    1. Drag a node which have inPorts with non-any type
    2. Dropped a link from the port
    3. A input dialog should popup based on its type
    4. Insert any input and submit it
    5. That port should be connected to its literal node
  2. Drag link from any type InPorts
    1. Drag a node which have inPorts with any type
    2. Dropped a link from the port
    3. A input dialog should popup
    4. Insert the first character mentioned above based on the type you want. Follow by, the input and submit it.
    5. That port should be connected to its literal node.

Tested on?

  • Windows
  • Linux Ubuntu
  • Centos
  • Mac
  • Others (State here -> xxx )

@AdrySky AdrySky added the enhancement New feature or request label Sep 19, 2022
@AdrySky AdrySky requested a review from MFA-X-AI September 19, 2022 09:09
@AdrySky AdrySky self-assigned this Sep 19, 2022
Copy link
Member

@MFA-X-AI MFA-X-AI left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I've tried out the new feature, feels super nice to use. Hope to get this merged soon!

Some things to note:

  1. Dragging a literal component from the tray doesn't prompt the input dialog
  2. For the float input.. it wasn't included in the tooltip description, but it feels a bit wonky to input .0.1. Let's piggy back on the integer notation using # then do an additional check if the input has a decimal or not. Don't forget to include the tooltip as well.

Those two for now. Thanks again for the PR!

@AdrySky
Copy link
Contributor Author

AdrySky commented Sep 21, 2022

Thanks for the reviewed. I wasn't aware the sidebar's literal was broken. Fix that.

For the float, I made the changes as requested. Even add a check if there is non-numeric value, it'll show an error dialog.
You can also insert like 12e3. It's a valid Numeric value in python and can be render.

Also, change a bit regarding any type when first character is undefined, it'll show error.

Copy link
Member

@MFA-X-AI MFA-X-AI left a comment

Choose a reason for hiding this comment

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

Feels solid. I've tested all the parameters and can confirm each correctly prompts the right input dialogue and renders the right node.

image

def main(args):

    ctx = {}
    ctx['args'] = args

    c_1 = HelloParameters()

    c_1.input_int.value = 1
    c_1.input_float.value = 1e2
    c_1.input_str.value = """asd"""
    c_1.input_bool.value = True
    c_1.input_list.value = [1,2,3]
    c_1.input_tuple.value = (1,2,3)
    c_1.input_dict.value = {"a":1}
    c_1.input_any.value = False

Great work, merging with main.

@MFA-X-AI MFA-X-AI merged commit 745349f into master Sep 22, 2022
@MFA-X-AI MFA-X-AI deleted the adry/inport-literal-node branch September 22, 2022 03:33
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.

2 participants