mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 05:09:00 +08:00
Show time estimates per feature in tooltip
This commit is contained in:
parent
f15aa66751
commit
69a95e37a5
@ -52,6 +52,19 @@ class PrintInformation(QObject):
|
|||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self._current_print_time = Duration(None, self)
|
self._current_print_time = Duration(None, self)
|
||||||
|
self._print_times_per_feature = {
|
||||||
|
"none": Duration(None, self),
|
||||||
|
"inset_0": Duration(None, self),
|
||||||
|
"inset_x": Duration(None, self),
|
||||||
|
"skin": Duration(None, self),
|
||||||
|
"support": Duration(None, self),
|
||||||
|
"skirt": Duration(None, self),
|
||||||
|
"infill": Duration(None, self),
|
||||||
|
"support_infill": Duration(None, self),
|
||||||
|
"travel": Duration(None, self),
|
||||||
|
"retract": Duration(None, self),
|
||||||
|
"support_interface": Duration(None, self)
|
||||||
|
}
|
||||||
|
|
||||||
self._material_lengths = []
|
self._material_lengths = []
|
||||||
self._material_weights = []
|
self._material_weights = []
|
||||||
@ -93,6 +106,10 @@ class PrintInformation(QObject):
|
|||||||
def currentPrintTime(self):
|
def currentPrintTime(self):
|
||||||
return self._current_print_time
|
return self._current_print_time
|
||||||
|
|
||||||
|
@pyqtProperty("QVariantMap", notify = currentPrintTimeChanged)
|
||||||
|
def printTimesPerFeature(self):
|
||||||
|
return self._print_times_per_feature
|
||||||
|
|
||||||
materialLengthsChanged = pyqtSignal()
|
materialLengthsChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtProperty("QVariantList", notify = materialLengthsChanged)
|
@pyqtProperty("QVariantList", notify = materialLengthsChanged)
|
||||||
@ -115,9 +132,11 @@ class PrintInformation(QObject):
|
|||||||
total_time = 0
|
total_time = 0
|
||||||
for feature, time in time_per_feature.items():
|
for feature, time in time_per_feature.items():
|
||||||
if time != time: # Check for NaN. Engine can sometimes give us weird values.
|
if time != time: # Check for NaN. Engine can sometimes give us weird values.
|
||||||
|
self._print_times_per_feature[feature].setDuration(0)
|
||||||
Logger.log("w", "Received NaN for print duration message")
|
Logger.log("w", "Received NaN for print duration message")
|
||||||
continue
|
continue
|
||||||
total_time += time
|
total_time += time
|
||||||
|
self._print_times_per_feature[feature].setDuration(time)
|
||||||
self._current_print_time.setDuration(total_time)
|
self._current_print_time.setDuration(total_time)
|
||||||
|
|
||||||
self.currentPrintTimeChanged.emit()
|
self.currentPrintTimeChanged.emit()
|
||||||
|
@ -24,6 +24,7 @@ Item {
|
|||||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||||
|
|
||||||
property variant printDuration: PrintInformation.currentPrintTime
|
property variant printDuration: PrintInformation.currentPrintTime
|
||||||
|
property variant printDurationPerFeature: PrintInformation.printTimesPerFeature
|
||||||
property variant printMaterialLengths: PrintInformation.materialLengths
|
property variant printMaterialLengths: PrintInformation.materialLengths
|
||||||
property variant printMaterialWeights: PrintInformation.materialWeights
|
property variant printMaterialWeights: PrintInformation.materialWeights
|
||||||
property variant printMaterialCosts: PrintInformation.materialCosts
|
property variant printMaterialCosts: PrintInformation.materialCosts
|
||||||
@ -159,7 +160,7 @@ Item {
|
|||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
id: timeIcon
|
id: timeIcon
|
||||||
anchors.right: timeSpec.left
|
anchors.right: timeSpecPerFeatureTooltipArea.left
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width/2
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width/2
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: UM.Theme.getSize("save_button_specs_icons").width
|
width: UM.Theme.getSize("save_button_specs_icons").width
|
||||||
@ -169,15 +170,48 @@ Item {
|
|||||||
color: UM.Theme.getColor("text_subtext")
|
color: UM.Theme.getColor("text_subtext")
|
||||||
source: UM.Theme.getIcon("print_time")
|
source: UM.Theme.getIcon("print_time")
|
||||||
}
|
}
|
||||||
Text
|
UM.TooltipArea
|
||||||
{
|
{
|
||||||
id: timeSpec
|
id: timeSpecPerFeatureTooltipArea
|
||||||
|
text: {
|
||||||
|
var result = "";
|
||||||
|
if(base.printDurationPerFeature["inset_0"] && base.printDurationPerFeature["inset_0"].totalSeconds > 0)
|
||||||
|
result += "Outer Walls: " + base.printDurationPerFeature["inset_0"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["inset_x"] && base.printDurationPerFeature["inset_x"].totalSeconds > 0)
|
||||||
|
result += "<br/>Inner Walls: " + base.printDurationPerFeature["inset_x"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["skin"] && base.printDurationPerFeature["skin"].totalSeconds > 0)
|
||||||
|
result += "<br/>Skin: " + base.printDurationPerFeature["skin"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["infill"] && base.printDurationPerFeature["infill"].totalSeconds > 0)
|
||||||
|
result += "<br/>Infill: " + base.printDurationPerFeature["infill"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["support_infill"] && base.printDurationPerFeature["support_infill"].totalSeconds > 0)
|
||||||
|
result += "<br/>Support: " + base.printDurationPerFeature["support_infill"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["support_interface"] && base.printDurationPerFeature["support_interface"].totalSeconds > 0)
|
||||||
|
result += "<br/>Support Interface: " + base.printDurationPerFeature["support_interface"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["support"] && base.printDurationPerFeature["support"].totalSeconds > 0)
|
||||||
|
result += "<br/>Helper Structures: " + base.printDurationPerFeature["support"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["travel"] && base.printDurationPerFeature["travel"].totalSeconds > 0)
|
||||||
|
result += "<br/>Travel: " + base.printDurationPerFeature["travel"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["retract"] && base.printDurationPerFeature["retract"].totalSeconds > 0)
|
||||||
|
result += "<br/>Retractions: " + base.printDurationPerFeature["retract"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
if(base.printDurationPerFeature["none"] && base.printDurationPerFeature["none"].totalSeconds > 0)
|
||||||
|
result += "<br/>Other: " + base.printDurationPerFeature["none"].getDisplayString(UM.DurationFormat.Short)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
anchors.right: lengthIcon.left
|
anchors.right: lengthIcon.left
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font: UM.Theme.getFont("small")
|
|
||||||
color: UM.Theme.getColor("text_subtext")
|
Text
|
||||||
text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
|
{
|
||||||
|
id: timeSpec
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
font: UM.Theme.getFont("small")
|
||||||
|
color: UM.Theme.getColor("text_subtext")
|
||||||
|
text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user