mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-28 13:21:10 -07:00
Merge branch 'master' into qtquick-controls-2.0
This commit is contained in:
commit
27ca743e58
327 changed files with 57764 additions and 17968 deletions
|
|
@ -21,9 +21,8 @@ Rectangle
|
|||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||
property int backendState: UM.Backend.state
|
||||
|
||||
property bool monitoringPrint: false
|
||||
property bool monitoringPrint: UM.Controller.activeStage.stageId == "MonitorStage"
|
||||
|
||||
property variant printDuration: PrintInformation.currentPrintTime
|
||||
property variant printMaterialLengths: PrintInformation.materialLengths
|
||||
|
|
@ -86,10 +85,19 @@ Rectangle
|
|||
}
|
||||
}
|
||||
|
||||
MachineSelection {
|
||||
id: machineSelection
|
||||
width: base.width
|
||||
height: UM.Theme.getSize("sidebar_header").height
|
||||
anchors.top: base.top
|
||||
anchors.right: parent.right
|
||||
}
|
||||
|
||||
SidebarHeader {
|
||||
id: header
|
||||
width: parent.width
|
||||
visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants
|
||||
anchors.top: machineSelection.bottom
|
||||
|
||||
onShowTooltip: base.showTooltip(item, location, text)
|
||||
onHideTooltip: base.hideTooltip()
|
||||
|
|
@ -225,7 +233,7 @@ Rectangle
|
|||
{
|
||||
id: controlItem
|
||||
anchors.bottom: footerSeparator.top
|
||||
anchors.top: headerSeparator.bottom
|
||||
anchors.top: monitoringPrint ? machineSelection.bottom : headerSeparator.bottom
|
||||
anchors.left: base.left
|
||||
anchors.right: base.right
|
||||
sourceComponent:
|
||||
|
|
@ -244,7 +252,7 @@ Rectangle
|
|||
Loader
|
||||
{
|
||||
anchors.bottom: footerSeparator.top
|
||||
anchors.top: headerSeparator.bottom
|
||||
anchors.top: monitoringPrint ? machineSelection.bottom : headerSeparator.bottom
|
||||
anchors.left: base.left
|
||||
anchors.right: base.right
|
||||
source:
|
||||
|
|
@ -305,7 +313,6 @@ Rectangle
|
|||
|
||||
onEntered:
|
||||
{
|
||||
|
||||
if(base.printDuration.valid && !base.printDuration.isTotalDurationZero)
|
||||
{
|
||||
// All the time information for the different features is achieved
|
||||
|
|
@ -313,31 +320,20 @@ Rectangle
|
|||
var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds))
|
||||
|
||||
// A message is created and displayed when the user hover the time label
|
||||
var content = catalog.i18nc("@tooltip", "<b>Time specification</b><br/><table>");
|
||||
var tooltip_html = "<b>%1</b><br/><table width=\"100%\">".arg(catalog.i18nc("@tooltip", "Time specification"));
|
||||
for(var feature in print_time)
|
||||
{
|
||||
if(!print_time[feature].isTotalDurationZero)
|
||||
{
|
||||
var feature_name = "";
|
||||
|
||||
if (feature.length <= 11)
|
||||
{
|
||||
feature_name = feature
|
||||
}
|
||||
else{
|
||||
feature_name = feature.substring(0, 8) + "..."
|
||||
}
|
||||
|
||||
|
||||
content += "<tr><td>" + feature_name + ":" +
|
||||
" </td><td>" + print_time[feature].getDisplayString(UM.DurationFormat.Short) +
|
||||
" </td><td>" + Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds) + "%" +
|
||||
tooltip_html += "<tr><td>" + feature + ":</td>" +
|
||||
"<td align=\"right\" valign=\"bottom\"> %1</td>".arg(print_time[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) +
|
||||
"<td align=\"right\" valign=\"bottom\"> %1%</td>".arg(Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds)) +
|
||||
"</td></tr>";
|
||||
}
|
||||
}
|
||||
content += "</table>";
|
||||
tooltip_html += "</table>";
|
||||
|
||||
base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content);
|
||||
base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), tooltip_html);
|
||||
}
|
||||
}
|
||||
onExited:
|
||||
|
|
@ -349,9 +345,26 @@ Rectangle
|
|||
|
||||
Label
|
||||
{
|
||||
function formatRow(items)
|
||||
{
|
||||
var row_html = "<tr>";
|
||||
for(var item = 0; item < items.length; item++)
|
||||
{
|
||||
if (item == 0)
|
||||
{
|
||||
row_html += "<td valign=\"bottom\">%1</td>".arg(items[item]);
|
||||
}
|
||||
else
|
||||
{
|
||||
row_html += "<td align=\"right\" valign=\"bottom\"> %1</td>".arg(items[item]);
|
||||
}
|
||||
}
|
||||
row_html += "</tr>";
|
||||
return row_html;
|
||||
}
|
||||
|
||||
function getSpecsData(){
|
||||
|
||||
function getSpecsData()
|
||||
{
|
||||
var lengths = [];
|
||||
var total_length = 0;
|
||||
var weights = [];
|
||||
|
|
@ -360,7 +373,8 @@ Rectangle
|
|||
var total_cost = 0;
|
||||
var some_costs_known = false;
|
||||
var names = [];
|
||||
if(base.printMaterialLengths) {
|
||||
if(base.printMaterialLengths)
|
||||
{
|
||||
for(var index = 0; index < base.printMaterialLengths.length; index++)
|
||||
{
|
||||
if(base.printMaterialLengths[index] > 0)
|
||||
|
|
@ -388,34 +402,28 @@ Rectangle
|
|||
costs = ["0.00"];
|
||||
}
|
||||
|
||||
var tooltip_html = "<b>%1</b><br/><table>".arg(catalog.i18nc("@label", "Cost specification"));
|
||||
var tooltip_html = "<b>%1</b><br/><table width=\"100%\">".arg(catalog.i18nc("@label", "Cost specification"));
|
||||
for(var index = 0; index < lengths.length; index++)
|
||||
{
|
||||
var item_strings = [
|
||||
tooltip_html += formatRow([
|
||||
"%1:".arg(names[index]),
|
||||
catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]),
|
||||
catalog.i18nc("@label g for grams", "%1g").arg(weights[index]),
|
||||
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]),
|
||||
];
|
||||
tooltip_html += "<tr>";
|
||||
for(var item = 0; item < item_strings.length; item++) {
|
||||
tooltip_html += "<td>%1 </td>".arg(item_strings[item]);
|
||||
}
|
||||
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]),
|
||||
]);
|
||||
}
|
||||
var item_strings = [
|
||||
catalog.i18nc("@label", "Total:"),
|
||||
catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)),
|
||||
catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)),
|
||||
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)),
|
||||
];
|
||||
tooltip_html += "<tr>";
|
||||
for(var item = 0; item < item_strings.length; item++) {
|
||||
tooltip_html += "<td>%1 </td>".arg(item_strings[item]);
|
||||
if(lengths.length > 1)
|
||||
{
|
||||
tooltip_html += formatRow([
|
||||
catalog.i18nc("@label", "Total:"),
|
||||
catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)),
|
||||
catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)),
|
||||
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)),
|
||||
]);
|
||||
}
|
||||
tooltip_html += "</tr></table>";
|
||||
tooltip_html += "</table>";
|
||||
tooltipText = tooltip_html;
|
||||
|
||||
|
||||
return tooltipText
|
||||
}
|
||||
|
||||
|
|
@ -511,7 +519,6 @@ Rectangle
|
|||
visible: monitoringPrint
|
||||
}
|
||||
|
||||
|
||||
SidebarTooltip
|
||||
{
|
||||
id: tooltip;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue