diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index bc5398cb1c..ccdc3cea40 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -90,10 +90,15 @@ class BuildVolume(SceneNode): #Objects loaded at the moment. We are connected to the property changed events of these objects. self._scene_objects = set() - self._change_timer = QTimer() - self._change_timer.setInterval(100) - self._change_timer.setSingleShot(True) - self._change_timer.timeout.connect(self._onChangeTimerFinished) + self._scene_change_timer = QTimer() + self._scene_change_timer.setInterval(100) + self._scene_change_timer.setSingleShot(True) + self._scene_change_timer.timeout.connect(self._onSceneChangeTimerFinished) + + self._setting_change_timer = QTimer() + self._setting_change_timer.setInterval(100) + self._setting_change_timer.setSingleShot(True) + self._setting_change_timer.timeout.connect(self._onSettingChangeTimerFinished) self._build_volume_message = Message(catalog.i18nc("@info:status", "The build volume height has been reduced due to the value of the" @@ -104,15 +109,19 @@ class BuildVolume(SceneNode): # activeQualityChanged is always emitted after setActiveVariant, setActiveMaterial and setActiveQuality. # Therefore this works. Application.getInstance().getMachineManager().activeQualityChanged.connect(self._onStackChanged) + # This should also ways work, and it is semantically more correct, # but it does not update the disallowed areas after material change Application.getInstance().getMachineManager().activeStackChanged.connect(self._onStackChanged) + # list of settings which were updated + self._changed_settings_since_last_rebuild = [] + def _onSceneChanged(self, source): if self._global_container_stack: - self._change_timer.start() + self._scene_change_timer.start() - def _onChangeTimerFinished(self): + def _onSceneChangeTimerFinished(self): root = Application.getInstance().getController().getScene().getRoot() new_scene_objects = set(node for node in BreadthFirstIterator(root) if node.callDecoration("isSliceable")) if new_scene_objects != self._scene_objects: @@ -562,42 +571,67 @@ class BuildVolume(SceneNode): self._engine_ready = True self.rebuild() + def _onSettingChangeTimerFinished(self): + rebuild_me = False + update_disallowed_areas = False + update_raft_thickness = False + update_extra_z_clearance = True + for setting_key in self._changed_settings_since_last_rebuild: + if setting_key == "print_sequence": + machine_height = self._global_container_stack.getProperty("machine_height", "value") + if Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", + "value") == "one_at_a_time" and len( + self._scene_objects) > 1: + self._height = min(self._global_container_stack.getProperty("gantry_height", "value"), + machine_height) + if self._height < machine_height: + self._build_volume_message.show() + else: + self._build_volume_message.hide() + else: + self._height = self._global_container_stack.getProperty("machine_height", "value") + self._build_volume_message.hide() + rebuild_me = True + + if setting_key in self._skirt_settings or setting_key in self._prime_settings or setting_key in self._tower_settings or setting_key == "print_sequence" or setting_key in self._ooze_shield_settings or setting_key in self._distance_settings or setting_key in self._extruder_settings: + update_disallowed_areas = True + rebuild_me = True + + if setting_key in self._raft_settings: + update_raft_thickness = True + rebuild_me = True + + if setting_key in self._extra_z_settings: + update_extra_z_clearance = True + rebuild_me = True + + if setting_key in self._limit_to_extruder_settings: + update_disallowed_areas = True + rebuild_me = True + + # We only want to update all of them once. + if update_disallowed_areas: + self._updateDisallowedAreas() + + if update_raft_thickness: + self._updateRaftThickness() + + if update_extra_z_clearance: + self._updateExtraZClearance() + + if rebuild_me: + self.rebuild() + + # We just did a rebuild, reset the list. + self._changed_settings_since_last_rebuild = [] + def _onSettingPropertyChanged(self, setting_key: str, property_name: str): if property_name != "value": return - rebuild_me = False - if setting_key == "print_sequence": - machine_height = self._global_container_stack.getProperty("machine_height", "value") - if Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", "value") == "one_at_a_time" and len(self._scene_objects) > 1: - self._height = min(self._global_container_stack.getProperty("gantry_height", "value"), machine_height) - if self._height < machine_height: - self._build_volume_message.show() - else: - self._build_volume_message.hide() - else: - self._height = self._global_container_stack.getProperty("machine_height", "value") - self._build_volume_message.hide() - rebuild_me = True - - if setting_key in self._skirt_settings or setting_key in self._prime_settings or setting_key in self._tower_settings or setting_key == "print_sequence" or setting_key in self._ooze_shield_settings or setting_key in self._distance_settings or setting_key in self._extruder_settings: - self._updateDisallowedAreas() - rebuild_me = True - - if setting_key in self._raft_settings: - self._updateRaftThickness() - rebuild_me = True - - if setting_key in self._extra_z_settings: - self._updateExtraZClearance() - rebuild_me = True - - if setting_key in self._limit_to_extruder_settings: - self._updateDisallowedAreas() - rebuild_me = True - - if rebuild_me: - self.rebuild() + if setting_key not in self._changed_settings_since_last_rebuild: + self._changed_settings_since_last_rebuild.append(setting_key) + self._setting_change_timer.start() def hasErrors(self) -> bool: return self._has_errors diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 47672a9823..26f9420120 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -76,11 +76,12 @@ class PrintInformation(QObject): if self._backend: self._backend.printDurationMessage.connect(self._onPrintDurationMessage) - self._job_name = "" + self._base_name = "" self._abbr_machine = "" + self._job_name = "" Application.getInstance().globalContainerStackChanged.connect(self._setAbbreviatedMachineName) - Application.getInstance().fileLoaded.connect(self.setJobName) + Application.getInstance().fileLoaded.connect(self.setBaseName) Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged) @@ -221,15 +222,8 @@ class PrintInformation(QObject): @pyqtSlot(str) def setJobName(self, name): - # Ensure that we don't use entire path but only filename - name = os.path.basename(name) - - # when a file is opened using the terminal; the filename comes from _onFileLoaded and still contains its - # extension. This cuts the extension off if necessary. - name = os.path.splitext(name)[0] - if self._job_name != name: - self._job_name = name - self.jobNameChanged.emit() + self._job_name = name + self.jobNameChanged.emit() jobNameChanged = pyqtSignal() @@ -237,21 +231,43 @@ class PrintInformation(QObject): def jobName(self): return self._job_name - @pyqtSlot(str, result = str) - def createJobName(self, base_name): - if base_name == "": - return "" - base_name = self._stripAccents(base_name) + def _updateJobName(self): + if self._base_name == "": + self._job_name = "" + self.jobNameChanged.emit() + return + + base_name = self._stripAccents(self._base_name) self._setAbbreviatedMachineName() if self._pre_sliced: - return catalog.i18nc("@label", "Pre-sliced file {0}", base_name) + self._job_name = catalog.i18nc("@label", "Pre-sliced file {0}", base_name) elif Preferences.getInstance().getValue("cura/jobname_prefix"): # Don't add abbreviation if it already has the exact same abbreviation. if base_name.startswith(self._abbr_machine + "_"): - return base_name - return self._abbr_machine + "_" + base_name + self._job_name = base_name + else: + self._job_name = self._abbr_machine + "_" + base_name else: - return base_name + self._job_name = base_name + + self.jobNameChanged.emit() + + @pyqtProperty(str) + def baseName(self): + return self._base_name + + @pyqtSlot(str) + def setBaseName(self, base_name): + # Ensure that we don't use entire path but only filename + name = os.path.basename(base_name) + + # when a file is opened using the terminal; the filename comes from _onFileLoaded and still contains its + # extension. This cuts the extension off if necessary. + name = os.path.splitext(name)[0] + + if self._base_name == "" and self._base_name != name: + self._base_name = name + self._updateJobName() ## Created an acronymn-like abbreviated machine name from the currently active machine name # Called each time the global stack is switched @@ -276,4 +292,4 @@ class PrintInformation(QObject): ## Utility method that strips accents from characters (eg: รข -> a) def _stripAccents(self, str): - return ''.join(char for char in unicodedata.normalize('NFD', str) if unicodedata.category(char) != 'Mn') + return ''.join(char for char in unicodedata.normalize('NFD', str) if unicodedata.category(char) != 'Mn') diff --git a/cura_app.py b/cura_app.py index 2e406f99d3..ef9190a1fe 100755 --- a/cura_app.py +++ b/cura_app.py @@ -60,7 +60,7 @@ def get_cura_dir_path(): elif Platform.isLinux(): return os.path.expanduser("~/.local/share/cura") elif Platform.isOSX(): - return os.path.expanduser("~/Library/Application Support/cura") + return os.path.expanduser("~/Library/Logs/cura") if hasattr(sys, "frozen"): diff --git a/plugins/LayerView/LayerView.qml b/plugins/LayerView/LayerView.qml index 53f44f3f03..ff8bfcb988 100755 --- a/plugins/LayerView/LayerView.qml +++ b/plugins/LayerView/LayerView.qml @@ -72,7 +72,7 @@ Item anchors.left: parent.left text: catalog.i18nc("@label","View Mode: Layers") font: UM.Theme.getFont("default_bold"); - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("setting_control_text") Layout.fillWidth: true elide: Text.ElideMiddle; } @@ -93,7 +93,7 @@ Item font: UM.Theme.getFont("default"); visible: !UM.LayerView.compatibilityMode Layout.fillWidth: true - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("setting_control_text") } ListModel // matches LayerView.py @@ -211,7 +211,7 @@ Item { text: model.name elide: Text.ElideRight - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("button_text") font: UM.Theme.getFont("default") anchors.verticalCenter: parent.verticalCenter anchors.left: extrudersModelCheckBox.left; @@ -280,7 +280,7 @@ Item text: label font: UM.Theme.getFont("default") elide: Text.ElideRight - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("button_text") anchors.verticalCenter: parent.verticalCenter anchors.left: legendModelCheckBox.left; anchors.right: legendModelCheckBox.right; @@ -343,7 +343,7 @@ Item Layout.fillWidth: true Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height Layout.preferredWidth: UM.Theme.getSize("layerview_row").width - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("button_text") font: UM.Theme.getFont("default") } } diff --git a/plugins/PluginBrowser/PluginBrowser.qml b/plugins/PluginBrowser/PluginBrowser.qml index 494e09e26b..f8a4001443 100644 --- a/plugins/PluginBrowser/PluginBrowser.qml +++ b/plugins/PluginBrowser/PluginBrowser.qml @@ -9,10 +9,10 @@ UM.Dialog id: base title: catalog.i18nc("@title:window", "Find & Update plugins") - width: 600 - height: 450 - minimumWidth: 350 - minimumHeight: 350 + width: 600 * Screen.devicePixelRatio + height: 450 * Screen.devicePixelRatio + minimumWidth: 350 * Screen.devicePixelRatio + minimumHeight: 350 * Screen.devicePixelRatio Item { anchors.fill: parent diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 96c511bccb..450f92a6e3 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -326,16 +326,20 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): return True def _stopCamera(self): + self._stream_buffer = b"" + self._stream_buffer_start_index = -1 + if self._camera_timer.isActive(): self._camera_timer.stop() - if self._image_reply: - try: - self._image_reply.abort() - self._image_reply.downloadProgress.disconnect(self._onStreamDownloadProgress) - except RuntimeError: - pass # It can happen that the wrapped c++ object is already deleted. - self._image_reply = None - self._image_request = None + + if self._image_reply: + try: + self._image_reply.abort() + self._image_reply.downloadProgress.disconnect(self._onStreamDownloadProgress) + except RuntimeError: + pass # It can happen that the wrapped c++ object is already deleted. + self._image_reply = None + self._image_request = None def _startCamera(self): if self._use_stream: @@ -1095,8 +1099,11 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): global_container_stack.setMetaDataEntry("network_authentication_id", self._authentication_id) else: global_container_stack.addMetaDataEntry("network_authentication_id", self._authentication_id) - Application.getInstance().saveStack(global_container_stack) # Force save so we are sure the data is not lost. - Logger.log("i", "Authentication succeeded for id %s and key %s", self._authentication_id, self._getSafeAuthKey()) + Logger.log("i", "Authentication succeeded for id %s and key %s", self._authentication_id, self._getSafeAuthKey()) + Application.getInstance().saveStack(global_container_stack) # Force save so we are sure the data is not lost. + else: + Logger.log("w", "Unable to save authentication for id %s and key %s", self._authentication_id, self._getSafeAuthKey()) + else: # Got a response that we didn't expect, so something went wrong. Logger.log("e", "While trying to authenticate, we got an unexpected response: %s", reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)) self.setAuthenticationState(AuthState.NotAuthenticated) @@ -1165,6 +1172,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): return self._stream_buffer += self._image_reply.readAll() + if len(self._stream_buffer) > 2000000: # No single camera frame should be 2 Mb or larger + Logger.log("w", "MJPEG buffer exceeds reasonable size. Restarting stream...") + self._stopCamera() # resets stream buffer and start index + self._startCamera() + return + if self._stream_buffer_start_index == -1: self._stream_buffer_start_index = self._stream_buffer.indexOf(b'\xff\xd8') stream_buffer_end_index = self._stream_buffer.lastIndexOf(b'\xff\xd9') diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 4220fec011..817da65247 100755 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -869,7 +869,7 @@ "description": "The extruder train used for printing the outer wall. This is used in multi-extrusion.", "type": "optional_extruder", "default_value": "-1", - "settable_per_mesh": true, + "settable_per_mesh": false, "settable_per_extruder": false, "settable_per_meshgroup": true, "settable_globally": true, @@ -881,7 +881,7 @@ "description": "The extruder train used for printing the inner walls. This is used in multi-extrusion.", "type": "optional_extruder", "default_value": "-1", - "settable_per_mesh": true, + "settable_per_mesh": false, "settable_per_extruder": false, "settable_per_meshgroup": true, "settable_globally": true, @@ -936,7 +936,7 @@ "type": "optional_extruder", "default_value": "-1", "value": "top_bottom_extruder_nr", - "settable_per_mesh": true, + "settable_per_mesh": false, "settable_per_extruder": false, "settable_per_meshgroup": true, "settable_globally": true, @@ -989,7 +989,7 @@ "description": "The extruder train used for printing the top and bottom skin. This is used in multi-extrusion.", "type": "optional_extruder", "default_value": "-1", - "settable_per_mesh": true, + "settable_per_mesh": false, "settable_per_extruder": false, "settable_per_meshgroup": true, "settable_globally": true, @@ -1312,7 +1312,7 @@ "description": "The extruder train used for printing infill. This is used in multi-extrusion.", "type": "optional_extruder", "default_value": "-1", - "settable_per_mesh": true, + "settable_per_mesh": false, "settable_per_extruder": false, "settable_per_meshgroup": true, "settable_globally": true, @@ -3015,7 +3015,7 @@ "unit": "mm", "type": "float", "default_value": 0.0, - "minimum_value": "0", + "minimum_value": "machine_width / -2 if machine_center_is_zero else 0", "settable_per_mesh": false, "settable_per_extruder": true, "settable_per_meshgroup": true @@ -3027,7 +3027,7 @@ "unit": "mm", "type": "float", "default_value": 0.0, - "minimum_value": "0", + "minimum_value": "machine_depth / -2 if machine_center_is_zero else 0", "settable_per_mesh": false, "settable_per_extruder": true, "settable_per_meshgroup": true diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 35048925eb..094e138fbd 100755 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -353,28 +353,6 @@ UM.MainWindow action: Cura.Actions.open; } - Image - { - id: logo - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width; - bottom: parent.bottom - bottomMargin: UM.Theme.getSize("default_margin").height; - } - - source: UM.Theme.getImage("logo"); - width: UM.Theme.getSize("logo").width; - height: UM.Theme.getSize("logo").height; - z: -1; - - sourceSize.width: width; - sourceSize.height: height; - } - - - Toolbar { id: toolbar; diff --git a/resources/qml/ExtruderButton.qml b/resources/qml/ExtruderButton.qml index 296964448b..039158280a 100644 --- a/resources/qml/ExtruderButton.qml +++ b/resources/qml/ExtruderButton.qml @@ -16,7 +16,7 @@ Button text: catalog.i18ncp("@label %1 is filled in with the name of an extruder", "Print Selected Model with %1", "Print Selected Models with %1", UM.Selection.selectionCount).arg(extruder.name) style: UM.Theme.styles.tool_button; - iconSource: checked ? UM.Theme.getIcon("material_selected") : UM.Theme.getIcon("material_not_selected"); + iconSource: UM.Theme.getIcon("extruder_button") checked: ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1 enabled: UM.Selection.hasSelection @@ -36,12 +36,7 @@ Button Item { - anchors - { - right: parent.right; - top: parent.top; - margins: UM.Theme.getSize("default_lining").width * 3 - } + anchors.centerIn: parent width: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("default_margin").height @@ -54,22 +49,28 @@ Button } } + // Material colour circle + // Only draw the filling colour of the material inside the SVG border. Rectangle { anchors { - left: parent.left; - top: parent.top; - margins: UM.Theme.getSize("default_lining").width * 3 + right: parent.right + top: parent.top + rightMargin: UM.Theme.getSize("extruder_button_material_margin").width + topMargin: UM.Theme.getSize("extruder_button_material_margin").height } color: model.color - width: UM.Theme.getSize("default_margin").width - height: UM.Theme.getSize("default_margin").height + width: UM.Theme.getSize("extruder_button_material").width + height: UM.Theme.getSize("extruder_button_material").height + radius: width / 2 - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining"); + border.width: 1 + border.color: UM.Theme.getColor("extruder_button_material_border") + + opacity: !base.enabled ? 0.2 : 1.0 } onClicked: diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index b2f63dc708..0f70022efc 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -13,13 +13,7 @@ Item { id: base property bool activity: CuraApplication.platformActivity - property string fileBaseName - property variant activeMachineName: Cura.MachineManager.activeMachineName - - onActiveMachineNameChanged: - { - printJobTextfield.text = PrintInformation.createJobName(base.fileBaseName); - } + property string fileBaseName: "" UM.I18nCatalog { id: catalog; name:"cura"} @@ -30,23 +24,26 @@ Item { target: backgroundItem onHasMesh: { - base.fileBaseName = name + if (base.fileBaseName == "") + { + base.fileBaseName = name; + } } } onActivityChanged: { if (activity == true && base.fileBaseName == ''){ //this only runs when you open a file from the terminal (or something that works the same way; for example when you drag a file on the icon in MacOS or use 'open with' on Windows) - base.fileBaseName = PrintInformation.jobName; //get the fileBaseName from PrintInformation.py because this saves the filebase when the file is opened using the terminal (or something alike) - printJobTextfield.text = PrintInformation.createJobName(base.fileBaseName); + base.fileBaseName = PrintInformation.baseName; //get the fileBaseName from PrintInformation.py because this saves the filebase when the file is opened using the terminal (or something alike) + PrintInformation.setBaseName(base.fileBaseName); } if (activity == true && base.fileBaseName != ''){ //this runs in all other cases where there is a mesh on the buildplate (activity == true). It uses the fileBaseName from the hasMesh signal - printJobTextfield.text = PrintInformation.createJobName(base.fileBaseName); + PrintInformation.setBaseName(base.fileBaseName); } if (activity == false){ //When there is no mesh in the buildplate; the printJobTextField is set to an empty string so it doesn't set an empty string as a jobName (which is later used for saving the file) - printJobTextfield.text = ''; + PrintInformation.setJobName('') } } @@ -102,7 +99,7 @@ Item { width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50) maximumLength: 120 property int unremovableSpacing: 5 - text: '' + text: PrintInformation.jobName horizontalAlignment: TextInput.AlignRight onTextChanged: { PrintInformation.setJobName(text); diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index 15496eaa8b..ac9f6a29eb 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -97,36 +97,36 @@ SettingItem } label: Item { + Label + { + id: extruderText + anchors.verticalCenter: parent.verticalCenter + + text: control.currentText + font: UM.Theme.getFont("default") + color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + + elide: Text.ElideLeft + verticalAlignment: Text.AlignVCenter + } Rectangle { id: swatch height: UM.Theme.getSize("setting_control").height / 2 width: height - anchors.verticalCenter: parent.verticalCenter - - border.width: UM.Theme.getSize("default_lining").width - border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") - - color: control.color - } - Label - { anchors { - left: swatch.right; - right: arrow.left; + right: arrow.left verticalCenter: parent.verticalCenter - margins: UM.Theme.getSize("default_lining").width + margins: UM.Theme.getSize("default_margin").width / 4 } - width: parent.width - swatch.width; - text: control.currentText - font: UM.Theme.getFont("default") - color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + border.width: UM.Theme.getSize("default_lining").width * 2 + border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") + radius: width / 2 - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter + color: control.color } UM.RecolorImage { diff --git a/resources/qml/Settings/SettingOptionalExtruder.qml b/resources/qml/Settings/SettingOptionalExtruder.qml index 0fd36564a1..4e49f0440e 100644 --- a/resources/qml/Settings/SettingOptionalExtruder.qml +++ b/resources/qml/Settings/SettingOptionalExtruder.qml @@ -116,29 +116,10 @@ SettingItem } label: Item { - Rectangle - { - id: swatch - height: UM.Theme.getSize("setting_control").height / 2 - width: height - - anchors.verticalCenter: parent.verticalCenter - - border.width: UM.Theme.getSize("default_lining").width - border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") - - color: control.color - } Label { - anchors - { - left: swatch.right; - right: arrow.left; - verticalCenter: parent.verticalCenter - margins: UM.Theme.getSize("default_lining").width - } - width: parent.width - swatch.width; + anchors.verticalCenter: parent.verticalCenter + width: parent.width - swatch.width - arrow.width; text: control.currentText font: UM.Theme.getFont("default") @@ -147,6 +128,25 @@ SettingItem elide: Text.ElideRight verticalAlignment: Text.AlignVCenter } + Rectangle + { + id: swatch + height: UM.Theme.getSize("setting_control").height / 2 + width: height + + anchors + { + right: arrow.left; + verticalCenter: parent.verticalCenter + margins: UM.Theme.getSize("default_margin").width / 4 + } + + border.width: UM.Theme.getSize("default_lining").width * 2 + border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") + radius: width / 2 + + color: control.color + } UM.RecolorImage { id: arrow diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index be0b12af19..ce13a5eddf 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -121,7 +121,7 @@ Rectangle anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.top: headerSeparator.bottom anchors.topMargin: UM.Theme.getSize("sidebar_margin").height - width: parent.width * 0.45 - 2 * UM.Theme.getSize("sidebar_margin").width + width: parent.width * 0.45 font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") visible: !monitoringPrint @@ -181,7 +181,7 @@ Rectangle color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") : control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text") - font: UM.Theme.getFont("default") + font: (control.checked || control.pressed) ? UM.Theme.getFont("default_bold") : UM.Theme.getFont("default") text: control.text; } } @@ -223,7 +223,7 @@ Rectangle { id: globalProfileLabel text: catalog.i18nc("@label","Profile:"); - width: parent.width * 0.45 - UM.Theme.getSize("sidebar_margin").width + width: parent.width * 0.45 - UM.Theme.getSize("sidebar_margin").width - 2 font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); verticalAlignment: Text.AlignVCenter @@ -247,7 +247,7 @@ Rectangle } enabled: !header.currentExtruderVisible || header.currentExtruderIndex > -1 - width: parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width + width: parent.width * 0.55 height: UM.Theme.getSize("setting_control").height anchors.left: globalProfileLabel.right anchors.right: parent.right diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 606e629b45..d42fc8b262 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -17,28 +17,51 @@ Column property int currentExtruderIndex: ExtruderManager.activeExtruderIndex; property bool currentExtruderVisible: extrudersList.visible; - spacing: UM.Theme.getSize("sidebar_margin").height + spacing: UM.Theme.getSize("sidebar_margin").width * 0.9 signal showTooltip(Item item, point location, string text) signal hideTooltip() + Item + { + anchors + { + left: parent.left + right: parent.right + } + visible: extruderSelectionRow.visible + height: UM.Theme.getSize("default_lining").height + width: height + } + + Item + { + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("sidebar_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("sidebar_margin").width + } + visible: extruderSelectionRow.visible + height: UM.Theme.getSize("default_lining").hieght + width: height + } + Item { id: extruderSelectionRow width: parent.width - height: UM.Theme.getSize("sidebar_tabs").height + height: UM.Theme.getSize("sidebar_tabs").height * 2 / 3 visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint - Rectangle + anchors { - id: extruderSeparator - visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint - - width: parent.width - height: parent.height - color: UM.Theme.getColor("sidebar_lining") - - anchors.top: extruderSelectionRow.top + left: parent.left + leftMargin: UM.Theme.getSize("sidebar_margin").width * 0.7 + right: parent.right + rightMargin: UM.Theme.getSize("sidebar_margin").width * 0.7 + topMargin: UM.Theme.getSize("sidebar_margin").height } ListView @@ -53,8 +76,10 @@ Column anchors { left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width / 2 right: parent.right - bottom: extruderSelectionRow.bottom + rightMargin: UM.Theme.getSize("default_margin").width / 2 + verticalCenter: parent.verticalCenter } ExclusiveGroup { id: extruderMenuGroup; } @@ -92,61 +117,116 @@ Column style: ButtonStyle { - background: Rectangle + background: Item { - border.width: UM.Theme.getSize("default_lining").width - border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : - control.pressed ? UM.Theme.getColor("tab_active_border") : - control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") - color: control.checked ? UM.Theme.getColor("tab_checked") : - control.pressed ? UM.Theme.getColor("tab_active") : - control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") - Behavior on color { ColorAnimation { duration: 50; } } - Rectangle { - id: highlight - visible: control.checked - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - height: UM.Theme.getSize("sidebar_header_highlight").height - color: UM.Theme.getColor("sidebar_header_bar") - } - - Rectangle - { - id: swatch - visible: index > -1 - height: UM.Theme.getSize("setting_control").height / 2 - width: height - anchors.left: parent.left - anchors.leftMargin: (parent.height - height) / 2 - anchors.verticalCenter: parent.verticalCenter - - color: model.color + anchors.fill: parent border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("setting_control_border") + border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : + UM.Theme.getColor("action_button_border") + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : + UM.Theme.getColor("action_button") + Behavior on color { ColorAnimation { duration: 50; } } } - Text + Item { - anchors.verticalCenter: parent.verticalCenter - anchors.left: swatch.visible ? swatch.right : parent.left - anchors.leftMargin: swatch.visible ? UM.Theme.getSize("sidebar_margin").width / 2 : UM.Theme.getSize("sidebar_margin").width - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width / 2 + id: extruderButtonFace + anchors.centerIn: parent + width: { + var extruderTextWidth = extruderStaticText.visible ? extruderStaticText.width : 0; + var iconWidth = extruderIconItem.width; + return extruderTextWidth + iconWidth + UM.Theme.getSize("default_margin").width / 2; + } - color: control.checked ? UM.Theme.getColor("tab_checked_text") : - control.pressed ? UM.Theme.getColor("tab_active_text") : - control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") + // Static text "Extruder" + Text + { + id: extruderStaticText + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left - font: UM.Theme.getFont("default") - text: control.text - elide: Text.ElideRight + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") : + control.hovered ? UM.Theme.getColor("action_button_hovered_text") : + UM.Theme.getColor("action_button_text") + + font: control.checked ? UM.Theme.getFont("default_bold") : UM.Theme.getFont("default") + text: catalog.i18nc("@label", "Extruder") + visible: width < (control.width - extruderIconItem.width - UM.Theme.getSize("default_margin").width) + elide: Text.ElideRight + } + + // Everthing for the extruder icon + Item + { + id: extruderIconItem + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + + property var sizeToUse: + { + var minimumWidth = control.width < UM.Theme.getSize("button").width ? control.width : UM.Theme.getSize("button").width; + var minimumHeight = control.height < UM.Theme.getSize("button").height ? control.height : UM.Theme.getSize("button").height; + var minimumSize = minimumWidth < minimumHeight ? minimumWidth : minimumHeight; + minimumSize -= UM.Theme.getSize("default_margin").width / 2; + return minimumSize; + } + + width: sizeToUse + height: sizeToUse + + UM.RecolorImage { + id: mainCircle + anchors.fill: parent + + sourceSize.width: parent.width + sourceSize.height: parent.width + source: UM.Theme.getIcon("extruder_button") + + color: extruderNumberText.color + } + + Text + { + id: extruderNumberText + anchors.centerIn: parent + text: index + 1; + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") : + control.hovered ? UM.Theme.getColor("action_button_hovered_text") : + UM.Theme.getColor("action_button_text") + font: UM.Theme.getFont("default_bold") + } + + // Material colour circle + // Only draw the filling colour of the material inside the SVG border. + Rectangle + { + anchors + { + right: parent.right + top: parent.top + rightMargin: parent.sizeToUse * 0.01 + topMargin: parent.sizeToUse * 0.05 + } + + color: model.color + + width: parent.width * 0.35 + height: parent.height * 0.35 + radius: width / 2 + + border.width: 1 + border.color: UM.Theme.getColor("extruder_button_material_border") + + opacity: !control.checked ? 0.6 : 1.0 + } + } } } - label: Item { } + label: Item {} } } } @@ -260,7 +340,7 @@ Column Item { id: materialInfoRow - height: UM.Theme.getSize("sidebar_setup").height + height: UM.Theme.getSize("sidebar_setup").height / 2 visible: (Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials) && !sidebar.monitoringPrint && !sidebar.hideSettings anchors @@ -277,14 +357,31 @@ Column anchors.right: parent.right width: parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width + UM.RecolorImage + { + id: warningImage + anchors.right: materialInfoLabel.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.Bottom + source: UM.Theme.getIcon("warning") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + //sourceSize.width: width + 5 + //sourceSize.height: width + 5 + + color: UM.Theme.getColor("material_compatibility_warning") + visible: !Cura.MachineManager.isCurrentSetupSupported + } + Text { id: materialInfoLabel wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "Check material compability"); + text: catalog.i18nc("@label", "Check material compatibility") font: UM.Theme.getFont("default"); - verticalAlignment: Text.AlignVCenter + verticalAlignment: Text.AlignTop anchors.top: parent.top + anchors.right: parent.right anchors.bottom: parent.bottom color: UM.Theme.getColor("text") @@ -314,21 +411,6 @@ Column onExited: base.hideTooltip(); } } - - UM.RecolorImage - { - id: warningImage - anchors.right: parent.right - anchors.verticalCenter: parent.Bottom - source: UM.Theme.getIcon("warning") - width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height - //sourceSize.width: width + 5 - //sourceSize.height: width + 5 - - color: UM.Theme.getColor("setting_validation_warning") - visible: !Cura.MachineManager.isCurrentSetupSupported - } } } diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 5b65f948a2..bd2c7ab3b7 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -40,7 +40,7 @@ Item id: infillCellLeft anchors.top: parent.top anchors.left: parent.left - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 0.8 width: UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width height: childrenRect.height @@ -276,7 +276,7 @@ Item property alias _hovered: enableSupportMouseArea.containsMouse anchors.top: infillCellRight.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2 + anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.left: infillCellRight.left style: UM.Theme.styles.checkbox; diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 3e612b1478..1b9f6cad65 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -16,7 +16,7 @@ Rectangle anchors.left: parent.left anchors.right: parent.right height: UM.Theme.getSize("sidebar_header").height - color: UM.Theme.getColor("sidebar_header_bar") + color: "transparent" property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands @@ -29,9 +29,25 @@ Rectangle name:"cura" } + Image + { + id: logo + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + + source: UM.Theme.getImage("logo"); + width: UM.Theme.getSize("logo").width; + height: UM.Theme.getSize("logo").height; + + sourceSize.width: width; + sourceSize.height: height; + } + Row { - anchors.left: parent.left + anchors.left: logo.right + anchors.leftMargin: UM.Theme.getSize("topbar_logo_right_margin").width anchors.right: machineSelection.left anchors.rightMargin: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width @@ -41,7 +57,6 @@ Rectangle id: showSettings height: UM.Theme.getSize("sidebar_header").height onClicked: base.stopMonitoringPrint() - iconSource: UM.Theme.getIcon("tab_settings"); property color overlayColor: "transparent" property string overlayIconSource: "" text: catalog.i18nc("@title:tab", "Prepare") @@ -49,53 +64,21 @@ Rectangle checked: !base.monitoringPrint exclusiveGroup: sidebarHeaderBarGroup - style: UM.Theme.styles.topbar_header_tab + style: UM.Theme.styles.topbar_header_tab } Button { id: showMonitor + width: UM.Theme.getSize("topbar_button").width height: UM.Theme.getSize("sidebar_header").height onClicked: base.startMonitoringPrint() text: catalog.i18nc("@title:tab", "Monitor") - iconSource: UM.Theme.getIcon("tab_monitor") - property color overlayColor: - { - if(!printerAcceptsCommands) - { - return UM.Theme.getColor("status_unknown"); - } - - if(Cura.MachineManager.printerOutputDevices[0].printerState == "maintenance") - { - return UM.Theme.getColor("status_busy"); - } - switch(Cura.MachineManager.printerOutputDevices[0].jobState) - { - case "printing": - case "pre_print": - case "wait_cleanup": - case "pausing": - case "resuming": - return UM.Theme.getColor("status_busy"); - case "ready": - case "": - return UM.Theme.getColor("status_ready"); - case "paused": - return UM.Theme.getColor("status_paused"); - case "error": - return UM.Theme.getColor("status_stopped"); - case "offline": - return UM.Theme.getColor("status_offline"); - default: - return UM.Theme.getColor("text_reversed"); - } - } - property string overlayIconSource: + property string iconSource: { if(!printerConnected) { - return ""; + return UM.Theme.getIcon("tab_status_unknown"); } else if(!printerAcceptsCommands) { @@ -111,10 +94,11 @@ Rectangle { case "printing": case "pre_print": - case "wait_cleanup": case "pausing": case "resuming": return UM.Theme.getIcon("tab_status_busy"); + case "wait_cleanup": + return UM.Theme.getIcon("tab_status_finished"); case "ready": case "": return UM.Theme.getIcon("tab_status_connected") @@ -123,7 +107,7 @@ Rectangle case "error": return UM.Theme.getIcon("tab_status_stopped") default: - return "" + return UM.Theme.getIcon("tab_status_unknown") } } @@ -131,18 +115,19 @@ Rectangle checked: base.monitoringPrint exclusiveGroup: sidebarHeaderBarGroup - style: UM.Theme.styles.topbar_header_tab + style: UM.Theme.styles.topbar_header_tab_no_overlay } ExclusiveGroup { id: sidebarHeaderBarGroup } } + ToolButton { id: machineSelection text: Cura.MachineManager.activeMachineName - width: UM.Theme.getSize("sidebar").width; + width: UM.Theme.getSize("sidebar").width height: UM.Theme.getSize("sidebar_header").height tooltip: Cura.MachineManager.activeMachineName @@ -199,7 +184,7 @@ Rectangle text: control.text; elide: Text.ElideRight; anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2 anchors.right: downArrow.left; anchors.rightMargin: control.rightMargin; anchors.verticalCenter: parent.verticalCenter; diff --git a/resources/themes/cura-light/icons/extruder_button.svg b/resources/themes/cura-light/icons/extruder_button.svg new file mode 100644 index 0000000000..e3c01b6a0a --- /dev/null +++ b/resources/themes/cura-light/icons/extruder_button.svg @@ -0,0 +1,64 @@ + + + + + + image/svg+xml + + Artboard 3 Copy + + + + + + Artboard 3 Copy + Created with Sketch. + + + diff --git a/resources/themes/cura-light/icons/material_not_selected.svg b/resources/themes/cura-light/icons/material_not_selected.svg deleted file mode 100644 index 9b3cad88bd..0000000000 --- a/resources/themes/cura-light/icons/material_not_selected.svg +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - image/svg+xml - - Artboard 3 - - - - - - Artboard 3 - Created with Sketch. - - - - - - - - - - diff --git a/resources/themes/cura-light/icons/material_selected.svg b/resources/themes/cura-light/icons/material_selected.svg deleted file mode 100644 index 6589eac416..0000000000 --- a/resources/themes/cura-light/icons/material_selected.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - image/svg+xml - - Artboard 3 Copy - - - - - - Artboard 3 Copy - Created with Sketch. - - - - - - - - - - diff --git a/resources/themes/cura-light/icons/tab_monitor.svg b/resources/themes/cura-light/icons/tab_monitor.svg deleted file mode 100644 index afc661a22d..0000000000 --- a/resources/themes/cura-light/icons/tab_monitor.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_settings.svg b/resources/themes/cura-light/icons/tab_settings.svg deleted file mode 100644 index e2a4860647..0000000000 --- a/resources/themes/cura-light/icons/tab_settings.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/resources/themes/cura-light/icons/tab_status_busy.svg b/resources/themes/cura-light/icons/tab_status_busy.svg index cf8e384d88..debe4f6360 100644 --- a/resources/themes/cura-light/icons/tab_status_busy.svg +++ b/resources/themes/cura-light/icons/tab_status_busy.svg @@ -1,9 +1,13 @@ - - - - - - + + + Busy + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_connected.svg b/resources/themes/cura-light/icons/tab_status_connected.svg index 56aecdf0a7..a8ff015a9d 100644 --- a/resources/themes/cura-light/icons/tab_status_connected.svg +++ b/resources/themes/cura-light/icons/tab_status_connected.svg @@ -1,7 +1,13 @@ - - - - + + + Connected + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_finished.svg b/resources/themes/cura-light/icons/tab_status_finished.svg new file mode 100644 index 0000000000..2519f2f862 --- /dev/null +++ b/resources/themes/cura-light/icons/tab_status_finished.svg @@ -0,0 +1,13 @@ + + + + Wait cleanup + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_paused.svg b/resources/themes/cura-light/icons/tab_status_paused.svg index 0ec744ad86..bab6c9ca6b 100644 --- a/resources/themes/cura-light/icons/tab_status_paused.svg +++ b/resources/themes/cura-light/icons/tab_status_paused.svg @@ -1,8 +1,13 @@ - - - - - + + + paused + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_stopped.svg b/resources/themes/cura-light/icons/tab_status_stopped.svg index ec1afaec81..c9b150db3a 100644 --- a/resources/themes/cura-light/icons/tab_status_stopped.svg +++ b/resources/themes/cura-light/icons/tab_status_stopped.svg @@ -1,8 +1,13 @@ - - - - - + + + Aborted + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_unknown.svg b/resources/themes/cura-light/icons/tab_status_unknown.svg index 382a2b2d8b..f195ae238a 100644 --- a/resources/themes/cura-light/icons/tab_status_unknown.svg +++ b/resources/themes/cura-light/icons/tab_status_unknown.svg @@ -1,8 +1,15 @@ - - - - - + + + Unknown + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 2d40a0e8d0..bb2b57509a 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -90,36 +90,100 @@ QtObject { } } + property Component topbar_header_tab_no_overlay: Component { + ButtonStyle { + background: Rectangle { + implicitHeight: Theme.getSize("topbar_button").height + implicitWidth: Theme.getSize("topbar_button").width + color: "transparent" + anchors.fill: parent + + Rectangle + { + id: underline + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + width: parent.width + height: Theme.getSize("sidebar_header_highlight").height + color: control.checked ? UM.Theme.getColor("sidebar_header_highlight") : "transparent" + visible: control.hovered || control.checked + } + } + + label: Rectangle { + implicitHeight: Theme.getSize("topbar_button_icon").height + implicitWidth: Theme.getSize("topbar_button").width + color: "transparent" + anchors.fill: parent + + Item + { + anchors.centerIn: parent + width: textLabel.width + icon.width + Theme.getSize("default_margin").width / 2 + Label + { + id: textLabel + text: control.text + anchors.right: icon.visible ? icon.left : parent.right + anchors.rightMargin: icon.visible ? Theme.getSize("default_margin").width / 2 : 0 + anchors.verticalCenter: parent.verticalCenter; + font: control.checked ? UM.Theme.getFont("large") : UM.Theme.getFont("large_nonbold") + color: + { + if(control.hovered) + { + return UM.Theme.getColor("topbar_button_text_hovered"); + } + if(control.checked) + { + return UM.Theme.getColor("topbar_button_text_active"); + } + else + { + return UM.Theme.getColor("topbar_button_text_inactive"); + } + } + } + Image + { + id: icon + visible: control.iconSource != "" + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + opacity: !control.enabled ? 0.2 : 1.0 + source: control.iconSource + width: visible ? Theme.getSize("topbar_button_icon").width : 0 + height: Theme.getSize("topbar_button_icon").height + + sourceSize: Theme.getSize("topbar_button_icon") + } + } + } + } + } + property Component topbar_header_tab: Component { ButtonStyle { background: Item { - implicitWidth: Theme.getSize("topbar_button").width; - implicitHeight: Theme.getSize("topbar_button").height; + implicitHeight: Theme.getSize("topbar_button").height + implicitWidth: Theme.getSize("topbar_button").width + Theme.getSize("topbar_button_icon").width Rectangle { id: buttonFace; - anchors.fill: parent; - property bool down: control.pressed || (control.checkable && control.checked); - color: { - if(control.pressed || (control.checkable && control.checked)) { - return Theme.getColor("sidebar_header_active"); - } else if(control.hovered) { - return Theme.getColor("sidebar_header_hover"); - } else { - return Theme.getColor("sidebar_header_bar"); - } - } + color: "transparent" Behavior on color { ColorAnimation { duration: 50; } } Rectangle { id: underline; - anchors.left: parent.left - anchors.right: parent.right + anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom - height: UM.Theme.getSize("sidebar_header_highlight").height + width: Theme.getSize("topbar_button").width + Theme.getSize("topbar_button_icon").width + height: Theme.getSize("sidebar_header_highlight").height color: control.checked ? UM.Theme.getColor("sidebar_header_highlight") : UM.Theme.getColor("sidebar_header_highlight_hover") visible: control.hovered || control.checked } @@ -129,57 +193,60 @@ QtObject { label: Item { implicitHeight: Theme.getSize("topbar_button_icon").height - implicitWidth: Theme.getSize("topbar_button").width; + implicitWidth: Theme.getSize("topbar_button").width + Theme.getSize("topbar_button_icon").width Item { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter; width: childrenRect.width height: Theme.getSize("topbar_button_icon").height - UM.RecolorImage - { - id: icon - color: UM.Theme.getColor("text_emphasis") - opacity: !control.enabled ? 0.2 : 1.0 - source: control.iconSource - width: Theme.getSize("topbar_button_icon").width - height: Theme.getSize("topbar_button_icon").height - - sourceSize: Theme.getSize("topbar_button_icon") - } - Image - { - visible: control.overlayIconSource != "" - opacity: !control.enabled ? 0.2 : 1.0 - source: control.overlayIconSource - width: Theme.getSize("topbar_button_icon").width - height: Theme.getSize("topbar_button_icon").height - - sourceSize: Theme.getSize("topbar_button_icon") - } Label { text: control.text; - anchors.left: icon.right - anchors.leftMargin: Theme.getSize("default_margin").width + anchors.right: (icon.visible || overlayIcon.visible) ? icon.left : parent.right + anchors.rightMargin: (icon.visible || overlayIcon.visible) ? Theme.getSize("default_margin").width : 0 anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.getFont("large"); + font: control.checked ? UM.Theme.getFont("large") : UM.Theme.getFont("large_nonbold") color: { if(control.hovered) { - return UM.Theme.getColor("sidebar_header_text_hover"); + return UM.Theme.getColor("topbar_button_text_hovered"); } if(control.checked) { - return UM.Theme.getColor("sidebar_header_text_active"); + return UM.Theme.getColor("topbar_button_text_active"); } else { - return UM.Theme.getColor("sidebar_header_text_inactive"); + return UM.Theme.getColor("topbar_button_text_inactive"); } } } + UM.RecolorImage + { + visible: control.iconSource != "" + id: icon + color: UM.Theme.getColor("text_emphasis") + opacity: !control.enabled ? 0.2 : 1.0 + source: control.iconSource + width: visible ? Theme.getSize("topbar_button_icon").width : 0 + height: Theme.getSize("topbar_button_icon").height + + sourceSize: Theme.getSize("topbar_button_icon") + } + UM.RecolorImage + { + id: overlayIcon + visible: control.overlayIconSource != "" && control.iconSource != "" + color: control.overlayColor + opacity: !control.enabled ? 0.2 : 1.0 + source: control.overlayIconSource + width: visible ? Theme.getSize("topbar_button_icon").width : 0 + height: Theme.getSize("topbar_button_icon").height + + sourceSize: Theme.getSize("topbar_button_icon") + } } } } @@ -242,6 +309,8 @@ QtObject { } Behavior on color { ColorAnimation { duration: 50; } } + border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 : 0 + border.color: Theme.getColor("tool_button_border") UM.RecolorImage { id: tool_button_arrow @@ -612,24 +681,11 @@ QtObject { } label: Item { - Rectangle - { - id: swatch - height: UM.Theme.getSize("setting_control").height / 2 - width: height - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_lining").width - anchors.verticalCenter: parent.verticalCenter - - color: if (control.color_override != "") {return control.color_override} else {return control.color;} - border.width: UM.Theme.getSize("default_lining").width - border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border") - } Label { - anchors.left: swatch.right + anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_lining").width - anchors.right: downArrow.left + anchors.right: swatch.left anchors.rightMargin: UM.Theme.getSize("default_lining").width anchors.verticalCenter: parent.verticalCenter @@ -640,7 +696,25 @@ QtObject { elide: Text.ElideRight verticalAlignment: Text.AlignVCenter } + Rectangle + { + id: swatch + height: UM.Theme.getSize("setting_control").height / 2 + width: height + anchors + { + right: downArrow.left; + verticalCenter: parent.verticalCenter + margins: UM.Theme.getSize("default_margin").width / 4 + } + + border.width: UM.Theme.getSize("default_lining").width * 2 + border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") + radius: width / 2 + + color: if (control.color_override != "") {return control.color_override} else {return control.color;} + } UM.RecolorImage { id: downArrow diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index eb9fb72db6..c1c855513f 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -9,6 +9,10 @@ "bold": true, "family": "Open Sans" }, + "large_nonbold": { + "size": 1.25, + "family": "Open Sans" + }, "default": { "size": 1.15, "family": "Open Sans" @@ -50,7 +54,7 @@ "colors": { "sidebar": [255, 255, 255, 255], - "lining": [127, 127, 127, 255], + "lining": [192, 193, 194, 255], "viewport_overlay": [24, 41, 77, 192], "primary": [12, 169, 227, 255], @@ -59,32 +63,36 @@ "border": [127, 127, 127, 255], "secondary": [245, 245, 245, 255], - "text": [24, 41, 77, 255], + "topbar_button_text_active": [0, 0, 0, 255], + "topbar_button_text_inactive": [128, 128, 128, 255], + "topbar_button_text_hovered": [0, 0, 0, 255], + + "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], "text_link": [12, 169, 227, 255], "text_inactive": [174, 174, 174, 255], "text_hover": [70, 84, 113, 255], "text_pressed": [12, 169, 227, 255], - "text_subtext": [70, 84, 113, 255], + "text_subtext": [0, 0, 0, 255], "text_emphasis": [255, 255, 255, 255], "text_scene": [24, 41, 77, 255], "text_scene_hover": [70, 84, 113, 255], "error": [255, 140, 0, 255], - "sidebar_header_bar": [24, 41, 77, 255], - "sidebar_header_active": [70, 84, 113, 255], - "sidebar_header_hover": [24, 41, 77, 255], - "sidebar_header_highlight": [12, 169, 227, 255], - "sidebar_header_highlight_hover": [255, 255, 255, 255], + "sidebar_header_bar": [31, 36, 39, 255], + "sidebar_header_active": [68, 72, 75, 255], + "sidebar_header_hover": [68, 72, 75, 255], + "sidebar_header_highlight": [68, 192, 255, 255], + "sidebar_header_highlight_hover": [68, 192, 255, 255], "sidebar_header_text_inactive": [255, 255, 255, 255], "sidebar_header_text_active": [255, 255, 255, 255], "sidebar_header_text_hover": [255, 255, 255, 255], "sidebar_lining": [245, 245, 245, 255], - "button": [24, 41, 77, 255], - "button_hover": [70, 84, 113, 255], - "button_active": [32, 166, 219, 255], - "button_active_hover": [12, 169, 227, 255], + "button": [31, 36, 39, 255], + "button_hover": [68, 72, 75, 255], + "button_active": [68, 72, 75, 255], + "button_active_hover": [68, 72, 75, 255], "button_text": [255, 255, 255, 255], "button_text_hover": [255, 255, 255, 255], "button_text_active": [255, 255, 255, 255], @@ -92,9 +100,14 @@ "button_disabled": [24, 41, 77, 255], "button_disabled_text": [255, 255, 255, 101], - "button_tooltip": [12, 169, 227, 255], - "button_tooltip_border": [24, 41, 77, 255], - "button_tooltip_text": [24, 41, 77, 255], + "button_tooltip": [31, 36, 39, 255], + "button_tooltip_border": [68, 192, 255, 255], + "button_tooltip_text": [192, 193, 194, 255], + + "extruder_button_material_border": [255, 255, 255, 255], + + "sync_button_text": [120, 120, 120, 255], + "sync_button_text_hovered": [0, 0, 0, 255], "tab_checked": [255, 255, 255, 255], "tab_checked_border": [255, 255, 255, 255], @@ -111,13 +124,13 @@ "tab_background": [245, 245, 245, 255], "action_button": [255, 255, 255, 255], - "action_button_text": [24, 41, 77, 255], + "action_button_text": [0, 0, 0, 255], "action_button_border": [127, 127, 127, 255], "action_button_hovered": [255, 255, 255, 255], "action_button_hovered_text": [24, 41, 77, 255], "action_button_hovered_border": [12, 169, 227, 255], - "action_button_active": [12, 169, 227, 255], - "action_button_active_text": [255, 255, 255, 255], + "action_button_active": [255, 255, 255, 255], + "action_button_active_text": [0, 0, 0, 255], "action_button_active_border": [12, 169, 227, 255], "action_button_disabled": [245, 245, 245, 255], "action_button_disabled_text": [127, 127, 127, 255], @@ -149,7 +162,7 @@ "setting_control_highlight": [255, 255, 255, 0], "setting_control_border": [127, 127, 127, 255], "setting_control_border_highlight": [12, 169, 227, 255], - "setting_control_text": [24, 41, 77, 255], + "setting_control_text": [127, 127, 127, 255], "setting_control_depth_line": [127, 127, 127, 255], "setting_control_button": [127, 127, 127, 255], "setting_control_button_hover": [70, 84, 113, 255], @@ -157,12 +170,14 @@ "setting_control_disabled_text": [127, 127, 127, 255], "setting_control_disabled_border": [127, 127, 127, 255], "setting_unit": [127, 127, 127, 255], - "setting_validation_error_background": [255, 57, 14, 255], + "setting_validation_error_background": [255, 66, 60, 255], "setting_validation_error": [127, 127, 127, 255], - "setting_validation_warning_background": [255, 186, 15, 255], + "setting_validation_warning_background": [255, 145, 62, 255], "setting_validation_warning": [127, 127, 127, 255], "setting_validation_ok": [255, 255, 255, 255], + "material_compatibility_warning": [0, 0, 0, 255], + "progressbar_background": [245, 245, 245, 255], "progressbar_control": [24, 41, 77, 255], @@ -175,10 +190,10 @@ "checkbox": [255, 255, 255, 255], "checkbox_hover": [255, 255, 255, 255], - "checkbox_border": [127, 127, 127, 255], + "checkbox_border": [64, 69, 72, 255], "checkbox_border_hover": [12, 169, 227, 255], - "checkbox_mark": [24, 41, 77, 255], - "checkbox_text": [24, 41, 77, 255], + "checkbox_mark": [119, 122, 124, 255], + "checkbox_text": [166, 168, 169, 255], "mode_switch": [255, 255, 255, 255], "mode_switch_hover": [255, 255, 255, 255], @@ -189,9 +204,11 @@ "mode_switch_text_hover": [24, 41, 77, 255], "mode_switch_text_checked": [12, 169, 227, 255], - "tooltip": [12, 169, 227, 255], + "tooltip": [68, 192, 255, 255], "tooltip_text": [255, 255, 255, 255], + "tool_button_border": [39, 44, 48, 255], + "message_background": [24, 41, 77, 255], "message_text": [255, 255, 255, 255], "message_border": [24, 41, 77, 255], @@ -204,7 +221,7 @@ "message_progressbar_background": [255, 255, 255, 255], "message_progressbar_control": [12, 169, 227, 255], - "tool_panel_background": [255, 255, 255, 255], + "tool_panel_background": [31, 36, 39, 255], "status_offline": [0, 0, 0, 255], "status_ready": [0, 205, 0, 255], @@ -259,7 +276,10 @@ "default_margin": [1.0, 1.0], "default_lining": [0.08, 0.08], "default_arrow": [0.8, 0.8], - "logo": [9.5, 2.0], + "logo": [7.6, 1.6], + + "extruder_button_material_margin": [0.50, 0.9], + "extruder_button_material": [0.75, 0.75], "sidebar": [35.0, 10.0], "sidebar_margin": [1.71, 1.43], @@ -297,8 +317,9 @@ "button_icon": [2.5, 2.5], "button_lining": [0, 0], - "topbar_button": [17, 4], - "topbar_button_icon": [3.125, 2.5], + "topbar_logo_right_margin": [3, 0], + "topbar_button": [8, 4], + "topbar_button_icon": [1.2, 1.2], "button_tooltip": [1.0, 1.3], "button_tooltip_arrow": [0.25, 0.25], @@ -332,6 +353,7 @@ "save_button_specs_icons": [1.4, 1.4], "modal_window_minimum": [60.0, 45], + "license_window_minimum": [45, 45], "wizard_progress": [10.0, 0.0], "message": [30.0, 5.0], diff --git a/resources/themes/cura/icons/tab_status_busy.svg b/resources/themes/cura/icons/tab_status_busy.svg deleted file mode 100644 index 7b5774e71b..0000000000 --- a/resources/themes/cura/icons/tab_status_busy.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura/icons/tab_status_connected.svg b/resources/themes/cura/icons/tab_status_connected.svg deleted file mode 100644 index 7997ffbee6..0000000000 --- a/resources/themes/cura/icons/tab_status_connected.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura/icons/tab_status_paused.svg b/resources/themes/cura/icons/tab_status_paused.svg deleted file mode 100644 index 606d4cb96c..0000000000 --- a/resources/themes/cura/icons/tab_status_paused.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura/icons/tab_status_stopped.svg b/resources/themes/cura/icons/tab_status_stopped.svg deleted file mode 100644 index 6cd0f18b17..0000000000 --- a/resources/themes/cura/icons/tab_status_stopped.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura/icons/tab_status_unknown.svg b/resources/themes/cura/icons/tab_status_unknown.svg deleted file mode 100644 index 5e46eec55b..0000000000 --- a/resources/themes/cura/icons/tab_status_unknown.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura/images/logo.svg b/resources/themes/cura/images/logo.svg deleted file mode 100644 index 545b42d193..0000000000 --- a/resources/themes/cura/images/logo.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 3ef5366c9e..46da3cbe7a 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -243,7 +243,7 @@ "button_icon": [2.5, 2.5], "button_lining": [0, 0], - "topbar_button": [17, 4], + "topbar_button": [8, 4], "button_tooltip": [1.0, 1.3], "button_tooltip_arrow": [0.25, 0.25], @@ -278,7 +278,6 @@ "save_button_specs_icons": [1.4, 1.4], "modal_window_minimum": [60.0, 45], - "license_window_minimum": [45, 45], "wizard_progress": [10.0, 0.0], "message": [30.0, 5.0],