Merge branch '5.0' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2022-04-28 13:26:56 +02:00
commit 8af6b46708
16 changed files with 58 additions and 52 deletions

View File

@ -119,16 +119,16 @@ class PrintJobOutputModel(QObject):
@pyqtProperty(int, notify = timeTotalChanged) @pyqtProperty(int, notify = timeTotalChanged)
def timeTotal(self) -> int: def timeTotal(self) -> int:
return self._time_total return int(self._time_total)
@pyqtProperty(int, notify = timeElapsedChanged) @pyqtProperty(int, notify = timeElapsedChanged)
def timeElapsed(self) -> int: def timeElapsed(self) -> int:
return self._time_elapsed return int(self._time_elapsed)
@pyqtProperty(int, notify = timeElapsedChanged) @pyqtProperty(int, notify = timeElapsedChanged)
def timeRemaining(self) -> int: def timeRemaining(self) -> int:
# Never get a negative time remaining # Never get a negative time remaining
return max(self.timeTotal - self.timeElapsed, 0) return int(max(self.timeTotal - self.timeElapsed, 0))
@pyqtProperty(float, notify = timeElapsedChanged) @pyqtProperty(float, notify = timeElapsedChanged)
def progress(self) -> float: def progress(self) -> float:

View File

@ -5,21 +5,23 @@ import sys
from UM.Logger import Logger from UM.Logger import Logger
try: try:
from . import ThreeMFWriter from . import ThreeMFWriter
threemf_writer_was_imported = True
except ImportError: except ImportError:
Logger.log("w", "Could not import ThreeMFWriter; libSavitar may be missing") Logger.log("w", "Could not import ThreeMFWriter; libSavitar may be missing")
from . import ThreeMFWorkspaceWriter threemf_writer_was_imported = False
from . import ThreeMFWorkspaceWriter
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from UM.Platform import Platform
i18n_catalog = i18nCatalog("cura") i18n_catalog = i18nCatalog("cura")
def getMetaData(): def getMetaData():
workspace_extension = "3mf" workspace_extension = "3mf"
metaData = {} metaData = {}
if "3MFWriter.ThreeMFWriter" in sys.modules: if threemf_writer_was_imported:
metaData["mesh_writer"] = { metaData["mesh_writer"] = {
"output": [{ "output": [{
"extension": "3mf", "extension": "3mf",
@ -39,6 +41,7 @@ def getMetaData():
return metaData return metaData
def register(app): def register(app):
if "3MFWriter.ThreeMFWriter" in sys.modules: if "3MFWriter.ThreeMFWriter" in sys.modules:
return {"mesh_writer": ThreeMFWriter.ThreeMFWriter(), return {"mesh_writer": ThreeMFWriter.ThreeMFWriter(),

View File

@ -23,7 +23,7 @@ Column
{ {
id: profileImage id: profileImage
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: "../images/backup.svg" source: Qt.resolvedUrl("../images/backup.svg")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(parent.width / 4) width: Math.round(parent.width / 4)
} }

View File

@ -37,7 +37,7 @@ Cura.RoundedRectangle
width: UM.Theme.getSize("section").height width: UM.Theme.getSize("section").height
height: width height: width
color: UM.Theme.getColor("text_link") color: UM.Theme.getColor("text_link")
source: "../images/arrow_down.svg" source: Qt.resolvedUrl("../images/arrow_down.svg")
} }
Label Label
@ -65,7 +65,7 @@ Cura.RoundedRectangle
{ {
target: projectImage target: projectImage
color: UM.Theme.getColor("text_link") color: UM.Theme.getColor("text_link")
source: "../images/arrow_down.svg" source: Qt.resolvedUrl("../images/arrow_down.svg")
} }
PropertyChanges PropertyChanges
{ {
@ -88,7 +88,7 @@ Cura.RoundedRectangle
{ {
target: projectImage target: projectImage
color: UM.Theme.getColor("text_link") color: UM.Theme.getColor("text_link")
source: "../images/arrow_down.svg" source: Qt.resolvedUrl("../images/arrow_down.svg")
} }
PropertyChanges PropertyChanges
{ {
@ -111,7 +111,7 @@ Cura.RoundedRectangle
{ {
target: projectImage target: projectImage
color: UM.Theme.getColor("action_button_disabled_text") color: UM.Theme.getColor("action_button_disabled_text")
source: "../images/update.svg" source: Qt.resolvedUrl("../images/update.svg")
} }
PropertyChanges PropertyChanges
{ {

View File

@ -99,7 +99,7 @@ Item
{ {
id: digitalFactoryImage id: digitalFactoryImage
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
source: searchBar.text === "" ? "../images/digital_factory.svg" : "../images/projects_not_found.svg" source: Qt.resolvedUrl(searchBar.text === "" ? "../images/digital_factory.svg" : "../images/projects_not_found.svg")
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
width: parent.width - 2 * UM.Theme.getSize("thick_margin").width width: parent.width - 2 * UM.Theme.getSize("thick_margin").width
} }

View File

@ -14,7 +14,7 @@ UM.SimpleButton
width: UM.Theme.getSize("save_button_specs_icons").width width: UM.Theme.getSize("save_button_specs_icons").width
height: UM.Theme.getSize("save_button_specs_icons").height height: UM.Theme.getSize("save_button_specs_icons").height
iconSource: "model_checker.svg" iconSource: Qt.resolvedUrl("model_checker.svg")
anchors.verticalCenter: parent ? parent.verticalCenter : undefined anchors.verticalCenter: parent ? parent.verticalCenter : undefined
color: UM.Theme.getColor("text_scene") color: UM.Theme.getColor("text_scene")
hoverColor: UM.Theme.getColor("text_scene_hover") hoverColor: UM.Theme.getColor("text_scene_hover")

View File

@ -475,7 +475,7 @@ UM.Dialog
} }
toolTipContentAlignment: UM.Enums.ContentAlignment.AlignLeft toolTipContentAlignment: UM.Enums.ContentAlignment.AlignLeft
onClicked: dialog.show() onClicked: dialog.show()
// iconSource: "Script.svg" iconSource: Qt.resolvedUrl("Script.svg")
fixedWidthMode: false fixedWidthMode: false
} }

View File

@ -21,7 +21,7 @@ class RemovableDrivePlugin(OutputDevicePlugin):
super().__init__() super().__init__()
self._update_thread = threading.Thread(target = self._updateThread) self._update_thread = threading.Thread(target = self._updateThread)
self._update_thread.deamon = True self._update_thread.daemon = True
self._check_updates = True self._check_updates = True

View File

@ -22,7 +22,7 @@ Item
property int size: 32 * screenScaleFactor // TODO: Theme! property int size: 32 * screenScaleFactor // TODO: Theme!
// THe extruder icon source; NOTE: This shouldn't need to be changed // THe extruder icon source; NOTE: This shouldn't need to be changed
property string iconSource: "../svg/icons/Extruder.svg" property string iconSource: Qt.resolvedUrl("../svg/icons/Extruder.svg")
height: size height: size
width: size width: size

View File

@ -45,7 +45,7 @@ Item
anchors.centerIn: printJobPreview anchors.centerIn: printJobPreview
color: UM.Theme.getColor("monitor_placeholder_image") color: UM.Theme.getColor("monitor_placeholder_image")
height: printJobPreview.height height: printJobPreview.height
source: "../svg/ultibot.svg" source: Qt.resolvedUrl("../svg/ultibot.svg")
/* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
not in order to determine if we show the placeholder (ultibot) image instead. */ not in order to determine if we show the placeholder (ultibot) image instead. */
visible: printJob && previewImage.status == Image.Error visible: printJob && previewImage.status == Image.Error

View File

@ -252,7 +252,7 @@ Item
bottom: parent.bottom bottom: parent.bottom
bottomMargin: 20 * screenScaleFactor // TODO: Theme! bottomMargin: 20 * screenScaleFactor // TODO: Theme!
} }
iconSource: "../svg/icons/CameraPhoto.svg" iconSource: Qt.resolvedUrl("../svg/icons/CameraPhoto.svg")
enabled: !cloudConnection enabled: !cloudConnection
visible: printer visible: printer
} }

View File

@ -101,7 +101,8 @@ Item
{ {
id: backgroundLine id: backgroundLine
height: UM.Theme.getSize("print_setup_slider_groove").height height: UM.Theme.getSize("print_setup_slider_groove").height
width: infillSlider.width - UM.Theme.getSize("print_setup_slider_handle").width width: parent.width - UM.Theme.getSize("print_setup_slider_handle").width
implicitWidth: width
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
@ -120,8 +121,10 @@ Item
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
// Do not use Math.round otherwise the tickmarks won't be aligned // Do not use Math.round otherwise the tickmarks won't be aligned
x: ((handleButton.width / 2) - (backgroundLine.implicitWidth / 2) + (index * ((repeater.width - handleButton.width) / (repeater.count-1)))) // (space between steps) * index of step
radius: Math.round(backgroundLine.implicitWidth / 2) x: (backgroundLine.width / (repeater.count - 1)) * index
radius: Math.round(implicitWidth / 2)
visible: (index % 10) == 0 // Only show steps of 10% visible: (index % 10) == 0 // Only show steps of 10%
UM.Label UM.Label

View File

@ -11,7 +11,7 @@ UM.PointingRectangle
id: base id: base
property real sourceWidth: 0 property real sourceWidth: 0
width: UM.Theme.getSize("tooltip").width width: UM.Theme.getSize("tooltip").width
height: UM.Theme.getSize("tooltip").height height: textScroll.height + UM.Theme.getSize("tooltip_margins").height * 2
color: UM.Theme.getColor("tooltip") color: UM.Theme.getColor("tooltip")
arrowSize: UM.Theme.getSize("default_arrow").width arrowSize: UM.Theme.getSize("default_arrow").width
@ -20,7 +20,7 @@ UM.PointingRectangle
Behavior on opacity Behavior on opacity
{ {
NumberAnimation { duration: 100; } NumberAnimation { duration: 200; }
} }
property alias text: label.text property alias text: label.text
@ -59,16 +59,19 @@ UM.PointingRectangle
base.opacity = 0; base.opacity = 0;
} }
MouseArea ScrollView
{ {
enabled: parent.opacity > 0 id: textScroll
visible: enabled width: parent.width
anchors.fill: parent height: Math.min(label.height + UM.Theme.getSize("tooltip_margins").height, base.parent.height)
acceptedButtons: Qt.NoButton
hoverEnabled: true ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AsNeeded
hoverEnabled: parent.opacity > 0
onHoveredChanged: onHoveredChanged:
{ {
if(containsMouse && base.opacity > 0) if(hovered && base.opacity > 0)
{ {
base.show(Qt.point(target.x - 1, target.y - UM.Theme.getSize("tooltip_arrow_margins").height / 2)); //Same arrow position as before. base.show(Qt.point(target.x - 1, target.y - UM.Theme.getSize("tooltip_arrow_margins").height / 2)); //Same arrow position as before.
} }
@ -78,26 +81,16 @@ UM.PointingRectangle
} }
} }
ScrollView
{
id: textScroll
width: base.width
height: base.height
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AsNeeded
UM.Label UM.Label
{ {
id: label id: label
x: UM.Theme.getSize("tooltip_margins").width x: UM.Theme.getSize("tooltip_margins").width
y: UM.Theme.getSize("tooltip_margins").height y: UM.Theme.getSize("tooltip_margins").height
width: base.width - UM.Theme.getSize("tooltip_margins").width * 2 width: textScroll.width - 2 * UM.Theme.getSize("tooltip_margins").width
wrapMode: Text.Wrap wrapMode: Text.Wrap
textFormat: Text.RichText textFormat: Text.RichText
color: UM.Theme.getColor("tooltip_text") color: UM.Theme.getColor("tooltip_text")
} }
} }
}
} }

