magicclass.gui package

Submodules

magicclass.gui.class_gui module

class magicclass.gui.class_gui.ClassGuiBase(close_on_run, popup_mode, error_mode)[source]

Bases: magicclass.gui._base.BaseGui

native: QWidget
magicclass.gui.class_gui.make_gui(container: type[magicgui.widgets._bases.container_widget.ContainerWidget], no_margin: bool = True)[source]

Make a ClassGui class from a Container widget. Because GUI class inherits Container here, functions that need overriden must be defined here, not in ClassGuiBase.

magicclass.gui.keybinding module

class magicclass.gui.keybinding.Key(value)[source]

Bases: enum.Enum

An enumeration.

A = 'a'
Alt = 'alt'
Ampersand = '&'
Apostrophe = "'"
Asterisk = '*'
At = '@'
B = 'b'
Backspace = 'backspace'
C = 'c'
Colon = ':'
Comma = ','
Ctrl = 'ctrl'
D = 'd'
Delete = 'delete'
Dollar = '$'
Down = 'down'
E = 'e'
Equal = '='
Exclam = '!'
F = 'f'
F1 = 'f1'
F10 = 'f10'
F11 = 'f11'
F12 = 'f12'
F2 = 'f2'
F3 = 'f3'
F4 = 'f4'
F5 = 'f5'
F6 = 'f6'
F7 = 'f7'
F8 = 'f8'
F9 = 'f9'
G = 'g'
Greater = '>'
H = 'h'
I = 'i'
J = 'j'
K = 'k'
L = 'l'
Left = 'left'
Less = '<'
M = 'm'
Meta = 'meta'
Minus = '-'
N = 'n'
O = 'o'
P = 'p'
PageDown = 'pagedown'
PageUp = 'pageup'
ParenLeft = '('
ParenRight = ')'
Percent = '%'
Period = '.'
Plus = '+'
Q = 'q'
Question = '?'
R = 'r'
Right = 'right'
S = 's'
Semicolon = ';'
Shift = 'shift'
Slash = '/'
T = 't'
Tab = 'tab'
U = 'u'
Up = 'up'
V = 'v'
W = 'w'
X = 'x'
Y = 'y'
Z = 'z'
classmethod to_qtkey(key: str | int | Key) QtKey[source]
classmethod to_qtmodifier(key: str | Key) QtModifier[source]
magicclass.gui.keybinding.as_shortcut(key_combo: tuple) PyQt5.QtGui.QKeySequence[source]
magicclass.gui.keybinding.ismodifier(s: str) bool[source]
magicclass.gui.keybinding.parse_key_combo(key_combo: str) QtKey[source]
magicclass.gui.keybinding.strs2keycombo(*args: tuple[str | Key, ...]) KeyCombo[source]

magicclass.gui.menu_gui module

class magicclass.gui.menu_gui.ContextMenuGui(parent=None, name: str = None, close_on_run: bool = None, popup_mode: str | PopUpMode = None, error_mode: str | ErrorMode = None, labels: bool = True)[source]

Bases: magicclass.gui.menu_gui.MenuGuiBase

Magic class that will be converted into a context menu.

annotation: Any
enabled: bool
gui_only: bool
height: int
label: str
label_changed: Signal
labels: bool
layout: str
margins: tuple[int, int, int, int]
max_height: int
max_width: int
min_height: int
min_width: int
name: str
options: dict
param_kind: inspect._ParameterKind
parent_changed: Signal
tooltip: str
visible: bool
widget_type: str
width: int
class magicclass.gui.menu_gui.MenuGui(parent=None, name: str = None, close_on_run: bool = None, popup_mode: str | PopUpMode = None, error_mode: str | ErrorMode = None, labels: bool = True)[source]

Bases: magicclass.gui.menu_gui.MenuGuiBase

Magic class that will be converted into a menu bar.

