From 17eb1b34bedbdf7b1513cb94c6cff440c24f6a8d Mon Sep 17 00:00:00 2001 From: marques Date: Wed, 17 Dec 2025 00:24:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9B=B4=E6=96=B0=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=8C=89=E9=92=AE=E5=8F=8A=E5=85=B6=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE=EF=BC=8C=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- func/Module_label_check.py | 36 +++++++++++++++++++++++-- func/utils/ConfigParams.py | 1 + ui/MainWindow/MainWindow_label_check.py | 17 +++++++++++- ui/MainWindow/MainWindow_label_check.ui | 24 +++++++++++++++++ 4 files changed, 75 insertions(+), 3 deletions(-) diff --git a/func/Module_label_check.py b/func/Module_label_check.py index 260ff3b..af58453 100644 --- a/func/Module_label_check.py +++ b/func/Module_label_check.py @@ -36,7 +36,8 @@ ButtonState = { "pushButton_save": False, "pushButton_prev_move": False, "pushButton_pause": False, - "pushButton_next_move": False + "pushButton_next_move": False, + "pushButton_update_state": False }, "Current": { "pushButton_input_setting": True, @@ -44,7 +45,8 @@ ButtonState = { "pushButton_save": False, "pushButton_prev_move": False, "pushButton_pause": False, - "pushButton_next_move": False + "pushButton_next_move": False, + "pushButton_update_state": False } } @@ -257,6 +259,9 @@ class MainWindow_label_check(QMainWindow): self.point_peak_corrected = None self.annotation_tableWidget = None + self.move_state = None + self.last_move_state = None + self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") PublicFunc.__styleAllButton__(self, ButtonState) @@ -332,6 +337,7 @@ class MainWindow_label_check(QMainWindow): self.ui.pushButton_prev_move.clicked.connect(self.__slot_btn_move__) self.ui.pushButton_pause.clicked.connect(self.__slot_btn_move__) self.ui.pushButton_next_move.clicked.connect(self.__slot_btn_move__) + self.ui.pushButton_update_state.clicked.connect(self.__update_state__) self.ui.radioButton_move_preset_1.toggled.connect(self.__change_autoplay_args__) self.ui.radioButton_move_preset_2.toggled.connect(self.__change_autoplay_args__) self.ui.radioButton_move_preset_3.toggled.connect(self.__change_autoplay_args__) @@ -354,6 +360,12 @@ class MainWindow_label_check(QMainWindow): self.ui.pushButton_pause.setShortcut( QCoreApplication.translate("MainWindow", Params.LABEL_CHECK_BTN_PAUSE_SHORTCUT_KEY) ) + self.ui.pushButton_update_state.setShortcut( + QCoreApplication.translate("MainWindow", Params.LABEL_CHECK_BTN_UPDATE_STATE_SHORTCUT_KEY) + ) + + + @overrides def closeEvent(self, event): @@ -584,6 +596,8 @@ class MainWindow_label_check(QMainWindow): ButtonState["Current"]["pushButton_prev_move"] = True ButtonState["Current"]["pushButton_next_move"] = True ButtonState["Current"]["pushButton_pause"] = True + ButtonState["Current"]["pushButton_update_state"] = True + PublicFunc.finish_operation(self, ButtonState) def __slot_btn_save__(self): @@ -603,6 +617,20 @@ class MainWindow_label_check(QMainWindow): PublicFunc.msgbox_output(self, result.info, Constants.TIPS_TYPE_INFO) PublicFunc.finish_operation(self, ButtonState) + def __update_state__(self): + if self.move_state == "moving": + self.ui.pushButton_pause.click() + self.move_state = "pause" + else: + if self.last_move_state == "prev": + self.ui.pushButton_prev_move.click() + elif self.last_move_state == "next": + self.ui.pushButton_next_move.click() + else: + self.ui.pushButton_next_move.click() + self.move_state = "moving" + + def __slot_btn_move__(self): if self.data is None: return @@ -610,6 +638,8 @@ class MainWindow_label_check(QMainWindow): sender = self.sender() if sender == self.ui.pushButton_prev_move: + self.last_move_state = "prev" + self.move_state = "moving" Config["AutoplayArgs"]["AutoplayMode"] = "prev" self.autoplay_xlim_start = int(self.ax0.get_xlim()[1] - Config["AutoplayArgs"]["MaxRange"]) self.autoplay_xlim_end = int(self.ax0.get_xlim()[1]) @@ -621,6 +651,8 @@ class MainWindow_label_check(QMainWindow): self.timer_autoplay.start(Config["AutoplayArgs"]["MoveSpeed"]) PublicFunc.text_output(self.ui, Constants.LABEL_CHECK_PREV_MOVE, Constants.TIPS_TYPE_INFO) elif sender == self.ui.pushButton_next_move: + self.last_move_state = "next" + self.move_state = "moving" Config["AutoplayArgs"]["AutoplayMode"] = "next" self.autoplay_xlim_start = int(self.ax0.get_xlim()[0]) self.autoplay_xlim_end = int(self.ax0.get_xlim()[0] + Config["AutoplayArgs"]["MaxRange"]) diff --git a/func/utils/ConfigParams.py b/func/utils/ConfigParams.py index a01dcd4..4aaf9d7 100644 --- a/func/utils/ConfigParams.py +++ b/func/utils/ConfigParams.py @@ -202,6 +202,7 @@ class Params: LABEL_CHECK_BTN_PREV_MOVE_SHORTCUT_KEY = "A" LABEL_CHECK_BTN_NEXT_MOVE_SHORTCUT_KEY = "D" LABEL_CHECK_BTN_PAUSE_SHORTCUT_KEY = "S" + LABEL_CHECK_BTN_UPDATE_STATE_SHORTCUT_KEY = "Space" # 数据精同步 PRECISELY_ALIGN_CONFIG_FILE_PATH: str = "./config/Config_precisely_align.yaml" diff --git a/ui/MainWindow/MainWindow_label_check.py b/ui/MainWindow/MainWindow_label_check.py index 235f3c2..fccb2e4 100644 --- a/ui/MainWindow/MainWindow_label_check.py +++ b/ui/MainWindow/MainWindow_label_check.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'MainWindow_label_check.ui' ## -## Created by: Qt User Interface Compiler version 6.8.2 +## Created by: Qt User Interface Compiler version 6.9.2 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -156,6 +156,14 @@ class Ui_MainWindow_label_check(object): self.horizontalLayout_2.addWidget(self.pushButton_pause) + self.pushButton_update_state = QPushButton(self.groupBox_2) + self.pushButton_update_state.setObjectName(u"pushButton_update_state") + sizePolicy.setHeightForWidth(self.pushButton_update_state.sizePolicy().hasHeightForWidth()) + self.pushButton_update_state.setSizePolicy(sizePolicy) + self.pushButton_update_state.setFont(font1) + + self.horizontalLayout_2.addWidget(self.pushButton_update_state) + self.pushButton_next_move = QPushButton(self.groupBox_2) self.pushButton_next_move.setObjectName(u"pushButton_next_move") sizePolicy.setHeightForWidth(self.pushButton_next_move.sizePolicy().hasHeightForWidth()) @@ -505,6 +513,13 @@ class Ui_MainWindow_label_check(object): self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow_label_check", u"\u81ea\u52a8\u64ad\u653e", None)) self.pushButton_prev_move.setText(QCoreApplication.translate("MainWindow_label_check", u"< <(A)", None)) self.pushButton_pause.setText(QCoreApplication.translate("MainWindow_label_check", u"| |(S)", None)) +#if QT_CONFIG(tooltip) + self.pushButton_update_state.setToolTip(QCoreApplication.translate("MainWindow_label_check", u"\u6309\u4e0b\u540e\u6062\u590d\u4e0a\u6b21\u72b6\u6001", None)) +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + self.pushButton_update_state.setWhatsThis("") +#endif // QT_CONFIG(whatsthis) + self.pushButton_update_state.setText(QCoreApplication.translate("MainWindow_label_check", u"\u26aa( )", None)) self.pushButton_next_move.setText(QCoreApplication.translate("MainWindow_label_check", u"> >(D)", None)) self.groupBox_3.setTitle(QCoreApplication.translate("MainWindow_label_check", u"\u8bbe\u7f6e", None)) self.label_moveLength_preset_1.setText(QCoreApplication.translate("MainWindow_label_check", u"10000", None)) diff --git a/ui/MainWindow/MainWindow_label_check.ui b/ui/MainWindow/MainWindow_label_check.ui index 1cb67fa..9bff0a5 100644 --- a/ui/MainWindow/MainWindow_label_check.ui +++ b/ui/MainWindow/MainWindow_label_check.ui @@ -237,6 +237,30 @@ + + + + + 0 + 0 + + + + + 12 + + + + 按下后恢复上次状态 + + + + + + ⚪( ) + + +