From 4f1e94a97a916cd868df78667c3ce173211562fb Mon Sep 17 00:00:00 2001 From: w4ffl35 <25737761+w4ffl35@users.noreply.github.com> Date: Wed, 22 Nov 2023 08:40:25 -0700 Subject: [PATCH 1/4] hide imagecontainer on init in standard img widget --- src/airunner/widgets/canvas_plus/standard_image_widget.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/airunner/widgets/canvas_plus/standard_image_widget.py b/src/airunner/widgets/canvas_plus/standard_image_widget.py index a5ea0506e..d0fc68502 100644 --- a/src/airunner/widgets/canvas_plus/standard_image_widget.py +++ b/src/airunner/widgets/canvas_plus/standard_image_widget.py @@ -35,6 +35,7 @@ def __init__(self, *args, **kwargs): self.ui.batch_container.hide() self.ui.delete_confirmation.hide() self.ui.tableWidget.hide() + self.ui.image_frame.hide() def handle_image_data(self, data): print(data) @@ -140,6 +141,7 @@ def set_pixmap(self, image_path=None, image=None): self.set_table_data(meta_data) self.ui.controls_container.show() + self.ui.image_frame.show() def handle_label_clicked(self, event): # create a popup window and show the full size image in it From 9802248e7149e4d9aaf112f0068ae17b95881b10 Mon Sep 17 00:00:00 2001 From: w4ffl35 <25737761+w4ffl35@users.noreply.github.com> Date: Wed, 22 Nov 2023 08:43:26 -0700 Subject: [PATCH 2/4] apply opacity fix --- src/airunner/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/airunner/utils.py b/src/airunner/utils.py index 7c5807f9f..0dcb7b2e8 100644 --- a/src/airunner/utils.py +++ b/src/airunner/utils.py @@ -476,6 +476,7 @@ def apply_opacity_to_image(image, target_opacity): target_opacity = 255 * target_opacity if target_opacity == 0: target_opacity = 1 + image = image.convert("RGBA") r, g, b, a = image.split() a = a.point(lambda i: target_opacity if i > 0 else 0) image.putalpha(a) From bc18ed21e5278b4c6e79a09a6ad3e5f96da09a70 Mon Sep 17 00:00:00 2001 From: w4ffl35 <25737761+w4ffl35@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:24:42 -0700 Subject: [PATCH 3/4] Fixes canvas initialization when switching to canvas tab --- src/airunner/windows/main/main_window.py | 2 + .../windows/main/templates/main_window.ui | 80 +++++++++---------- .../windows/main/templates/main_window_ui.py | 8 +- 3 files changed, 46 insertions(+), 44 deletions(-) diff --git a/src/airunner/windows/main/main_window.py b/src/airunner/windows/main/main_window.py index 360803273..9d6e66b8d 100644 --- a/src/airunner/windows/main/main_window.py +++ b/src/airunner/windows/main/main_window.py @@ -358,6 +358,8 @@ def image_editor_tab_name(self): return self.ui.image_editor_tab_widget.tabText(self.ui.image_editor_tab_widget.currentIndex()) def image_editor_tab_index_changed(self): + if self.image_editor_tab_name == "Canvas": + self.canvas.do_draw() self.settings_manager.set_value("active_image_editor_section", self.image_editor_tab_name) def initialize_panel_tabs(self): diff --git a/src/airunner/windows/main/templates/main_window.ui b/src/airunner/windows/main/templates/main_window.ui index 28006eb12..57d1b992b 100644 --- a/src/airunner/windows/main/templates/main_window.ui +++ b/src/airunner/windows/main/templates/main_window.ui @@ -7,8 +7,8 @@ 0 0 - 1035 - 1018 + 1085 + 1141 @@ -128,7 +128,7 @@ 0 0 - 1031 + 1081 50 @@ -1177,8 +1177,8 @@ 0 0 - 406 - 846 + 427 + 964 @@ -1778,7 +1778,7 @@ 0 0 - 1035 + 1085 22 @@ -3334,8 +3334,8 @@ action_new_document_triggered() - 775 - 66 + 1198 + 65 1002 @@ -3350,8 +3350,8 @@ action_undo_triggered() - 952 - 66 + 1375 + 65 1002 @@ -3366,8 +3366,8 @@ action_redo_triggered() - 994 - 66 + 1417 + 65 1002 @@ -3382,8 +3382,8 @@ action_export_image_triggered() - 901 - 66 + 1324 + 65 1002 @@ -3398,8 +3398,8 @@ image_generators_toggled() - 528 - 72 + 832 + 71 0 @@ -3414,8 +3414,8 @@ text_to_gif_toggled() - 576 - 72 + 880 + 71 0 @@ -3430,8 +3430,8 @@ text_to_video_toggled() - 624 - 72 + 928 + 71 0 @@ -3446,8 +3446,8 @@ prompt_builder_toggled() - 672 - 72 + 976 + 71 0 @@ -3510,8 +3510,8 @@ image_generators_toggled() - 528 - 72 + 832 + 71 754 @@ -3526,8 +3526,8 @@ text_to_gif_toggled() - 576 - 72 + 880 + 71 0 @@ -3542,8 +3542,8 @@ text_to_video_toggled() - 624 - 72 + 928 + 71 1002 @@ -3558,8 +3558,8 @@ prompt_builder_toggled() - 672 - 72 + 976 + 71 1002 @@ -3574,7 +3574,7 @@ action_toggle_nsfw_filter_triggered(bool) - 990 + 1381 417 @@ -3590,7 +3590,7 @@ action_show_settings() - 990 + 1381 477 @@ -3606,7 +3606,7 @@ action_toggle_grid(bool) - 990 + 1381 315 @@ -3622,7 +3622,7 @@ action_toggle_active_grid_area(bool) - 990 + 1381 153 @@ -3638,7 +3638,7 @@ action_toggle_eraser(bool) - 990 + 1381 255 @@ -3654,7 +3654,7 @@ action_toggle_brush(bool) - 990 + 1381 204 @@ -3723,7 +3723,7 @@ 452 - -13 + 0 @@ -3739,7 +3739,7 @@ 444 - -18 + 0 @@ -3755,7 +3755,7 @@ 728 - -6 + 0 @@ -3771,7 +3771,7 @@ 731 - -19 + 0 diff --git a/src/airunner/windows/main/templates/main_window_ui.py b/src/airunner/windows/main/templates/main_window_ui.py index 5edc67e33..cdf5665de 100644 --- a/src/airunner/windows/main/templates/main_window_ui.py +++ b/src/airunner/windows/main/templates/main_window_ui.py @@ -12,7 +12,7 @@ class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(1035, 1018) + MainWindow.resize(1085, 1141) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Maximum, QtWidgets.QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -58,7 +58,7 @@ def setupUi(self, MainWindow): self.scrollArea_3.setWidgetResizable(True) self.scrollArea_3.setObjectName("scrollArea_3") self.scrollAreaWidgetContents_3 = QtWidgets.QWidget() - self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 1031, 50)) + self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 1081, 50)) self.scrollAreaWidgetContents_3.setObjectName("scrollAreaWidgetContents_3") self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.scrollAreaWidgetContents_3) self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) @@ -430,7 +430,7 @@ def setupUi(self, MainWindow): self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 406, 846)) + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 427, 964)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.gridLayout = QtWidgets.QGridLayout(self.scrollAreaWidgetContents) self.gridLayout.setObjectName("gridLayout") @@ -685,7 +685,7 @@ def setupUi(self, MainWindow): self.header_widget.raise_() MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(parent=MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1035, 22)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1085, 22)) font = QtGui.QFont() font.setPointSize(11) self.menubar.setFont(font) From 5bdf0b68f411d5c74b1ef59fdfa655d2666dac47 Mon Sep 17 00:00:00 2001 From: w4ffl35 <25737761+w4ffl35@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:25:53 -0700 Subject: [PATCH 4/4] Updated styles for standard image widget --- src/airunner/styles/dark_theme/main.qss | 1 + .../widgets/canvas_plus/canvas_plus_widget.py | 1 - .../canvas_plus/standard_image_widget.py | 17 +- .../templates/standard_image_widget.ui | 509 +++++++++--------- .../templates/standard_image_widget_ui.py | 158 +++--- .../generator_form/generator_form_widget.py | 2 - 6 files changed, 355 insertions(+), 333 deletions(-) diff --git a/src/airunner/styles/dark_theme/main.qss b/src/airunner/styles/dark_theme/main.qss index 9607cde79..0eaff1d36 100644 --- a/src/airunner/styles/dark_theme/main.qss +++ b/src/airunner/styles/dark_theme/main.qss @@ -630,6 +630,7 @@ QTableWidget::item:selected { background-color: @darkerprimary-color; } +#standard_image_widget QPushButton, #image_widget QPushButton { border: 1px solid @darkerprimary-color; } diff --git a/src/airunner/widgets/canvas_plus/canvas_plus_widget.py b/src/airunner/widgets/canvas_plus/canvas_plus_widget.py index 99b31208a..120aeeca1 100644 --- a/src/airunner/widgets/canvas_plus/canvas_plus_widget.py +++ b/src/airunner/widgets/canvas_plus/canvas_plus_widget.py @@ -572,7 +572,6 @@ def handle_outpaint(self, outpaint_box_rect, outpainted_image, action=None, is_k new_image = Image.alpha_composite(new_image, new_image_b) new_image = Image.alpha_composite(new_image, new_image_a) - new_image.save("test.png") return new_image, image_root_point, image_pivot_point def load_image_from_path(self, image_path): diff --git a/src/airunner/widgets/canvas_plus/standard_image_widget.py b/src/airunner/widgets/canvas_plus/standard_image_widget.py index d0fc68502..bd5c6c335 100644 --- a/src/airunner/widgets/canvas_plus/standard_image_widget.py +++ b/src/airunner/widgets/canvas_plus/standard_image_widget.py @@ -12,6 +12,7 @@ from PIL import Image from PIL import PngImagePlugin +from PIL.ImageQt import ImageQt from airunner.widgets.canvas_plus.canvas_base_widget import CanvasBaseWidget from airunner.widgets.canvas_plus.templates.standard_image_widget_ui import Ui_standard_image_widget @@ -36,9 +37,9 @@ def __init__(self, *args, **kwargs): self.ui.delete_confirmation.hide() self.ui.tableWidget.hide() self.ui.image_frame.hide() + self.ui.similar_groupbox.hide() def handle_image_data(self, data): - print(data) self.image_path = data["path"] images = data["images"] if len(images) == 1: @@ -48,20 +49,17 @@ def handle_image_data(self, data): self.load_batch_images(images) def clear_batch_images(self): - for widget in self.ui.batch_container.layout().children(): + for widget in self.ui.batch_container.findChildren(QLabel): widget.deleteLater() def load_batch_images(self, images): + self.ui.batch_container.show() self.clear_batch_images() images = images[:4] for image in images: - raw_data = image.tobytes("raw", "RGBA") - qimage = QImage( - raw_data, - image.size[0], - image.size[1], - QImage.Format.Format_RGBA8888 - ) + # resize the image to 128x128 + image = image.resize((128, 128)) + qimage = ImageQt(image) pixmap = QPixmap.fromImage(qimage) label = QLabel() label.setPixmap(pixmap) @@ -142,6 +140,7 @@ def set_pixmap(self, image_path=None, image=None): self.ui.controls_container.show() self.ui.image_frame.show() + self.ui.similar_groupbox.show() def handle_label_clicked(self, event): # create a popup window and show the full size image in it diff --git a/src/airunner/widgets/canvas_plus/templates/standard_image_widget.ui b/src/airunner/widgets/canvas_plus/templates/standard_image_widget.ui index 330e4dab3..702e60f11 100644 --- a/src/airunner/widgets/canvas_plus/templates/standard_image_widget.ui +++ b/src/airunner/widgets/canvas_plus/templates/standard_image_widget.ui @@ -6,168 +6,264 @@ 0 0 - 744 + 552 1194 + + + 552 + 16777215 + + Form - - - - - 0 - 0 - - - - - 532 - 532 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 20 - - - - Similarity - - - handle_value_change - - - 100 - - - 100 - - - 1.000000000000000 - - - true - - - 0.010000000000000 - - - 0.010000000000000 - - - 0.000000000000000 - - + + + + + + + 0 + 0 + + + + + 532 + 532 + + + + + 532 + 532 + + + + true + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 - - image_similarity - - - - - - - PointingHandCursor - - - Send this image to the canvas - - - To Canvas - - - - - - - PointingHandCursor - - - Generate a batch of four variations - - - Batch - - - - - - - PointingHandCursor + + 0 - - Permanently delete this image + + 0 - - Delete + + 0 - - - - - - Export + + + + PointingHandCursor + + + Export + + + + + + + PointingHandCursor + + + Permanently delete this image + + + Delete + + + + + + + PointingHandCursor + + + Send this image to the canvas + + + To Canvas + + + + + + + + + + + + + Permanently delete? + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + PointingHandCursor + + + Yes + + + + + + + PointingHandCursor + + + No + + + + + + + + + + Generate similar images + + + + 4 - - - - - - PointingHandCursor + + 4 - - Generate one variation + + 4 - - Single + + 4 - - - - + + + + + 0 + 20 + + + + Similarity + + + handle_value_change + + + 100 + + + 100 + + + 1.000000000000000 + + + true + + + 0.010000000000000 + + + 0.010000000000000 + + + 0.000000000000000 + + + 0 + + + image_similarity + + + + + + + PointingHandCursor + + + Generate one variation + + + Single + + + + + + + PointingHandCursor + + + Generate a batch of four variations + + + Batch + + + + + + + - + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -193,101 +289,20 @@ - - - - - 0 - 0 - - + + - 532 - 532 - - - - - 532 - 532 + 0 + 128 - - true - - - QFrame::StyledPanel - - - QFrame::Raised + + + - - - - - - - Permanently delete? - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - PointingHandCursor - - - Yes - - - - - - - PointingHandCursor - - - No - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -307,8 +322,8 @@ confirm_delete() - 222 - 864 + 240 + 919 237 @@ -323,8 +338,8 @@ cancel_delete() - 639 - 864 + 533 + 919 368 @@ -339,8 +354,8 @@ image_to_canvas() - 734 - 416 + 541 + 572 85 @@ -355,8 +370,8 @@ delete_image() - 734 - 478 + 326 + 572 310 @@ -371,8 +386,8 @@ similar_image() - 734 - 540 + 111 + 572 38 @@ -387,8 +402,8 @@ similar_batch() - 734 - 447 + 433 + 572 154 @@ -403,8 +418,8 @@ export_image() - 734 - 509 + 218 + 572 467 diff --git a/src/airunner/widgets/canvas_plus/templates/standard_image_widget_ui.py b/src/airunner/widgets/canvas_plus/templates/standard_image_widget_ui.py index efe3293ac..f3f870600 100644 --- a/src/airunner/widgets/canvas_plus/templates/standard_image_widget_ui.py +++ b/src/airunner/widgets/canvas_plus/templates/standard_image_widget_ui.py @@ -12,69 +12,12 @@ class Ui_standard_image_widget(object): def setupUi(self, standard_image_widget): standard_image_widget.setObjectName("standard_image_widget") - standard_image_widget.resize(744, 1194) + standard_image_widget.resize(552, 1194) + standard_image_widget.setMaximumSize(QtCore.QSize(552, 16777215)) self.gridLayout_2 = QtWidgets.QGridLayout(standard_image_widget) self.gridLayout_2.setObjectName("gridLayout_2") - self.batch_container = QtWidgets.QWidget(parent=standard_image_widget) - self.batch_container.setMinimumSize(QtCore.QSize(0, 0)) - self.batch_container.setMaximumSize(QtCore.QSize(532, 532)) - self.batch_container.setObjectName("batch_container") - self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.batch_container) - self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_3.setSpacing(0) - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.gridLayout_2.addWidget(self.batch_container, 4, 0, 1, 1) - self.controls_container = QtWidgets.QWidget(parent=standard_image_widget) - self.controls_container.setObjectName("controls_container") - self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.controls_container) - self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.samples_widget = SliderWidget(parent=self.controls_container) - self.samples_widget.setMinimumSize(QtCore.QSize(0, 20)) - self.samples_widget.setProperty("slider_callback", "handle_value_change") - self.samples_widget.setProperty("current_value", 100) - self.samples_widget.setProperty("slider_maximum", 100) - self.samples_widget.setProperty("spinbox_maximum", 1.0) - self.samples_widget.setProperty("display_as_float", True) - self.samples_widget.setProperty("spinbox_single_step", 0.01) - self.samples_widget.setProperty("spinbox_page_step", 0.01) - self.samples_widget.setProperty("spinbox_minimum", 0.0) - self.samples_widget.setProperty("slider_minimum", 0) - self.samples_widget.setObjectName("samples_widget") - self.verticalLayout_3.addWidget(self.samples_widget) - self.pushButton_4 = QtWidgets.QPushButton(parent=self.controls_container) - self.pushButton_4.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.pushButton_4.setObjectName("pushButton_4") - self.verticalLayout_3.addWidget(self.pushButton_4) - self.pushButton_2 = QtWidgets.QPushButton(parent=self.controls_container) - self.pushButton_2.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.pushButton_2.setObjectName("pushButton_2") - self.verticalLayout_3.addWidget(self.pushButton_2) - self.pushButton = QtWidgets.QPushButton(parent=self.controls_container) - self.pushButton.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.pushButton.setObjectName("pushButton") - self.verticalLayout_3.addWidget(self.pushButton) - self.pushButton_7 = QtWidgets.QPushButton(parent=self.controls_container) - self.pushButton_7.setObjectName("pushButton_7") - self.verticalLayout_3.addWidget(self.pushButton_7) - self.pushButton_3 = QtWidgets.QPushButton(parent=self.controls_container) - self.pushButton_3.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.pushButton_3.setObjectName("pushButton_3") - self.verticalLayout_3.addWidget(self.pushButton_3) - self.gridLayout_2.addWidget(self.controls_container, 0, 1, 1, 1) - self.tableWidget = QtWidgets.QTableWidget(parent=standard_image_widget) - self.tableWidget.setStyleSheet("") - self.tableWidget.setAutoScroll(False) - self.tableWidget.setObjectName("tableWidget") - self.tableWidget.setColumnCount(2) - self.tableWidget.setRowCount(0) - item = QtWidgets.QTableWidgetItem() - self.tableWidget.setHorizontalHeaderItem(0, item) - item = QtWidgets.QTableWidgetItem() - self.tableWidget.setHorizontalHeaderItem(1, item) - self.tableWidget.horizontalHeader().setVisible(False) - self.tableWidget.verticalHeader().setVisible(False) - self.gridLayout_2.addWidget(self.tableWidget, 1, 0, 1, 1) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") self.image_frame = QtWidgets.QFrame(parent=standard_image_widget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -87,7 +30,25 @@ def setupUi(self, standard_image_widget): self.image_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) self.image_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) self.image_frame.setObjectName("image_frame") - self.gridLayout_2.addWidget(self.image_frame, 0, 0, 1, 1) + self.verticalLayout.addWidget(self.image_frame) + self.controls_container = QtWidgets.QWidget(parent=standard_image_widget) + self.controls_container.setObjectName("controls_container") + self.horizontalLayout = QtWidgets.QHBoxLayout(self.controls_container) + self.horizontalLayout.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout.setObjectName("horizontalLayout") + self.pushButton_7 = QtWidgets.QPushButton(parent=self.controls_container) + self.pushButton_7.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) + self.pushButton_7.setObjectName("pushButton_7") + self.horizontalLayout.addWidget(self.pushButton_7) + self.pushButton = QtWidgets.QPushButton(parent=self.controls_container) + self.pushButton.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) + self.pushButton.setObjectName("pushButton") + self.horizontalLayout.addWidget(self.pushButton) + self.pushButton_4 = QtWidgets.QPushButton(parent=self.controls_container) + self.pushButton_4.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) + self.pushButton_4.setObjectName("pushButton_4") + self.horizontalLayout.addWidget(self.pushButton_4) + self.verticalLayout.addWidget(self.controls_container) self.delete_confirmation = QtWidgets.QWidget(parent=standard_image_widget) self.delete_confirmation.setObjectName("delete_confirmation") self.gridLayout = QtWidgets.QGridLayout(self.delete_confirmation) @@ -109,9 +70,57 @@ def setupUi(self, standard_image_widget): self.pushButton_6.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) self.pushButton_6.setObjectName("pushButton_6") self.gridLayout.addWidget(self.pushButton_6, 4, 1, 1, 1) - self.gridLayout_2.addWidget(self.delete_confirmation, 2, 0, 1, 1) + self.verticalLayout.addWidget(self.delete_confirmation) + self.similar_groupbox = QtWidgets.QGroupBox(parent=standard_image_widget) + self.similar_groupbox.setObjectName("similar_groupbox") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.similar_groupbox) + self.horizontalLayout_3.setContentsMargins(4, 4, 4, 4) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.samples_widget = SliderWidget(parent=self.similar_groupbox) + self.samples_widget.setMinimumSize(QtCore.QSize(0, 20)) + self.samples_widget.setProperty("slider_callback", "handle_value_change") + self.samples_widget.setProperty("current_value", 100) + self.samples_widget.setProperty("slider_maximum", 100) + self.samples_widget.setProperty("spinbox_maximum", 1.0) + self.samples_widget.setProperty("display_as_float", True) + self.samples_widget.setProperty("spinbox_single_step", 0.01) + self.samples_widget.setProperty("spinbox_page_step", 0.01) + self.samples_widget.setProperty("spinbox_minimum", 0.0) + self.samples_widget.setProperty("slider_minimum", 0) + self.samples_widget.setObjectName("samples_widget") + self.horizontalLayout_3.addWidget(self.samples_widget) + self.pushButton_3 = QtWidgets.QPushButton(parent=self.similar_groupbox) + self.pushButton_3.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) + self.pushButton_3.setObjectName("pushButton_3") + self.horizontalLayout_3.addWidget(self.pushButton_3) + self.pushButton_2 = QtWidgets.QPushButton(parent=self.similar_groupbox) + self.pushButton_2.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) + self.pushButton_2.setObjectName("pushButton_2") + self.horizontalLayout_3.addWidget(self.pushButton_2) + self.verticalLayout.addWidget(self.similar_groupbox) + self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) - self.gridLayout_2.addItem(spacerItem, 3, 0, 1, 1) + self.gridLayout_2.addItem(spacerItem, 7, 0, 1, 1) + self.tableWidget = QtWidgets.QTableWidget(parent=standard_image_widget) + self.tableWidget.setStyleSheet("") + self.tableWidget.setAutoScroll(False) + self.tableWidget.setObjectName("tableWidget") + self.tableWidget.setColumnCount(2) + self.tableWidget.setRowCount(0) + item = QtWidgets.QTableWidgetItem() + self.tableWidget.setHorizontalHeaderItem(0, item) + item = QtWidgets.QTableWidgetItem() + self.tableWidget.setHorizontalHeaderItem(1, item) + self.tableWidget.horizontalHeader().setVisible(False) + self.tableWidget.verticalHeader().setVisible(False) + self.gridLayout_2.addWidget(self.tableWidget, 4, 0, 1, 1) + self.batch_container = QtWidgets.QWidget(parent=standard_image_widget) + self.batch_container.setMinimumSize(QtCore.QSize(0, 128)) + self.batch_container.setStyleSheet("") + self.batch_container.setObjectName("batch_container") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.batch_container) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.gridLayout_2.addWidget(self.batch_container, 5, 0, 1, 1) self.retranslateUi(standard_image_widget) self.pushButton_5.clicked.connect(standard_image_widget.confirm_delete) # type: ignore @@ -126,22 +135,23 @@ def setupUi(self, standard_image_widget): def retranslateUi(self, standard_image_widget): _translate = QtCore.QCoreApplication.translate standard_image_widget.setWindowTitle(_translate("standard_image_widget", "Form")) - self.samples_widget.setProperty("label_text", _translate("standard_image_widget", "Similarity")) - self.samples_widget.setProperty("settings_property", _translate("standard_image_widget", "image_similarity")) - self.pushButton_4.setToolTip(_translate("standard_image_widget", "Send this image to the canvas")) - self.pushButton_4.setText(_translate("standard_image_widget", "To Canvas")) - self.pushButton_2.setToolTip(_translate("standard_image_widget", "Generate a batch of four variations")) - self.pushButton_2.setText(_translate("standard_image_widget", "Batch")) + self.pushButton_7.setText(_translate("standard_image_widget", "Export")) self.pushButton.setToolTip(_translate("standard_image_widget", "Permanently delete this image")) self.pushButton.setText(_translate("standard_image_widget", "Delete")) - self.pushButton_7.setText(_translate("standard_image_widget", "Export")) + self.pushButton_4.setToolTip(_translate("standard_image_widget", "Send this image to the canvas")) + self.pushButton_4.setText(_translate("standard_image_widget", "To Canvas")) + self.label.setText(_translate("standard_image_widget", "Permanently delete?")) + self.pushButton_5.setText(_translate("standard_image_widget", "Yes")) + self.pushButton_6.setText(_translate("standard_image_widget", "No")) + self.similar_groupbox.setTitle(_translate("standard_image_widget", "Generate similar images")) + self.samples_widget.setProperty("label_text", _translate("standard_image_widget", "Similarity")) + self.samples_widget.setProperty("settings_property", _translate("standard_image_widget", "image_similarity")) self.pushButton_3.setToolTip(_translate("standard_image_widget", "Generate one variation")) self.pushButton_3.setText(_translate("standard_image_widget", "Single")) + self.pushButton_2.setToolTip(_translate("standard_image_widget", "Generate a batch of four variations")) + self.pushButton_2.setText(_translate("standard_image_widget", "Batch")) item = self.tableWidget.horizontalHeaderItem(0) item.setText(_translate("standard_image_widget", "New Column")) item = self.tableWidget.horizontalHeaderItem(1) item.setText(_translate("standard_image_widget", "New Column")) - self.label.setText(_translate("standard_image_widget", "Permanently delete?")) - self.pushButton_5.setText(_translate("standard_image_widget", "Yes")) - self.pushButton_6.setText(_translate("standard_image_widget", "No")) from airunner.widgets.slider.slider_widget import SliderWidget diff --git a/src/airunner/widgets/generator_form/generator_form_widget.py b/src/airunner/widgets/generator_form/generator_form_widget.py index 8cf3f77b3..434b3589a 100644 --- a/src/airunner/widgets/generator_form/generator_form_widget.py +++ b/src/airunner/widgets/generator_form/generator_form_widget.py @@ -308,8 +308,6 @@ def call_generate(self, image=None, seed=None, override_data=None): # Save the mask and input image for debugging image = new_image.convert("RGB") - mask.save("mask.png") - image.save("image.png") # Generate a new image using the mask and input image self.do_generate({