event_types¶
classDiagram
CharmyObject <|-- Event
Event <|-- DelayTriggered
Event <|-- EventTriggered
Event <|-- MouseInteractEvent
Event <|-- MouseRawEvent
Event <|-- ProfileChanged
Event <|-- VarChanged
Event <|-- WidgetEvent
Event <|-- WindowEvent
MouseInteractEvent <|-- MouseClick
MouseInteractEvent <|-- MouseEnter
MouseInteractEvent <|-- MouseLeave
MouseRawEvent <|-- MouseMove
MouseRawEvent <|-- MousePress
MouseRawEvent <|-- MouseRelease
MouseRawEvent <|-- MouseScroll
WidgetEvent <|-- FocusGain
WidgetEvent <|-- FocusLoss
WidgetEvent <|-- WidgetConfigure
WidgetEvent <|-- WidgetDestroy
WidgetEvent <|-- WidgetDraw
WidgetEvent <|-- WidgetMove
WidgetEvent <|-- WidgetResize
WidgetEvent <|-- WidgetUpdate
- class charmy.utils.event_types.Event¶
基类:
CharmyObjectUsed to represent an event. Can be regarded as a placeholder if directly used.
- type: ClassVar[str] = 'noevent'¶
- meets(target_condition: dict, allow_inexist: bool = False) bool¶
Check if current event meets the target condition.
- 参数:
target_condition -- Condition specified by task etc. to meet
- call_chain(subject: _EventHandling) None¶
- __init__() None¶
- class charmy.utils.event_types.EventTriggered(subject: _EventHandling)¶
基类:
EventTriggered when any other kind of event is triggered.
- type: _typing.ClassVar[str] = 'event_triggered'¶
- subject: _EventHandling¶
- call_chain(_: _EventHandling) None¶
- __init__(subject: _EventHandling) None¶
- class charmy.utils.event_types.WidgetEvent(subject: _EventHandling)¶
基类:
EventThe type of events that represents widget events.
Notes on Param subject¶
subject should be the widget that is triggered the event.
- type: _typing.ClassVar[str] = 'widget'¶
- subject: _EventHandling¶
- __init__(subject: _EventHandling) None¶
- class charmy.utils.event_types.WidgetUpdate(subject: _EventHandling | None, redraw: bool | _shape.ShapeRange = False)¶
基类:
WidgetEventWill be generated when a widget or window is updated.
Note on Param subject¶
When subject is set to none, it means Charmy's global update routine is triggered.
- type: _typing.ClassVar[str] = 'widget.update'¶
- subject: _EventHandling | None¶
- redraw: bool | _shape.ShapeRange = False¶
- __init__(subject: _EventHandling | None, redraw: bool | _shape.ShapeRange = False) None¶
- class charmy.utils.event_types.WidgetDraw(subject: _EventHandling, pos: _shape.Point = (0, 0), size: _shape.Size = (0, 0))¶
基类:
WidgetEventWill be generated when a widget or window is redrawn.
- type: _typing.ClassVar[str] = 'widget.draw'¶
- pos: _shape.Point = (0, 0)¶
- size: _shape.Size = (0, 0)¶
- __init__(subject: _EventHandling, pos: _shape.Point = (0, 0), size: _shape.Size = (0, 0)) None¶
- class charmy.utils.event_types.WidgetConfigure(subject: _EventHandling, attrs_changed: dict)¶
基类:
WidgetEventWill be generated when a widget or window has its configuration changed.
- type: _typing.ClassVar[str] = 'widget.configure'¶
- attrs_changed: dict¶
- call_chain(subject: _EventHandling) None¶
- __init__(subject: _EventHandling, attrs_changed: dict) None¶
- class charmy.utils.event_types.WidgetResize(subject: _EventHandling, new_size: _shape.Size, old_size: _typing.Optional[_shape.Size] = None)¶
基类:
WidgetEventWill be generated when a widget or window is resized.
- type: _typing.ClassVar[str] = 'widget.resize'¶
- new_size: _shape.Size¶
- old_size: _typing.Optional[_shape.Size] = None¶
- __init__(subject: _EventHandling, new_size: _shape.Size, old_size: _typing.Optional[_shape.Size] = None) None¶
- class charmy.utils.event_types.WidgetMove(subject: _EventHandling, new_pos: _shape.Point, old_pos: _typing.Optional[_shape.Point] = None)¶
基类:
WidgetEventWill be generated when a widget or window is moved.
- type: _typing.ClassVar[str] = 'widget.move'¶
- new_pos: _shape.Point¶
- old_pos: _typing.Optional[_shape.Point] = None¶
- __init__(subject: _EventHandling, new_pos: _shape.Point, old_pos: _typing.Optional[_shape.Point] = None) None¶
- class charmy.utils.event_types.FocusGain(subject: _EventHandling)¶
基类:
WidgetEventWill be generated when a widget or window gained focus.
- type: _typing.ClassVar[str] = 'widget.focus_gain'¶
- __init__(subject: _EventHandling) None¶
- class charmy.utils.event_types.FocusLoss(subject: _EventHandling)¶
基类:
WidgetEventWill be generated when a widget or window lose focus.
- type: _typing.ClassVar[str] = 'widget.focus_loss'¶
- __init__(subject: _EventHandling) None¶
- class charmy.utils.event_types.WidgetDestroy(subject: _EventHandling)¶
基类:
WidgetEventWill be generated when a widget or window is destroyed.
- type: _typing.ClassVar[str] = 'widget.destroy'¶
- __init__(subject: _EventHandling) None¶
- class charmy.utils.event_types.WindowEvent(subject: _window.WindowEntity)¶
基类:
EventThe type of events that represents window events.
Notes on Param subject¶
subject should be the window where the events happened.
- subject: _window.WindowEntity¶
- __init__(subject: _window.WindowEntity) None¶
- class charmy.utils.event_types.MouseRawEvent(subject: _window.WindowEntity, mouse_pos: _shape.Point)¶
基类:
EventThe type of events that represents mouse actions.
Notes on Param subject¶
subject should be the window that detected the mouse event.
- type: _typing.ClassVar[str] = 'mouse'¶
- subject: _window.WindowEntity¶
- mouse_pos: _shape.Point¶
- call_chain(subject: _EventHandling) None¶
- __init__(subject: _window.WindowEntity, mouse_pos: _shape.Point) None¶
- class charmy.utils.event_types.MouseMove(subject: _window.WindowEntity, mouse_pos: _shape.Point)¶
-
Will be generated when mouse movement is detected.
- type: _typing.ClassVar[str] = 'mouse.move'¶
- call_chain(subject: _EventHandling)¶
- __init__(subject: _window.WindowEntity, mouse_pos: _shape.Point) None¶
- class charmy.utils.event_types.MousePress(subject: _window.WindowEntity, mouse_pos: _shape.Point, button: int)¶
-
Will be generated when a mouse button is pressed.
- type: _typing.ClassVar[str] = 'mouse.press'¶
- button: int¶
- call_chain(subject: _EventHandling)¶
- __init__(subject: _window.WindowEntity, mouse_pos: _shape.Point, button: int) None¶
- class charmy.utils.event_types.MouseRelease(subject: _window.WindowEntity, mouse_pos: _shape.Point, button: int)¶
-
Will be generated when a mouse button is released.
- type: _typing.ClassVar[str] = 'mouse.release'¶
- button: int¶
- call_chain(subject: _EventHandling)¶
- __init__(subject: _window.WindowEntity, mouse_pos: _shape.Point, button: int) None¶
- class charmy.utils.event_types.MouseScroll(subject: _window.WindowEntity, mouse_pos: _shape.Point, steps: int, horizontal: bool = False)¶
-
Will be generated when a mouse button is released.
- type: _typing.ClassVar[str] = 'mouse.scroll'¶
- steps: int¶
- horizontal: bool = False¶
- __init__(subject: _window.WindowEntity, mouse_pos: _shape.Point, steps: int, horizontal: bool = False) None¶
- class charmy.utils.event_types.MouseInteractEvent(subject: _EventHandling, recent_raw_event: MouseRawEvent)¶
基类:
EventWill be generated when the mouse interacts with an EventHandling.
- type: _typing.ClassVar[str] = 'mouse_interact'¶
- subject: _EventHandling¶
- recent_raw_event: MouseRawEvent¶
- __init__(subject: _EventHandling, recent_raw_event: MouseRawEvent) None¶
- class charmy.utils.event_types.MouseEnter(subject: _EventHandling, recent_raw_event: MouseRawEvent)¶
-
Will be generated when the mouse enters an EventHandling.
- type: _typing.ClassVar[str] = 'mouse_interact.enter'¶
- __init__(subject: _EventHandling, recent_raw_event: MouseRawEvent) None¶
- class charmy.utils.event_types.MouseLeave(subject: _EventHandling, recent_raw_event: MouseRawEvent)¶
-
Will be generated when the mouse enters an EventHandling.
- type: _typing.ClassVar[str] = 'mouse_interact.leave'¶
- __init__(subject: _EventHandling, recent_raw_event: MouseRawEvent) None¶
- class charmy.utils.event_types.MouseClick(subject: _EventHandling, recent_raw_event: MouseRawEvent, button: int)¶
-
Will be generated when the mouse clicks an EventHandling.
- type: _typing.ClassVar[str] = 'mouse_interact.click'¶
- button: int¶
- __init__(subject: _EventHandling, recent_raw_event: MouseRawEvent, button: int) None¶
- class charmy.utils.event_types.VarChanged(subject: '_var.Var')¶
基类:
Event- type: _typing.ClassVar[str] = 'var.changed'¶
- subject: _var.Var¶
- __init__(subject: _var.Var) None¶