From cae8ef066234f9febd1ab031dea8f2d787c86483 Mon Sep 17 00:00:00 2001 From: w4ffl35 <25737761+w4ffl35@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:04:32 -0600 Subject: [PATCH] image filter fixes --- src/airunner/widgets/canvas/custom_scene.py | 7 ++++++- src/airunner/windows/filter_window.py | 7 ------- src/airunner/windows/filter_window.ui | 13 ------------- src/airunner/windows/filter_window_ui.py | 16 +++------------- 4 files changed, 9 insertions(+), 34 deletions(-) diff --git a/src/airunner/widgets/canvas/custom_scene.py b/src/airunner/widgets/canvas/custom_scene.py index 7eefb8906..cfaef65ba 100644 --- a/src/airunner/widgets/canvas/custom_scene.py +++ b/src/airunner/widgets/canvas/custom_scene.py @@ -115,6 +115,11 @@ def current_active_image(self) -> Image: except PIL.UnidentifiedImageError: return None + @current_active_image.setter + def current_active_image(self, image: Image): + self._update_current_settings("image", convert_image_to_base64(image)) + self.initialize_image(image) + @image_pivot_point.setter def image_pivot_point(self, value): self.emit_signal(SignalCode.LAYER_UPDATE_CURRENT_SIGNAL, { @@ -179,7 +184,7 @@ def on_load_image_signal(self, image_path: str): image = self._load_image(image_path) if self.application_settings.resize_on_paste: image = self._resize_image(image) - self.initialize_image(image) + self.current_active_image = image def on_apply_filter_signal(self, message): self._apply_filter(message) diff --git a/src/airunner/windows/filter_window.py b/src/airunner/windows/filter_window.py index 02b2d1dcc..95cfccdd6 100644 --- a/src/airunner/windows/filter_window.py +++ b/src/airunner/windows/filter_window.py @@ -74,9 +74,6 @@ def showEvent(self, event): ) self.ui.content.layout().addWidget(slider_spinbox_widget) - self.ui.auto_apply.setChecked(self.image_filter.auto_apply) - self.ui.auto_apply.clicked.connect(partial(self.handle_auto_apply_toggle)) - self.setWindowTitle(self.window_title) self.preview_filter() @@ -103,10 +100,6 @@ def filter_object(self): self._filter = class_(**kwargs) return self._filter - def handle_auto_apply_toggle(self): - self.image_filter.auto_apply = self.ui.auto_apply.isChecked() - self.session.commit() - def reject(self): self.emit_signal( SignalCode.CANVAS_CANCEL_FILTER_SIGNAL diff --git a/src/airunner/windows/filter_window.ui b/src/airunner/windows/filter_window.ui index d86c7b7f3..ee6d8acd1 100644 --- a/src/airunner/windows/filter_window.ui +++ b/src/airunner/windows/filter_window.ui @@ -45,19 +45,6 @@ - - - - - 8 - true - - - - Auto Apply Filter - - - diff --git a/src/airunner/windows/filter_window_ui.py b/src/airunner/windows/filter_window_ui.py index 9f90d1297..206932077 100644 --- a/src/airunner/windows/filter_window_ui.py +++ b/src/airunner/windows/filter_window_ui.py @@ -15,9 +15,9 @@ QFont, QFontDatabase, QGradient, QIcon, QImage, QKeySequence, QLinearGradient, QPainter, QPalette, QPixmap, QRadialGradient, QTransform) -from PySide6.QtWidgets import (QAbstractButton, QApplication, QCheckBox, QDialog, - QDialogButtonBox, QFrame, QGridLayout, QSizePolicy, - QSpacerItem, QWidget) +from PySide6.QtWidgets import (QAbstractButton, QApplication, QDialog, QDialogButtonBox, + QFrame, QGridLayout, QSizePolicy, QSpacerItem, + QWidget) class Ui_filter_window(object): def setupUi(self, filter_window): @@ -46,15 +46,6 @@ def setupUi(self, filter_window): self.gridLayout.addWidget(self.content, 0, 0, 1, 2) - self.auto_apply = QCheckBox(filter_window) - self.auto_apply.setObjectName(u"auto_apply") - font1 = QFont() - font1.setPointSize(8) - font1.setBold(True) - self.auto_apply.setFont(font1) - - self.gridLayout.addWidget(self.auto_apply, 1, 0, 1, 1) - self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.gridLayout.addItem(self.verticalSpacer, 2, 1, 1, 1) @@ -69,6 +60,5 @@ def setupUi(self, filter_window): def retranslateUi(self, filter_window): filter_window.setWindowTitle(QCoreApplication.translate("filter_window", u"Dialog", None)) - self.auto_apply.setText(QCoreApplication.translate("filter_window", u"Auto Apply Filter", None)) # retranslateUi