mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 14:04:03 -06:00
Merge branch 'master' into ui_rework_4_0
This commit is contained in:
commit
7a12cc53cc
61 changed files with 14245 additions and 53399 deletions
|
@ -11,7 +11,7 @@ import UM 1.3 as UM
|
|||
Item {
|
||||
id: root;
|
||||
property var printJob: null;
|
||||
property var running: isRunning(printJob);
|
||||
property var started: isStarted(printJob);
|
||||
property var assigned: isAssigned(printJob);
|
||||
|
||||
Button {
|
||||
|
@ -34,7 +34,13 @@ Item {
|
|||
hoverEnabled: true;
|
||||
onClicked: parent.switchPopupState();
|
||||
text: "\u22EE"; //Unicode; Three stacked points.
|
||||
visible: printJob.state == "queued" || running ? true : false;
|
||||
visible: {
|
||||
if (!printJob) {
|
||||
return false;
|
||||
}
|
||||
var states = ["queued", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"];
|
||||
return states.indexOf(printJob.state) !== -1;
|
||||
}
|
||||
width: 35 * screenScaleFactor; // TODO: Theme!
|
||||
}
|
||||
|
||||
|
@ -102,7 +108,12 @@ Item {
|
|||
width: parent.width;
|
||||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: {
|
||||
onClicked: {
|
||||
sendToTopConfirmationDialog.visible = true;
|
||||
popup.close();
|
||||
}
|
||||
text: catalog.i18nc("@label", "Move to top");
|
||||
visible: {
|
||||
if (printJob && printJob.state == "queued" && !assigned) {
|
||||
if (OutputDevice && OutputDevice.queuedPrintJobs[0]) {
|
||||
return OutputDevice.queuedPrintJobs[0].key != printJob.key;
|
||||
|
@ -110,42 +121,75 @@ Item {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
onClicked: {
|
||||
sendToTopConfirmationDialog.visible = true;
|
||||
popup.close();
|
||||
}
|
||||
text: catalog.i18nc("@label", "Move to top");
|
||||
}
|
||||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: printJob && !running;
|
||||
onClicked: {
|
||||
deleteConfirmationDialog.visible = true;
|
||||
popup.close();
|
||||
}
|
||||
text: catalog.i18nc("@label", "Delete");
|
||||
visible: {
|
||||
if (!printJob) {
|
||||
return false;
|
||||
}
|
||||
var states = ["queued", "sent_to_printer"];
|
||||
return states.indexOf(printJob.state) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: printJob && running;
|
||||
enabled: visible && !(printJob.state == "pausing" || printJob.state == "resuming");
|
||||
onClicked: {
|
||||
if (printJob.state == "paused") {
|
||||
printJob.setState("print");
|
||||
} else if(printJob.state == "printing") {
|
||||
printJob.setState("pause");
|
||||
popup.close();
|
||||
return;
|
||||
}
|
||||
if (printJob.state == "printing") {
|
||||
printJob.setState("pause");
|
||||
popup.close();
|
||||
return;
|
||||
}
|
||||
popup.close();
|
||||
}
|
||||
text: printJob && printJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause");
|
||||
text: {
|
||||
if (!printJob) {
|
||||
return "";
|
||||
}
|
||||
switch(printJob.state) {
|
||||
case "paused":
|
||||
return catalog.i18nc("@label", "Resume");
|
||||
case "pausing":
|
||||
return catalog.i18nc("@label", "Pausing...");
|
||||
case "resuming":
|
||||
return catalog.i18nc("@label", "Resuming...");
|
||||
default:
|
||||
catalog.i18nc("@label", "Pause");
|
||||
}
|
||||
}
|
||||
visible: {
|
||||
if (!printJob) {
|
||||
return false;
|
||||
}
|
||||
var states = ["printing", "pausing", "paused", "resuming"];
|
||||
return states.indexOf(printJob.state) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: printJob && running;
|
||||
enabled: visible && printJob.state !== "aborting";
|
||||
onClicked: {
|
||||
abortConfirmationDialog.visible = true;
|
||||
popup.close();
|
||||
}
|
||||
text: catalog.i18nc("@label", "Abort");
|
||||
text: printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort");
|
||||
visible: {
|
||||
if (!printJob) {
|
||||
return false;
|
||||
}
|
||||
var states = ["pre_print", "printing", "pausing", "paused", "resuming"];
|
||||
return states.indexOf(printJob.state) !== -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
enter: Transition {
|
||||
|
@ -205,11 +249,11 @@ Item {
|
|||
function switchPopupState() {
|
||||
popup.visible ? popup.close() : popup.open();
|
||||
}
|
||||
function isRunning(job) {
|
||||
function isStarted(job) {
|
||||
if (!job) {
|
||||
return false;
|
||||
}
|
||||
return ["paused", "printing", "pre_print"].indexOf(job.state) !== -1;
|
||||
return ["pre_print", "printing", "pausing", "paused", "resuming", "aborting"].indexOf(job.state) !== -1;
|
||||
}
|
||||
function isAssigned(job) {
|
||||
if (!job) {
|
||||
|
@ -217,4 +261,13 @@ Item {
|
|||
}
|
||||
return job.assignedPrinter ? true : false;
|
||||
}
|
||||
function getMenuLength() {
|
||||
var visible = 0;
|
||||
for (var i = 0; i < popupOptions.children.length; i++) {
|
||||
if (popupOptions.children[i].visible) {
|
||||
visible++;
|
||||
}
|
||||
}
|
||||
return visible;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,12 @@ Button {
|
|||
color: UM.Theme.getColor("monitor_context_menu_highlight");
|
||||
}
|
||||
contentItem: Label {
|
||||
color: UM.Theme.getColor("text");
|
||||
color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_inactive");
|
||||
text: parent.text
|
||||
horizontalAlignment: Text.AlignLeft;
|
||||
verticalAlignment: Text.AlignVCenter;
|
||||
}
|
||||
height: 39 * screenScaleFactor; // TODO: Theme!
|
||||
height: visible ? 39 * screenScaleFactor : 0; // TODO: Theme!
|
||||
hoverEnabled: true;
|
||||
visible: enabled;
|
||||
width: parent.width;
|
||||
}
|
|
@ -168,6 +168,18 @@ Item {
|
|||
width: 0.5 * printJobPreview.width;
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: totalTimeLabel;
|
||||
anchors {
|
||||
bottom: parent.bottom;
|
||||
right: parent.right;
|
||||
}
|
||||
color: UM.Theme.getColor("text");
|
||||
elide: Text.ElideRight;
|
||||
font: UM.Theme.getFont("default");
|
||||
text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : "";
|
||||
}
|
||||
}
|
||||
|
||||
// Divider
|
||||
|
|
|
@ -590,13 +590,27 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
origin_name=change["origin_name"]))
|
||||
return result
|
||||
|
||||
def _createMaterialOutputModel(self, material_data) -> MaterialOutputModel:
|
||||
containers = ContainerRegistry.getInstance().findInstanceContainers(type="material", GUID=material_data["guid"])
|
||||
if containers:
|
||||
color = containers[0].getMetaDataEntry("color_code")
|
||||
brand = containers[0].getMetaDataEntry("brand")
|
||||
material_type = containers[0].getMetaDataEntry("material")
|
||||
name = containers[0].getName()
|
||||
def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel":
|
||||
material_manager = CuraApplication.getInstance().getMaterialManager()
|
||||
material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"])
|
||||
|
||||
# Sort the material groups by "is_read_only = True" first, and then the name alphabetically.
|
||||
read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list))
|
||||
non_read_only_material_group_list = list(filter(lambda x: not x.is_read_only, material_group_list))
|
||||
material_group = None
|
||||
if read_only_material_group_list:
|
||||
read_only_material_group_list = sorted(read_only_material_group_list, key = lambda x: x.name)
|
||||
material_group = read_only_material_group_list[0]
|
||||
elif non_read_only_material_group_list:
|
||||
non_read_only_material_group_list = sorted(non_read_only_material_group_list, key = lambda x: x.name)
|
||||
material_group = non_read_only_material_group_list[0]
|
||||
|
||||
if material_group:
|
||||
container = material_group.root_material_node.getContainer()
|
||||
color = container.getMetaDataEntry("color_code")
|
||||
brand = container.getMetaDataEntry("brand")
|
||||
material_type = container.getMetaDataEntry("material")
|
||||
name = container.getName()
|
||||
else:
|
||||
Logger.log("w",
|
||||
"Unable to find material with guid {guid}. Using data as provided by cluster".format(
|
||||
|
|
|
@ -498,8 +498,8 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
self._authentication_id = None
|
||||
|
||||
self.post("auth/request",
|
||||
json.dumps({"application": "Cura-" + CuraApplication.getInstance().getVersion(),
|
||||
"user": self._getUserName()}).encode(),
|
||||
json.dumps({"application": "Cura-" + CuraApplication.getInstance().getVersion(),
|
||||
"user": self._getUserName()}),
|
||||
on_finished=self._onRequestAuthenticationFinished)
|
||||
|
||||
self.setAuthenticationState(AuthState.AuthenticationRequested)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue