Merge remote-tracking branch 'origin/4.1' into CURA-6483_fix_add_by_ip

This commit is contained in:
Lipu Fei 2019-05-02 14:06:07 +02:00
commit 1e89ce3673
4 changed files with 23 additions and 4 deletions

View file

@ -35,6 +35,8 @@ class FirstStartMachineActionsModel(ListModel):
self._application = application
self._application.initializationFinished.connect(self._initialize)
self._previous_global_stack = None
def _initialize(self) -> None:
self._application.getMachineManager().globalContainerChanged.connect(self._update)
self._update()
@ -86,6 +88,12 @@ class FirstStartMachineActionsModel(ListModel):
self.setItems([])
return
# Do not update if the machine has not been switched. This can cause the SettingProviders on the Machine
# Setting page to do a force update, but they can use potential outdated cached values.
if self._previous_global_stack is not None and global_stack.getId() == self._previous_global_stack.getId():
return
self._previous_global_stack = global_stack
definition_id = global_stack.definition.getId()
first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id)

View file

@ -285,18 +285,30 @@ Item
optionModel: ListModel
{
id: extruderCountModel
Component.onCompleted:
{
extruderCountModel.clear()
update()
}
function update()
{
clear()
for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++)
{
// Use String as value. JavaScript only has Number. PropertyProvider.setPropertyValue()
// takes a QVariant as value, and Number gets translated into a float. This will cause problem
// for integer settings such as "Number of Extruders".
extruderCountModel.append({ text: String(i), value: String(i) })
append({ text: String(i), value: String(i) })
}
}
}
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged: extruderCountModel.update()
}
}
}
}

View file

@ -69,6 +69,7 @@ UM.TooltipArea
background: Rectangle
{
color: UM.Theme.getColor("main_background")
anchors.fill: parent
border.color:
{

View file

@ -76,6 +76,4 @@ NumericTextFieldWithUnit
forceUpdateOnChangeFunction()
}
}
// TODO: add forceUpdateOnChangeFunction:
}