MVC Controllers: rafcon.gui.controllers

All controllers of the MVC architecture.

The controllers are the interface between the models (holding the data) and the view (showing the data). They are responsible for the logic.

All controllers of RAFCON inherit from rafcon.gui.controllers.extended_controller.ExtendedController, which inherits from the controller class of GTKMVC.

Subpackages of rafcon.gui.controllers

MainWindowController (in main_window)

GraphicalEditorController (in graphical_editor_gaphas)

StateMachinesEditorController (in state_machines_editor)

ExecutionHistoryTreeController (in execution_history)

class rafcon.gui.controllers.execution_history.ExecutionHistoryTreeController(model=None, view=None)

Bases: ExtendedController

Controller handling the execution history.

Parameters:
  • model (rafcon.gui.models.state_machine_manager.StateMachineManagerModel) – The state machine manager model, holding data regarding state machines.

  • view (rafcon.gui.views.execution_history.ExecutionHistoryTreeView) – The GTK View showing the execution history tree.

  • state_machine_manager (rafcon.core.state_machine_manager.StateMachineManager) –

HISTORY_ITEM_STORAGE_ID = 1
TOOL_TIP_STORAGE_ID = 2
TOOL_TIP_TEXT = 'Right click for more details\nMiddle click for external more detailed viewer\nDouble click to select corresponding state'
append_string_to_menu(popup_menu, menu_item_string)
clean_history(widget, event=None)

Triggered when the ‘Clean History’ button is clicked.

Empties the execution history tree by adjusting the start index and updates tree store and view.

destroy()

Recursively destroy all Controllers

The method remove all controllers, which calls the destroy method of the child controllers. Then, all registered models are relieved and and the widget hand by the initial view argument is destroyed.

execution_history_focus(model, prop_name, info)

Arranges to put execution-history widget page to become top page in notebook when execution starts and stops and resets the boolean of modification_history_was_focused to False each time this notification are observed.

get_history_item_for_tree_iter(child_tree_iter)

Hands history item for tree iter and compensate if tree item is a dummy item

Parameters:

child_tree_iter (Gtk.TreeIter) – Tree iter of row

Rtype rafcon.core.execution.execution_history.HistoryItem:

Return history tree item:

insert_concurrent_execution_histories(parent, concurrent_execution_histories)

Adds the child execution histories of a concurrency state.

Parameters:
  • parent (Gtk.TreeItem) – the parent to add the next history item to

  • concurrent_execution_histories (list[ExecutionHistory]) – a list of all child execution histories

Returns:

insert_execution_history(parent, execution_history, is_root=False)

Insert a list of history items into a the tree store

If there are concurrency history items, the method is called recursively.

Parameters:
  • parent (Gtk.TreeItem) – the parent to add the next history item to

  • execution_history (ExecutionHistory) – all history items of a certain state machine execution

  • is_root (bool) – Whether this is the root execution history

insert_history_item(parent, history_item, description, dummy=False)

Enters a single history item into the tree store

Parameters:
  • parent (Gtk.TreeItem) – Parent tree item

  • history_item (HistoryItem) – History item to be inserted

  • description (str) – A description to be added to the entry

  • dummy (None) – Whether this is just a dummy entry (wrapper for concurrency items)

Returns:

Inserted tree item

Return type:

Gtk.TreeItem

mouse_click(widget, event=None)

Triggered when mouse click is pressed in the history tree. The method shows all scoped data for an execution step as tooltip or fold and unfold the tree by double-click and select respective state for double clicked element.

notification_selected_sm_changed(model, prop_name, info)

If a new state machine is selected, make sure expansion state is stored and tree updated

notification_sm_changed(model, prop_name, info)

Remove references to non-existing state machines

open_selected_history_separately(widget, event=None)
register_view(view)

Called when the View was registered

Can be used e.g. to connect signals. Here, this implements a convenient feature that observes if thread problems are possible by destroying a controller before being fully initialized.

reload_history(widget, event=None)

Triggered when the ‘Reload History’ button is clicked.

update()

rebuild the tree view of the history item tree store :return:

GlobalVariableManagerController (in global_variable_manager)

class rafcon.gui.controllers.global_variable_manager.GlobalVariableManagerController(model, view)

