mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Added notification icon in recomended mode. The notification icon is only
active if one of custom settings is changed CURA-4333
This commit is contained in:
parent
2cdec7e47f
commit
b318dc7087
3 changed files with 126 additions and 0 deletions
|
@ -400,6 +400,8 @@ class CuraApplication(QtApplication):
|
|||
# ALWAYS ask whether to keep or discard the profile
|
||||
self.showDiscardOrKeepProfileChanges.emit()
|
||||
|
||||
sidebarSimpleDiscardOrKeepProfileChanges = pyqtSignal()
|
||||
|
||||
@pyqtSlot(str)
|
||||
def discardOrKeepProfileChangesClosed(self, option):
|
||||
if option == "discard":
|
||||
|
@ -409,6 +411,10 @@ class CuraApplication(QtApplication):
|
|||
|
||||
global_stack.getTop().clear()
|
||||
|
||||
#event handler for SidebarSimple, which will update sliders view visibility (like:sliders..)
|
||||
if Preferences.getInstance().getValue("cura/active_mode") == 0:
|
||||
self.sidebarSimpleDiscardOrKeepProfileChanges.emit()
|
||||
|
||||
@pyqtSlot(int)
|
||||
def messageBoxClosed(self, button):
|
||||
if self._message_box_callback:
|
||||
|
|
|
@ -413,6 +413,42 @@ class MachineManager(QObject):
|
|||
|
||||
return False
|
||||
|
||||
## Check whether user containers have adjusted settings or not
|
||||
# \param skip_keys \type{list} List of setting keys which will be not taken into account ("support_enable" , "infill_sparse_density"...)
|
||||
# \return \type{boole} Return true if user containers have any of adjusted settings
|
||||
@pyqtSlot("QVariantList", result = bool)
|
||||
def hasUserCustomSettings(self, skip_keys = []) -> bool:
|
||||
|
||||
user_setting_keys = []
|
||||
try:
|
||||
if not self._global_container_stack:
|
||||
return False
|
||||
|
||||
allContainers = self._global_container_stack.getContainers()
|
||||
|
||||
for container in allContainers:
|
||||
meta = container.getMetaData()
|
||||
if meta and meta["type"] and meta["type"] == "user":
|
||||
user_setting_keys.extend(container.getAllKeys())
|
||||
|
||||
stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||
for stack in stacks:
|
||||
|
||||
for container in stack.getContainers():
|
||||
meta = container.getMetaData()
|
||||
if meta and meta["type"] and meta["type"] == "user":
|
||||
user_setting_keys.extend(container.getAllKeys())
|
||||
|
||||
for skip_key in skip_keys:
|
||||
if skip_key in user_setting_keys:
|
||||
user_setting_keys.remove(skip_key)
|
||||
|
||||
except:
|
||||
Logger.log("e", "While checking user custom settings occured error. skip_keys: %s", skip_keys )
|
||||
return False
|
||||
|
||||
return len(user_setting_keys) > 0
|
||||
|
||||
@pyqtProperty(int, notify = activeStackValueChanged)
|
||||
def numUserSettings(self) -> int:
|
||||
if not self._global_container_stack:
|
||||
|
|
|
@ -20,11 +20,40 @@ Item
|
|||
property variant minimumPrintTime: PrintInformation.minimumPrintTime;
|
||||
property variant maximumPrintTime: PrintInformation.maximumPrintTime;
|
||||
property bool settingsEnabled: ExtruderManager.activeExtruderStackId || machineExtruderCount.properties.value == 1
|
||||
property bool hasUserSettings;
|
||||
|
||||
Component.onCompleted: PrintInformation.enabled = true
|
||||
Component.onDestruction: PrintInformation.enabled = false
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
|
||||
onVisibleChanged:
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
base.checkUserSettings()
|
||||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: CuraApplication
|
||||
onSidebarSimpleDiscardOrKeepProfileChanges:
|
||||
{
|
||||
base.hasUserSettings = false
|
||||
}
|
||||
}
|
||||
|
||||
function checkUserSettings(){
|
||||
|
||||
var skip_keys = ["support_enable" ,
|
||||
"infill_sparse_density",
|
||||
"gradual_infill_steps",
|
||||
"adhesion_type",
|
||||
"support_extruder_nr"]
|
||||
|
||||
base.hasUserSettings = Cura.MachineManager.hasUserCustomSettings(skip_keys)
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
visible: Cura.MachineManager.activeMachineName != "" // If no printers added then the view is invisible
|
||||
|
@ -291,6 +320,7 @@ Item
|
|||
implicitWidth: 10 * screenScaleFactor
|
||||
implicitHeight: implicitWidth
|
||||
radius: implicitWidth / 2
|
||||
visible: !hasUserSettings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,6 +338,33 @@ Item
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//If any of settings were changed in custom mode then the Rectangle will
|
||||
//overlap quality slider area. It is used to catch mouse click
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: extrudersModelCheckBox.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
width: qualitySlider.width
|
||||
height: qualitySlider.height * 1.5
|
||||
//border.width: UM.Theme.getSize("default_lining").width // dispay overlap zone
|
||||
//border.color: UM.Theme.getColor("lining")
|
||||
|
||||
color: "transparent"
|
||||
|
||||
visible: hasUserSettings
|
||||
enabled: hasUserSettings
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
discardOrKeepProfileChangesDialog.show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Label
|
||||
|
@ -343,6 +400,33 @@ Item
|
|||
color: (qualityModel.availableTotalTicks > 0) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||
horizontalAlignment: Text.AlignRight
|
||||
}
|
||||
|
||||
UM.SimpleButton
|
||||
{
|
||||
id: customisedSettings
|
||||
|
||||
visible: hasUserSettings
|
||||
height: speedSlider.height * 0.8
|
||||
width: speedSlider.height * 0.8
|
||||
|
||||
anchors.verticalCenter: speedSlider.verticalCenter
|
||||
anchors.right: speedSlider.left
|
||||
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width / 2
|
||||
|
||||
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
|
||||
iconSource: UM.Theme.getIcon("reset");
|
||||
|
||||
onClicked:
|
||||
{
|
||||
discardOrKeepProfileChangesDialog.show()
|
||||
}
|
||||
onEntered:
|
||||
{
|
||||
var content = catalog.i18nc("@tooltip","You have selected a custom profile. If you want to change it, go to custom mode.")
|
||||
base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, customisedSettings.height), content)
|
||||
}
|
||||
onExited: base.hideTooltip()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue