mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 06:55:54 +08:00
Select the UM3 that we are connected to if it is in the list
CURA-2035
This commit is contained in:
parent
7e8eb2044a
commit
7011520845
@ -55,3 +55,13 @@ class DiscoverUM3Action(MachineAction):
|
||||
if self._network_plugin:
|
||||
# Ensure that the connection states are refreshed.
|
||||
self._network_plugin.reCheckConnections()
|
||||
|
||||
@pyqtSlot(result = str)
|
||||
def getStoredKey(self):
|
||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||
if global_container_stack:
|
||||
meta_data = global_container_stack.getMetaData()
|
||||
if "um_network_key" in meta_data:
|
||||
return global_container_stack.getMetaDataEntry("um_network_key")
|
||||
|
||||
return ""
|
@ -97,6 +97,18 @@ Cura.MachineAction
|
||||
{
|
||||
id: listview
|
||||
model: manager.foundDevices
|
||||
onModelChanged:
|
||||
{
|
||||
var selectedKey = manager.getStoredKey();
|
||||
for(var i = 0; i < model.length; i++) {
|
||||
if(model[i].getKey() == selectedKey)
|
||||
{
|
||||
currentIndex = i;
|
||||
return
|
||||
}
|
||||
}
|
||||
currentIndex = -1;
|
||||
}
|
||||
width: parent.width
|
||||
currentIndex: -1
|
||||
onCurrentIndexChanged: base.selectedPrinter = listview.model[currentIndex]
|
||||
@ -134,6 +146,7 @@ Cura.MachineAction
|
||||
{
|
||||
width: parent.width * 0.5
|
||||
visible: base.selectedPrinter
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
Label
|
||||
{
|
||||
width: parent.width
|
||||
|
Loading…
x
Reference in New Issue
Block a user