@@ -24,7 +24,6 @@ class URLCommandHandler(QObject):
2424 showMainPageRequested = Signal (str ) # 请求显示主页面
2525 showTrayActionRequested = Signal (str ) # 请求执行托盘操作
2626 securityVerificationRequested = Signal (str , dict ) # 请求安全验证
27- classIslandDataReceived = Signal (dict ) # 接收ClassIsland数据信号
2827
2928 def __init__ (self , main_window = None ):
3029 super ().__init__ ()
@@ -63,8 +62,6 @@ def __init__(self, main_window=None):
6362 "open" : self ._handle_open ,
6463 "action" : self ._handle_action ,
6564 "verify" : self ._handle_verify ,
66- # ClassIsland数据命令
67- "data/class_island" : self ._handle_class_island_data ,
6865 }
6966
7067 # 需要密码验证的命令列表
@@ -637,74 +634,6 @@ def _handle_verify(self, params: Dict[str, Any]) -> Dict[str, Any]:
637634 # 这里可以实现具体的验证逻辑
638635 return {"status" : "success" , "message" : "验证通过" , "verified" : True }
639636
640- def _handle_class_island_data (self , params : Dict [str , Any ]) -> Dict [str , Any ]:
641- """处理ClassIsland数据
642- 接收包含课程表信息的JSON数据
643-
644- Args:
645- params: 包含ClassIsland数据的参数字典
646- 预期包含以下字段:
647- - data: ClassIsland发送的课程表数据
648- - CurrentSubject: 当前所处时间点的科目
649- - NextClassSubject: 下一节课的科目
650- - CurrentState: 当前时间点状态
651- - CurrentTimeLayoutItem: 当前所处的时间点
652- - CurrentClassPlan: 当前加载的课表
653- - NextBreakingTimeLayoutItem: 下一个课间休息类型的时间点
654- - NextClassTimeLayoutItem: 下一个上课类型的时间点
655- - CurrentSelectedIndex: 当前所处时间点的索引
656- - OnClassLeftTime: 距离上课剩余时间
657- - OnBreakingTimeLeftTime: 距下课剩余时间
658- - IsClassPlanEnabled: 是否启用课表
659- - IsClassPlanLoaded: 是否已加载课表
660- - IsLessonConfirmed: 是否已确定当前时间点
661- """
662- logger .debug ("处理ClassIsland数据" )
663-
664- # 从参数中获取ClassIsland数据
665- class_island_data = params .get ("data" , {})
666-
667- if not class_island_data :
668- logger .warning ("收到空的ClassIsland数据" )
669- return {"status" : "error" , "message" : "ClassIsland数据不能为空" }
670-
671- # 验证必要的字段是否存在
672- required_fields = [
673- "CurrentSubject" ,
674- "NextClassSubject" ,
675- "CurrentState" ,
676- "CurrentTimeLayoutItem" ,
677- "CurrentClassPlan" ,
678- "NextBreakingTimeLayoutItem" ,
679- "NextClassTimeLayoutItem" ,
680- "CurrentSelectedIndex" ,
681- "OnClassLeftTime" ,
682- "OnBreakingTimeLeftTime" ,
683- "IsClassPlanEnabled" ,
684- "IsClassPlanLoaded" ,
685- "IsLessonConfirmed" ,
686- ]
687-
688- for field in required_fields :
689- if field not in class_island_data :
690- logger .warning (f"ClassIsland数据缺少必要字段: { field } " )
691-
692- # 发射信号,让主窗口处理ClassIsland数据
693- try :
694- self .classIslandDataReceived .emit (class_island_data )
695- logger .debug ("ClassIsland数据已发送到主窗口处理" )
696- return {
697- "status" : "success" ,
698- "message" : "ClassIsland数据已接收并处理" ,
699- "data_received" : True ,
700- }
701- except Exception as e :
702- logger .error (f"发送ClassIsland数据信号失败: { e } " )
703- return {
704- "status" : "error" ,
705- "message" : f"发送ClassIsland数据信号失败: { str (e )} " ,
706- }
707-
708637 def register_command (
709638 self ,
710639 command : str ,
0 commit comments