From 32143ced4401d87a7326ef7a0ce24fe1229d9fdc Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Apr 2016 13:15:26 +0200 Subject: [PATCH] Fixed firstStart actions CURA-1385 --- cura/MachineActionManager.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cura/MachineActionManager.py b/cura/MachineActionManager.py index d7a0478f37..be94d1696c 100644 --- a/cura/MachineActionManager.py +++ b/cura/MachineActionManager.py @@ -51,8 +51,11 @@ class MachineActionManager: ## Add an action to the first start list of a machine. def addFirstStartAction(self, machine, action_key, index = None): if action_key in self._machine_actions: - if machine in self._supported_actions and index is not None: - self._first_start_actions[machine].insert(index, self._machine_actions[action_key]) + if machine in self._first_start_actions: + if index is not None: + self._first_start_actions[machine].insert(index, self._machine_actions[action_key]) + else: + self._first_start_actions[machine].append(self._machine_actions[action_key]) else: self._first_start_actions[machine] = [self._machine_actions[action_key]] else: @@ -84,6 +87,17 @@ class MachineActionManager: else: return set() + ## Get all actions that need to be perfomed upon first start of a given machine. + # Note that contrary to required / supported actions a list is returned (as it could be required to run the same + # action multiple times). + # \param machine The machine you want the first start actions of + # \returns List of actions. + def getFirstStartActions(self, machine): + if machine in self._first_start_actions: + return self._first_start_actions[machine] + else: + return [] + ## Remove Machine action from manager # \param action to remove def removeMachineAction(self, action):