mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 01:15:51 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
180e9b6612
@ -7,6 +7,8 @@ from enum import IntEnum
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
from UM.Logger import Logger
|
||||||
|
|
||||||
MYPY = False
|
MYPY = False
|
||||||
if MYPY:
|
if MYPY:
|
||||||
from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
|
from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
|
||||||
@ -38,8 +40,10 @@ class FirmwareUpdater(QObject):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self._setFirmwareUpdateState(FirmwareUpdateState.updating)
|
self._setFirmwareUpdateState(FirmwareUpdateState.updating)
|
||||||
|
try:
|
||||||
self._update_firmware_thread.start()
|
self._update_firmware_thread.start()
|
||||||
|
except RuntimeError:
|
||||||
|
Logger.warning("Could not start the update thread, since it's still running!")
|
||||||
|
|
||||||
def _updateFirmware(self) -> None:
|
def _updateFirmware(self) -> None:
|
||||||
raise NotImplementedError("_updateFirmware needs to be implemented")
|
raise NotImplementedError("_updateFirmware needs to be implemented")
|
||||||
|
@ -41,6 +41,7 @@ Cura.ExpandablePopup
|
|||||||
RowLayout
|
RowLayout
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
visible: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.hasMaterials : false
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
model: extrudersModel
|
model: extrudersModel
|
||||||
|
@ -5,7 +5,7 @@ import QtQuick 2.10
|
|||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
import UM 1.3 as UM
|
import UM 1.3 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.1 as Cura
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -29,8 +29,6 @@ Item
|
|||||||
"Custom": -1
|
"Custom": -1
|
||||||
}
|
}
|
||||||
|
|
||||||
property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll.
|
|
||||||
|
|
||||||
// User-editable printer name
|
// User-editable printer name
|
||||||
property alias printerName: printerNameTextField.text
|
property alias printerName: printerNameTextField.text
|
||||||
property alias isPrinterNameValid: printerNameTextField.acceptableInput
|
property alias isPrinterNameValid: printerNameTextField.acceptableInput
|
||||||
@ -54,12 +52,27 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMachineName()
|
||||||
|
{
|
||||||
|
return machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).name : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMachineMetaDataEntry(key)
|
||||||
|
{
|
||||||
|
var metadata = machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).metadata : undefined;
|
||||||
|
if (metadata)
|
||||||
|
{
|
||||||
|
return metadata[key];
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
updateCurrentItemUponSectionChange()
|
updateCurrentItemUponSectionChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
Item
|
Row
|
||||||
{
|
{
|
||||||
id: localPrinterSelectionItem
|
id: localPrinterSelectionItem
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@ -68,19 +81,12 @@ Item
|
|||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
|
||||||
// ScrollView + ListView for selecting a local printer to add
|
// ScrollView + ListView for selecting a local printer to add
|
||||||
ScrollView
|
Cura.ScrollView
|
||||||
{
|
{
|
||||||
id: scrollView
|
id: scrollView
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
|
|
||||||
height: (maxItemCountAtOnce * UM.Theme.getSize("action_button").height) - UM.Theme.getSize("default_margin").height
|
height: childrenHeight
|
||||||
|
width: Math.floor(parent.width * 0.4)
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
|
||||||
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
ListView
|
ListView
|
||||||
{
|
{
|
||||||
@ -183,45 +189,83 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Horizontal line
|
// Vertical line
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: horizontalLine
|
id: verticalLine
|
||||||
anchors.top: localPrinterSelectionItem.bottom
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
height: childrenHeight - UM.Theme.getSize("default_lining").height
|
||||||
anchors.right: parent.right
|
width: UM.Theme.getSize("default_lining").height
|
||||||
height: UM.Theme.getSize("default_lining").height
|
|
||||||
color: UM.Theme.getColor("lining")
|
color: UM.Theme.getColor("lining")
|
||||||
}
|
}
|
||||||
|
|
||||||
// User-editable printer name row
|
// User-editable printer name row
|
||||||
Row
|
Column
|
||||||
{
|
{
|
||||||
anchors.top: horizontalLine.bottom
|
width: Math.floor(parent.width * 0.6)
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.topMargin: UM.Theme.getSize("default_lining").height
|
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
|
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
|
padding: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: base.getMachineName()
|
||||||
|
color: UM.Theme.getColor("primary_button")
|
||||||
|
font: UM.Theme.getFont("huge")
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
Grid
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
columns: 2
|
||||||
|
rowSpacing: UM.Theme.getSize("default_lining").height
|
||||||
|
columnSpacing: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
verticalItemAlignment: Grid.AlignVCenter
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@label", "Manufacturer")
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: base.getMachineMetaDataEntry("manufacturer")
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@label", "Profile author")
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: base.getMachineMetaDataEntry("author")
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Printer name")
|
text: catalog.i18nc("@label", "Printer name")
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
font: UM.Theme.getFont("default")
|
||||||
font: UM.Theme.getFont("medium")
|
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.TextField
|
Cura.TextField
|
||||||
{
|
{
|
||||||
id: printerNameTextField
|
id: printerNameTextField
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: (parent.width / 2) | 0
|
|
||||||
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
||||||
maximumLength: 40
|
maximumLength: 40
|
||||||
validator: RegExpValidator
|
validator: RegExpValidator
|
||||||
@ -230,5 +274,9 @@ Item
|
|||||||
}
|
}
|
||||||
property var machineNameValidator: Cura.MachineNameValidator { }
|
property var machineNameValidator: Cura.MachineNameValidator { }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,12 @@ Item
|
|||||||
AddLocalPrinterScrollView
|
AddLocalPrinterScrollView
|
||||||
{
|
{
|
||||||
id: localPrinterView
|
id: localPrinterView
|
||||||
|
property int childrenHeight: backButton.y - addLocalPrinterDropDown.y - UM.Theme.getSize("expandable_component_content_header").height - UM.Theme.getSize("default_margin").height
|
||||||
|
|
||||||
|
onChildrenHeightChanged:
|
||||||
|
{
|
||||||
|
addLocalPrinterDropDown.children[1].height = childrenHeight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
46
resources/qml/Widgets/ScrollView.qml
Normal file
46
resources/qml/Widgets/ScrollView.qml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (c) 2020 Ultimaker B.V.
|
||||||
|
// Toolbox is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.10
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
|
import UM 1.1 as UM
|
||||||
|
|
||||||
|
ScrollView
|
||||||
|
{
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
// Setting this property to false hides the scrollbar both when the scrollbar is not needed (child height < height)
|
||||||
|
// and when the scrollbar is not actively being hovered or pressed
|
||||||
|
property bool scrollAlwaysVisible: true
|
||||||
|
|
||||||
|
ScrollBar.vertical: ScrollBar
|
||||||
|
{
|
||||||
|
hoverEnabled: true
|
||||||
|
policy: parent.scrollAlwaysVisible ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
contentItem: Rectangle
|
||||||
|
{
|
||||||
|
implicitWidth: UM.Theme.getSize("scrollbar").width
|
||||||
|
opacity: (parent.active || parent.parent.scrollAlwaysVisible) ? 1.0 : 0.0
|
||||||
|
radius: Math.round(width / 2)
|
||||||
|
color:
|
||||||
|
{
|
||||||
|
if (parent.pressed)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("scrollbar_handle_down")
|
||||||
|
}
|
||||||
|
else if (parent.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("scrollbar_handle_hover")
|
||||||
|
}
|
||||||
|
return UM.Theme.getColor("scrollbar_handle")
|
||||||
|
}
|
||||||
|
Behavior on color { ColorAnimation { duration: 100; } }
|
||||||
|
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -35,6 +35,7 @@ RadioButton 1.0 RadioButton.qml
|
|||||||
Scrollable 1.0 Scrollable.qml
|
Scrollable 1.0 Scrollable.qml
|
||||||
TabButton 1.0 TabButton.qml
|
TabButton 1.0 TabButton.qml
|
||||||
TextField 1.0 TextField.qml
|
TextField 1.0 TextField.qml
|
||||||
|
ScrollView 1.0 ScrollView.qml
|
||||||
|
|
||||||
|
|
||||||
# Cura/MachineSettings
|
# Cura/MachineSettings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user