This commit is contained in:
Your Name
2026-08-22 08:51:35 +08:00
parent 6c444a4a04
commit c06d293424
69 changed files with 11431 additions and 1601 deletions
+20 -31
View File
@@ -40,7 +40,9 @@ from PySide6.QtWidgets import (
QWidget,
)
from .theme import crisp_pixmap
from .dialogs.ai_consult import can_open_ai_consult
from .dialogs.ai_consult_picker import select_and_present_ai_consult
from .dialogs.local_audio_queue import LocalAudioQueueDialog
from .pages import (
AppointmentsPage,
@@ -109,8 +111,10 @@ class NavigationItem:
NAVIGATION = (
NavigationItem(
# 挂号与诊单是两条独立队列,早期两项都叫“问诊列表”,侧边栏出现两个同名
# 入口,医生无法判断该点哪个。按各自的业务对象命名以消除歧义。
"appointments",
"问诊列表",
"挂号列表",
"号",
AppointmentsPage,
("doctor.appointment/lists",),
@@ -350,8 +354,7 @@ def _resolve_navigation(
def _painted_shell_icon(kind: str, size: int = 18) -> QIcon:
"""Create a font-independent shell icon once, before widget painting."""
pixmap = QPixmap(size, size)
pixmap.fill(Qt.GlobalColor.transparent)
pixmap = crisp_pixmap(size)
painter = QPainter(pixmap)
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
try:
@@ -519,8 +522,7 @@ def _painted_navigation_icon(kind: str, size: int = 18) -> QIcon:
"""Return a compact line icon with a dedicated checked-state color."""
def render(color: str) -> QPixmap:
pixmap = QPixmap(size, size)
pixmap.fill(Qt.GlobalColor.transparent)
pixmap = crisp_pixmap(size)
painter = QPainter(pixmap)
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
pen = QPen(QColor(color), 1.55)
@@ -725,8 +727,7 @@ class _UserMenuButton(QToolButton):
self.setFixedWidth(max(104, min(174, name_width + 72)))
self.setAccessibleName(f"用户菜单:{self.display_name}")
self.setText(self.display_name)
avatar = QPixmap(34, 34)
avatar.fill(Qt.GlobalColor.transparent)
avatar = crisp_pixmap(34)
painter = QPainter(avatar)
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
painter.setPen(Qt.PenStyle.NoPen)
@@ -843,6 +844,7 @@ class ShellWindow(QMainWindow):
logout_requested = Signal()
video_requested = Signal(dict)
page_changed = Signal(str)
update_check_requested = Signal()
def __init__(
self,
@@ -1328,6 +1330,9 @@ class ShellWindow(QMainWindow):
account_action = user_menu.addAction(self._role_text())
account_action.setEnabled(False)
user_menu.addSeparator()
update_action = user_menu.addAction("检查更新")
update_action.triggered.connect(self.update_check_requested.emit)
user_menu.addSeparator()
logout_action = user_menu.addAction("退出登录")
logout_action.triggered.connect(lambda: self.logout_requested.emit())
self.user_menu_button.setMenu(user_menu)
@@ -1552,31 +1557,15 @@ class ShellWindow(QMainWindow):
show_toast(self, "当前账号没有使用 AI 问诊助手的权限。", "danger")
return
current_page = self.stack.currentWidget()
opener = getattr(current_page, "open_selected_ai_consult", None)
if callable(opener) and bool(opener()):
return
reception = self.pages.get("reception")
if reception is None or not self.navigate("reception"):
show_toast(
self,
"当前账号没有可用的接诊台;请从问诊列表或患者列表选择诊单后使用 AI 分析。",
"warning",
4800,
)
return
if reception is not current_page:
reception_opener = getattr(reception, "open_selected_ai_consult", None)
if callable(reception_opener) and bool(reception_opener()):
return
show_toast(
# The shell assistant is the global entry point. Always let the doctor
# choose from the complete permission-scoped patient list, even when a
# page happens to retain a selected row. Page-level AI actions keep the
# faster "open the selected patient" behaviour.
select_and_present_ai_consult(
self.repository,
self.permissions,
self,
"请先在接诊台选择一位有诊单的患者,再点击“开始对话”。",
"info",
4200,
initial_query=self.global_search.text().strip(),
)
def _open_local_audio_settings(self) -> None: