77import videoControl
88import ms_toollib as ms
99from mineSweeperGUIEvent import MineSweeperGUIEvent
10+ from mainWindowGUI import MainWindow
1011
1112class MineSweeperVideoPlayer (MineSweeperGUIEvent ):
12- def initVideoPlayer (self ):
13+ def __init__ (self , MainWindow : MainWindow , args ):
14+ super (MineSweeperVideoPlayer , self ).__init__ (MainWindow , args )
1315 self .ui_video_control = videoControl .ui_Form (self .r_path , self .game_setting ,
1416 self .mainWindow )
1517 self .video_time_step = 0.01 # 录像时间的步长,定时器始终是10毫秒
@@ -20,18 +22,13 @@ def initVideoPlayer(self):
2022 self .ui_video_control .videoSetTime .connect (self .video_set_time )
2123 self .ui_video_control .videoSetTimePeriod .connect (self .video_set_a_time )
2224 self .ui_video_control .label_speed .wEvent .connect (self .video_set_speed )
23- self .ui_video_control .tabWidget .currentChanged . connect (self .on_tab_changed )
25+ self .ui_video_control .tabWidget .tabBar (). tabBarClicked . connect (self .on_tab_clicked )
2426 self .timer_video = QTimer ()
2527 self .timer_video .timeout .connect (self .video_playing_step )
2628
2729
2830 # 打开录像文件的回调
2931 def action_OpenFile (self , openfile_name = None ):
30- # self.setting_path / 'replay'
31-
32- # self.ui_video_control = videoControl.ui_Form(self.r_path, self.game_setting,
33- # self.mainWindow)
34-
3532 self .unlimit_cursor ()
3633 if not openfile_name :
3734 openfile_name = QFileDialog .\
@@ -88,17 +85,15 @@ def action_OpenFile(self, openfile_name=None):
8885 "super_fl_local" ])
8986 self .ui_video_control .add_new_video_tab (video )
9087 # self.tab_data.append(video)
88+ tab_count = self .ui_video_control .tabWidget .count ()
89+ self .ui_video_control .tabWidget .setCurrentIndex (tab_count - 1 )
9190 self .play_video (video )
9291
9392
9493 # 播放新录像,调整局面尺寸等
9594 # 控制台中,不添加新标签、连接信号。假如关闭就展示
9695 # 播放AvfVideo、RmvVideo、EvfVideo、MvfVideo或BaseVideo
9796 def play_video (self , video , new_tab = False ):
98- # if self.game_state == 'display':
99- # self.ui_video_control.QWidget.close()
100- # self.game_state = 'display'
101-
10297 if self .game_state != 'display' :
10398 self .game_state = 'display'
10499 self .video_playing = False
@@ -185,7 +180,7 @@ def play_video(self, video, new_tab=False):
185180
186181
187182 # 切换标签时,播放标签中的录像
188- def on_tab_changed (self , idt ):
183+ def on_tab_clicked (self , idt ):
189184 if isinstance (self .ui_video_control .tabWidget .widget (idt ), videoControl .VideoTabWidget ):
190185 self .play_video (self .ui_video_control .tabWidget .widget (idt ).video )
191186 ...
0 commit comments