Bases: ListViewController

Controller handling the Global Variable Manager

The controller enables to edit, add and remove global variable to the global variable manager by a tree view. Every global variable is accessible by it key which is in the tree view equivalent with its name and in the methods it is gv_name. This Controller inherit and use rudimentary methods of the ListViewController (therefore it introduce the ID_STORAGE_ID class attribute) and avoids to use the selection methods of those which need a MODEL_STORAGE_ID (there is no global variable model) and a state machine selection (is model based). Therefore the register view is only called for the extended controller. Because of this and the fact that name = key for a global variable ID_STORAGE_ID, NAME_STORAGE_ID and MODEL_STORAGE_ID are all equal.

Parameters:
Variables:
  • global_variable_counter (int) – Counter for global variables to ensure unique names for new global variables.

  • list_store (Gtk.ListStore) – A gtk list store storing the rows of data of respective global variables in.

DATA_TYPE_AS_STRING_STORAGE_ID = 1
ID_STORAGE_ID = 0
IS_LOCKED_AS_STRING_STORAGE_ID = 3
MODEL_STORAGE_ID = 0
NAME_STORAGE_ID = 0
VALUE_AS_STRING_STORAGE_ID = 2
apply_new_global_variable_name(path, new_gv_name)

Change global variable name/key according handed string

Updates the global variable name only if different and already in list store.

Parameters:
  • path – The path identifying the edited global variable tree view row, can be str, int or tuple.

  • new_gv_name (str) – New global variable name

apply_new_global_variable_type(path, new_data_type_as_string)

Change global variable value according handed string

Updates the global variable data type only if different.

Parameters:
  • path – The path identifying the edited global variable tree view row, can be str, int or tuple.

  • new_data_type_as_string (str) – New global variable data type as string

apply_new_global_variable_value(path, new_value_as_string)

Change global variable value according handed string

Updates the global variable value only if new value string is different to old representation.

Parameters:
  • path – The path identifying the edited global variable tree view row, can be str, int or tuple.

  • new_value_as_string (str) – New global variable value as string

assign_notification_from_gvm(model, prop_name, info)

Handles gtkmvc3 notification from global variable manager

Calls update of whole list store in case new variable was added. Avoids to run updates without reasonable change. Holds tree store and updates row elements if is-locked or global variable value changes.

global_variable_is_editable(gv_name, intro_message='edit')

Check whether global variable is locked

Parameters:
  • gv_name (str) – Name of global variable to be checked

  • intro_message (str) – Message which is used form a useful logger error message if needed

Returns:

on_add(widget, data=None)

Create a global variable with default value and select its row

Triggered when the add button in the global variables tab is clicked.

on_lock(widget, data=None)

Locks respective selected core element

on_unlock(widget, data=None)

Locks respective selected core element

register_actions(shortcut_manager)

Register callback methods for triggered actions

Parameters:

shortcut_manager (rafcon.gui.shortcut_manager.ShortcutManager) – Shortcut Manager Object holding mappings between shortcuts and actions.

register_view(view)

Called when the View was registered

remove_core_element(model)

Remove respective core element of handed global variable name

Parameters:

model (str) – String that is the key/gv_name of core element which should be removed

Returns:

update_global_variables_list_store()

Updates the global variable list store

Triggered after creation or deletion of a variable has taken place.

LoggingConsoleController (in logging_console)

class rafcon.gui.controllers.logging_console.LoggingConsoleController(model, view)

Bases: ExtendedController

Controller handling the updates and modifications of the logging console.

Parameters:
add_clear_menu_item(widget, menu)
destroy()

Recursively destroy all Controllers

The method remove all controllers, which calls the destroy method of the child controllers. Then, all registered models are relieved and and the widget hand by the initial view argument is destroyed.

model_changed(model, prop_name, info)

React to configuration changes

Update internal hold enable state, propagates it to view and refresh the text buffer.

print_filtered_buffer()
print_message(message, log_level, new=True)
register_view(view)

Called when the View was registered

Can be used e.g. to connect signals. Here, this implements a convenient feature that observes if thread problems are possible by destroying a controller before being fully initialized.

update_filtered_buffer()

LibraryTreeController (in library_tree)

