From bd5e85144c38af00c270fd1022660a8353622538 Mon Sep 17 00:00:00 2001 From: Tamara Hogenhout Date: Fri, 28 Aug 2015 10:15:17 +0200 Subject: [PATCH 1/5] Merging of mine and Jaimes work --- resources/qml/SaveButton.qml | 106 +++++++++++++---------------------- 1 file changed, 38 insertions(+), 68 deletions(-) diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 5f3cb5cd5d..638289932b 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -8,8 +8,7 @@ import QtQuick.Layouts 1.1 import UM 1.1 as UM -Rectangle -{ +Rectangle { id: base; property real progress: UM.Backend.progress; @@ -17,34 +16,27 @@ Rectangle Behavior on progress { NumberAnimation { duration: 250; } } property int totalHeight: childrenRect.height + UM.I18nCatalog { id: catalog; name:"cura"} + property variant printDuration: PrintInformation.currentPrintTime; property real printMaterialAmount: PrintInformation.materialAmount; - UM.I18nCatalog { id: catalog; name:"cura"} - Rectangle - { - id: background + + Rectangle{ + id: printJobRow implicitWidth: base.width; - implicitHeight: parent.height; - color: UM.Theme.colors.save_button_background; - border.width: UM.Theme.sizes.save_button_border.width - border.color: UM.Theme.colors.save_button_border - - Rectangle - { - id: infoBox - width: parent.width - UM.Theme.sizes.default_margin.width * 2; - height: UM.Theme.sizes.save_button_slicing_bar.height - - anchors.top: parent.top - anchors.topMargin: UM.Theme.sizes.default_margin.height; + implicitHeight: UM.Theme.sizes.sidebar_header.height + anchors.top: parent.top + color: UM.Theme.colors.sidebar_header_bar + Label{ + id: printJobTextfieldLabel + text: catalog.i18nc("@label","Printjob name"); anchors.left: parent.left anchors.leftMargin: UM.Theme.sizes.default_margin.width; anchors.verticalCenter: parent.verticalCenter - //font: UM.Theme.fonts.default; + font: UM.Theme.fonts.default; color: UM.Theme.colors.text_white } - TextField - { + TextField { id: printJobTextfield anchors.right: parent.right anchors.rightMargin: UM.Theme.sizes.default_margin.width; @@ -53,23 +45,18 @@ Rectangle height: UM.Theme.sizes.sidebar_inputFields.height property int unremovableSpacing: 5 text: "UM2" + "_" + "filename" ///TODO KOMT NOG - onEditingFinished: - { - if (printJobTextfield.text != '') - { + onEditingFinished: { + if (printJobTextfield.text != ''){ printJobTextfield.focus = false } } - validator: RegExpValidator - { + validator: RegExpValidator { regExp: /^[0-9a-zA-Z\_\-]*$/ } - style: TextFieldStyle - { + style: TextFieldStyle{ textColor: UM.Theme.colors.setting_control_text; font: UM.Theme.fonts.default; - background: Rectangle - { + background: Rectangle { radius: 0 implicitWidth: parent.width implicitHeight: parent.height @@ -80,14 +67,12 @@ Rectangle } } - Rectangle - { + Rectangle { id: specsRow implicitWidth: base.width implicitHeight: UM.Theme.sizes.sidebar_specs_bar.height anchors.top: printJobRow.bottom - Item - { + Item{ id: time width: (parent.width / 100 * 45) - UM.Theme.sizes.default_margin.width * 2 height: parent.height @@ -95,8 +80,7 @@ Rectangle anchors.leftMargin: UM.Theme.sizes.default_margin.width anchors.top: parent.top visible: base.printMaterialAmount > 0 ? true : false - UM.RecolorImage - { + UM.RecolorImage { id: timeIcon anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left @@ -107,26 +91,23 @@ Rectangle color: UM.Theme.colors.text_hover source: UM.Theme.icons.print_time; } - Label - { + Label{ id: timeSpec anchors.verticalCenter: parent.verticalCenter anchors.left: timeIcon.right anchors.leftMargin: UM.Theme.sizes.default_margin.width/2 font: UM.Theme.fonts.default color: UM.Theme.colors.text - text: (!base.printDuration || !base.printDuration.valid) ? "" : catalog.i18nc("@label","%1 h:m").arg(base.printDuration.getDisplayString(UM.DurationFormat.Short)) + text: (!base.printDuration || !base.printDuration.valid) ? "" : catalog.i18nc("@label", "%1 m").arg(base.printDuration.getDisplayString(UM.DurationFormat.Short)) } } - Item - { + Item{ width: parent.width / 100 * 55 height: parent.height anchors.left: time.right anchors.top: parent.top visible: base.printMaterialAmount > 0 ? true : false - UM.RecolorImage - { + UM.RecolorImage { id: lengthIcon anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left @@ -137,8 +118,7 @@ Rectangle color: UM.Theme.colors.text_hover source: UM.Theme.icons.category_material; } - Label - { + Label{ id: lengthSpec anchors.verticalCenter: parent.verticalCenter anchors.left: lengthIcon.right @@ -150,8 +130,7 @@ Rectangle } } - Item - { + Item{ id: saveRow implicitWidth: base.width / 100 * 55 implicitHeight: saveToButton.height + (UM.Theme.sizes.default_margin.height / 2) // height + bottomMargin @@ -159,8 +138,7 @@ Rectangle anchors.right: parent.right anchors.rightMargin: UM.Theme.sizes.default_margin.width - Button - { + Button { id: saveToButton anchors.left: parent.left tooltip: UM.OutputDeviceManager.activeDeviceDescription; @@ -171,15 +149,12 @@ Rectangle text: UM.OutputDeviceManager.activeDeviceShortDescription; - style: ButtonStyle - { - background: Rectangle - { + style: ButtonStyle { + background: Rectangle { color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button Behavior on color { ColorAnimation { duration: 50; } } - Label - { + Label { anchors.centerIn: parent color: UM.Theme.colors.load_save_button_text font: UM.Theme.fonts.default @@ -191,10 +166,9 @@ Rectangle onClicked: UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice) } - Button - { + Button { id: deviceSelectionMenu; - tooltip: catalog.i18nc("@action:button","Select the active output device"); + tooltip: catalog.i18nc("@info:tooltip","Select the active output device"); anchors.right: parent.right width: UM.Theme.sizes.save_button_save_to_button.height height: UM.Theme.sizes.save_button_save_to_button.height @@ -225,20 +199,16 @@ Rectangle label: Label{ } } - menu: Menu - { + menu: Menu { id: devicesMenu; - Instantiator - { + Instantiator { model: devicesModel; - MenuItem - { + MenuItem { text: model.description checkable: true; checked: model.id == UM.OutputDeviceManager.activeDevice; exclusiveGroup: devicesMenuGroup; - onTriggered: - { + onTriggered: { UM.OutputDeviceManager.setActiveDevice(model.id); } } From 8cbe802881dc2da22f2092892b65bc38eadd22d6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 28 Aug 2015 11:44:19 +0200 Subject: [PATCH 2/5] Added missing ) --- resources/qml/ViewPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/ViewPage.qml b/resources/qml/ViewPage.qml index 3bab4acd1a..66af58eaa6 100644 --- a/resources/qml/ViewPage.qml +++ b/resources/qml/ViewPage.qml @@ -42,7 +42,7 @@ UM.PreferencesPage onClicked: overhangCheckbox.checked = !overhangCheckbox.checked //: Display Overhang preference tooltip - tooltip: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will nog print properly." + tooltip: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will nog print properly.") style: ButtonStyle { From ff9a22209714b2de61234618379725ee8bab21dd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 28 Aug 2015 16:24:38 +0200 Subject: [PATCH 3/5] Added changeLog plugin --- plugins/ChangeLogPlugin/ChangeLog.py | 98 +++++++++++++++++++++++++++ plugins/ChangeLogPlugin/ChangeLog.qml | 28 ++++++++ plugins/ChangeLogPlugin/ChangeLog.txt | 41 +++++++++++ plugins/ChangeLogPlugin/__init__.py | 21 ++++++ 4 files changed, 188 insertions(+) create mode 100644 plugins/ChangeLogPlugin/ChangeLog.py create mode 100644 plugins/ChangeLogPlugin/ChangeLog.qml create mode 100644 plugins/ChangeLogPlugin/ChangeLog.txt create mode 100644 plugins/ChangeLogPlugin/__init__.py diff --git a/plugins/ChangeLogPlugin/ChangeLog.py b/plugins/ChangeLogPlugin/ChangeLog.py new file mode 100644 index 0000000000..095f8a5647 --- /dev/null +++ b/plugins/ChangeLogPlugin/ChangeLog.py @@ -0,0 +1,98 @@ +# Copyright (c) 2015 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + +from UM.i18n import i18nCatalog +from UM.Extension import Extension +from UM.Preferences import Preferences +from UM.Application import Application +from UM.PluginRegistry import PluginRegistry +from UM.Version import Version + +from PyQt5.QtQuick import QQuickView +from PyQt5.QtQml import QQmlComponent, QQmlContext +from PyQt5.QtCore import QUrl, pyqtSlot, QObject + +import os.path + +catalog = i18nCatalog("cura") + +class ChangeLog(Extension, QObject,): + def __init__(self, parent = None): + QObject.__init__(self, parent) + Extension.__init__(self) + self._changelog_window = None + self._changelog_context = None + version_string = Application.getInstance().getVersion() + if version_string is not "master": + self._version = Version(version_string) + else: + self._version = None + self._change_logs = None + Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated) + Preferences.getInstance().addPreference("general/latest_version_changelog_shown", "15.05.90") #First version of CURA with uranium + #self.showChangelog() + + def getChangeLogs(self): + if not self._change_logs: + self.loadChangeLogs() + return self._change_logs + + @pyqtSlot(result = str) + def getChangeLogString(self): + logs = self.getChangeLogs() + latest_version = Version(Preferences.getInstance().getValue("general/latest_version_changelog_shown")) + result = "" + for version in logs: + result += "

" + str(version) + "


" + result += "" + for change in logs[version]: + result += "" + str(change) + "
" + for line in logs[version][change]: + result += str(line) + "
" + result += "
" + + pass + return result + + def loadChangeLogs(self): + self._change_logs = {} + with open(os.path.join(PluginRegistry.getInstance().getPluginPath("ChangeLogPlugin"), "ChangeLog.txt"), 'r') as f: + open_version = None + open_header = None + for line in f: + line = line.replace("\n","") + if "[" in line and "]" in line: + line = line.replace("[","") + line = line.replace("]","") + open_version = Version(line) + self._change_logs[Version(line)] = {} + elif line.startswith("*"): + open_header = line.replace("*","") + self._change_logs[open_version][open_header] = [] + else: + if line != "": + self._change_logs[open_version][open_header].append(line) + + def _onEngineCreated(self): + if not self._version: + return #We're on dev branch. + if self._version > Preferences.getInstance().getValue("general/latest_version_changelog_shown"): + self.showChangelog() + + def showChangelog(self): + if not self._changelog_window: + self.createChangelogWindow() + self._changelog_window.show() + Preferences.getInstance().setValue("general/latest_version_changelog_shown", Application.getInstance().getVersion()) + + def hideChangelog(self): + if self._changelog_window: + self._changelog_window.hide() + + def createChangelogWindow(self): + path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath("ChangeLogPlugin"), "ChangeLog.qml")) + component = QQmlComponent(Application.getInstance()._engine, path) + self._changelog_context = QQmlContext(Application.getInstance()._engine.rootContext()) + self._changelog_context.setContextProperty("manager", self) + self._changelog_window = component.create(self._changelog_context) + #print(self._changelog_window) diff --git a/plugins/ChangeLogPlugin/ChangeLog.qml b/plugins/ChangeLogPlugin/ChangeLog.qml new file mode 100644 index 0000000000..61400f3d07 --- /dev/null +++ b/plugins/ChangeLogPlugin/ChangeLog.qml @@ -0,0 +1,28 @@ +// Copyright (c) 2015 Ultimaker B.V. +// Cura is released under the terms of the AGPLv3 or higher. + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 + +import UM 1.1 as UM + +UM.Dialog +{ + id: base + width: 300 * Screen.devicePixelRatio; + height: 500 * Screen.devicePixelRatio; + title: "Changelog" + ScrollView + { + anchors.fill:parent + Text + { + text: manager.getChangeLogString() + width:base.width - 35 + wrapMode: Text.Wrap; + //Component.onCompleted: console.log() + } + } +} diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/plugins/ChangeLogPlugin/ChangeLog.txt new file mode 100644 index 0000000000..c263b4f112 --- /dev/null +++ b/plugins/ChangeLogPlugin/ChangeLog.txt @@ -0,0 +1,41 @@ +[15.10.0] +*All at Once/One at a Time +Cura’s default mode is set to All At Once. You can print multiple objects faster with the option print objects One At A Time. This can be changed in Advanced Settings. Please note that in One At A Time mode, grouped objects will still be printed as a single object. + +*Setting Profiles +Now you can create preferred setting favourites and share them with others. + + +*Post-Processing Plugin +This plugin supports post-processing on the GCode generated by the engine – allowing for custom scripts. For example, Pause At Height and Tweak At Z. + +*Support for Bed Levelling and other wizards +We have restored the Bed Levelling function and several other wizards that were previously available for the Ultimaker Original. Additionally, these are ready to be used with machines from other vendors (BQ, Rep Rap neo). + +*Third-Party Printer Profiles +We received printer profiles for third-party vendors (BQ, Rep Rap neo) from the community (thanks guys!). These have been included in this release. + + +*3MF File Loading Support (New) +We’re happy to report we now support loading 3MF files. This is a new file format similar to AMF, but freely available. + +*Output Device API for Developers (New) +The Storage Device API has now been replaced with the Output Device API for saving files. It’s designed to make it easier for anyone that wants to write a plugin giving them some form of output device, whether it’s a printer or a web service. + +*Improved Cut-Off Object Bottom (New) +We’ve added a feature than allows you to move objects below the build plate. You can either correct a model with a rough bottom, or print only a part of an object. Please note that the implementation greatly differs from the old one where it was a setting. + +*Improved File Saving (new) +We’re happy to report that the way file saving is handled has received a huge overhaul. Now the default action is to save everything on the build plate to a file. + +*Select Multiple Objects (New) +You now have the freedom to select and manipulate multiple objects at the same time. + +*Grouping (New) +You can now group objects together to make it easier to manipulate multiple objects. + +*Per-Object Settings (New) +You can now select different profiles for different objects and in advance mode override individual settings. + +*64-bit Windows Builds (New) +Cura now allows 64-bit Windows builds in addition to the 32-bit builds. For users running the 64-bit version of Windows, you can now load models in more detail. \ No newline at end of file diff --git a/plugins/ChangeLogPlugin/__init__.py b/plugins/ChangeLogPlugin/__init__.py new file mode 100644 index 0000000000..8f8235bf23 --- /dev/null +++ b/plugins/ChangeLogPlugin/__init__.py @@ -0,0 +1,21 @@ +# Copyright (c) 2015 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. +from UM.i18n import i18nCatalog + +from . import ChangeLog + +catalog = i18nCatalog("cura") + +def getMetaData(): + return { + "plugin": { + "name": "Change log", + "author": "Ultimaker", + "version": "1.0", + "description": catalog.i18nc("Change log plugin description", "Shows changes since latest checked version"), + "api": 2 + } + } + +def register(app): + return {"extension": ChangeLog.ChangeLog()} \ No newline at end of file From 709ec79918561a526737cac29a1edef3b01c79e6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 28 Aug 2015 16:31:47 +0200 Subject: [PATCH 4/5] Removed unused import --- cura/PlatformPhysics.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index 6416b83e01..c91aaaabde 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -6,7 +6,6 @@ from PyQt5.QtCore import QTimer from UM.Scene.SceneNode import SceneNode from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator from UM.Operations.TranslateOperation import TranslateOperation -from UM.Operations.ScaleToBoundsOperation import ScaleToBoundsOperation from UM.Math.Float import Float from UM.Math.Vector import Vector from UM.Math.AxisAlignedBox import AxisAlignedBox From dd7e450d1cd9021623370589addd8665b4578389 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 28 Aug 2015 16:42:11 +0200 Subject: [PATCH 5/5] Added preference to disable automatic scale Ultimaker/Cura#142 #CURA-89 --- cura/CuraApplication.py | 1 + resources/qml/GeneralPage.qml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a23dc61b05..3e892e52a2 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -85,6 +85,7 @@ class CuraApplication(QtApplication): Preferences.getInstance().addPreference("cura/recent_files", "") Preferences.getInstance().addPreference("cura/categories_expanded", "") Preferences.getInstance().addPreference("view/center_on_select", True) + Preferences.getInstance().addPreference("mesh/scale_to_fit", True) JobQueue.getInstance().jobFinished.connect(self._onJobFinished) diff --git a/resources/qml/GeneralPage.qml b/resources/qml/GeneralPage.qml index 896da66104..676acbf931 100644 --- a/resources/qml/GeneralPage.qml +++ b/resources/qml/GeneralPage.qml @@ -17,9 +17,11 @@ UM.PreferencesPage { UM.Preferences.resetPreference("general/language") UM.Preferences.resetPreference("physics/automatic_push_free") + UM.Preferences.resetPreference("mesh/scale_to_fit") UM.Preferences.resetPreference("info/send_slice_info") pushFreeCheckbox.checked = UM.Preferences.getValue("physics/automatic_push_free") sendDataCheckbox.checked = UM.Preferences.getValue("info/send_slice_info") + scaleToFitCheckbox.checked = UM.Preferences.getValue("mesh/scale_to_fit") languageComboBox.currentIndex = 0 } GridLayout @@ -163,6 +165,38 @@ UM.PreferencesPage } } } + CheckBox + { + id: scaleToFitCheckbox + checked: UM.Preferences.getValue("mesh/scale_to_fit") + onCheckedChanged: UM.Preferences.setValue("mesh/scale_to_fit", checked) + } + Button + { + id: scaleToFitText //is a button so the user doesn't have te click inconvenientley precise to enable or disable the checkbox + + //: Display Overhang preference checkbox + text: catalog.i18nc("@action:checkbox","Scale loaded meshes when too large"); + onClicked: scaleToFitCheckbox.checked = !scaleToFitCheckbox.checked + + //: Display Overhang preference tooltip + tooltip: catalog.i18nc("@info:tooltip","Should loaded meshes be scaled to the max build volume if they are too large.") + + style: ButtonStyle + { + background: Rectangle + { + border.width: 0 + color: "transparent" + } + label: Text + { + renderType: Text.NativeRendering + horizontalAlignment: Text.AlignLeft + text: control.text + } + } + } Item { Layout.fillHeight: true; Layout.columnSpan: 2 } } }