42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
# src/utils/window_utils.py
|
|
from PyQt5.QtWidgets import QDialog, QMessageBox, QInputDialog
|
|
from PyQt5.QtCore import Qt
|
|
|
|
def show_floating_dialog(parent, title, message, icon=QMessageBox.Information):
|
|
"""Показывает диалоговое окно как плавающее поверх всех окон"""
|
|
dialog = QMessageBox(parent)
|
|
dialog.setWindowTitle(title)
|
|
dialog.setText(message)
|
|
dialog.setIcon(icon)
|
|
|
|
# Устанавливаем флаги для плавающего окна
|
|
dialog.setWindowFlags(
|
|
Qt.Window |
|
|
Qt.CustomizeWindowHint |
|
|
Qt.WindowTitleHint |
|
|
Qt.WindowStaysOnTopHint
|
|
)
|
|
|
|
# Отключаем тайлинг для этого окна
|
|
dialog.setProperty("hyprland_floating", True)
|
|
|
|
return dialog.exec_()
|
|
|
|
def create_floating_input(parent, title, label):
|
|
"""Создает плавающее окно ввода"""
|
|
dialog = QInputDialog(parent)
|
|
dialog.setWindowTitle(title)
|
|
dialog.setLabelText(label)
|
|
|
|
# Устанавливаем флаги для плавающего окна
|
|
dialog.setWindowFlags(
|
|
Qt.Window |
|
|
Qt.CustomizeWindowHint |
|
|
Qt.WindowTitleHint |
|
|
Qt.WindowStaysOnTopHint
|
|
)
|
|
|
|
# Отключаем тайлинг для этого окна
|
|
dialog.setProperty("hyprland_floating", True)
|
|
|
|
return dialog |