mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06: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
2 changed files with 23 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue