Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/naja_schematic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- From a shell: ``naja-schematic --verilog design.v --open`` serves the
viewer page and opens it in a browser.
"""
__version__ = "0.1.0"
__version__ = "0.1.1"

from .protocol import diagnosis_response, handle_request

Expand Down
8 changes: 7 additions & 1 deletion python/naja_schematic/static/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ function render({ model, el }) {
injectStyle();
const wrap = document.createElement("div");
wrap.className = "naja-schematic-wrap";
// Right-click belongs to the viewer (its tree and schematic context menus
// hold Show Equipotential, Trace to Driver, ...). JupyterLab opens its own
// cell menu on top unless the target is inside this attribute.
wrap.setAttribute("data-jp-suppress-context-menu", "");
wrap.style.height = `${model.get("height")}px`;
const canvas = document.createElement("canvas");
canvas.className = "naja-schematic-canvas";
canvas.tabIndex = -1;
canvas.addEventListener("contextmenu", (e) => e.preventDefault());
// Also keep the event from reaching other hosts' menu handlers (classic
// Notebook, VSCode, Colab) and suppress the browser's own menu.
canvas.addEventListener("contextmenu", (e) => { e.preventDefault(); e.stopPropagation(); });
// Keyboard input only goes to the viewer while it has focus.
canvas.addEventListener("mousedown", () => canvas.focus());
const status = document.createElement("div");
Expand Down
9 changes: 9 additions & 0 deletions src/EquipotentialView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,15 @@ void EquipotentialView::renderSchematic(const std::vector<Equipotential*>& equip
}

g_schematic.render(dl, cpos, inner);
if (equipotentials.empty()) {
// Nothing drawn yet: the schematic is only ever filled from a pin's
// context menu, which a first-time user has no way to guess.
const char* hint = "Right-click a pin in the Netlist Hierarchy (e.g. top > Terms > a port)\n"
"and choose Show Equipotential or Trace to Driver.";
ImVec2 ts = ImGui::CalcTextSize(hint);
dl->AddText(ImVec2(cpos.x + (inner.x - ts.x) * 0.5f, cpos.y + (inner.y - ts.y) * 0.5f),
IM_COL32(120, 120, 120, 255), hint);
}
ImGui::EndChild();

// Scrollbars
Expand Down
Loading