/
Ruden161
/
player
Обзор
Документация
Войти
/
Ruden161
/
player
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/ui/dialogs.py
61 строка
2 KB
Ruden161
Проводник видео, горячие клавиши, YouTube-style панель
01 мар 2026, 19:16
01 мар 2026, 19:16
816ee8b
Код
Авторство
О чём код?
""" Диалоговые окна приложения """ from PyQt6.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QTextEdit, QPushButton, QDialogButtonBox from PyQt6.QtCore import Qt class AddTimecodeDialog(QDialog): """Диалог добавления таймкода""" def __init__(self, time: float, parent=None): super().__init__(parent) self.time = time self._init_ui() def _init_ui(self): """Инициализация интерфейса""" self.setWindowTitle("Добавить таймкод") self.setModal(True) self.resize(400, 300) layout = QVBoxLayout(self) # Название таймкода name_label = QLabel("Название таймкода:") self.name_edit = QLineEdit() self.name_edit.setPlaceholderText("Введите название таймкода") # Описание таймкода description_label = QLabel("Описание таймкода:") self.description_edit = QTextEdit() self.description_edit.setPlaceholderText("Введите описание таймкода") self.description_edit.setMaximumHeight(100) # Время таймкода time_label = QLabel(f"Время: {self._format_time(self.time)}") # Кнопки button_box = QDialogButtonBox( QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel ) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) # Добавляем виджеты в layout layout.addWidget(name_label) layout.addWidget(self.name_edit) layout.addWidget(description_label) layout.addWidget(self.description_edit) layout.addWidget(time_label) layout.addWidget(button_box) # Устанавливаем фокус на поле названия self.name_edit.setFocus() def _format_time(self, time: float) -> str: """Форматировать время в строку""" minutes = int(time // 60) seconds = int(time % 60) milliseconds = int((time % 1) * 1000) return f"{minutes:02d}:{seconds:02d}.{milliseconds:03d}"