mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 18:27:51 -06:00
Use .definition to access DefinitionContainer in qml
CURA-3810
This commit is contained in:
parent
7be05229d8
commit
8af1cc886f
3 changed files with 4 additions and 10 deletions
|
@ -5,7 +5,7 @@ import os.path
|
||||||
|
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject
|
||||||
from UM.FlameProfiler import pyqtSlot
|
from UM.FlameProfiler import pyqtSlot
|
||||||
|
|
||||||
from UM.Decorators import override
|
from UM.Decorators import override
|
||||||
|
@ -250,7 +250,7 @@ class CuraContainerStack(ContainerStack):
|
||||||
## Get the definition container.
|
## Get the definition container.
|
||||||
#
|
#
|
||||||
# \return The definition container. Should always be a valid container, but can be equal to the empty InstanceContainer.
|
# \return The definition container. Should always be a valid container, but can be equal to the empty InstanceContainer.
|
||||||
@pyqtProperty(DefinitionContainer, fset = setDefinition, notify = pyqtContainersChanged)
|
@pyqtProperty(QObject, fset = setDefinition, notify = pyqtContainersChanged)
|
||||||
def definition(self) -> DefinitionContainer:
|
def definition(self) -> DefinitionContainer:
|
||||||
return self._containers[_ContainerIndexes.Definition]
|
return self._containers[_ContainerIndexes.Definition]
|
||||||
|
|
||||||
|
|
|
@ -470,16 +470,10 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@pyqtProperty("QObject", notify = globalContainerChanged)
|
@pyqtProperty(QObject, notify = globalContainerChanged)
|
||||||
def activeMachine(self) -> "GlobalStack":
|
def activeMachine(self) -> "GlobalStack":
|
||||||
return self._global_container_stack
|
return self._global_container_stack
|
||||||
|
|
||||||
@pyqtProperty(str, notify = globalContainerChanged)
|
|
||||||
def activeMachineDefinitionId(self) -> str:
|
|
||||||
if self._global_container_stack and self._global_container_stack.definition:
|
|
||||||
return self._global_container_stack.definition.getId()
|
|
||||||
return ""
|
|
||||||
|
|
||||||
@pyqtProperty(str, notify = activeStackChanged)
|
@pyqtProperty(str, notify = activeStackChanged)
|
||||||
def activeStackId(self) -> str:
|
def activeStackId(self) -> str:
|
||||||
if self._active_container_stack:
|
if self._active_container_stack:
|
||||||
|
|
|
@ -221,7 +221,7 @@ Column
|
||||||
{
|
{
|
||||||
// open the material URL with web browser
|
// open the material URL with web browser
|
||||||
var version = UM.Application.version;
|
var version = UM.Application.version;
|
||||||
var machineName = Cura.MachineManager.activeMachineDefinitionId;
|
var machineName = Cura.MachineManager.activeMachine.definition.id;
|
||||||
|
|
||||||
var url = "https://ultimaker.com/materialcompatibility/" + version + "/" + machineName;
|
var url = "https://ultimaker.com/materialcompatibility/" + version + "/" + machineName;
|
||||||
Qt.openUrlExternally(url);
|
Qt.openUrlExternally(url);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue