mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 17:15:10 +08:00
Now displaying a help icon and value units
CURA-11561
This commit is contained in:
parent
fcf1e63160
commit
38b67f8015
@ -5,7 +5,7 @@ import QtQuick 2.10
|
|||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
|
|
||||||
import UM 1.5 as UM
|
import UM 1.8 as UM
|
||||||
|
|
||||||
|
|
||||||
Item
|
Item
|
||||||
@ -80,34 +80,13 @@ Item
|
|||||||
sourceComponent: combobox
|
sourceComponent: combobox
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea
|
UM.HelpIcon
|
||||||
{
|
{
|
||||||
id: helpIconMouseArea
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: comboboxLabel.verticalCenter
|
anchors.verticalCenter: comboboxLabel.verticalCenter
|
||||||
width: childrenRect.width
|
|
||||||
height: childrenRect.height
|
|
||||||
hoverEnabled: true
|
|
||||||
|
|
||||||
UM.ColorImage
|
|
||||||
{
|
|
||||||
width: UM.Theme.getSize("section_icon").width
|
|
||||||
height: width
|
|
||||||
|
|
||||||
visible: comboboxTooltipText != ""
|
|
||||||
source: UM.Theme.getIcon("Help")
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
|
|
||||||
UM.ToolTip
|
|
||||||
{
|
|
||||||
text: comboboxTooltipText
|
text: comboboxTooltipText
|
||||||
visible: helpIconMouseArea.containsMouse
|
visible: comboboxTooltipText != ""
|
||||||
targetPoint: Qt.point(parent.x + Math.round(parent.width / 2), parent.y)
|
|
||||||
x: 0
|
|
||||||
y: parent.y + parent.height + UM.Theme.getSize("default_margin").height
|
|
||||||
width: UM.Theme.getSize("tooltip").width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,12 +6,13 @@ from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal
|
|||||||
|
|
||||||
class SettingExport(QObject):
|
class SettingExport(QObject):
|
||||||
|
|
||||||
def __init__(self, id, name, value):
|
def __init__(self, id, name, value, selectable):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.id = id
|
self.id = id
|
||||||
self._name = name
|
self._name = name
|
||||||
self._value = value
|
self._value = value
|
||||||
self._selected = True
|
self._selected = selectable
|
||||||
|
self._selectable = selectable
|
||||||
|
|
||||||
@pyqtProperty(str, constant=True)
|
@pyqtProperty(str, constant=True)
|
||||||
def name(self):
|
def name(self):
|
||||||
@ -31,3 +32,7 @@ class SettingExport(QObject):
|
|||||||
@pyqtProperty(bool, fset = setSelected, notify = selectedChanged)
|
@pyqtProperty(bool, fset = setSelected, notify = selectedChanged)
|
||||||
def selected(self):
|
def selected(self):
|
||||||
return self._selected
|
return self._selected
|
||||||
|
|
||||||
|
@pyqtProperty(bool, constant=True)
|
||||||
|
def selectable(self):
|
||||||
|
return self._selectable
|
||||||
|
@ -6,7 +6,7 @@ import QtQuick.Controls 2.3
|
|||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.2
|
||||||
|
|
||||||
import UM 1.5 as UM
|
import UM 1.8 as UM
|
||||||
import Cura 1.1 as Cura
|
import Cura 1.1 as Cura
|
||||||
|
|
||||||
RowLayout
|
RowLayout
|
||||||
@ -19,10 +19,20 @@ RowLayout
|
|||||||
Layout.preferredWidth: UM.Theme.getSize("setting").width
|
Layout.preferredWidth: UM.Theme.getSize("setting").width
|
||||||
checked: modelData.selected
|
checked: modelData.selected
|
||||||
onClicked: modelData.selected = checked
|
onClicked: modelData.selected = checked
|
||||||
|
enabled: modelData.selectable
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
text: modelData.value
|
text: modelData.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UM.HelpIcon
|
||||||
|
{
|
||||||
|
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||||
|
|
||||||
|
text: catalog.i18nc("@tooltip",
|
||||||
|
"This setting can't be exported because it depends too much on the used printer capacities")
|
||||||
|
visible: !modelData.selectable
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,17 +110,21 @@ class SettingsExportModel(QObject):
|
|||||||
|
|
||||||
settings_export = []
|
settings_export = []
|
||||||
|
|
||||||
for setting_to_export in user_keys.intersection(SettingsExportModel.EXPORTABLE_SETTINGS):
|
for setting_to_export in user_keys:
|
||||||
label = settings_stack.getProperty(setting_to_export, "label")
|
label = settings_stack.getProperty(setting_to_export, "label")
|
||||||
value = settings_stack.getProperty(setting_to_export, "value")
|
value = settings_stack.getProperty(setting_to_export, "value")
|
||||||
|
unit = settings_stack.getProperty(setting_to_export, "unit")
|
||||||
|
|
||||||
setting_type = settings_stack.getProperty(setting_to_export, "type")
|
setting_type = settings_stack.getProperty(setting_to_export, "type")
|
||||||
if setting_type is not None:
|
if setting_type is not None:
|
||||||
# This is not very good looking, but will do for now
|
# This is not very good looking, but will do for now
|
||||||
value = SettingDefinition.settingValueToString(setting_type, value)
|
value = SettingDefinition.settingValueToString(setting_type, value) + " " + unit
|
||||||
else:
|
else:
|
||||||
value = str(value)
|
value = str(value)
|
||||||
|
|
||||||
settings_export.append(SettingExport(setting_to_export, label, value))
|
settings_export.append(SettingExport(setting_to_export,
|
||||||
|
label,
|
||||||
|
value,
|
||||||
|
setting_to_export in SettingsExportModel.EXPORTABLE_SETTINGS))
|
||||||
|
|
||||||
return settings_export
|
return settings_export
|
||||||
|
Loading…
x
Reference in New Issue
Block a user