repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/cache/value_cache.py | ValueCache.get_value | def get_value(self, name, parameters=None):
"""Return the value of a cached variable if applicable
The value of the variable 'name' is returned, if no parameters are passed or if all parameters are identical
to the ones stored for the variable.
:param str name: Name of teh variable
... | python | def get_value(self, name, parameters=None):
"""Return the value of a cached variable if applicable
The value of the variable 'name' is returned, if no parameters are passed or if all parameters are identical
to the ones stored for the variable.
:param str name: Name of teh variable
... | [
"def",
"get_value",
"(",
"self",
",",
"name",
",",
"parameters",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"parameters",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"\"parameters must a dict\"",
")",
"if",
"name",
"not",
"in",
"self",
... | Return the value of a cached variable if applicable
The value of the variable 'name' is returned, if no parameters are passed or if all parameters are identical
to the ones stored for the variable.
:param str name: Name of teh variable
:param dict parameters: Current parameters or None... | [
"Return",
"the",
"value",
"of",
"a",
"cached",
"variable",
"if",
"applicable"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/cache/value_cache.py#L59-L75 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/cache/value_cache.py | ValueCache._normalize_number_values | def _normalize_number_values(self, parameters):
"""Assures equal precision for all number values"""
for key, value in parameters.items():
if isinstance(value, (int, float)):
parameters[key] = str(Decimal(value).normalize(self._context)) | python | def _normalize_number_values(self, parameters):
"""Assures equal precision for all number values"""
for key, value in parameters.items():
if isinstance(value, (int, float)):
parameters[key] = str(Decimal(value).normalize(self._context)) | [
"def",
"_normalize_number_values",
"(",
"self",
",",
"parameters",
")",
":",
"for",
"key",
",",
"value",
"in",
"parameters",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"parameters",
"[",... | Assures equal precision for all number values | [
"Assures",
"equal",
"precision",
"for",
"all",
"number",
"values"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/cache/value_cache.py#L83-L87 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.register_view | def register_view(self, view):
"""Register callbacks for button press events and selection changed"""
super(AbstractTreeViewController, self).register_view(view)
self.signal_handlers.append((self._tree_selection,
self._tree_selection.connect('changed', self.s... | python | def register_view(self, view):
"""Register callbacks for button press events and selection changed"""
super(AbstractTreeViewController, self).register_view(view)
self.signal_handlers.append((self._tree_selection,
self._tree_selection.connect('changed', self.s... | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"super",
"(",
"AbstractTreeViewController",
",",
"self",
")",
".",
"register_view",
"(",
"view",
")",
"self",
".",
"signal_handlers",
".",
"append",
"(",
"(",
"self",
".",
"_tree_selection",
",",
... | Register callbacks for button press events and selection changed | [
"Register",
"callbacks",
"for",
"button",
"press",
"events",
"and",
"selection",
"changed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L87-L99 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.get_view_selection | def get_view_selection(self):
"""Get actual tree selection object and all respective models of selected rows"""
if not self.MODEL_STORAGE_ID:
return None, None
# avoid selection requests on empty tree views -> case warnings in gtk3
if len(self.store) == 0:
paths ... | python | def get_view_selection(self):
"""Get actual tree selection object and all respective models of selected rows"""
if not self.MODEL_STORAGE_ID:
return None, None
# avoid selection requests on empty tree views -> case warnings in gtk3
if len(self.store) == 0:
paths ... | [
"def",
"get_view_selection",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"MODEL_STORAGE_ID",
":",
"return",
"None",
",",
"None",
"# avoid selection requests on empty tree views -> case warnings in gtk3",
"if",
"len",
"(",
"self",
".",
"store",
")",
"==",
"0",
... | Get actual tree selection object and all respective models of selected rows | [
"Get",
"actual",
"tree",
"selection",
"object",
"and",
"all",
"respective",
"models",
"of",
"selected",
"rows"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L101-L117 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.get_selections | def get_selections(self):
"""Get current model selection status in state machine selection (filtered according the purpose of the widget)
and tree selection of the widget"""
sm_selection, sm_filtered_selected_model_set = self.get_state_machine_selection()
tree_selection, selected_model_l... | python | def get_selections(self):
"""Get current model selection status in state machine selection (filtered according the purpose of the widget)
and tree selection of the widget"""
sm_selection, sm_filtered_selected_model_set = self.get_state_machine_selection()
tree_selection, selected_model_l... | [
"def",
"get_selections",
"(",
"self",
")",
":",
"sm_selection",
",",
"sm_filtered_selected_model_set",
"=",
"self",
".",
"get_state_machine_selection",
"(",
")",
"tree_selection",
",",
"selected_model_list",
"=",
"self",
".",
"get_view_selection",
"(",
")",
"return",
... | Get current model selection status in state machine selection (filtered according the purpose of the widget)
and tree selection of the widget | [
"Get",
"current",
"model",
"selection",
"status",
"in",
"state",
"machine",
"selection",
"(",
"filtered",
"according",
"the",
"purpose",
"of",
"the",
"widget",
")",
"and",
"tree",
"selection",
"of",
"the",
"widget"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L129-L134 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.state_machine_selection_changed | def state_machine_selection_changed(self, state_machine_m, signal_name, signal_msg):
"""Notify tree view about state machine selection"""
if self.CORE_ELEMENT_CLASS in signal_msg.arg.affected_core_element_classes:
self.update_selection_sm_prior() | python | def state_machine_selection_changed(self, state_machine_m, signal_name, signal_msg):
"""Notify tree view about state machine selection"""
if self.CORE_ELEMENT_CLASS in signal_msg.arg.affected_core_element_classes:
self.update_selection_sm_prior() | [
"def",
"state_machine_selection_changed",
"(",
"self",
",",
"state_machine_m",
",",
"signal_name",
",",
"signal_msg",
")",
":",
"if",
"self",
".",
"CORE_ELEMENT_CLASS",
"in",
"signal_msg",
".",
"arg",
".",
"affected_core_element_classes",
":",
"self",
".",
"update_s... | Notify tree view about state machine selection | [
"Notify",
"tree",
"view",
"about",
"state",
"machine",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L141-L144 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.add_action_callback | def add_action_callback(self, *event):
"""Callback method for add action"""
if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
self.on_add(None)
return True | python | def add_action_callback(self, *event):
"""Callback method for add action"""
if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
self.on_add(None)
return True | [
"def",
"add_action_callback",
"(",
"self",
",",
"*",
"event",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"tree_view",
",",
"event",
")",
"and",
"self",
".",
"active_entry_widget",
"is",
"None",
":",
"self",
".",
"on_add... | Callback method for add action | [
"Callback",
"method",
"for",
"add",
"action"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L163-L167 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.remove_action_callback | def remove_action_callback(self, *event):
"""Callback method for remove action
The method checks whether a shortcut ('Delete') is in the gui config model which shadow the delete functionality
of maybe active a entry widget. If a entry widget is active the remove callback return with None.
... | python | def remove_action_callback(self, *event):
"""Callback method for remove action
The method checks whether a shortcut ('Delete') is in the gui config model which shadow the delete functionality
of maybe active a entry widget. If a entry widget is active the remove callback return with None.
... | [
"def",
"remove_action_callback",
"(",
"self",
",",
"*",
"event",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"tree_view",
",",
"event",
")",
"and",
"not",
"(",
"self",
".",
"active_entry_widget",
"and",
"not",
"is_event_of... | Callback method for remove action
The method checks whether a shortcut ('Delete') is in the gui config model which shadow the delete functionality
of maybe active a entry widget. If a entry widget is active the remove callback return with None. | [
"Callback",
"method",
"for",
"remove",
"action"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L192-L201 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.copy_action_callback | def copy_action_callback(self, *event):
"""Callback method for copy action"""
if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
sm_selection, sm_selected_model_list = self.get_state_machine_selection()
# only list specific elements are copi... | python | def copy_action_callback(self, *event):
"""Callback method for copy action"""
if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
sm_selection, sm_selected_model_list = self.get_state_machine_selection()
# only list specific elements are copi... | [
"def",
"copy_action_callback",
"(",
"self",
",",
"*",
"event",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"tree_view",
",",
"event",
")",
"and",
"self",
".",
"active_entry_widget",
"is",
"None",
":",
"sm_selection",
",",
... | Callback method for copy action | [
"Callback",
"method",
"for",
"copy",
"action"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L203-L211 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.cut_action_callback | def cut_action_callback(self, *event):
"""Callback method for copy action"""
if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
sm_selection, sm_selected_model_list = self.get_state_machine_selection()
# only list specific elements are cut b... | python | def cut_action_callback(self, *event):
"""Callback method for copy action"""
if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
sm_selection, sm_selected_model_list = self.get_state_machine_selection()
# only list specific elements are cut b... | [
"def",
"cut_action_callback",
"(",
"self",
",",
"*",
"event",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"tree_view",
",",
"event",
")",
"and",
"self",
".",
"active_entry_widget",
"is",
"None",
":",
"sm_selection",
",",
... | Callback method for copy action | [
"Callback",
"method",
"for",
"copy",
"action"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L213-L221 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController._apply_value_on_edited_and_focus_out | def _apply_value_on_edited_and_focus_out(self, renderer, apply_method):
"""Sets up the renderer to apply changed when loosing focus
The default behaviour for the focus out event dismisses the changes in the renderer. Therefore we setup
handlers for that event, applying the changes.
:pa... | python | def _apply_value_on_edited_and_focus_out(self, renderer, apply_method):
"""Sets up the renderer to apply changed when loosing focus
The default behaviour for the focus out event dismisses the changes in the renderer. Therefore we setup
handlers for that event, applying the changes.
:pa... | [
"def",
"_apply_value_on_edited_and_focus_out",
"(",
"self",
",",
"renderer",
",",
"apply_method",
")",
":",
"assert",
"isinstance",
"(",
"renderer",
",",
"Gtk",
".",
"CellRenderer",
")",
"def",
"remove_all_handler",
"(",
"renderer",
")",
":",
"\"\"\"Remove all handl... | Sets up the renderer to apply changed when loosing focus
The default behaviour for the focus out event dismisses the changes in the renderer. Therefore we setup
handlers for that event, applying the changes.
:param Gtk.CellRendererText renderer: The cell renderer who's changes are to be applie... | [
"Sets",
"up",
"the",
"renderer",
"to",
"apply",
"changed",
"when",
"loosing",
"focus"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L232-L341 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | AbstractTreeViewController.tree_view_keypress_callback | def tree_view_keypress_callback(self, widget, event):
"""General method to adapt widget view and controller behavior according the key press/release and
button release events
Here the scrollbar motion to follow key cursor motions in editable is already in.
:param Gtk.TreeView widge... | python | def tree_view_keypress_callback(self, widget, event):
"""General method to adapt widget view and controller behavior according the key press/release and
button release events
Here the scrollbar motion to follow key cursor motions in editable is already in.
:param Gtk.TreeView widge... | [
"def",
"tree_view_keypress_callback",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"current_row_path",
",",
"current_focused_column",
"=",
"self",
".",
"tree_view",
".",
"get_cursor",
"(",
")",
"# print(current_row_path, current_focused_column)",
"if",
"isinstanc... | General method to adapt widget view and controller behavior according the key press/release and
button release events
Here the scrollbar motion to follow key cursor motions in editable is already in.
:param Gtk.TreeView widget: The tree view the controller use
:param Gdk.Event even... | [
"General",
"method",
"to",
"adapt",
"widget",
"view",
"and",
"controller",
"behavior",
"according",
"the",
"key",
"press",
"/",
"release",
"and",
"button",
"release",
"events"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L352-L410 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.register_view | def register_view(self, view):
"""Register callbacks for button press events and selection changed"""
super(ListViewController, self).register_view(view)
self.tree_view.connect('button_press_event', self.mouse_click) | python | def register_view(self, view):
"""Register callbacks for button press events and selection changed"""
super(ListViewController, self).register_view(view)
self.tree_view.connect('button_press_event', self.mouse_click) | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"super",
"(",
"ListViewController",
",",
"self",
")",
".",
"register_view",
"(",
"view",
")",
"self",
".",
"tree_view",
".",
"connect",
"(",
"'button_press_event'",
",",
"self",
".",
"mouse_click",
... | Register callbacks for button press events and selection changed | [
"Register",
"callbacks",
"for",
"button",
"press",
"events",
"and",
"selection",
"changed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L460-L463 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.on_remove | def on_remove(self, widget, data=None):
"""Removes respective selected core elements and select the next one"""
path_list = None
if self.view is not None:
model, path_list = self.tree_view.get_selection().get_selected_rows()
old_path = self.get_path()
models = [self.... | python | def on_remove(self, widget, data=None):
"""Removes respective selected core elements and select the next one"""
path_list = None
if self.view is not None:
model, path_list = self.tree_view.get_selection().get_selected_rows()
old_path = self.get_path()
models = [self.... | [
"def",
"on_remove",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"path_list",
"=",
"None",
"if",
"self",
".",
"view",
"is",
"not",
"None",
":",
"model",
",",
"path_list",
"=",
"self",
".",
"tree_view",
".",
"get_selection",
"(",
")... | Removes respective selected core elements and select the next one | [
"Removes",
"respective",
"selected",
"core",
"elements",
"and",
"select",
"the",
"next",
"one"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L465-L483 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.get_state_machine_selection | def get_state_machine_selection(self):
"""An abstract getter method for state machine selection
The method maybe has to be re-implemented by inherit classes and hands generally a filtered set of
selected elements.
:return: selection object it self, filtered set of selected elements
... | python | def get_state_machine_selection(self):
"""An abstract getter method for state machine selection
The method maybe has to be re-implemented by inherit classes and hands generally a filtered set of
selected elements.
:return: selection object it self, filtered set of selected elements
... | [
"def",
"get_state_machine_selection",
"(",
"self",
")",
":",
"sm_selection",
"=",
"self",
".",
"model",
".",
"get_state_machine_m",
"(",
")",
".",
"selection",
"if",
"self",
".",
"model",
".",
"get_state_machine_m",
"(",
")",
"else",
"None",
"return",
"sm_sele... | An abstract getter method for state machine selection
The method maybe has to be re-implemented by inherit classes and hands generally a filtered set of
selected elements.
:return: selection object it self, filtered set of selected elements
:rtype: rafcon.gui.selection.Selection, set | [
"An",
"abstract",
"getter",
"method",
"for",
"state",
"machine",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L485-L495 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.mouse_click | def mouse_click(self, widget, event=None):
"""Implements shift- and control-key handling features for mouse button press events explicit
The method is implements a fully defined mouse pattern to use shift- and control-key for multi-selection in a
TreeView and a ListStore as model. It avoid pr... | python | def mouse_click(self, widget, event=None):
"""Implements shift- and control-key handling features for mouse button press events explicit
The method is implements a fully defined mouse pattern to use shift- and control-key for multi-selection in a
TreeView and a ListStore as model. It avoid pr... | [
"def",
"mouse_click",
"(",
"self",
",",
"widget",
",",
"event",
"=",
"None",
")",
":",
"if",
"event",
".",
"type",
"==",
"Gdk",
".",
"EventType",
".",
"BUTTON_PRESS",
":",
"pthinfo",
"=",
"self",
".",
"tree_view",
".",
"get_path_at_pos",
"(",
"int",
"(... | Implements shift- and control-key handling features for mouse button press events explicit
The method is implements a fully defined mouse pattern to use shift- and control-key for multi-selection in a
TreeView and a ListStore as model. It avoid problems caused by special renderer types like the text ... | [
"Implements",
"shift",
"-",
"and",
"control",
"-",
"key",
"handling",
"features",
"for",
"mouse",
"button",
"press",
"events",
"explicit"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L497-L575 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController._handle_double_click | def _handle_double_click(self, event):
""" Double click with left mouse button focuses the element"""
if event.get_button()[1] == 1: # Left mouse button
path_info = self.tree_view.get_path_at_pos(int(event.x), int(event.y))
if path_info: # Valid entry was clicked on
... | python | def _handle_double_click(self, event):
""" Double click with left mouse button focuses the element"""
if event.get_button()[1] == 1: # Left mouse button
path_info = self.tree_view.get_path_at_pos(int(event.x), int(event.y))
if path_info: # Valid entry was clicked on
... | [
"def",
"_handle_double_click",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"get_button",
"(",
")",
"[",
"1",
"]",
"==",
"1",
":",
"# Left mouse button",
"path_info",
"=",
"self",
".",
"tree_view",
".",
"get_path_at_pos",
"(",
"int",
"(",
"ev... | Double click with left mouse button focuses the element | [
"Double",
"click",
"with",
"left",
"mouse",
"button",
"focuses",
"the",
"element"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L577-L586 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.update_selection_sm_prior | def update_selection_sm_prior(self):
"""State machine prior update of tree selection"""
if self._do_selection_update:
return
self._do_selection_update = True
tree_selection, selected_model_list, sm_selection, sm_selected_model_list = self.get_selections()
if tree_sele... | python | def update_selection_sm_prior(self):
"""State machine prior update of tree selection"""
if self._do_selection_update:
return
self._do_selection_update = True
tree_selection, selected_model_list, sm_selection, sm_selected_model_list = self.get_selections()
if tree_sele... | [
"def",
"update_selection_sm_prior",
"(",
"self",
")",
":",
"if",
"self",
".",
"_do_selection_update",
":",
"return",
"self",
".",
"_do_selection_update",
"=",
"True",
"tree_selection",
",",
"selected_model_list",
",",
"sm_selection",
",",
"sm_selected_model_list",
"="... | State machine prior update of tree selection | [
"State",
"machine",
"prior",
"update",
"of",
"tree",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L588-L602 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.update_selection_self_prior | def update_selection_self_prior(self):
"""Tree view prior update of state machine selection"""
if self._do_selection_update:
return
self._do_selection_update = True
tree_selection, selected_model_list, sm_selection, sm_selected_model_list = self.get_selections()
if is... | python | def update_selection_self_prior(self):
"""Tree view prior update of state machine selection"""
if self._do_selection_update:
return
self._do_selection_update = True
tree_selection, selected_model_list, sm_selection, sm_selected_model_list = self.get_selections()
if is... | [
"def",
"update_selection_self_prior",
"(",
"self",
")",
":",
"if",
"self",
".",
"_do_selection_update",
":",
"return",
"self",
".",
"_do_selection_update",
"=",
"True",
"tree_selection",
",",
"selected_model_list",
",",
"sm_selection",
",",
"sm_selected_model_list",
"... | Tree view prior update of state machine selection | [
"Tree",
"view",
"prior",
"update",
"of",
"state",
"machine",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L604-L612 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.select_entry | def select_entry(self, core_element_id, by_cursor=True):
"""Selects the row entry belonging to the given core_element_id by cursor or tree selection"""
for row_num, element_row in enumerate(self.list_store):
# Compare data port ids
if element_row[self.ID_STORAGE_ID] == core_eleme... | python | def select_entry(self, core_element_id, by_cursor=True):
"""Selects the row entry belonging to the given core_element_id by cursor or tree selection"""
for row_num, element_row in enumerate(self.list_store):
# Compare data port ids
if element_row[self.ID_STORAGE_ID] == core_eleme... | [
"def",
"select_entry",
"(",
"self",
",",
"core_element_id",
",",
"by_cursor",
"=",
"True",
")",
":",
"for",
"row_num",
",",
"element_row",
"in",
"enumerate",
"(",
"self",
".",
"list_store",
")",
":",
"# Compare data port ids",
"if",
"element_row",
"[",
"self",... | Selects the row entry belonging to the given core_element_id by cursor or tree selection | [
"Selects",
"the",
"row",
"entry",
"belonging",
"to",
"the",
"given",
"core_element_id",
"by",
"cursor",
"or",
"tree",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L614-L623 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.get_path_for_core_element | def get_path_for_core_element(self, core_element_id):
"""Get path to the row representing core element described by handed core_element_id
:param core_element_id: Core element identifier used in the respective list store column
:rtype: tuple
:return: path
"""
for row_num... | python | def get_path_for_core_element(self, core_element_id):
"""Get path to the row representing core element described by handed core_element_id
:param core_element_id: Core element identifier used in the respective list store column
:rtype: tuple
:return: path
"""
for row_num... | [
"def",
"get_path_for_core_element",
"(",
"self",
",",
"core_element_id",
")",
":",
"for",
"row_num",
",",
"element_row",
"in",
"enumerate",
"(",
"self",
".",
"list_store",
")",
":",
"# Compare data port ids",
"if",
"element_row",
"[",
"self",
".",
"ID_STORAGE_ID",... | Get path to the row representing core element described by handed core_element_id
:param core_element_id: Core element identifier used in the respective list store column
:rtype: tuple
:return: path | [
"Get",
"path",
"to",
"the",
"row",
"representing",
"core",
"element",
"described",
"by",
"handed",
"core_element_id"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L625-L635 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | ListViewController.tree_view_keypress_callback | def tree_view_keypress_callback(self, widget, event):
"""Tab back and forward tab-key motion in list widget and the scrollbar motion to follow key cursor motions
The method introduce motion and edit functionality by using "tab"- or "shift-tab"-key for a Gtk.TreeView.
It is designed to work wi... | python | def tree_view_keypress_callback(self, widget, event):
"""Tab back and forward tab-key motion in list widget and the scrollbar motion to follow key cursor motions
The method introduce motion and edit functionality by using "tab"- or "shift-tab"-key for a Gtk.TreeView.
It is designed to work wi... | [
"def",
"tree_view_keypress_callback",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"# self._logger.info(\"key_value: \" + str(event.keyval if event is not None else ''))",
"if",
"event",
"and",
"\"GDK_KEY_PRESS\"",
"==",
"event",
".",
"type",
".",
"value_name",
"and"... | Tab back and forward tab-key motion in list widget and the scrollbar motion to follow key cursor motions
The method introduce motion and edit functionality by using "tab"- or "shift-tab"-key for a Gtk.TreeView.
It is designed to work with a Gtk.TreeView which model is a Gtk.ListStore and only uses te... | [
"Tab",
"back",
"and",
"forward",
"tab",
"-",
"key",
"motion",
"in",
"list",
"widget",
"and",
"the",
"scrollbar",
"motion",
"to",
"follow",
"key",
"cursor",
"motions"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L647-L721 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | TreeViewController.iter_tree_with_handed_function | def iter_tree_with_handed_function(self, function, *function_args):
"""Iterate tree view with condition check function"""
def iter_all_children(row_iter, function, function_args):
if isinstance(row_iter, Gtk.TreeIter):
function(row_iter, *function_args)
for n ... | python | def iter_tree_with_handed_function(self, function, *function_args):
"""Iterate tree view with condition check function"""
def iter_all_children(row_iter, function, function_args):
if isinstance(row_iter, Gtk.TreeIter):
function(row_iter, *function_args)
for n ... | [
"def",
"iter_tree_with_handed_function",
"(",
"self",
",",
"function",
",",
"*",
"function_args",
")",
":",
"def",
"iter_all_children",
"(",
"row_iter",
",",
"function",
",",
"function_args",
")",
":",
"if",
"isinstance",
"(",
"row_iter",
",",
"Gtk",
".",
"Tre... | Iterate tree view with condition check function | [
"Iterate",
"tree",
"view",
"with",
"condition",
"check",
"function"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L758-L773 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | TreeViewController.update_selection_sm_prior_condition | def update_selection_sm_prior_condition(self, state_row_iter, selected_model_list, sm_selected_model_list):
"""State machine prior update of tree selection for one tree model row"""
selected_path = self.tree_store.get_path(state_row_iter)
tree_model_row = self.tree_store[selected_path]
m... | python | def update_selection_sm_prior_condition(self, state_row_iter, selected_model_list, sm_selected_model_list):
"""State machine prior update of tree selection for one tree model row"""
selected_path = self.tree_store.get_path(state_row_iter)
tree_model_row = self.tree_store[selected_path]
m... | [
"def",
"update_selection_sm_prior_condition",
"(",
"self",
",",
"state_row_iter",
",",
"selected_model_list",
",",
"sm_selected_model_list",
")",
":",
"selected_path",
"=",
"self",
".",
"tree_store",
".",
"get_path",
"(",
"state_row_iter",
")",
"tree_model_row",
"=",
... | State machine prior update of tree selection for one tree model row | [
"State",
"machine",
"prior",
"update",
"of",
"tree",
"selection",
"for",
"one",
"tree",
"model",
"row"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L775-L785 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | TreeViewController.update_selection_self_prior_condition | def update_selection_self_prior_condition(self, state_row_iter, sm_selected_model_set, selected_model_list):
"""Tree view prior update of one model in the state machine selection"""
selected_path = self.tree_store.get_path(state_row_iter)
tree_model_row = self.tree_store[selected_path]
m... | python | def update_selection_self_prior_condition(self, state_row_iter, sm_selected_model_set, selected_model_list):
"""Tree view prior update of one model in the state machine selection"""
selected_path = self.tree_store.get_path(state_row_iter)
tree_model_row = self.tree_store[selected_path]
m... | [
"def",
"update_selection_self_prior_condition",
"(",
"self",
",",
"state_row_iter",
",",
"sm_selected_model_set",
",",
"selected_model_list",
")",
":",
"selected_path",
"=",
"self",
".",
"tree_store",
".",
"get_path",
"(",
"state_row_iter",
")",
"tree_model_row",
"=",
... | Tree view prior update of one model in the state machine selection | [
"Tree",
"view",
"prior",
"update",
"of",
"one",
"model",
"in",
"the",
"state",
"machine",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L787-L796 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | TreeViewController.update_selection_self_prior | def update_selection_self_prior(self):
"""Tree view prior update of state machine selection"""
if self._do_selection_update:
return
self._do_selection_update = True
tree_selection, selected_model_list, sm_selection, sm_selected_model_set = self.get_selections()
if isi... | python | def update_selection_self_prior(self):
"""Tree view prior update of state machine selection"""
if self._do_selection_update:
return
self._do_selection_update = True
tree_selection, selected_model_list, sm_selection, sm_selected_model_set = self.get_selections()
if isi... | [
"def",
"update_selection_self_prior",
"(",
"self",
")",
":",
"if",
"self",
".",
"_do_selection_update",
":",
"return",
"self",
".",
"_do_selection_update",
"=",
"True",
"tree_selection",
",",
"selected_model_list",
",",
"sm_selection",
",",
"sm_selected_model_set",
"=... | Tree view prior update of state machine selection | [
"Tree",
"view",
"prior",
"update",
"of",
"state",
"machine",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L808-L828 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | TreeViewController.update_selection_sm_prior | def update_selection_sm_prior(self):
"""State machine prior update of tree selection"""
if self._do_selection_update:
return
self._do_selection_update = True
tree_selection, selected_model_list, sm_selection, sm_selected_model_list = self.get_selections()
if tree_sele... | python | def update_selection_sm_prior(self):
"""State machine prior update of tree selection"""
if self._do_selection_update:
return
self._do_selection_update = True
tree_selection, selected_model_list, sm_selection, sm_selected_model_list = self.get_selections()
if tree_sele... | [
"def",
"update_selection_sm_prior",
"(",
"self",
")",
":",
"if",
"self",
".",
"_do_selection_update",
":",
"return",
"self",
".",
"_do_selection_update",
"=",
"True",
"tree_selection",
",",
"selected_model_list",
",",
"sm_selection",
",",
"sm_selected_model_list",
"="... | State machine prior update of tree selection | [
"State",
"machine",
"prior",
"update",
"of",
"tree",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L830-L842 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | TreeViewController.select_entry | def select_entry(self, core_element_id, by_cursor=True):
"""Selects the row entry belonging to the given core_element_id by cursor or tree selection"""
path = self.get_path_for_core_element(core_element_id)
if path:
if by_cursor:
self.tree_view.set_cursor(path)
... | python | def select_entry(self, core_element_id, by_cursor=True):
"""Selects the row entry belonging to the given core_element_id by cursor or tree selection"""
path = self.get_path_for_core_element(core_element_id)
if path:
if by_cursor:
self.tree_view.set_cursor(path)
... | [
"def",
"select_entry",
"(",
"self",
",",
"core_element_id",
",",
"by_cursor",
"=",
"True",
")",
":",
"path",
"=",
"self",
".",
"get_path_for_core_element",
"(",
"core_element_id",
")",
"if",
"path",
":",
"if",
"by_cursor",
":",
"self",
".",
"tree_view",
".",... | Selects the row entry belonging to the given core_element_id by cursor or tree selection | [
"Selects",
"the",
"row",
"entry",
"belonging",
"to",
"the",
"given",
"core_element_id",
"by",
"cursor",
"or",
"tree",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L852-L861 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/tree_view_controller.py | TreeViewController.tree_view_keypress_callback | def tree_view_keypress_callback(self, widget, event):
"""Tab back and forward tab-key motion in list widget and the scrollbar motion to follow key cursor motions
The method introduce motion and edit functionality by using "tab"- or "shift-tab"-key for a Gtk.TreeView.
It is designed to work wi... | python | def tree_view_keypress_callback(self, widget, event):
"""Tab back and forward tab-key motion in list widget and the scrollbar motion to follow key cursor motions
The method introduce motion and edit functionality by using "tab"- or "shift-tab"-key for a Gtk.TreeView.
It is designed to work wi... | [
"def",
"tree_view_keypress_callback",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"# self._logger.info(\"key_value: \" + str(event.keyval if event is not None else ''))",
"# TODO works for root level or other single level of tree view but not for switching in between levels",
"if",
... | Tab back and forward tab-key motion in list widget and the scrollbar motion to follow key cursor motions
The method introduce motion and edit functionality by using "tab"- or "shift-tab"-key for a Gtk.TreeView.
It is designed to work with a Gtk.TreeView which model is a Gtk.ListStore and only uses te... | [
"Tab",
"back",
"and",
"forward",
"tab",
"-",
"key",
"motion",
"in",
"list",
"widget",
"and",
"the",
"scrollbar",
"motion",
"to",
"follow",
"key",
"cursor",
"motions"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L863-L954 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | contains_geometric_info | def contains_geometric_info(var):
""" Check whether the passed variable is a tuple with two floats or integers """
return isinstance(var, tuple) and len(var) == 2 and all(isinstance(val, (int, float)) for val in var) | python | def contains_geometric_info(var):
""" Check whether the passed variable is a tuple with two floats or integers """
return isinstance(var, tuple) and len(var) == 2 and all(isinstance(val, (int, float)) for val in var) | [
"def",
"contains_geometric_info",
"(",
"var",
")",
":",
"return",
"isinstance",
"(",
"var",
",",
"tuple",
")",
"and",
"len",
"(",
"var",
")",
"==",
"2",
"and",
"all",
"(",
"isinstance",
"(",
"val",
",",
"(",
"int",
",",
"float",
")",
")",
"for",
"v... | Check whether the passed variable is a tuple with two floats or integers | [
"Check",
"whether",
"the",
"passed",
"variable",
"is",
"a",
"tuple",
"with",
"two",
"floats",
"or",
"integers"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L55-L57 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | generate_default_state_meta_data | def generate_default_state_meta_data(parent_state_m, canvas=None, num_child_state=None, gaphas_editor=True):
"""Generate default meta data for a child state according its parent state
The function could work with the handed num_child_state if all child state are not drawn, till now.
The method checks if th... | python | def generate_default_state_meta_data(parent_state_m, canvas=None, num_child_state=None, gaphas_editor=True):
"""Generate default meta data for a child state according its parent state
The function could work with the handed num_child_state if all child state are not drawn, till now.
The method checks if th... | [
"def",
"generate_default_state_meta_data",
"(",
"parent_state_m",
",",
"canvas",
"=",
"None",
",",
"num_child_state",
"=",
"None",
",",
"gaphas_editor",
"=",
"True",
")",
":",
"parent_size",
"=",
"parent_state_m",
".",
"get_meta_data_editor",
"(",
")",
"[",
"'size... | Generate default meta data for a child state according its parent state
The function could work with the handed num_child_state if all child state are not drawn, till now.
The method checks if the parents meta data is consistent in canvas state view and model if a canvas instance is
handed.
:param r... | [
"Generate",
"default",
"meta",
"data",
"for",
"a",
"child",
"state",
"according",
"its",
"parent",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L108-L166 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | add_boundary_clearance | def add_boundary_clearance(left, right, top, bottom, frame, clearance=0.1):
"""Increase boundary size
The function increase the space between top and bottom and between left and right parameters.
The increase performed on the biggest size/frame so max(size boundary, size frame)
:param float left: lowe... | python | def add_boundary_clearance(left, right, top, bottom, frame, clearance=0.1):
"""Increase boundary size
The function increase the space between top and bottom and between left and right parameters.
The increase performed on the biggest size/frame so max(size boundary, size frame)
:param float left: lowe... | [
"def",
"add_boundary_clearance",
"(",
"left",
",",
"right",
",",
"top",
",",
"bottom",
",",
"frame",
",",
"clearance",
"=",
"0.1",
")",
":",
"# print(\"old boundary\", left, right, top, bottom)",
"width",
"=",
"right",
"-",
"left",
"width",
"=",
"frame",
"[",
... | Increase boundary size
The function increase the space between top and bottom and between left and right parameters.
The increase performed on the biggest size/frame so max(size boundary, size frame)
:param float left: lower x-axis value
:param float right: upper x-axis value
:param float top: low... | [
"Increase",
"boundary",
"size"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L226-L254 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | get_boundaries_of_elements_in_dict | def get_boundaries_of_elements_in_dict(models_dict, clearance=0.):
""" Get boundaries of all handed models
The function checks all model meta data positions to increase boundary starting with a state or scoped variables.
It is finally iterated over all states, data and logical port models and linkage if su... | python | def get_boundaries_of_elements_in_dict(models_dict, clearance=0.):
""" Get boundaries of all handed models
The function checks all model meta data positions to increase boundary starting with a state or scoped variables.
It is finally iterated over all states, data and logical port models and linkage if su... | [
"def",
"get_boundaries_of_elements_in_dict",
"(",
"models_dict",
",",
"clearance",
"=",
"0.",
")",
":",
"# Determine initial outer coordinates",
"right",
"=",
"0.",
"bottom",
"=",
"0.",
"if",
"'states'",
"in",
"models_dict",
"and",
"models_dict",
"[",
"'states'",
"]... | Get boundaries of all handed models
The function checks all model meta data positions to increase boundary starting with a state or scoped variables.
It is finally iterated over all states, data and logical port models and linkage if sufficient for respective
graphical editor. At the end a clearance is add... | [
"Get",
"boundaries",
"of",
"all",
"handed",
"models"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L257-L333 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | cal_frame_according_boundaries | def cal_frame_according_boundaries(left, right, top, bottom, parent_size, gaphas_editor=True, group=True):
""" Generate margin and relative position and size handed boundary parameter and parent size """
# print("parent_size ->", parent_size)
margin = cal_margin(parent_size)
# Add margin and ensure that... | python | def cal_frame_according_boundaries(left, right, top, bottom, parent_size, gaphas_editor=True, group=True):
""" Generate margin and relative position and size handed boundary parameter and parent size """
# print("parent_size ->", parent_size)
margin = cal_margin(parent_size)
# Add margin and ensure that... | [
"def",
"cal_frame_according_boundaries",
"(",
"left",
",",
"right",
",",
"top",
",",
"bottom",
",",
"parent_size",
",",
"gaphas_editor",
"=",
"True",
",",
"group",
"=",
"True",
")",
":",
"# print(\"parent_size ->\", parent_size)",
"margin",
"=",
"cal_margin",
"(",... | Generate margin and relative position and size handed boundary parameter and parent size | [
"Generate",
"margin",
"and",
"relative",
"position",
"and",
"size",
"handed",
"boundary",
"parameter",
"and",
"parent",
"size"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L336-L353 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | offset_rel_pos_of_all_models_in_dict | def offset_rel_pos_of_all_models_in_dict(models_dict, pos_offset, gaphas_editor=True):
""" Add position offset to all handed models in dict"""
# print("\n", "#"*30, "offset models", pos_offset, "#"*30)
# Update relative position of states within the container in order to maintain their absolute position
... | python | def offset_rel_pos_of_all_models_in_dict(models_dict, pos_offset, gaphas_editor=True):
""" Add position offset to all handed models in dict"""
# print("\n", "#"*30, "offset models", pos_offset, "#"*30)
# Update relative position of states within the container in order to maintain their absolute position
... | [
"def",
"offset_rel_pos_of_all_models_in_dict",
"(",
"models_dict",
",",
"pos_offset",
",",
"gaphas_editor",
"=",
"True",
")",
":",
"# print(\"\\n\", \"#\"*30, \"offset models\", pos_offset, \"#\"*30)",
"# Update relative position of states within the container in order to maintain their ab... | Add position offset to all handed models in dict | [
"Add",
"position",
"offset",
"to",
"all",
"handed",
"models",
"in",
"dict"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L356-L383 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | scale_library_ports_meta_data | def scale_library_ports_meta_data(state_m, gaphas_editor=True):
"""Scale the ports of library model accordingly relative to state_copy meta size.
The function assumes that the meta data of ports of the state_copy of the library was copied to
respective elements in the library and that those was not ad... | python | def scale_library_ports_meta_data(state_m, gaphas_editor=True):
"""Scale the ports of library model accordingly relative to state_copy meta size.
The function assumes that the meta data of ports of the state_copy of the library was copied to
respective elements in the library and that those was not ad... | [
"def",
"scale_library_ports_meta_data",
"(",
"state_m",
",",
"gaphas_editor",
"=",
"True",
")",
":",
"if",
"state_m",
".",
"meta_data_was_scaled",
":",
"return",
"state_m",
".",
"income",
".",
"set_meta_data_editor",
"(",
"'rel_pos'",
",",
"state_m",
".",
"state_c... | Scale the ports of library model accordingly relative to state_copy meta size.
The function assumes that the meta data of ports of the state_copy of the library was copied to
respective elements in the library and that those was not adjusted before. | [
"Scale",
"the",
"ports",
"of",
"library",
"model",
"accordingly",
"relative",
"to",
"state_copy",
"meta",
"size",
".",
"The",
"function",
"assumes",
"that",
"the",
"meta",
"data",
"of",
"ports",
"of",
"the",
"state_copy",
"of",
"the",
"library",
"was",
"copi... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L387-L406 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | scale_library_content | def scale_library_content(library_state_m, gaphas_editor=True):
"""Scales the meta data of the content of a LibraryState
The contents of the `LibraryStateModel` `library_state_m` (i.e., the `state_copy` and all it children/state
elements) to fit the current size of the `LibraryStateModel`.
:p... | python | def scale_library_content(library_state_m, gaphas_editor=True):
"""Scales the meta data of the content of a LibraryState
The contents of the `LibraryStateModel` `library_state_m` (i.e., the `state_copy` and all it children/state
elements) to fit the current size of the `LibraryStateModel`.
:p... | [
"def",
"scale_library_content",
"(",
"library_state_m",
",",
"gaphas_editor",
"=",
"True",
")",
":",
"assert",
"isinstance",
"(",
"library_state_m",
",",
"LibraryStateModel",
")",
"# For library states with an ExecutionState as state_copy, scaling does not make sense",
"if",
"n... | Scales the meta data of the content of a LibraryState
The contents of the `LibraryStateModel` `library_state_m` (i.e., the `state_copy` and all it children/state
elements) to fit the current size of the `LibraryStateModel`.
:param LibraryStateModel library_state_m: The library who's content is to... | [
"Scales",
"the",
"meta",
"data",
"of",
"the",
"content",
"of",
"a",
"LibraryState",
"The",
"contents",
"of",
"the",
"LibraryStateModel",
"library_state_m",
"(",
"i",
".",
"e",
".",
"the",
"state_copy",
"and",
"all",
"it",
"children",
"/",
"state",
"elements"... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L409-L461 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | _resize_port_models_list | def _resize_port_models_list(port_models, rel_pos_key, factor, gaphas_editor=True):
""" Resize relative positions a list of (data or logical) port models """
for port_m in port_models:
old_rel_pos = port_m.get_meta_data_editor(for_gaphas=gaphas_editor)[rel_pos_key]
port_m.set_meta_data_editor(re... | python | def _resize_port_models_list(port_models, rel_pos_key, factor, gaphas_editor=True):
""" Resize relative positions a list of (data or logical) port models """
for port_m in port_models:
old_rel_pos = port_m.get_meta_data_editor(for_gaphas=gaphas_editor)[rel_pos_key]
port_m.set_meta_data_editor(re... | [
"def",
"_resize_port_models_list",
"(",
"port_models",
",",
"rel_pos_key",
",",
"factor",
",",
"gaphas_editor",
"=",
"True",
")",
":",
"for",
"port_m",
"in",
"port_models",
":",
"old_rel_pos",
"=",
"port_m",
".",
"get_meta_data_editor",
"(",
"for_gaphas",
"=",
"... | Resize relative positions a list of (data or logical) port models | [
"Resize",
"relative",
"positions",
"a",
"list",
"of",
"(",
"data",
"or",
"logical",
")",
"port",
"models"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L464-L468 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | _resize_connection_models_list | def _resize_connection_models_list(connection_models, factor, gaphas_editor=True):
""" Resize relative positions of way points of a list of connection/linkage models """
for connection_m in connection_models:
# print("old_waypoints", connection_m.get_meta_data_editor(for_gaphas=gaphas_editor), connectio... | python | def _resize_connection_models_list(connection_models, factor, gaphas_editor=True):
""" Resize relative positions of way points of a list of connection/linkage models """
for connection_m in connection_models:
# print("old_waypoints", connection_m.get_meta_data_editor(for_gaphas=gaphas_editor), connectio... | [
"def",
"_resize_connection_models_list",
"(",
"connection_models",
",",
"factor",
",",
"gaphas_editor",
"=",
"True",
")",
":",
"for",
"connection_m",
"in",
"connection_models",
":",
"# print(\"old_waypoints\", connection_m.get_meta_data_editor(for_gaphas=gaphas_editor), connection_... | Resize relative positions of way points of a list of connection/linkage models | [
"Resize",
"relative",
"positions",
"of",
"way",
"points",
"of",
"a",
"list",
"of",
"connection",
"/",
"linkage",
"models"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L471-L479 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | resize_state_port_meta | def resize_state_port_meta(state_m, factor, gaphas_editor=True):
""" Resize data and logical ports relative positions """
# print("scale ports", factor, state_m, gaphas_editor)
if not gaphas_editor and isinstance(state_m, ContainerStateModel):
port_models = state_m.input_data_ports[:] + state_m.outp... | python | def resize_state_port_meta(state_m, factor, gaphas_editor=True):
""" Resize data and logical ports relative positions """
# print("scale ports", factor, state_m, gaphas_editor)
if not gaphas_editor and isinstance(state_m, ContainerStateModel):
port_models = state_m.input_data_ports[:] + state_m.outp... | [
"def",
"resize_state_port_meta",
"(",
"state_m",
",",
"factor",
",",
"gaphas_editor",
"=",
"True",
")",
":",
"# print(\"scale ports\", factor, state_m, gaphas_editor)",
"if",
"not",
"gaphas_editor",
"and",
"isinstance",
"(",
"state_m",
",",
"ContainerStateModel",
")",
"... | Resize data and logical ports relative positions | [
"Resize",
"data",
"and",
"logical",
"ports",
"relative",
"positions"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L490-L500 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | resize_state_meta | def resize_state_meta(state_m, factor, gaphas_editor=True):
""" Resize state meta data recursive what includes also LibraryStateModels meta data and its internal state_copy
"""
# print("START RESIZE OF STATE", state_m.get_meta_data_editor(for_gaphas=gaphas_editor), state_m)
old_rel_pos = state_m.get_met... | python | def resize_state_meta(state_m, factor, gaphas_editor=True):
""" Resize state meta data recursive what includes also LibraryStateModels meta data and its internal state_copy
"""
# print("START RESIZE OF STATE", state_m.get_meta_data_editor(for_gaphas=gaphas_editor), state_m)
old_rel_pos = state_m.get_met... | [
"def",
"resize_state_meta",
"(",
"state_m",
",",
"factor",
",",
"gaphas_editor",
"=",
"True",
")",
":",
"# print(\"START RESIZE OF STATE\", state_m.get_meta_data_editor(for_gaphas=gaphas_editor), state_m)",
"old_rel_pos",
"=",
"state_m",
".",
"get_meta_data_editor",
"(",
"for_g... | Resize state meta data recursive what includes also LibraryStateModels meta data and its internal state_copy | [
"Resize",
"state",
"meta",
"data",
"recursive",
"what",
"includes",
"also",
"LibraryStateModels",
"meta",
"data",
"and",
"its",
"internal",
"state_copy"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L503-L540 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | offset_rel_pos_of_models_meta_data_according_parent_state | def offset_rel_pos_of_models_meta_data_according_parent_state(models_dict):
""" Offset meta data of state elements according the area used indicated by the state meta data.
The offset_rel_pos_of_models_meta_data_according_parent_state offset the position of all handed old elements
in the dictionary.
:... | python | def offset_rel_pos_of_models_meta_data_according_parent_state(models_dict):
""" Offset meta data of state elements according the area used indicated by the state meta data.
The offset_rel_pos_of_models_meta_data_according_parent_state offset the position of all handed old elements
in the dictionary.
:... | [
"def",
"offset_rel_pos_of_models_meta_data_according_parent_state",
"(",
"models_dict",
")",
":",
"old_parent_rel_pos",
"=",
"models_dict",
"[",
"'state'",
"]",
".",
"get_meta_data_editor",
"(",
")",
"[",
"'rel_pos'",
"]",
"offset_rel_pos_of_all_models_in_dict",
"(",
"model... | Offset meta data of state elements according the area used indicated by the state meta data.
The offset_rel_pos_of_models_meta_data_according_parent_state offset the position of all handed old elements
in the dictionary.
:param models_dict: dict that hold lists of meta data with state attribute consistent... | [
"Offset",
"meta",
"data",
"of",
"state",
"elements",
"according",
"the",
"area",
"used",
"indicated",
"by",
"the",
"state",
"meta",
"data",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L563-L575 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | scale_meta_data_according_states | def scale_meta_data_according_states(models_dict):
""" Offset meta data of state elements according the area used indicated by the states and
maybe scoped variables (in case of OpenGL editor) meta data.
Method is used by group states to set the offset for the elements in the new container state.
The me... | python | def scale_meta_data_according_states(models_dict):
""" Offset meta data of state elements according the area used indicated by the states and
maybe scoped variables (in case of OpenGL editor) meta data.
Method is used by group states to set the offset for the elements in the new container state.
The me... | [
"def",
"scale_meta_data_according_states",
"(",
"models_dict",
")",
":",
"left",
",",
"right",
",",
"top",
",",
"bottom",
"=",
"get_boundaries_of_elements_in_dict",
"(",
"models_dict",
"=",
"models_dict",
")",
"parent_size",
"=",
"models_dict",
"[",
"'state'",
"]",
... | Offset meta data of state elements according the area used indicated by the states and
maybe scoped variables (in case of OpenGL editor) meta data.
Method is used by group states to set the offset for the elements in the new container state.
The method needs some generalisation to create methods to easily ... | [
"Offset",
"meta",
"data",
"of",
"state",
"elements",
"according",
"the",
"area",
"used",
"indicated",
"by",
"the",
"states",
"and",
"maybe",
"scoped",
"variables",
"(",
"in",
"case",
"of",
"OpenGL",
"editor",
")",
"meta",
"data",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L578-L600 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | scale_meta_data_according_state | def scale_meta_data_according_state(models_dict, rel_pos=None, as_template=False, fill_up=False):
# TODO Documentation needed....
""" Scale elements in dict to fit into dict state key element.
If elements are already small enough no resize is performed.
"""
# TODO check about positions of input-dat... | python | def scale_meta_data_according_state(models_dict, rel_pos=None, as_template=False, fill_up=False):
# TODO Documentation needed....
""" Scale elements in dict to fit into dict state key element.
If elements are already small enough no resize is performed.
"""
# TODO check about positions of input-dat... | [
"def",
"scale_meta_data_according_state",
"(",
"models_dict",
",",
"rel_pos",
"=",
"None",
",",
"as_template",
"=",
"False",
",",
"fill_up",
"=",
"False",
")",
":",
"# TODO Documentation needed....",
"# TODO check about positions of input-data- and output-data- or scoped variab... | Scale elements in dict to fit into dict state key element.
If elements are already small enough no resize is performed. | [
"Scale",
"elements",
"in",
"dict",
"to",
"fit",
"into",
"dict",
"state",
"key",
"element",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L603-L701 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/meta_data.py | get_closest_sibling_state | def get_closest_sibling_state(state_m, from_logical_port=None):
""" Calculate the closest sibling also from optional logical port of handed state model
:param StateModel state_m: Reference State model the closest sibling state should be find for
:param str from_logical_port: The logical port of handed stat... | python | def get_closest_sibling_state(state_m, from_logical_port=None):
""" Calculate the closest sibling also from optional logical port of handed state model
:param StateModel state_m: Reference State model the closest sibling state should be find for
:param str from_logical_port: The logical port of handed stat... | [
"def",
"get_closest_sibling_state",
"(",
"state_m",
",",
"from_logical_port",
"=",
"None",
")",
":",
"if",
"not",
"state_m",
".",
"parent",
":",
"logger",
".",
"warning",
"(",
"\"A state can not have a closest sibling state if it has not parent as {0}\"",
".",
"format",
... | Calculate the closest sibling also from optional logical port of handed state model
:param StateModel state_m: Reference State model the closest sibling state should be find for
:param str from_logical_port: The logical port of handed state model to be used as reference.
:rtype: tuple
:return: distance... | [
"Calculate",
"the",
"closest",
"sibling",
"also",
"from",
"optional",
"logical",
"port",
"of",
"handed",
"state",
"model"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/meta_data.py#L792-L834 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.get_action_arguments | def get_action_arguments(self, target_state_m):
""" Collect argument attributes for action signal
Use non empty list dict to create arguments for action signal msg and logger messages. The action parent model
can be different then the target state model because logical and data port changes als... | python | def get_action_arguments(self, target_state_m):
""" Collect argument attributes for action signal
Use non empty list dict to create arguments for action signal msg and logger messages. The action parent model
can be different then the target state model because logical and data port changes als... | [
"def",
"get_action_arguments",
"(",
"self",
",",
"target_state_m",
")",
":",
"non_empty_lists_dict",
"=",
"{",
"key",
":",
"elems",
"for",
"key",
",",
"elems",
"in",
"self",
".",
"model_copies",
".",
"items",
"(",
")",
"if",
"elems",
"}",
"port_attrs",
"="... | Collect argument attributes for action signal
Use non empty list dict to create arguments for action signal msg and logger messages. The action parent model
can be different then the target state model because logical and data port changes also may influence the
linkage, see action-module (undo... | [
"Collect",
"argument",
"attributes",
"for",
"action",
"signal"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L56-L69 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.copy | def copy(self, selection, smart_selection_adaption=True):
""" Copy all selected items to the clipboard using smart selection adaptation by default
:param selection: the current selection
:param bool smart_selection_adaption: flag to enable smart selection adaptation mode
:return... | python | def copy(self, selection, smart_selection_adaption=True):
""" Copy all selected items to the clipboard using smart selection adaptation by default
:param selection: the current selection
:param bool smart_selection_adaption: flag to enable smart selection adaptation mode
:return... | [
"def",
"copy",
"(",
"self",
",",
"selection",
",",
"smart_selection_adaption",
"=",
"True",
")",
":",
"assert",
"isinstance",
"(",
"selection",
",",
"Selection",
")",
"self",
".",
"__create_core_and_model_object_copies",
"(",
"selection",
",",
"smart_selection_adapt... | Copy all selected items to the clipboard using smart selection adaptation by default
:param selection: the current selection
:param bool smart_selection_adaption: flag to enable smart selection adaptation mode
:return: | [
"Copy",
"all",
"selected",
"items",
"to",
"the",
"clipboard",
"using",
"smart",
"selection",
"adaptation",
"by",
"default",
":",
"param",
"selection",
":",
"the",
"current",
"selection",
":",
"param",
"bool",
"smart_selection_adaption",
":",
"flag",
"to",
"enabl... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L77-L85 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.cut | def cut(self, selection, smart_selection_adaption=False):
"""Cuts all selected items and copy them to the clipboard using smart selection adaptation by default
:param selection: the current selection
:param bool smart_selection_adaption: flag to enable smart selection adaptation mode
:r... | python | def cut(self, selection, smart_selection_adaption=False):
"""Cuts all selected items and copy them to the clipboard using smart selection adaptation by default
:param selection: the current selection
:param bool smart_selection_adaption: flag to enable smart selection adaptation mode
:r... | [
"def",
"cut",
"(",
"self",
",",
"selection",
",",
"smart_selection_adaption",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"selection",
",",
"Selection",
")",
"import",
"rafcon",
".",
"gui",
".",
"helpers",
".",
"state_machine",
"as",
"gui_helper_state... | Cuts all selected items and copy them to the clipboard using smart selection adaptation by default
:param selection: the current selection
:param bool smart_selection_adaption: flag to enable smart selection adaptation mode
:return: | [
"Cuts",
"all",
"selected",
"items",
"and",
"copy",
"them",
"to",
"the",
"clipboard",
"using",
"smart",
"selection",
"adaptation",
"by",
"default"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L88-L118 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.paste | def paste(self, target_state_m, cursor_position=None, limited=None, convert=False):
"""Paste objects to target state
The method checks whether the target state is a execution state or a container state and inserts respective
elements and notifies the user if the parts can not be insert to the t... | python | def paste(self, target_state_m, cursor_position=None, limited=None, convert=False):
"""Paste objects to target state
The method checks whether the target state is a execution state or a container state and inserts respective
elements and notifies the user if the parts can not be insert to the t... | [
"def",
"paste",
"(",
"self",
",",
"target_state_m",
",",
"cursor_position",
"=",
"None",
",",
"limited",
"=",
"None",
",",
"convert",
"=",
"False",
")",
":",
"self",
".",
"reset_clipboard_mapping_dicts",
"(",
")",
"if",
"not",
"isinstance",
"(",
"target_stat... | Paste objects to target state
The method checks whether the target state is a execution state or a container state and inserts respective
elements and notifies the user if the parts can not be insert to the target state.
- for ExecutionStates outcomes, input- and output-data ports can be insert... | [
"Paste",
"objects",
"to",
"target",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L123-L244 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.reset_clipboard | def reset_clipboard(self):
""" Resets the clipboard, so that old elements do not pollute the new selection that is copied into the
clipboard.
:return:
"""
# reset selections
for state_element_attr in ContainerState.state_element_attrs:
self.model_copies[s... | python | def reset_clipboard(self):
""" Resets the clipboard, so that old elements do not pollute the new selection that is copied into the
clipboard.
:return:
"""
# reset selections
for state_element_attr in ContainerState.state_element_attrs:
self.model_copies[s... | [
"def",
"reset_clipboard",
"(",
"self",
")",
":",
"# reset selections",
"for",
"state_element_attr",
"in",
"ContainerState",
".",
"state_element_attrs",
":",
"self",
".",
"model_copies",
"[",
"state_element_attr",
"]",
"=",
"[",
"]",
"# reset parent state_id the copied e... | Resets the clipboard, so that old elements do not pollute the new selection that is copied into the
clipboard.
:return: | [
"Resets",
"the",
"clipboard",
"so",
"that",
"old",
"elements",
"do",
"not",
"pollute",
"the",
"new",
"selection",
"that",
"is",
"copied",
"into",
"the",
"clipboard",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L321-L334 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.do_selection_reduction_to_one_parent | def do_selection_reduction_to_one_parent(selection):
""" Find and reduce selection to one parent state.
:param selection:
:return: state model which is parent of selection or None if root state
"""
all_models_selected = selection.get_all()
# check if all elements select... | python | def do_selection_reduction_to_one_parent(selection):
""" Find and reduce selection to one parent state.
:param selection:
:return: state model which is parent of selection or None if root state
"""
all_models_selected = selection.get_all()
# check if all elements select... | [
"def",
"do_selection_reduction_to_one_parent",
"(",
"selection",
")",
":",
"all_models_selected",
"=",
"selection",
".",
"get_all",
"(",
")",
"# check if all elements selected are on one hierarchy level -> TODO or in future are parts of sibling?!",
"# if not take the state with the most ... | Find and reduce selection to one parent state.
:param selection:
:return: state model which is parent of selection or None if root state | [
"Find",
"and",
"reduce",
"selection",
"to",
"one",
"parent",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L343-L372 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.do_smart_selection_adaption | def do_smart_selection_adaption(selection, parent_m):
""" Reduce and extend transition and data flow element selection if already enclosed by selection
The smart selection adaptation checks and ignores directly data flows and transitions which are selected
without selected related origin or t... | python | def do_smart_selection_adaption(selection, parent_m):
""" Reduce and extend transition and data flow element selection if already enclosed by selection
The smart selection adaptation checks and ignores directly data flows and transitions which are selected
without selected related origin or t... | [
"def",
"do_smart_selection_adaption",
"(",
"selection",
",",
"parent_m",
")",
":",
"def",
"get_ports_related_to_data_flow",
"(",
"data_flow",
")",
":",
"from_port",
"=",
"data_flow",
".",
"parent",
".",
"get_data_port",
"(",
"data_flow",
".",
"from_state",
",",
"d... | Reduce and extend transition and data flow element selection if already enclosed by selection
The smart selection adaptation checks and ignores directly data flows and transitions which are selected
without selected related origin or targets elements. Additional the linkage (data flows and transition... | [
"Reduce",
"and",
"extend",
"transition",
"and",
"data",
"flow",
"element",
"selection",
"if",
"already",
"enclosed",
"by",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L375-L450 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.__create_core_and_model_object_copies | def __create_core_and_model_object_copies(self, selection, smart_selection_adaption):
"""Copy all elements of a selection.
The method copies all objects and modifies the selection before copying the elements if the smart flag is true.
The smart selection adaption is by default enabled. In any... | python | def __create_core_and_model_object_copies(self, selection, smart_selection_adaption):
"""Copy all elements of a selection.
The method copies all objects and modifies the selection before copying the elements if the smart flag is true.
The smart selection adaption is by default enabled. In any... | [
"def",
"__create_core_and_model_object_copies",
"(",
"self",
",",
"selection",
",",
"smart_selection_adaption",
")",
":",
"all_models_selected",
"=",
"selection",
".",
"get_all",
"(",
")",
"if",
"not",
"all_models_selected",
":",
"logger",
".",
"warning",
"(",
"\"No... | Copy all elements of a selection.
The method copies all objects and modifies the selection before copying the elements if the smart flag is true.
The smart selection adaption is by default enabled. In any case the selection is reduced to have one parent
state that is used as the root of copy... | [
"Copy",
"all",
"elements",
"of",
"a",
"selection",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L452-L489 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.destroy_all_models_in_dict | def destroy_all_models_in_dict(target_dict):
""" Method runs the prepare destruction method of models
which are assumed in list or tuple as values within a dict
"""
if target_dict:
for model_list in target_dict.values():
if isinstance(model_list, (list, t... | python | def destroy_all_models_in_dict(target_dict):
""" Method runs the prepare destruction method of models
which are assumed in list or tuple as values within a dict
"""
if target_dict:
for model_list in target_dict.values():
if isinstance(model_list, (list, t... | [
"def",
"destroy_all_models_in_dict",
"(",
"target_dict",
")",
":",
"if",
"target_dict",
":",
"for",
"model_list",
"in",
"target_dict",
".",
"values",
"(",
")",
":",
"if",
"isinstance",
"(",
"model_list",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for"... | Method runs the prepare destruction method of models
which are assumed in list or tuple as values within a dict | [
"Method",
"runs",
"the",
"prepare",
"destruction",
"method",
"of",
"models",
"which",
"are",
"assumed",
"in",
"list",
"or",
"tuple",
"as",
"values",
"within",
"a",
"dict"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L492-L504 |
DLR-RM/RAFCON | source/rafcon/gui/clipboard.py | Clipboard.destroy | def destroy(self):
""" Destroys the clipboard by relieving all model references.
"""
self.destroy_all_models_in_dict(self.model_copies)
self.model_copies = None
self.copy_parent_state_id = None
self.outcome_id_mapping_dict = None
self.port_id_mapping_dict = None
... | python | def destroy(self):
""" Destroys the clipboard by relieving all model references.
"""
self.destroy_all_models_in_dict(self.model_copies)
self.model_copies = None
self.copy_parent_state_id = None
self.outcome_id_mapping_dict = None
self.port_id_mapping_dict = None
... | [
"def",
"destroy",
"(",
"self",
")",
":",
"self",
".",
"destroy_all_models_in_dict",
"(",
"self",
".",
"model_copies",
")",
"self",
".",
"model_copies",
"=",
"None",
"self",
".",
"copy_parent_state_id",
"=",
"None",
"self",
".",
"outcome_id_mapping_dict",
"=",
... | Destroys the clipboard by relieving all model references. | [
"Destroys",
"the",
"clipboard",
"by",
"relieving",
"all",
"model",
"references",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L506-L514 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | extend_extents | def extend_extents(extents, factor=1.1):
"""Extend a given bounding box
The bounding box (x1, y1, x2, y2) is centrally stretched by the given factor.
:param extents: The bound box extents
:param factor: The factor for stretching
:return: (x1, y1, x2, y2) of the extended bounding box
"""
wi... | python | def extend_extents(extents, factor=1.1):
"""Extend a given bounding box
The bounding box (x1, y1, x2, y2) is centrally stretched by the given factor.
:param extents: The bound box extents
:param factor: The factor for stretching
:return: (x1, y1, x2, y2) of the extended bounding box
"""
wi... | [
"def",
"extend_extents",
"(",
"extents",
",",
"factor",
"=",
"1.1",
")",
":",
"width",
"=",
"extents",
"[",
"2",
"]",
"-",
"extents",
"[",
"0",
"]",
"height",
"=",
"extents",
"[",
"3",
"]",
"-",
"extents",
"[",
"1",
"]",
"add_width",
"=",
"(",
"f... | Extend a given bounding box
The bounding box (x1, y1, x2, y2) is centrally stretched by the given factor.
:param extents: The bound box extents
:param factor: The factor for stretching
:return: (x1, y1, x2, y2) of the extended bounding box | [
"Extend",
"a",
"given",
"bounding",
"box"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L22-L39 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | calc_rel_pos_to_parent | def calc_rel_pos_to_parent(canvas, item, handle):
"""This method calculates the relative position of the given item's handle to its parent
:param canvas: Canvas to find relative position in
:param item: Item to find relative position to parent
:param handle: Handle of item to find relative position to
... | python | def calc_rel_pos_to_parent(canvas, item, handle):
"""This method calculates the relative position of the given item's handle to its parent
:param canvas: Canvas to find relative position in
:param item: Item to find relative position to parent
:param handle: Handle of item to find relative position to
... | [
"def",
"calc_rel_pos_to_parent",
"(",
"canvas",
",",
"item",
",",
"handle",
")",
":",
"from",
"gaphas",
".",
"item",
"import",
"NW",
"if",
"isinstance",
"(",
"item",
",",
"ConnectionView",
")",
":",
"return",
"item",
".",
"canvas",
".",
"get_matrix_i2i",
"... | This method calculates the relative position of the given item's handle to its parent
:param canvas: Canvas to find relative position in
:param item: Item to find relative position to parent
:param handle: Handle of item to find relative position to
:return: Relative position (x, y) | [
"This",
"method",
"calculates",
"the",
"relative",
"position",
"of",
"the",
"given",
"item",
"s",
"handle",
"to",
"its",
"parent"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L42-L59 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | assert_exactly_one_true | def assert_exactly_one_true(bool_list):
"""This method asserts that only one value of the provided list is True.
:param bool_list: List of booleans to check
:return: True if only one value is True, False otherwise
"""
assert isinstance(bool_list, list)
counter = 0
for item in bool_list:
... | python | def assert_exactly_one_true(bool_list):
"""This method asserts that only one value of the provided list is True.
:param bool_list: List of booleans to check
:return: True if only one value is True, False otherwise
"""
assert isinstance(bool_list, list)
counter = 0
for item in bool_list:
... | [
"def",
"assert_exactly_one_true",
"(",
"bool_list",
")",
":",
"assert",
"isinstance",
"(",
"bool_list",
",",
"list",
")",
"counter",
"=",
"0",
"for",
"item",
"in",
"bool_list",
":",
"if",
"item",
":",
"counter",
"+=",
"1",
"return",
"counter",
"==",
"1"
] | This method asserts that only one value of the provided list is True.
:param bool_list: List of booleans to check
:return: True if only one value is True, False otherwise | [
"This",
"method",
"asserts",
"that",
"only",
"one",
"value",
"of",
"the",
"provided",
"list",
"is",
"True",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L62-L73 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | get_state_id_for_port | def get_state_id_for_port(port):
"""This method returns the state ID of the state containing the given port
:param port: Port to check for containing state ID
:return: State ID of state containing port
"""
parent = port.parent
from rafcon.gui.mygaphas.items.state import StateView
if isinsta... | python | def get_state_id_for_port(port):
"""This method returns the state ID of the state containing the given port
:param port: Port to check for containing state ID
:return: State ID of state containing port
"""
parent = port.parent
from rafcon.gui.mygaphas.items.state import StateView
if isinsta... | [
"def",
"get_state_id_for_port",
"(",
"port",
")",
":",
"parent",
"=",
"port",
".",
"parent",
"from",
"rafcon",
".",
"gui",
".",
"mygaphas",
".",
"items",
".",
"state",
"import",
"StateView",
"if",
"isinstance",
"(",
"parent",
",",
"StateView",
")",
":",
... | This method returns the state ID of the state containing the given port
:param port: Port to check for containing state ID
:return: State ID of state containing port | [
"This",
"method",
"returns",
"the",
"state",
"ID",
"of",
"the",
"state",
"containing",
"the",
"given",
"port"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L76-L85 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | get_port_for_handle | def get_port_for_handle(handle, state):
"""Looks for and returns the PortView to the given handle in the provided state
:param handle: Handle to look for port
:param state: State containing handle and port
:returns: PortView for handle
"""
from rafcon.gui.mygaphas.items.state import StateView
... | python | def get_port_for_handle(handle, state):
"""Looks for and returns the PortView to the given handle in the provided state
:param handle: Handle to look for port
:param state: State containing handle and port
:returns: PortView for handle
"""
from rafcon.gui.mygaphas.items.state import StateView
... | [
"def",
"get_port_for_handle",
"(",
"handle",
",",
"state",
")",
":",
"from",
"rafcon",
".",
"gui",
".",
"mygaphas",
".",
"items",
".",
"state",
"import",
"StateView",
"if",
"isinstance",
"(",
"state",
",",
"StateView",
")",
":",
"if",
"state",
".",
"inco... | Looks for and returns the PortView to the given handle in the provided state
:param handle: Handle to look for port
:param state: State containing handle and port
:returns: PortView for handle | [
"Looks",
"for",
"and",
"returns",
"the",
"PortView",
"to",
"the",
"given",
"handle",
"in",
"the",
"provided",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L88-L111 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | create_new_connection | def create_new_connection(from_port, to_port):
"""Checks the type of connection and tries to create it
If bot port are logical port,s a transition is created. If both ports are data ports (including scoped variable),
then a data flow is added. An error log is created, when the types are not compatible.
... | python | def create_new_connection(from_port, to_port):
"""Checks the type of connection and tries to create it
If bot port are logical port,s a transition is created. If both ports are data ports (including scoped variable),
then a data flow is added. An error log is created, when the types are not compatible.
... | [
"def",
"create_new_connection",
"(",
"from_port",
",",
"to_port",
")",
":",
"from",
"rafcon",
".",
"gui",
".",
"mygaphas",
".",
"items",
".",
"ports",
"import",
"ScopedVariablePortView",
",",
"LogicPortView",
",",
"DataPortView",
"if",
"isinstance",
"(",
"from_p... | Checks the type of connection and tries to create it
If bot port are logical port,s a transition is created. If both ports are data ports (including scoped variable),
then a data flow is added. An error log is created, when the types are not compatible.
:param from_port: The starting port of the connectio... | [
"Checks",
"the",
"type",
"of",
"connection",
"and",
"tries",
"to",
"create",
"it"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L114-L135 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | add_data_flow_to_state | def add_data_flow_to_state(from_port, to_port):
"""Interface method between Gaphas and RAFCON core for adding data flows
The method checks the types of the given ports and their relation. From this the necessary parameters for the
add_dat_flow method of the RAFCON core are determined. Also the parent state... | python | def add_data_flow_to_state(from_port, to_port):
"""Interface method between Gaphas and RAFCON core for adding data flows
The method checks the types of the given ports and their relation. From this the necessary parameters for the
add_dat_flow method of the RAFCON core are determined. Also the parent state... | [
"def",
"add_data_flow_to_state",
"(",
"from_port",
",",
"to_port",
")",
":",
"from",
"rafcon",
".",
"gui",
".",
"mygaphas",
".",
"items",
".",
"ports",
"import",
"InputPortView",
",",
"OutputPortView",
",",
"ScopedVariablePortView",
"from",
"rafcon",
".",
"gui",... | Interface method between Gaphas and RAFCON core for adding data flows
The method checks the types of the given ports and their relation. From this the necessary parameters for the
add_dat_flow method of the RAFCON core are determined. Also the parent state is derived from the ports.
:param from_port: Port... | [
"Interface",
"method",
"between",
"Gaphas",
"and",
"RAFCON",
"core",
"for",
"adding",
"data",
"flows"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L138-L197 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | add_transition_to_state | def add_transition_to_state(from_port, to_port):
"""Interface method between Gaphas and RAFCON core for adding transitions
The method checks the types of the given ports (IncomeView or OutcomeView) and from this determines the necessary
parameters for the add_transition method of the RAFCON core. Also the ... | python | def add_transition_to_state(from_port, to_port):
"""Interface method between Gaphas and RAFCON core for adding transitions
The method checks the types of the given ports (IncomeView or OutcomeView) and from this determines the necessary
parameters for the add_transition method of the RAFCON core. Also the ... | [
"def",
"add_transition_to_state",
"(",
"from_port",
",",
"to_port",
")",
":",
"from",
"rafcon",
".",
"gui",
".",
"mygaphas",
".",
"items",
".",
"ports",
"import",
"IncomeView",
",",
"OutcomeView",
"from_state_v",
"=",
"from_port",
".",
"parent",
"to_state_v",
... | Interface method between Gaphas and RAFCON core for adding transitions
The method checks the types of the given ports (IncomeView or OutcomeView) and from this determines the necessary
parameters for the add_transition method of the RAFCON core. Also the parent state is derived from the ports.
:param from... | [
"Interface",
"method",
"between",
"Gaphas",
"and",
"RAFCON",
"core",
"for",
"adding",
"transitions"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L200-L265 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | get_relative_positions_of_waypoints | def get_relative_positions_of_waypoints(transition_v):
"""This method takes the waypoints of a connection and returns all relative positions of these waypoints.
:param canvas: Canvas to check relative position in
:param transition_v: Transition view to extract all relative waypoint positions
:return: L... | python | def get_relative_positions_of_waypoints(transition_v):
"""This method takes the waypoints of a connection and returns all relative positions of these waypoints.
:param canvas: Canvas to check relative position in
:param transition_v: Transition view to extract all relative waypoint positions
:return: L... | [
"def",
"get_relative_positions_of_waypoints",
"(",
"transition_v",
")",
":",
"handles_list",
"=",
"transition_v",
".",
"handles",
"(",
")",
"rel_pos_list",
"=",
"[",
"]",
"for",
"handle",
"in",
"handles_list",
":",
"if",
"handle",
"in",
"transition_v",
".",
"end... | This method takes the waypoints of a connection and returns all relative positions of these waypoints.
:param canvas: Canvas to check relative position in
:param transition_v: Transition view to extract all relative waypoint positions
:return: List with all relative positions of the given transition | [
"This",
"method",
"takes",
"the",
"waypoints",
"of",
"a",
"connection",
"and",
"returns",
"all",
"relative",
"positions",
"of",
"these",
"waypoints",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L268-L282 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | update_meta_data_for_transition_waypoints | def update_meta_data_for_transition_waypoints(graphical_editor_view, transition_v, last_waypoint_list, publish=True):
"""This method updates the relative position meta data of the transitions waypoints if they changed
:param graphical_editor_view: Graphical Editor the change occurred in
:param transition_v... | python | def update_meta_data_for_transition_waypoints(graphical_editor_view, transition_v, last_waypoint_list, publish=True):
"""This method updates the relative position meta data of the transitions waypoints if they changed
:param graphical_editor_view: Graphical Editor the change occurred in
:param transition_v... | [
"def",
"update_meta_data_for_transition_waypoints",
"(",
"graphical_editor_view",
",",
"transition_v",
",",
"last_waypoint_list",
",",
"publish",
"=",
"True",
")",
":",
"from",
"rafcon",
".",
"gui",
".",
"mygaphas",
".",
"items",
".",
"connection",
"import",
"Transi... | This method updates the relative position meta data of the transitions waypoints if they changed
:param graphical_editor_view: Graphical Editor the change occurred in
:param transition_v: Transition that changed
:param last_waypoint_list: List of waypoints before change
:param bool publish: Whether to ... | [
"This",
"method",
"updates",
"the",
"relative",
"position",
"meta",
"data",
"of",
"the",
"transitions",
"waypoints",
"if",
"they",
"changed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L285-L302 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | update_meta_data_for_port | def update_meta_data_for_port(graphical_editor_view, item, handle):
"""This method updates the meta data of the states ports if they changed.
:param graphical_editor_view: Graphical Editor the change occurred in
:param item: State the port was moved in
:param handle: Handle of moved port or None if all... | python | def update_meta_data_for_port(graphical_editor_view, item, handle):
"""This method updates the meta data of the states ports if they changed.
:param graphical_editor_view: Graphical Editor the change occurred in
:param item: State the port was moved in
:param handle: Handle of moved port or None if all... | [
"def",
"update_meta_data_for_port",
"(",
"graphical_editor_view",
",",
"item",
",",
"handle",
")",
":",
"from",
"rafcon",
".",
"gui",
".",
"mygaphas",
".",
"items",
".",
"ports",
"import",
"IncomeView",
",",
"OutcomeView",
",",
"InputPortView",
",",
"OutputPortV... | This method updates the meta data of the states ports if they changed.
:param graphical_editor_view: Graphical Editor the change occurred in
:param item: State the port was moved in
:param handle: Handle of moved port or None if all ports are to be updated | [
"This",
"method",
"updates",
"the",
"meta",
"data",
"of",
"the",
"states",
"ports",
"if",
"they",
"changed",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L305-L329 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | update_meta_data_for_name_view | def update_meta_data_for_name_view(graphical_editor_view, name_v, publish=True):
"""This method updates the meta data of a name view.
:param graphical_editor_view: Graphical Editor view the change occurred in
:param name_v: The name view which has been changed/moved
:param publish: Whether to publish t... | python | def update_meta_data_for_name_view(graphical_editor_view, name_v, publish=True):
"""This method updates the meta data of a name view.
:param graphical_editor_view: Graphical Editor view the change occurred in
:param name_v: The name view which has been changed/moved
:param publish: Whether to publish t... | [
"def",
"update_meta_data_for_name_view",
"(",
"graphical_editor_view",
",",
"name_v",
",",
"publish",
"=",
"True",
")",
":",
"from",
"gaphas",
".",
"item",
"import",
"NW",
"rel_pos",
"=",
"calc_rel_pos_to_parent",
"(",
"graphical_editor_view",
".",
"editor",
".",
... | This method updates the meta data of a name view.
:param graphical_editor_view: Graphical Editor view the change occurred in
:param name_v: The name view which has been changed/moved
:param publish: Whether to publish the changes of the meta data | [
"This",
"method",
"updates",
"the",
"meta",
"data",
"of",
"a",
"name",
"view",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L332-L348 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/gap_helper.py | update_meta_data_for_state_view | def update_meta_data_for_state_view(graphical_editor_view, state_v, affects_children=False, publish=True):
"""This method updates the meta data of a state view
:param graphical_editor_view: Graphical Editor view the change occurred in
:param state_v: The state view which has been changed/moved
:param a... | python | def update_meta_data_for_state_view(graphical_editor_view, state_v, affects_children=False, publish=True):
"""This method updates the meta data of a state view
:param graphical_editor_view: Graphical Editor view the change occurred in
:param state_v: The state view which has been changed/moved
:param a... | [
"def",
"update_meta_data_for_state_view",
"(",
"graphical_editor_view",
",",
"state_v",
",",
"affects_children",
"=",
"False",
",",
"publish",
"=",
"True",
")",
":",
"from",
"gaphas",
".",
"item",
"import",
"NW",
"# Update all port meta data to match with new position and... | This method updates the meta data of a state view
:param graphical_editor_view: Graphical Editor view the change occurred in
:param state_v: The state view which has been changed/moved
:param affects_children: Whether the children of the state view have been resized or not
:param publish: Whether to pu... | [
"This",
"method",
"updates",
"the",
"meta",
"data",
"of",
"a",
"state",
"view"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_helper.py#L351-L377 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/items/state.py | StateView.remove | def remove(self):
"""Remove recursively all children and then the StateView itself
"""
self.canvas.get_first_view().unselect_item(self)
for child in self.canvas.get_children(self)[:]:
child.remove()
self.remove_income()
for outcome_v in self.outcomes[:]:
... | python | def remove(self):
"""Remove recursively all children and then the StateView itself
"""
self.canvas.get_first_view().unselect_item(self)
for child in self.canvas.get_children(self)[:]:
child.remove()
self.remove_income()
for outcome_v in self.outcomes[:]:
... | [
"def",
"remove",
"(",
"self",
")",
":",
"self",
".",
"canvas",
".",
"get_first_view",
"(",
")",
".",
"unselect_item",
"(",
"self",
")",
"for",
"child",
"in",
"self",
".",
"canvas",
".",
"get_children",
"(",
"self",
")",
"[",
":",
"]",
":",
"child",
... | Remove recursively all children and then the StateView itself | [
"Remove",
"recursively",
"all",
"children",
"and",
"then",
"the",
"StateView",
"itself"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/items/state.py#L187-L209 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/items/state.py | StateView.set_enable_flag_keep_rect_within_constraints | def set_enable_flag_keep_rect_within_constraints(self, enable):
""" Enable/disables the KeepRectangleWithinConstraint for child states """
for child_state_v in self.child_state_views():
self.keep_rect_constraints[child_state_v].enable = enable
child_state_v.keep_rect_constraints[... | python | def set_enable_flag_keep_rect_within_constraints(self, enable):
""" Enable/disables the KeepRectangleWithinConstraint for child states """
for child_state_v in self.child_state_views():
self.keep_rect_constraints[child_state_v].enable = enable
child_state_v.keep_rect_constraints[... | [
"def",
"set_enable_flag_keep_rect_within_constraints",
"(",
"self",
",",
"enable",
")",
":",
"for",
"child_state_v",
"in",
"self",
".",
"child_state_views",
"(",
")",
":",
"self",
".",
"keep_rect_constraints",
"[",
"child_state_v",
"]",
".",
"enable",
"=",
"enable... | Enable/disables the KeepRectangleWithinConstraint for child states | [
"Enable",
"/",
"disables",
"the",
"KeepRectangleWithinConstraint",
"for",
"child",
"states"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/items/state.py#L234-L238 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/items/state.py | StateView.show_content | def show_content(self, with_content=False):
"""Checks if the state is a library with the `show_content` flag set
:param with_content: If this parameter is `True`, the method return only True if the library represents a
ContainerState
:return: Whether the content of a library state is ... | python | def show_content(self, with_content=False):
"""Checks if the state is a library with the `show_content` flag set
:param with_content: If this parameter is `True`, the method return only True if the library represents a
ContainerState
:return: Whether the content of a library state is ... | [
"def",
"show_content",
"(",
"self",
",",
"with_content",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"model",
",",
"LibraryStateModel",
")",
"and",
"self",
".",
"model",
".",
"show_content",
"(",
")",
":",
"return",
"not",
"with_content",... | Checks if the state is a library with the `show_content` flag set
:param with_content: If this parameter is `True`, the method return only True if the library represents a
ContainerState
:return: Whether the content of a library state is shown | [
"Checks",
"if",
"the",
"state",
"is",
"a",
"library",
"with",
"the",
"show_content",
"flag",
"set"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/items/state.py#L336-L345 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/items/state.py | StateView._calculate_port_pos_on_line | def _calculate_port_pos_on_line(self, port_num, side_length, port_width=None):
"""Calculate the position of a port on a line
The position depends on the number of element. Elements are equally spaced. If the end of the line is
reached, ports are stacked.
:param int port_num: The number ... | python | def _calculate_port_pos_on_line(self, port_num, side_length, port_width=None):
"""Calculate the position of a port on a line
The position depends on the number of element. Elements are equally spaced. If the end of the line is
reached, ports are stacked.
:param int port_num: The number ... | [
"def",
"_calculate_port_pos_on_line",
"(",
"self",
",",
"port_num",
",",
"side_length",
",",
"port_width",
"=",
"None",
")",
":",
"if",
"port_width",
"is",
"None",
":",
"port_width",
"=",
"2",
"*",
"self",
".",
"border_width",
"border_size",
"=",
"self",
"."... | Calculate the position of a port on a line
The position depends on the number of element. Elements are equally spaced. If the end of the line is
reached, ports are stacked.
:param int port_num: The number of the port of that type
:param float side_length: The length of the side the elem... | [
"Calculate",
"the",
"position",
"of",
"a",
"port",
"on",
"a",
"line"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/items/state.py#L796-L813 |
DLR-RM/RAFCON | source/rafcon/utils/storage_utils.py | write_dict_to_yaml | def write_dict_to_yaml(dictionary, path, **kwargs):
"""
Writes a dictionary to a yaml file
:param dictionary: the dictionary to be written
:param path: the absolute path of the target yaml file
:param kwargs: optional additional parameters for dumper
"""
with open(path, 'w') as f:
y... | python | def write_dict_to_yaml(dictionary, path, **kwargs):
"""
Writes a dictionary to a yaml file
:param dictionary: the dictionary to be written
:param path: the absolute path of the target yaml file
:param kwargs: optional additional parameters for dumper
"""
with open(path, 'w') as f:
y... | [
"def",
"write_dict_to_yaml",
"(",
"dictionary",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"open",
"(",
"path",
",",
"'w'",
")",
"as",
"f",
":",
"yaml",
".",
"dump",
"(",
"dictionary",
",",
"f",
",",
"indent",
"=",
"4",
",",
"*",
"*"... | Writes a dictionary to a yaml file
:param dictionary: the dictionary to be written
:param path: the absolute path of the target yaml file
:param kwargs: optional additional parameters for dumper | [
"Writes",
"a",
"dictionary",
"to",
"a",
"yaml",
"file",
":",
"param",
"dictionary",
":",
"the",
"dictionary",
"to",
"be",
"written",
":",
"param",
"path",
":",
"the",
"absolute",
"path",
"of",
"the",
"target",
"yaml",
"file",
":",
"param",
"kwargs",
":",... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/storage_utils.py#L79-L87 |
DLR-RM/RAFCON | source/rafcon/utils/storage_utils.py | load_dict_from_yaml | def load_dict_from_yaml(path):
"""
Loads a dictionary from a yaml file
:param path: the absolute path of the target yaml file
:return:
"""
f = file(path, 'r')
dictionary = yaml.load(f)
f.close()
return dictionary | python | def load_dict_from_yaml(path):
"""
Loads a dictionary from a yaml file
:param path: the absolute path of the target yaml file
:return:
"""
f = file(path, 'r')
dictionary = yaml.load(f)
f.close()
return dictionary | [
"def",
"load_dict_from_yaml",
"(",
"path",
")",
":",
"f",
"=",
"file",
"(",
"path",
",",
"'r'",
")",
"dictionary",
"=",
"yaml",
".",
"load",
"(",
"f",
")",
"f",
".",
"close",
"(",
")",
"return",
"dictionary"
] | Loads a dictionary from a yaml file
:param path: the absolute path of the target yaml file
:return: | [
"Loads",
"a",
"dictionary",
"from",
"a",
"yaml",
"file",
":",
"param",
"path",
":",
"the",
"absolute",
"path",
"of",
"the",
"target",
"yaml",
"file",
":",
"return",
":"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/storage_utils.py#L90-L99 |
DLR-RM/RAFCON | source/rafcon/utils/storage_utils.py | write_dict_to_json | def write_dict_to_json(dictionary, path, **kwargs):
"""
Write a dictionary to a json file.
:param path: The relative path to save the dictionary to
:param dictionary: The dictionary to get saved
:param kwargs: optional additional parameters for dumper
"""
result_string = json.dumps(dictionar... | python | def write_dict_to_json(dictionary, path, **kwargs):
"""
Write a dictionary to a json file.
:param path: The relative path to save the dictionary to
:param dictionary: The dictionary to get saved
:param kwargs: optional additional parameters for dumper
"""
result_string = json.dumps(dictionar... | [
"def",
"write_dict_to_json",
"(",
"dictionary",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"result_string",
"=",
"json",
".",
"dumps",
"(",
"dictionary",
",",
"cls",
"=",
"JSONObjectEncoder",
",",
"indent",
"=",
"4",
",",
"check_circular",
"=",
"False... | Write a dictionary to a json file.
:param path: The relative path to save the dictionary to
:param dictionary: The dictionary to get saved
:param kwargs: optional additional parameters for dumper | [
"Write",
"a",
"dictionary",
"to",
"a",
"json",
"file",
".",
":",
"param",
"path",
":",
"The",
"relative",
"path",
"to",
"save",
"the",
"dictionary",
"to",
":",
"param",
"dictionary",
":",
"The",
"dictionary",
"to",
"get",
"saved",
":",
"param",
"kwargs",... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/storage_utils.py#L102-L113 |
DLR-RM/RAFCON | source/rafcon/utils/storage_utils.py | load_objects_from_json | def load_objects_from_json(path, as_dict=False):
"""Loads a dictionary from a json file.
:param path: The relative path of the json file.
:return: The dictionary specified in the json file
"""
f = open(path, 'r')
if as_dict:
result = json.load(f)
else:
result = json.load(f, ... | python | def load_objects_from_json(path, as_dict=False):
"""Loads a dictionary from a json file.
:param path: The relative path of the json file.
:return: The dictionary specified in the json file
"""
f = open(path, 'r')
if as_dict:
result = json.load(f)
else:
result = json.load(f, ... | [
"def",
"load_objects_from_json",
"(",
"path",
",",
"as_dict",
"=",
"False",
")",
":",
"f",
"=",
"open",
"(",
"path",
",",
"'r'",
")",
"if",
"as_dict",
":",
"result",
"=",
"json",
".",
"load",
"(",
"f",
")",
"else",
":",
"result",
"=",
"json",
".",
... | Loads a dictionary from a json file.
:param path: The relative path of the json file.
:return: The dictionary specified in the json file | [
"Loads",
"a",
"dictionary",
"from",
"a",
"json",
"file",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/storage_utils.py#L116-L128 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/constraint.py | KeepRectangleWithinConstraint.solve_for | def solve_for(self, var=None):
"""Ensure that the children is within its parent
"""
if not self.enable:
return
margin = self.margin_method()
def parent_width():
return self.parent_se[0].value - self.parent_nw[0].value
def parent_height():
... | python | def solve_for(self, var=None):
"""Ensure that the children is within its parent
"""
if not self.enable:
return
margin = self.margin_method()
def parent_width():
return self.parent_se[0].value - self.parent_nw[0].value
def parent_height():
... | [
"def",
"solve_for",
"(",
"self",
",",
"var",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"enable",
":",
"return",
"margin",
"=",
"self",
".",
"margin_method",
"(",
")",
"def",
"parent_width",
"(",
")",
":",
"return",
"self",
".",
"parent_se",
"[... | Ensure that the children is within its parent | [
"Ensure",
"that",
"the",
"children",
"is",
"within",
"its",
"parent"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L57-L111 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/constraint.py | KeepPointWithinConstraint.solve_for | def solve_for(self, var=None):
"""
Ensure that the children is within its parent
"""
margin = self.margin_method()
if self.parent_nw[0].value > self.child[0].value - margin:
_update(self.child[0], self.parent_nw[0].value + margin)
# Right edge (east)
i... | python | def solve_for(self, var=None):
"""
Ensure that the children is within its parent
"""
margin = self.margin_method()
if self.parent_nw[0].value > self.child[0].value - margin:
_update(self.child[0], self.parent_nw[0].value + margin)
# Right edge (east)
i... | [
"def",
"solve_for",
"(",
"self",
",",
"var",
"=",
"None",
")",
":",
"margin",
"=",
"self",
".",
"margin_method",
"(",
")",
"if",
"self",
".",
"parent_nw",
"[",
"0",
"]",
".",
"value",
">",
"self",
".",
"child",
"[",
"0",
"]",
".",
"value",
"-",
... | Ensure that the children is within its parent | [
"Ensure",
"that",
"the",
"children",
"is",
"within",
"its",
"parent"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L134-L149 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/constraint.py | PortRectConstraint.update_port_side | def update_port_side(self):
"""Updates the initial position of the port
The port side is ignored but calculated from the port position. Then the port position is limited to the four
side lines of the state.
"""
from rafcon.utils.geometry import point_left_of_line
p = (s... | python | def update_port_side(self):
"""Updates the initial position of the port
The port side is ignored but calculated from the port position. Then the port position is limited to the four
side lines of the state.
"""
from rafcon.utils.geometry import point_left_of_line
p = (s... | [
"def",
"update_port_side",
"(",
"self",
")",
":",
"from",
"rafcon",
".",
"utils",
".",
"geometry",
"import",
"point_left_of_line",
"p",
"=",
"(",
"self",
".",
"_initial_pos",
".",
"x",
",",
"self",
".",
"_initial_pos",
".",
"y",
")",
"nw_x",
",",
"nw_y",... | Updates the initial position of the port
The port side is ignored but calculated from the port position. Then the port position is limited to the four
side lines of the state. | [
"Updates",
"the",
"initial",
"position",
"of",
"the",
"port"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L223-L248 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/constraint.py | PortRectConstraint._solve | def _solve(self):
"""
Calculates the correct position of the port and keeps it aligned with the binding rect
"""
# As the size of the containing state may has changed we need to update the distance to the border
self.update_distance_to_border()
px, py = self._point
... | python | def _solve(self):
"""
Calculates the correct position of the port and keeps it aligned with the binding rect
"""
# As the size of the containing state may has changed we need to update the distance to the border
self.update_distance_to_border()
px, py = self._point
... | [
"def",
"_solve",
"(",
"self",
")",
":",
"# As the size of the containing state may has changed we need to update the distance to the border",
"self",
".",
"update_distance_to_border",
"(",
")",
"px",
",",
"py",
"=",
"self",
".",
"_point",
"nw_x",
",",
"nw_y",
",",
"se_x... | Calculates the correct position of the port and keeps it aligned with the binding rect | [
"Calculates",
"the",
"correct",
"position",
"of",
"the",
"port",
"and",
"keeps",
"it",
"aligned",
"with",
"the",
"binding",
"rect"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L253-L296 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/constraint.py | PortRectConstraint.limit_pos | def limit_pos(p, se_pos, nw_pos):
"""
Limits position p to stay inside containing state
:param p: Position to limit
:param se_pos: Bottom/Right boundary
:param nw_pos: Top/Left boundary
:return:
"""
if p > se_pos:
_update(p, se_pos)
eli... | python | def limit_pos(p, se_pos, nw_pos):
"""
Limits position p to stay inside containing state
:param p: Position to limit
:param se_pos: Bottom/Right boundary
:param nw_pos: Top/Left boundary
:return:
"""
if p > se_pos:
_update(p, se_pos)
eli... | [
"def",
"limit_pos",
"(",
"p",
",",
"se_pos",
",",
"nw_pos",
")",
":",
"if",
"p",
">",
"se_pos",
":",
"_update",
"(",
"p",
",",
"se_pos",
")",
"elif",
"p",
"<",
"nw_pos",
":",
"_update",
"(",
"p",
",",
"nw_pos",
")"
] | Limits position p to stay inside containing state
:param p: Position to limit
:param se_pos: Bottom/Right boundary
:param nw_pos: Top/Left boundary
:return: | [
"Limits",
"position",
"p",
"to",
"stay",
"inside",
"containing",
"state",
":",
"param",
"p",
":",
"Position",
"to",
"limit",
":",
"param",
"se_pos",
":",
"Bottom",
"/",
"Right",
"boundary",
":",
"param",
"nw_pos",
":",
"Top",
"/",
"Left",
"boundary",
":"... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L302-L313 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/constraint.py | PortRectConstraint.get_adjusted_border_positions | def get_adjusted_border_positions(self):
"""
Calculates the positions to limit the port movement to
:return: Adjusted positions nw_x, nw_y, se_x, se_y
"""
nw_x, nw_y = self._rect[0]
se_x, se_y = self._rect[1]
nw_x += self._distance_to_border
nw_y += self.... | python | def get_adjusted_border_positions(self):
"""
Calculates the positions to limit the port movement to
:return: Adjusted positions nw_x, nw_y, se_x, se_y
"""
nw_x, nw_y = self._rect[0]
se_x, se_y = self._rect[1]
nw_x += self._distance_to_border
nw_y += self.... | [
"def",
"get_adjusted_border_positions",
"(",
"self",
")",
":",
"nw_x",
",",
"nw_y",
"=",
"self",
".",
"_rect",
"[",
"0",
"]",
"se_x",
",",
"se_y",
"=",
"self",
".",
"_rect",
"[",
"1",
"]",
"nw_x",
"+=",
"self",
".",
"_distance_to_border",
"nw_y",
"+=",... | Calculates the positions to limit the port movement to
:return: Adjusted positions nw_x, nw_y, se_x, se_y | [
"Calculates",
"the",
"positions",
"to",
"limit",
"the",
"port",
"movement",
"to",
":",
"return",
":",
"Adjusted",
"positions",
"nw_x",
"nw_y",
"se_x",
"se_y"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L315-L328 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/constraint.py | PortRectConstraint.set_nearest_border | def set_nearest_border(self):
"""Snaps the port to the correct side upon state size change
"""
px, py = self._point
nw_x, nw_y, se_x, se_y = self.get_adjusted_border_positions()
if self._port.side == SnappedSide.RIGHT:
_update(px, se_x)
elif self._port.side =... | python | def set_nearest_border(self):
"""Snaps the port to the correct side upon state size change
"""
px, py = self._point
nw_x, nw_y, se_x, se_y = self.get_adjusted_border_positions()
if self._port.side == SnappedSide.RIGHT:
_update(px, se_x)
elif self._port.side =... | [
"def",
"set_nearest_border",
"(",
"self",
")",
":",
"px",
",",
"py",
"=",
"self",
".",
"_point",
"nw_x",
",",
"nw_y",
",",
"se_x",
",",
"se_y",
"=",
"self",
".",
"get_adjusted_border_positions",
"(",
")",
"if",
"self",
".",
"_port",
".",
"side",
"==",
... | Snaps the port to the correct side upon state size change | [
"Snaps",
"the",
"port",
"to",
"the",
"correct",
"side",
"upon",
"state",
"size",
"change"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L330-L343 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | remove_obsolete_folders | def remove_obsolete_folders(states, path):
"""Removes obsolete state machine folders
This function removes all folders in the file system folder `path` that do not belong to the states given by
`states`.
:param list states: the states that should reside in this very folder
:param str path: the... | python | def remove_obsolete_folders(states, path):
"""Removes obsolete state machine folders
This function removes all folders in the file system folder `path` that do not belong to the states given by
`states`.
:param list states: the states that should reside in this very folder
:param str path: the... | [
"def",
"remove_obsolete_folders",
"(",
"states",
",",
"path",
")",
":",
"elements_in_folder",
"=",
"os",
".",
"listdir",
"(",
"path",
")",
"# find all state folder elements in system path",
"state_folders_in_file_system",
"=",
"[",
"]",
"for",
"folder_name",
"in",
"el... | Removes obsolete state machine folders
This function removes all folders in the file system folder `path` that do not belong to the states given by
`states`.
:param list states: the states that should reside in this very folder
:param str path: the file system path to be checked for valid folders | [
"Removes",
"obsolete",
"state",
"machine",
"folders"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L67-L92 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | clean_path_from_deprecated_naming | def clean_path_from_deprecated_naming(base_path):
""" Checks if the base path includes deprecated characters/format and returns corrected version
The state machine folder name should be according the universal RAFCON path format. In case the state machine path
is inside a mounted library_root_path also the... | python | def clean_path_from_deprecated_naming(base_path):
""" Checks if the base path includes deprecated characters/format and returns corrected version
The state machine folder name should be according the universal RAFCON path format. In case the state machine path
is inside a mounted library_root_path also the... | [
"def",
"clean_path_from_deprecated_naming",
"(",
"base_path",
")",
":",
"def",
"warning_logger_message",
"(",
"insert_string",
")",
":",
"not_allowed_characters",
"=",
"\"'\"",
"+",
"\"', '\"",
".",
"join",
"(",
"REPLACED_CHARACTERS_FOR_NO_OS_LIMITATION",
".",
"keys",
"... | Checks if the base path includes deprecated characters/format and returns corrected version
The state machine folder name should be according the universal RAFCON path format. In case the state machine path
is inside a mounted library_root_path also the library_path has to have this format. The library path is... | [
"Checks",
"if",
"the",
"base",
"path",
"includes",
"deprecated",
"characters",
"/",
"format",
"and",
"returns",
"corrected",
"version"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L95-L128 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | clean_path | def clean_path(base_path):
"""
This function cleans a file system path in terms of removing all not allowed characters of each path element.
A path element is an element of a path between the path separator of the operating system.
:param base_path: the path to be cleaned
:return: the clean pat... | python | def clean_path(base_path):
"""
This function cleans a file system path in terms of removing all not allowed characters of each path element.
A path element is an element of a path between the path separator of the operating system.
:param base_path: the path to be cleaned
:return: the clean pat... | [
"def",
"clean_path",
"(",
"base_path",
")",
":",
"path_elements",
"=",
"base_path",
".",
"split",
"(",
"os",
".",
"path",
".",
"sep",
")",
"reduced_path_elements",
"=",
"[",
"clean_path_element",
"(",
"elem",
",",
"max_length",
"=",
"255",
")",
"for",
"ele... | This function cleans a file system path in terms of removing all not allowed characters of each path element.
A path element is an element of a path between the path separator of the operating system.
:param base_path: the path to be cleaned
:return: the clean path | [
"This",
"function",
"cleans",
"a",
"file",
"system",
"path",
"in",
"terms",
"of",
"removing",
"all",
"not",
"allowed",
"characters",
"of",
"each",
"path",
"element",
".",
"A",
"path",
"element",
"is",
"an",
"element",
"of",
"a",
"path",
"between",
"the",
... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L131-L144 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | save_state_machine_to_path | def save_state_machine_to_path(state_machine, base_path, delete_old_state_machine=False, as_copy=False):
"""Saves a state machine recursively to the file system
The `as_copy` flag determines whether the state machine is saved as copy. If so (`as_copy=True`), some state
machine attributes will be left untou... | python | def save_state_machine_to_path(state_machine, base_path, delete_old_state_machine=False, as_copy=False):
"""Saves a state machine recursively to the file system
The `as_copy` flag determines whether the state machine is saved as copy. If so (`as_copy=True`), some state
machine attributes will be left untou... | [
"def",
"save_state_machine_to_path",
"(",
"state_machine",
",",
"base_path",
",",
"delete_old_state_machine",
"=",
"False",
",",
"as_copy",
"=",
"False",
")",
":",
"# warns the user in the logger when using deprecated names",
"clean_path_from_deprecated_naming",
"(",
"base_path... | Saves a state machine recursively to the file system
The `as_copy` flag determines whether the state machine is saved as copy. If so (`as_copy=True`), some state
machine attributes will be left untouched, such as the `file_system_path` or the `dirty_flag`.
:param rafcon.core.state_machine.StateMachine sta... | [
"Saves",
"a",
"state",
"machine",
"recursively",
"to",
"the",
"file",
"system"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L147-L195 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | save_script_file_for_state_and_source_path | def save_script_file_for_state_and_source_path(state, state_path_full, as_copy=False):
"""Saves the script file for a state to the directory of the state.
The script name will be set to the SCRIPT_FILE constant.
:param state: The state of which the script file should be saved
:param str state_path_ful... | python | def save_script_file_for_state_and_source_path(state, state_path_full, as_copy=False):
"""Saves the script file for a state to the directory of the state.
The script name will be set to the SCRIPT_FILE constant.
:param state: The state of which the script file should be saved
:param str state_path_ful... | [
"def",
"save_script_file_for_state_and_source_path",
"(",
"state",
",",
"state_path_full",
",",
"as_copy",
"=",
"False",
")",
":",
"from",
"rafcon",
".",
"core",
".",
"states",
".",
"execution_state",
"import",
"ExecutionState",
"if",
"isinstance",
"(",
"state",
"... | Saves the script file for a state to the directory of the state.
The script name will be set to the SCRIPT_FILE constant.
:param state: The state of which the script file should be saved
:param str state_path_full: The path to the file system storage location of the state
:param bool as_copy: Temporar... | [
"Saves",
"the",
"script",
"file",
"for",
"a",
"state",
"to",
"the",
"directory",
"of",
"the",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L198-L221 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | save_semantic_data_for_state | def save_semantic_data_for_state(state, state_path_full):
"""Saves the semantic data in a separate json file.
:param state: The state of which the script file should be saved
:param str state_path_full: The path to the file system storage location of the state
"""
destination_script_file = os.path... | python | def save_semantic_data_for_state(state, state_path_full):
"""Saves the semantic data in a separate json file.
:param state: The state of which the script file should be saved
:param str state_path_full: The path to the file system storage location of the state
"""
destination_script_file = os.path... | [
"def",
"save_semantic_data_for_state",
"(",
"state",
",",
"state_path_full",
")",
":",
"destination_script_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"state_path_full",
",",
"SEMANTIC_DATA_FILE",
")",
"try",
":",
"storage_utils",
".",
"write_dict_to_json",
"("... | Saves the semantic data in a separate json file.
:param state: The state of which the script file should be saved
:param str state_path_full: The path to the file system storage location of the state | [
"Saves",
"the",
"semantic",
"data",
"in",
"a",
"separate",
"json",
"file",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L224-L238 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | save_state_recursively | def save_state_recursively(state, base_path, parent_path, as_copy=False):
"""Recursively saves a state to a json file
It calls this method on all its substates.
:param state: State to be stored
:param base_path: Path to the state machine
:param parent_path: Path to the parent state
:param bool... | python | def save_state_recursively(state, base_path, parent_path, as_copy=False):
"""Recursively saves a state to a json file
It calls this method on all its substates.
:param state: State to be stored
:param base_path: Path to the state machine
:param parent_path: Path to the parent state
:param bool... | [
"def",
"save_state_recursively",
"(",
"state",
",",
"base_path",
",",
"parent_path",
",",
"as_copy",
"=",
"False",
")",
":",
"from",
"rafcon",
".",
"core",
".",
"states",
".",
"execution_state",
"import",
"ExecutionState",
"from",
"rafcon",
".",
"core",
".",
... | Recursively saves a state to a json file
It calls this method on all its substates.
:param state: State to be stored
:param base_path: Path to the state machine
:param parent_path: Path to the parent state
:param bool as_copy: Temporary storage flag to signal that the given path is not the new fil... | [
"Recursively",
"saves",
"a",
"state",
"to",
"a",
"json",
"file"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L241-L273 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | load_state_machine_from_path | def load_state_machine_from_path(base_path, state_machine_id=None):
"""Loads a state machine from the given path
:param base_path: An optional base path for the state machine.
:return: a tuple of the loaded container state, the version of the state and the creation time
:raises ValueError: if the provi... | python | def load_state_machine_from_path(base_path, state_machine_id=None):
"""Loads a state machine from the given path
:param base_path: An optional base path for the state machine.
:return: a tuple of the loaded container state, the version of the state and the creation time
:raises ValueError: if the provi... | [
"def",
"load_state_machine_from_path",
"(",
"base_path",
",",
"state_machine_id",
"=",
"None",
")",
":",
"logger",
".",
"debug",
"(",
"\"Loading state machine from path {0}...\"",
".",
"format",
"(",
"base_path",
")",
")",
"state_machine_file_path",
"=",
"os",
".",
... | Loads a state machine from the given path
:param base_path: An optional base path for the state machine.
:return: a tuple of the loaded container state, the version of the state and the creation time
:raises ValueError: if the provided path does not contain a valid state machine | [
"Loads",
"a",
"state",
"machine",
"from",
"the",
"given",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L277-L362 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | load_state_recursively | def load_state_recursively(parent, state_path=None, dirty_states=[]):
"""Recursively loads the state
It calls this method on each sub-state of a container state.
:param parent: the root state of the last load call to which the loaded state will be added
:param state_path: the path on the filesystem w... | python | def load_state_recursively(parent, state_path=None, dirty_states=[]):
"""Recursively loads the state
It calls this method on each sub-state of a container state.
:param parent: the root state of the last load call to which the loaded state will be added
:param state_path: the path on the filesystem w... | [
"def",
"load_state_recursively",
"(",
"parent",
",",
"state_path",
"=",
"None",
",",
"dirty_states",
"=",
"[",
"]",
")",
":",
"from",
"rafcon",
".",
"core",
".",
"states",
".",
"execution_state",
"import",
"ExecutionState",
"from",
"rafcon",
".",
"core",
"."... | Recursively loads the state
It calls this method on each sub-state of a container state.
:param parent: the root state of the last load call to which the loaded state will be added
:param state_path: the path on the filesystem where to find the meta file for the state
:param dirty_states: a dict of s... | [
"Recursively",
"loads",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L374-L467 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | load_data_file | def load_data_file(path_of_file):
""" Loads the content of a file by using json.load.
:param path_of_file: the path of the file to load
:return: the file content as a string
:raises exceptions.ValueError: if the file was not found
"""
if os.path.exists(path_of_file):
return storage_util... | python | def load_data_file(path_of_file):
""" Loads the content of a file by using json.load.
:param path_of_file: the path of the file to load
:return: the file content as a string
:raises exceptions.ValueError: if the file was not found
"""
if os.path.exists(path_of_file):
return storage_util... | [
"def",
"load_data_file",
"(",
"path_of_file",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path_of_file",
")",
":",
"return",
"storage_utils",
".",
"load_objects_from_json",
"(",
"path_of_file",
")",
"raise",
"ValueError",
"(",
"\"Data file not found: {... | Loads the content of a file by using json.load.
:param path_of_file: the path of the file to load
:return: the file content as a string
:raises exceptions.ValueError: if the file was not found | [
"Loads",
"the",
"content",
"of",
"a",
"file",
"by",
"using",
"json",
".",
"load",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L470-L479 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | limit_text_max_length | def limit_text_max_length(text, max_length, separator='_'):
"""
Limits the length of a string. The returned string will be the first `max_length/2` characters of the input string
plus a separator plus the last `max_length/2` characters of the input string.
:param text: the text to be limited
:p... | python | def limit_text_max_length(text, max_length, separator='_'):
"""
Limits the length of a string. The returned string will be the first `max_length/2` characters of the input string
plus a separator plus the last `max_length/2` characters of the input string.
:param text: the text to be limited
:p... | [
"def",
"limit_text_max_length",
"(",
"text",
",",
"max_length",
",",
"separator",
"=",
"'_'",
")",
":",
"if",
"max_length",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"text",
",",
"string_types",
")",
"and",
"len",
"(",
"text",
")",
">",
"max_len... | Limits the length of a string. The returned string will be the first `max_length/2` characters of the input string
plus a separator plus the last `max_length/2` characters of the input string.
:param text: the text to be limited
:param max_length: the maximum length of the output string
:param sepa... | [
"Limits",
"the",
"length",
"of",
"a",
"string",
".",
"The",
"returned",
"string",
"will",
"be",
"the",
"first",
"max_length",
"/",
"2",
"characters",
"of",
"the",
"input",
"string",
"plus",
"a",
"separator",
"plus",
"the",
"last",
"max_length",
"/",
"2",
... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L482-L498 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | clean_path_element | def clean_path_element(text, max_length=None, separator='_'):
""" Replace characters that conflict with a free OS choice when in a file system path.
:param text: the string to be cleaned
:param max_length: the maximum length of the output string
:param separator: the separator used for rafcon.core.stor... | python | def clean_path_element(text, max_length=None, separator='_'):
""" Replace characters that conflict with a free OS choice when in a file system path.
:param text: the string to be cleaned
:param max_length: the maximum length of the output string
:param separator: the separator used for rafcon.core.stor... | [
"def",
"clean_path_element",
"(",
"text",
",",
"max_length",
"=",
"None",
",",
"separator",
"=",
"'_'",
")",
":",
"elements_to_replace",
"=",
"REPLACED_CHARACTERS_FOR_NO_OS_LIMITATION",
"for",
"elem",
",",
"replace_with",
"in",
"elements_to_replace",
".",
"items",
"... | Replace characters that conflict with a free OS choice when in a file system path.
:param text: the string to be cleaned
:param max_length: the maximum length of the output string
:param separator: the separator used for rafcon.core.storage.storage.limit_text_max_length
:return: | [
"Replace",
"characters",
"that",
"conflict",
"with",
"a",
"free",
"OS",
"choice",
"when",
"in",
"a",
"file",
"system",
"path",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L501-L514 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | limit_text_to_be_path_element | def limit_text_to_be_path_element(text, max_length=None, separator='_'):
""" Replace characters that are not in the valid character set of RAFCON.
:param text: the string to be cleaned
:param max_length: the maximum length of the output string
:param separator: the separator used for rafcon.core.storag... | python | def limit_text_to_be_path_element(text, max_length=None, separator='_'):
""" Replace characters that are not in the valid character set of RAFCON.
:param text: the string to be cleaned
:param max_length: the maximum length of the output string
:param separator: the separator used for rafcon.core.storag... | [
"def",
"limit_text_to_be_path_element",
"(",
"text",
",",
"max_length",
"=",
"None",
",",
"separator",
"=",
"'_'",
")",
":",
"# TODO: Should there not only be one method i.e. either this one or \"clean_path_element\"",
"elements_to_replace",
"=",
"{",
"' '",
":",
"'_'",
","... | Replace characters that are not in the valid character set of RAFCON.
:param text: the string to be cleaned
:param max_length: the maximum length of the output string
:param separator: the separator used for rafcon.core.storage.storage.limit_text_max_length
:return: | [
"Replace",
"characters",
"that",
"are",
"not",
"in",
"the",
"valid",
"character",
"set",
"of",
"RAFCON",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L517-L532 |
DLR-RM/RAFCON | source/rafcon/core/storage/storage.py | get_storage_id_for_state | def get_storage_id_for_state(state):
""" Calculates the storage id of a state. This ID can be used for generating the file path for a state.
:param rafcon.core.states.state.State state: state the storage_id should is composed for
"""
if global_config.get_config_value('STORAGE_PATH_WITH_STATE_NAME'):
... | python | def get_storage_id_for_state(state):
""" Calculates the storage id of a state. This ID can be used for generating the file path for a state.
:param rafcon.core.states.state.State state: state the storage_id should is composed for
"""
if global_config.get_config_value('STORAGE_PATH_WITH_STATE_NAME'):
... | [
"def",
"get_storage_id_for_state",
"(",
"state",
")",
":",
"if",
"global_config",
".",
"get_config_value",
"(",
"'STORAGE_PATH_WITH_STATE_NAME'",
")",
":",
"max_length",
"=",
"global_config",
".",
"get_config_value",
"(",
"'MAX_LENGTH_FOR_STATE_NAME_IN_STORAGE_PATH'",
")",
... | Calculates the storage id of a state. This ID can be used for generating the file path for a state.
:param rafcon.core.states.state.State state: state the storage_id should is composed for | [
"Calculates",
"the",
"storage",
"id",
"of",
"a",
"state",
".",
"This",
"ID",
"can",
"be",
"used",
"for",
"generating",
"the",
"file",
"path",
"for",
"a",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/storage/storage.py#L535-L552 |
DLR-RM/RAFCON | source/rafcon/gui/views/state_editor/source_editor.py | SourceEditorView.pane_position_check | def pane_position_check(self):
""" Update right bar pane position if needed
Checks calculates if the cursor is still visible and updates the pane position if it is close to not be seen.
In case of an un-docked right-bar this method does nothing.
:return:
"""
text_buffer ... | python | def pane_position_check(self):
""" Update right bar pane position if needed
Checks calculates if the cursor is still visible and updates the pane position if it is close to not be seen.
In case of an un-docked right-bar this method does nothing.
:return:
"""
text_buffer ... | [
"def",
"pane_position_check",
"(",
"self",
")",
":",
"text_buffer",
"=",
"self",
".",
"get_buffer",
"(",
")",
"# not needed if the right side bar is un-docked",
"from",
"rafcon",
".",
"gui",
".",
"singleton",
"import",
"main_window_controller",
"if",
"main_window_contro... | Update right bar pane position if needed
Checks calculates if the cursor is still visible and updates the pane position if it is close to not be seen.
In case of an un-docked right-bar this method does nothing.
:return: | [
"Update",
"right",
"bar",
"pane",
"position",
"if",
"needed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/views/state_editor/source_editor.py#L102-L141 |
DLR-RM/RAFCON | source/rafcon/core/execution/execution_history.py | ExecutionHistory.push_call_history_item | def push_call_history_item(self, state, call_type, state_for_scoped_data, input_data=None):
"""Adds a new call-history-item to the history item list
A call history items stores information about the point in time where a method (entry, execute,
exit) of certain state was called.
:param... | python | def push_call_history_item(self, state, call_type, state_for_scoped_data, input_data=None):
"""Adds a new call-history-item to the history item list
A call history items stores information about the point in time where a method (entry, execute,
exit) of certain state was called.
:param... | [
"def",
"push_call_history_item",
"(",
"self",
",",
"state",
",",
"call_type",
",",
"state_for_scoped_data",
",",
"input_data",
"=",
"None",
")",
":",
"last_history_item",
"=",
"self",
".",
"get_last_history_item",
"(",
")",
"from",
"rafcon",
".",
"core",
".",
... | Adds a new call-history-item to the history item list
A call history items stores information about the point in time where a method (entry, execute,
exit) of certain state was called.
:param state: the state that was called
:param call_type: the call type of the execution step,
... | [
"Adds",
"a",
"new",
"call",
"-",
"history",
"-",
"item",
"to",
"the",
"history",
"item",
"list"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/execution/execution_history.py#L169-L187 |
DLR-RM/RAFCON | source/rafcon/core/execution/execution_history.py | ExecutionHistory.push_return_history_item | def push_return_history_item(self, state, call_type, state_for_scoped_data, output_data=None):
"""Adds a new return-history-item to the history item list
A return history items stores information about the point in time where a method (entry, execute,
exit) of certain state returned.
:... | python | def push_return_history_item(self, state, call_type, state_for_scoped_data, output_data=None):
"""Adds a new return-history-item to the history item list
A return history items stores information about the point in time where a method (entry, execute,
exit) of certain state returned.
:... | [
"def",
"push_return_history_item",
"(",
"self",
",",
"state",
",",
"call_type",
",",
"state_for_scoped_data",
",",
"output_data",
"=",
"None",
")",
":",
"last_history_item",
"=",
"self",
".",
"get_last_history_item",
"(",
")",
"from",
"rafcon",
".",
"core",
".",... | Adds a new return-history-item to the history item list
A return history items stores information about the point in time where a method (entry, execute,
exit) of certain state returned.
:param state: the state that returned
:param call_type: the call type of the execution step,
... | [
"Adds",
"a",
"new",
"return",
"-",
"history",
"-",
"item",
"to",
"the",
"history",
"item",
"list"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/execution/execution_history.py#L190-L208 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.