Skip to content

fix(ui): automatically update component editability on connection and deletion changes - #143

Merged
Koyandechirag merged 1 commit into
FOSSEE:masterfrom
muaviz:fix/dynamic-component-editability
Nov 13, 2026
Merged

Koyandechirag merged 1 commit into
FOSSEE:masterfrom
muaviz:fix/dynamic-component-editability

Conversation

@muaviz

@muaviz muaviz commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Fixes an issue where components connected downstream of another component remained disabled/read-only even after the upstream component or connection line was deleted following a
simulation.

With this change, component editability dynamically reflects the live graph connection state on the canvas:

  • If a component is connected to the output of an upstream component (e.g. an intermediate or product stream), its property window inputs are disabled/read-only.
  • If a component is not connected to any upstream component (a feed stream or isolated component), its property window is immediately re-enabled/editable, even if a simulation was
    previously executed.
  • If a connection is restored or re-created, the downstream component becomes read-only again.

Key Changes

  1. Centralized Editability Synchronization (Container.update_components_editability):

    • Added update_components_editability() to evaluate every component's incoming connection state on the canvas.
    • For MaterialStream, calls disableInputDataTab when fed by an upstream unit, and enableInputDataTab when it has no upstream feed.
    • For other components, ensures isolated or un-fed components are editable (set_read_only(False)).
  2. Triggering on Canvas State Changes:

    • Node and Line Deletions (Container.delete): Triggers update_components_editability() immediately after removing deleted nodes and lines from the scene.
    • Socket Connections (Graphics.mouseReleaseEvent): Recalculates editability as soon as an inlet or outlet line is connected.
    • Undo / Redo & Canvas Reload (Graphics.load_canvas_from_snapshot): Recalculates editability after rebuilding components and lines.
    • Dynamic Socket Port Resizing (Graphics.update_input_ports, update_output_ports): Recalculates editability when ports are modified.
    • Simulation Results (Container._populate_results): Updates editability preserving connection-based restrictions across all components without permanently locking
      disconnected units.
  3. Stream State Controls (Streams.enableInputDataTab & Streams.disableInputDataTab):

    • Implemented enableInputDataTab() to safely re-enable the flash mode combo box, P/T/flow line edits, composition mole fractions (x_pclist), thermodynamic package dropdown,
      and Submit button.
    • Hardened disableInputDataTab() with safe attribute checks.
  4. Automated Unit Tests (TestDynamicComponentEditability in tests/test_container.py):

    • Added unit tests covering:
      • Component becoming read-only when connected downstream.
      • Component becoming editable when the connection line is deleted.
      • Component becoming editable when the upstream component is deleted.
      • Full post-simulation lifecycle (MS1, MS2 -> Mixer -> MS3 simulated, Mixer deleted, MS3 verified editable immediately).
      • Reconnecting and disconnecting cycles.
      • Isolated component editability.

@Koyandechirag
Koyandechirag merged commit e5b5c0d into FOSSEE:master Nov 13, 2026
1 check passed
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.

2 participants