File: ConfigUI.qml

package info (click to toggle)
cura 5.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 122,888 kB
  • sloc: python: 44,572; sh: 81; xml: 32; makefile: 16
file content (333 lines) | stat: -rw-r--r-- 11,978 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
// Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import QtQuick.Window 2.1

import UM 1.5 as UM
import Cura 1.0 as Cura

UM.Dialog
{
    title: catalog.i18nc("@title:window", "Convert Image")

    minimumWidth: grid.width + 2 * UM.Theme.getSize("default_margin").height
    minimumHeight: UM.Theme.getSize("modal_window_minimum").height
    width: minimumWidth
    height: minimumHeight

    GridLayout
    {
        UM.I18nCatalog { id: catalog; name: "cura" }
        id: grid
        columnSpacing: UM.Theme.getSize("narrow_margin").width
        rowSpacing: UM.Theme.getSize("narrow_margin").height
        columns: 2

        UM.Label
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            text: catalog.i18nc("@action:label", "Height (mm)")
            Layout.alignment: Qt.AlignmentFlag.AlignVCenter

            MouseArea {
                id: peak_height_label
                anchors.fill: parent
                hoverEnabled: true
            }
        }

        Cura.TextField
        {
            id: peak_height
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            selectByMouse: true
            objectName: "Peak_Height"
            validator: RegularExpressionValidator { regularExpression: /^\d{0,3}([\,|\.]\d*)?$/ }
            onTextChanged: manager.onPeakHeightChanged(text)
        }

        UM.ToolTip
        {
            text: catalog.i18nc("@info:tooltip", "The maximum distance of each pixel from \"Base.\"")
            visible: peak_height.hovered || peak_height_label.containsMouse
            targetPoint: Qt.point(peak_height.x + Math.round(peak_height.width / 2), 0)
            y: peak_height.y + peak_height.height + UM.Theme.getSize("default_margin").height
        }

        UM.Label
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            text: catalog.i18nc("@action:label", "Base (mm)")
            Layout.alignment: Qt.AlignmentFlag.AlignVCenter

            MouseArea
            {
                id: base_height_label
                anchors.fill: parent
                hoverEnabled: true
            }
        }

        Cura.TextField
        {
            id: base_height
            selectByMouse: true
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            objectName: "Base_Height"
            validator: RegularExpressionValidator { regularExpression: /^\d{0,3}([\,|\.]\d*)?$/ }
            onTextChanged: manager.onBaseHeightChanged(text)
        }

        UM.ToolTip
        {
            text: catalog.i18nc("@info:tooltip", "The base height from the build plate in millimeters.")
            visible: base_height.hovered || base_height_label.containsMouse
            targetPoint: Qt.point(base_height.x + Math.round(base_height.width / 2), 0)
            y: base_height.y + base_height.height + UM.Theme.getSize("default_margin").height
        }

        UM.Label
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            text: catalog.i18nc("@action:label", "Width (mm)")
            Layout.alignment: Qt.AlignmentFlag.AlignVCenter

            MouseArea {
                id: width_label
                anchors.fill: parent
                hoverEnabled: true
            }
        }

        Cura.TextField
        {
            id: width
            selectByMouse: true
            objectName: "Width"
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            focus: true
            validator: RegularExpressionValidator { regularExpression: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
            onTextChanged: manager.onWidthChanged(text)
        }

        UM.ToolTip
        {
            text: catalog.i18nc("@info:tooltip", "The width in millimeters on the build plate")
            visible: width.hovered || width_label.containsMouse
            targetPoint: Qt.point(width.x + Math.round(width.width / 2), 0)
            y: width.y + width.height + UM.Theme.getSize("default_margin").height
        }

        UM.Label
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            text: catalog.i18nc("@action:label", "Depth (mm)")
            Layout.alignment: Qt.AlignmentFlag.AlignVCenter

            MouseArea {
                id: depth_label
                anchors.fill: parent
                hoverEnabled: true
            }
        }

        Cura.TextField
        {
            id: depth
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            selectByMouse: true
            objectName: "Depth"
            focus: true
            validator: RegularExpressionValidator { regularExpression: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
            onTextChanged: manager.onDepthChanged(text)
        }

        UM.ToolTip
        {
            text: catalog.i18nc("@info:tooltip", "The depth in millimeters on the build plate")
            visible: depth.hovered || depth_label.containsMouse
            targetPoint: Qt.point(depth.x + Math.round(depth.width / 2), 0)
            y: depth.y + depth.height + UM.Theme.getSize("default_margin").height
        }

        UM.Label
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            text: ""
            Layout.alignment: Qt.AlignmentFlag.AlignVCenter

            MouseArea {
                id: lighter_is_higher_label
                anchors.fill: parent
                hoverEnabled: true
            }
        }

        Cura.ComboBox
        {
            id: lighter_is_higher
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            Layout.preferredHeight: UM.Theme.getSize("setting_control").height
            objectName: "Lighter_Is_Higher"
            textRole: "text"
            model: [
                { text: catalog.i18nc("@item:inlistbox", "Darker is higher") },
                { text: catalog.i18nc("@item:inlistbox", "Lighter is higher") }
            ]
            onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) }
        }

        UM.ToolTip
        {
            text: catalog.i18nc("@info:tooltip", "For lithophanes dark pixels should correspond to thicker locations in order to block more light coming through. For height maps lighter pixels signify higher terrain, so lighter pixels should correspond to thicker locations in the generated 3D model.")
            visible: lighter_is_higher.hovered || lighter_is_higher_label.containsMouse
            targetPoint: Qt.point(lighter_is_higher.x + Math.round(lighter_is_higher.width / 2), 0)
            y: lighter_is_higher.y + lighter_is_higher.height + UM.Theme.getSize("default_margin").height
        }

        UM.Label
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            text: catalog.i18nc("@action:label", "Color Model")
            Layout.alignment: Qt.AlignmentFlag.AlignVCenter

            MouseArea {
                id: color_model_label
                anchors.fill: parent
                hoverEnabled: true
            }
        }

        Cura.ComboBox
        {
            id: color_model
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            Layout.preferredHeight: UM.Theme.getSize("setting_control").height
            objectName: "ColorModel"
            textRole: "text"
            model: [
                { text: catalog.i18nc("@item:inlistbox", "Linear") },
                { text: catalog.i18nc("@item:inlistbox", "Translucency") }
            ]
            onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) }
        }

        UM.ToolTip
        {
            text: catalog.i18nc("@info:tooltip", "For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.")
            visible: color_model.hovered || color_model_label.containsMouse
            targetPoint: Qt.point(color_model.x + Math.round(color_model.width / 2), 0)
            y: color_model.y + color_model.height + UM.Theme.getSize("default_margin").height
        }

        UM.Label
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            text: catalog.i18nc("@action:label", "1mm Transmittance (%)")
            Layout.alignment: Qt.AlignmentFlag.AlignVCenter

            MouseArea {
                id: transmittance_label
                anchors.fill: parent
                hoverEnabled: true
            }
        }

        Cura.TextField
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            selectByMouse: true
            objectName: "Transmittance"
            validator: RegularExpressionValidator { regularExpression: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
            onTextChanged: manager.onTransmittanceChanged(text)

            UM.ToolTip
            {
                text: catalog.i18nc("@info:tooltip", "The percentage of light penetrating a print with a thickness of 1 millimeter. Lowering this value increases the contrast in dark regions and decreases the contrast in light regions of the image.")
                visible: parent.hovered || transmittance_label.containsMouse
                targetPoint: Qt.point(parent.x + Math.round(parent.width / 2), 0)
                y: parent.y + parent.height + UM.Theme.getSize("default_margin").height
            }
        }

        UM.Label
        {
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            text: catalog.i18nc("@action:label", "Smoothing")
            Layout.alignment: Qt.AlignmentFlag.AlignVCenter

            MouseArea
            {
                id: smoothing_label
                anchors.fill: parent
                hoverEnabled: true
            }
        }

        Cura.SpinBox
        {
            id: smoothing
            Layout.fillWidth: true
            Layout.minimumWidth: UM.Theme.getSize("setting_control").width
            objectName: "Smoothing"
            to: 100.0
            stepSize: 1.0
            onValueChanged: manager.onSmoothingChanged(value)
        }

        UM.ToolTip
        {
            text: catalog.i18nc("@info:tooltip", "The amount of smoothing to apply to the image.")
            visible: smoothing.hovered || smoothing_label.containsMouse
            targetPoint: Qt.point(smoothing.x + Math.round(smoothing.width / 2), 0)
            y: smoothing.y + smoothing.height + UM.Theme.getSize("default_margin").height
        }
    }

    Item
    {
        ButtonGroup
        {
            buttons: [ok_button, cancel_button]
            checkedButton: ok_button
        }
    }

    onAccepted: manager.onOkButtonClicked()
    onRejected: manager.onCancelButtonClicked()

    buttonSpacing: UM.Theme.getSize("default_margin").width

    rightButtons: [
        Cura.TertiaryButton
        {
            id: cancel_button
            text: catalog.i18nc("@action:button", "Cancel")
            onClicked: manager.onCancelButtonClicked()
        },
        Cura.PrimaryButton
        {
            id: ok_button
            text: catalog.i18nc("@action:button", "OK")
            onClicked: manager.onOkButtonClicked()
        }
    ]
}