|
30 | 30 | QTextEdit, |
31 | 31 | QProgressDialog, |
32 | 32 | ) |
33 | | -from PySide6.QtCore import Qt, QThread, Signal, QMutex |
| 33 | +from PySide6.QtCore import Qt, QThread, Signal, QMutex, QCoreApplication |
34 | 34 | from PySide6.QtGui import QImage, QPixmap, QPainter, QColor |
35 | 35 |
|
36 | 36 |
|
@@ -861,16 +861,18 @@ def init_ui(self): |
861 | 861 | widget.hide() |
862 | 862 |
|
863 | 863 | # 控制按钮和设备选择 |
864 | | - self.play_btn = QPushButton("Play") |
| 864 | + self.play_btn = QPushButton(QCoreApplication.translate("Dialog", "Play")) |
865 | 865 | self.play_btn.clicked.connect(self.toggle_play) |
866 | | - self.stop_btn = QPushButton("Stop") |
| 866 | + self.stop_btn = QPushButton(QCoreApplication.translate("Dialog", "Stop")) |
867 | 867 | self.stop_btn.clicked.connect(self.stop) |
868 | 868 |
|
869 | | - self.device_label = QLabel("音频设备:") |
| 869 | + self.device_label = QLabel( |
| 870 | + QCoreApplication.translate("Dialog", "Audio Device:") |
| 871 | + ) |
870 | 872 | self.device_combo = QComboBox() |
871 | 873 | self.device_combo.currentIndexChanged.connect(self.on_device_changed) |
872 | 874 |
|
873 | | - self.volume_label = QLabel("音量:") |
| 875 | + self.volume_label = QLabel(QCoreApplication.translate("Dialog", "Volume:")) |
874 | 876 | self.volume_slider = QSlider(Qt.Horizontal) |
875 | 877 | self.volume_slider.setRange(0, 100) |
876 | 878 | self.volume_slider.setValue(100) |
@@ -1082,7 +1084,7 @@ def _on_audio_ready_after_reload(self, audio_spec, target_pos_ms): |
1082 | 1084 | if self.video_loaded: |
1083 | 1085 | self.set_play_position(target_pos_ms) |
1084 | 1086 | self.is_playing = True |
1085 | | - self.play_btn.setText("Pause") |
| 1087 | + self.play_btn.setText(QCoreApplication.translate("Dialog", "Pause")) |
1086 | 1088 |
|
1087 | 1089 | # 开始播放 |
1088 | 1090 | if self.video_thread: |
@@ -1252,15 +1254,15 @@ def toggle_play(self): |
1252 | 1254 |
|
1253 | 1255 | if self.audio_thread and self.audio_thread.paused: |
1254 | 1256 | self.audio_thread.pause() |
1255 | | - self.play_btn.setText("Pause") |
| 1257 | + self.play_btn.setText(QCoreApplication.translate("Dialog", "Pause")) |
1256 | 1258 | self.log("开始播放") |
1257 | 1259 | else: |
1258 | 1260 | if not self.video_thread.paused: |
1259 | 1261 | self.video_thread.pause() |
1260 | 1262 |
|
1261 | 1263 | if self.audio_thread and not self.audio_thread.paused: |
1262 | 1264 | self.audio_thread.pause() |
1263 | | - self.play_btn.setText("Play") |
| 1265 | + self.play_btn.setText(QCoreApplication.translate("Dialog", "Play")) |
1264 | 1266 | self.log("已暂停") |
1265 | 1267 |
|
1266 | 1268 | def stop(self): |
@@ -1306,6 +1308,7 @@ def handle_ffmpeg_error(self, msg): |
1306 | 1308 | self.log(f"FFmpeg: {msg}") |
1307 | 1309 |
|
1308 | 1310 | def closeEvent(self, event): |
| 1311 | + self.video_thread._is_to_stop_old_frameTimer = True |
1309 | 1312 | self.stop() |
1310 | 1313 | event.accept() |
1311 | 1314 |
|
|
0 commit comments