sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def update_is_start(self):
"""Updates the `is_start` property of the state
A state is a start state, if it is the root state, it has no parent, the parent is a LibraryState or the state's
state_id is identical with the ContainerState.start_state_id of the ContainerState it is within.
... | Updates the `is_start` property of the state
A state is a start state, if it is the root state, it has no parent, the parent is a LibraryState or the state's
state_id is identical with the ContainerState.start_state_id of the ContainerState it is within. | entailment |
def prepare_destruction(self, recursive=True):
"""Prepares the model for destruction
Recursively un-registers all observers and removes references to child models
"""
if self.state is None:
logger.verbose("Multiple calls of prepare destruction for {0}".format(self))
... | Prepares the model for destruction
Recursively un-registers all observers and removes references to child models | entailment |
def get_state_machine_m(self, two_factor_check=True):
""" Get respective state machine model
Get a reference of the state machine model the state model belongs to. As long as the root state model
has no direct reference to its state machine model the state machine manager model is checked respe... | Get respective state machine model
Get a reference of the state machine model the state model belongs to. As long as the root state model
has no direct reference to its state machine model the state machine manager model is checked respective model.
:rtype: rafcon.gui.models.state_machine.Stat... | entailment |
def get_input_data_port_m(self, data_port_id):
"""Returns the input data port model for the given data port id
:param data_port_id: The data port id to search for
:return: The model of the data port with the given id
"""
for data_port_m in self.input_data_ports:
if d... | Returns the input data port model for the given data port id
:param data_port_id: The data port id to search for
:return: The model of the data port with the given id | entailment |
def get_output_data_port_m(self, data_port_id):
"""Returns the output data port model for the given data port id
:param data_port_id: The data port id to search for
:return: The model of the data port with the given id
"""
for data_port_m in self.output_data_ports:
i... | Returns the output data port model for the given data port id
:param data_port_id: The data port id to search for
:return: The model of the data port with the given id | entailment |
def get_data_port_m(self, data_port_id):
"""Searches and returns the model of a data port of a given state
The method searches a port with the given id in the data ports of the given state model. If the state model
is a container state, not only the input and output data ports are looked at, bu... | Searches and returns the model of a data port of a given state
The method searches a port with the given id in the data ports of the given state model. If the state model
is a container state, not only the input and output data ports are looked at, but also the scoped variables.
:param data_po... | entailment |
def get_outcome_m(self, outcome_id):
"""Returns the outcome model for the given outcome id
:param outcome_id: The outcome id to search for
:return: The model of the outcome with the given id
"""
for outcome_m in self.outcomes:
if outcome_m.outcome.outcome_id == outco... | Returns the outcome model for the given outcome id
:param outcome_id: The outcome id to search for
:return: The model of the outcome with the given id | entailment |
def action_signal_triggered(self, model, prop_name, info):
"""This method notifies the parent state and child state models about complex actions
"""
msg = info.arg
# print("action_signal_triggered state: ", self.state.state_id, model, prop_name, info)
if msg.action.startswith('sm... | This method notifies the parent state and child state models about complex actions | entailment |
def meta_changed(self, model, prop_name, info):
"""This method notifies the parent state about changes made to the meta data
"""
msg = info.arg
# print("meta_changed state: ", model, prop_name, info)
if msg.notification is None:
# Meta data of this state was changed, ... | This method notifies the parent state about changes made to the meta data | entailment |
def load_meta_data(self, path=None):
"""Load meta data of state model from the file system
The meta data of the state model is loaded from the file system and stored in the meta property of the model.
Existing meta data is removed. Also the meta data of all state elements (data ports, outcomes,... | Load meta data of state model from the file system
The meta data of the state model is loaded from the file system and stored in the meta property of the model.
Existing meta data is removed. Also the meta data of all state elements (data ports, outcomes,
etc) are loaded, as those stored in the... | entailment |
def store_meta_data(self, copy_path=None):
"""Save meta data of state model to the file system
This method generates a dictionary of the meta data of the state together with the meta data of all state
elements (data ports, outcomes, etc.) and stores it on the filesystem.
Secure that the... | Save meta data of state model to the file system
This method generates a dictionary of the meta data of the state together with the meta data of all state
elements (data ports, outcomes, etc.) and stores it on the filesystem.
Secure that the store meta data method is called after storing the co... | entailment |
def copy_meta_data_from_state_m(self, source_state_m):
"""Dismiss current meta data and copy meta data from given state model
The meta data of the given state model is used as meta data for this state. Also the meta data of all state
elements (data ports, outcomes, etc.) is overwritten with the... | Dismiss current meta data and copy meta data from given state model
The meta data of the given state model is used as meta data for this state. Also the meta data of all state
elements (data ports, outcomes, etc.) is overwritten with the meta data of the elements of the given state.
:param sou... | entailment |
def _parse_for_element_meta_data(self, meta_data):
"""Load meta data for state elements
The meta data of the state meta data file also contains the meta data for state elements (data ports,
outcomes, etc). This method parses the loaded meta data for each state element model. The meta data of th... | Load meta data for state elements
The meta data of the state meta data file also contains the meta data for state elements (data ports,
outcomes, etc). This method parses the loaded meta data for each state element model. The meta data of the
elements is removed from the passed dictionary.
... | entailment |
def _copy_element_meta_data_from_meta_file_data(meta_data, element_m, element_name, element_id):
"""Helper method to assign the meta of the given element
The method assigns the meta data of the elements from the given meta data dictionary. The copied meta data is
then removed from the dictionar... | Helper method to assign the meta of the given element
The method assigns the meta data of the elements from the given meta data dictionary. The copied meta data is
then removed from the dictionary.
:param meta_data: The loaded meta data
:param element_m: The element model that is suppo... | entailment |
def _generate_element_meta_data(self, meta_data):
"""Generate meta data for state elements and add it to the given dictionary
This method retrieves the meta data of the state elements (data ports, outcomes, etc) and adds it to the
given meta data dictionary.
:param meta_data: Dictionar... | Generate meta data for state elements and add it to the given dictionary
This method retrieves the meta data of the state elements (data ports, outcomes, etc) and adds it to the
given meta data dictionary.
:param meta_data: Dictionary of meta data | entailment |
def save_file_data(self, path):
""" Implements the abstract method of the ExternalEditor class.
"""
sm = self.model.state.get_state_machine()
if sm.marked_dirty and not self.saved_initial:
try:
# Save the file before opening it to update the applied changes. U... | Implements the abstract method of the ExternalEditor class. | entailment |
def load_and_set_file_content(self, file_system_path):
""" Implements the abstract method of the ExternalEditor class.
"""
content = filesystem.read_file(file_system_path, storage.SCRIPT_FILE)
if content is not None:
self.set_script_text(content) | Implements the abstract method of the ExternalEditor class. | entailment |
def apply_clicked(self, button):
"""Triggered when the Apply button in the source editor is clicked.
"""
if isinstance(self.model.state, LibraryState):
logger.warning("It is not allowed to modify libraries.")
self.view.set_text("")
return
# Ugly work... | Triggered when the Apply button in the source editor is clicked. | entailment |
def split_text(text_to_split):
"""Split text
Splits the debug text into its different parts: 'Time', 'LogLevel + Module Name', 'Debug message'
:param text_to_split: Text to split
:return: List containing the content of text_to_split split up
"""
assert isinstance(text_t... | Split text
Splits the debug text into its different parts: 'Time', 'LogLevel + Module Name', 'Debug message'
:param text_to_split: Text to split
:return: List containing the content of text_to_split split up | entailment |
def update_auto_scroll_mode(self):
""" Register or un-register signals for follow mode """
if self._enables['CONSOLE_FOLLOW_LOGGING']:
if self._auto_scroll_handler_id is None:
self._auto_scroll_handler_id = self.text_view.connect("size-allocate", self._auto_scroll)
el... | Register or un-register signals for follow mode | entailment |
def _auto_scroll(self, *args):
""" Scroll to the end of the text view """
adj = self['scrollable'].get_vadjustment()
adj.set_value(adj.get_upper() - adj.get_page_size()) | Scroll to the end of the text view | entailment |
def get_line_number_next_to_cursor_with_string_within(self, s):
""" Find the closest occurrence of a string with respect to the cursor position in the text view """
line_number, _ = self.get_cursor_position()
text_buffer = self.text_view.get_buffer()
line_iter = text_buffer.get_iter_at_l... | Find the closest occurrence of a string with respect to the cursor position in the text view | entailment |
def set_variable(self, key, value, per_reference=False, access_key=None, data_type=None):
"""Sets a global variable
:param key: the key of the global variable to be set
:param value: the new value of the global variable
:param per_reference: a flag to decide if the variable should be st... | Sets a global variable
:param key: the key of the global variable to be set
:param value: the new value of the global variable
:param per_reference: a flag to decide if the variable should be stored per reference or per value
:param access_key: if the variable was explicitly locked with... | entailment |
def get_variable(self, key, per_reference=None, access_key=None, default=None):
"""Fetches the value of a global variable
:param key: the key of the global variable to be fetched
:param bool per_reference: a flag to decide if the variable should be stored per reference or per value
:par... | Fetches the value of a global variable
:param key: the key of the global variable to be fetched
:param bool per_reference: a flag to decide if the variable should be stored per reference or per value
:param access_key: if the variable was explicitly locked with the rafcon.state lock_variable
... | entailment |
def variable_can_be_referenced(self, key):
"""Checks whether the value of the variable can be returned by reference
:param str key: Name of the variable
:return: True if value of variable can be returned by reference, False else
"""
key = str(key)
return key in self.__va... | Checks whether the value of the variable can be returned by reference
:param str key: Name of the variable
:return: True if value of variable can be returned by reference, False else | entailment |
def delete_variable(self, key):
"""Deletes a global variable
:param key: the key of the global variable to be deleted
:raises exceptions.AttributeError: if the global variable does not exist
"""
key = str(key)
if self.is_locked(key):
raise RuntimeError("Glob... | Deletes a global variable
:param key: the key of the global variable to be deleted
:raises exceptions.AttributeError: if the global variable does not exist | entailment |
def lock_variable(self, key, block=False):
"""Locks a global variable
:param key: the key of the global variable to be locked
:param block: a flag to specify if to wait for locking the variable in blocking mode
"""
key = str(key)
# watch out for releasing the __dictionar... | Locks a global variable
:param key: the key of the global variable to be locked
:param block: a flag to specify if to wait for locking the variable in blocking mode | entailment |
def unlock_variable(self, key, access_key, force=False):
"""Unlocks a global variable
:param key: the key of the global variable to be unlocked
:param access_key: the access key to be able to unlock the global variable
:param force: if the variable should be unlocked forcefully
... | Unlocks a global variable
:param key: the key of the global variable to be unlocked
:param access_key: the access key to be able to unlock the global variable
:param force: if the variable should be unlocked forcefully
:raises exceptions.AttributeError: if the global variable does not e... | entailment |
def set_locked_variable(self, key, access_key, value):
"""Set an already locked global variable
:param key: the key of the global variable to be set
:param access_key: the access key to the already locked global variable
:param value: the new value of the global variable
"""
... | Set an already locked global variable
:param key: the key of the global variable to be set
:param access_key: the access key to the already locked global variable
:param value: the new value of the global variable | entailment |
def get_locked_variable(self, key, access_key):
"""Returns the value of an global variable that is already locked
:param key: the key of the global variable
:param access_key: the access_key to the global variable that is already locked
"""
return self.get_variable(key, per_refe... | Returns the value of an global variable that is already locked
:param key: the key of the global variable
:param access_key: the access_key to the global variable that is already locked | entailment |
def is_locked(self, key):
"""Returns the status of the lock of a global variable
:param key: the unique key of the global variable
:return:
"""
key = str(key)
if key in self.__variable_locks:
return self.__variable_locks[key].locked()
return False | Returns the status of the lock of a global variable
:param key: the unique key of the global variable
:return: | entailment |
def get_all_keys_starting_with(self, start_key):
""" Returns all keys, which start with a certain pattern defined in :param start_key.
:param start_key: The start pattern to search all keys for.
:return:
"""
start_key = str(start_key)
output_list = []
if len(self... | Returns all keys, which start with a certain pattern defined in :param start_key.
:param start_key: The start pattern to search all keys for.
:return: | entailment |
def global_variable_dictionary(self):
"""Property for the _global_variable_dictionary field"""
dict_copy = {}
for key, value in self.__global_variable_dictionary.items():
if key in self.__variable_references and self.__variable_references[key]:
dict_copy[key] = value
... | Property for the _global_variable_dictionary field | entailment |
def check_value_and_type(value, data_type):
"""Checks if a given value is of a specific type
:param value: the value to check
:param data_type: the type to be checked upon
:return:
"""
if value is not None and data_type is not type(None):
# if not isinstance(... | Checks if a given value is of a specific type
:param value: the value to check
:param data_type: the type to be checked upon
:return: | entailment |
def glue(self, pos):
"""Calculates the distance between the given position and the port
:param (float, float) pos: Distance to this position is calculated
:return: Distance to port
:rtype: float
"""
# Distance between border of rectangle and point
# Equation from... | Calculates the distance between the given position and the port
:param (float, float) pos: Distance to this position is calculated
:return: Distance to port
:rtype: float | entailment |
def format_time(time):
""" Formats the given time into HH:MM:SS """
h, r = divmod(time / 1000, 3600)
m, s = divmod(r, 60)
return "%02d:%02d:%02d" % (h, m, s) | Formats the given time into HH:MM:SS | entailment |
def __destroy(self):
"""Remove controller from parent controller and/or destroy it self."""
if self.parent:
self.parent.remove_controller(self)
else:
self.destroy() | Remove controller from parent controller and/or destroy it self. | entailment |
def register_view(self, view):
"""Called when the View was registered"""
super(PreferencesWindowController, self).register_view(view)
self.view['add_library_button'].connect('clicked', self._on_add_library)
self.view["remove_library_button"].connect('clicked', self._on_remove_library)
... | Called when the View was registered | entailment |
def on_config_value_changed(self, config_m, prop_name, info):
"""Callback when a config value has been changed
Only collects information, delegates handling further to _handle_config_update
:param ConfigModel config_m: The config model that has been changed
:param str prop_name: Should... | Callback when a config value has been changed
Only collects information, delegates handling further to _handle_config_update
:param ConfigModel config_m: The config model that has been changed
:param str prop_name: Should always be 'config'
:param dict info: Information e.g. about the ... | entailment |
def on_preliminary_config_changed(self, config_m, prop_name, info):
"""Callback when a preliminary config value has been changed
Mainly collects information, delegates handling further to _handle_config_update
:param ConfigModel config_m: The config model that has been changed
:param s... | Callback when a preliminary config value has been changed
Mainly collects information, delegates handling further to _handle_config_update
:param ConfigModel config_m: The config model that has been changed
:param str prop_name: Should always be 'preliminary_config'
:param dict info: I... | entailment |
def _handle_config_update(self, config_m, config_key):
"""Handles changes in config values
The method ensure that the correct list stores are updated with the new values.
:param ConfigModel config_m: The config model that has been changed
:param config_key: The config key who's value ... | Handles changes in config values
The method ensure that the correct list stores are updated with the new values.
:param ConfigModel config_m: The config model that has been changed
:param config_key: The config key who's value has been changed
:return: | entailment |
def update_all(self):
"""Shorthand method to update all collection information
"""
self.update_path_labels()
self.update_core_config_list_store()
self.update_gui_config_list_store()
self.update_libraries_list_store()
self.update_shortcut_settings()
self.ch... | Shorthand method to update all collection information | entailment |
def check_for_preliminary_config(self):
"""Activates the 'Apply' button if there are preliminary changes
"""
if any([self.model.preliminary_config, self.gui_config_model.preliminary_config]):
self.view['apply_button'].set_sensitive(True)
else:
self.view['apply_but... | Activates the 'Apply' button if there are preliminary changes | entailment |
def update_path_labels(self):
"""Update labels showing config paths
"""
self.view['core_label'].set_text("Core Config Path: " + str(self.core_config_model.config.config_file_path))
self.view['gui_label'].set_text("GUI Config Path: " + str(self.gui_config_model.config.config_file_path)) | Update labels showing config paths | entailment |
def update_config_value(self, config_m, config_key):
"""Updates the corresponding list store of a changed config value
:param ConfigModel config_m: The config model that has been changed
:param str config_key: The config key who's value has been changed
"""
config_value = config... | Updates the corresponding list store of a changed config value
:param ConfigModel config_m: The config model that has been changed
:param str config_key: The config key who's value has been changed | entailment |
def _update_list_store_entry(self, list_store, config_key, config_value):
"""Helper method to update a list store
:param Gtk.ListStore list_store: List store to be updated
:param str config_key: Config key to search for
:param config_value: New config value
:returns: Row of list... | Helper method to update a list store
:param Gtk.ListStore list_store: List store to be updated
:param str config_key: Config key to search for
:param config_value: New config value
:returns: Row of list store that has been updated
:rtype: int | entailment |
def _update_list_store(config_m, list_store, ignore_keys=None):
"""Generic method to create list store for a given config model
:param ConfigModel config_m: Config model to read into list store
:param Gtk.ListStore list_store: List store to be filled
:param list ignore_keys: List of key... | Generic method to create list store for a given config model
:param ConfigModel config_m: Config model to read into list store
:param Gtk.ListStore list_store: List store to be filled
:param list ignore_keys: List of keys that should be ignored | entailment |
def update_libraries_list_store(self):
"""Creates the list store for the libraries
"""
self.library_list_store.clear()
libraries = self.core_config_model.get_current_config_value("LIBRARY_PATHS", use_preliminary=True, default={})
library_names = sorted(libraries.keys())
f... | Creates the list store for the libraries | entailment |
def update_shortcut_settings(self):
"""Creates the list store for the shortcuts
"""
self.shortcut_list_store.clear()
shortcuts = self.gui_config_model.get_current_config_value("SHORTCUTS", use_preliminary=True, default={})
actions = sorted(shortcuts.keys())
for action in ... | Creates the list store for the shortcuts | entailment |
def _select_row_by_column_value(tree_view, list_store, column, value):
"""Helper method to select a tree view row
:param Gtk.TreeView tree_view: Tree view who's row is to be selected
:param Gtk.ListStore list_store: List store of the tree view
:param int column: Column in which the valu... | Helper method to select a tree view row
:param Gtk.TreeView tree_view: Tree view who's row is to be selected
:param Gtk.ListStore list_store: List store of the tree view
:param int column: Column in which the value is searched
:param value: Value to search for
:returns: Row of l... | entailment |
def _on_add_library(self, *event):
"""Callback method handling the addition of a new library
"""
self.view['library_tree_view'].grab_focus()
if react_to_event(self.view, self.view['library_tree_view'], event):
temp_library_name = "<LIB_NAME_%s>" % self._lib_counter
... | Callback method handling the addition of a new library | entailment |
def _on_remove_library(self, *event):
"""Callback method handling the removal of an existing library
"""
self.view['library_tree_view'].grab_focus()
if react_to_event(self.view, self.view['library_tree_view'], event):
path = self.view["library_tree_view"].get_cursor()[0]
... | Callback method handling the removal of an existing library | entailment |
def _on_checkbox_toggled(self, renderer, path, config_m, config_list_store):
"""Callback method handling a config toggle event
:param Gtk.CellRenderer renderer: Cell renderer that has been toggled
:param path: Path within the list store
:param ConfigModel config_m: The config model rela... | Callback method handling a config toggle event
:param Gtk.CellRenderer renderer: Cell renderer that has been toggled
:param path: Path within the list store
:param ConfigModel config_m: The config model related to the toggle option
:param Gtk.ListStore config_list_store: The list store ... | entailment |
def _on_import_config(self, *args):
"""Callback method the the import button was clicked
Shows a dialog allowing to import an existing configuration file
"""
def handle_import(dialog_text, path_name):
chooser = Gtk.FileChooserDialog(dialog_text, None,
... | Callback method the the import button was clicked
Shows a dialog allowing to import an existing configuration file | entailment |
def _on_export_config(self, *args):
"""Callback method the the export button was clicked
Shows dialogs allowing to export the configurations into separate files
"""
response = self._config_chooser_dialog("Export configuration",
"Please sele... | Callback method the the export button was clicked
Shows dialogs allowing to export the configurations into separate files | entailment |
def _on_ok_button_clicked(self, *args):
"""OK button clicked: Applies the configurations and closes the window
"""
if self.core_config_model.preliminary_config or self.gui_config_model.preliminary_config:
self._on_apply_button_clicked()
self.__destroy() | OK button clicked: Applies the configurations and closes the window | entailment |
def _on_cancel_button_clicked(self, *args):
"""Cancel button clicked: Dismiss preliminary config and close the window
"""
self.core_config_model.preliminary_config.clear()
self.gui_config_model.preliminary_config.clear()
self.__destroy() | Cancel button clicked: Dismiss preliminary config and close the window | entailment |
def _on_apply_button_clicked(self, *args):
"""Apply button clicked: Apply the configuration
"""
refresh_required = self.core_config_model.apply_preliminary_config()
refresh_required |= self.gui_config_model.apply_preliminary_config()
if not self.gui_config_model.config.get_confi... | Apply button clicked: Apply the configuration | entailment |
def _on_library_name_changed(self, renderer, path, new_library_name):
"""Callback handling a change of a library name
:param Gtk.CellRenderer renderer: Cell renderer showing the library name
:param path: Path of library within the list store
:param str new_library_name: New library name... | Callback handling a change of a library name
:param Gtk.CellRenderer renderer: Cell renderer showing the library name
:param path: Path of library within the list store
:param str new_library_name: New library name | entailment |
def _on_library_path_changed(self, renderer, path, new_library_path):
"""Callback handling a change of a library path
:param Gtk.CellRenderer renderer: Cell renderer showing the library path
:param path: Path of library within the list store
:param str new_library_path: New library path... | Callback handling a change of a library path
:param Gtk.CellRenderer renderer: Cell renderer showing the library path
:param path: Path of library within the list store
:param str new_library_path: New library path | entailment |
def _on_shortcut_changed(self, renderer, path, new_shortcuts):
"""Callback handling a change of a shortcut
:param Gtk.CellRenderer renderer: Cell renderer showing the shortcut
:param path: Path of shortcuts within the list store
:param str new_shortcuts: New shortcuts
"""
... | Callback handling a change of a shortcut
:param Gtk.CellRenderer renderer: Cell renderer showing the shortcut
:param path: Path of shortcuts within the list store
:param str new_shortcuts: New shortcuts | entailment |
def _on_config_value_changed(self, renderer, path, new_value, config_m, list_store):
"""Callback handling a change of a config value
:param Gtk.CellRenderer renderer: Cell renderer showing the shortcut
:param path: Path of shortcuts within the list store
:param ConfigModel config_m: The... | Callback handling a change of a config value
:param Gtk.CellRenderer renderer: Cell renderer showing the shortcut
:param path: Path of shortcuts within the list store
:param ConfigModel config_m: The config model that is to be changed
:param Gtk.ListStore list_store: The list store that... | entailment |
def _config_chooser_dialog(self, title_text, description):
"""Dialog to select which config shall be exported
:param title_text: Title text
:param description: Description
"""
dialog = Gtk.Dialog(title_text, self.view["preferences_window"],
flags=0, b... | Dialog to select which config shall be exported
:param title_text: Title text
:param description: Description | entailment |
def check_if_dict_contains_object_reference_in_values(object_to_check, dict_to_check):
""" Method to check if an object is inside the values of a dict.
A simple object_to_check in dict_to_check.values() does not work as it uses the __eq__ function of the object
and not the object reference.
:param obje... | Method to check if an object is inside the values of a dict.
A simple object_to_check in dict_to_check.values() does not work as it uses the __eq__ function of the object
and not the object reference.
:param object_to_check: The target object.
:param dict_to_check: The dict to search in.
:return: | entailment |
def update_data_flows(model, data_flow_dict, tree_dict_combos):
""" Updates data flow dictionary and combo dictionary of the widget according handed model.
:param model: model for which the data_flow_dict and tree_dict_combos should be updated
:param data_flow_dict: dictionary that holds all internal and e... | Updates data flow dictionary and combo dictionary of the widget according handed model.
:param model: model for which the data_flow_dict and tree_dict_combos should be updated
:param data_flow_dict: dictionary that holds all internal and external data-flows and those respective row labels
:param tree_dict_... | entailment |
def register_view(self, view):
"""Called when the View was registered
"""
super(StateDataFlowsListController, self).register_view(view)
def cell_text(column, cell_renderer, model, iter, container_model):
df_id = model.get_value(iter, self.ID_STORAGE_ID)
in_extern... | Called when the View was registered | entailment |
def remove_core_element(self, model):
"""Remove respective core element of handed data flow model
:param DataFlowModel model: Data Flow model which core element should be removed
:return:
"""
assert model.data_flow.parent is self.model.state or model.data_flow.parent is self.mod... | Remove respective core element of handed data flow model
:param DataFlowModel model: Data Flow model which core element should be removed
:return: | entailment |
def register_view(self, view):
"""Called when the View was registered
Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application
"""
super(StateDataFlowsEditorController, self).register_view(view)
view['add_d_button'].connect('clicked', s... | Called when the View was registered
Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application | entailment |
def start(self):
"""Starts the execution of the root state.
"""
# load default input data for the state
self._root_state.input_data = self._root_state.get_default_input_values_for_state(self._root_state)
self._root_state.output_data = self._root_state.create_output_dictionary_for... | Starts the execution of the root state. | entailment |
def join(self):
"""Wait for root state to finish execution"""
self._root_state.join()
# execution finished, close execution history log file (if present)
if len(self._execution_histories) > 0:
if self._execution_histories[-1].execution_history_storage is not None:
... | Wait for root state to finish execution | entailment |
def get_port_area(self, view):
"""Calculates the drawing area affected by the (hovered) port
"""
state_v = self.parent
center = self.handle.pos
margin = self.port_side_size / 4.
if self.side in [SnappedSide.LEFT, SnappedSide.RIGHT]:
height, width = self.port_s... | Calculates the drawing area affected by the (hovered) port | entailment |
def _draw_simple_state_port(self, context, direction, color, transparency):
"""Draw the port of a simple state (ExecutionState, LibraryState)
Connector for execution states can only be connected to the outside. Thus the connector fills the whole
border of the state.
:param context: Cai... | Draw the port of a simple state (ExecutionState, LibraryState)
Connector for execution states can only be connected to the outside. Thus the connector fills the whole
border of the state.
:param context: Cairo context
:param direction: The direction the port is pointing to
:par... | entailment |
def _draw_container_state_port(self, context, direction, color, transparency):
"""Draw the port of a container state
Connector for container states are split in an inner connector and an outer connector.
:param context: Cairo context
:param direction: The direction the port is pointing... | Draw the port of a container state
Connector for container states are split in an inner connector and an outer connector.
:param context: Cairo context
:param direction: The direction the port is pointing to
:param color: Desired color of the port
:param float transparency: The... | entailment |
def _draw_single_connector(context, width, height):
"""Draw the connector for execution states
Connector for execution states can only be connected to the outside. Thus the connector fills the whole
border of the state.
:param context: Cairo context
:param float port_size: The ... | Draw the connector for execution states
Connector for execution states can only be connected to the outside. Thus the connector fills the whole
border of the state.
:param context: Cairo context
:param float port_size: The side length of the port | entailment |
def _draw_inner_connector(context, width, height):
"""Draw the connector for container states
Connector for container states can be connected from the inside and the outside. Thus the connector is split
in two parts: A rectangle on the inside and an arrow on the outside. This methods draws the ... | Draw the connector for container states
Connector for container states can be connected from the inside and the outside. Thus the connector is split
in two parts: A rectangle on the inside and an arrow on the outside. This methods draws the inner rectangle.
:param context: Cairo context
... | entailment |
def _draw_outer_connector(context, width, height):
"""Draw the outer connector for container states
Connector for container states can be connected from the inside and the outside. Thus the connector is split
in two parts: A rectangle on the inside and an arrow on the outside. This method draws... | Draw the outer connector for container states
Connector for container states can be connected from the inside and the outside. Thus the connector is split
in two parts: A rectangle on the inside and an arrow on the outside. This method draws the outer arrow.
:param context: Cairo context
... | entailment |
def _draw_rectangle(context, width, height):
"""Draw a rectangle
Assertion: The current point is the center point of the rectangle
:param context: Cairo context
:param width: Width of the rectangle
:param height: Height of the rectangle
"""
c = context
#... | Draw a rectangle
Assertion: The current point is the center point of the rectangle
:param context: Cairo context
:param width: Width of the rectangle
:param height: Height of the rectangle | entailment |
def _rotate_context(context, direction):
"""Moves the current position to 'position' and rotates the context according to 'direction'
:param context: Cairo context
:param direction: Direction enum
"""
if direction is Direction.UP:
pass
elif direction is Direc... | Moves the current position to 'position' and rotates the context according to 'direction'
:param context: Cairo context
:param direction: Direction enum | entailment |
def draw_name(self, context, transparency, only_calculate_size=False):
"""Draws the name of the port
Offers the option to only calculate the size of the name.
:param context: The context to draw on
:param transparency: The transparency of the text
:param only_calculate_size: Wh... | Draws the name of the port
Offers the option to only calculate the size of the name.
:param context: The context to draw on
:param transparency: The transparency of the text
:param only_calculate_size: Whether to only calculate the size
:return: Size of the name
:rtype:... | entailment |
def _draw_rectangle_path(self, context, width, height, only_get_extents=False):
"""Draws the rectangle path for the port
The rectangle is correctly rotated. Height therefore refers to the border thickness and width to the length
of the port.
:param context: The context to draw on
... | Draws the rectangle path for the port
The rectangle is correctly rotated. Height therefore refers to the border thickness and width to the length
of the port.
:param context: The context to draw on
:param float width: The width of the rectangle
:param float height: The height o... | entailment |
def _get_port_center_position(self, width):
"""Calculates the center position of the port rectangle
The port itself can be positioned in the corner, the center of the port rectangle however is restricted by
the width of the rectangle. This method therefore calculates the center, depending on th... | Calculates the center position of the port rectangle
The port itself can be positioned in the corner, the center of the port rectangle however is restricted by
the width of the rectangle. This method therefore calculates the center, depending on the position of the
port and the width of the rec... | entailment |
def register_actions(self, shortcut_manager):
"""Register callback methods for triggered actions
:param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: Shortcut Manager Object holding mappings
between shortcuts and actions.
"""
shortcut_manager.add_callback_for... | Register callback methods for triggered actions
:param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: Shortcut Manager Object holding mappings
between shortcuts and actions. | entailment |
def on_config_value_changed(self, config_m, prop_name, info):
"""Callback when a config value has been changed
:param ConfigModel config_m: The config model that has been changed
:param str prop_name: Should always be 'config'
:param dict info: Information e.g. about the changed config ... | Callback when a config value has been changed
:param ConfigModel config_m: The config model that has been changed
:param str prop_name: Should always be 'config'
:param dict info: Information e.g. about the changed config key | entailment |
def get_current_state_m(self):
"""Returns the state model of the currently open tab"""
page_id = self.view.notebook.get_current_page()
if page_id == -1:
return None
page = self.view.notebook.get_nth_page(page_id)
state_identifier = self.get_state_identifier_for_page(p... | Returns the state model of the currently open tab | entailment |
def state_machine_manager_notification(self, model, property, info):
"""Triggered whenever a new state machine is created, or an existing state machine is selected.
"""
if self.current_state_machine_m is not None:
selection = self.current_state_machine_m.selection
if len(... | Triggered whenever a new state machine is created, or an existing state machine is selected. | entailment |
def clean_up_tabs(self):
""" Method remove state-tabs for those no state machine exists anymore.
"""
tabs_to_close = []
for state_identifier, tab_dict in list(self.tabs.items()):
if tab_dict['sm_id'] not in self.model.state_machine_manager.state_machines:
tabs... | Method remove state-tabs for those no state machine exists anymore. | entailment |
def state_machines_set_notification(self, model, prop_name, info):
"""Observe all open state machines and their root states
"""
if info['method_name'] == '__setitem__':
state_machine_m = info.args[1]
self.observe_model(state_machine_m) | Observe all open state machines and their root states | entailment |
def state_machines_del_notification(self, model, prop_name, info):
"""Relive models of closed state machine
"""
if info['method_name'] == '__delitem__':
state_machine_m = info["result"]
try:
self.relieve_model(state_machine_m)
except KeyError:
... | Relive models of closed state machine | entailment |
def add_state_editor(self, state_m):
"""Triggered whenever a state is selected.
:param state_m: The selected state model.
"""
state_identifier = self.get_state_identifier(state_m)
if state_identifier in self.closed_tabs:
state_editor_ctrl = self.closed_tabs[state_id... | Triggered whenever a state is selected.
:param state_m: The selected state model. | entailment |
def script_text_changed(self, 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.
:param TextBuffer text_buffer: Text buffer of the edited script
:param rafcon.gui.models.state.StateModel... | Update gui elements according text buffer changes
Checks if the dirty flag needs to be set and the tab label to be updated.
:param TextBuffer text_buffer: Text buffer of the edited script
:param rafcon.gui.models.state.StateModel state_m: The state model related to the text buffer
:ret... | entailment |
def destroy_page(self, tab_dict):
""" Destroys desired page
Disconnects the page from signals and removes interconnection to parent-controller or observables.
:param tab_dict: Tab-dictionary that holds all necessary information of a page and state-editor.
"""
# logger.info("des... | Destroys desired page
Disconnects the page from signals and removes interconnection to parent-controller or observables.
:param tab_dict: Tab-dictionary that holds all necessary information of a page and state-editor. | entailment |
def close_page(self, 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.
:param state_identifier: Identifier... | 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.
:param state_identifier: Identifier of the page's state
:param delete: Whether to delete th... | entailment |
def find_page_of_state_m(self, state_m):
"""Return the identifier and page of a given state model
:param state_m: The state model to be searched
:return: page containing the state and the state_identifier
"""
for state_identifier, page_info in list(self.tabs.items()):
... | Return the identifier and page of a given state model
:param state_m: The state model to be searched
:return: page containing the state and the state_identifier | entailment |
def on_tab_close_clicked(self, event, state_m):
"""Triggered when the states-editor close button is clicked
Closes the tab.
:param state_m: The desired state model (the selected state)
"""
[page, state_identifier] = self.find_page_of_state_m(state_m)
if page:
... | Triggered when the states-editor close button is clicked
Closes the tab.
:param state_m: The desired state model (the selected state) | entailment |
def on_toggle_sticky_clicked(self, event, state_m):
"""Callback for the "toggle-sticky-check-button" emitted by custom TabLabel widget.
"""
[page, state_identifier] = self.find_page_of_state_m(state_m)
if not page:
return
self.tabs[state_identifier]['is_sticky'] = not... | Callback for the "toggle-sticky-check-button" emitted by custom TabLabel widget. | entailment |
def close_all_pages(self):
"""Closes all tabs of the states editor"""
states_to_be_closed = []
for state_identifier in self.tabs:
states_to_be_closed.append(state_identifier)
for state_identifier in states_to_be_closed:
self.close_page(state_identifier, delete=Fal... | Closes all tabs of the states editor | entailment |
def close_pages_for_specific_sm_id(self, sm_id):
"""Closes all tabs of the states editor for a specific sm_id"""
states_to_be_closed = []
for state_identifier in self.tabs:
state_m = self.tabs[state_identifier]["state_m"]
if state_m.state.get_state_machine().state_machine... | Closes all tabs of the states editor for a specific sm_id | entailment |
def on_switch_page(self, notebook, page_pointer, page_num, user_param1=None):
"""Update state selection when the active tab was changed
"""
page = notebook.get_nth_page(page_num)
# find state of selected tab
for tab_info in list(self.tabs.values()):
if tab_info['page... | Update state selection when the active tab was changed | entailment |
def activate_state_tab(self, state_m):
"""Opens the tab for the specified state model
The tab with the given state model is opened or set to foreground.
:param state_m: The desired state model (the selected state)
"""
# The current shown state differs from the desired one
... | Opens the tab for the specified state model
The tab with the given state model is opened or set to foreground.
:param state_m: The desired state model (the selected state) | entailment |
def keep_only_sticked_and_selected_tabs(self):
"""Close all tabs, except the currently active one and all sticked ones"""
# Only if the user didn't deactivate this behaviour
if not global_gui_config.get_config_value('KEEP_ONLY_STICKY_STATES_OPEN', True):
return
page_id = sel... | Close all tabs, except the currently active one and all sticked ones | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.