class rafcon.gui.controllers.library_tree.LibraryTreeController(model, view, find_usages=False)

Bases: ExtendedController

ID_STORAGE_ID = 0
ITEM_STORAGE_ID = 1
LIB_KEY_STORAGE_ID = 4
LIB_PATH_STORAGE_ID = 2
OS_PATH_STORAGE_ID = 3
TOOL_TIP_STORAGE_ID = 3
static convert_if_human_readable(s)

Converts a string to format which is more human readable

extract_library_properties_from_selected_row()

Extracts properties library_os_path, library_path, library_name and tree_item_key from tree store row

generate_right_click_menu(kind='library')
get_menu_item_text(menu_item)
insert_button_clicked(widget, as_template=False)
insert_rec(parent, library_key, library_item, library_path, library_root_path=None)
Parameters:
  • parent

  • library_key (str) –

  • library_item

  • library_path (str) –

  • library_root_path (str) –

Returns:

menu_item_add_library_root_clicked(widget)
menu_item_find_usages_clicked(widget)
menu_item_relocate_libraries_or_root_clicked(menu_item)

Relocate library after request second confirmation

menu_item_remove_libraries_or_root_clicked(menu_item)

Removes library from hard drive after request second confirmation

menu_item_rename_libraries_or_root_clicked(menu_item)

Rename library after request second confirmation

model_changed(model, prop_name, info)
mouse_click(widget, event=None)
on_drag_begin(widget, context)

replace drag icon

Parameters:
  • widget

  • context

on_drag_data_get(widget, context, data, info, time)

dragged state is inserted and its state_id sent to the receiver

Parameters:
  • widget

  • context

  • data – SelectionData: contains state_id

  • info

  • time

open_button_clicked(widget)
open_library_as_state_machine()
open_run_button_clicked(widget)
redo_expansion_state()
register_view(view)

Called when the View was registered

Can be used e.g. to connect signals. Here, this implements a convenient feature that observes if thread problems are possible by destroying a controller before being fully initialized.

select_library_tree_element_of_lib_tree_path(lib_tree_path)
select_library_tree_element_of_library_state_model(state_m)
store_expansion_state()
substitute_as_library_clicked(widget, keep_name=True)
substitute_as_template_clicked(widget, keep_name=True)
update()

MenuBarController (in menu_bar)

class rafcon.gui.controllers.menu_bar.MenuBarController(state_machine_manager_model, view, shortcut_manager, sm_execution_engine)

Bases: ExtendedController

Controller handling the Menu Bar

The class to trigger all the actions, available in the menu bar.

Parameters:
  • state_machine_manager_model (rafcon.gui.models.state_machine_manager.StateMachineManagerModel) – The state machine manager model, holding data regarding state machines. Should be exchangeable.

  • view (rafcon.gui.views.main_window.MainWindowView) – The GTK View showing the Menu Bar and Menu Items.

add_callback_to_shortcut_manager(action, callback)

Helper function to add an callback for an action to the shortcut manager. :param action: the action to add a shortcut for :param callback: the callback if the action is executed :return:

call_action_callback(callback_name, *args, **kwargs)

Wrapper for action callbacks

Returns True after executing the callback. This is needed in order to prevent the shortcut from being passed on to the system. The callback methods itself cannot return True, as they are also used with idle_add, which would call the method over and over again. :param str callback_name: The name of the method to call :param args: Any remaining parameters, which are passed on to the callback method :return: True

check_edit_menu_items_status(widget)
connect_button_to_function(view_index, button_state, function)

Connect callback to a button :param view_index: the index of the button in the view :param button_state: the state of the button the function should be connected to :param function: the function to be connected :return:

static create_logger_warning_if_shortcuts_are_overwritten_by_menu_bar()
data_flow_mode_toggled_shortcut(*args, **kwargs)
destroy()

Recursively destroy all Controllers

The method remove all controllers, which calls the destroy method of the child controllers. Then, all registered models are relieved and and the widget hand by the initial view argument is destroyed.

static on_about_activate(widget, data=None)
on_add_state_activate(widget, method=None, *arg)
static on_add_transitions_from_closest_sibling_state_active(widget, data=None)
static on_add_transitions_to_closest_sibling_state_active(widget, data=None)
static on_add_transitions_to_parent_state_active(widget, data=None)
on_backward_step_activate(widget, data=None)
on_bake_state_machine_activate(widget, data=None, force=False)
on_config_value_changed(config_m, prop_name, info)

