17 from ..publish
import (RideTestCaseRemoved, RideVariableAdded, RideVariableRemoved, RideVariableMovedUp,
18 RideVariableMovedDown, RideUserKeywordRemoved, RideUserKeywordAdded, RideTestCaseAdded)
19 from ..publish.messages
import RideItemMovedUp, RideItemMovedDown
20 from ..robotapi
import is_list_var, is_scalar_var, is_dict_var
21 from ..utils
import overrides, variablematcher
22 from .basecontroller
import ControllerWithParent
23 from .
import macrocontrollers
24 from .settingcontrollers
import MetadataController, ImportController, VariableController
31 self.
_swap_swap(index - 1, index)
35 self.
_swap_swap(index, index + 1)
52 raise NotImplementedError(self.__class__)
55 raise NotImplementedError(self.__class__)
69 for item
in original_list:
71 for item2
in sorted_list:
72 if item.name == item2.name:
73 index_difference.append(counter)
76 return index_difference
82 _TableController.__init__(self, parent_controller, table)
91 return iter(self.
_get_get(v)
for v
in self.
_table_table)
97 return [v
for v
in self].
index(ctrl)
103 return self.
_table_table.variables
109 _WithListOperations.move_up(self, index)
118 _WithListOperations.move_down(self, index)
124 self.
_table_table.add(name, value, comment)
126 var_controller = self[-1]
128 return var_controller
154 name=ctrl.name, item=ctrl,
155 index=ctrl.index).publish()
160 name=ctrl.name, item=ctrl).publish()
165 vars_as_list += var.as_list()
166 return any(variablematcher.value_contains_variable(string, name)
167 for string
in vars_as_list)
171 variables_sorted = sorted(self.
_table_table.variables, key=
lambda variable: variable.name)
173 self.
_table_table.variables = variables_sorted
174 return index_difference
180 variables_temp.append(self.
_table_table.variables[i])
181 self.
_table_table.variables = variables_temp
208 self._validate(name.strip())
211 return any(utils.eq(name, item.name, ignore=[
'_'])
217 def __init__(self, table, validator, name, named_ctrl=None):
219 _NameValidation.__init__(self, table, name, named_ctrl)
234 self.
_table_table.item_type
237 self.
_table_table.item_type
240 self.
_table_table.item_type
249 raise NotImplementedError(self.__class__)
260 _item_to_controller = property
263 if not hasattr(self,
'_item_to_controller_attribute'):
275 idx = items.index(item)
279 items[upper], items[idx] = items[idx], items[upper]
286 idx = items.index(item)
287 if idx + 1 == len(items):
290 items[idx], items[lower] = items[lower], items[idx]
304 self._notify_removal(ctrl)
308 item.parent = self.
_table_table
313 self._notify_creation(new_controller.name, new_controller)
321 self._notify_creation(name, ctrl)
328 class TestCaseTableController(_MacroTable):
329 item_type =
'Test case'
339 return self.
_table_table.tests
352 tests_sorted = sorted(self.
_table_table.tests, key=
lambda testcase: testcase.name)
354 self.
_table_table.tests = tests_sorted
355 return index_difference
361 tests_temp.append(self.
_table_table.tests[i])
362 self.
_table_table.tests = tests_temp
366 item_type =
'User keyword'
376 return self.
_table_table.keywords
386 def new(self, name, argstr=''):
391 ctrl.arguments.set_value(config)
395 keywords_sorted = sorted(self.
_table_table.keywords, key=
lambda userkeyword: userkeyword.name)
397 self.
_table_table.keywords = keywords_sorted
398 return index_difference
404 keywords_temp.append(self.
_table_table.keywords[i])
405 self.
_table_table.keywords = keywords_temp
410 def __init__(self, parent_controller, table, resource_file_controller_factory=None):
411 _TableController.__init__(self, parent_controller, table)
422 _import_controllers = property
436 return self.
_table_table.imports
439 resource_file_controller_factory = property
444 @overrides(_WithListOperations)
447 imps[ind1], imps[ind2] = imps[ind2], imps[ind1]
448 _WithListOperations._swap(self, ind1, ind2)
455 _WithListOperations.delete(self, index)
457 item.publish_removed()
464 import_.alias = alias
510 return self.
_table_table.metadata
def datafile_controller(self)
def resource_import_modified(self, path)
def _add_controller(self, import_)
def __init__(self, parent_controller, table, resource_file_controller_factory=None)
def __getitem__(self, index)
def add_library(self, name, argstr, alias, comment=None)
def notify_imports_modified(self)
def add_variables(self, path, argstr, comment=None)
def remove_import_data(self, imp)
resource_file_controller_factory
def _import_controllers(self)
_resource_file_controller_factory
def add_resource(self, path, comment=None)
def _swap(self, ind1, ind2)
def _import_controller(self, import_)
def _configure_controller(self, ctrl, config)
def new(self, name, argstr='')
def restore_keyword_order(self, list)
Restores the old order of the keyword list.
def _notify_removal(self, item)
def sort(self)
Sorts the keywords of the controller by name.
def _notify_creation(self, name, ctrl)
def _validate(self, name)
def restore_test_order(self, list)
Restores the old order of the test list.
def _notify_creation(self, name, ctrl)
def _notify_removal(self, item)
def sort(self)
Sorts the tests of the controller by name.
def __init__(self, table, validator, name, named_ctrl=None)
def _validate(self, name)
def notify_variable_removed(self, ctrl)
def remove_var(self, var_controller)
def move_down(self, index)
def sort(self)
Sorts the variables of the controller by name.
def validate_dict_variable_name(self, name, item=None)
def __init__(self, parent_controller, table)
def add_variable(self, name, value, comment=None)
def validate_scalar_variable_name(self, name, item=None)
def notify_variable_added(self, ctrl)
def validate_list_variable_name(self, name, item=None)
def _validate_name(self, validator, name, item=None)
def __getitem__(self, index)
def contains_variable(self, name)
def restore_variable_order(self, list)
Restores the old order of the variable list.
_item_to_controller_attribute
def _create_controller(self, item)
def validate_name(self, name, named_ctrl=None)
def _item_to_controller(self)
def __getitem__(self, index)
def _configure_controller(self, ctrl, config)
def _create_new(self, name, config=None)
def move_down(self, item)
def _name_taken(self, name)
def __init__(self, table, name, named_ctrl=None)
def _index_difference(self, original_list, sorted_list)
Determines the difference in sorting order for undo/redo.
def __init__(self, parent_controller, table)
def _swap(self, ind1, ind2)
def move_down(self, index)
Sent when an item (test, keyword, variable) is moved down.
Sent when an item (test, keyword, variable) is moved up.
Sent when a new test case is added to a suite.
Sent when a test case is removed from a suite.
Sent when a new user keyword is added to a suite or resource.
Sent when a user keyword is removed from a suite or resource.
Sent when a new variable is added to a suite.
Sent when a variable is moved down item is the item that has been moved down other is the item that w...
Sent when a variable is moved up item is the item that has been moved up other is the item that was s...
Sent when a variable is removed from a suite.
def ImportController(parent, import_)
def is_scalar_var(string)