diff --git a/src/airunner/aihandler/settings_manager.py b/src/airunner/aihandler/settings_manager.py index 87942ef67..83fbe1140 100644 --- a/src/airunner/aihandler/settings_manager.py +++ b/src/airunner/aihandler/settings_manager.py @@ -201,22 +201,28 @@ def generator(self): def llm_generator_setting(self): llm_generator = session.query(LLMGenerator).filter(LLMGenerator.name == self.current_llm_generator).first() return llm_generator.generator_settings[0] + + _generator = None def find_generator(self, generator_section, generator_name): # using sqlalchemy, query the document.settings.generator_settings column # and find any with GeneratorSettings.section == self.generator_section and GeneratorSettings.generator_name == self.generator_name # return the first result - generator_settings = session.query(GeneratorSetting).filter_by( - section=generator_section, - generator_name=generator_name - ).join(Settings).first() + if self.generator_settings_override_id: + generator_settings = session.query(GeneratorSetting).filter_by( + id=self.generator_settings_override_id + ).join(Settings).first() + else: + generator_settings = session.query(GeneratorSetting).filter_by( + section=generator_section, + generator_name=generator_name + ).join(Settings).first() if generator_settings is None: if not generator_section or generator_section == "" or not generator_name or generator_name == "": return None generator_settings = GeneratorSetting( section=generator_section, - generator_name=generator_name, - settings_id=document.settings.id, + generator_name=generator_name ) session.add(generator_settings) session.commit() diff --git a/src/airunner/alembic/versions/1bbf5fc3748c_added_brushes_tabel.py b/src/airunner/alembic/versions/1bbf5fc3748c_added_brushes_tabel.py new file mode 100644 index 000000000..b6452f913 --- /dev/null +++ b/src/airunner/alembic/versions/1bbf5fc3748c_added_brushes_tabel.py @@ -0,0 +1,30 @@ +"""added brushes tabel + +Revision ID: 1bbf5fc3748c +Revises: 08fb52568b41 +Create Date: 2023-12-31 10:23:02.460956 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = '1bbf5fc3748c' +down_revision: Union[str, None] = '08fb52568b41' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### diff --git a/src/airunner/alembic/versions/28d612bd908c_added_generator_settings_override_id_to_.py b/src/airunner/alembic/versions/28d612bd908c_added_generator_settings_override_id_to_.py new file mode 100644 index 000000000..5ecef3958 --- /dev/null +++ b/src/airunner/alembic/versions/28d612bd908c_added_generator_settings_override_id_to_.py @@ -0,0 +1,47 @@ +"""Added generator_settings_override_id to settings + +Revision ID: 28d612bd908c +Revises: 1bbf5fc3748c +Create Date: 2024-01-01 15:34:54.674668 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = '28d612bd908c' +down_revision: Union[str, None] = '1bbf5fc3748c' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + with op.batch_alter_table("brushes") as batch_op: + #batch_op.drop_constraint('generator_setting_id', type_='foreignkey') + batch_op.drop_column('generator_setting_id') + + with op.batch_alter_table("generator_settings") as batch_op: + #batch_op.drop_constraint('settings_id', type_='foreignkey') + batch_op.drop_column('settings_id') + + with op.batch_alter_table("settings") as batch_op: + batch_op.create_foreign_key('settings_id', 'generator_settings', ['generator_settings_override_id'], ['id']) + batch_op.drop_column('current_section_shape') + batch_op.drop_column('current_version_kandinsky') + batch_op.drop_column('current_section_kandinsky') + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('settings', sa.Column('current_section_kandinsky', sa.VARCHAR(), nullable=True)) + op.add_column('settings', sa.Column('current_version_kandinsky', sa.VARCHAR(), nullable=True)) + op.add_column('settings', sa.Column('current_section_shape', sa.VARCHAR(), nullable=True)) + op.drop_constraint(None, 'settings', type_='foreignkey') + op.add_column('generator_settings', sa.Column('settings_id', sa.INTEGER(), nullable=True)) + op.create_foreign_key(None, 'generator_settings', 'settings', ['settings_id'], ['id']) + op.add_column('brushes', sa.Column('generator_setting_id', sa.INTEGER(), nullable=True)) + op.create_foreign_key(None, 'brushes', 'prompt_generator_settings', ['generator_setting_id'], ['id']) + # ### end Alembic commands ### diff --git a/src/airunner/alembic/versions/6f4472b84071_fixes_brush_link_to_generator_settings.py b/src/airunner/alembic/versions/6f4472b84071_fixes_brush_link_to_generator_settings.py new file mode 100644 index 000000000..32a66d2fc --- /dev/null +++ b/src/airunner/alembic/versions/6f4472b84071_fixes_brush_link_to_generator_settings.py @@ -0,0 +1,30 @@ +"""Fixes brush link to generator settings + +Revision ID: 6f4472b84071 +Revises: d25b0e141c27 +Create Date: 2024-01-01 15:49:27.635195 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = '6f4472b84071' +down_revision: Union[str, None] = 'd25b0e141c27' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### diff --git a/src/airunner/alembic/versions/d25b0e141c27_added_ids.py b/src/airunner/alembic/versions/d25b0e141c27_added_ids.py new file mode 100644 index 000000000..151ec7348 --- /dev/null +++ b/src/airunner/alembic/versions/d25b0e141c27_added_ids.py @@ -0,0 +1,32 @@ +"""Added ids + +Revision ID: d25b0e141c27 +Revises: 28d612bd908c +Create Date: 2024-01-01 15:45:14.216904 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = 'd25b0e141c27' +down_revision: Union[str, None] = '28d612bd908c' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + with op.batch_alter_table("brushes") as batch_op: + batch_op.add_column(sa.Column('generator_setting_id', sa.Integer(), nullable=True)) + batch_op.create_foreign_key('fk_brushes_generator_setting_id', 'generator_settings', ['generator_setting_id'], ['id']) + + # rest of your code + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### diff --git a/src/airunner/data/models.py b/src/airunner/data/models.py index 8a37797c8..edac49b49 100644 --- a/src/airunner/data/models.py +++ b/src/airunner/data/models.py @@ -318,7 +318,6 @@ class GeneratorSetting(BaseModel): id = Column(Integer, primary_key=True) section = Column(String) generator_name = Column(String) - settings_id = Column(Integer, ForeignKey('settings.id')) prompt = Column(String, default="") negative_prompt = Column(String, default="") steps = Column(Integer, default=20) @@ -356,6 +355,18 @@ class GeneratorSetting(BaseModel): use_prompt_builder = Column(Boolean, default=False) active_grid_border_color = Column(String, default="#00FF00") active_grid_fill_color = Column(String, default="#FF0000") + brushes = relationship("Brush", back_populates='generator_setting') # modified line + + +class Brush(BaseModel): + __tablename__ = 'brushes' + + id = Column(Integer, primary_key=True) + name = Column(String, nullable=False) + thumbnail = Column(String, nullable=False) + generator_setting_id = Column(Integer, ForeignKey('generator_settings.id')) # new line + generator_setting = relationship('GeneratorSetting', back_populates='brushes') # modified line + class PromptGeneratorSetting(BaseModel): @@ -648,6 +659,8 @@ class Settings(BaseModel): enable_tts = Column(Boolean, default=True) + generator_settings_override_id = Column(Integer, ForeignKey('generator_settings.id')) + class StandardImageWidgetSettings(BaseModel): __tablename__ = 'standard_image_widget_settings' @@ -812,3 +825,5 @@ class Message(BaseModel): message = Column(String) conversation_id = Column(Integer, ForeignKey('conversation.id')) conversation = relationship('Conversation', back_populates='messages') + + diff --git a/src/airunner/widgets/base_widget.py b/src/airunner/widgets/base_widget.py index c0fd1ff87..268443c17 100644 --- a/src/airunner/widgets/base_widget.py +++ b/src/airunner/widgets/base_widget.py @@ -27,14 +27,16 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.app = get_main_window() self.settings_manager = SettingsManager() - self.ui = self.widget_class_() - self.ui.setupUi(self) - if self.qss_filename: - theme_name = "dark_theme" - here = os.path.dirname(os.path.realpath(__file__)) - with open(os.path.join(here, "..", "styles", theme_name, self.qss_filename), "r") as f: - stylesheet = f.read() - self.setStyleSheet(stylesheet) + if self.widget_class_: + self.ui = self.widget_class_() + if self.ui: + self.ui.setupUi(self) + if self.qss_filename: + theme_name = "dark_theme" + here = os.path.dirname(os.path.realpath(__file__)) + with open(os.path.join(here, "..", "styles", theme_name, self.qss_filename), "r") as f: + stylesheet = f.read() + self.setStyleSheet(stylesheet) def set_stylesheet(self, is_dark=None, button_name=None, icon=None): is_dark = self.is_dark if is_dark is None else is_dark diff --git a/src/airunner/widgets/brush/brush_container_widget.py b/src/airunner/widgets/brush/brush_container_widget.py index 73c179410..37a4c8700 100644 --- a/src/airunner/widgets/brush/brush_container_widget.py +++ b/src/airunner/widgets/brush/brush_container_widget.py @@ -7,6 +7,5 @@ class BrushContainerWidget(BaseWidget): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - print(self.settings_manager.brush_settings.size) self.ui.brush_size_slider.setProperty("current_value", self.settings_manager.brush_settings.size) self.ui.brush_size_slider.initialize() diff --git a/src/airunner/widgets/brushes/brushes_container.py b/src/airunner/widgets/brushes/brushes_container.py new file mode 100644 index 000000000..edd6a585e --- /dev/null +++ b/src/airunner/widgets/brushes/brushes_container.py @@ -0,0 +1,236 @@ +import io +import json +from airunner.widgets.base_widget import BaseWidget +from airunner.widgets.image.image_widget import BrushImageWidget +from airunner.widgets.qflowlayout.q_flow_layout import QFlowLayout +from PyQt6.QtWidgets import QInputDialog +from PyQt6.QtGui import QPixmap +from PyQt6.QtCore import Qt +from airunner.utils import get_session +from airunner.data.models import Brush, GeneratorSetting +import base64 +from PIL import Image +from io import BytesIO +from PyQt6.QtCore import QBuffer +from PyQt6.QtWidgets import QMenu + + +class BrushesContainer(BaseWidget): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # Enable the widget to accept drops + self.setAcceptDrops(True) + + # Create a layout to manage the widgets + self.layout = QFlowLayout() + self.setLayout(self.layout) + + self.load_brushes() + + def dragEnterEvent(self, event): + # Accept the drag enter event if the data is text + event.acceptProposedAction() + + def save_brush(self, brush_name, thumbnail: QPixmap, meta_data): + # Convert QPixmap to QImage + image = thumbnail.toImage() + + # Convert QImage to raw bytes + from PyQt6.QtCore import QIODevice # Import the QIODevice class + + buffer = QBuffer() + buffer.open(QIODevice.OpenModeFlag.ReadWrite) # Use QIODevice.OpenModeFlag.ReadWrite + image.save(buffer, "PNG") + + # Use PIL to open the image from raw bytes + with Image.open(io.BytesIO(buffer.data())) as img: + # Convert the image to RGB + img = img.convert('RGB') + + # Create a BytesIO object + buffer = BytesIO() + + # Save the image to the BytesIO object + img.save(buffer, format='PNG') + + # Get the bytes value of the image + img_bytes = buffer.getvalue() + + # Convert the bytes to base64 + img_base64 = base64.b64encode(img_bytes).decode() + + session = get_session() + + # Create a new GeneratorSetting entry with the metadata + generator_setting = GeneratorSetting( + section=meta_data.get("section", getattr(self.settings_manager, f"current_section_{self.settings_manager.current_image_generator}")), + generator_name=meta_data.get("generator_name", self.settings_manager.current_image_generator), + prompt=meta_data.get("prompt", ""), + negative_prompt=meta_data.get("negative_prompt", ""), + steps=meta_data.get("steps", 20), + ddim_eta=meta_data.get("ddim_eta", 0.5), + height=meta_data.get("height", 512), + width=meta_data.get("width", 512), + scale=meta_data.get("scale", 750), + seed=meta_data.get("seed", 42), + latents_seed=meta_data.get("latents_seed", 84), + random_seed=meta_data.get("random_seed", True), + random_latents_seed=meta_data.get("random_latents_seed", True), + model=meta_data.get("model", ""), + scheduler=meta_data.get("scheduler", "DPM++ 2M Karras"), + prompt_triggers=meta_data.get("prompt_triggers", ""), + strength=meta_data.get("strength", 50), + image_guidance_scale=meta_data.get("image_guidance_scale", 150), + n_samples=meta_data.get("n_samples", 1), + controlnet=meta_data.get("controlnet", ""), + enable_controlnet=meta_data.get("enable_controlnet", False), + enable_input_image=meta_data.get("enable_input_image", False), + controlnet_guidance_scale=meta_data.get("controlnet_guidance_scale", 50), + clip_skip=meta_data.get("clip_skip", 0), + variation=meta_data.get("variation", False), + input_image_use_imported_image=meta_data.get("input_image_use_imported_image", False), + input_image_use_grid_image=meta_data.get("input_image_use_grid_image", True), + input_image_recycle_grid_image=meta_data.get("input_image_recycle_grid_image", True), + input_image_mask_use_input_image=meta_data.get("input_image_mask_use_input_image", True), + input_image_mask_use_imported_image=meta_data.get("input_image_mask_use_imported_image", False), + controlnet_input_image_link_to_input_image=meta_data.get("controlnet_input_image_link_to_input_image", True), + controlnet_input_image_use_imported_image=meta_data.get("controlnet_input_image_use_imported_image", False), + controlnet_use_grid_image=meta_data.get("controlnet_use_grid_image", False), + controlnet_recycle_grid_image=meta_data.get("controlnet_recycle_grid_image", False), + controlnet_mask_link_input_image=meta_data.get("controlnet_mask_link_input_image", False), + controlnet_mask_use_imported_image=meta_data.get("controlnet_mask_use_imported_image", False), + use_prompt_builder=meta_data.get("use_prompt_builder", False), + active_grid_border_color=meta_data.get("active_grid_border_color", "#00FF00"), + active_grid_fill_color=meta_data.get("active_grid_fill_color", "#FF0000") + ) + + session.add(generator_setting) + session.commit() + + # Create a new Brush entry associated with the GeneratorSetting entry + brush = Brush(name=brush_name, thumbnail=img_base64, generator_setting_id=generator_setting.id) + session.add(brush) + + session.commit() + + return brush + + selected_brushes = [] + + def activate_brush(self, clicked_widget, brush, multiple): + if clicked_widget in self.selected_brushes: + if len(self.selected_brushes) == 1: + self.selected_brushes.remove(clicked_widget) + clicked_widget.setStyleSheet("") + else: + for widget in self.selected_brushes: + if not multiple: + if widget is not clicked_widget: + self.selected_brushes.remove(widget) + widget.setStyleSheet("") + break + else: + self.selected_brushes.remove(widget) + widget.setStyleSheet("") + return + + for widget in self.selected_brushes: + try: + widget.setStyleSheet("") + except RuntimeError: + pass + + if not multiple: + self.selected_brushes = [clicked_widget] + else: + self.selected_brushes.append(clicked_widget) + + if len(self.selected_brushes) > 2: + self.selected_brushes = self.selected_brushes[1:] + + for widget in self.selected_brushes: + widget.setStyleSheet(f""" + border: 2px solid #ff0000; + """) + self.app.ui.generator_widget.enable_preset(widget.brush.generator_setting_id) + + def display_brush_menu(self, event, widget, brush): + context_menu = QMenu(self) + + delete_action = context_menu.addAction("Delete brush") + delete_action.triggered.connect(lambda: self.delete_brush(widget, brush)) + + global_position = self.mapToGlobal(event.pos()) + context_menu.exec(global_position) + + def delete_brush(self, widget, brush): + session = get_session() + brush = session.query(Brush).filter(Brush.id == brush.id).first() + generator_setting = session.query(GeneratorSetting).filter(GeneratorSetting.id == brush.generator_setting_id).first() + + if generator_setting is not None: + session.delete(generator_setting) + + if brush is not None: + session.delete(brush) + + session.commit() + widget.deleteLater() + + def create_and_add_widget(self, image_source, is_base64=False, brush=None): + widget = BrushImageWidget(self, container=self, brush=brush) + + if is_base64: + # Convert the base64 image back to bytes + img_bytes = base64.b64decode(image_source) + + # Create a BytesIO object from the bytes + buffer = BytesIO(img_bytes) + + # Open the image file + img = Image.open(buffer) + else: + img = image_source + # Set the image to the widget + widget.set_image(img) + + # Add the widget to the layout + self.layout.addWidget(widget) + + return widget + + def dropEvent(self, event): + # Get the metadata from the event's mime data + meta_data_bytes = event.mimeData().data("application/x-qt-image-metadata") + + # Decode the bytes to a string + meta_data_str = bytes(meta_data_bytes).decode() + + # Parse the JSON string to a dictionary + meta_data = json.loads(meta_data_str) + + image_path = meta_data["path"] + + # Create an instance of the widget with the image path + widget = self.create_and_add_widget(image_path) + + # Show a popup window asking the user to name the brush + brush_name, ok = QInputDialog.getText(self, 'Name the preset', 'Enter preset name:') + + # If the user cancels the dialog, remove the widget from the layout + if not ok or not brush_name: + widget.deleteLater() + else: + # Save the brush name, thumbnail, and metadata to the database + widget.brush = self.save_brush(brush_name, widget.thumbnail(), meta_data) + + + event.acceptProposedAction() + + def load_brushes(self): + session = get_session() + brushes = session.query(Brush).all() + + for brush in brushes: + self.create_and_add_widget(brush.thumbnail, is_base64=True, brush=brush) diff --git a/src/airunner/widgets/canvas_plus/canvas_plus_widget.py b/src/airunner/widgets/canvas_plus/canvas_plus_widget.py index 0f880c2fd..d5097f515 100644 --- a/src/airunner/widgets/canvas_plus/canvas_plus_widget.py +++ b/src/airunner/widgets/canvas_plus/canvas_plus_widget.py @@ -335,8 +335,6 @@ def handle_changed_signal(self, key, value): self.do_draw() elif key == "current_section_stablediffusion": self.do_draw() - elif key == "current_section_kandinsky": - self.do_draw() elif key == "layer_image_data.visible": self.do_draw() elif key == "layer_data.hidden": @@ -507,8 +505,6 @@ def update_cursor(self): self.ui.canvas_container.setCursor(QCursor(Qt.CursorShape.ArrowCursor)) def handle_image_data(self, data): - if self.app.canvas_is_active: - pass options = data["data"]["options"] images = data["images"] outpaint_box_rect = options["outpaint_box_rect"] @@ -516,8 +512,7 @@ def handle_image_data(self, data): processed_image, image_root_point, image_pivot_point = self.handle_outpaint( outpaint_box_rect, images[0], - section, - is_kandinsky=options.get("generator_section", "") == "kandinsky" + section ) self.load_image_from_object( processed_image, @@ -525,7 +520,7 @@ def handle_image_data(self, data): image_root_point=image_root_point ) - def handle_outpaint(self, outpaint_box_rect, outpainted_image, action=None, is_kandinsky=False): + def handle_outpaint(self, outpaint_box_rect, outpainted_image, action=None): if self.current_active_image is None: point = QPoint(outpaint_box_rect.x(), outpaint_box_rect.y()) return outpainted_image, QPoint(0, 0), point @@ -568,7 +563,7 @@ def handle_outpaint(self, outpaint_box_rect, outpainted_image, action=None, is_k new_image_a.paste(outpainted_image, (int(outpaint_box_rect.x()), int(outpaint_box_rect.y()))) new_image_b.paste(existing_image_copy, (current_image_position.x(), current_image_position.y())) - if action == "outpaint" and not is_kandinsky: + if action == "outpaint": new_image = Image.alpha_composite(new_image, new_image_a) new_image = Image.alpha_composite(new_image, new_image_b) else: @@ -584,8 +579,7 @@ def load_image_from_path(self, image_path): self.load_image_from_object(image) def load_image_from_object(self, image, is_outpaint=False, image_root_point=None): - if self.app.canvas_is_active: - self.add_image_to_scene(image, is_outpaint=is_outpaint, image_root_point=image_root_point) + self.add_image_to_scene(image, is_outpaint=is_outpaint, image_root_point=image_root_point) def load_image(self, image_path): image = Image.open(image_path) diff --git a/src/airunner/widgets/canvas_plus/standard_base_widget.py b/src/airunner/widgets/canvas_plus/standard_base_widget.py index be43498c4..821350fb2 100644 --- a/src/airunner/widgets/canvas_plus/standard_base_widget.py +++ b/src/airunner/widgets/canvas_plus/standard_base_widget.py @@ -9,27 +9,9 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.app.image_data.connect(self.handle_image_data) self.app.load_image.connect(self.load_image_from_path) - self.ui.delete_confirmation.hide() - def image_to_canvas(self): - self.app.load_image_object.emit(self.image) - - def delete_image(self): - self.ui.delete_confirmation.show() - - def confirm_delete(self): - self._label.setPixmap(QPixmap()) - delete_image(self.image_path) - self.ui.delete_confirmation.hide() - - def cancel_delete(self): - self.ui.delete_confirmation.hide() - def handle_image_data(self, data): pass def load_image_from_path(self, image_path): - pass - - def export_image(self): - self.app.export_image(self.image) + pass diff --git a/src/airunner/widgets/canvas_plus/standard_image_widget.py b/src/airunner/widgets/canvas_plus/standard_image_widget.py index 36e5888e4..0a2465006 100644 --- a/src/airunner/widgets/canvas_plus/standard_image_widget.py +++ b/src/airunner/widgets/canvas_plus/standard_image_widget.py @@ -17,7 +17,8 @@ from airunner.widgets.canvas_plus.templates.standard_image_widget_ui import Ui_standard_image_widget from airunner.utils import delete_image, load_metadata_from_image, prepare_metadata from airunner.settings import CONTROLNET_OPTIONS - +from airunner.widgets.slider.slider_widget import SliderWidget +from airunner.data.models import ActionScheduler, Pipeline class StandardImageWidget(StandardBaseWidget): widget_class_ = Ui_standard_image_widget @@ -31,14 +32,48 @@ class StandardImageWidget(StandardBaseWidget): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.load_controlnet_options() + self.ui.advanced_settings.hide() self.load_upscale_options() + self.set_controlnet_settings_properties() + self.set_input_image_widget_properties() + self.ui.ddim_eta_slider_widget.hide() + self.ui.frames_slider_widget.hide() + self.initialize() + + def set_controlnet_settings_properties(self): + self.ui.controlnet_settings.initialize( + self.settings_manager.generator_name, + self.settings_manager.generator_section + ) + + def set_input_image_widget_properties(self): + self.ui.input_image_widget.initialize( + self.settings_manager.generator_name, + self.settings_manager.generator_section + ) + self.ui.controlnet_settings.initialize( + self.settings_manager.generator_name, + self.settings_manager.generator_section + ) + + def update_image_input_thumbnail(self): + self.ui.input_image_widget.set_thumbnail() + + def update_controlnet_settings_thumbnail(self): + self.ui.controlnet_settings.set_thumbnail() + + def update_thumbnails(self): + self.update_image_input_thumbnail() + self.update_controlnet_settings_thumbnail() - def load_controlnet_options(self): - self.ui.controlnet.blockSignals(True) - self.ui.controlnet.clear() - self.ui.controlnet.addItems(CONTROLNET_OPTIONS) - self.ui.controlnet.blockSignals(False) + def upscale_number_changed(self, val): + print("upscale int", val) + + def handle_advanced_settings_checkbox(self, val): + if val: + self.ui.advanced_settings.show() + else: + self.ui.advanced_settings.hide() def load_upscale_options(self): self.ui.upscale_model.blockSignals(True) @@ -61,31 +96,7 @@ def face_enhance_toggled(self, val): def handle_controlnet_changed(self, val): self.settings_manager.set_value("standard_image_widget_settings.controlnet", val) - - def reset_prompt_clicked(self): - self.settings_manager.set_value("standard_image_widget_settings.prompt", "") - self.set_prompt_text() - - def reset_negative_prompt_clicked(self): - self.settings_manager.set_value("standard_image_widget_settings.negative_prompt", "") - self.set_negative_prompt_text() - - def toggle_prompt_reset_button(self, enabled): - self.ui.reset_prompt.setEnabled(enabled) - def toggle_negative_prompt_reset_button(self, enabled): - self.ui.reset_negative_prompt.setEnabled(enabled) - - def prompt_changed(self): - val = self.ui.prompt.toPlainText() - self.settings_manager.set_value("standard_image_widget_settings.prompt", val) - self.toggle_prompt_reset_button(val != "") - - def negative_prompt_changed(self): - val = self.ui.negative_prompt.toPlainText() - self.settings_manager.set_value("standard_image_widget_settings.negative_prompt", val) - self.toggle_negative_prompt_reset_button(val != "") - def handle_image_data(self, data): images = data["images"] if len(images) == 1: @@ -96,36 +107,16 @@ def load_image_from_path(self, image_path): self.load_image_from_object(image=image, image_path=image_path) def load_image_from_object(self, image, image_path=NotImplemented): - if self.app.image_editor_tab_name == "Standard": - self.set_pixmap(image=image, image_path=image_path) - - def set_prompt_text(self): - self.ui.prompt.blockSignals(True) - prompt = self.settings_manager.standard_image_widget_settings.prompt - self.toggle_prompt_reset_button(prompt != "") - if not prompt: - prompt = self.meta_data.get("prompt", None) if self.meta_data else "" - self.ui.prompt.setPlainText(prompt) - self.ui.prompt.blockSignals(False) - - def set_negative_prompt_text(self): - self.ui.negative_prompt.blockSignals(True) - negative_prompt = self.settings_manager.standard_image_widget_settings.negative_prompt - self.toggle_negative_prompt_reset_button(negative_prompt != "") - if not negative_prompt: - negative_prompt = self.meta_data.get("negative_prompt", None) if self.meta_data else "" - self.ui.negative_prompt.setPlainText(negative_prompt) - self.ui.negative_prompt.blockSignals(False) + self.set_pixmap(image=image, image_path=image_path) def set_pixmap(self, image_path=None, image=None): self.image_path = image_path self.image = image meta_data = image.info + print("META DATA", meta_data) self.meta_data = meta_data if meta_data is not None else load_metadata_from_image(image) - size = self.ui.image_frame.width() - 20 - - self.set_prompt_text() - self.set_negative_prompt_text() + return + #size = self.ui.image_frame.width() - 20 pixmap = self._pixmap if not pixmap: @@ -209,19 +200,6 @@ def handle_label_clicked(self, event): self.dialog.show() - def set_table_data(self, data): - if "options" in data: - data = data["options"] - - for k, v in data.items(): - self.ui.tableWidget.insertRow(self.ui.tableWidget.rowCount()) - self.ui.tableWidget.setItem(self.ui.tableWidget.rowCount()-1, 0, QTableWidgetItem(str(k))) - self.ui.tableWidget.setItem(self.ui.tableWidget.rowCount()-1, 1, QTableWidgetItem(str(v))) - self.ui.tableWidget.resizeColumnsToContents() - self.ui.tableWidget.resizeRowsToContents() - self.ui.tableWidget.update() - QApplication.processEvents() - def similar_image_with_prompt(self): """ Using the LLM, generate a description of the image @@ -312,4 +290,140 @@ def upscale_2x_clicked(self): self.app.generator_tab_widget.current_generator_widget.call_generate( image=self.image, override_data=meta_data - ) \ No newline at end of file + ) + + def set_form_values(self): + self.set_form_property("steps_widget", "current_value", "generator.steps") + self.set_form_property("scale_widget", "current_value", "generator.scale") + + def load_pipelines(self): + self.ui.pipeline.blockSignals(True) + self.ui.pipeline.clear() + pipeline_names = ["txt2img / img2img", "inpaint / outpaint", "depth2img", "pix2pix", "upscale", "superresolution", "txt2vid"] + self.ui.pipeline.addItems(pipeline_names) + current_pipeline = getattr(self.settings_manager, f"current_section_{self.settings_manager.current_image_generator}") + if current_pipeline != "": + if current_pipeline == "txt2img": + current_pipeline = "txt2img / img2img" + elif current_pipeline == "outpaint": + current_pipeline = "inpaint / outpaint" + self.ui.pipeline.setCurrentText(current_pipeline) + self.ui.pipeline.blockSignals(False) + + def load_versions(self): + session = get_session() + self.ui.version.blockSignals(True) + self.ui.version.clear() + pipelines = session.query(Pipeline).filter(Pipeline.category == self.settings_manager.current_image_generator).all() + version_names = set([pipeline.version for pipeline in pipelines]) + self.ui.version.addItems(version_names) + current_version = getattr(self.settings_manager, f"current_version_{self.settings_manager.current_image_generator}") + if current_version != "": + self.ui.version.setCurrentText(current_version) + self.ui.version.blockSignals(False) + + def handle_pipeline_changed(self, val): + if val == "txt2img / img2img": + val = "txt2img" + elif val == "inpaint / outpaint": + val = "outpaint" + self.settings_manager.set_value(f"current_section_{self.settings_manager.current_image_generator}", val) + self.load_versions() + self.load_models() + + def handle_version_changed(self, val): + print("VERSION CHANGED", val) + self.settings_manager.set_value(f"current_version_{self.settings_manager.current_image_generator}", val) + self.load_models() + + def load_models(self): + session = get_session() + self.ui.model.blockSignals(True) + self.clear_models() + + image_generator = self.settings_manager.current_image_generator + pipeline = getattr(self.settings_manager, f"current_section_{image_generator}") + version = getattr(self.settings_manager, f"current_version_{image_generator}") + + models = session.query(AIModel).filter( + AIModel.category == image_generator, + AIModel.pipeline_action == pipeline, + AIModel.version == version, + AIModel.enabled == True + ).all() + model_names = [model.name for model in models] + self.ui.model.addItems(model_names) + current_model = self.settings_manager.generator.model + if current_model != "": + self.ui.model.setCurrentText(current_model) + else: + self.settings_manager.set_value("generator.model", self.ui.model.currentText()) + self.ui.model.blockSignals(False) + + def load_schedulers(self): + self.ui.scheduler.blockSignals(True) + session = get_session() + schedulers = session.query(ActionScheduler).filter( + ActionScheduler.section == getattr(self.settings_manager, f"current_section_{self.settings_manager.current_image_generator}"), + ActionScheduler.generator_name == self.settings_manager.current_image_generator + ).all() + scheduler_names = [s.scheduler.display_name for s in schedulers] + self.ui.scheduler.clear() + self.ui.scheduler.addItems(scheduler_names) + + current_scheduler = self.settings_manager.generator.scheduler + if current_scheduler != "": + self.ui.scheduler.setCurrentText(current_scheduler) + else: + self.settings_manager.set_value("generator.scheduler", self.ui.scheduler.currentText()) + self.ui.scheduler.blockSignals(False) + + def clear_models(self): + self.ui.model.clear() + + def handle_settings_manager_changed(self, key, val, settings_manager): + print("handle_settings_manager_changed", key, val) + if settings_manager.generator_section == self.settings_manager.generator_section and settings_manager.generator_name == self.settings_manager.generator_name: + self.set_form_values() + self.load_pipelines() + self.load_versions() + self.load_models() + self.load_schedulers() + + def initialize(self): + self.set_form_values() + self.load_pipelines() + self.load_versions() + self.load_models() + self.load_schedulers() + + # listen to emitted signal from self.settings_manager.changed_signal + self.settings_manager.changed_signal.connect(self.handle_settings_manager_changed) + + # find all SliderWidget widgets in the template and call initialize + for widget in self.findChildren(SliderWidget): + try: + current_value = getattr( + self.generator_settings, + widget.property("settings_property").split(".")[1] + ) + except Exception as e: + current_value = None + if current_value is not None: + widget.setProperty("current_value", current_value) + widget.initialize() + + self.ui.seed_widget.setProperty("generator_section", getattr(self.settings_manager, f"current_section_{self.settings_manager.current_image_generator}")) + self.ui.seed_widget.setProperty("generator_name", self.settings_manager.current_image_generator) + # self.ui.seed_widget.initialize( + # self.generator_section, + # self.generator_name + # ) + + self.ui.seed_widget_latents.setProperty("generator_section", getattr(self.settings_manager, f"current_section_{self.settings_manager.current_image_generator}")) + self.ui.seed_widget_latents.setProperty("generator_name", self.settings_manager.current_image_generator) + # self.ui.seed_widget_latents.initialize( + # self.generator_section, + # self.generator_name + # ) + self.initialized = True \ No newline at end of file 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 0e5a5e41b..77553b23c 100644 --- a/src/airunner/widgets/canvas_plus/templates/standard_image_widget.ui +++ b/src/airunner/widgets/canvas_plus/templates/standard_image_widget.ui @@ -6,13 +6,13 @@ 0 0 - 552 - 1232 + 1181 + 1243 - 552 + 16777215 16777215 @@ -20,279 +20,82 @@ Form - - - - - 0 - 0 - - - - 0 + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal - - - Similar - - + + + + 0 + 0 + + + + + 450 + 0 + + + + + 450 + 16777215 + + + + + 0 + + + 0 + + + 0 + + + 0 + - + - 8 - false + 9 - - Controlnet + + Qt::LeftToRight - - - - - - - - - - - - - - 0 - 20 - - - - Similarity - - - handle_value_change - - - 100 - - - 100 - - - 1.000000000000000 - - - true - - - 0.010000000000000 - - - 0.010000000000000 - - - 0.000000000000000 - - - 0 - - - standard_image_widget_settings.image_similarity - - - - - - - PointingHandCursor - - - Generate one variation - - - Single - - - - - - - PointingHandCursor - - - Generate a batch of four variations - - - Batch - - - - - - - - - - Upscale - - - - - - - - - RealESRGAN_x4plus - - - - - RealESRNet_x4plus - - - - - RealESRGAN_x4plus_anime_6B - - - - - RealESRGAN_x2plus - - - - - realesr-animevideov3 - - - - - realesr-general-x4v3 - - - - - - - - Face enhance - - - - - - - - - PointingHandCursor - - - 2x Upscale + + 0 - - - - - - - - - - - - - 0 - 0 - - - - - 532 - 532 - - - - - 532 - 532 - - - - true - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - PointingHandCursor - - - Export - - - - - - - PointingHandCursor - - - Permanently delete this image - - - Delete - - - - - - - PointingHandCursor - - - Send this image to the canvas + + + - - To Canvas - - - - - - - - - - - - - Permanently delete? - - - - - - + + + + + Settings + + + Stable Diffusion settings + + 0 @@ -305,99 +108,692 @@ 0 + + + + true + + + + + 0 + 0 + 444 + 1211 + + + + + + + + + + + + + + + generator.random_seed + + + + + + + + + + + + + generator.random_latents_seed + + + + + + + + + + + Steps + + + handle_value_change + + + 0 + + + 200 + + + 200.000000000000000 + + + false + + + 1 + + + 1 + + + 1 + + + 1 + + + generator.steps + + + + + + + Scale + + + 0 + + + 10000 + + + 100.000000000000000 + + + true + + + 0.010000000000000 + + + 0.010000000000000 + + + handle_value_change + + + generator.scale + + + + + + + + + + + DDIM ETA + + + handle_value_change + + + 1 + + + 10 + + + 10 + + + false + + + 1 + + + 1 + + + 1 + + + 1 + + + generator.ddim_eta + + + + + + + Frames + + + handle_value_change + + + 0 + + + 200 + + + 200.000000000000000 + + + false + + + 1 + + + 1 + + + 1 + + + 1 + + + generator.n_samples + + + + + + + + + + + Samples + + + handle_value_change + + + 0 + + + 500 + + + 500.000000000000000 + + + false + + + 1 + + + 1 + + + 1 + + + 1 + + + generator.n_samples + + + + + + + Clip Skip + + + 0 + + + 11 + + + 12.000000000000000 + + + false + + + 1 + + + 1 + + + 0 + + + 0 + + + handle_value_change + + + generator.clip_skip + + + + + + + + + + + + + + 8 + true + + + + Pipeline + + + + + + + + + + + + + + + 8 + true + + + + Version + + + + + + + + + + + + + + + 8 + true + + + + Model + + + + + + + + + + + + + + + 8 + true + + + + Scheduler + + + + + + + ArrowCursor + + + + + + + + + + + + + PointingHandCursor + + + Variation + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + - - - - - PointingHandCursor - - - Yes - + + + Presets + + + Stable Diffusion setting presets + + + + + + true + + + + + - - - - - PointingHandCursor - - - No - + + + Embeddings + + + + + + - - - - - - - - - - - - - 11 - false - - - - Prompt - - - - - - - - - - - - - - Reset - - - - + + + LoRA + + + + + + + + + + Similar + + + + + + + + + 0 + 20 + + + + Similarity + + + handle_value_change + + + 100 + + + 100 + + + 1.000000000000000 + + + true + + + 0.010000000000000 + + + 0.010000000000000 + + + 0.000000000000000 + + + 0 + + + standard_image_widget_settings.image_similarity + + + + + + + PointingHandCursor + + + Generate one variation + + + Single + + + + + + + PointingHandCursor + + + Generate a batch of four variations + + + Batch + + + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Advanced settings + + + + + + + + Upscale + + + + + + + + + RealESRGAN_x4plus + + + + + RealESRNet_x4plus + + + + + RealESRGAN_x4plus_anime_6B + + + + + RealESRGAN_x2plus + + + + + realesr-animevideov3 + + + + + realesr-general-x4v3 + + + + + + + + Face enhance + + + + + + + + + + + + 2x + + + + + 4x + + + + + + + + PointingHandCursor + + + Upscale + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + - - - - - - - 11 - false - - - - Negative Prompt - - - - - - - - - - - - - - Reset - - - - + + + + + + 0 + + + 0 + + + 9 + + + 0 + + + + + + 0 + 0 + + + + + 532 + 532 + + + + + 16777215 + 16777215 + + + + PointingHandCursor + + + true + + - - + + @@ -408,121 +804,99 @@
airunner/widgets/slider/slider_widget
1 + + EmbeddingsContainerWidget + QWidget +
airunner/widgets/embeddings/embeddings_container_widget
+ 1 +
+ + LoraContainerWidget + QWidget +
airunner/widgets/lora/lora_container_widget
+ 1 +
+ + BrushesContainer + QWidget +
airunner/widgets/brushes/brushes_container
+ 1 +
+ + InputImageSettingsWidget + QWidget +
airunner/widgets/input_image/input_image_settings_widget
+ 1 +
+ + ControlNetSettingsWidget + QWidget +
airunner/widgets/controlnet_settings/controlnet_settings_widget
+ 1 +
+ + CanvasPlusWidget + QWidget +
airunner/widgets/canvas_plus/canvas_plus_widget
+ 1 +
+ + SeedWidget + QWidget +
airunner/widgets/seed/seed_widget
+ 1 +
- confirm_delete_button - clicked() - standard_image_widget - confirm_delete() - - - 259 - 552 - - - 237 - 0 - - - - - cancel_delete_button - clicked() - standard_image_widget - cancel_delete() - - - 532 - 552 - - - 368 - 0 - - - - - to_canvas_button - clicked() - standard_image_widget - image_to_canvas() - - - 541 - 483 - - - 85 - 0 - - - - - delete_button - clicked() + upscale_model + currentTextChanged(QString) standard_image_widget - delete_image() + upscale_model_changed(QString) - 326 - 483 + 144 + 67 - 310 - 0 + 79 + -16 - generate_single_simillar_button - clicked() + face_enhance + clicked(bool) standard_image_widget - similar_image() + face_enhance_toggled(bool) - 316 - 824 + 306 + 66 - 38 - 0 + 286 + -12 - generate_batch_similar_button - clicked() + comboBox + currentIndexChanged(int) standard_image_widget - similar_batch() + upscale_number_changed(int) - 489 - 824 + 86 + 92 - 154 + 0 2 - - export_button - clicked() - standard_image_widget - export_image() - - - 182 - 483 - - - 467 - 0 - - - upscale_2x clicked() @@ -530,124 +904,60 @@ upscale_2x_clicked() - 431 - 934 + 249 + 100 - 391 - -7 + 228 + 1 - reset_prompt - clicked() + advanced_settings_checkbox + clicked(bool) standard_image_widget - reset_prompt_clicked() + handle_advanced_settings_checkbox(bool) - 140 - 684 + 58 + 58 - 95 - -10 + 24 + -5 - reset_negative_prompt + generate_single_simillar_button clicked() standard_image_widget - reset_negative_prompt_clicked() - - - 359 - 681 - - - 211 - -12 - - - - - controlnet - currentTextChanged(QString) - standard_image_widget - handle_controlnet_changed(QString) - - - 136 - 771 - - - 0 - 25 - - - - - prompt - textChanged() - standard_image_widget - prompt_changed() - - - 84 - 624 - - - -1 - 12 - - - - - negative_prompt - textChanged() - standard_image_widget - negative_prompt_changed() + similar_image() - 362 - 631 + 206 + 142 -3 - 595 + 44 - upscale_model - currentTextChanged(QString) - standard_image_widget - upscale_model_changed(QString) - - - 114 - 881 - - - 1 - 108 - - - - - face_enhance - toggled(bool) + generate_batch_similar_button + clicked() standard_image_widget - face_enhance_toggled(bool) + similar_batch() - 60 - 910 + 350 + 143 - 1 - 381 + 259 + -1 @@ -669,5 +979,7 @@ negative_prompt_changed() upscale_model_changed(QString) face_enhance_toggled(bool) + handle_advanced_settings_checkbox(bool) + upscale_number_changed(int) 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 2887f9a36..58a8df40b 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,33 +12,243 @@ class Ui_standard_image_widget(object): def setupUi(self, standard_image_widget): standard_image_widget.setObjectName("standard_image_widget") - standard_image_widget.resize(552, 1232) - standard_image_widget.setMaximumSize(QtCore.QSize(552, 16777215)) + standard_image_widget.resize(1181, 1243) + standard_image_widget.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.gridLayout_2 = QtWidgets.QGridLayout(standard_image_widget) + self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setObjectName("gridLayout_2") - self.tabWidget = QtWidgets.QTabWidget(parent=standard_image_widget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.splitter = QtWidgets.QSplitter(parent=standard_image_widget) + self.splitter.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.splitter.setObjectName("splitter") + self.sidebar = QtWidgets.QWidget(parent=self.splitter) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Maximum, QtWidgets.QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth()) - self.tabWidget.setSizePolicy(sizePolicy) + sizePolicy.setHeightForWidth(self.sidebar.sizePolicy().hasHeightForWidth()) + self.sidebar.setSizePolicy(sizePolicy) + self.sidebar.setMinimumSize(QtCore.QSize(450, 0)) + self.sidebar.setMaximumSize(QtCore.QSize(450, 16777215)) + self.sidebar.setObjectName("sidebar") + self.gridLayout_7 = QtWidgets.QGridLayout(self.sidebar) + self.gridLayout_7.setContentsMargins(0, 0, 0, 0) + self.gridLayout_7.setObjectName("gridLayout_7") + self.tabWidget = QtWidgets.QTabWidget(parent=self.sidebar) + font = QtGui.QFont() + font.setPointSize(9) + self.tabWidget.setFont(font) + self.tabWidget.setLayoutDirection(QtCore.Qt.LayoutDirection.LeftToRight) self.tabWidget.setObjectName("tabWidget") + self.tab_6 = QtWidgets.QWidget() + self.tab_6.setStyleSheet("") + self.tab_6.setObjectName("tab_6") + self.gridLayout_11 = QtWidgets.QGridLayout(self.tab_6) + self.gridLayout_11.setContentsMargins(0, 0, 0, 0) + self.gridLayout_11.setObjectName("gridLayout_11") + self.scrollArea_2 = QtWidgets.QScrollArea(parent=self.tab_6) + self.scrollArea_2.setWidgetResizable(True) + self.scrollArea_2.setObjectName("scrollArea_2") + self.scrollAreaWidgetContents_2 = QtWidgets.QWidget() + self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 444, 1211)) + self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2") + self.gridLayout_10 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_2) + self.gridLayout_10.setObjectName("gridLayout_10") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.seed_widget = SeedWidget(parent=self.scrollAreaWidgetContents_2) + self.seed_widget.setProperty("generator_section", "") + self.seed_widget.setProperty("generator_name", "") + self.seed_widget.setObjectName("seed_widget") + self.horizontalLayout_3.addWidget(self.seed_widget) + self.seed_widget_latents = SeedWidget(parent=self.scrollAreaWidgetContents_2) + self.seed_widget_latents.setProperty("generator_section", "") + self.seed_widget_latents.setProperty("generator_name", "") + self.seed_widget_latents.setObjectName("seed_widget_latents") + self.horizontalLayout_3.addWidget(self.seed_widget_latents) + self.gridLayout_10.addLayout(self.horizontalLayout_3, 1, 0, 1, 1) + self.horizontalLayout_5 = QtWidgets.QHBoxLayout() + self.horizontalLayout_5.setObjectName("horizontalLayout_5") + self.steps_widget = SliderWidget(parent=self.scrollAreaWidgetContents_2) + self.steps_widget.setProperty("slider_callback", "handle_value_change") + self.steps_widget.setProperty("current_value", 0) + self.steps_widget.setProperty("slider_maximum", 200) + self.steps_widget.setProperty("spinbox_maximum", 200.0) + self.steps_widget.setProperty("display_as_float", False) + self.steps_widget.setProperty("spinbox_single_step", 1) + self.steps_widget.setProperty("spinbox_page_step", 1) + self.steps_widget.setProperty("spinbox_minimum", 1) + self.steps_widget.setProperty("slider_minimum", 1) + self.steps_widget.setProperty("settings_property", "generator.steps") + self.steps_widget.setObjectName("steps_widget") + self.horizontalLayout_5.addWidget(self.steps_widget) + self.scale_widget = SliderWidget(parent=self.scrollAreaWidgetContents_2) + self.scale_widget.setProperty("current_value", 0) + self.scale_widget.setProperty("slider_maximum", 10000) + self.scale_widget.setProperty("spinbox_maximum", 100.0) + self.scale_widget.setProperty("display_as_float", True) + self.scale_widget.setProperty("spinbox_single_step", 0.01) + self.scale_widget.setProperty("spinbox_page_step", 0.01) + self.scale_widget.setProperty("slider_callback", "handle_value_change") + self.scale_widget.setProperty("settings_property", "generator.scale") + self.scale_widget.setObjectName("scale_widget") + self.horizontalLayout_5.addWidget(self.scale_widget) + self.gridLayout_10.addLayout(self.horizontalLayout_5, 2, 0, 1, 1) + self.ddim_frames = QtWidgets.QHBoxLayout() + self.ddim_frames.setObjectName("ddim_frames") + self.ddim_eta_slider_widget = SliderWidget(parent=self.scrollAreaWidgetContents_2) + self.ddim_eta_slider_widget.setProperty("slider_callback", "handle_value_change") + self.ddim_eta_slider_widget.setProperty("current_value", 1) + self.ddim_eta_slider_widget.setProperty("slider_maximum", 10) + self.ddim_eta_slider_widget.setProperty("spinbox_maximum", 10) + self.ddim_eta_slider_widget.setProperty("display_as_float", False) + self.ddim_eta_slider_widget.setProperty("spinbox_single_step", 1) + self.ddim_eta_slider_widget.setProperty("spinbox_page_step", 1) + self.ddim_eta_slider_widget.setProperty("spinbox_minimum", 1) + self.ddim_eta_slider_widget.setProperty("slider_minimum", 1) + self.ddim_eta_slider_widget.setProperty("settings_property", "generator.ddim_eta") + self.ddim_eta_slider_widget.setObjectName("ddim_eta_slider_widget") + self.ddim_frames.addWidget(self.ddim_eta_slider_widget) + self.frames_slider_widget = SliderWidget(parent=self.scrollAreaWidgetContents_2) + self.frames_slider_widget.setProperty("slider_callback", "handle_value_change") + self.frames_slider_widget.setProperty("current_value", 0) + self.frames_slider_widget.setProperty("slider_maximum", 200) + self.frames_slider_widget.setProperty("spinbox_maximum", 200.0) + self.frames_slider_widget.setProperty("display_as_float", False) + self.frames_slider_widget.setProperty("spinbox_single_step", 1) + self.frames_slider_widget.setProperty("spinbox_page_step", 1) + self.frames_slider_widget.setProperty("spinbox_minimum", 1) + self.frames_slider_widget.setProperty("slider_minimum", 1) + self.frames_slider_widget.setProperty("settings_property", "generator.n_samples") + self.frames_slider_widget.setObjectName("frames_slider_widget") + self.ddim_frames.addWidget(self.frames_slider_widget) + self.gridLayout_10.addLayout(self.ddim_frames, 4, 0, 1, 1) + self.horizontalLayout_6 = QtWidgets.QHBoxLayout() + self.horizontalLayout_6.setObjectName("horizontalLayout_6") + self.samples_widget_2 = SliderWidget(parent=self.scrollAreaWidgetContents_2) + self.samples_widget_2.setProperty("slider_callback", "handle_value_change") + self.samples_widget_2.setProperty("current_value", 0) + self.samples_widget_2.setProperty("slider_maximum", 500) + self.samples_widget_2.setProperty("spinbox_maximum", 500.0) + self.samples_widget_2.setProperty("display_as_float", False) + self.samples_widget_2.setProperty("spinbox_single_step", 1) + self.samples_widget_2.setProperty("spinbox_page_step", 1) + self.samples_widget_2.setProperty("spinbox_minimum", 1) + self.samples_widget_2.setProperty("slider_minimum", 1) + self.samples_widget_2.setObjectName("samples_widget_2") + self.horizontalLayout_6.addWidget(self.samples_widget_2) + self.clip_skip_slider_widget = SliderWidget(parent=self.scrollAreaWidgetContents_2) + self.clip_skip_slider_widget.setProperty("current_value", 0) + self.clip_skip_slider_widget.setProperty("slider_maximum", 11) + self.clip_skip_slider_widget.setProperty("spinbox_maximum", 12.0) + self.clip_skip_slider_widget.setProperty("display_as_float", False) + self.clip_skip_slider_widget.setProperty("spinbox_single_step", 1) + self.clip_skip_slider_widget.setProperty("spinbox_page_step", 1) + self.clip_skip_slider_widget.setProperty("spinbox_minimum", 0) + self.clip_skip_slider_widget.setProperty("slider_minimum", 0) + self.clip_skip_slider_widget.setProperty("slider_callback", "handle_value_change") + self.clip_skip_slider_widget.setProperty("settings_property", "generator.clip_skip") + self.clip_skip_slider_widget.setObjectName("clip_skip_slider_widget") + self.horizontalLayout_6.addWidget(self.clip_skip_slider_widget) + self.gridLayout_10.addLayout(self.horizontalLayout_6, 3, 0, 1, 1) + self.verticalLayout_3 = QtWidgets.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.verticalLayout_4 = QtWidgets.QVBoxLayout() + self.verticalLayout_4.setObjectName("verticalLayout_4") + self.label_5 = QtWidgets.QLabel(parent=self.scrollAreaWidgetContents_2) + font = QtGui.QFont() + font.setPointSize(8) + font.setBold(True) + self.label_5.setFont(font) + self.label_5.setObjectName("label_5") + self.verticalLayout_4.addWidget(self.label_5) + self.pipeline = QtWidgets.QComboBox(parent=self.scrollAreaWidgetContents_2) + self.pipeline.setObjectName("pipeline") + self.verticalLayout_4.addWidget(self.pipeline) + self.verticalLayout_3.addLayout(self.verticalLayout_4) + self.verticalLayout_7 = QtWidgets.QVBoxLayout() + self.verticalLayout_7.setObjectName("verticalLayout_7") + self.label_6 = QtWidgets.QLabel(parent=self.scrollAreaWidgetContents_2) + font = QtGui.QFont() + font.setPointSize(8) + font.setBold(True) + self.label_6.setFont(font) + self.label_6.setObjectName("label_6") + self.verticalLayout_7.addWidget(self.label_6) + self.version = QtWidgets.QComboBox(parent=self.scrollAreaWidgetContents_2) + self.version.setObjectName("version") + self.verticalLayout_7.addWidget(self.version) + self.verticalLayout_3.addLayout(self.verticalLayout_7) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.label_3 = QtWidgets.QLabel(parent=self.scrollAreaWidgetContents_2) + font = QtGui.QFont() + font.setPointSize(8) + font.setBold(True) + self.label_3.setFont(font) + self.label_3.setObjectName("label_3") + self.verticalLayout.addWidget(self.label_3) + self.model = QtWidgets.QComboBox(parent=self.scrollAreaWidgetContents_2) + self.model.setObjectName("model") + self.verticalLayout.addWidget(self.model) + self.verticalLayout_3.addLayout(self.verticalLayout) + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.label_4 = QtWidgets.QLabel(parent=self.scrollAreaWidgetContents_2) + font = QtGui.QFont() + font.setPointSize(8) + font.setBold(True) + self.label_4.setFont(font) + self.label_4.setObjectName("label_4") + self.verticalLayout_2.addWidget(self.label_4) + self.scheduler = QtWidgets.QComboBox(parent=self.scrollAreaWidgetContents_2) + self.scheduler.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.ArrowCursor)) + self.scheduler.setObjectName("scheduler") + self.verticalLayout_2.addWidget(self.scheduler) + self.verticalLayout_3.addLayout(self.verticalLayout_2) + self.gridLayout_10.addLayout(self.verticalLayout_3, 0, 0, 1, 1) + self.verticalLayout_5 = QtWidgets.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.variation_checkbox = QtWidgets.QCheckBox(parent=self.scrollAreaWidgetContents_2) + self.variation_checkbox.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) + self.variation_checkbox.setObjectName("variation_checkbox") + self.verticalLayout_5.addWidget(self.variation_checkbox) + self.gridLayout_10.addLayout(self.verticalLayout_5, 5, 0, 1, 1) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridLayout_10.addItem(spacerItem, 6, 0, 1, 1) + self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2) + self.gridLayout_11.addWidget(self.scrollArea_2, 0, 0, 1, 1) + icon = QtGui.QIcon.fromTheme("document-properties") + self.tabWidget.addTab(self.tab_6, icon, "") + self.tab_5 = QtWidgets.QWidget() + self.tab_5.setObjectName("tab_5") + self.gridLayout_3 = QtWidgets.QGridLayout(self.tab_5) + self.gridLayout_3.setObjectName("gridLayout_3") + self.brushes_container = BrushesContainer(parent=self.tab_5) + self.brushes_container.setAcceptDrops(True) + self.brushes_container.setObjectName("brushes_container") + self.gridLayout_17 = QtWidgets.QGridLayout(self.brushes_container) + self.gridLayout_17.setObjectName("gridLayout_17") + self.gridLayout_3.addWidget(self.brushes_container, 0, 0, 1, 1) + self.tabWidget.addTab(self.tab_5, "") + self.tab_3 = QtWidgets.QWidget() + self.tab_3.setObjectName("tab_3") + self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_3) + self.gridLayout_9.setObjectName("gridLayout_9") + self.embeddings_container_widget = EmbeddingsContainerWidget(parent=self.tab_3) + self.embeddings_container_widget.setObjectName("embeddings_container_widget") + self.gridLayout_9.addWidget(self.embeddings_container_widget, 0, 0, 1, 1) + self.tabWidget.addTab(self.tab_3, "") + self.tab_4 = QtWidgets.QWidget() + self.tab_4.setObjectName("tab_4") + self.gridLayout_8 = QtWidgets.QGridLayout(self.tab_4) + self.gridLayout_8.setObjectName("gridLayout_8") + self.lora_container_widget = LoraContainerWidget(parent=self.tab_4) + self.lora_container_widget.setObjectName("lora_container_widget") + self.gridLayout_8.addWidget(self.lora_container_widget, 0, 0, 1, 1) + self.tabWidget.addTab(self.tab_4, "") self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") self.gridLayout_5 = QtWidgets.QGridLayout(self.tab) self.gridLayout_5.setObjectName("gridLayout_5") - self.groupBox_2 = QtWidgets.QGroupBox(parent=self.tab) - font = QtGui.QFont() - font.setPointSize(8) - font.setBold(False) - self.groupBox_2.setFont(font) - self.groupBox_2.setObjectName("groupBox_2") - self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.groupBox_2) - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.controlnet = QtWidgets.QComboBox(parent=self.groupBox_2) - self.controlnet.setObjectName("controlnet") - self.horizontalLayout_5.addWidget(self.controlnet) - self.gridLayout_5.addWidget(self.groupBox_2, 0, 0, 1, 1) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.samples_widget = SliderWidget(parent=self.tab) @@ -62,14 +272,30 @@ def setupUi(self, standard_image_widget): self.generate_batch_similar_button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) self.generate_batch_similar_button.setObjectName("generate_batch_similar_button") self.horizontalLayout_4.addWidget(self.generate_batch_similar_button) - self.gridLayout_5.addLayout(self.horizontalLayout_4, 1, 0, 1, 1) + self.gridLayout_5.addLayout(self.horizontalLayout_4, 2, 0, 1, 1) + self.advanced_settings = QtWidgets.QWidget(parent=self.tab) + self.advanced_settings.setObjectName("advanced_settings") + self.gridLayout_4 = QtWidgets.QGridLayout(self.advanced_settings) + self.gridLayout_4.setObjectName("gridLayout_4") + self.input_image_widget = InputImageSettingsWidget(parent=self.advanced_settings) + self.input_image_widget.setObjectName("input_image_widget") + self.gridLayout_4.addWidget(self.input_image_widget, 0, 0, 1, 1) + self.controlnet_settings = ControlNetSettingsWidget(parent=self.advanced_settings) + self.controlnet_settings.setObjectName("controlnet_settings") + self.gridLayout_4.addWidget(self.controlnet_settings, 1, 0, 1, 1) + self.gridLayout_5.addWidget(self.advanced_settings, 1, 0, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridLayout_5.addItem(spacerItem1, 3, 0, 1, 1) + self.advanced_settings_checkbox = QtWidgets.QCheckBox(parent=self.tab) + self.advanced_settings_checkbox.setObjectName("advanced_settings_checkbox") + self.gridLayout_5.addWidget(self.advanced_settings_checkbox, 0, 0, 1, 1) self.tabWidget.addTab(self.tab, "") self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") - self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_2) - self.gridLayout_4.setObjectName("gridLayout_4") - self.gridLayout_3 = QtWidgets.QGridLayout() - self.gridLayout_3.setObjectName("gridLayout_3") + self.gridLayout_6 = QtWidgets.QGridLayout(self.tab_2) + self.gridLayout_6.setObjectName("gridLayout_6") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") self.upscale_model = QtWidgets.QComboBox(parent=self.tab_2) self.upscale_model.setObjectName("upscale_model") self.upscale_model.addItem("") @@ -78,140 +304,87 @@ def setupUi(self, standard_image_widget): self.upscale_model.addItem("") self.upscale_model.addItem("") self.upscale_model.addItem("") - self.gridLayout_3.addWidget(self.upscale_model, 0, 0, 1, 1) + self.horizontalLayout.addWidget(self.upscale_model) self.face_enhance = QtWidgets.QCheckBox(parent=self.tab_2) self.face_enhance.setObjectName("face_enhance") - self.gridLayout_3.addWidget(self.face_enhance, 0, 1, 1, 1) - self.gridLayout_4.addLayout(self.gridLayout_3, 0, 0, 1, 1) + self.horizontalLayout.addWidget(self.face_enhance) + self.gridLayout_6.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.comboBox = QtWidgets.QComboBox(parent=self.tab_2) + self.comboBox.setObjectName("comboBox") + self.comboBox.addItem("") + self.comboBox.addItem("") + self.horizontalLayout_2.addWidget(self.comboBox) self.upscale_2x = QtWidgets.QPushButton(parent=self.tab_2) self.upscale_2x.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) self.upscale_2x.setObjectName("upscale_2x") - self.gridLayout_4.addWidget(self.upscale_2x, 3, 0, 1, 1) + self.horizontalLayout_2.addWidget(self.upscale_2x) + self.gridLayout_6.addLayout(self.horizontalLayout_2, 1, 0, 1, 1) + spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridLayout_6.addItem(spacerItem2, 2, 0, 1, 1) self.tabWidget.addTab(self.tab_2, "") - self.gridLayout_2.addWidget(self.tabWidget, 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) + self.gridLayout_7.addWidget(self.tabWidget, 0, 0, 1, 1) + self.layoutWidget = QtWidgets.QWidget(parent=self.splitter) + self.layoutWidget.setObjectName("layoutWidget") + self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget) + self.gridLayout.setContentsMargins(0, 0, 9, 0) + self.gridLayout.setObjectName("gridLayout") + self.canvas_widget = CanvasPlusWidget(parent=self.layoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.image_frame.sizePolicy().hasHeightForWidth()) - self.image_frame.setSizePolicy(sizePolicy) - self.image_frame.setMinimumSize(QtCore.QSize(532, 532)) - self.image_frame.setMaximumSize(QtCore.QSize(532, 532)) - self.image_frame.setAcceptDrops(True) - self.image_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) - self.image_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) - self.image_frame.setObjectName("image_frame") - 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.export_button = QtWidgets.QPushButton(parent=self.controls_container) - self.export_button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.export_button.setObjectName("export_button") - self.horizontalLayout.addWidget(self.export_button) - self.delete_button = QtWidgets.QPushButton(parent=self.controls_container) - self.delete_button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.delete_button.setObjectName("delete_button") - self.horizontalLayout.addWidget(self.delete_button) - self.to_canvas_button = QtWidgets.QPushButton(parent=self.controls_container) - self.to_canvas_button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.to_canvas_button.setObjectName("to_canvas_button") - self.horizontalLayout.addWidget(self.to_canvas_button) - 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) - self.gridLayout.setObjectName("gridLayout") - self.label = QtWidgets.QLabel(parent=self.delete_confirmation) - self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 3, 0, 1, 2) - self.button_container = QtWidgets.QWidget(parent=self.delete_confirmation) - self.button_container.setObjectName("button_container") - self.buttons = QtWidgets.QHBoxLayout(self.button_container) - self.buttons.setContentsMargins(0, 0, 0, 0) - self.buttons.setObjectName("buttons") - self.gridLayout.addWidget(self.button_container, 0, 0, 1, 2) - self.confirm_delete_button = QtWidgets.QPushButton(parent=self.delete_confirmation) - self.confirm_delete_button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.confirm_delete_button.setObjectName("confirm_delete_button") - self.gridLayout.addWidget(self.confirm_delete_button, 4, 0, 1, 1) - self.cancel_delete_button = QtWidgets.QPushButton(parent=self.delete_confirmation) - self.cancel_delete_button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.cancel_delete_button.setObjectName("cancel_delete_button") - self.gridLayout.addWidget(self.cancel_delete_button, 4, 1, 1, 1) - self.verticalLayout.addWidget(self.delete_confirmation) - self.horizontalLayout_3 = QtWidgets.QHBoxLayout() - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.verticalLayout_2 = QtWidgets.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.label_2 = QtWidgets.QLabel(parent=standard_image_widget) - font = QtGui.QFont() - font.setPointSize(11) - font.setBold(False) - self.label_2.setFont(font) - self.label_2.setObjectName("label_2") - self.verticalLayout_2.addWidget(self.label_2) - self.prompt = QtWidgets.QPlainTextEdit(parent=standard_image_widget) - self.prompt.setPlaceholderText("") - self.prompt.setObjectName("prompt") - self.verticalLayout_2.addWidget(self.prompt) - self.reset_prompt = QtWidgets.QPushButton(parent=standard_image_widget) - self.reset_prompt.setObjectName("reset_prompt") - self.verticalLayout_2.addWidget(self.reset_prompt) - self.horizontalLayout_3.addLayout(self.verticalLayout_2) - self.verticalLayout_3 = QtWidgets.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.label_3 = QtWidgets.QLabel(parent=standard_image_widget) - font = QtGui.QFont() - font.setPointSize(11) - font.setBold(False) - self.label_3.setFont(font) - self.label_3.setObjectName("label_3") - self.verticalLayout_3.addWidget(self.label_3) - self.negative_prompt = QtWidgets.QPlainTextEdit(parent=standard_image_widget) - self.negative_prompt.setPlaceholderText("") - self.negative_prompt.setObjectName("negative_prompt") - self.verticalLayout_3.addWidget(self.negative_prompt) - self.reset_negative_prompt = QtWidgets.QPushButton(parent=standard_image_widget) - self.reset_negative_prompt.setObjectName("reset_negative_prompt") - self.verticalLayout_3.addWidget(self.reset_negative_prompt) - self.horizontalLayout_3.addLayout(self.verticalLayout_3) - self.verticalLayout.addLayout(self.horizontalLayout_3) - self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1) + sizePolicy.setHeightForWidth(self.canvas_widget.sizePolicy().hasHeightForWidth()) + self.canvas_widget.setSizePolicy(sizePolicy) + self.canvas_widget.setMinimumSize(QtCore.QSize(532, 532)) + self.canvas_widget.setMaximumSize(QtCore.QSize(16777215, 16777215)) + self.canvas_widget.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) + self.canvas_widget.setAcceptDrops(True) + self.canvas_widget.setObjectName("canvas_widget") + self.gridLayout.addWidget(self.canvas_widget, 0, 0, 1, 1) + self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1) self.retranslateUi(standard_image_widget) self.tabWidget.setCurrentIndex(0) - self.confirm_delete_button.clicked.connect(standard_image_widget.confirm_delete) # type: ignore - self.cancel_delete_button.clicked.connect(standard_image_widget.cancel_delete) # type: ignore - self.to_canvas_button.clicked.connect(standard_image_widget.image_to_canvas) # type: ignore - self.delete_button.clicked.connect(standard_image_widget.delete_image) # type: ignore + self.upscale_model.currentTextChanged['QString'].connect(standard_image_widget.upscale_model_changed) # type: ignore + self.face_enhance.clicked['bool'].connect(standard_image_widget.face_enhance_toggled) # type: ignore + self.comboBox.currentIndexChanged['int'].connect(standard_image_widget.upscale_number_changed) # type: ignore + self.upscale_2x.clicked.connect(standard_image_widget.upscale_2x_clicked) # type: ignore + self.advanced_settings_checkbox.clicked['bool'].connect(standard_image_widget.handle_advanced_settings_checkbox) # type: ignore self.generate_single_simillar_button.clicked.connect(standard_image_widget.similar_image) # type: ignore self.generate_batch_similar_button.clicked.connect(standard_image_widget.similar_batch) # type: ignore - self.export_button.clicked.connect(standard_image_widget.export_image) # type: ignore - self.upscale_2x.clicked.connect(standard_image_widget.upscale_2x_clicked) # type: ignore - self.reset_prompt.clicked.connect(standard_image_widget.reset_prompt_clicked) # type: ignore - self.reset_negative_prompt.clicked.connect(standard_image_widget.reset_negative_prompt_clicked) # type: ignore - self.controlnet.currentTextChanged['QString'].connect(standard_image_widget.handle_controlnet_changed) # type: ignore - self.prompt.textChanged.connect(standard_image_widget.prompt_changed) # type: ignore - self.negative_prompt.textChanged.connect(standard_image_widget.negative_prompt_changed) # type: ignore - self.upscale_model.currentTextChanged['QString'].connect(standard_image_widget.upscale_model_changed) # type: ignore - self.face_enhance.toggled['bool'].connect(standard_image_widget.face_enhance_toggled) # type: ignore QtCore.QMetaObject.connectSlotsByName(standard_image_widget) def retranslateUi(self, standard_image_widget): _translate = QtCore.QCoreApplication.translate standard_image_widget.setWindowTitle(_translate("standard_image_widget", "Form")) - self.groupBox_2.setTitle(_translate("standard_image_widget", "Controlnet")) + self.seed_widget.setProperty("property_name", _translate("standard_image_widget", "generator.random_seed")) + self.seed_widget_latents.setProperty("property_name", _translate("standard_image_widget", "generator.random_latents_seed")) + self.steps_widget.setProperty("label_text", _translate("standard_image_widget", "Steps")) + self.scale_widget.setProperty("label_text", _translate("standard_image_widget", "Scale")) + self.ddim_eta_slider_widget.setProperty("label_text", _translate("standard_image_widget", "DDIM ETA")) + self.frames_slider_widget.setProperty("label_text", _translate("standard_image_widget", "Frames")) + self.samples_widget_2.setProperty("label_text", _translate("standard_image_widget", "Samples")) + self.samples_widget_2.setProperty("settings_property", _translate("standard_image_widget", "generator.n_samples")) + self.clip_skip_slider_widget.setProperty("label_text", _translate("standard_image_widget", "Clip Skip")) + self.label_5.setText(_translate("standard_image_widget", "Pipeline")) + self.label_6.setText(_translate("standard_image_widget", "Version")) + self.label_3.setText(_translate("standard_image_widget", "Model")) + self.label_4.setText(_translate("standard_image_widget", "Scheduler")) + self.variation_checkbox.setText(_translate("standard_image_widget", "Variation")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), _translate("standard_image_widget", "Settings")) + self.tabWidget.setTabToolTip(self.tabWidget.indexOf(self.tab_6), _translate("standard_image_widget", "Stable Diffusion settings")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("standard_image_widget", "Presets")) + self.tabWidget.setTabToolTip(self.tabWidget.indexOf(self.tab_5), _translate("standard_image_widget", "Stable Diffusion setting presets")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("standard_image_widget", "Embeddings")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), _translate("standard_image_widget", "LoRA")) self.samples_widget.setProperty("label_text", _translate("standard_image_widget", "Similarity")) self.samples_widget.setProperty("settings_property", _translate("standard_image_widget", "standard_image_widget_settings.image_similarity")) self.generate_single_simillar_button.setToolTip(_translate("standard_image_widget", "Generate one variation")) self.generate_single_simillar_button.setText(_translate("standard_image_widget", "Single")) self.generate_batch_similar_button.setToolTip(_translate("standard_image_widget", "Generate a batch of four variations")) self.generate_batch_similar_button.setText(_translate("standard_image_widget", "Batch")) + self.advanced_settings_checkbox.setText(_translate("standard_image_widget", "Advanced settings")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("standard_image_widget", "Similar")) self.upscale_model.setItemText(0, _translate("standard_image_widget", "RealESRGAN_x4plus")) self.upscale_model.setItemText(1, _translate("standard_image_widget", "RealESRNet_x4plus")) @@ -220,18 +393,15 @@ def retranslateUi(self, standard_image_widget): self.upscale_model.setItemText(4, _translate("standard_image_widget", "realesr-animevideov3")) self.upscale_model.setItemText(5, _translate("standard_image_widget", "realesr-general-x4v3")) self.face_enhance.setText(_translate("standard_image_widget", "Face enhance")) - self.upscale_2x.setText(_translate("standard_image_widget", "2x Upscale")) + self.comboBox.setItemText(0, _translate("standard_image_widget", "2x")) + self.comboBox.setItemText(1, _translate("standard_image_widget", "4x")) + self.upscale_2x.setText(_translate("standard_image_widget", "Upscale")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("standard_image_widget", "Upscale")) - self.export_button.setText(_translate("standard_image_widget", "Export")) - self.delete_button.setToolTip(_translate("standard_image_widget", "Permanently delete this image")) - self.delete_button.setText(_translate("standard_image_widget", "Delete")) - self.to_canvas_button.setToolTip(_translate("standard_image_widget", "Send this image to the canvas")) - self.to_canvas_button.setText(_translate("standard_image_widget", "To Canvas")) - self.label.setText(_translate("standard_image_widget", "Permanently delete?")) - self.confirm_delete_button.setText(_translate("standard_image_widget", "Yes")) - self.cancel_delete_button.setText(_translate("standard_image_widget", "No")) - self.label_2.setText(_translate("standard_image_widget", "Prompt")) - self.reset_prompt.setText(_translate("standard_image_widget", "Reset")) - self.label_3.setText(_translate("standard_image_widget", "Negative Prompt")) - self.reset_negative_prompt.setText(_translate("standard_image_widget", "Reset")) +from airunner.widgets.brushes.brushes_container import BrushesContainer +from airunner.widgets.canvas_plus.canvas_plus_widget import CanvasPlusWidget +from airunner.widgets.controlnet_settings.controlnet_settings_widget import ControlNetSettingsWidget +from airunner.widgets.embeddings.embeddings_container_widget import EmbeddingsContainerWidget +from airunner.widgets.input_image.input_image_settings_widget import InputImageSettingsWidget +from airunner.widgets.lora.lora_container_widget import LoraContainerWidget +from airunner.widgets.seed.seed_widget import SeedWidget 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 8070dc7b0..7c9a5924c 100644 --- a/src/airunner/widgets/generator_form/generator_form_widget.py +++ b/src/airunner/widgets/generator_form/generator_form_widget.py @@ -6,11 +6,10 @@ from airunner.aihandler.settings import MAX_SEED from airunner.data.db import session -from airunner.data.models import ActionScheduler, AIModel, ActiveGridSettings, CanvasSettings, Pipeline +from airunner.data.models import AIModel, ActiveGridSettings, CanvasSettings, Pipeline, GeneratorSetting from airunner.utils import get_session from airunner.widgets.base_widget import BaseWidget from airunner.widgets.generator_form.templates.generatorform_ui import Ui_generator_form -from airunner.widgets.slider.slider_widget import SliderWidget class GeneratorForm(BaseWidget): @@ -25,6 +24,7 @@ class GeneratorForm(BaseWidget): deterministic_seed = None initialized = False parent = None + generate_signal = pyqtSignal(dict) @property def is_txt2img(self): @@ -92,7 +92,7 @@ def latents_seed(self): @latents_seed.setter def latents_seed(self, val): self.settings_manager.set_value("generator.latents_seed", val) - self.ui.seed_widget_latents.ui.lineEdit.setText(str(val)) + self.app.ui.standard_image_widget.ui.seed_widget_latents.ui.lineEdit.setText(str(val)) @property def seed(self): @@ -101,7 +101,7 @@ def seed(self): @seed.setter def seed(self, val): self.settings_manager.set_value("generator.seed", val) - self.ui.seed_widget.ui.lineEdit.setText(str(val)) + self.app.ui.standard_image_widget.ui.seed_widget.ui.lineEdit.setText(str(val)) @property def image_scale(self): @@ -125,7 +125,7 @@ def enable_controlnet(self): @property def controlnet_image(self): - return self.ui.controlnet_settings.current_controlnet_image + return self.app.ui.standard_image_widget.ui.controlnet_settings.current_controlnet_image def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -133,12 +133,11 @@ def __init__(self, *args, **kwargs): self.canvas_settings = session.query(CanvasSettings).first() self.settings_manager.changed_signal.connect(self.handle_changed_signal) - - # one shot timer - timer = QTimer(self) - timer.setSingleShot(True) - timer.timeout.connect(self.initialize) - timer.start(1000) + self.initialize() + + def enable_preset(self, id): + self.settings_manager.set_value("generator_settings_override_id", id) + self.initialize() def toggle_advanced_generation(self): advanced_mode = self.settings_manager.enable_advanced_mode @@ -160,12 +159,6 @@ def handle_changed_signal(self, key, value): elif key == "enable_advanced_mode": self.toggle_advanced_generation() - def update_image_input_thumbnail(self): - self.ui.input_image_widget.set_thumbnail() - - def update_controlnet_settings_thumbnail(self): - self.ui.controlnet_settings.set_thumbnail() - """ Slot functions @@ -218,10 +211,10 @@ def handle_interrupt_button_clicked(self): def generate(self, image=None, seed=None): if seed is None: - seed = self.ui.seed_widget.seed - if self.ui.samples_widget.current_value > 1: + seed = self.app.ui.standard_image_widget.ui.seed_widget.seed + if self.app.ui.standard_image_widget.ui.samples_widget.current_value > 1: self.app.client.do_process_queue = False - total_samples = self.ui.samples_widget.current_value if not self.is_txt2vid else 1 + total_samples = self.app.ui.standard_image_widget.ui.samples_widget.current_value if not self.is_txt2vid else 1 for n in range(total_samples): if self.settings_manager.generator.use_prompt_builder and n > 0: seed = int(seed) + n @@ -249,7 +242,7 @@ def call_generate(self, image=None, seed=None, override_data=None): self.settings_manager.generator.enable_input_image ) if enable_input_image: - input_image = self.ui.input_image_widget.current_input_image + input_image = self.app.ui.standard_image_widget.ui.input_image_widget.current_input_image elif self.generator_section == "txt2img": input_image = override_data.get("input_image", None) image = input_image @@ -328,7 +321,7 @@ def call_generate(self, image=None, seed=None, override_data=None): "mask": mask, "image": image, "original_image": original_image, - "location": self.canvas.active_grid_area_rect + "location": QRect(0, 0, self.settings_manager.working_width, self.settings_manager.working_height) }, seed=seed, override_data=override_data) elif self.generator_section == "vid2vid": images = self.prep_video() @@ -386,6 +379,7 @@ def do_generate(self, extra_options=None, seed=None, latents_seed=None, do_deter # get the model from the database + print(model_data) model = self.settings_manager.models.filter_by( name=model_data["name"] if "name" in model_data \ else self.settings_manager.generator.model @@ -426,7 +420,6 @@ def do_generate(self, extra_options=None, seed=None, latents_seed=None, do_deter "enabled", "default", ] - print(input_image_info) original_model_data = { key: model_data.get( key, input_image_info.get(key, "")) for key in keys @@ -552,8 +545,8 @@ def set_seed(self, seed=None, latents_seed=None): self.update_seed() def update_seed(self): - self.ui.seed_widget.update_seed() - self.ui.seed_widget_latents.update_seed() + self.app.ui.standard_image_widget.ui.seed_widget.update_seed() + self.app.ui.standard_image_widget.ui.seed_widget_latents.update_seed() def set_primary_seed(self, seed=None): if self.deterministic_data: @@ -600,158 +593,20 @@ def initialize(self): self.settings_manager.generator_section = self.generator_section self.settings_manager.generator_name = self.generator_name self.set_form_values() - self.load_pipelines() - self.load_versions() - self.load_models() - self.load_schedulers() - self.set_controlnet_settings_properties() - self.set_input_image_widget_properties() - - # listen to emitted signal from self.settings_manager.changed_signal self.settings_manager.changed_signal.connect(self.handle_settings_manager_changed) - - # find all SliderWidget widgets in the template and call initialize - for widget in self.findChildren(SliderWidget): - try: - current_value = getattr( - self.generator_settings, - widget.property("settings_property").split(".")[1] - ) - except Exception as e: - current_value = None - if current_value is not None: - widget.setProperty("current_value", current_value) - widget.initialize() - - self.ui.seed_widget.setProperty("generator_section", self.generator_section) - self.ui.seed_widget.setProperty("generator_name", self.generator_name) - # self.ui.seed_widget.initialize( - # self.generator_section, - # self.generator_name - # ) - - self.ui.seed_widget_latents.setProperty("generator_section", self.generator_section) - self.ui.seed_widget_latents.setProperty("generator_name", self.generator_name) - # self.ui.seed_widget_latents.initialize( - # self.generator_section, - # self.generator_name - # ) self.initialized = True def handle_settings_manager_changed(self, key, val, settings_manager): if settings_manager.generator_section == self.settings_manager.generator_section and settings_manager.generator_name == self.settings_manager.generator_name: self.set_form_values() - def set_controlnet_settings_properties(self): - self.ui.controlnet_settings.initialize( - self.generator_name, - self.generator_section - ) - - def set_input_image_widget_properties(self): - self.ui.input_image_widget.initialize( - self.generator_name, - self.generator_section - ) - self.ui.controlnet_settings.initialize( - self.generator_name, - self.generator_section - ) - def clear_prompts(self): self.ui.prompt.setPlainText("") self.ui.negative_prompt.setPlainText("") - def load_pipelines(self): - self.ui.pipeline.blockSignals(True) - self.ui.pipeline.clear() - pipeline_names = ["txt2img / img2img", "inpaint / outpaint", "depth2img", "pix2pix", "upscale", "superresolution", "txt2vid"] - self.ui.pipeline.addItems(pipeline_names) - current_pipeline = getattr(self.settings_manager, f"current_section_{self.settings_manager.current_image_generator}") - if current_pipeline != "": - if current_pipeline == "txt2img": - current_pipeline = "txt2img / img2img" - elif current_pipeline == "outpaint": - current_pipeline = "inpaint / outpaint" - self.ui.pipeline.setCurrentText(current_pipeline) - self.ui.pipeline.blockSignals(False) - - def load_versions(self): - self.ui.version.blockSignals(True) - self.ui.version.clear() - pipelines = session.query(Pipeline).filter(Pipeline.category == self.settings_manager.current_image_generator).all() - version_names = set([pipeline.version for pipeline in pipelines]) - self.ui.version.addItems(version_names) - current_version = getattr(self.settings_manager, f"current_version_{self.settings_manager.current_image_generator}") - if current_version != "": - self.ui.version.setCurrentText(current_version) - self.ui.version.blockSignals(False) - - def handle_pipeline_changed(self, val): - if val == "txt2img / img2img": - val = "txt2img" - elif val == "inpaint / outpaint": - val = "outpaint" - self.settings_manager.set_value(f"current_section_{self.settings_manager.current_image_generator}", val) - self.load_versions() - self.load_models() - - def handle_version_changed(self, val): - print("VERSION CHANGED", val) - self.settings_manager.set_value(f"current_version_{self.settings_manager.current_image_generator}", val) - self.load_models() - - def load_models(self): - self.ui.model.blockSignals(True) - self.clear_models() - - image_generator = self.settings_manager.current_image_generator - pipeline = getattr(self.settings_manager, f"current_section_{image_generator}") - version = getattr(self.settings_manager, f"current_version_{image_generator}") - - models = session.query(AIModel).filter( - AIModel.category == image_generator, - AIModel.pipeline_action == pipeline, - AIModel.version == version, - AIModel.enabled == True - ).all() - model_names = [model.name for model in models] - self.ui.model.addItems(model_names) - current_model = self.settings_manager.generator.model - if current_model != "": - self.ui.model.setCurrentText(current_model) - else: - self.settings_manager.set_value("generator.model", self.ui.model.currentText()) - self.ui.model.blockSignals(False) - - def load_schedulers(self): - self.ui.scheduler.blockSignals(True) - session = get_session() - schedulers = session.query(ActionScheduler).filter( - ActionScheduler.section == self.generator_section, - ActionScheduler.generator_name == self.generator_name - ).all() - scheduler_names = [s.scheduler.display_name for s in schedulers] - self.ui.scheduler.clear() - self.ui.scheduler.addItems(scheduler_names) - - current_scheduler = self.settings_manager.generator.scheduler - if current_scheduler != "": - self.ui.scheduler.setCurrentText(current_scheduler) - else: - self.settings_manager.set_value("generator.scheduler", self.ui.scheduler.currentText()) - self.ui.scheduler.blockSignals(False) - def set_form_values(self): self.set_form_value("prompt", "generator.prompt") self.set_form_value("negative_prompt", "generator.negative_prompt") - # self.set_form_value("use_prompt_builder_checkbox", "generator.use_prompt_builder") - # self.set_form_value("use_prompt_builder_checkbox", "generator.use_prompt_builder") - self.set_form_property("steps_widget", "current_value", "generator.steps") - self.set_form_property("scale_widget", "current_value", "generator.scale") - - def clear_models(self): - self.ui.model.clear() def new_batch(self, index, image, data): self.new_batch(index, image, data) diff --git a/src/airunner/widgets/generator_form/generator_tab_widget.py b/src/airunner/widgets/generator_form/generator_tab_widget.py index 36cfd6b77..03d713b35 100644 --- a/src/airunner/widgets/generator_form/generator_tab_widget.py +++ b/src/airunner/widgets/generator_form/generator_tab_widget.py @@ -9,7 +9,7 @@ class GeneratorTabWidget(BaseWidget): widget_class_ = Ui_generator_tab generate_signal = pyqtSignal(dict) data = {} - clip_skip_disabled_tabs = ["kandinsky"] + clip_skip_disabled_tabs = [] clip_skip_disabled_sections = ["upscale", "superresolution", "txt2vid"] random_image_embed_seed = False row = 0 @@ -82,13 +82,7 @@ def current_generator(self): print(e) def initialize(self): - from airunner.widgets.generator_form.generator_form_widget import GeneratorForm - self.app.release_tab_overrides() - self.set_current_section_tab() - for tab in self.ui.generator_form_stablediffusion.findChildren(GeneratorForm): - tab.initialize() - for tab in self.ui.tab_widget_kandinsky.findChildren(GeneratorForm): - tab.initialize() + pass def refresh_models(self): # iterate over all generator tabs and call load_models on the generatorform widget @@ -112,7 +106,7 @@ def clear_prompts(self, tab_section, tab): def handle_generator_tab_changed(self, val): """ This method is called when the generator tab is changed. - Generator tabs are stablediffusion, kandinsky etc. + Generator tabs are stablediffusion etc. :return: """ print("handle_generator_tab_changed") @@ -165,10 +159,6 @@ def update_available_models(self): self.data[section][tab]["model"].clear() self.load_model_by_section(section, tab) - def update_thumbnails(self): - self.current_generator_widget.update_image_input_thumbnail() - self.current_generator_widget.update_controlnet_settings_thumbnail() - def toggle_variation(self, val): self.settings_manager.set_value("generator.variation", val) diff --git a/src/airunner/widgets/generator_form/templates/generator_tab.ui b/src/airunner/widgets/generator_form/templates/generator_tab.ui index d02e40e4f..35de37522 100644 --- a/src/airunner/widgets/generator_form/templates/generator_tab.ui +++ b/src/airunner/widgets/generator_form/templates/generator_tab.ui @@ -54,29 +54,6 @@ Stable Diffusion - - - - txt2img - - - stablediffusion - - - - - - - - - 0 - 0 - - - - Kandinsky - - 0 @@ -90,95 +67,13 @@ 0 - - - QTabWidget::West + + + txt2img - - 1 + + stablediffusion - - - - 0 - 0 - - - - txt2img - - - kandinsky - - - txt2img / img2img - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - txt2img - - - kandinsky - - - - - - - - - 0 - 0 - - - - outpaint - - - kandinsky - - - inpaint / outapint - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - outpaint - - - kandinsky - - - - - diff --git a/src/airunner/widgets/generator_form/templates/generator_tab_ui.py b/src/airunner/widgets/generator_form/templates/generator_tab_ui.py index dfef17960..074e22bf3 100644 --- a/src/airunner/widgets/generator_form/templates/generator_tab_ui.py +++ b/src/airunner/widgets/generator_form/templates/generator_tab_ui.py @@ -36,59 +36,16 @@ def setupUi(self, generator_tab): self.tab_stablediffusion.setSizePolicy(sizePolicy) self.tab_stablediffusion.setObjectName("tab_stablediffusion") self.gridLayout = QtWidgets.QGridLayout(self.tab_stablediffusion) + self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.generator_form_stablediffusion = GeneratorForm(parent=self.tab_stablediffusion) self.generator_form_stablediffusion.setObjectName("generator_form_stablediffusion") self.gridLayout.addWidget(self.generator_form_stablediffusion, 0, 0, 1, 1) self.generator_tabs.addTab(self.tab_stablediffusion, "") - self.tab_kandinsky = QtWidgets.QWidget() - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.tab_kandinsky.sizePolicy().hasHeightForWidth()) - self.tab_kandinsky.setSizePolicy(sizePolicy) - self.tab_kandinsky.setObjectName("tab_kandinsky") - self.gridLayout_3 = QtWidgets.QGridLayout(self.tab_kandinsky) - self.gridLayout_3.setContentsMargins(0, 0, 0, 0) - self.gridLayout_3.setObjectName("gridLayout_3") - self.tab_widget_kandinsky = QtWidgets.QTabWidget(parent=self.tab_kandinsky) - self.tab_widget_kandinsky.setTabPosition(QtWidgets.QTabWidget.TabPosition.West) - self.tab_widget_kandinsky.setObjectName("tab_widget_kandinsky") - self.tab_kandinsky_txt2img = QtWidgets.QWidget() - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.tab_kandinsky_txt2img.sizePolicy().hasHeightForWidth()) - self.tab_kandinsky_txt2img.setSizePolicy(sizePolicy) - self.tab_kandinsky_txt2img.setObjectName("tab_kandinsky_txt2img") - self.gridLayout_8 = QtWidgets.QGridLayout(self.tab_kandinsky_txt2img) - self.gridLayout_8.setContentsMargins(0, 0, 0, 0) - self.gridLayout_8.setObjectName("gridLayout_8") - self.generator_form_kandinsky_txt2img = GeneratorForm(parent=self.tab_kandinsky_txt2img) - self.generator_form_kandinsky_txt2img.setObjectName("generator_form_kandinsky_txt2img") - self.gridLayout_8.addWidget(self.generator_form_kandinsky_txt2img, 0, 0, 1, 1) - self.tab_widget_kandinsky.addTab(self.tab_kandinsky_txt2img, "") - self.tab_kandinsky_outpaint = QtWidgets.QWidget() - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.tab_kandinsky_outpaint.sizePolicy().hasHeightForWidth()) - self.tab_kandinsky_outpaint.setSizePolicy(sizePolicy) - self.tab_kandinsky_outpaint.setObjectName("tab_kandinsky_outpaint") - self.gridLayout_14 = QtWidgets.QGridLayout(self.tab_kandinsky_outpaint) - self.gridLayout_14.setContentsMargins(0, 0, 0, 0) - self.gridLayout_14.setObjectName("gridLayout_14") - self.generator_form_kandinsky_outpaint = GeneratorForm(parent=self.tab_kandinsky_outpaint) - self.generator_form_kandinsky_outpaint.setObjectName("generator_form_kandinsky_outpaint") - self.gridLayout_14.addWidget(self.generator_form_kandinsky_outpaint, 0, 0, 1, 1) - self.tab_widget_kandinsky.addTab(self.tab_kandinsky_outpaint, "") - self.gridLayout_3.addWidget(self.tab_widget_kandinsky, 0, 0, 1, 1) - self.generator_tabs.addTab(self.tab_kandinsky, "") self.gridLayout_2.addWidget(self.generator_tabs, 0, 0, 1, 1) self.retranslateUi(generator_tab) self.generator_tabs.setCurrentIndex(0) - self.tab_widget_kandinsky.setCurrentIndex(1) self.generator_tabs.currentChanged['int'].connect(generator_tab.handle_generator_tab_changed) # type: ignore QtCore.QMetaObject.connectSlotsByName(generator_tab) @@ -98,15 +55,4 @@ def retranslateUi(self, generator_tab): self.generator_form_stablediffusion.setProperty("generator_section", _translate("generator_tab", "txt2img")) self.generator_form_stablediffusion.setProperty("generator_name", _translate("generator_tab", "stablediffusion")) self.generator_tabs.setTabText(self.generator_tabs.indexOf(self.tab_stablediffusion), _translate("generator_tab", "Stable Diffusion")) - self.tab_kandinsky_txt2img.setProperty("generator_section", _translate("generator_tab", "txt2img")) - self.tab_kandinsky_txt2img.setProperty("generator_name", _translate("generator_tab", "kandinsky")) - self.generator_form_kandinsky_txt2img.setProperty("generator_section", _translate("generator_tab", "txt2img")) - self.generator_form_kandinsky_txt2img.setProperty("generator_name", _translate("generator_tab", "kandinsky")) - self.tab_widget_kandinsky.setTabText(self.tab_widget_kandinsky.indexOf(self.tab_kandinsky_txt2img), _translate("generator_tab", "txt2img / img2img")) - self.tab_kandinsky_outpaint.setProperty("generator_section", _translate("generator_tab", "outpaint")) - self.tab_kandinsky_outpaint.setProperty("generator_name", _translate("generator_tab", "kandinsky")) - self.generator_form_kandinsky_outpaint.setProperty("generator_section", _translate("generator_tab", "outpaint")) - self.generator_form_kandinsky_outpaint.setProperty("generator_name", _translate("generator_tab", "kandinsky")) - self.tab_widget_kandinsky.setTabText(self.tab_widget_kandinsky.indexOf(self.tab_kandinsky_outpaint), _translate("generator_tab", "inpaint / outapint")) - self.generator_tabs.setTabText(self.generator_tabs.indexOf(self.tab_kandinsky), _translate("generator_tab", "Kandinsky")) from airunner.widgets.generator_form.generator_form_widget import GeneratorForm diff --git a/src/airunner/widgets/generator_form/templates/generatorform.ui b/src/airunner/widgets/generator_form/templates/generatorform.ui index 50e89c12e..4498a0c34 100644 --- a/src/airunner/widgets/generator_form/templates/generatorform.ui +++ b/src/airunner/widgets/generator_form/templates/generatorform.ui @@ -6,8 +6,8 @@ 0 0 - 503 - 689 + 361 + 1064 @@ -21,7 +21,7 @@ Form - + 0 @@ -34,7 +34,7 @@ 0 - + QFrame::NoFrame @@ -50,22 +50,47 @@ 0 0 - 503 - 689 + 361 + 1064 - - - 0 - + - 0 + 2 - 0 + 9 + + + + + + Generate + + + + + + + 0 + + + + + + + PointingHandCursor + + + Interrupt + + + + + - + Qt::Vertical @@ -74,19 +99,6 @@ 9 - - - - - 8 - true - - - - Prompt - - - @@ -111,6 +123,19 @@ + + + + + 8 + true + + + + Prompt + + + @@ -147,529 +172,19 @@ - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 494 - 135 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - 8 - true - - - - Pipeline - - - - - - - - - - - - - - - 8 - true - - - - Version - - - - - - - - - - - - - - - 8 - true - - - - Model - - - - - - - - - - - - - - - 8 - true - - - - Scheduler - - - - - - - ArrowCursor - - - - - - - - - - - - - PointingHandCursor - - - Variation - - - - - - - - - - - Steps - - - handle_value_change - - - 0 - - - 200 - - - 200.000000000000000 - - - false - - - 1 - - - 1 - - - 1 - - - 1 - - - generator.steps - - - - - - - Scale - - - 0 - - - 10000 - - - 100.000000000000000 - - - true - - - 0.010000000000000 - - - 0.010000000000000 - - - handle_value_change - - - generator.scale - - - - - - - - - - - Samples - - - handle_value_change - - - 0 - - - 500 - - - 500.000000000000000 - - - false - - - 1 - - - 1 - - - 1 - - - 1 - - - generator.n_samples - - - - - - - Clip Skip - - - 0 - - - 11 - - - 12.000000000000000 - - - false - - - 1 - - - 1 - - - 0 - - - 0 - - - handle_value_change - - - generator.clip_skip - - - - - - - - - - - DDIM ETA - - - handle_value_change - - - 1 - - - 10 - - - 10 - - - false - - - 1 - - - 1 - - - 1 - - - 1 - - - generator.ddim_eta - - - - - - - Frames - - - handle_value_change - - - 0 - - - 200 - - - 200.000000000000000 - - - false - - - 1 - - - 1 - - - 1 - - - 1 - - - generator.n_samples - - - - - - - - - - - - - - - - - generator.random_seed - - - - - - - - - - - - - generator.random_latents_seed - - - - - - - - - - - - 0 - 0 - - - - false - - - - - - - - - Use Input Image - - - - - - - - 0 - 0 - - - - false - - - - - - - - - Controlnet - - - - - - - - - - - - - - Generate - - - - - - - 0 - - - - - - - PointingHandCursor - - - Interrupt - - - - - - - - SliderWidget - QWidget -
airunner/widgets/slider/slider_widget
- 1 -
- - InputImageSettingsWidget - QWidget -
airunner/widgets/input_image/input_image_settings_widget
- 1 -
- - ControlNetSettingsWidget - QWidget -
airunner/widgets/controlnet_settings/controlnet_settings_widget
- 1 -
- - SeedWidget - QWidget -
airunner/widgets/seed/seed_widget
- 1 -
-
- - scheduler - currentTextChanged(QString) - generator_form - handle_scheduler_changed(QString) - - - 393 - 581 - - - 54 - 0 - - - pushButton clicked() @@ -677,8 +192,8 @@ action_clicked_button_save_prompts() - 491 - 22 + 349 + 23 502 @@ -693,8 +208,8 @@ handle_interrupt_button_clicked() - 492 - 687 + 350 + 1053 0 @@ -710,7 +225,7 @@ 39 - 687 + 1053 0 @@ -734,22 +249,6 @@ - - model - currentTextChanged(QString) - generator_form - handle_model_changed(QString) - - - 260 - 581 - - - 93 - 0 - - - negative_prompt textChanged() @@ -758,7 +257,7 @@ 270 - 479 + 1024 93 @@ -766,54 +265,6 @@ - - variation_checkbox - toggled(bool) - generator_form - toggle_variation(bool) - - - 68 - 658 - - - 18 - 0 - - - - - pipeline - currentTextChanged(QString) - generator_form - handle_pipeline_changed(QString) - - - 90 - 572 - - - 130 - 0 - - - - - version - currentTextChanged(QString) - generator_form - handle_version_changed(QString) - - - 177 - 566 - - - 112 - -9 - - - handle_prompt_changed() diff --git a/src/airunner/widgets/generator_form/templates/generatorform_ui.py b/src/airunner/widgets/generator_form/templates/generatorform_ui.py index bd2df1b5e..180de7232 100644 --- a/src/airunner/widgets/generator_form/templates/generatorform_ui.py +++ b/src/airunner/widgets/generator_form/templates/generatorform_ui.py @@ -12,40 +12,47 @@ class Ui_generator_form(object): def setupUi(self, generator_form): generator_form.setObjectName("generator_form") - generator_form.resize(503, 689) + generator_form.resize(361, 1064) font = QtGui.QFont() font.setPointSize(8) generator_form.setFont(font) generator_form.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.gridLayout_3 = QtWidgets.QGridLayout(generator_form) - self.gridLayout_3.setContentsMargins(0, 0, 0, 0) - self.gridLayout_3.setObjectName("gridLayout_3") + self.gridLayout_7 = QtWidgets.QGridLayout(generator_form) + self.gridLayout_7.setContentsMargins(0, 0, 0, 0) + self.gridLayout_7.setObjectName("gridLayout_7") self.scrollArea = QtWidgets.QScrollArea(parent=generator_form) self.scrollArea.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) self.scrollArea.setFrameShadow(QtWidgets.QFrame.Shadow.Plain) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 503, 689)) + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 361, 1064)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") - self.gridLayout_8 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents) - self.gridLayout_8.setContentsMargins(0, 0, -1, 0) - self.gridLayout_8.setObjectName("gridLayout_8") - self.advanced_splitter = QtWidgets.QSplitter(parent=self.scrollAreaWidgetContents) - self.advanced_splitter.setOrientation(QtCore.Qt.Orientation.Vertical) - self.advanced_splitter.setObjectName("advanced_splitter") - self.layoutWidget = QtWidgets.QWidget(parent=self.advanced_splitter) + self.gridLayout = QtWidgets.QGridLayout(self.scrollAreaWidgetContents) + self.gridLayout.setContentsMargins(-1, 2, -1, 9) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout_9 = QtWidgets.QHBoxLayout() + self.horizontalLayout_9.setObjectName("horizontalLayout_9") + self.generate_button = QtWidgets.QPushButton(parent=self.scrollAreaWidgetContents) + self.generate_button.setObjectName("generate_button") + self.horizontalLayout_9.addWidget(self.generate_button) + self.progress_bar = QtWidgets.QProgressBar(parent=self.scrollAreaWidgetContents) + self.progress_bar.setProperty("value", 0) + self.progress_bar.setObjectName("progress_bar") + self.horizontalLayout_9.addWidget(self.progress_bar) + self.interrupt_button = QtWidgets.QPushButton(parent=self.scrollAreaWidgetContents) + self.interrupt_button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) + self.interrupt_button.setObjectName("interrupt_button") + self.horizontalLayout_9.addWidget(self.interrupt_button) + self.gridLayout.addLayout(self.horizontalLayout_9, 1, 0, 1, 1) + self.splitter = QtWidgets.QSplitter(parent=self.scrollAreaWidgetContents) + self.splitter.setOrientation(QtCore.Qt.Orientation.Vertical) + self.splitter.setObjectName("splitter") + self.layoutWidget = QtWidgets.QWidget(parent=self.splitter) self.layoutWidget.setObjectName("layoutWidget") self.gridLayout_2 = QtWidgets.QGridLayout(self.layoutWidget) self.gridLayout_2.setContentsMargins(0, 0, 0, 9) self.gridLayout_2.setObjectName("gridLayout_2") - self.label = QtWidgets.QLabel(parent=self.layoutWidget) - font = QtGui.QFont() - font.setPointSize(8) - font.setBold(True) - self.label.setFont(font) - self.label.setObjectName("label") - self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1) self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) @@ -54,10 +61,17 @@ def setupUi(self, generator_form): self.pushButton.setObjectName("pushButton") self.horizontalLayout_6.addWidget(self.pushButton) self.gridLayout_2.addLayout(self.horizontalLayout_6, 0, 1, 1, 1) + self.label = QtWidgets.QLabel(parent=self.layoutWidget) + font = QtGui.QFont() + font.setPointSize(8) + font.setBold(True) + self.label.setFont(font) + self.label.setObjectName("label") + self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1) self.prompt = QtWidgets.QPlainTextEdit(parent=self.layoutWidget) self.prompt.setObjectName("prompt") self.gridLayout_2.addWidget(self.prompt, 1, 0, 1, 2) - self.layoutWidget1 = QtWidgets.QWidget(parent=self.advanced_splitter) + self.layoutWidget1 = QtWidgets.QWidget(parent=self.splitter) self.layoutWidget1.setObjectName("layoutWidget1") self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.layoutWidget1) self.verticalLayout_6.setContentsMargins(0, 9, 0, 0) @@ -72,252 +86,25 @@ def setupUi(self, generator_form): self.negative_prompt = QtWidgets.QPlainTextEdit(parent=self.layoutWidget1) self.negative_prompt.setObjectName("negative_prompt") self.verticalLayout_6.addWidget(self.negative_prompt) - self.scrollArea_2 = QtWidgets.QScrollArea(parent=self.advanced_splitter) - self.scrollArea_2.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) - self.scrollArea_2.setWidgetResizable(True) - self.scrollArea_2.setObjectName("scrollArea_2") - self.scrollAreaWidgetContents_5 = QtWidgets.QWidget() - self.scrollAreaWidgetContents_5.setGeometry(QtCore.QRect(0, 0, 494, 135)) - self.scrollAreaWidgetContents_5.setObjectName("scrollAreaWidgetContents_5") - self.gridLayout = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_5) - self.gridLayout.setContentsMargins(0, 0, 0, 0) - self.gridLayout.setObjectName("gridLayout") - self.horizontalLayout_5 = QtWidgets.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.verticalLayout_4 = QtWidgets.QVBoxLayout() - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.label_5 = QtWidgets.QLabel(parent=self.scrollAreaWidgetContents_5) - font = QtGui.QFont() - font.setPointSize(8) - font.setBold(True) - self.label_5.setFont(font) - self.label_5.setObjectName("label_5") - self.verticalLayout_4.addWidget(self.label_5) - self.pipeline = QtWidgets.QComboBox(parent=self.scrollAreaWidgetContents_5) - self.pipeline.setObjectName("pipeline") - self.verticalLayout_4.addWidget(self.pipeline) - self.horizontalLayout_5.addLayout(self.verticalLayout_4) - self.verticalLayout_7 = QtWidgets.QVBoxLayout() - self.verticalLayout_7.setObjectName("verticalLayout_7") - self.label_6 = QtWidgets.QLabel(parent=self.scrollAreaWidgetContents_5) - font = QtGui.QFont() - font.setPointSize(8) - font.setBold(True) - self.label_6.setFont(font) - self.label_6.setObjectName("label_6") - self.verticalLayout_7.addWidget(self.label_6) - self.version = QtWidgets.QComboBox(parent=self.scrollAreaWidgetContents_5) - self.version.setObjectName("version") - self.verticalLayout_7.addWidget(self.version) - self.horizontalLayout_5.addLayout(self.verticalLayout_7) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.label_3 = QtWidgets.QLabel(parent=self.scrollAreaWidgetContents_5) - font = QtGui.QFont() - font.setPointSize(8) - font.setBold(True) - self.label_3.setFont(font) - self.label_3.setObjectName("label_3") - self.verticalLayout.addWidget(self.label_3) - self.model = QtWidgets.QComboBox(parent=self.scrollAreaWidgetContents_5) - self.model.setObjectName("model") - self.verticalLayout.addWidget(self.model) - self.horizontalLayout_5.addLayout(self.verticalLayout) - self.verticalLayout_2 = QtWidgets.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.label_4 = QtWidgets.QLabel(parent=self.scrollAreaWidgetContents_5) - font = QtGui.QFont() - font.setPointSize(8) - font.setBold(True) - self.label_4.setFont(font) - self.label_4.setObjectName("label_4") - self.verticalLayout_2.addWidget(self.label_4) - self.scheduler = QtWidgets.QComboBox(parent=self.scrollAreaWidgetContents_5) - self.scheduler.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.ArrowCursor)) - self.scheduler.setObjectName("scheduler") - self.verticalLayout_2.addWidget(self.scheduler) - self.horizontalLayout_5.addLayout(self.verticalLayout_2) - self.gridLayout.addLayout(self.horizontalLayout_5, 2, 0, 1, 1) - self.verticalLayout_5 = QtWidgets.QVBoxLayout() - self.verticalLayout_5.setObjectName("verticalLayout_5") - self.variation_checkbox = QtWidgets.QCheckBox(parent=self.scrollAreaWidgetContents_5) - self.variation_checkbox.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.variation_checkbox.setObjectName("variation_checkbox") - self.verticalLayout_5.addWidget(self.variation_checkbox) - self.gridLayout.addLayout(self.verticalLayout_5, 7, 0, 1, 1) - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.steps_widget = SliderWidget(parent=self.scrollAreaWidgetContents_5) - self.steps_widget.setProperty("slider_callback", "handle_value_change") - self.steps_widget.setProperty("current_value", 0) - self.steps_widget.setProperty("slider_maximum", 200) - self.steps_widget.setProperty("spinbox_maximum", 200.0) - self.steps_widget.setProperty("display_as_float", False) - self.steps_widget.setProperty("spinbox_single_step", 1) - self.steps_widget.setProperty("spinbox_page_step", 1) - self.steps_widget.setProperty("spinbox_minimum", 1) - self.steps_widget.setProperty("slider_minimum", 1) - self.steps_widget.setProperty("settings_property", "generator.steps") - self.steps_widget.setObjectName("steps_widget") - self.horizontalLayout_2.addWidget(self.steps_widget) - self.scale_widget = SliderWidget(parent=self.scrollAreaWidgetContents_5) - self.scale_widget.setProperty("current_value", 0) - self.scale_widget.setProperty("slider_maximum", 10000) - self.scale_widget.setProperty("spinbox_maximum", 100.0) - self.scale_widget.setProperty("display_as_float", True) - self.scale_widget.setProperty("spinbox_single_step", 0.01) - self.scale_widget.setProperty("spinbox_page_step", 0.01) - self.scale_widget.setProperty("slider_callback", "handle_value_change") - self.scale_widget.setProperty("settings_property", "generator.scale") - self.scale_widget.setObjectName("scale_widget") - self.horizontalLayout_2.addWidget(self.scale_widget) - self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1) - self.horizontalLayout_4 = QtWidgets.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.samples_widget = SliderWidget(parent=self.scrollAreaWidgetContents_5) - self.samples_widget.setProperty("slider_callback", "handle_value_change") - self.samples_widget.setProperty("current_value", 0) - self.samples_widget.setProperty("slider_maximum", 500) - self.samples_widget.setProperty("spinbox_maximum", 500.0) - self.samples_widget.setProperty("display_as_float", False) - self.samples_widget.setProperty("spinbox_single_step", 1) - self.samples_widget.setProperty("spinbox_page_step", 1) - self.samples_widget.setProperty("spinbox_minimum", 1) - self.samples_widget.setProperty("slider_minimum", 1) - self.samples_widget.setObjectName("samples_widget") - self.horizontalLayout_4.addWidget(self.samples_widget) - self.clip_skip_slider_widget = SliderWidget(parent=self.scrollAreaWidgetContents_5) - self.clip_skip_slider_widget.setProperty("current_value", 0) - self.clip_skip_slider_widget.setProperty("slider_maximum", 11) - self.clip_skip_slider_widget.setProperty("spinbox_maximum", 12.0) - self.clip_skip_slider_widget.setProperty("display_as_float", False) - self.clip_skip_slider_widget.setProperty("spinbox_single_step", 1) - self.clip_skip_slider_widget.setProperty("spinbox_page_step", 1) - self.clip_skip_slider_widget.setProperty("spinbox_minimum", 0) - self.clip_skip_slider_widget.setProperty("slider_minimum", 0) - self.clip_skip_slider_widget.setProperty("slider_callback", "handle_value_change") - self.clip_skip_slider_widget.setProperty("settings_property", "generator.clip_skip") - self.clip_skip_slider_widget.setObjectName("clip_skip_slider_widget") - self.horizontalLayout_4.addWidget(self.clip_skip_slider_widget) - self.gridLayout.addLayout(self.horizontalLayout_4, 5, 0, 1, 1) - self.horizontalLayout_7 = QtWidgets.QHBoxLayout() - self.horizontalLayout_7.setObjectName("horizontalLayout_7") - self.ddim_eta_slider_widget = SliderWidget(parent=self.scrollAreaWidgetContents_5) - self.ddim_eta_slider_widget.setProperty("slider_callback", "handle_value_change") - self.ddim_eta_slider_widget.setProperty("current_value", 1) - self.ddim_eta_slider_widget.setProperty("slider_maximum", 10) - self.ddim_eta_slider_widget.setProperty("spinbox_maximum", 10) - self.ddim_eta_slider_widget.setProperty("display_as_float", False) - self.ddim_eta_slider_widget.setProperty("spinbox_single_step", 1) - self.ddim_eta_slider_widget.setProperty("spinbox_page_step", 1) - self.ddim_eta_slider_widget.setProperty("spinbox_minimum", 1) - self.ddim_eta_slider_widget.setProperty("slider_minimum", 1) - self.ddim_eta_slider_widget.setProperty("settings_property", "generator.ddim_eta") - self.ddim_eta_slider_widget.setObjectName("ddim_eta_slider_widget") - self.horizontalLayout_7.addWidget(self.ddim_eta_slider_widget) - self.frames_slider_widget = SliderWidget(parent=self.scrollAreaWidgetContents_5) - self.frames_slider_widget.setProperty("slider_callback", "handle_value_change") - self.frames_slider_widget.setProperty("current_value", 0) - self.frames_slider_widget.setProperty("slider_maximum", 200) - self.frames_slider_widget.setProperty("spinbox_maximum", 200.0) - self.frames_slider_widget.setProperty("display_as_float", False) - self.frames_slider_widget.setProperty("spinbox_single_step", 1) - self.frames_slider_widget.setProperty("spinbox_page_step", 1) - self.frames_slider_widget.setProperty("spinbox_minimum", 1) - self.frames_slider_widget.setProperty("slider_minimum", 1) - self.frames_slider_widget.setProperty("settings_property", "generator.n_samples") - self.frames_slider_widget.setObjectName("frames_slider_widget") - self.horizontalLayout_7.addWidget(self.frames_slider_widget) - self.gridLayout.addLayout(self.horizontalLayout_7, 6, 0, 1, 1) - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.seed_widget = SeedWidget(parent=self.scrollAreaWidgetContents_5) - self.seed_widget.setProperty("generator_section", "") - self.seed_widget.setProperty("generator_name", "") - self.seed_widget.setObjectName("seed_widget") - self.horizontalLayout.addWidget(self.seed_widget) - self.seed_widget_latents = SeedWidget(parent=self.scrollAreaWidgetContents_5) - self.seed_widget_latents.setProperty("generator_section", "") - self.seed_widget_latents.setProperty("generator_name", "") - self.seed_widget_latents.setObjectName("seed_widget_latents") - self.horizontalLayout.addWidget(self.seed_widget_latents) - self.gridLayout.addLayout(self.horizontalLayout, 3, 0, 1, 1) - self.verticalLayout_3 = QtWidgets.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.input_image_widget = InputImageSettingsWidget(parent=self.scrollAreaWidgetContents_5) - self.input_image_widget.setMinimumSize(QtCore.QSize(0, 0)) - self.input_image_widget.setAcceptDrops(False) - self.input_image_widget.setProperty("generator_section", "") - self.input_image_widget.setProperty("generator_name", "") - self.input_image_widget.setObjectName("input_image_widget") - self.verticalLayout_3.addWidget(self.input_image_widget) - self.controlnet_settings = ControlNetSettingsWidget(parent=self.scrollAreaWidgetContents_5) - self.controlnet_settings.setMinimumSize(QtCore.QSize(0, 0)) - self.controlnet_settings.setAcceptDrops(False) - self.controlnet_settings.setProperty("generator_section", "") - self.controlnet_settings.setProperty("generator_name", "") - self.controlnet_settings.setObjectName("controlnet_settings") - self.verticalLayout_3.addWidget(self.controlnet_settings) - self.gridLayout.addLayout(self.verticalLayout_3, 1, 0, 1, 1) - self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_5) - self.gridLayout_8.addWidget(self.advanced_splitter, 0, 0, 1, 1) - self.horizontalLayout_9 = QtWidgets.QHBoxLayout() - self.horizontalLayout_9.setObjectName("horizontalLayout_9") - self.generate_button = QtWidgets.QPushButton(parent=self.scrollAreaWidgetContents) - self.generate_button.setObjectName("generate_button") - self.horizontalLayout_9.addWidget(self.generate_button) - self.progress_bar = QtWidgets.QProgressBar(parent=self.scrollAreaWidgetContents) - self.progress_bar.setProperty("value", 0) - self.progress_bar.setObjectName("progress_bar") - self.horizontalLayout_9.addWidget(self.progress_bar) - self.interrupt_button = QtWidgets.QPushButton(parent=self.scrollAreaWidgetContents) - self.interrupt_button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor)) - self.interrupt_button.setObjectName("interrupt_button") - self.horizontalLayout_9.addWidget(self.interrupt_button) - self.gridLayout_8.addLayout(self.horizontalLayout_9, 1, 0, 1, 1) + self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) self.scrollArea.setWidget(self.scrollAreaWidgetContents) - self.gridLayout_3.addWidget(self.scrollArea, 0, 0, 1, 1) + self.gridLayout_7.addWidget(self.scrollArea, 1, 0, 1, 1) self.retranslateUi(generator_form) - self.scheduler.currentTextChanged['QString'].connect(generator_form.handle_scheduler_changed) # type: ignore self.pushButton.clicked.connect(generator_form.action_clicked_button_save_prompts) # type: ignore self.interrupt_button.clicked.connect(generator_form.handle_interrupt_button_clicked) # type: ignore self.generate_button.clicked.connect(generator_form.handle_generate_button_clicked) # type: ignore self.prompt.textChanged.connect(generator_form.handle_prompt_changed) # type: ignore - self.model.currentTextChanged['QString'].connect(generator_form.handle_model_changed) # type: ignore self.negative_prompt.textChanged.connect(generator_form.handle_negative_prompt_changed) # type: ignore - self.variation_checkbox.toggled['bool'].connect(generator_form.toggle_variation) # type: ignore - self.pipeline.currentTextChanged['QString'].connect(generator_form.handle_pipeline_changed) # type: ignore - self.version.currentTextChanged['QString'].connect(generator_form.handle_version_changed) # type: ignore QtCore.QMetaObject.connectSlotsByName(generator_form) def retranslateUi(self, generator_form): _translate = QtCore.QCoreApplication.translate generator_form.setWindowTitle(_translate("generator_form", "Form")) - self.label.setText(_translate("generator_form", "Prompt")) + self.generate_button.setText(_translate("generator_form", "Generate")) + self.interrupt_button.setText(_translate("generator_form", "Interrupt")) self.pushButton.setText(_translate("generator_form", "Save Prompts")) + self.label.setText(_translate("generator_form", "Prompt")) self.prompt.setPlaceholderText(_translate("generator_form", "Enter a prompt...")) self.label_2.setText(_translate("generator_form", "Negative Prompt")) self.negative_prompt.setPlaceholderText(_translate("generator_form", "Enter a negative prompt...")) - self.label_5.setText(_translate("generator_form", "Pipeline")) - self.label_6.setText(_translate("generator_form", "Version")) - self.label_3.setText(_translate("generator_form", "Model")) - self.label_4.setText(_translate("generator_form", "Scheduler")) - self.variation_checkbox.setText(_translate("generator_form", "Variation")) - self.steps_widget.setProperty("label_text", _translate("generator_form", "Steps")) - self.scale_widget.setProperty("label_text", _translate("generator_form", "Scale")) - self.samples_widget.setProperty("label_text", _translate("generator_form", "Samples")) - self.samples_widget.setProperty("settings_property", _translate("generator_form", "generator.n_samples")) - self.clip_skip_slider_widget.setProperty("label_text", _translate("generator_form", "Clip Skip")) - self.ddim_eta_slider_widget.setProperty("label_text", _translate("generator_form", "DDIM ETA")) - self.frames_slider_widget.setProperty("label_text", _translate("generator_form", "Frames")) - self.seed_widget.setProperty("property_name", _translate("generator_form", "generator.random_seed")) - self.seed_widget_latents.setProperty("property_name", _translate("generator_form", "generator.random_latents_seed")) - self.input_image_widget.setProperty("checkbox_label", _translate("generator_form", "Use Input Image")) - self.controlnet_settings.setProperty("checkbox_label", _translate("generator_form", "Controlnet")) - self.generate_button.setText(_translate("generator_form", "Generate")) - self.interrupt_button.setText(_translate("generator_form", "Interrupt")) -from airunner.widgets.controlnet_settings.controlnet_settings_widget import ControlNetSettingsWidget -from airunner.widgets.input_image.input_image_settings_widget import InputImageSettingsWidget -from airunner.widgets.seed.seed_widget import SeedWidget -from airunner.widgets.slider.slider_widget import SliderWidget diff --git a/src/airunner/widgets/image/image_widget.py b/src/airunner/widgets/image/image_widget.py index 4e7858514..d4b027f6f 100644 --- a/src/airunner/widgets/image/image_widget.py +++ b/src/airunner/widgets/image/image_widget.py @@ -1,17 +1,27 @@ import os +import json from PyQt6.QtGui import QPixmap from PyQt6.QtWidgets import QLabel from PyQt6.QtCore import Qt from PyQt6.QtWidgets import QVBoxLayout from PyQt6.QtWidgets import QDialog +from PyQt6.QtCore import pyqtSignal +from PyQt6.QtWidgets import QMenu +from PyQt6.QtWidgets import QMessageBox +from PIL import Image from PIL import Image +from PIL.ImageQt import ImageQt from airunner.utils import load_metadata_from_image +from airunner.utils import delete_image from airunner.widgets.base_widget import BaseWidget from airunner.widgets.image.templates.image_widget_ui import Ui_image_widget from airunner.aihandler.logger import Logger +from PyQt6.QtGui import QDrag +from PyQt6.QtCore import QMimeData +from PyQt6.QtCore import QByteArray class ImageWidget(BaseWidget): @@ -20,9 +30,12 @@ class ImageWidget(BaseWidget): meta_data = {} image_width = 0 image_height = 0 - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) + clicked = pyqtSignal() + + def thumbnail(self, width=128, height=128): + if not self.pixmap: + return None + return self.pixmap.scaled(width, height, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation) def set_image(self, image_path): size = self.ui.image_frame.width() @@ -31,8 +44,14 @@ def set_image(self, image_path): self.load_meta_data(image_path) # Create a QPixmap object - pixmap = QPixmap(self.image_path) + + if isinstance(self.image_path, Image.Image): + qimage = ImageQt(self.image_path) # Convert the PngImageFile to a QImage + pixmap = QPixmap.fromImage(qimage) # Create a QPixmap from the QImage + else: + pixmap = QPixmap(self.image_path) pixmap = pixmap.scaled(size - 20, size - 20, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation) + self.pixmap = pixmap # set width and height self.image_width = pixmap.width() @@ -52,36 +71,129 @@ def set_image(self, image_path): label.setAlignment(Qt.AlignmentFlag.AlignCenter) def handle_label_clicked(self, event): - self.send_image_to_grid() + if event.button() == Qt.MouseButton.LeftButton: + drag = QDrag(self.app) + mime_data = QMimeData() + + # Load the image metadata + self.load_meta_data(self.image_path) + + # Convert the metadata to a JSON string + meta_data = self.meta_data.copy() + meta_data["path"] = self.image_path + meta_data_str = json.dumps(meta_data) + + # Encode the JSON string to bytes + meta_data_bytes = meta_data_str.encode() + + # Set the metadata as additional data in the QMimeData object + mime_data.setData("application/x-qt-image-metadata", QByteArray(meta_data_bytes)) + + drag.setMimeData(mime_data) + + # Set a pixmap for the drag operation + pixmap = QPixmap(self.image_path) + + # Scale the pixmap to no larger than 128x128 while maintaining aspect ratio + pixmap = pixmap.scaled(128, 128, Qt.AspectRatioMode.KeepAspectRatio) + + drag.setPixmap(pixmap) + + # Execute the drag operation + drag.exec(Qt.DropAction.MoveAction) + elif event.button() == Qt.MouseButton.RightButton: + #self.send_image_to_grid() + self.display_image_menu(event) + + def display_image_menu(self, event): + context_menu = QMenu(self) + + view_action = context_menu.addAction("View") + edit_action = context_menu.addAction("Edit") + delete_action = context_menu.addAction("Delete") + + # display image in a window + view_action.triggered.connect(lambda: self.view_image()) + edit_action.triggered.connect(lambda: self.send_image_to_grid()) + delete_action.triggered.connect(lambda: self.delete_image()) + + global_position = self.mapToGlobal(event.pos()) + context_menu.exec(global_position) def load_meta_data(self, image_path): # load the png metadata from image_path - with open(image_path, 'rb') as image_file: - image = Image.open(image_file) + # check if image_path is Image + image = None + if isinstance(image_path, Image.Image): + image = image_path + else: + with open(image_path, 'rb') as image_file: + image = Image.open(image_file) + + if image: self.meta_data = load_metadata_from_image(image) def send_image_to_grid(self): #self.app.ui.canvas_plus_widget.load_image(self.image_path) self.app.load_image.emit(self.image_path) + def view_image(self): + from PyQt6.QtWidgets import QGraphicsView, QGraphicsScene, QDialog, QVBoxLayout + from PyQt6.QtGui import QPixmap + from PyQt6.QtCore import Qt + from PyQt6.QtGui import QPainter + # Open the image + image = QPixmap(self.image_path) + + # Create a QGraphicsScene and add the image to it + scene = QGraphicsScene() + scene.addPixmap(image) + + # Create a QGraphicsView and set its scene to be the one we just created + view = QGraphicsView(scene) + + # Enable dragging and using the scroll wheel to zoom + view.setRenderHint(QPainter.RenderHint.Antialiasing) + view.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform) + view.setRenderHint(QPainter.RenderHint.TextAntialiasing) + view.setOptimizationFlags(QGraphicsView.OptimizationFlag.DontAdjustForAntialiasing | QGraphicsView.OptimizationFlag.DontSavePainterState) + view.setViewportUpdateMode(QGraphicsView.ViewportUpdateMode.FullViewportUpdate) + view.setTransformationAnchor(QGraphicsView.ViewportAnchor.AnchorUnderMouse) + view.setResizeAnchor(QGraphicsView.ViewportAnchor.AnchorUnderMouse) + view.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + view.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + view.setInteractive(True) + view.setMouseTracking(True) + view.setRenderHints(QPainter.RenderHint.Antialiasing | QPainter.RenderHint.SmoothPixmapTransform | QPainter.RenderHint.TextAntialiasing) + + # Create a layout and add the QGraphicsView to it + layout = QVBoxLayout() + layout.addWidget(view) + + # Create a QDialog, set its layout and show it + dialog = QDialog() + dialog.setLayout(layout) + dialog.exec() + + def delete_image(self): + confirm_dialog = QMessageBox() + confirm_dialog.setIcon(QMessageBox.Icon.Warning) + confirm_dialog.setText("Are you sure you want to delete this image?") + confirm_dialog.setWindowTitle("Confirm Delete") + confirm_dialog.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No) + + result = confirm_dialog.exec() + if result == QMessageBox.StandardButton.Yes: + self.confirm_delete() + else: + self.cancel_delete() + def confirm_delete(self): - pass + delete_image(self.image_path) def cancel_delete(self): pass - def delete_image(self): - if not self.image_path: - return - try: - os.remove(self.image_path) - except Exception as e: - Logger.error("Failed to delete image") - try: - self.deleteLater() - except Exception as e: - Logger.error("Failed to delete widget") - def generate_similar(self): image = Image.open(self.image_path) meta_data = self.meta_data.copy() @@ -121,3 +233,19 @@ def generate_variant(self): image=image, override_data=meta_data ) + + +class BrushImageWidget(ImageWidget): + def __init__(self, *args, **kwargs): + self.container = kwargs.pop("container", None) + self.brush = kwargs.pop("brush", None) + super().__init__(*args, **kwargs) + + def handle_label_clicked(self, event): + # get the clicked object + if event.button() == Qt.MouseButton.LeftButton: + # check if shift is down + shift_pressed = event.modifiers() == Qt.KeyboardModifier.ShiftModifier + self.container.activate_brush(self, self.brush, shift_pressed) + elif event.button() == Qt.MouseButton.RightButton: + self.container.display_brush_menu(event, self, self.brush) diff --git a/src/airunner/widgets/image_generator_preferences/image_generator_preferences_widget.py b/src/airunner/widgets/image_generator_preferences/image_generator_preferences_widget.py index 46a5b887c..4ccc755d4 100644 --- a/src/airunner/widgets/image_generator_preferences/image_generator_preferences_widget.py +++ b/src/airunner/widgets/image_generator_preferences/image_generator_preferences_widget.py @@ -8,7 +8,6 @@ class ImageGeneratorPreferencesWidget(BaseWidget): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.ui.stablediffusion.setChecked(self.settings_manager.current_image_generator == "stablediffusion") - self.ui.kandinsky.setChecked(self.settings_manager.current_image_generator == "kandinsky") def stablediffusion_toggled(self, val): if val: @@ -16,12 +15,4 @@ def stablediffusion_toggled(self, val): self.settings_manager.set_value("current_tab", "stablediffusion") self.settings_manager.set_value("current_section_stablediffusion", "txt2img") self.app.generator_tab_widget.set_current_section_tab() - self.settings_manager.set_value("generator_section", "txt2img") - - def kandinsky_toggled(self, val): - if val: - self.settings_manager.set_value("current_image_generator", "kandinsky") - self.settings_manager.set_value("current_tab", "kandinsky") - self.settings_manager.set_value("current_section_kandinsky", "txt2img") - self.app.generator_tab_widget.set_current_section_tab() self.settings_manager.set_value("generator_section", "txt2img") \ No newline at end of file diff --git a/src/airunner/widgets/image_generator_preferences/templates/image_generator_preferences.ui b/src/airunner/widgets/image_generator_preferences/templates/image_generator_preferences.ui index 40b3aa946..e277e6901 100644 --- a/src/airunner/widgets/image_generator_preferences/templates/image_generator_preferences.ui +++ b/src/airunner/widgets/image_generator_preferences/templates/image_generator_preferences.ui @@ -27,13 +27,6 @@ - - - - Kandinsky - - - @@ -70,22 +63,6 @@ - - kandinsky - toggled(bool) - image_generator_preferences - kandinsky_toggled(bool) - - - 66 - 78 - - - 110 - -2 - - -
stablediffusion_toggled(bool) diff --git a/src/airunner/widgets/image_generator_preferences/templates/image_generator_preferences_ui.py b/src/airunner/widgets/image_generator_preferences/templates/image_generator_preferences_ui.py index 78e2875ab..251961833 100644 --- a/src/airunner/widgets/image_generator_preferences/templates/image_generator_preferences_ui.py +++ b/src/airunner/widgets/image_generator_preferences/templates/image_generator_preferences_ui.py @@ -22,16 +22,12 @@ def setupUi(self, image_generator_preferences): self.stablediffusion = QtWidgets.QRadioButton(parent=self.groupBox) self.stablediffusion.setObjectName("stablediffusion") self.gridLayout_2.addWidget(self.stablediffusion, 0, 0, 1, 1) - self.kandinsky = QtWidgets.QRadioButton(parent=self.groupBox) - self.kandinsky.setObjectName("kandinsky") - self.gridLayout_2.addWidget(self.kandinsky, 1, 0, 1, 1) self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) self.gridLayout.addItem(spacerItem, 1, 0, 1, 1) self.retranslateUi(image_generator_preferences) self.stablediffusion.toggled['bool'].connect(image_generator_preferences.stablediffusion_toggled) # type: ignore - self.kandinsky.toggled['bool'].connect(image_generator_preferences.kandinsky_toggled) # type: ignore QtCore.QMetaObject.connectSlotsByName(image_generator_preferences) def retranslateUi(self, image_generator_preferences): @@ -39,4 +35,3 @@ def retranslateUi(self, image_generator_preferences): image_generator_preferences.setWindowTitle(_translate("image_generator_preferences", "Form")) self.groupBox.setTitle(_translate("image_generator_preferences", "Current Image Generator")) self.stablediffusion.setText(_translate("image_generator_preferences", "StableDiffusion")) - self.kandinsky.setText(_translate("image_generator_preferences", "Kandinsky")) diff --git a/src/airunner/widgets/layers/layer_container_widget.py b/src/airunner/widgets/layers/layer_container_widget.py index 861a30b5e..4be82f88c 100644 --- a/src/airunner/widgets/layers/layer_container_widget.py +++ b/src/airunner/widgets/layers/layer_container_widget.py @@ -348,7 +348,6 @@ def set_layer_opacity(self, opacity: int): session = get_session() session.add(self.current_layer) save_session(session) - self.app.canvas.do_draw() def show_layers(self): pass \ No newline at end of file diff --git a/src/airunner/widgets/llm/templates/llm_widget.ui b/src/airunner/widgets/llm/templates/llm_widget.ui index d047748a2..acc764482 100644 --- a/src/airunner/widgets/llm/templates/llm_widget.ui +++ b/src/airunner/widgets/llm/templates/llm_widget.ui @@ -29,7 +29,7 @@ - 2 + 0 @@ -1010,85 +1010,6 @@ - - - Quantization - - - - - - Model - - - - - - - - - - - - Model Version - - - - - - -1 - - - - - - - - - - DType - - - - - - - - - - - - Quantized model name - - - - - - - - - - - - Run Quantization - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - diff --git a/src/airunner/widgets/llm/templates/llm_widget_ui.py b/src/airunner/widgets/llm/templates/llm_widget_ui.py index a331dec37..efb6aee76 100644 --- a/src/airunner/widgets/llm/templates/llm_widget_ui.py +++ b/src/airunner/widgets/llm/templates/llm_widget_ui.py @@ -433,54 +433,11 @@ def setupUi(self, llm_widget): self.gridLayout_5.addWidget(self.groupBox_14, 2, 0, 1, 1) icon = QtGui.QIcon.fromTheme("preferences-other") self.tabWidget.addTab(self.settings, icon, "") - self.quantization = QtWidgets.QWidget() - self.quantization.setObjectName("quantization") - self.gridLayout_7 = QtWidgets.QGridLayout(self.quantization) - self.gridLayout_7.setObjectName("gridLayout_7") - self.groupBox_9 = QtWidgets.QGroupBox(parent=self.quantization) - self.groupBox_9.setObjectName("groupBox_9") - self.gridLayout_14 = QtWidgets.QGridLayout(self.groupBox_9) - self.gridLayout_14.setObjectName("gridLayout_14") - self.quantization_model = QtWidgets.QComboBox(parent=self.groupBox_9) - self.quantization_model.setObjectName("quantization_model") - self.gridLayout_14.addWidget(self.quantization_model, 0, 0, 1, 1) - self.gridLayout_7.addWidget(self.groupBox_9, 0, 0, 1, 1) - self.groupBox_13 = QtWidgets.QGroupBox(parent=self.quantization) - self.groupBox_13.setObjectName("groupBox_13") - self.gridLayout_16 = QtWidgets.QGridLayout(self.groupBox_13) - self.gridLayout_16.setObjectName("gridLayout_16") - self.quantization_model_version = QtWidgets.QComboBox(parent=self.groupBox_13) - self.quantization_model_version.setObjectName("quantization_model_version") - self.gridLayout_16.addWidget(self.quantization_model_version, 0, 0, 1, 1) - self.gridLayout_7.addWidget(self.groupBox_13, 1, 0, 1, 1) - self.groupBox_10 = QtWidgets.QGroupBox(parent=self.quantization) - self.groupBox_10.setObjectName("groupBox_10") - self.gridLayout_6 = QtWidgets.QGridLayout(self.groupBox_10) - self.gridLayout_6.setObjectName("gridLayout_6") - self.comboBox_2 = QtWidgets.QComboBox(parent=self.groupBox_10) - self.comboBox_2.setObjectName("comboBox_2") - self.gridLayout_6.addWidget(self.comboBox_2, 0, 0, 1, 1) - self.gridLayout_7.addWidget(self.groupBox_10, 2, 0, 1, 1) - self.groupBox_12 = QtWidgets.QGroupBox(parent=self.quantization) - self.groupBox_12.setObjectName("groupBox_12") - self.gridLayout_15 = QtWidgets.QGridLayout(self.groupBox_12) - self.gridLayout_15.setObjectName("gridLayout_15") - self.lineEdit = QtWidgets.QLineEdit(parent=self.groupBox_12) - self.lineEdit.setObjectName("lineEdit") - self.gridLayout_15.addWidget(self.lineEdit, 0, 0, 1, 1) - self.gridLayout_7.addWidget(self.groupBox_12, 3, 0, 1, 1) - self.pushButton_2 = QtWidgets.QPushButton(parent=self.quantization) - self.pushButton_2.setObjectName("pushButton_2") - self.gridLayout_7.addWidget(self.pushButton_2, 4, 0, 1, 1) - spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) - self.gridLayout_7.addItem(spacerItem2, 5, 0, 1, 1) - self.tabWidget.addTab(self.quantization, "") self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) self.retranslateUi(llm_widget) - self.tabWidget.setCurrentIndex(2) + self.tabWidget.setCurrentIndex(0) self.model_version.setCurrentIndex(-1) - self.quantization_model_version.setCurrentIndex(-1) self.prefix.textChanged.connect(llm_widget.prefix_text_changed) # type: ignore self.suffix.textChanged.connect(llm_widget.suffix_text_changed) # type: ignore self.send_button.clicked.connect(llm_widget.action_button_clicked_send) # type: ignore @@ -610,10 +567,4 @@ def retranslateUi(self, llm_widget): self.groupBox_8.setTitle(_translate("llm_widget", "Model Version")) self.groupBox_14.setTitle(_translate("llm_widget", "Prompt Template")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.settings), _translate("llm_widget", "Settings")) - self.groupBox_9.setTitle(_translate("llm_widget", "Model")) - self.groupBox_13.setTitle(_translate("llm_widget", "Model Version")) - self.groupBox_10.setTitle(_translate("llm_widget", "DType")) - self.groupBox_12.setTitle(_translate("llm_widget", "Quantized model name")) - self.pushButton_2.setText(_translate("llm_widget", "Run Quantization")) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.quantization), _translate("llm_widget", "Quantization")) from airunner.widgets.slider.slider_widget import SliderWidget diff --git a/src/airunner/windows/main/main_window.py b/src/airunner/windows/main/main_window.py index 9bfe93c4a..25a903653 100644 --- a/src/airunner/windows/main/main_window.py +++ b/src/airunner/windows/main/main_window.py @@ -34,8 +34,6 @@ create_airunner_paths, default_hf_cache_dir from airunner.widgets.status.status_widget import StatusWidget from airunner.windows.about.about import AboutWindow -from airunner.windows.deterministic_generation.deterministic_generation_window import DeterministicGenerationWindow -from airunner.windows.interpolation.image_interpolation import ImageInterpolation from airunner.windows.main.templates.main_window_ui import Ui_MainWindow from airunner.windows.model_merger import ModelMerger from airunner.windows.prompt_browser.prompt_browser import PromptBrowser @@ -43,6 +41,7 @@ from airunner.windows.update.update_window import UpdateWindow from airunner.windows.video import VideoPopup from airunner.data.models import TabSection +from airunner.widgets.brushes.brushes_container import BrushesContainer from airunner.utils import get_session @@ -70,7 +69,6 @@ class MainWindow( override_section = None _version = None _latest_version = None - use_interpolation = None add_image_to_canvas_signal = pyqtSignal(dict) data = None # this is set in the generator_mixin image_handler function and used for deterministic generation status_error_color = "#ff0000" @@ -82,7 +80,6 @@ class MainWindow( status_widget = None splitters = None - image_interpolation_window = None deterministic_window = None _tabs = { @@ -95,10 +92,6 @@ class MainWindow( "superresolution": None, "txt2vid": None }, - "kandinsky": { - "txt2img": None, - "outpaint": None, - }, } registered_settings_handlers = [] image_generated = pyqtSignal(bool) @@ -135,14 +128,6 @@ def is_dark(self): def grid_size(self): return self.settings_manager.grid_settings.size - @property - def canvas_widget(self): - return self.ui.canvas_plus_widget.ui - - @property - def canvas(self): - return self.ui.canvas_plus_widget - @property def standard_image_panel(self): return self.ui.standard_image_widget @@ -199,7 +184,7 @@ def tabs(self, val): @property def generator_type(self): """ - Returns either stablediffusion or kandinsky + Returns stablediffusion :return: string """ return self._generator_type @@ -243,15 +228,9 @@ def is_maximized(self, val): @property def current_layer(self): return self.ui.layer_widget.current_layer - - @property - def canvas_is_active(self): - return self.image_editor_tab_name == "Canvas" @property def current_canvas(self): - if self.canvas_is_active: - return self.canvas return self.standard_image_panel def describe_image(self, image, callback): @@ -261,10 +240,7 @@ def describe_image(self, image, callback): ) def current_active_image(self): - if self.canvas_is_active: - return self.canvas.current_active_image.copy() if self.canvas.current_active_image else None - else: - return self.ui.standard_image_widget.image.copy() if self.ui.standard_image_widget.image else None + return self.ui.standard_image_widget.image.copy() if self.ui.standard_image_widget.image else None def send_message(self, code, message): self.message_var.emit({ @@ -298,11 +274,6 @@ def __init__(self, *args, **kwargs): self.initialize() - # get tab index by name value which is stored in self.settings_manager.active_image_editor_section - index = self.ui.image_editor_tab_widget.indexOf(self.ui.image_editor_tab_widget.findChild(QWidget, self.settings_manager.active_image_editor_section)) - self.ui.image_editor_tab_widget.setCurrentIndex(index) - self.ui.image_editor_tab_widget.currentChanged.connect(self.image_editor_tab_index_changed) - # on window resize: # self.applicationStateChanged.connect(self.on_state_changed) @@ -342,6 +313,9 @@ def __init__(self, *args, **kwargs): self.ui.mode_tab_widget.tabBar().hide() self.ui.center_tab.tabBar().hide() + # initialize the brushes container + self.ui.brushes_container = BrushesContainer(self) + self.set_all_section_buttons() self.initialize_panel_tabs() @@ -355,18 +329,10 @@ def __init__(self, *args, **kwargs): else: self.model_manager_toggled() + # This is used to check the state of the window and save splitter sizes if they have changed self.start_splitter_timer() self.loaded.emit() - - @property - 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): """ @@ -467,9 +433,6 @@ def action_rotate_90_counterclockwise_triggered(self): def action_show_prompt_browser_triggered(self): self.show_prompt_browser() - def action_show_image_interpolation_triggered(self): - self.show_image_interpolation() - def action_clear_all_prompts_triggered(self): self.clear_all_prompts() @@ -503,12 +466,6 @@ def action_show_active_grid(self): def action_show_stablediffusion(self): self.activate_image_generation_section() - def action_show_kandinsky(self): - self.show_section("Kandinsky") - - def action_show_shape(self): - self.show_section("Shap-e") - def action_triggered_browse_ai_runner_path(self): path = self.settings_manager.path_settings.base_path if path == "": @@ -592,7 +549,6 @@ def action_toggle_nsfw_filter_triggered(self, bool): def action_toggle_grid(self, active): self.settings_manager.set_value("grid_settings.show_grid", active) - self.ui.canvas_plus_widget.do_draw() # self.canvas.update() def action_toggle_darkmode(self): @@ -640,13 +596,6 @@ def center_panel_tab_index_changed(self, val): session.commit() - def batches_panel_tab_index_changed(self, index): - tab_section = session.query(TabSection).filter_by( - panel="batches_tab" - ).first() - tab_section.active_tab = self.ui.batches_tab.tabText(index) - session.commit() - def bottom_panel_tab_index_changed(self, index): tab_section = session.query(TabSection).filter_by( panel="bottom_panel_tab_widget" @@ -886,7 +835,6 @@ def handle_button_clicked(self, kwargs): def toggle_tool(self, tool): self.settings_manager.set_value("current_tool", tool) - self.ui.canvas_plus_widget.update_cursor() def initialize_mixins(self): HistoryMixin.initialize(self) @@ -999,7 +947,6 @@ def show_section(self, section): "left": [self.ui.generator_widget.ui.generator_tabs.tabText(i) for i in range(self.ui.generator_widget.ui.generator_tabs.count())], "center": [self.ui.center_tab.tabText(i) for i in range(self.ui.center_tab.count())], "right": [self.ui.tool_tab_widget.tabText(i) for i in range(self.ui.tool_tab_widget.count())], - "right_center": [self.ui.batches_tab.tabText(i) for i in range(self.ui.batches_tab.count())], "bottom": [self.ui.bottom_panel_tab_widget.tabText(i) for i in range(self.ui.bottom_panel_tab_widget.count())] } for k, v in section_lists.items(): @@ -1008,8 +955,6 @@ def show_section(self, section): self.ui.generator_widget.ui.generator_tabs.setCurrentIndex(v.index(section)) elif k == "right": self.ui.tool_tab_widget.setCurrentIndex(v.index(section)) - elif k == "right_center": - self.ui.batches_tab.setCurrentIndex(v.index(section)) elif k == "bottom": self.ui.bottom_panel_tab_widget.setCurrentIndex(v.index(section)) break @@ -1356,7 +1301,7 @@ def do_save(self, document_name): self.canvas.is_dirty = False def update(self): - self.generator_tab_widget.update_thumbnails() + self.ui.standard_image_widget.update_thumbnails() def insert_into_prompt(self, text, negative_prompt=False): prompt_widget = self.generator_tab_widget.data[self.current_generator][self.current_section]["prompt_widget"] @@ -1420,13 +1365,11 @@ def import_image(self): directory=self.settings_manager.path_settings.image_path) if file_path == "": return - self.ui.canvas_plus_widget.load_image(file_path) def export_image(self, image=None): file_path, _ = self.display_file_export_dialog() if file_path == "": return - self.ui.canvas_plus_widget.save_image(file_path, image=image) def choose_image_export_path(self): # display a dialog to choose the export path @@ -1451,24 +1394,6 @@ def display_import_image_dialog(self, label="Import Image", directory=""): "Image Files (*.png *.jpg *.jpeg)" ) - def show_image_interpolation(self): - self.image_interpolation_window = ImageInterpolation(app=self, exec=False) - self.image_interpolation_window.show() - self.image_interpolation_window = None - - def show_deterministic_generation(self): - if not self.deterministic_window: - self.deterministic_window = DeterministicGenerationWindow(app=self, exec=False, images=self.deterministic_images, data=self.data) - self.deterministic_window.show() - self.deterministic_window = None - else: - self.deterministic_window.update_images(self.deterministic_images) - - def close_deterministic_generation_window(self): - self.deterministic_window = None - self.deterministic_data = None - self.deterministic_images = None - def load_prompt(self, prompt: Prompt): """ Loads prompt values from a Prompt model instance. @@ -1599,7 +1524,6 @@ def toggle_tool_section_buttons_visibility(self): elif visible and self.header_widget_spacer: self.ui.scrollAreaWidgetContents_3.layout().removeItem(self.header_widget_spacer) - def set_all_image_generator_buttons(self): is_image_generators = self.settings_manager.generator_section == GeneratorSection.TXT2IMG.value is_txt2vid = self.settings_manager.generator_section == GeneratorSection.TXT2VID.value @@ -1622,7 +1546,6 @@ def image_generators_toggled(self): save_session() self.set_all_image_generator_buttons() self.change_content_widget() - def text_to_video_toggled(self): self.image_generation_toggled() @@ -1654,4 +1577,4 @@ def redraw(self): self.set_stylesheet() # Update the window - self.update() \ No newline at end of file + self.update() diff --git a/src/airunner/windows/main/templates/main_window.ui b/src/airunner/windows/main/templates/main_window.ui index 6945a269d..bb5fdf015 100644 --- a/src/airunner/windows/main/templates/main_window.ui +++ b/src/airunner/windows/main/templates/main_window.ui @@ -938,7 +938,7 @@ Qt::Horizontal - + @@ -1005,42 +1005,12 @@ Qt::Horizontal - - - 0 - - - - Standard - - - - - - - - - - Canvas - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - + + + + + + @@ -1088,8 +1058,8 @@ 0 0 - 427 - 1012 + 365 + 1017 @@ -1099,53 +1069,12 @@ Qt::Vertical + + false + 0 - - - Embeddings - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - LoRA - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - Pen @@ -1191,31 +1120,6 @@ - - - 0 - - - - Deterministic Batches - - - - - - - - - - Standard Batches - - - - - - - - QFrame::StyledPanel @@ -1758,14 +1662,11 @@ Tools - - - @@ -1773,7 +1674,6 @@ - @@ -2417,9 +2317,9 @@ - GeneratorTabWidget + GeneratorForm QWidget -
airunner/widgets/generator_form/generator_tab_widget
+
airunner/widgets/generator_form/generator_form_widget
1
@@ -2434,18 +2334,6 @@
airunner/widgets/model_manager/model_manager_widget
1
- - EmbeddingsContainerWidget - QWidget -
airunner/widgets/embeddings/embeddings_container_widget
- 1 -
- - LoraContainerWidget - QWidget -
airunner/widgets/lora/lora_container_widget
- 1 -
BrushContainerWidget QWidget @@ -2458,27 +2346,6 @@
airunner/widgets/layers/layer_container_widget
1
- - DeterministicWidget - QWidget -
airunner/widgets/deterministic/deterministic_widget
- 1 -
- - BatchWidget - QWidget -
airunner/widgets/batch/batch_widget
- 1 -
- - CanvasPlusWidget - QWidget -
airunner/widgets/canvas_plus/canvas_plus_widget
- 1 - - action_button_clicked_focus() - -
ActiveGridSettingsWidget QWidget @@ -2557,22 +2424,6 @@ - - actionKandinsky - triggered() - MainWindow - action_show_kandinsky() - - - -1 - -1 - - - 442 - 432 - - - actionStableDiffusion triggered() @@ -2589,22 +2440,6 @@ - - actionShap_E - triggered() - MainWindow - action_show_shape() - - - -1 - -1 - - - 442 - 432 - - - actionPrompt_Builder triggered() @@ -2861,22 +2696,6 @@ - - actionImage_Interpolation - triggered() - MainWindow - action_show_image_interpolation_triggered() - - - -1 - -1 - - - 442 - 432 - - - actionClear_all_prompts triggered() @@ -3069,22 +2888,6 @@ - - batches_tab - currentChanged(int) - MainWindow - batches_panel_tab_index_changed(int) - - - 922 - 731 - - - 49 - 0 - - - actionActive_Grid triggered() @@ -3653,7 +3456,6 @@ action_show_model_merger_window() action_show_kandinsky() action_show_stablediffusion() - action_show_shape() action_show_model_manager() action_show_prompt_builder() action_show_controlnet() diff --git a/src/airunner/windows/main/templates/main_window_ui.py b/src/airunner/windows/main/templates/main_window_ui.py index 11f28b829..793c73ef6 100644 --- a/src/airunner/windows/main/templates/main_window_ui.py +++ b/src/airunner/windows/main/templates/main_window_ui.py @@ -331,7 +331,7 @@ def setupUi(self, MainWindow): self.content_splitter = QtWidgets.QSplitter(parent=self.art) self.content_splitter.setOrientation(QtCore.Qt.Orientation.Horizontal) self.content_splitter.setObjectName("content_splitter") - self.generator_widget = GeneratorTabWidget(parent=self.content_splitter) + self.generator_widget = GeneratorForm(parent=self.content_splitter) self.generator_widget.setObjectName("generator_widget") self.center_splitter = QtWidgets.QSplitter(parent=self.content_splitter) self.center_splitter.setMinimumSize(QtCore.QSize(0, 0)) @@ -356,25 +356,14 @@ def setupUi(self, MainWindow): self.canvas_splitter = QtWidgets.QSplitter(parent=self.tab_image) self.canvas_splitter.setOrientation(QtCore.Qt.Orientation.Horizontal) self.canvas_splitter.setObjectName("canvas_splitter") - self.image_editor_tab_widget = QtWidgets.QTabWidget(parent=self.canvas_splitter) + self.image_editor_tab_widget = QtWidgets.QWidget(parent=self.canvas_splitter) self.image_editor_tab_widget.setObjectName("image_editor_tab_widget") - self.Standard = QtWidgets.QWidget() - self.Standard.setObjectName("Standard") - self.gridLayout_19 = QtWidgets.QGridLayout(self.Standard) + self.gridLayout_19 = QtWidgets.QGridLayout(self.image_editor_tab_widget) + self.gridLayout_19.setContentsMargins(0, 0, 0, 0) self.gridLayout_19.setObjectName("gridLayout_19") - self.standard_image_widget = StandardImageWidget(parent=self.Standard) + self.standard_image_widget = StandardImageWidget(parent=self.image_editor_tab_widget) self.standard_image_widget.setObjectName("standard_image_widget") self.gridLayout_19.addWidget(self.standard_image_widget, 0, 0, 1, 1) - self.image_editor_tab_widget.addTab(self.Standard, "") - self.Canvas = QtWidgets.QWidget() - self.Canvas.setObjectName("Canvas") - self.gridLayout_18 = QtWidgets.QGridLayout(self.Canvas) - self.gridLayout_18.setContentsMargins(0, 0, 0, 0) - self.gridLayout_18.setObjectName("gridLayout_18") - self.canvas_plus_widget = CanvasPlusWidget(parent=self.Canvas) - self.canvas_plus_widget.setObjectName("canvas_plus_widget") - self.gridLayout_18.addWidget(self.canvas_plus_widget, 0, 0, 1, 1) - self.image_editor_tab_widget.addTab(self.Canvas, "") self.image_browser = ImagePanelWidget(parent=self.canvas_splitter) self.image_browser.setObjectName("image_browser") self.gridLayout_10.addWidget(self.canvas_splitter, 0, 0, 1, 1) @@ -396,7 +385,7 @@ def setupUi(self, MainWindow): self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 427, 1012)) + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 365, 1017)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.gridLayout = QtWidgets.QGridLayout(self.scrollAreaWidgetContents) self.gridLayout.setObjectName("gridLayout") @@ -404,25 +393,8 @@ def setupUi(self, MainWindow): self.splitter.setOrientation(QtCore.Qt.Orientation.Vertical) self.splitter.setObjectName("splitter") self.tool_tab_widget = QtWidgets.QTabWidget(parent=self.splitter) + self.tool_tab_widget.setAcceptDrops(False) self.tool_tab_widget.setObjectName("tool_tab_widget") - self.tab_embeddings = QtWidgets.QWidget() - self.tab_embeddings.setObjectName("tab_embeddings") - self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_embeddings) - self.gridLayout_9.setContentsMargins(0, 0, 0, 0) - self.gridLayout_9.setObjectName("gridLayout_9") - self.embeddings_container_widget = EmbeddingsContainerWidget(parent=self.tab_embeddings) - self.embeddings_container_widget.setObjectName("embeddings_container_widget") - self.gridLayout_9.addWidget(self.embeddings_container_widget, 0, 0, 1, 1) - self.tool_tab_widget.addTab(self.tab_embeddings, "") - self.tab_lora = QtWidgets.QWidget() - self.tab_lora.setObjectName("tab_lora") - self.gridLayout_7 = QtWidgets.QGridLayout(self.tab_lora) - self.gridLayout_7.setContentsMargins(0, 0, 0, 0) - self.gridLayout_7.setObjectName("gridLayout_7") - self.lora_container_widget = LoraContainerWidget(parent=self.tab_lora) - self.lora_container_widget.setObjectName("lora_container_widget") - self.gridLayout_7.addWidget(self.lora_container_widget, 0, 0, 1, 1) - self.tool_tab_widget.addTab(self.tab_lora, "") self.tab_pen = QtWidgets.QWidget() self.tab_pen.setObjectName("tab_pen") self.gridLayout_8 = QtWidgets.QGridLayout(self.tab_pen) @@ -441,24 +413,6 @@ def setupUi(self, MainWindow): self.active_grid_settings_widget.setObjectName("active_grid_settings_widget") self.gridLayout_12.addWidget(self.active_grid_settings_widget, 0, 0, 1, 1) self.tool_tab_widget.addTab(self.tab_active_grid, "") - self.batches_tab = QtWidgets.QTabWidget(parent=self.splitter) - self.batches_tab.setObjectName("batches_tab") - self.tab_deterministic = QtWidgets.QWidget() - self.tab_deterministic.setObjectName("tab_deterministic") - self.gridLayout_13 = QtWidgets.QGridLayout(self.tab_deterministic) - self.gridLayout_13.setObjectName("gridLayout_13") - self.deterministic_widget = DeterministicWidget(parent=self.tab_deterministic) - self.deterministic_widget.setObjectName("deterministic_widget") - self.gridLayout_13.addWidget(self.deterministic_widget, 0, 0, 1, 1) - self.batches_tab.addTab(self.tab_deterministic, "") - self.tab_standard = QtWidgets.QWidget() - self.tab_standard.setObjectName("tab_standard") - self.gridLayout_14 = QtWidgets.QGridLayout(self.tab_standard) - self.gridLayout_14.setObjectName("gridLayout_14") - self.batch_container_widget = BatchWidget(parent=self.tab_standard) - self.batch_container_widget.setObjectName("batch_container_widget") - self.gridLayout_14.addWidget(self.batch_container_widget, 0, 0, 1, 1) - self.batches_tab.addTab(self.tab_standard, "") self.layer_frame = QtWidgets.QFrame(parent=self.splitter) self.layer_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) self.layer_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) @@ -908,14 +862,11 @@ def setupUi(self, MainWindow): self.menuAbout.addAction(self.actionBug_report) self.menuAbout.addAction(self.actionReport_vulnerability) self.menuAbout.addAction(self.actionDiscord) - self.menuModel_merge.addAction(self.actionImage_interpolation) self.menuModel_merge.addAction(self.actionModel_Merger) self.menuModel_merge.addSeparator() self.menuModel_merge.addAction(self.actionStableDiffusion) - self.menuModel_merge.addAction(self.actionKandinsky) self.menuModel_merge.addSeparator() self.menuModel_merge.addAction(self.actionPrompt_Builder) - self.menuModel_merge.addAction(self.actionControlNet) self.menuModel_merge.addAction(self.actionModel_Manager_2) self.menuModel_merge.addSeparator() self.menuModel_merge.addAction(self.actionEmbeddings) @@ -923,7 +874,6 @@ def setupUi(self, MainWindow): self.menuModel_merge.addAction(self.actionPen) self.menuModel_merge.addAction(self.actionActive_Grid) self.menuModel_merge.addSeparator() - self.menuModel_merge.addAction(self.actionDeterministic_Batches) self.menuModel_merge.addAction(self.actionStandard_Batches) self.menuModel_merge.addSeparator() self.menuModel_merge.addAction(self.actionLLM_beta) @@ -956,15 +906,11 @@ def setupUi(self, MainWindow): self.retranslateUi(MainWindow) self.mode_tab_widget.setCurrentIndex(0) self.center_tab.setCurrentIndex(0) - self.image_editor_tab_widget.setCurrentIndex(0) self.tool_tab_widget.setCurrentIndex(0) - self.batches_tab.setCurrentIndex(0) self.actionHuggingface_Cache_manager.triggered.connect(MainWindow.action_show_hf_cache_manager) # type: ignore self.actionModel_Merger.triggered.connect(MainWindow.action_show_model_merger_window) # type: ignore self.actionAbout.triggered.connect(MainWindow.action_show_about_window) # type: ignore - self.actionKandinsky.triggered.connect(MainWindow.action_show_kandinsky) # type: ignore self.actionStableDiffusion.triggered.connect(MainWindow.action_show_stablediffusion) # type: ignore - self.actionShap_E.triggered.connect(MainWindow.action_show_shape) # type: ignore self.actionPrompt_Builder.triggered.connect(MainWindow.action_show_prompt_builder) # type: ignore self.actionControlNet.triggered.connect(MainWindow.action_show_controlnet) # type: ignore self.actionEmbeddings.triggered.connect(MainWindow.action_show_embeddings) # type: ignore @@ -981,7 +927,6 @@ def setupUi(self, MainWindow): self.actionRotate_90_clockwise.triggered.connect(MainWindow.action_rotate_90_clockwise_triggered) # type: ignore self.actionRotate_90_counter_clockwise.triggered.connect(MainWindow.action_rotate_90_counterclockwise_triggered) # type: ignore self.actionPrompt_Browser.triggered.connect(MainWindow.action_show_prompt_browser_triggered) # type: ignore - self.actionImage_Interpolation.triggered.connect(MainWindow.action_show_image_interpolation_triggered) # type: ignore self.actionClear_all_prompts.triggered.connect(MainWindow.action_clear_all_prompts_triggered) # type: ignore self.actionSettings.triggered.connect(MainWindow.action_show_settings) # type: ignore self.actionBrowse_AI_Runner_Path.triggered.connect(MainWindow.action_triggered_browse_ai_runner_path) # type: ignore @@ -994,7 +939,6 @@ def setupUi(self, MainWindow): self.actionUpscale.triggered.connect(MainWindow.action_show_model_path_upscale) # type: ignore self.actionTxt2vid.triggered.connect(MainWindow.action_show_model_path_txt2vid) # type: ignore self.tool_tab_widget.currentChanged['int'].connect(MainWindow.tool_tab_index_changed) # type: ignore - self.batches_tab.currentChanged['int'].connect(MainWindow.batches_panel_tab_index_changed) # type: ignore self.actionActive_Grid.triggered.connect(MainWindow.action_show_active_grid) # type: ignore self.actionModel_Manager_2.triggered.connect(MainWindow.action_show_model_manager) # type: ignore self.actionDeterministic_Batches.triggered.connect(MainWindow.action_show_deterministic_batches) # type: ignore @@ -1046,17 +990,11 @@ def retranslateUi(self, MainWindow): self.export_button.setToolTip(_translate("MainWindow", "Export Image")) self.undo_button.setToolTip(_translate("MainWindow", "Undo")) self.redo_button.setToolTip(_translate("MainWindow", "Redo")) - self.image_editor_tab_widget.setTabText(self.image_editor_tab_widget.indexOf(self.Standard), _translate("MainWindow", "Standard")) - self.image_editor_tab_widget.setTabText(self.image_editor_tab_widget.indexOf(self.Canvas), _translate("MainWindow", "Canvas")) self.center_tab.setTabText(self.center_tab.indexOf(self.tab_image), _translate("MainWindow", "Canvas")) self.center_tab.setTabText(self.center_tab.indexOf(self.tab_txt2vid), _translate("MainWindow", "Video")) self.center_tab.setTabText(self.center_tab.indexOf(self.tab_prompt_builder), _translate("MainWindow", "Prompt Builder")) - self.tool_tab_widget.setTabText(self.tool_tab_widget.indexOf(self.tab_embeddings), _translate("MainWindow", "Embeddings")) - self.tool_tab_widget.setTabText(self.tool_tab_widget.indexOf(self.tab_lora), _translate("MainWindow", "LoRA")) self.tool_tab_widget.setTabText(self.tool_tab_widget.indexOf(self.tab_pen), _translate("MainWindow", "Pen")) self.tool_tab_widget.setTabText(self.tool_tab_widget.indexOf(self.tab_active_grid), _translate("MainWindow", "Active Grid")) - self.batches_tab.setTabText(self.batches_tab.indexOf(self.tab_deterministic), _translate("MainWindow", "Deterministic Batches")) - self.batches_tab.setTabText(self.batches_tab.indexOf(self.tab_standard), _translate("MainWindow", "Standard Batches")) self.toggle_active_grid_area_button.setToolTip(_translate("MainWindow", "Active grid area selection tool")) self.toggle_brush_button.setToolTip(_translate("MainWindow", "Pen tool")) self.toggle_eraser_button.setToolTip(_translate("MainWindow", "Eraser tool")) @@ -1194,16 +1132,11 @@ def retranslateUi(self, MainWindow): self.actionStandard_Batches.setText(_translate("MainWindow", "Standard Batches")) self.actionLLM_beta.setText(_translate("MainWindow", "LLM (beta)")) from airunner.widgets.active_grid_settings.active_grid_settings_widget import ActiveGridSettingsWidget -from airunner.widgets.batch.batch_widget import BatchWidget from airunner.widgets.brush.brush_container_widget import BrushContainerWidget -from airunner.widgets.canvas_plus.canvas_plus_widget import CanvasPlusWidget from airunner.widgets.canvas_plus.standard_image_widget import StandardImageWidget -from airunner.widgets.deterministic.deterministic_widget import DeterministicWidget -from airunner.widgets.embeddings.embeddings_container_widget import EmbeddingsContainerWidget -from airunner.widgets.generator_form.generator_tab_widget import GeneratorTabWidget +from airunner.widgets.generator_form.generator_form_widget import GeneratorForm from airunner.widgets.image.image_panel_widget import ImagePanelWidget from airunner.widgets.layers.layer_container_widget import LayerContainerWidget from airunner.widgets.llm.llm_widget import LLMWidget -from airunner.widgets.lora.lora_container_widget import LoraContainerWidget from airunner.widgets.model_manager.model_manager_widget import ModelManagerWidget from airunner.widgets.prompt_builder.prompt_builder_widget import PromptBuilderWidget