Callback when a config value has been changed

Parameters:
  • config_m (ConfigModel) – The config model that has been changed

  • prop_name (str) – Should always be ‘config’

  • info (dict) – Information e.g. about the changed config key

on_copy_selection_activate(widget, data=None)
on_cut_selection_activate(widget, data=None)
static on_data_flow_mode_toggled(widget, data=None)
on_delete_activate(widget, data=None)
on_delete_check_sm_modified()
on_delete_check_sm_running()
on_delete_event(widget, event, data=None, force=False)
on_destroy(widget, data=None)
on_escape_key_press_event_leave_full_screen(widget, event)
on_expert_view_activate(widget, data=None)
on_full_screen_activate(*args)

function to display the currently selected state machine in full screen mode :param args: :return:

on_full_screen_deactivate()
on_full_screen_mode_toggled(*args)
on_grid_toggled(widget, data=None)
on_group_states_activate(widget, data=None)
static on_layout_state_machine(*args, **kwargs)
static on_menu_preferences_activate(widget, data=None)
on_new_activate(widget=None, data=None)
static on_open_activate(widget=None, data=None, path=None)
static on_open_library_state_separately_activate(widget, data=None, cursor_position=None)
on_paste_clipboard_activate(widget, data=None)
on_pause_activate(widget, data=None)
on_quit_activate(widget, data=None, force=False)
on_redo_activate(widget, data=None)
on_refresh_all_activate(widget, data=None, force=False)
static on_refresh_libraries_activate()
on_refresh_selected_activate(widget, data=None, force=False)
on_run_only_selected_state_activate(widget, data=None)
on_run_selected_state_activate(widget, data=None)
on_run_to_selected_state_activate(widget, data=None)
on_save_activate(widget, data=None, delete_old_state_machine=False)
on_save_as_activate(widget=None, data=None, path=None)
on_save_as_copy_activate(widget=None, data=None, path=None)
static on_save_selected_state_as_activate(widget=None, data=None, path=None)
on_search_activate(widget, data=None, cursor_position=None)
static on_show_aborted_preempted_toggled(widget, data=None)
static on_show_data_flows_toggled(widget, data=None)
static on_show_data_values_toggled(widget, data=None)
static on_show_transitions_toggled(widget, data=None)
on_start_activate(widget, data=None)
on_start_from_selected_state_activate(widget, data=None)
on_step_into_activate(widget, data=None)
on_step_mode_activate(widget, data=None)
on_step_out_activate(widget, data=None)
on_step_over_activate(widget, data=None)
on_stop_activate(widget, data=None)
static on_substitute_library_with_template_activate(widget=None, data=None)
static on_substitute_selected_state_activate(widget=None, data=None, path=None)
on_toggle_full_screen_mode(*args, **kwargs)
static on_toggle_is_start_state_active(widget, data=None)
on_undo_activate(widget, data=None)
on_ungroup_state_activate(widget, data=None)
refresh_shortcuts()
register_actions(shortcut_manager)

Register callback methods for triggered actions

Parameters:

shortcut_manager (rafcon.gui.shortcut_manager.ShortcutManager) – Shortcut Manager Object holding mappings between shortcuts and actions.

register_view(view)

Called when the View was registered

show_aborted_preempted(*args, **kwargs)
show_data_flows_toggled_shortcut(*args, **kwargs)
show_data_values_toggled_shortcut(*args, **kwargs)
show_transitions_toggled_shortcut(*args, **kwargs)
unregister_view()

import log Unregister all registered functions to a view element :return:

ModificationHistoryTreeController (in modification_history)

class rafcon.gui.controllers.modification_history.ModificationHistoryTreeController(model, view)

Bases: ExtendedController

static get_color_active(active)
new_change(model, method_name, instance, info, history_id, active, parent_tree_item, parameters, tool_tip=None)
on_cursor_changed(widget)
on_redo_button_clicked(widget, event=None)
on_reset_button_clicked(widget, event=None)
on_toggle_mode(widget, event=None)
on_toggle_tree_folded(widget, event=None)
on_undo_button_clicked(widget, event=None)
redo(key_value, modifier_mask, **kwargs)

Redo for selected state-machine if no state-source-editor is open and focused in states-editor-controller.

Returns:

True if a redo was performed, False if focus on source-editor.

Return type:

bool

register()

Change the state machine that is observed for new selected states to the selected state machine. :return:

register_actions(shortcut_manager)

Register callback methods for triggered actions

Parameters:

shortcut_manager (rafcon.gui.shortcut_manager.ShortcutManager) –

register_view(view)

Called when the View was registered

Can be used e.g. to connect signals. Here, this implements a convenient feature that observes if thread problems are possible by destroying a controller before being fully initialized.

state_machine_manager_notification(model, property, info)
undo(key_value, modifier_mask, **kwargs)

Undo for selected state-machine if no state-source-editor is open and focused in states-editor-controller.

Returns:

True if a undo was performed, False if focus on source-editor.

Return type:

bool

update(model, prop_name, info)

The method updates the history (a Gtk.TreeStore) which is the model of respective TreeView. It functionality is strongly depends on a consistent history-tree hold by a ChangeHistory-Class.

StateMachineTreeController (in state_machine_tree)

class rafcon.gui.controllers.state_machine_tree.StateMachineTreeController(model, view)

Bases: TreeViewController

Controller handling the state machine tree.

Parameters:
  • model (rafcon.gui.models.state_machine_manager.StateMachineManagerModel) – The state machine manager model, holding data regarding state machines. Should be exchangeable.

  • view (rafcon.gui.views.state_machine_tree.StateMachineTreeView) – The GTK view showing the state machine tree.

CORE_ELEMENT_CLASS

alias of State

ID_STORAGE_ID = 1
MODEL_STORAGE_ID = 3
NAME_STORAGE_ID = 0
STATE_PATH_STORAGE_ID = 4
TYPE_NAME_STORAGE_ID = 2
action_signal(model, prop_name, info)
assign_notification_selection(state_machine_m, signal_name, signal_msg)
get_row_iter_for_state_model(state_model)
get_state_machine_selection()

Getter state machine selection

Returns:

selection object, filtered set of selected states

Return type:

rafcon.gui.selection.Selection, set

insert_and_update_recursively(parent_iter, state_model, with_expand=False)

Insert and/or update the handed state model in parent tree store element iterator

Parameters:
  • parent_iter – Parent tree store iterator the insert should be performed in

  • state_model (StateModel) – Model of state that has to be insert and/or updated

  • with_expand (bool) – Trigger to expand tree

Returns:

mouse_click(widget, event=None)
paste_action_callback(*event, **kwargs)

Callback method for paste action

redo_expansion_state(ignore_not_existing_rows=False)

Considers the tree to be collapsed and expand into all tree item with the flag set True

register()

Change the state machine that is observed for new selected states to the selected state machine.

register_actions(shortcut_manager)

Register callback methods for triggered actions

Parameters:

shortcut_manager (rafcon.gui.shortcut_manager.ShortcutManager) – Shortcut Manager Object holding mappings between shortcuts and actions.

register_view(view)

Called when the view was registered

remove_tree_children(child_tree_iter)
selection_changed(widget, event=None)

Notify state machine about tree view selection

show_content(state_model)

Check state machine tree specific show content flag.

Is returning true if the upper most library state of a state model has a enabled show content flag or if there is no library root state above this state.

Parameters:

state_model (rafcon.gui.models.abstract_state.AbstractStateModel) – The state model to check

state_action_signal(model, prop_name, info)
state_machine_manager_notification(model, property, info)
state_machine_notification(model, property, info)
state_meta_update(model, prop_name, info)
states_update(model, prop_name, info)
states_update_before(model, prop_name, info)
store_expansion_state()
update(changed_state_model=None, with_expand=False)

Checks if all states are in tree and if tree has states which were deleted

Parameters:
  • changed_state_model – Model that row has to be updated

  • with_expand – The expand flag for the tree

update_tree_store_row(state_model)

StatesEditorController (in states_editor)

class rafcon.gui.controllers.states_editor.StatesEditorController(model, view)

Bases: ExtendedController

Controller handling the states editor

