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 = application
self._application.initializationFinished.connect(self._initialize) self._application.initializationFinished.connect(self._initialize)
self._previous_global_stack = None
def _initialize(self) -> None: def _initialize(self) -> None:
self._application.getMachineManager().globalContainerChanged.connect(self._update) self._application.getMachineManager().globalContainerChanged.connect(self._update)
self._update() self._update()
@ -86,6 +88,12 @@ class FirstStartMachineActionsModel(ListModel):
self.setItems([]) self.setItems([])
return 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() definition_id = global_stack.definition.getId()
first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id)

View File

@ -285,18 +285,30 @@ Item
optionModel: ListModel optionModel: ListModel
{ {
id: extruderCountModel id: extruderCountModel
Component.onCompleted: Component.onCompleted:
{ {
extruderCountModel.clear() update()
}
function update()
{
clear()
for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++) for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++)
{ {
// Use String as value. JavaScript only has Number. PropertyProvider.setPropertyValue() // 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 // takes a QVariant as value, and Number gets translated into a float. This will cause problem
// for integer settings such as "Number of Extruders". // 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 background: Rectangle
{ {
color: UM.Theme.getColor("main_background") color: UM.Theme.getColor("main_background")
anchors.fill: parent
border.color: border.color:
{ {

View File

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