mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 05:55:53 +08:00
Merge branch 'feature_additional_components' of github.com:Ultimaker/Cura
This commit is contained in:
commit
614d4bb21a
@ -128,6 +128,8 @@ class CuraApplication(QtApplication):
|
|||||||
self._machine_action_manager = MachineActionManager.MachineActionManager()
|
self._machine_action_manager = MachineActionManager.MachineActionManager()
|
||||||
self._machine_manager = None # This is initialized on demand.
|
self._machine_manager = None # This is initialized on demand.
|
||||||
|
|
||||||
|
self._additional_components = {} # Components to add to certain areas in the interface
|
||||||
|
|
||||||
super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType)
|
super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType)
|
||||||
|
|
||||||
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
||||||
@ -877,3 +879,21 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
def getBuildVolume(self):
|
def getBuildVolume(self):
|
||||||
return self._volume
|
return self._volume
|
||||||
|
|
||||||
|
additionalComponentsChanged = pyqtSignal(str, arguments = ["areaId"])
|
||||||
|
|
||||||
|
@pyqtProperty("QVariantMap", notify = additionalComponentsChanged)
|
||||||
|
def additionalComponents(self):
|
||||||
|
return self._additional_components
|
||||||
|
|
||||||
|
## Add a component to a list of components to be reparented to another area in the GUI.
|
||||||
|
# The actual reparenting is done by the area itself.
|
||||||
|
# \param area_id \type{str} Identifying name of the area to which the component should be reparented
|
||||||
|
# \param component \type{QQuickComponent} The component that should be reparented
|
||||||
|
@pyqtSlot(str, "QVariant")
|
||||||
|
def addAdditionalComponent(self, area_id, component):
|
||||||
|
if area_id not in self._additional_components:
|
||||||
|
self._additional_components[area_id] = []
|
||||||
|
self._additional_components[area_id].append(component)
|
||||||
|
|
||||||
|
self.additionalComponentsChanged.emit(area_id)
|
@ -84,6 +84,27 @@ Rectangle {
|
|||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: additionalComponentsRow
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: saveToButton.visible ? saveToButton.left : parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Printer
|
||||||
|
onAdditionalComponentsChanged:
|
||||||
|
{
|
||||||
|
if(areaId == "saveButton") {
|
||||||
|
for (var component in Printer.additionalComponents["saveButton"]) {
|
||||||
|
Printer.additionalComponents["saveButton"][component].parent = additionalComponentsRow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: saveToButton
|
id: saveToButton
|
||||||
|
|
||||||
@ -102,8 +123,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
style: ButtonStyle {
|
style: ButtonStyle {
|
||||||
background:
|
background: Rectangle
|
||||||
Rectangle
|
|
||||||
{
|
{
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") :
|
border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user