Parameters:
  • model (rafcon.gui.models.state_machine_manager.StateMachineManagerModel) – The state machine manager model, holding data regarding state machines.

  • view (rafcon.gui.views.states_editor.StatesEditorView) – The GTK view showing state editor tabs.

Variables:
  • tabs – Currently open State Editor tabs.

  • closed_tabs – Previously opened, non-deleted State Editor tabs.

activate_state_tab(state_m)

Opens the tab for the specified state model

The tab with the given state model is opened or set to foreground.

Parameters:

state_m – The desired state model (the selected state)

add_state_editor(state_m)

Triggered whenever a state is selected.

Parameters:

state_m – The selected state model.

close_all_pages()

Closes all tabs of the states editor

close_page(state_identifier, delete=True)

Closes the desired page

The page belonging to the state with the specified state_identifier is closed. If the deletion flag is set to False, the controller of the page is stored for later usage.

Parameters:
  • state_identifier – Identifier of the page’s state

  • delete – Whether to delete the controller (deletion is necessary if teh state is deleted)

close_pages_for_specific_sm_id(sm_id)

Closes all tabs of the states editor for a specific sm_id

property current_state_machine_m
get_current_state_m()

Returns the state model of the currently open tab

get_page_of_state_m(state_m)

Return the identifier and page of a given state model

Parameters:

state_m – The state model to be searched

Returns:

page containing the state and the state_identifier

get_state_identifier(state_m)
get_state_identifier_for_page(page)

Returns the state identifier for a given page

notify_state_name_change(model, prop_name, info)

Checks whether the name of a state was changed and change the tab label accordingly

on_close_clicked(widget, page_num)
on_config_value_changed(config_m, prop_name, info)

Callback when a config value has been changed

Parameters:
  • config_m (ConfigModel) – The config model that has been changed

  • prop_name (str) – Should always be ‘config’

  • info (dict) – Information e.g. about the changed config key

on_switch_page(notebook, page_pointer, page_num, user_param1=None)

Update state machine and state selection when the active tab was changed

When the state editor tab switches (e.g. when a tab is closed), this callback causes the state machine tab corresponding to the activated state editor tab to be opened and the corresponding state to be selected.

This is disabled for now, as the might be irritating for the user

on_tab_close_clicked(event, state_m)

Triggered when the states-editor close button is clicked

Closes the tab.

Parameters:

state_m – The desired state model (the selected state)

on_toggle_sticky_clicked(event, state_m)

Callback for the “toggle-sticky-check-button” emitted by custom TabLabel widget.

prepare_destruction()
register_actions(shortcut_manager)

Register callback methods for triggered actions

Parameters:

shortcut_manager (rafcon.gui.shortcut_manager.ShortcutManager) – Shortcut Manager Object holding mappings between shortcuts and actions.

register_view(view)

Called when the View was registered

Can be used e.g. to connect signals. Here, this implements a convenient feature that observes if thread problems are possible by destroying a controller before being fully initialized.

reload_style()

Closes all tabs and reopens only the current tab in the new style.

Returns:

rename_selected_state(key_value, modifier_mask, **kwargs)

Callback method for shortcut action rename

Searches for a single selected state model and open the according page. Page is created if it is not existing. Then the rename method of the state controller is called.

Parameters:
  • key_value

  • modifier_mask

root_state_changed(model, property, info)
script_text_changed(text_buffer, state_m)

Update gui elements according text buffer changes

Checks if the dirty flag needs to be set and the tab label to be updated.

Parameters:
Returns:

selection_notification(state_machine_m, property, info)

If a single state is selected, open the corresponding tab

state_action_signal(model, prop_name, info)
state_machine_manager_notification(model, property, info)

Triggered whenever a new state machine is created, or an existing state machine is selected.

state_machines_del_notification(model, prop_name, info)

Relive models of closed state machine

state_machines_set_notification(model, prop_name, info)

Observe all open state machines and their root states

update_tab_label(state_m)

Update all tab labels

Parameters:

state_m (rafcon.state_machine.states.state.State) – State model who’s tab label is to be updated