annotation: Any
enabled: bool
gui_only: bool
height: int
label: str
label_changed: Signal
labels: bool
layout: str
margins: tuple[int, int, int, int]
max_height: int
max_width: int
min_height: int
min_width: int
name: str
options: dict
param_kind: inspect._ParameterKind
parent_changed: Signal
tooltip: str
visible: bool
widget_type: str
width: int
class magicclass.gui.menu_gui.MenuGuiBase(parent=None, name: str = None, close_on_run: bool = None, popup_mode: str | PopUpMode = None, error_mode: str | ErrorMode = None, labels: bool = True)[source]

Bases: magicclass.gui._base.BaseGui, collections.abc.MutableSequence

annotation: Any
append(obj: Callable | MenuGuiBase | AbstractAction | Widget) None[source]

S.append(value) -- append value to the end of the sequence

changed: Signal
enabled: bool
gui_only: bool
height: int
insert(key: int, obj: Callable | MenuGuiBase | AbstractAction | Widget) None[source]

Insert object into the menu. Could be widget or callable.

Parameters
label: str
label_changed: Signal
labels: bool
layout: str
margins: tuple[int, int, int, int]
max_height: int
max_width: int
min_height: int
min_width: int
name: str
options: dict
param_kind: inspect._ParameterKind
property parent
parent_changed: Signal
render()[source]
tooltip: str
visible: bool
widget_type: str
width: int

magicclass.gui.mgui_ext module

class magicclass.gui.mgui_ext.AbstractAction[source]

Bases: object

QAction encapsulated class with a similar API as magicgui Widget. This class makes it easier to combine QMenu to magicgui.

changed
property enabled
from_options(options)[source]
property name: str
native: QAction | QWidgetAction
property parent
set_shortcut(key)[source]
support_value: bool
property tooltip: str
property value
property visible
class magicclass.gui.mgui_ext.Action(*args, name: Optional[str] = None, text: Optional[str] = None, gui_only: bool = True, **kwargs)[source]

Bases: magicclass.gui.mgui_ext.AbstractAction

from_options(options: dict[str] | Callable)[source]
property icon_path
native: QAction | QWidgetAction
property running: bool
support_value: bool = True
property text: str
property value
class magicclass.gui.mgui_ext.FunctionGuiPlus(function: Callable[..., _R], call_button: bool | str | None = None, layout: str = 'vertical', labels: bool = True, tooltips: bool = True, app: AppRef = None, visible: bool = None, auto_call: bool = False, result_widget: bool = False, param_options: dict[str, dict] | None = None, name: str = None, persist: bool = False, **kwargs)[source]

Bases: magicgui.widgets.Container, Generic[magicgui.widgets._function_gui._R]

FunctionGui class with a parameter recording functionality etc.

insert(key: int, widget: magicgui.widgets._bases.widget.Widget)[source]

Insert widget at key.

class magicclass.gui.mgui_ext.PushButtonPlus(text: str | None = None, **kwargs)[source]

Bases: magicgui.widgets.PushButton

A Qt specific PushButton widget with a magicgui bound.

property background_color
property font_color
property font_family
property font_size
from_options(options: dict[str] | Callable)[source]
property icon_path
property icon_size
property running: bool
set_shortcut(key)[source]
class magicclass.gui.mgui_ext.WidgetAction(widget: magicgui.widgets._bases.widget.Widget, name: Optional[str] = None, label: Optional[str] = None, gui_only: bool = True, parent=None)[source]

Bases: magicclass.gui.mgui_ext.AbstractAction

property max_width: int
property min_width: int
native: QAction | QWidgetAction
render()[source]
support_value: bool
property value
property width: int

magicclass.gui.utils module

exception magicclass.gui.utils.MagicClassConstructionError[source]

Bases: Exception

This exception will be raised when class definition is not a valid magic-class.

magicclass.gui.utils.define_callback(self, callback: Callable)[source]
magicclass.gui.utils.get_parameters(fgui: magicgui.widgets._function_gui.FunctionGui)[source]

Module contents