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

Error when Renaming Quadrant in FlowKit #243

Open
catcd opened this issue Feb 26, 2025 · 1 comment
Open

Error when Renaming Quadrant in FlowKit #243

catcd opened this issue Feb 26, 2025 · 1 comment

Comments

@catcd
Copy link

catcd commented Feb 26, 2025

Describe the bug
When renaming a Quadrant object in FlowKit, the name field is created (previously, it does not exist), but the id field retains the old name. Additionally, when retrieving the parent QuadrantGate using get_gate, the quadrants dictionary still uses the old name as the key. This causes subsequent gating operations to fail.

Steps to Reproduce

  1. Create a QuadrantGate with multiple quadrants.
  2. Rename one of the quadrants.
  3. Retrieve the gate using get_gate.
  4. Check the quadrants dictionary inside the parent QuadrantGate.
  5. Attempt to perform further gating operations.

Expected Behavior

  • When renaming a Quadrant, both name (if needed) and id fields should be updated consistently.
  • The QuadrantGate's quadrants dictionary should reflect the updated name as the key.
  • Subsequent gating operations should function correctly.

Observed Behavior

  • The id field retains the old quadrant name.
  • The name field is created with new name
  • The parent QuadrantGate still references the old name in its quadrants dictionary.
  • Subsequent gating operations fail.

Desktop (please complete the following information):

  • OS: Windows 11
  • Python version: 3.11
  • FlowKit version: 1.2.3
@catcd
Copy link
Author

catcd commented Feb 26, 2025

Image

Here is my code to fix this bug. I am not sure if it is optimized but I hope it helps you identify the issue.

# Need to change the gate node name & the gate's gate_name attribute
gate_node.name = new_gate_name
# CATCD EDITED CODE
if isinstance(gate, fk_gates.Quadrant):
    gate.id = new_gate_name

    gate_node.ancestors[-1].gate.quadrants[new_gate_name] = gate_node.ancestors[-1].gate.quadrants.pop(gate_name)
else:
    gate.gate_name = new_gate_name
# OLD CODE
# gate.gate_name = new_gate_name

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

No branches or pull requests

1 participant