rayoptics.qtgui.plotview module

Support for fully featured QT windows for plotting/matplotlib

class PlotCanvas(parent, figure, accept_drops=True, drop_action=None)[source]

Bases: FigureCanvasQTAgg

dragEnterEvent(self, a0: QDragEnterEvent | None)[source]
dragMoveEvent(self, a0: QDragMoveEvent | None)[source]
dragLeaveEvent(self, a0: QDragLeaveEvent | None)[source]
dropEvent(self, a0: QDropEvent | None)[source]
class NullDropAction[source]

Bases: object

dragEnterEvent(view, event)[source]
dragMoveEvent(view, event)[source]
dragLeaveEvent(view, event)[source]
dropEvent(view, event)[source]
update_figure_view(plotFigure, **kwargs)[source]
class CommandItem(parent, txt, cntxt)[source]

Bases: QListWidgetItem

data(self, role: int) Any[source]
setData(self, role: int, value: Any)[source]
create_command_panel(fig, commands)[source]
create_plot_view(app, figure, title, view_width, view_ht, commands=None, add_panel_fcts=None, add_nav_toolbar=False, drop_action=None, context_menu=None)[source]

create a window hosting a (mpl) figure

create_glass_map_view(app, glass_db)[source]
on_plot_scale_toggled(cntxt, scale_type)[source]
create_plot_scale_panel(app, pc)[source]
create_multi_plot_scale_panel(app, pc)[source]
get_icon(fig, icon_filepath, icon_size=48)[source]
create_2d_figure_toolbar(app, pc)[source]

zoom, fit and pan commands for figures Pan Zoom Box Fit Zoom In, Out 1:1

create_draw_rays_groupbox(app, pc)[source]
create_diagram_controls_groupbox(app, pc)[source]
create_diagram_edge_actions_groupbox(app, pc)[source]
create_diagram_layers_groupbox(app, pc)[source]
create_handle_context_menu(app, pc, menu_actions)[source]

Create a (Qt) context menu for a (mpl) figure.


  • app: the Qt main app

  • pc: the Qt-specific backend for mpl, CanvasFigure

  • menu_actions: list of potential context menu actions

each menu action is a tuple consisting of:

  • action_desc:str the menu item text

  • action_handle:str the key in the actions dict for the action

  • action: the action class to be instantiated if picked

The fig.selected_shape is what the actions are built against. The action should raise a TypeError if an incompatible shape is supplied.