Улучшен дизайн кнопок SpinBox: добавлены современные стили, улучшена визуальная обратная связь, добавлены SVG иконки, оптимизированы размеры и отступы, улучшена читаемость значени
This commit is contained in:
1 parent
2b9165771b
commit
29dce906c5
6110 files changed
+775979
No files matched your search
@@ -0,0 +1,93 @@
|
||||
from PyQt6.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout,
|
||||
QTextEdit, QPushButton, QDialog)
|
||||
from PyQt6.QtCore import Qt, pyqtSignal
|
||||
from PyQt6.QtGui import QClipboard, QTextCursor
|
||||
from PyQt6.QtWidgets import QApplication
|
||||
|
||||
class ConsoleWindow(QDialog):
|
||||
console_closed = pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle("Консоль")
|
||||
self.setModal(False)
|
||||
self.setup_ui()
|
||||
self.log_messages = []
|
||||
|
||||
def setup_ui(self):
|
||||
self.setStyleSheet("""
|
||||
QDialog {
|
||||
background-color: #2b2b2b;
|
||||
min-width: 600px;
|
||||
min-height: 400px;
|
||||
}
|
||||
QTextEdit {
|
||||
background-color: #1e1e1e;
|
||||
color: #ffffff;
|
||||
border: 1px solid #3b3b3b;
|
||||
border-radius: 4px;
|
||||
font-family: 'Consolas', 'Courier New', monospace;
|
||||
font-size: 12px;
|
||||
padding: 8px;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #0d6efd;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 8px 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #0b5ed7;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #0a58ca;
|
||||
}
|
||||
""")
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
# Область для логов
|
||||
self.console_output = QTextEdit()
|
||||
self.console_output.setReadOnly(True)
|
||||
layout.addWidget(self.console_output)
|
||||
|
||||
# Кнопки управления
|
||||
buttons_layout = QHBoxLayout()
|
||||
|
||||
copy_button = QPushButton("Копировать всё")
|
||||
copy_button.clicked.connect(self.copy_all)
|
||||
|
||||
clear_button = QPushButton("Очистить")
|
||||
clear_button.clicked.connect(self.clear_console)
|
||||
|
||||
buttons_layout.addWidget(copy_button)
|
||||
buttons_layout.addWidget(clear_button)
|
||||
buttons_layout.addStretch()
|
||||
|
||||
layout.addLayout(buttons_layout)
|
||||
|
||||
def log(self, message):
|
||||
"""Добавить сообщение в консоль"""
|
||||
self.log_messages.append(message)
|
||||
self.console_output.append(message)
|
||||
# Прокрутка к последнему сообщению
|
||||
cursor = self.console_output.textCursor()
|
||||
cursor.movePosition(QTextCursor.MoveOperation.End)
|
||||
self.console_output.setTextCursor(cursor)
|
||||
|
||||
def copy_all(self):
|
||||
"""Копировать весь текст в буфер обмена"""
|
||||
clipboard = QApplication.clipboard()
|
||||
clipboard.setText(self.console_output.toPlainText())
|
||||
|
||||
def clear_console(self):
|
||||
"""Очистить консоль"""
|
||||
self.console_output.clear()
|
||||
self.log_messages.clear()
|
||||
|
||||
def closeEvent(self, event):
|
||||
"""Обработка закрытия окна"""
|
||||
self.console_closed.emit()
|
||||
event.accept()
|
||||
Reference in new issue
Block a user