From 56454a9c7a894f3c2c7acc08e5347f0bdad008b4 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 8 Jun 2015 17:50:29 +0200 Subject: [PATCH 1/7] Add support for listing recent files Fixes Asana issue 33694049548880 --- cura/CuraApplication.py | 32 ++++++++++++++++++++++++++++++++ resources/qml/Cura.qml | 14 ++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 55e1e466a4..7668a62dae 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -17,6 +17,7 @@ from UM.Logger import Logger from UM.Preferences import Preferences from UM.Message import Message from UM.PluginRegistry import PluginRegistry +from UM.JobQueue import JobQueue from UM.Scene.BoxRenderer import BoxRenderer from UM.Scene.Selection import Selection @@ -71,6 +72,17 @@ class CuraApplication(QtApplication): Preferences.getInstance().addPreference("cura/active_machine", "") Preferences.getInstance().addPreference("cura/active_mode", "simple") + Preferences.getInstance().addPreference("cura/recent_files", "") + + JobQueue.getInstance().jobFinished.connect(self._onJobFinished) + + self._recent_files = [] + files = Preferences.getInstance().getValue("cura/recent_files").split(";") + for f in files: + if not os.path.isfile(f): + continue + + self._recent_files.append(f) ## Handle loading of all plugin types (and the backend explicitly) # \sa PluginRegistery @@ -305,6 +317,11 @@ class CuraApplication(QtApplication): return log + recentFilesChanged = pyqtSignal() + @pyqtProperty("QStringList", notify = recentFilesChanged) + def recentFiles(self): + return self._recent_files + outputDevicesChanged = pyqtSignal() @pyqtProperty("QVariantMap", notify = outputDevicesChanged) @@ -460,3 +477,18 @@ class CuraApplication(QtApplication): op = AddSceneNodeOperation(node, self.getController().getScene().getRoot()) op.push() + + def _onJobFinished(self, job): + if type(job) is not ReadMeshJob: + return + + f = job.getFileName() + if f in self._recent_files: + self._recent_files.remove(f) + + self._recent_files.insert(0, f) + if len(self._recent_files) > 10: + del self._recent_files[10] + + Preferences.getInstance().setValue("cura/recent_files", ";".join(self._recent_files)) + self.recentFilesChanged.emit() diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index a2eeba59cd..e0caf4d83d 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -25,6 +25,7 @@ UM.MainWindow { window: base Menu { + id: fileMenu //: File menu title: qsTr("&File"); @@ -33,6 +34,19 @@ UM.MainWindow { MenuSeparator { } + Instantiator { + model: Printer.recentFiles + MenuItem { + property url filePath: modelData; + text: (index + 1) + ". " + modelData.slice(modelData.lastIndexOf("/") + 1); + onTriggered: UM.MeshFileHandler.readLocalFile(filePath); + } + onObjectAdded: fileMenu.insertItem(index, object) + onObjectRemoved: fileMenu.removeItem(object) + } + + MenuSeparator { } + MenuItem { action: actions.quit; } } From fc33b340607fd0cf99db82ba722bc5531fd30b6e Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 9 Jun 2015 13:38:23 +0200 Subject: [PATCH 2/7] Save the state of collapsed/expanded categories Fixes Asana issue 36436828173802 --- cura/CuraApplication.py | 15 +++++++++++++++ resources/qml/SidebarAdvanced.qml | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7668a62dae..43ce586e74 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -73,6 +73,7 @@ class CuraApplication(QtApplication): Preferences.getInstance().addPreference("cura/active_machine", "") Preferences.getInstance().addPreference("cura/active_mode", "simple") Preferences.getInstance().addPreference("cura/recent_files", "") + Preferences.getInstance().addPreference("cura/categories_expanded", "") JobQueue.getInstance().jobFinished.connect(self._onJobFinished) @@ -322,6 +323,20 @@ class CuraApplication(QtApplication): def recentFiles(self): return self._recent_files + @pyqtSlot("QStringList") + def setExpandedCategories(self, categories): + categories = list(set(categories)) + categories.sort() + joined = ";".join(categories) + if joined != Preferences.getInstance().getValue("cura/categories_expanded"): + Preferences.getInstance().setValue("cura/categories_expanded", joined) + self.expandedCategoriesChanged.emit() + + expandedCategoriesChanged = pyqtSignal() + @pyqtProperty("QStringList", notify = expandedCategoriesChanged) + def expandedCategories(self): + return Preferences.getInstance().getValue("cura/categories_expanded").split(";") + outputDevicesChanged = pyqtSignal() @pyqtProperty("QVariantMap", notify = outputDevicesChanged) diff --git a/resources/qml/SidebarAdvanced.qml b/resources/qml/SidebarAdvanced.qml index 7d0e391768..8a231aa53d 100644 --- a/resources/qml/SidebarAdvanced.qml +++ b/resources/qml/SidebarAdvanced.qml @@ -1,6 +1,13 @@ // Copyright (c) 2015 Ultimaker B.V. // Cura is released under the terms of the AGPLv3 or higher. +import QtQuick 2.0 + +import QtQuick.Controls 1.2 + import UM 1.0 as UM -UM.SettingView { } +UM.SettingView { + expandedCategories: Printer.expandedCategories; + onExpandedCategoriesChanged: Printer.setExpandedCategories(expandedCategories); +} From 5019a157a1a31b2c999cfd75f510785b74e47dd0 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 9 Jun 2015 05:22:28 -0700 Subject: [PATCH 3/7] Bump version to .95 --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 43ce586e74..5135a84471 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -49,7 +49,7 @@ class CuraApplication(QtApplication): if not hasattr(sys, "frozen"): Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")) - super().__init__(name = "cura", version = "15.05.93") + super().__init__(name = "cura", version = "15.05.94") self.setRequiredPlugins([ "CuraEngineBackend", From da6b7c272cebe17a2b2045106eef664416b116ed Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 9 Jun 2015 05:23:37 -0700 Subject: [PATCH 4/7] Include VCRedist and add an option to run it during install Fixes Asana issue 34145139570660 --- installer.nsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/installer.nsi b/installer.nsi index 5bd18a929b..1259aeba7a 100644 --- a/installer.nsi +++ b/installer.nsi @@ -99,6 +99,15 @@ Function LaunchLink Exec '"$WINDIR\explorer.exe" "$SMPROGRAMS\Cura ${VERSION}\Cura ${VERSION}.lnk"' FunctionEnd +Section "Install Visual Studio 2010 Redistributable" + SetOutPath "$INSTDIR" + File "vcredist_2010_x86.exe" + + IfSilent +2 + ExecWait '"$INSTDIR\vcredist_2010_x86.exe"' + +SectionEnd + ;Section "Install Arduino Drivers" ; ; Set output path to the driver directory. ; SetOutPath "$INSTDIR\drivers\" From aef2821464ba50958a323663cbfdd02e7f463cc2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 9 Jun 2015 14:37:04 +0200 Subject: [PATCH 5/7] Update CHANGES file with changes since .93 --- CHANGES | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index e62253066b..f33001afd5 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,24 @@ Cura 15.06 is a new release built from the ground up on a completely new framework called Uranium. This framework has been designed to make it easier to extend Cura with additional functionality as well as provide a cleaner UI. +Changes since 15.05.93 +---------------------- + +* Fixed: No shortcuts for moving up/down layers in layer view. +* Fixed: Last view layers could not be scrolled through in layer view. +* Fixed: Files provided on command line would not actually show up on the build + platform. +* Fixed: Render a ghost of the selection in Layer view to make the actual object + position clear. +* Fixed: Showing a menu would clear the selection. +* Fixed: Size and scaling factor display for scale tool. +* Fixed: Missing background for additional tool controls. +* Fixed: Loading message times out when loading large files. +* Fixed: Show recent files in the file menu. +* Fixed: Windows installer will now install MSVC 2010 redistributable, to + prevent issues with missing DLL's. +* Fixed: Collapsed/expanded state of setting categories not stored. + Changes since 15.05.91 ---------------------- @@ -26,7 +44,8 @@ Changes since 15.05.91 * Fixed: Camera panning now works correctly instead of doing nothing. * Fixed: Camera would flip around center point at maximum rotation. * Fixed: Build platform grid blocked view from below objects. -* Fixed: Viewport on MacOSX with high-DPI screens was only taking 1/4th of the window +* Fixed: Viewport on MacOSX with high-DPI screens was only taking 1/4th of the +window Changes since 15.05.90 ---------------------- From 74cf0274214797bdfe5e1a1ddfeb25c37353249f Mon Sep 17 00:00:00 2001 From: Tamara Hogenhout Date: Wed, 10 Jun 2015 14:40:46 +0200 Subject: [PATCH 6/7] Fix text wrapping and several other style issues of the About dialog Contributes to Ultimaker/Uranium#43 --- resources/qml/AboutDialog.qml | 72 ++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/resources/qml/AboutDialog.qml b/resources/qml/AboutDialog.qml index df2ecf4172..1ed9f5dd32 100644 --- a/resources/qml/AboutDialog.qml +++ b/resources/qml/AboutDialog.qml @@ -3,7 +3,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 import UM 1.0 as UM @@ -12,48 +11,53 @@ UM.Dialog { id: base //: About dialog title - title: qsTr("About Cura"); + title: qsTr("About Cura") + minimumWidth: 400 + minimumHeight: 300 - ColumnLayout { - anchors.fill: parent; + Image { + id: logo + width: parent.width * 0.75 + height: width * (1/4.25) - Item { - Layout.fillWidth: true; - Layout.fillHeight: true; - } + source: UM.Theme.images.logo - Image { - Layout.alignment: Qt.AlignHCenter; - Layout.preferredWidth: parent.width * 0.75; - Layout.preferredHeight: width * (1/4.25); + sourceSize.width: width + sourceSize.height: height + anchors.centerIn: parent + anchors.verticalCenterOffset : -(height * 0.5) + } - source: UM.Theme.images.logo; + Label { + id: version - sourceSize.width: width; - sourceSize.height: height; - } + text: "Cura 15.06 Beta" + font: UM.Theme.fonts.large + anchors.horizontalCenter : logo.horizontalCenter + anchors.horizontalCenterOffset : (logo.width * 0.25) + anchors.top: logo.bottom + anchors.topMargin : 5 + } - Label { - Layout.alignment: Qt.AlignHCenter; + Label { + id: description + width: parent.width - text: "Cura 15.06 Beta"; - font: UM.Theme.fonts.large; - } + //: About dialog application description + text: qsTr("End-to-end solution for fused filament 3D printing.") + wrapMode: Text.WordWrap + anchors.top: version.bottom + anchors.topMargin : 10 + } - Label { - //: About dialog application description - text: qsTr("End-to-end solution for fused filament 3D printing.") - } + Label { + id: author_note + width: parent.width - Label { - //: About dialog application author note - text: qsTr("Cura has been developed by Ultimaker B.V. in cooperation with the community.") - } - - Item { - Layout.fillWidth: true; - Layout.fillHeight: true; - } + //: About dialog application author note + text: qsTr("Cura has been developed by Ultimaker B.V. in cooperation with the community.") + wrapMode: Text.WordWrap + anchors.top: description.bottom } rightButtons: Button { From 5f24b70453d11fa17f6b746afe425d6841c37dd8 Mon Sep 17 00:00:00 2001 From: Tamara Hogenhout Date: Wed, 10 Jun 2015 14:57:37 +0200 Subject: [PATCH 7/7] Highlight Open button when no files are loaded This helps with first-run to make it clear where to start. Fixes #37 --- resources/qml/Cura.qml | 3 +- resources/themes/cura/styles.qml | 49 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index e0caf4d83d..8c5c43d83c 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -192,7 +192,7 @@ UM.MainWindow { id: openFileButton; iconSource: UM.Theme.icons.open; - style: UM.Theme.styles.tool_button; + style: UM.Backend.progress < 0 ? UM.Theme.styles.open_file_button : UM.Theme.styles.tool_button; anchors { top: parent.top; @@ -433,3 +433,4 @@ UM.MainWindow { Component.onCompleted: UM.Theme.load(UM.Resources.getPath(UM.Resources.ThemesLocation, "cura")) } + diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index b7db374da1..e6c08b381c 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -35,6 +35,55 @@ QtObject { } } + property Component open_file_button: Component { + ButtonStyle { + background: UM.AngledCornerRectangle { + implicitWidth: UM.Theme.sizes.button.width; + implicitHeight: UM.Theme.sizes.button.height; + color: { + if(control.hovered) { + return UM.Theme.colors.button_active_hover; + } else { + return UM.Theme.colors.button_active; + } + } + Behavior on color { ColorAnimation { duration: 50; } } + cornerSize: UM.Theme.sizes.default_margin.width; + + Rectangle { + anchors.bottom: parent.top; + + width: parent.width; + height: control.hovered ? label.height : 0; + Behavior on height { NumberAnimation { duration: 75; } } + + opacity: control.hovered ? 1.0 : 0.0; + Behavior on opacity { NumberAnimation { duration: 75; } } + + Label { + id: label + anchors.horizontalCenter: parent.horizontalCenter; + text: control.text; + font: UM.Theme.fonts.button_tooltip; + color: UM.Theme.colors.button_tooltip_text; + } + } + } + + label: Item { + Image { + anchors.centerIn: parent; + + source: control.iconSource; + width: UM.Theme.sizes.button_icon.width; + height: UM.Theme.sizes.button_icon.height; + + sourceSize: UM.Theme.sizes.button_icon; + } + } + } + } + property Component tool_button: Component { ButtonStyle { background: UM.AngledCornerRectangle {