chat patch
This commit is contained in:
parent
1affc2f8d7
commit
86d5e03157
@ -7,6 +7,7 @@ from PySide6.QtWidgets import (
|
||||
)
|
||||
from PySide6.QtCore import Qt, QPropertyAnimation, QEasingCurve, QTimer
|
||||
from PySide6.QtGui import QColor
|
||||
from PySide6.QtWidgets import QLineEdit
|
||||
|
||||
from app.core.theme import theme_manager
|
||||
from app.core.dialogs import show_themed_messagebox
|
||||
@ -264,6 +265,13 @@ class YobbleHomeView(QWidget):
|
||||
top_bar_layout.addWidget(self.title_label)
|
||||
top_bar_layout.addStretch()
|
||||
|
||||
# Поле ввода для поиска (скрыто по умолчанию)
|
||||
self.search_input = QLineEdit()
|
||||
self.search_input.setObjectName("SearchInput")
|
||||
self.search_input.setPlaceholderText("Поиск…")
|
||||
self.search_input.hide()
|
||||
top_bar_layout.addWidget(self.search_input, 1)
|
||||
|
||||
# Новые кнопки справа
|
||||
self.search_button = QPushButton("🔍")
|
||||
self.search_button.setObjectName("SearchButton")
|
||||
@ -272,12 +280,27 @@ class YobbleHomeView(QWidget):
|
||||
top_bar_layout.addWidget(self.search_button)
|
||||
self.search_button.clicked.connect(self.handle_search_click)
|
||||
|
||||
# Кнопка закрытия режима поиска (скрыта по умолчанию)
|
||||
self.search_close_button = QPushButton("✕")
|
||||
self.search_close_button.setObjectName("SearchCloseButton")
|
||||
self.search_close_button.setFocusPolicy(Qt.NoFocus)
|
||||
self.search_close_button.setCursor(Qt.PointingHandCursor)
|
||||
self.search_close_button.hide()
|
||||
top_bar_layout.addWidget(self.search_close_button)
|
||||
self.search_close_button.clicked.connect(self.exit_search_mode)
|
||||
|
||||
self.notification_button = QPushButton("🔔")
|
||||
self.notification_button.setObjectName("NotificationButton")
|
||||
self.notification_button.setFocusPolicy(Qt.NoFocus)
|
||||
self.notification_button.setCursor(Qt.PointingHandCursor)
|
||||
top_bar_layout.addWidget(self.notification_button)
|
||||
self.notification_button.clicked.connect(self.handle_notification_click)
|
||||
# Иконки для кнопок (визуальная корректировка)
|
||||
try:
|
||||
self.search_button.setText("🔍")
|
||||
self.notification_button.setText("🔔")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return top_bar_widget
|
||||
|
||||
@ -616,6 +639,31 @@ class YobbleHomeView(QWidget):
|
||||
"🔍 Функция поиска пока в разработке."
|
||||
)
|
||||
|
||||
# Переопределяем обработчик поиска и добавляем режим поиска
|
||||
def handle_search_click(self):
|
||||
"""Включает режим поиска: показывает поле и крестик."""
|
||||
self.enter_search_mode()
|
||||
|
||||
def enter_search_mode(self):
|
||||
# Скрываем элементы, показываем поиск
|
||||
self.title_label.hide()
|
||||
self.search_button.hide()
|
||||
self.notification_button.hide()
|
||||
# Показываем поле ввода и кнопку закрытия
|
||||
self.search_input.show()
|
||||
self.search_close_button.show()
|
||||
self.search_input.setFocus()
|
||||
|
||||
def exit_search_mode(self):
|
||||
# Прячем поле поиска, очищаем
|
||||
self.search_input.clear()
|
||||
self.search_input.hide()
|
||||
self.search_close_button.hide()
|
||||
# Возвращаем элементы
|
||||
self.title_label.show()
|
||||
self.search_button.show()
|
||||
self.notification_button.show()
|
||||
|
||||
def handle_notification_click(self):
|
||||
"""Пустышка для кнопки уведомлений."""
|
||||
show_themed_messagebox(
|
||||
@ -718,6 +766,20 @@ class YobbleHomeView(QWidget):
|
||||
outline: none;
|
||||
background-color: transparent;
|
||||
}}
|
||||
#SearchInput {{
|
||||
border-radius: 8px;
|
||||
padding: 6px 10px;
|
||||
font-size: 14px;
|
||||
color: {title_color};
|
||||
background-color: {bar_bg_color};
|
||||
border: 1px solid {top_bar_border};
|
||||
}}
|
||||
#SearchCloseButton {{
|
||||
font-size: 18px;
|
||||
padding: 5px;
|
||||
color: {title_color};
|
||||
background: transparent;
|
||||
}}
|
||||
|
||||
/* Нижняя панель */
|
||||
#BottomBar {{
|
||||
|
||||
Reference in New Issue
Block a user