Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36db738601 | ||
|
|
18dfe41e39 | ||
|
|
df447a1ecf | ||
|
|
01395a5aa4 | ||
|
|
74dd9824f3 | ||
|
|
11d03556da | ||
|
|
828f3c6c12 |
No files matched your search
+174
@@ -0,0 +1,174 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# UV
|
||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
#uv.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
||||
.pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
# Ruff stuff:
|
||||
.ruff_cache/
|
||||
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
@@ -6,9 +6,9 @@ from time import sleep
|
||||
from PyQt6.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout,
|
||||
QHBoxLayout, QLabel, QLineEdit, QPushButton,
|
||||
QComboBox, QSpinBox, QDoubleSpinBox, QProgressBar,
|
||||
QScrollArea, QTextEdit, QFileDialog)
|
||||
QScrollArea, QTextEdit, QFileDialog, QMenuBar, QMenu)
|
||||
from PyQt6.QtCore import Qt, QThread, pyqtSignal, QTimer
|
||||
from PyQt6.QtGui import QPixmap, QImage
|
||||
from PyQt6.QtGui import QPixmap, QImage, QAction
|
||||
from PIL import Image
|
||||
from io import BytesIO
|
||||
|
||||
@@ -19,6 +19,7 @@ from modules.sampler_manager import SamplerManager
|
||||
from modules.prompt_window import PromptWindow
|
||||
from modules.negative_prompt_window import NegativePromptWindow
|
||||
from modules.size_preset_manager import SizePresetManager
|
||||
from modules.settings_menu import SettingsMenu
|
||||
|
||||
class GenerationThread(QThread):
|
||||
progress_updated = pyqtSignal(float, str)
|
||||
@@ -68,8 +69,42 @@ class MainWindow(QMainWindow):
|
||||
self.prompt_window = None
|
||||
self.negative_prompt_window = None
|
||||
self.progress_timer = None
|
||||
|
||||
# Создаем меню бар
|
||||
self.create_menu_bar()
|
||||
|
||||
self.init_ui()
|
||||
|
||||
def create_menu_bar(self):
|
||||
"""Создание меню бара с настройками"""
|
||||
menubar = QMenuBar(self)
|
||||
menubar.setStyleSheet("""
|
||||
QMenuBar {
|
||||
background-color: #2b2b2b;
|
||||
color: #ffffff;
|
||||
border-bottom: 1px solid #3b3b3b;
|
||||
padding: 2px;
|
||||
}
|
||||
QMenuBar::item {
|
||||
background-color: transparent;
|
||||
padding: 8px 12px;
|
||||
margin: 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
QMenuBar::item:selected {
|
||||
background-color: #3b3b3b;
|
||||
}
|
||||
QMenuBar::item:pressed {
|
||||
background-color: #404040;
|
||||
}
|
||||
""")
|
||||
|
||||
# Добавляем меню настроек
|
||||
settings_menu = SettingsMenu(self)
|
||||
menubar.addMenu(settings_menu)
|
||||
|
||||
self.setMenuBar(menubar)
|
||||
|
||||
def init_ui(self):
|
||||
self.setWindowTitle("Stable Diffusion UI")
|
||||
self.setStyleSheet("""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+26
-19
@@ -17,36 +17,42 @@ class ConsoleWindow(QDialog):
|
||||
def setup_ui(self):
|
||||
self.setStyleSheet("""
|
||||
QDialog {
|
||||
background-color: #2b2b2b;
|
||||
min-width: 600px;
|
||||
min-height: 400px;
|
||||
background-color: #1e1e1e;
|
||||
min-width: 700px;
|
||||
min-height: 500px;
|
||||
}
|
||||
QTextEdit {
|
||||
background-color: #1e1e1e;
|
||||
color: #ffffff;
|
||||
border: 1px solid #3b3b3b;
|
||||
border-radius: 4px;
|
||||
font-family: 'Consolas', 'Courier New', monospace;
|
||||
font-size: 12px;
|
||||
padding: 8px;
|
||||
background-color: #252526;
|
||||
color: #d4d4d4;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
|
||||
font-size: 13px;
|
||||
padding: 12px;
|
||||
selection-background-color: #264f78;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #0d6efd;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: #2d2d2d;
|
||||
color: #d4d4d4;
|
||||
border: 1px solid #3e3e3e;
|
||||
border-radius: 6px;
|
||||
padding: 8px 16px;
|
||||
font-weight: bold;
|
||||
font-weight: 500;
|
||||
min-width: 100px;
|
||||
margin: 4px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #0b5ed7;
|
||||
background-color: #3e3e3e;
|
||||
border-color: #565656;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #0a58ca;
|
||||
background-color: #565656;
|
||||
}
|
||||
""")
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(16, 16, 16, 16)
|
||||
layout.setSpacing(12)
|
||||
|
||||
# Область для логов
|
||||
self.console_output = QTextEdit()
|
||||
@@ -55,11 +61,12 @@ class ConsoleWindow(QDialog):
|
||||
|
||||
# Кнопки управления
|
||||
buttons_layout = QHBoxLayout()
|
||||
buttons_layout.setSpacing(8)
|
||||
|
||||
copy_button = QPushButton("Копировать всё")
|
||||
copy_button = QPushButton("📋 Копировать")
|
||||
copy_button.clicked.connect(self.copy_all)
|
||||
|
||||
clear_button = QPushButton("Очистить")
|
||||
clear_button = QPushButton("🗑️ Очистить")
|
||||
clear_button.clicked.connect(self.clear_console)
|
||||
|
||||
buttons_layout.addWidget(copy_button)
|
||||
|
||||
@@ -13,8 +13,65 @@ class ModelManager(QWidget):
|
||||
self.load_models()
|
||||
|
||||
def setup_ui(self):
|
||||
self.setStyleSheet("""
|
||||
QWidget {
|
||||
background-color: transparent;
|
||||
}
|
||||
QLabel {
|
||||
color: #d4d4d4;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
margin-right: 8px;
|
||||
}
|
||||
QComboBox {
|
||||
background-color: #252526;
|
||||
color: #d4d4d4;
|
||||
border: 1px solid #3e3e3e;
|
||||
border-radius: 6px;
|
||||
padding: 6px 12px;
|
||||
min-width: 200px;
|
||||
font-size: 13px;
|
||||
}
|
||||
QComboBox:hover {
|
||||
border-color: #565656;
|
||||
}
|
||||
QComboBox:focus {
|
||||
border-color: #007acc;
|
||||
}
|
||||
QComboBox::drop-down {
|
||||
border: none;
|
||||
width: 20px;
|
||||
}
|
||||
QComboBox::down-arrow {
|
||||
image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTggMTFMNCBTTDEyIDUiIHN0cm9rZT0iI2Q0ZDRkNCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+);
|
||||
}
|
||||
QComboBox QAbstractItemView {
|
||||
background-color: #252526;
|
||||
color: #d4d4d4;
|
||||
border: 1px solid #3e3e3e;
|
||||
selection-background-color: #094771;
|
||||
outline: none;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #2d2d2d;
|
||||
color: #d4d4d4;
|
||||
border: 1px solid #3e3e3e;
|
||||
border-radius: 6px;
|
||||
padding: 6px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #3e3e3e;
|
||||
border-color: #565656;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #565656;
|
||||
}
|
||||
""")
|
||||
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(8)
|
||||
|
||||
# Метка
|
||||
label = QLabel("Модель:")
|
||||
@@ -22,11 +79,13 @@ class ModelManager(QWidget):
|
||||
|
||||
# Выпадающий список моделей
|
||||
self.model_combo = QComboBox()
|
||||
self.model_combo.setFixedHeight(32)
|
||||
self.model_combo.currentTextChanged.connect(self.on_model_changed)
|
||||
layout.addWidget(self.model_combo)
|
||||
|
||||
# Кнопка обновления
|
||||
refresh_button = QPushButton("🔄")
|
||||
refresh_button.setFixedSize(32, 32)
|
||||
refresh_button.setToolTip("Обновить список моделей")
|
||||
refresh_button.clicked.connect(self.load_models)
|
||||
layout.addWidget(refresh_button)
|
||||
|
||||
+66
-44
@@ -19,87 +19,105 @@ class PromptWindow(QDialog):
|
||||
def setup_ui(self):
|
||||
self.setStyleSheet("""
|
||||
QDialog {
|
||||
background-color: #2b2b2b;
|
||||
min-width: 1500px;
|
||||
min-height: 700px;
|
||||
background-color: #1e1e1e;
|
||||
min-width: 1200px;
|
||||
min-height: 800px;
|
||||
}
|
||||
QScrollArea {
|
||||
background-color: #1e1e1e;
|
||||
border: 1px solid #3b3b3b;
|
||||
border-radius: 4px;
|
||||
padding: 8px;
|
||||
background-color: #252526;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
}
|
||||
QScrollArea > QWidget > QWidget {
|
||||
background-color: #1e1e1e;
|
||||
background-color: #252526;
|
||||
}
|
||||
QLabel {
|
||||
color: #ffffff;
|
||||
color: #d4d4d4;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
padding: 8px;
|
||||
background-color: #3b3b3b;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
padding: 12px;
|
||||
background-color: #2d2d2d;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
QCheckBox {
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
padding: 4px;
|
||||
color: #d4d4d4;
|
||||
font-size: 13px;
|
||||
padding: 6px;
|
||||
spacing: 8px;
|
||||
}
|
||||
QCheckBox:hover {
|
||||
background-color: #2d2d2d;
|
||||
border-radius: 4px;
|
||||
}
|
||||
QCheckBox::indicator {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
QCheckBox::indicator:unchecked {
|
||||
border: 2px solid #555555;
|
||||
background-color: #3b3b3b;
|
||||
border-radius: 3px;
|
||||
border: 2px solid #565656;
|
||||
background-color: #252526;
|
||||
}
|
||||
QCheckBox::indicator:checked {
|
||||
border: 2px solid #0d6efd;
|
||||
background-color: #0d6efd;
|
||||
border-radius: 3px;
|
||||
border: 2px solid #007acc;
|
||||
background-color: #007acc;
|
||||
}
|
||||
QCheckBox::indicator:hover {
|
||||
border-color: #0b5ed7;
|
||||
border-color: #007acc;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #0d6efd;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: #2d2d2d;
|
||||
color: #d4d4d4;
|
||||
border: 1px solid #3e3e3e;
|
||||
border-radius: 6px;
|
||||
padding: 8px 16px;
|
||||
font-weight: bold;
|
||||
font-weight: 500;
|
||||
min-width: 120px;
|
||||
font-size: 13px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #0b5ed7;
|
||||
background-color: #3e3e3e;
|
||||
border-color: #565656;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #0a58ca;
|
||||
background-color: #565656;
|
||||
}
|
||||
QLineEdit {
|
||||
background-color: #3b3b3b;
|
||||
color: white;
|
||||
border: 1px solid #555555;
|
||||
border-radius: 4px;
|
||||
padding: 8px;
|
||||
font-size: 14px;
|
||||
min-height: 24px;
|
||||
background-color: #252526;
|
||||
color: #d4d4d4;
|
||||
border: 1px solid #3e3e3e;
|
||||
border-radius: 6px;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
min-height: 32px;
|
||||
}
|
||||
QLineEdit:focus {
|
||||
border-color: #007acc;
|
||||
}
|
||||
QFrame {
|
||||
background-color: #1e1e1e;
|
||||
border: 1px solid #3b3b3b;
|
||||
border-radius: 4px;
|
||||
background-color: #252526;
|
||||
border: 1px solid #3e3e3e;
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
margin: 4px;
|
||||
}
|
||||
QFrame:hover {
|
||||
border-color: #565656;
|
||||
}
|
||||
""")
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(16, 16, 16, 16)
|
||||
layout.setSpacing(12)
|
||||
|
||||
# Поиск
|
||||
search_layout = QHBoxLayout()
|
||||
search_label = QLabel("Поиск:")
|
||||
search_layout.setSpacing(8)
|
||||
search_label = QLabel("🔍 Поиск:")
|
||||
search_label.setStyleSheet("background: transparent; padding: 0;")
|
||||
self.search_input = QLineEdit()
|
||||
self.search_input.setPlaceholderText("Введите текст для поиска...")
|
||||
self.search_input.textChanged.connect(self.filter_prompts)
|
||||
search_layout.addWidget(search_label)
|
||||
search_layout.addWidget(self.search_input)
|
||||
@@ -110,22 +128,26 @@ class PromptWindow(QDialog):
|
||||
categories_scroll.setWidgetResizable(True)
|
||||
categories_scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOn)
|
||||
categories_scroll.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
categories_scroll.setMinimumHeight(600)
|
||||
|
||||
categories_widget = QWidget()
|
||||
self.categories_layout = QHBoxLayout(categories_widget)
|
||||
self.categories_layout.setSpacing(10)
|
||||
self.categories_layout.setSpacing(12)
|
||||
self.categories_layout.setContentsMargins(12, 12, 12, 12)
|
||||
categories_scroll.setWidget(categories_widget)
|
||||
|
||||
layout.addWidget(categories_scroll)
|
||||
|
||||
# Кнопки
|
||||
buttons_layout = QHBoxLayout()
|
||||
add_button = QPushButton("Добавить выбранные")
|
||||
buttons_layout.setSpacing(8)
|
||||
add_button = QPushButton("✨ Добавить выбранные")
|
||||
add_button.clicked.connect(self.add_selected)
|
||||
close_button = QPushButton("Закрыть")
|
||||
close_button = QPushButton("❌ Закрыть")
|
||||
close_button.clicked.connect(self.close)
|
||||
buttons_layout.addWidget(add_button)
|
||||
buttons_layout.addWidget(close_button)
|
||||
buttons_layout.addStretch()
|
||||
layout.addLayout(buttons_layout)
|
||||
|
||||
def load_categories(self):
|
||||
|
||||
@@ -13,8 +13,50 @@ class SamplerManager(QWidget):
|
||||
self.load_samplers()
|
||||
|
||||
def setup_ui(self):
|
||||
self.setStyleSheet("""
|
||||
QWidget {
|
||||
background-color: transparent;
|
||||
}
|
||||
QLabel {
|
||||
color: #d4d4d4;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
margin-right: 8px;
|
||||
}
|
||||
QComboBox {
|
||||
background-color: #252526;
|
||||
color: #d4d4d4;
|
||||
border: 1px solid #3e3e3e;
|
||||
border-radius: 6px;
|
||||
padding: 6px 12px;
|
||||
min-width: 180px;
|
||||
font-size: 13px;
|
||||
}
|
||||
QComboBox:hover {
|
||||
border-color: #565656;
|
||||
}
|
||||
QComboBox:focus {
|
||||
border-color: #007acc;
|
||||
}
|
||||
QComboBox::drop-down {
|
||||
border: none;
|
||||
width: 20px;
|
||||
}
|
||||
QComboBox::down-arrow {
|
||||
image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTggMTFMNCBTTDEyIDUiIHN0cm9rZT0iI2Q0ZDRkNCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+);
|
||||
}
|
||||
QComboBox QAbstractItemView {
|
||||
background-color: #252526;
|
||||
color: #d4d4d4;
|
||||
border: 1px solid #3e3e3e;
|
||||
selection-background-color: #094771;
|
||||
outline: none;
|
||||
}
|
||||
""")
|
||||
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(8)
|
||||
|
||||
# Метка
|
||||
label = QLabel("Сэмплер:")
|
||||
@@ -22,6 +64,7 @@ class SamplerManager(QWidget):
|
||||
|
||||
# Выпадающий список сэмплеров
|
||||
self.sampler_combo = QComboBox()
|
||||
self.sampler_combo.setFixedHeight(32)
|
||||
self.sampler_combo.currentTextChanged.connect(self.on_sampler_changed)
|
||||
layout.addWidget(self.sampler_combo)
|
||||
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
from PyQt6.QtWidgets import (QMenu,
|
||||
QDialog, QVBoxLayout, QHBoxLayout,
|
||||
QLabel, QLineEdit, QCheckBox,
|
||||
QPushButton, QComboBox, QSpinBox)
|
||||
from PyQt6.QtGui import QIcon, QAction, QActionGroup
|
||||
from PyQt6.QtCore import Qt
|
||||
|
||||
class SettingsMenu(QMenu):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__("⚙️ Настройки", parent)
|
||||
self.setStyleSheet("""
|
||||
QMenu {
|
||||
background-color: #2b2b2b;
|
||||
border: 1px solid #3b3b3b;
|
||||
border-radius: 8px;
|
||||
padding: 5px;
|
||||
}
|
||||
QMenu::item {
|
||||
background-color: transparent;
|
||||
padding: 8px 25px;
|
||||
margin: 2px;
|
||||
border-radius: 4px;
|
||||
color: #ffffff;
|
||||
font-size: 13px;
|
||||
}
|
||||
QMenu::item:selected {
|
||||
background-color: #3b3b3b;
|
||||
}
|
||||
QMenu::separator {
|
||||
height: 1px;
|
||||
background-color: #3b3b3b;
|
||||
margin: 5px 15px;
|
||||
}
|
||||
""")
|
||||
self.setup_menu()
|
||||
|
||||
def setup_menu(self):
|
||||
# API настройки
|
||||
api_action = QAction("🌐 API настройки", self)
|
||||
api_action.triggered.connect(self.show_api_settings)
|
||||
|
||||
# Настройки интерфейса
|
||||
ui_action = QAction("🎨 Настройки интерфейса", self)
|
||||
ui_action.triggered.connect(self.show_ui_settings)
|
||||
|
||||
# Настройки генерации
|
||||
generation_action = QAction("⚡ Настройки генерации", self)
|
||||
generation_action.triggered.connect(self.show_generation_settings)
|
||||
|
||||
# Горячие клавиши
|
||||
hotkeys_action = QAction("⌨️ Горячие клавиши", self)
|
||||
hotkeys_action.triggered.connect(self.show_hotkeys_settings)
|
||||
|
||||
# Добавляем действия в меню
|
||||
self.addAction(api_action)
|
||||
self.addAction(ui_action)
|
||||
self.addAction(generation_action)
|
||||
self.addSeparator()
|
||||
self.addAction(hotkeys_action)
|
||||
|
||||
def show_api_settings(self):
|
||||
dialog = APISettingsDialog(self.parent())
|
||||
dialog.exec()
|
||||
|
||||
def show_ui_settings(self):
|
||||
dialog = UISettingsDialog(self.parent())
|
||||
dialog.exec()
|
||||
|
||||
def show_generation_settings(self):
|
||||
dialog = GenerationSettingsDialog(self.parent())
|
||||
dialog.exec()
|
||||
|
||||
def show_hotkeys_settings(self):
|
||||
dialog = HotkeysSettingsDialog(self.parent())
|
||||
dialog.exec()
|
||||
|
||||
class BaseSettingsDialog(QDialog):
|
||||
def __init__(self, title, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle(title)
|
||||
self.setup_base_ui()
|
||||
|
||||
def setup_base_ui(self):
|
||||
self.setStyleSheet("""
|
||||
QDialog {
|
||||
background-color: #2b2b2b;
|
||||
min-width: 400px;
|
||||
}
|
||||
QLabel {
|
||||
color: #ffffff;
|
||||
font-size: 13px;
|
||||
}
|
||||
QLineEdit, QComboBox, QSpinBox {
|
||||
background-color: #3b3b3b;
|
||||
border: 1px solid #555555;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
color: #ffffff;
|
||||
min-width: 200px;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #0d6efd;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 8px 16px;
|
||||
font-weight: bold;
|
||||
min-width: 100px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #0b5ed7;
|
||||
}
|
||||
QCheckBox {
|
||||
color: #ffffff;
|
||||
}
|
||||
""")
|
||||
|
||||
self.layout = QVBoxLayout(self)
|
||||
self.layout.setSpacing(15)
|
||||
self.layout.setContentsMargins(20, 20, 20, 20)
|
||||
|
||||
class APISettingsDialog(BaseSettingsDialog):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__("🌐 API настройки", parent)
|
||||
self.setup_ui()
|
||||
|
||||
def setup_ui(self):
|
||||
# API URL
|
||||
url_layout = QHBoxLayout()
|
||||
url_label = QLabel("API URL:")
|
||||
self.url_input = QLineEdit(self.parent().api_url_input.text())
|
||||
url_layout.addWidget(url_label)
|
||||
url_layout.addWidget(self.url_input)
|
||||
self.layout.addLayout(url_layout)
|
||||
|
||||
# Кнопки
|
||||
buttons_layout = QHBoxLayout()
|
||||
save_button = QPushButton("Сохранить")
|
||||
save_button.clicked.connect(self.save_settings)
|
||||
cancel_button = QPushButton("Отмена")
|
||||
cancel_button.clicked.connect(self.reject)
|
||||
buttons_layout.addWidget(save_button)
|
||||
buttons_layout.addWidget(cancel_button)
|
||||
self.layout.addLayout(buttons_layout)
|
||||
|
||||
def save_settings(self):
|
||||
self.parent().api_url_input.setText(self.url_input.text())
|
||||
self.accept()
|
||||
|
||||
class UISettingsDialog(BaseSettingsDialog):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__("🎨 Настройки интерфейса", parent)
|
||||
self.setup_ui()
|
||||
|
||||
def setup_ui(self):
|
||||
# Тема
|
||||
theme_layout = QHBoxLayout()
|
||||
theme_label = QLabel("Тема:")
|
||||
self.theme_combo = QComboBox()
|
||||
self.theme_combo.addItems(["Тёмная", "Светлая"])
|
||||
theme_layout.addWidget(theme_label)
|
||||
theme_layout.addWidget(self.theme_combo)
|
||||
self.layout.addLayout(theme_layout)
|
||||
|
||||
# Размер шрифта
|
||||
font_layout = QHBoxLayout()
|
||||
font_label = QLabel("Размер шрифта:")
|
||||
self.font_spin = QSpinBox()
|
||||
self.font_spin.setRange(8, 24)
|
||||
self.font_spin.setValue(14)
|
||||
font_layout.addWidget(font_label)
|
||||
font_layout.addWidget(self.font_spin)
|
||||
self.layout.addLayout(font_layout)
|
||||
|
||||
# Кнопки
|
||||
buttons_layout = QHBoxLayout()
|
||||
save_button = QPushButton("Сохранить")
|
||||
save_button.clicked.connect(self.save_settings)
|
||||
cancel_button = QPushButton("Отмена")
|
||||
cancel_button.clicked.connect(self.reject)
|
||||
buttons_layout.addWidget(save_button)
|
||||
buttons_layout.addWidget(cancel_button)
|
||||
self.layout.addLayout(buttons_layout)
|
||||
|
||||
def save_settings(self):
|
||||
# TODO: Применить настройки интерфейса
|
||||
self.accept()
|
||||
|
||||
class GenerationSettingsDialog(BaseSettingsDialog):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__("⚡ Настройки генерации", parent)
|
||||
self.setup_ui()
|
||||
|
||||
def setup_ui(self):
|
||||
# Качество по умолчанию
|
||||
quality_layout = QHBoxLayout()
|
||||
quality_label = QLabel("Качество по умолчанию:")
|
||||
self.quality_combo = QComboBox()
|
||||
self.quality_combo.addItems(["Низкое", "Среднее", "Высокое"])
|
||||
quality_layout.addWidget(quality_label)
|
||||
quality_layout.addWidget(self.quality_combo)
|
||||
self.layout.addLayout(quality_layout)
|
||||
|
||||
# Размер по умолчанию
|
||||
size_layout = QHBoxLayout()
|
||||
size_label = QLabel("Размер по умолчанию:")
|
||||
self.size_combo = QComboBox()
|
||||
self.size_combo.addItems(["512x512", "768x512", "512x768"])
|
||||
size_layout.addWidget(size_label)
|
||||
size_layout.addWidget(self.size_combo)
|
||||
self.layout.addLayout(size_layout)
|
||||
|
||||
# Кнопки
|
||||
buttons_layout = QHBoxLayout()
|
||||
save_button = QPushButton("Сохранить")
|
||||
save_button.clicked.connect(self.save_settings)
|
||||
cancel_button = QPushButton("Отмена")
|
||||
cancel_button.clicked.connect(self.reject)
|
||||
buttons_layout.addWidget(save_button)
|
||||
buttons_layout.addWidget(cancel_button)
|
||||
self.layout.addLayout(buttons_layout)
|
||||
|
||||
def save_settings(self):
|
||||
# TODO: Применить настройки генерации
|
||||
self.accept()
|
||||
|
||||
class HotkeysSettingsDialog(BaseSettingsDialog):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__("⌨️ Горячие клавиши", parent)
|
||||
self.setup_ui()
|
||||
|
||||
def setup_ui(self):
|
||||
# Генерация
|
||||
generate_layout = QHBoxLayout()
|
||||
generate_label = QLabel("Генерация:")
|
||||
self.generate_input = QLineEdit("Ctrl+G")
|
||||
generate_layout.addWidget(generate_label)
|
||||
generate_layout.addWidget(self.generate_input)
|
||||
self.layout.addLayout(generate_layout)
|
||||
|
||||
# Открыть консоль
|
||||
console_layout = QHBoxLayout()
|
||||
console_label = QLabel("Открыть консоль:")
|
||||
self.console_input = QLineEdit("Ctrl+`")
|
||||
console_layout.addWidget(console_label)
|
||||
console_layout.addWidget(self.console_input)
|
||||
self.layout.addLayout(console_layout)
|
||||
|
||||
# Кнопки
|
||||
buttons_layout = QHBoxLayout()
|
||||
save_button = QPushButton("Сохранить")
|
||||
save_button.clicked.connect(self.save_settings)
|
||||
cancel_button = QPushButton("Отмена")
|
||||
cancel_button.clicked.connect(self.reject)
|
||||
buttons_layout.addWidget(save_button)
|
||||
buttons_layout.addWidget(cancel_button)
|
||||
self.layout.addLayout(buttons_layout)
|
||||
|
||||
def save_settings(self):
|
||||
# TODO: Применить настройки горячих клавиш
|
||||
self.accept()
|
||||
Reference in new issue
Block a user