From 7127de6a5962a8a3aacf324e299518ea0d67a16e Mon Sep 17 00:00:00 2001 From: Lev Kozlov Date: Sat, 5 Oct 2024 10:10:43 +0900 Subject: [PATCH] feat: implement checkbox for supports wall creation --- src/locales.py | 3 +++ src/settings_widget.py | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/locales.py b/src/locales.py index 46bbd0a..47c2ce2 100644 --- a/src/locales.py +++ b/src/locales.py @@ -146,6 +146,8 @@ class Locale: RemoveFirstPlaneError = "First figure cannot be removed" CannotDropHere = "Figure cannot be dropped here" + ShouldCreateWalls = "Create wall in support" + def __init__(self, **entries): self.__dict__.update(entries) @@ -297,6 +299,7 @@ def __init__(self, **entries): RemoveFirstPlaneError="Первая фигура не может быть убрана", WarningPathNotClosed="При разрезании модели были обнаружены незамкнутые участки! Проверьте корректность расположения фигур", CannotDropHere="Фигура не может быть перенесена сюда", + ShouldCreateWalls="Создавать стенки в поддержках", ), } diff --git a/src/settings_widget.py b/src/settings_widget.py index 51e7079..e6eb9d6 100644 --- a/src/settings_widget.py +++ b/src/settings_widget.py @@ -68,6 +68,7 @@ class SettingsWidget(QWidget): "support_priority_zoffset", "support_number_of_bottom_layers", "support_number_of_lid_layers", + "support_create_walls", "critical_angle", ] @@ -1260,6 +1261,25 @@ def on_change(): "label": angle_label, "edit": angle_value, } + elif name == "support_create_walls": + self.ensure_sett("supports.create_walls") + + create_walls_label = QLabel(self.locale.ShouldCreateWalls) + create_walls_box = QCheckBox() + if self.sett().supports.create_walls: + create_walls_box.setCheckState(QtCore.Qt.Checked) + self.panel.addWidget(create_walls_label, self.next_row, 1) + self.panel.addWidget(create_walls_box, self.cur_row, 2, 1, self.col2_cells) + + def on_change(): + self.sett().supports.create_walls = create_walls_box.isChecked() + + create_walls_box.stateChanged.connect(on_change) + + self.__elements[name] = { + "label": create_walls_label, + "checkbox": create_walls_box, + } # add row index for element self.__elements[name]["row_idx"] = self.cur_row