View File

@ -61,15 +61,21 @@ Item
var affected_by_list = "" var affected_by_list = ""
for (var i in affected_by) for (var i in affected_by)
{
if(affected_by[i].label != "")
{ {
affected_by_list += "<li>%1</li>\n".arg(affected_by[i].label) affected_by_list += "<li>%1</li>\n".arg(affected_by[i].label)
} }
}
var affects_list = "" var affects_list = ""
for (var i in affects) for (var i in affects)
{
if(affects[i].label != "")
{ {
affects_list += "<li>%1</li>\n".arg(affects[i].label) affects_list += "<li>%1</li>\n".arg(affects[i].label)
} }
}
var tooltip = "<b>%1</b>\n<p>%2</p>".arg(definition.label).arg(definition.description) var tooltip = "<b>%1</b>\n<p>%2</p>".arg(definition.label).arg(definition.description)

View File

@ -61,7 +61,7 @@ Item
left: parent.left left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width leftMargin: UM.Theme.getSize("default_margin").width
} }
source: UM.Theme.getIcon("search") source: UM.Theme.getIcon("Magnifier")
height: UM.Theme.getSize("small_button_icon").height height: UM.Theme.getSize("small_button_icon").height
width: height width: height
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
@ -178,7 +178,7 @@ Item
ListView ListView
{ {
id: contents id: contents
maximumFlickVelocity: 1000 maximumFlickVelocity: 1000 * screenScaleFactor
anchors anchors
{ {
top: filterContainer.bottom top: filterContainer.bottom

View File

@ -23,6 +23,7 @@ TextField
selectByMouse: true selectByMouse: true
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text_field_text") color: UM.Theme.getColor("text_field_text")
selectedTextColor: UM.Theme.getColor("text_field_text")
renderType: Text.NativeRendering renderType: Text.NativeRendering
selectionColor: UM.Theme.getColor("text_selection") selectionColor: UM.Theme.getColor("text_selection")
leftPadding: iconLeft.visible ? iconLeft.width + UM.Theme.getSize("default_margin").width * 2 : UM.Theme.getSize("thin_margin").width leftPadding: iconLeft.visible ? iconLeft.width + UM.Theme.getSize("default_margin").width * 2 : UM.Theme.getSize("thin_margin").width