mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 14:19:37 +08:00
Remove unused argument "index" in addFirstStartAction()
CURA-5812
This commit is contained in:
parent
6dc01d4c08
commit
c67abb61a8
@ -86,12 +86,9 @@ class MachineActionManager(QObject):
|
|||||||
Logger.log("w", "Unable to add %s to %s, as the action is not recognised", action_key, definition_id)
|
Logger.log("w", "Unable to add %s to %s, as the action is not recognised", action_key, definition_id)
|
||||||
|
|
||||||
## Add an action to the first start list of a machine.
|
## Add an action to the first start list of a machine.
|
||||||
def addFirstStartAction(self, definition_id, action_key, index = None):
|
def addFirstStartAction(self, definition_id: str, action_key: str) -> None:
|
||||||
if action_key in self._machine_actions:
|
if action_key in self._machine_actions:
|
||||||
if definition_id in self._first_start_actions:
|
if definition_id in self._first_start_actions:
|
||||||
if index is not None:
|
|
||||||
self._first_start_actions[definition_id].insert(index, self._machine_actions[action_key])
|
|
||||||
else:
|
|
||||||
self._first_start_actions[definition_id].append(self._machine_actions[action_key])
|
self._first_start_actions[definition_id].append(self._machine_actions[action_key])
|
||||||
else:
|
else:
|
||||||
self._first_start_actions[definition_id] = [self._machine_actions[action_key]]
|
self._first_start_actions[definition_id] = [self._machine_actions[action_key]]
|
||||||
|
@ -65,12 +65,3 @@ def test_addMachineAction(machine_action_manager):
|
|||||||
machine_action_manager.addFirstStartAction(test_machine, "test_action")
|
machine_action_manager.addFirstStartAction(test_machine, "test_action")
|
||||||
machine_action_manager.addFirstStartAction(test_machine, "test_action")
|
machine_action_manager.addFirstStartAction(test_machine, "test_action")
|
||||||
assert machine_action_manager.getFirstStartActions(test_machine) == [test_action, test_action]
|
assert machine_action_manager.getFirstStartActions(test_machine) == [test_action, test_action]
|
||||||
|
|
||||||
# Check if inserting an action works
|
|
||||||
machine_action_manager.addFirstStartAction(test_machine, "test_action_2", index = 1)
|
|
||||||
assert machine_action_manager.getFirstStartActions(test_machine) == [test_action, test_action_2, test_action]
|
|
||||||
|
|
||||||
# Check that adding a unknown action doesn't change anything.
|
|
||||||
machine_action_manager.addFirstStartAction(test_machine, "key_that_doesnt_exist", index = 1)
|
|
||||||
assert machine_action_manager.getFirstStartActions(test_machine) == [test_action, test_action_2, test_action]
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user