Feature/prompt translations #3

Merged
kromskii2 merged 5 commits from feature/prompt-translations into main 2025-03-14 13:23:17 +00:00
4 changed files with 69 additions and 38 deletions
Showing only changes of commit 02c7b9483b - Show all commits

No files matched your search

Binary file not shown.
+63 -32
View File
@@ -1,4 +1,4 @@
from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel
from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QFrame
from PyQt6.QtCore import Qt, pyqtSignal
from .size_presets import SIZE_PRESETS
@@ -11,51 +11,82 @@ class SizePresetManager(QWidget):
def setup_ui(self):
layout = QVBoxLayout(self)
layout.setSpacing(2)
# Заголовок
title = QLabel("Пресеты размеров:")
title = QLabel("Размеры:")
title.setStyleSheet("""
QLabel {
color: #ffffff;
font-size: 14px;
font-size: 12px;
font-weight: bold;
padding: 8px;
padding: 4px;
background-color: #3b3b3b;
border-radius: 4px;
}
""")
layout.addWidget(title)
# Создаем сетку кнопок
grid_layout = QHBoxLayout()
grid_layout.setSpacing(5)
# Создаем фрейм для кнопок
buttons_frame = QFrame()
buttons_frame.setStyleSheet("""
QFrame {
background-color: #2b2b2b;
border: 1px solid #3b3b3b;
border-radius: 4px;
padding: 2px;
}
""")
buttons_layout = QVBoxLayout(buttons_frame)
buttons_layout.setSpacing(2)
# Добавляем кнопки пресетов
for name, (width, height) in SIZE_PRESETS.items():
button = QPushButton(name)
button.setStyleSheet("""
QPushButton {
background-color: #3b3b3b;
color: white;
border: 1px solid #555555;
border-radius: 4px;
padding: 8px;
font-size: 12px;
min-width: 120px;
}
QPushButton:hover {
background-color: #4a4a4a;
border-color: #666666;
}
QPushButton:pressed {
background-color: #0d6efd;
border-color: #0b5ed7;
}
""")
button.clicked.connect(lambda checked, w=width, h=height: self.on_preset_clicked(w, h))
grid_layout.addWidget(button)
# Создаем две строки кнопок
row1_layout = QHBoxLayout()
row2_layout = QHBoxLayout()
layout.addLayout(grid_layout)
# Разделяем пресеты на две группы
presets = list(SIZE_PRESETS.items())
half = len(presets) // 2
# Добавляем кнопки в первую строку
for name, (width, height) in presets[:half]:
button = self.create_preset_button(name, width, height)
row1_layout.addWidget(button)
# Добавляем кнопки во вторую строку
for name, (width, height) in presets[half:]:
button = self.create_preset_button(name, width, height)
row2_layout.addWidget(button)
buttons_layout.addLayout(row1_layout)
buttons_layout.addLayout(row2_layout)
layout.addWidget(buttons_frame)
def create_preset_button(self, name, width, height):
"""Создание кнопки пресета с улучшенным дизайном"""
button = QPushButton(name)
button.setStyleSheet(f"""
QPushButton {{
background-color: #3b3b3b;
color: white;
border: 1px solid #555555;
border-radius: 4px;
padding: 4px;
font-size: 11px;
min-width: 80px;
text-align: center;
}}
QPushButton:hover {{
background-color: #4a4a4a;
border-color: #666666;
}}
QPushButton:pressed {{
background-color: #0d6efd;
border-color: #0b5ed7;
}}
""")
button.clicked.connect(lambda checked, w=width, h=height: self.on_preset_clicked(w, h))
return button
def on_preset_clicked(self, width, height):
"""Обработчик нажатия на кнопку пресета"""
+6 -6
View File
@@ -1,8 +1,8 @@
SIZE_PRESETS = {
"Портрет (512x768)": (512, 768),
"Пейзаж (768x512)": (768, 512),
"Квадрат (512x512)": (512, 512),
"Широкий (768x432)": (768, 432),
"Высокий (432x768)": (432, 768),
"Вертикальный (600x800)": (600, 800)
"512x768": (512, 768),
"768x512": (768, 512),
"512x512": (512, 512),
"768x432": (768, 432),
"432x768": (432, 768),
"600x800": (600, 800)
}