trigger_editor package
Submodules
trigger_editor.editor_dialog module
- class ui.dialogs.trigger_editor.editor_dialog.TriggerEditorDialog(tile_data_or_entity, *args, **kwargs)
Bases:
QDialogDialog window for editing triggers associated with a tile or entity.
Presents three tabs — Graph, Properties, and Triggers — with a shared button row for creating, saving, and deleting triggers.
- Parameters:
tile_data_or_entity (object) – The tile data or entity whose triggers are being edited.
- create_new_trigger()
trigger_editor.editor_stack module
- class ui.dialogs.trigger_editor.editor_stack.TriggerEditorStack(parent=None)
Bases:
QStackedWidgetA stacked widget that manages different views for editing triggers.
This widget allows switching between a list view, a property editor, and a graph view for editing triggers associated with a tile or game entity.
- set_context(obj)
Set the currently selected tile or entity whose triggers are being edited.
- Parameters:
obj (object) – The context object (TileData or GameEntity).
- show_graph_view()
Show the trigger graph view.
- show_list_view()
Show the trigger list view.
- show_property_view(trigger=None)
Show the trigger property editor view.
- Parameters:
trigger (object or None) – The trigger to edit, or None to clear selection.
trigger_editor.graph_view module
- class ui.dialogs.trigger_editor.graph_view.TriggerGraphView(context=None)
Bases:
QWidgetA QWidget that displays a graph of trigger nodes using QGraphicsView and QGraphicsScene. Nodes are laid out in chain-order columns (BFS) with timeline headers. Supports drag-to-connect wiring between node ports.
- add_trigger_node(trigger, x, y)
Add a single trigger node to the scene at the specified position.
- build_graph(context)
Build the graph layout from the context’s triggers using BFS column order.
- draw_arrow(start_item, end_item)
Draw an arrow from the output anchor of start_item to the input anchor of end_item.
- manage_graph_building_and_arrows(context)
Draw arrows between trigger nodes based on their next_trigger connections.
- refresh()
Rebuild the graph from the current context (called after saves).
- set_context(context)
Set a new context and rebuild the graph.
trigger_editor.list_view module
- class ui.dialogs.trigger_editor.list_view.TriggerListView
Bases:
QWidgetA QWidget subclass that displays a list of triggers associated with a given object.
This view provides a label and a QListWidget to show the triggers attached to a tile or entity. The context (object) can be set via
set_context(), which will populate the list with trigger labels.- set_context(obj)
Set the context object and update the trigger list.
- Parameters:
obj (object) – The object whose
triggersattribute (an iterable of objects with alabelattribute) will be displayed in the list widget.
trigger_editor.property_editor module
- class ui.dialogs.trigger_editor.property_editor.TriggerPropertyEditor
Bases:
QWidgetWidget for editing the properties of a Trigger object.
Allows selection and configuration of event type, condition, reaction, and next trigger, as well as saving changes to the context.
- build_condition_fields(condition_cls)
Build and display input fields for the parameters of the given condition class.
- Parameters:
condition_cls (type) – The condition class to inspect.
- build_reaction_fields(reaction_cls)
Build and display input fields for the parameters of the given reaction class.
- Parameters:
reaction_cls (type) – The reaction class to inspect.
- clear_inputs()
Clear all input fields and reset to defaults.
- on_reaction_changed(reaction_name)
Update the reaction parameter fields based on the selected reaction.
- Parameters:
reaction_name (str) – Name of the selected reaction class.
- refresh_next_trigger_choices()
Refresh the list of available next triggers in the dropdown.
- save_trigger()
Save the current trigger configuration to the context.
- set_context(context)
Set the context object that contains triggers.
- Parameters:
context (object) – The context object (should have a ‘triggers’ attribute).
- set_defaults()
Reset the editor to default state, clearing all fields and rebuilding parameter inputs.
- set_trigger(trigger=None)
Set the trigger to be edited.
- Parameters:
trigger (Trigger or None) – The Trigger object to edit, or None to clear.
- update_condition_fields(name)
Update the condition parameter fields based on the selected condition.
- Parameters:
name (str) – Name of the selected condition class.
trigger_editor.trigger_node module
- class ui.dialogs.trigger_editor.trigger_node.TriggerNodeItem(trigger, x, y, width=180, height=100)
Bases:
QGraphicsItemGroupA QGraphicsItemGroup representing a trigger node in the editor.
Displays a colored box with the trigger’s event type, condition, and reaction. Visual input/output ports allow drag-to-connect wiring in the graph view.
- Parameters:
trigger (object) – The trigger object to represent.
x (float) – The x position of the node.
y (float) – The y position of the node.
width (float) – The width of the node box.
height (float) – The height of the node box.
- get_input_anchor() QPointF
Get the input anchor point in scene coordinates (left-centre of node).
- Returns:
Scene-space input anchor.
- Return type:
QPointF
- get_output_anchor() QPointF
Get the output anchor point in scene coordinates (right-centre of node).
- Returns:
Scene-space output anchor.
- Return type:
QPointF
- input_port_contains(scene_pos: QPointF) bool
Return True if scene_pos is close to the input port.
- mousePressEvent(event)
Notify the graph view that this node was selected.
- output_port_contains(scene_pos: QPointF) bool
Return True if scene_pos is close to the output port.
- update_label()
Update the label text to reflect the current trigger’s event, condition, and reaction.