Skip to content

web: a script view for gui:: commands with no Qt window - #11943

Open
jorge-ferreira-pii wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:issue11488-2-web-script-view
Open

jorge-ferreira-pii wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:issue11488-2-web-script-view

Conversation

@jorge-ferreira-pii

@jorge-ferreira-pii jorge-ferreira-pii commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Part 2 of 9 for #11488. On top of PR #11942.

With no Qt window, gui::set_display_controls, gui::check_display_controls, gui::save_display_controls, gui::restore_display_controls and gui::fit now work. They act on a copy of the Qt Display Controls panel kept by the web viewer, with the same control names and the same defaults as Qt. A new test compares that copy with the real Qt panel, control by control.

The on/off switches of the debug renderers (placement, routing, and so on) are now one shared set for Tcl and for the browser, so a script and the viewer always agree.

gui.i and gui.tcl now build without Qt too, so a script can call the
gui:: commands in any build; with no window they still log GUI-0001.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
With no Qt window, the display controls act on a copy of the Qt
display-control tree kept by the web viewer, with the same paths and defaults.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@github-actions

Copy link
Copy Markdown
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request enables GUI Tcl commands (such as display controls and fit) to function in builds without Qt by introducing a server-side ScriptView and DisplayControlTree that mirror the Qt display-control tree's paths and defaults. It also refactors renderer controls into a dedicated RendererControls class shared between the script view and the web viewer. Feedback was provided to optimize the site visibility default computation in DisplayControlTree::addDesignRows to avoid redundant map lookups and erasures inside nested loops.

Comment thread src/web/src/display_control_tree.cpp Outdated
Comment on lines +180 to +200
// DisplayControls::libInit: a site starts as Rows is when it is added.
for (odb::dbLib* lib : db->getLibs()) {
for (odb::dbSite* site : lib->getSites()) {
const std::string path = std::string(kRows) + "/" + site->getName();
if (leaves_.contains(path)) {
continue;
}
bool on = true;
if (const Leaf* rows = find(kRows)) {
on = rows->visible.value_or(false);
} else {
for (const auto& [other, leaf] : leaves_) {
if (other.starts_with(std::string(kRows) + "/")) {
on = on && leaf.visible.value_or(false);
}
}
}
leaves_.erase(kRows);
addLeaf(path, {.visible = on, .selectable = on});
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The site visibility default value on and the removal of the kRows leaf can be computed once before the loops. Currently, they are computed and erased repeatedly inside the nested loops, which results in redundant map lookups, string prefix checks, and an $O(N^2)$ complexity where $N$ is the number of sites. Moving this logic outside the loops simplifies the code and improves efficiency.

  // DisplayControls::libInit: a site starts as Rows is when it is added.
  bool on = true;
  if (const Leaf* rows = find(kRows)) {
    on = rows->visible.value_or(false);
    leaves_.erase(kRows);
  } else {
    for (const auto& [other, leaf] : leaves_) {
      if (other.starts_with(std::string(kRows) + "/")) {
        on = on && leaf.visible.value_or(false);
      }
    }
  }

  for (odb::dbLib* lib : db->getLibs()) {
    for (odb::dbSite* site : lib->getSites()) {
      const std::string path = std::string(kRows) + "/" + site->getName();
      if (leaves_.contains(path)) {
        continue;
      }
      addLeaf(path, {.visible = on, .selectable = on});
    }
  }

Rows' default for new sites is worked out once, a renderer control's color
is reported as ignored, and RendererControls::check takes the default for a
path it has no value for.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…ipt-view

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
The web server's fixes took those IDs on master.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@jorge-ferreira-pii
jorge-ferreira-pii marked this pull request as ready for review November 5, 2026 11:18
…ript-view

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
Master took those IDs while this was in review.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants