mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Merge branch '4.1'
This commit is contained in:
commit
6708d9da64
11 changed files with 37 additions and 27 deletions
|
@ -20,7 +20,7 @@ class LayerPolygon:
|
|||
MoveCombingType = 8
|
||||
MoveRetractionType = 9
|
||||
SupportInterfaceType = 10
|
||||
PrimeTower = 11
|
||||
PrimeTowerType = 11
|
||||
__number_of_types = 12
|
||||
|
||||
__jump_map = numpy.logical_or(numpy.logical_or(numpy.arange(__number_of_types) == NoneType, numpy.arange(__number_of_types) == MoveCombingType), numpy.arange(__number_of_types) == MoveRetractionType)
|
||||
|
@ -245,7 +245,7 @@ class LayerPolygon:
|
|||
theme.getColor("layerview_move_combing").getRgbF(), # MoveCombingType
|
||||
theme.getColor("layerview_move_retraction").getRgbF(), # MoveRetractionType
|
||||
theme.getColor("layerview_support_interface").getRgbF(), # SupportInterfaceType
|
||||
theme.getColor("layerview_prime_tower").getRgbF()
|
||||
theme.getColor("layerview_prime_tower").getRgbF() # PrimeTowerType
|
||||
])
|
||||
|
||||
return cls.__color_map
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
|
||||
from PyQt5.QtCore import QObject, QUrl, pyqtSlot, pyqtProperty, pyqtSignal
|
||||
|
||||
from UM.Logger import Logger
|
||||
from UM.PluginObject import PluginObject
|
||||
|
@ -72,18 +73,26 @@ class MachineAction(QObject, PluginObject):
|
|||
return self._finished
|
||||
|
||||
## Protected helper to create a view object based on provided QML.
|
||||
def _createViewFromQML(self) -> None:
|
||||
def _createViewFromQML(self) -> Optional["QObject"]:
|
||||
plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId())
|
||||
if plugin_path is None:
|
||||
Logger.log("e", "Cannot create QML view: cannot find plugin path for plugin [%s]", self.getPluginId())
|
||||
return
|
||||
return None
|
||||
path = os.path.join(plugin_path, self._qml_url)
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
self._view = CuraApplication.getInstance().createQmlComponent(path, {"manager": self})
|
||||
view = CuraApplication.getInstance().createQmlComponent(path, {"manager": self})
|
||||
return view
|
||||
|
||||
@pyqtProperty(QObject, constant = True)
|
||||
def displayItem(self):
|
||||
if not self._view:
|
||||
self._createViewFromQML()
|
||||
return self._view
|
||||
@pyqtProperty(QUrl, constant = True)
|
||||
def qmlPath(self) -> "QUrl":
|
||||
plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId())
|
||||
if plugin_path is None:
|
||||
Logger.log("e", "Cannot create QML view: cannot find plugin path for plugin [%s]", self.getPluginId())
|
||||
return QUrl("")
|
||||
path = os.path.join(plugin_path, self._qml_url)
|
||||
return QUrl.fromLocalFile(path)
|
||||
|
||||
@pyqtSlot(result = QObject)
|
||||
def getDisplayItem(self) -> Optional["QObject"]:
|
||||
return self._createViewFromQML()
|
||||
|
|
|
@ -100,7 +100,7 @@ class FirstStartMachineActionsModel(ListModel):
|
|||
item_list = []
|
||||
for item in first_start_actions:
|
||||
item_list.append({"title": item.label,
|
||||
"content": item.displayItem,
|
||||
"content": item.getDisplayItem(),
|
||||
"action": item,
|
||||
})
|
||||
item.reset()
|
||||
|
|
|
@ -81,6 +81,7 @@ class PrintInformation(QObject):
|
|||
"support_interface": catalog.i18nc("@tooltip", "Support Interface"),
|
||||
"support": catalog.i18nc("@tooltip", "Support"),
|
||||
"skirt": catalog.i18nc("@tooltip", "Skirt"),
|
||||
"prime_tower": catalog.i18nc("@tooltip", "Prime Tower"),
|
||||
"travel": catalog.i18nc("@tooltip", "Travel"),
|
||||
"retract": catalog.i18nc("@tooltip", "Retractions"),
|
||||
"none": catalog.i18nc("@tooltip", "Other")
|
||||
|
|
|
@ -735,6 +735,7 @@ class CuraEngineBackend(QObject, Backend):
|
|||
"support_interface": message.time_support_interface,
|
||||
"support": message.time_support,
|
||||
"skirt": message.time_skirt,
|
||||
"prime_tower": message.time_prime_tower,
|
||||
"travel": message.time_travel,
|
||||
"retract": message.time_retract,
|
||||
"none": message.time_none
|
||||
|
|
|
@ -371,7 +371,7 @@ class FlavorParser:
|
|||
elif type == "SUPPORT-INTERFACE":
|
||||
self._layer_type = LayerPolygon.SupportInterfaceType
|
||||
elif type == "PRIME-TOWER":
|
||||
self._layer_type = LayerPolygon.SkirtType
|
||||
self._layer_type = LayerPolygon.PrimeTowerType
|
||||
else:
|
||||
Logger.log("w", "Encountered a unknown type (%s) while parsing g-code.", type)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Item
|
|||
|
||||
property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0
|
||||
property int columnSpacing: 3 * screenScaleFactor
|
||||
property int propertyStoreIndex: manager.storeContainerIndex // definition_changes
|
||||
property int propertyStoreIndex: manager ? manager.storeContainerIndex : 1 // definition_changes
|
||||
|
||||
property string extruderStackId: ""
|
||||
property int extruderPosition: 0
|
||||
|
|
|
@ -26,7 +26,7 @@ Item
|
|||
|
||||
property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0
|
||||
property int columnSpacing: 3 * screenScaleFactor
|
||||
property int propertyStoreIndex: manager.storeContainerIndex // definition_changes
|
||||
property int propertyStoreIndex: manager ? manager.storeContainerIndex : 1 // definition_changes
|
||||
|
||||
property string machineStackId: Cura.MachineManager.activeMachineId
|
||||
|
||||
|
|
|
@ -109,6 +109,8 @@ Item
|
|||
top: description.bottom
|
||||
left: properties.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
spacing: Math.floor(UM.Theme.getSize("narrow_margin").height)
|
||||
|
@ -123,6 +125,8 @@ Item
|
|||
}
|
||||
return ""
|
||||
}
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
linkColor: UM.Theme.getColor("text_link")
|
||||
|
|
|
@ -104,10 +104,11 @@ UM.ManagementPage
|
|||
text: machineActionRepeater.model[index].label
|
||||
onClicked:
|
||||
{
|
||||
actionDialog.content = machineActionRepeater.model[index].displayItem;
|
||||
machineActionRepeater.model[index].displayItem.reset();
|
||||
actionDialog.title = machineActionRepeater.model[index].label;
|
||||
actionDialog.show();
|
||||
var currentItem = machineActionRepeater.model[index]
|
||||
actionDialog.loader.manager = currentItem
|
||||
actionDialog.loader.source = currentItem.qmlPath
|
||||
actionDialog.title = currentItem.label
|
||||
actionDialog.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,13 +118,7 @@ UM.ManagementPage
|
|||
UM.Dialog
|
||||
{
|
||||
id: actionDialog
|
||||
property var content
|
||||
onContentChanged:
|
||||
{
|
||||
contents = content;
|
||||
content.onCompleted.connect(hide)
|
||||
content.dialog = actionDialog
|
||||
}
|
||||
|
||||
rightButtons: Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Close")
|
||||
|
|
|
@ -591,7 +591,7 @@
|
|||
"toolbox_thumbnail_large": [12.0, 10.0],
|
||||
"toolbox_footer": [1.0, 4.5],
|
||||
"toolbox_footer_button": [8.0, 2.5],
|
||||
"toolbox_header_tab": [8.0, 4.0],
|
||||
"toolbox_header_tab": [12.0, 4.0],
|
||||
"toolbox_detail_header": [1.0, 14.0],
|
||||
"toolbox_back_column": [6.0, 1.0],
|
||||
"toolbox_back_button": [6.0, 2.0],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue