gui_components module

Components of the GUI.

class gui_components.ButtonsWidget(*args: Any, **kwargs: Any)

Bases: wx.BoxSizer

Widget containing the control buttons.

Parameters
  • parent – parent window.

  • on_run – function to handle event of pressing run button.

  • on_continue – function to handle event of pressing continue button.

class gui_components.Canvas(*args: Any, **kwargs: Any)

Bases: wx.glcanvas.GLCanvas

Handle all drawing operations.

This class contains functions for drawing onto the canvas. It also contains handlers for events relating to the canvas.

Parameters
  • parent – parent window.

  • id – unique id.

  • pos – position of canvas.

  • size – size of canvas.

  • devices – instance of the devices.Devices() class.

  • network – instance of the network.Network() class.

  • monitors – instance of the monitors.Monitors() class.

draw_signal(signal, offset, colour_index)

Draw line for a given signal.

init_gl()

Configure and initialise OpenGL context.

on_mouse(event)

Handle mouse events.

on_paint(event)

Handle paint event.

on_size(event)

Handle canvas resize event.

Forces reconfiguration of the viewport, modelview and projection matrices on the next paint event.

render()

Handle all drawing operations.

render_text(text, x_pos, y_pos)

Handle text drawing operations.

class gui_components.ConnectionsWidget(*args: Any, **kwargs: Any)

Bases: wx.BoxSizer

Widget containing controls to add and remove connections.

Parameters
  • parent – parent window.

  • names – instance of the names.Names() class.

  • devices – instance of the devices.Devices() class.

  • network – instance of the network.Network() class.

add_connection(device1_id, pin1_id, device2_id, pin2_id)

Add a connection between input of device1 and output of device2.

break_connection(device1_id, pin1_id, device2_id, pin2_id)

Break an existing connection.

on_connect_button(event)

Handle event of user pressing connect button.

If all three dropdowns are not selected, error is shown.

If all three dropdowns are selected, attempt to create the given connection.

on_disconnect_button(event)

Handle event of user pressing disconnect button.

If all three dropdowns are not selected, error is shown.

If all three dropdowns are selected, attempt to destroy the given connection.

on_input_dropdown(event)

Refresh dropdown for input pin on selection of input device.

class gui_components.Console(*args: Any, **kwargs: Any)

Bases: wx.TextCtrl

Console component.

The console redirects from stdout.

Parameters

parent – parent window.

write(string)

Write string to console.

class gui_components.CyclesWidget(*args: Any, **kwargs: Any)

Bases: wx.BoxSizer

Sizer containing ‘Cycles’ text and number selector.

Parameters

parent – parent window

GetValue()

Get the current cycle selector value.

class gui_components.MenuBar(*args: Any, **kwargs: Any)

Bases: wx.MenuBar

Menu bar component.

Handles file load and help.

Parameters
  • parent (wx.Frame) – parent window

  • file_opened (bool) – whether there is a file loaded, if not a file dialogue will appear

  • on_file (Callback) – function to load new logic description files

HelpID = 110
OpenID = 998
handle_file_open() None

Call callback function if file selected.

on_menu(event) None

Handle menu events.

If Open button is selected, file dialog opens to select a .txt description file. If Help button is selected, web browser is opened to GitHub readme.

open_file_dialog() Union[None, str]

Open the file dialog.

Returns

path – Returns None if user cancels

Return type

Union[None, str]

class gui_components.MonitorWidget(*args: Any, **kwargs: Any)

Bases: wx.ScrolledWindow

Scrolled window for monitors.

All devices are listed, with a button for each to toggle monitoring.

Parameters
  • parent – parent window

  • cycles_completed – list containing number of cycles completed

  • names – instance of the names.Names() class.

  • devices – instance of the devices.Devices() class.

  • network – instance of the network.Network() class.

  • monitors – instance of the monitors.Monitors() class.

monitor_command(device_id, port)

Set the specified monitor.

on_monitor_button(event)

Handle toggle monitor state of output.

If output is being monitored, button says ‘Remove’. If output is not being monitored, button says ‘Add’.

zap_command(device_id, pin)

Remove the specified monitor.

class gui_components.StatusBar(*args: Any, **kwargs: Any)

Bases: wx.StatusBar

Status bar to display cycle count.

Parameters

parent – parent window.

push_cycle_count(cycle_completed: int)

Push the current cycle count to status bar.

class gui_components.SwitchWidget(*args: Any, **kwargs: Any)

Bases: wx.ScrolledWindow

Scrollable window for switches.

Parameters
  • parent – parent window.

  • names – instance of the names.Names() class.

  • devices – instance of the devices.Devices() class.

on_toggle_button(event)

Handle event when user presses a button to toggle switch value.

Text on button changes between On/Off depending on state.