MetalGUI

class MetalGUI(design: QDesign = None)[source]

Main Qt window for interacting with a Qiskit Metal design.

MetalGUI wraps a QDesign and gives you a synchronized visual view of components, variables, and geometry. Anything you do in the GUI (add/edit components, tweak options, rebuild) updates the underlying design object, and Python-side edits show up in the GUI after a rebuild.

Key behaviors and subtleties: - Starts a Qt event loop if one is not already running. - Exposes docks for components, connectors, variables, and logs; you can

hide/show or undock them without breaking synchronization.

  • The plot window shows the current QGeometry; call rebuild() after changing component options to refresh geometry before exporting or autoscaling.

  • Some imports are skipped when config.is_building_docs() is true to keep doc builds lean; avoid that flag in interactive GUI sessions.

Create a GUI bound to the provided design (or create one later).

Parameters:

design (QDesign, optional) – The design to visualize and edit. You can also call set_design after constructing the GUI. When passed, the GUI will immediately populate docks and the canvas from this design. Defaults to None.

Attributes

axes

Returns the axes.

canvas

Get access to the canvas that handles the figure and axes, and their main functions.

Returns:

The canvas

Return type:

PlotCanvas

figure

Return axis to the figure of the canvas.

path_stylesheets

Returns the path to the stylesheet.

Methods

autoscale()[source]

Shortcut to autoscale all views.

btn_comp_zoom_fx()[source]

Zooms in display on selected QComponent

clear_settings()

Clear the settings that get saved each time the main window is closed.

This will reset the window layout to the default.

create_log_handler(name_toshow: str, logger: Logger)

Creates a log handler.

Parameters:
  • name_toshow (str) – Display name

  • logger (logging.Logger) – The logger

Returns:

A LogHandler_for_QTextLog

Return type:

LogHandler_for_QTextLog

dockLibrary_filter_onChanged(text)[source]

Text changed event for filter_text_design :param text: Text typed in the filter box.

edit_component(name: str)[source]

Make the named component active in the component editor widget.

Parameters:

name (str) – Component name to load. Must exist in design.components.

Note

This does not rebuild geometry; use rebuild() if options are changed.

elements_lineEdit_2_onChanged(text)[source]

Text changed event for QGeometry/Layer text box :param text: Text typed in the filter box.

elements_lineEdit_onChanged(text)[source]

Text changed event for QGeometry/Component text box :param text: Text typed in the filter box.

filter_text_design_onChanged(text)[source]

Text changed event for filter_text_design :param text: Text typed in the filter box.

get_axes(num: int = None)[source]

Return access to the canvas axes. If num is specified, returns the n-th axis.

Parameters:

num (int, optional) – If num is specified, returns the n-th axis. Defaults to None.

Returns:

Of the canvas

Return type:

List[Axes] or Axes

gui_create_build_log_window(_=None)[source]

Creates a separate window that displays the recent successful/fails of all components for the design.

Parameters:

_ (object, optional) – Default parameters for slot - used to call from action

highlight_components(component_names: List[str])[source]

Visually highlight components in the plot canvas.

Parameters:

component_names (List[str]) – Names to highlight; others remain unhighlighted.

load_stylesheet(path=None)

Load and set stylesheet for the main gui.

Parameters:

path (str) – Path to stylesheet or its name. Can be: ‘default’, ‘qdarkstyle’ or None. qdarkstyle requires >>> pip install qdarkstyle

Returns:

False if failure, otherwise nothing

Return type:

bool

Raises:

ImportError – Import failure

rebuild(autoscale: bool = False)[source]

Rebuild all components and refresh the GUI.

Calls design.rebuild() (regenerates QGeometry for all components), then refreshes tables and plots. Optionally autoscale after the redraw.

Parameters:

autoscale (bool) – If True, call self.autoscale() after refresh.

refresh()[source]

Refreshes everything. Overkill in general.

  • Refreshes the design names in the gui

  • Refreshes the table models

  • Replots everything

Warning

This does not rebuild the components. For that, call rebuild.

refresh_design()[source]

Refresh design properties associated with the GUI.

refresh_plot()[source]

Redraw only the plot window contents.

save_file()[source]

Save file. Called on exit.

Raises:

NotImplementedError – Function not written

screenshot(name='shot', type_='png', display=True, disp_ops=None)

Alias for get_screenshot().

set_design(design: QDesign)[source]

Bind a QDesign to the GUI and refresh all views.

This wires the provided design into the plot window, component lists, netlist, variables table, and any renderer sub-GUIs (GDS/HFSS/Q3D). Call this once after constructing the GUI or when swapping designs.

Parameters:

design (QDesign) – The design to visualize/edit. Must be non-None.

set_font_size(font_size: int)

Set font size of the applicaiton globally in points.

Parameters:

font_size (int) – New font size

show()

Show the main window.

style_window()

Styles the window.

toggle_docks(do_hide: bool = None)[source]

Show or hide the full plot-area widget / show or hide all docks.

Parameters:

do_hide (bool) – Hide or show. Defaults to None – toggle.

update_design_name()[source]

Update the design name.

zoom_on_components(components: List[str])[source]

Zoom the canvas to fit the given components.

Parameters:

components (List[str]) – Names of components to frame.