diff --git a/main.py b/main.py index e8f7b77..e68160f 100644 --- a/main.py +++ b/main.py @@ -406,11 +406,24 @@ class MatrixControlApp(QMainWindow, Ui_MainWindow): big_pic_id += 1 break + # 发送全部取消选择指令 + cancel_all_bytes = self.serial_protocol.cancel_all() + + if not cancel_all_bytes: + logger.error("指令封装失败,数据无效") + return + + # send_command 方法来自 SerialManager 类 + success = self.serial_manager.send_command(cancel_all_bytes) + + if success: + logger.info(f"✅ 取消选择指令发送成功") + else: + logger.error("取消选择指令发送失败") + # 生成拼接指令 mosaic_packet_bytes = self.serial_protocol.build_mosaic_packet(start, v_count, h_count, big_pic_id) - print(mosaic_packet_bytes) - if not mosaic_packet_bytes: logger.error("指令封装失败,数据无效") return @@ -420,7 +433,13 @@ class MatrixControlApp(QMainWindow, Ui_MainWindow): if success: - click_labels = ScreenLabel.click_labels + ScreenLabel.click_labels = [] + + ids = [w.screen_id for w in selected_widgets] + + for i in ids: + ScreenLabel.split_solution[i - 1]["status"] = 3 + ScreenLabel.split_solution[i - 1]["big_pic_id"] = big_pic_id # 1. 查找对应的 Label 对象 # label = self.screen_labels[screen_id - 1] # 数组下标从0开始 @@ -433,20 +452,6 @@ class MatrixControlApp(QMainWindow, Ui_MainWindow): logger.error("指令发送失败,未连接数据大屏") return - - # if selected: - # # 如果选中,设置一个红色/蓝色的边框,或者背景色 - # self.setStyleSheet(""" - # border: 2px solid red; - # background-color: rgba(255, 0, 0, 0.1); - # """) - # else: - # # 如果取消选中,恢复默认样式(假设默认是灰色边框) - # self.setStyleSheet(""" - # border: 1px solid gray; - # background-color: white; - # """) - def clear_screen(self, screen_id): screen_pos = ScreenLabel.split_solution[screen_id - 1]['big_pic_id']