diff --git a/plugins/PCBWriter/PCBDialog.qml b/plugins/PCBWriter/PCBDialog.qml index 1937c00828..213bed108c 100644 --- a/plugins/PCBWriter/PCBDialog.qml +++ b/plugins/PCBWriter/PCBDialog.qml @@ -69,7 +69,7 @@ UM.Dialog id: settingsExportList anchors.fill: parent anchors.margins: UM.Theme.getSize("default_margin").width - spacing: UM.Theme.getSize("default_margin").height + spacing: UM.Theme.getSize("thick_margin").height model: settingsExportModel.settingsGroups clip: true @@ -77,21 +77,6 @@ UM.Dialog delegate: SettingsSelectionGroup { Layout.margins: 0 } } - - // Flickable - // { - // Column - // { - // width: parent.width - scrollbar.width - UM.Theme.getSize("default_margin").width - // height: childrenRect.height - // - // spacing: UM.Theme.getSize("default_margin").height - // leftPadding: UM.Theme.getSize("default_margin").width - // rightPadding: leftPadding - // topPadding: UM.Theme.getSize("default_margin").height - // bottomPadding: topPadding - // } - // } } footerComponent: Rectangle diff --git a/plugins/PCBWriter/SettingExport.py b/plugins/PCBWriter/SettingExport.py index 901dcdc804..2c230f9ab3 100644 --- a/plugins/PCBWriter/SettingExport.py +++ b/plugins/PCBWriter/SettingExport.py @@ -8,12 +8,12 @@ from UM.Qt.ListModel import ListModel from UM.Logger import Logger -class SettingsExport(): +class SettingsExport(QObject): - def __init__(self): + def __init__(self, name, value): super().__init__() - self._name = "Generate Support" - self._value = "Enabled" + self._name = name + self._value = value @pyqtProperty(str, constant=True) def name(self): diff --git a/plugins/PCBWriter/SettingSelection.qml b/plugins/PCBWriter/SettingSelection.qml new file mode 100644 index 0000000000..9b09593a7d --- /dev/null +++ b/plugins/PCBWriter/SettingSelection.qml @@ -0,0 +1,27 @@ +// Copyright (c) 2024 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 +import QtQuick.Window 2.2 + +import UM 1.5 as UM +import Cura 1.1 as Cura + +RowLayout +{ + id: settingSelection + + UM.CheckBox + { + text: modelData.name + Layout.preferredWidth: UM.Theme.getSize("setting").width + checked: true + } + + UM.Label + { + text: modelData.value + } +} diff --git a/plugins/PCBWriter/SettingsExportGroup.py b/plugins/PCBWriter/SettingsExportGroup.py index 355b2347f6..0a721a7fb8 100644 --- a/plugins/PCBWriter/SettingsExportGroup.py +++ b/plugins/PCBWriter/SettingsExportGroup.py @@ -20,15 +20,14 @@ class SettingsExportGroup(QObject): Extruder = 1 Model = 2 - def __init__(self, name, category, category_details = '', extruder_index = 0, extruder_color = ''): + def __init__(self, name, category, settings, category_details = '', extruder_index = 0, extruder_color = ''): super().__init__() self._name = name - self._settings = [] + self._settings = settings self._category = category self._category_details = category_details self._extruder_index = extruder_index self._extruder_color = extruder_color - self._updateSettings() @pyqtProperty(str, constant=True) def name(self): @@ -53,7 +52,3 @@ class SettingsExportGroup(QObject): @pyqtProperty(str, constant=True) def extruder_color(self): return self._extruder_color - - def _updateSettings(self): - self._settings.append(SettingsExport()) - self._settings.append(SettingsExport()) \ No newline at end of file diff --git a/plugins/PCBWriter/SettingsExportModel.py b/plugins/PCBWriter/SettingsExportModel.py index 3351e22b59..0f1ec5113a 100644 --- a/plugins/PCBWriter/SettingsExportModel.py +++ b/plugins/PCBWriter/SettingsExportModel.py @@ -8,6 +8,7 @@ from UM.Qt.ListModel import ListModel from UM.Logger import Logger from .SettingsExportGroup import SettingsExportGroup +from .SettingExport import SettingsExport class SettingsExportModel(QObject): @@ -22,10 +23,27 @@ class SettingsExportModel(QObject): return self._settingsGroups def _updateSettingsExportGroups(self): - self._settingsGroups.append(SettingsExportGroup("Global settings", SettingsExportGroup.Category.Global)) - self._settingsGroups.append(SettingsExportGroup("Extruder settings", SettingsExportGroup.Category.Extruder, extruder_index=1, extruder_color='#ff0000')) - self._settingsGroups.append(SettingsExportGroup("Extruder settings", SettingsExportGroup.Category.Extruder, extruder_index=8, extruder_color='#008fff')) + self._settingsGroups.append(SettingsExportGroup("Global settings", + SettingsExportGroup.Category.Global, + [SettingsExport("Generate Support", "Enabled"), + SettingsExport("Support Type", "Tree")])) + self._settingsGroups.append(SettingsExportGroup("Extruder settings", + SettingsExportGroup.Category.Extruder, + [SettingsExport("Brim Width", "0.7mm")], + extruder_index=1, + extruder_color='#ff0000')) + self._settingsGroups.append(SettingsExportGroup("Extruder settings", + SettingsExportGroup.Category.Extruder, + [], + extruder_index=8, + extruder_color='#008fff')) self._settingsGroups.append(SettingsExportGroup("Model settings", - SettingsExportGroup.Category.Model, 'hypercube.stl')) + SettingsExportGroup.Category.Model, + [SettingsExport("Brim Width", "20.0 mm"), + SettingsExport("Z Hop when retracted", "Disabled")], + 'hypercube.stl')) self._settingsGroups.append(SettingsExportGroup("Model settings", - SettingsExportGroup.Category.Model, 'homer-simpson.stl')) + SettingsExportGroup.Category.Model, + [SettingsExport("Walls Thickness", "3.0 mm"), + SettingsExport("Enable Ironing", "Enabled")], + 'homer-simpson.stl')) diff --git a/plugins/PCBWriter/SettingsSelectionGroup.qml b/plugins/PCBWriter/SettingsSelectionGroup.qml index 12829c96d4..39299ab7c3 100644 --- a/plugins/PCBWriter/SettingsSelectionGroup.qml +++ b/plugins/PCBWriter/SettingsSelectionGroup.qml @@ -10,13 +10,12 @@ import UM 1.5 as UM import Cura 1.1 as Cura import PCBWriter 1.0 as PCBWriter -Column +ColumnLayout { id: settingsGroup + spacing: UM.Theme.getSize("narrow_margin").width - UM.I18nCatalog { id: catalog; name: "cura" } - - Row + RowLayout { id: settingsGroupTitleRow spacing: UM.Theme.getSize("default_margin").width @@ -24,7 +23,6 @@ Column Item { id: icon - anchors.verticalCenter: parent.verticalCenter height: UM.Theme.getSize("medium_button_icon").height width: height @@ -63,8 +61,27 @@ Column { id: settingsTitle text: modelData.name + (modelData.category_details ? ' (%1)'.arg(modelData.category_details) : '') - anchors.verticalCenter: parent.verticalCenter font: UM.Theme.getFont("default_bold") } } + + ListView + { + id: settingsExportList + Layout.fillWidth: true + Layout.preferredHeight: contentHeight + spacing: 0 + model: modelData.settings + visible: modelData.settings.length > 0 + + delegate: SettingSelection { } + } + + UM.Label + { + UM.I18nCatalog { id: catalog; name: "cura" } + + text: catalog.i18nc("@label", "No specific value has been set") + visible: modelData.settings.length === 0 + } }