mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-14 20:33:14 +08:00
Fixed firstStart actions
CURA-1385
This commit is contained in:
parent
9896cc1817
commit
32143ced44
@ -51,8 +51,11 @@ class MachineActionManager:
|
|||||||
## 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, machine, action_key, index = None):
|
def addFirstStartAction(self, machine, action_key, index = None):
|
||||||
if action_key in self._machine_actions:
|
if action_key in self._machine_actions:
|
||||||
if machine in self._supported_actions and index is not None:
|
if machine in self._first_start_actions:
|
||||||
self._first_start_actions[machine].insert(index, self._machine_actions[action_key])
|
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:
|
else:
|
||||||
self._first_start_actions[machine] = [self._machine_actions[action_key]]
|
self._first_start_actions[machine] = [self._machine_actions[action_key]]
|
||||||
else:
|
else:
|
||||||
@ -84,6 +87,17 @@ class MachineActionManager:
|
|||||||
else:
|
else:
|
||||||
return set()
|
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
|
## Remove Machine action from manager
|
||||||
# \param action to remove
|
# \param action to remove
|
||||||
def removeMachineAction(self, action):
|
def removeMachineAction(self, action):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user