rafcon.gui.controllers.states_editor.create_button(toggle, font_size, icon_code, release_callback=None, *additional_parameters)
rafcon.gui.controllers.states_editor.create_sticky_button(callback, *additional_parameters)
rafcon.gui.controllers.states_editor.create_tab_close_button(callback, *additional_parameters)
rafcon.gui.controllers.states_editor.create_tab_header(title, close_callback, sticky_callback, *additional_parameters)
rafcon.gui.controllers.states_editor.set_tab_label_texts(label, state_m, unsaved_changes=False)

ToolBarController (in tool_bar)

class rafcon.gui.controllers.tool_bar.ToolBarController(state_machine_manager_model, view)

Bases: ExtendedController

The class to trigger all the action, available in the tool bar.

Parameters:
  • state_machine_manager_model (rafcon.gui.models.state_machine_manager.StateMachineManagerModel) – The state machine manager model, holding data regarding state machines. Should be exchangeable.

  • view

on_button_bake_state_machine_clicked(widget, data=None)
on_button_layout_state_machine(widget, data=None)
on_button_new_clicked(widget, data=None)
on_button_open_clicked(widget, data=None)
on_button_refresh_clicked(widget, data=None)
on_button_refresh_libs_clicked(widget, data=None)
on_button_refresh_selected_clicked(widget, data=None)
on_button_save_clicked(widget, data=None)
register_actions(shortcut_manager)

Register callback methods for triggered actions

Parameters:

shortcut_manager (rafcon.gui.shortcut_manager.ShortcutManager) –

register_view(view)

Called when the View was registered

TopToolBarController (in top_tool_bar)

class rafcon.gui.controllers.top_tool_bar.TopToolBarController(state_machine_manager_model, view, top_level_window)

Bases: ExtendedController

The class to trigger all the actions available in the top tool bar.

Parameters:
  • state_machine_manager_model (rafcon.gui.models.state_machine_manager.StateMachineManagerModel) – The state machine manager model, holding data regarding state machines. Should be exchangeable.

  • view (rafcon.gui.views.top_tool_bar.TopToolBarView) – The GTK View showing the top tool bar buttons.

  • top_level_window – The top level window containing the top tool bar.

on_maximize_button_clicked(widget, data=None)
on_minimize_button_clicked(widget, data=None)
register_view(view)

Called when the View was registered

update_maximize_button()
class rafcon.gui.controllers.top_tool_bar.TopToolBarUndockedWindowController(state_machine_manager_model, view, redock_method)

Bases: TopToolBarController

Controller handling the top tool bar in the un-docked windows.

In this controller, the close button in the top tool bar is hidden.

on_redock_button_clicked(widget, event=None)

Triggered when the redock button in any window is clicked.

Calls the corresponding redocking function of the open window.

register_view(view)

Called when the View was registered

StateIconController (in state_icons)

class rafcon.gui.controllers.state_icons.StateIconController(model=None, view=None, shortcut_manager=None)

Bases: ExtendedController

on_drag_begin(widget, context)

replace drag icon

Parameters:
  • widget

  • context

on_drag_data_get(widget, context, data, info, time)

dragged state is inserted and its state_id sent to the receiver

Parameters:
  • widget

  • context

  • data – SelectionData: contains state_id

  • info

  • time

on_drag_end(widget, context)

if the drag is finished, all icons are unselected

Parameters:
  • widget

  • context

on_mouse_click(widget, event)

state insertion on mouse click

Parameters:
  • widget

  • event (Gdk.Event) – mouse click event

on_mouse_motion(widget, event)

selection on mouse over

Parameters:
  • widget

  • event (Gdk.Event) – mouse motion event

register_view(view)

Called when the View was registered

Can be used e.g. to connect signals. Here, this implements a convenient feature that observes if thread problems are possible by destroying a controller before being fully initialized.

UndockedWindowController (in undocked_window)

class rafcon.gui.controllers.undocked_window.UndockedWindowController(state_machine_manager_model, view, redock_method)

Bases: ExtendedController

Controller handling the un-docked windows

Parameters:
  • state_machine_manager_model (rafcon.gui.models.state_machine_manager.StateMachineManagerModel) – The state machine manager model, holding data regarding state machines. Should be exchangeable.

  • view (rafcon.gui.views.undocked_window.UndockedWindowView) – The GTK View showing the separate window

hide_window()