@@ -116,11 +116,10 @@ def __frame_changed_handler(self, frame_num):
116116 self .ui .medianStrokesLabel .setText ('{} ms' .format (self .funscript .get_median_stroke ()))
117117
118118 def __setup_ui_binding (self ):
119- self .ui .menuFile .addAction ('Open' , self .__open_video )
120- self .ui .menuFile .addAction ('New' , self .__new_funscript )
121- self .ui .menuFile .addAction ('Save' , self .__save_funscript )
122- self .ui .menuFile .addAction ('Clear History' , self .__clear_funscript_history )
123- self .ui .menuFile .addAction ('Ground Strokes' , self .__ground_all )
119+ self .ui .menuFile .addAction ('Open (Ctrl+O)' , self .__open_video )
120+ self .ui .menuFile .addAction ('New (Ctrl+N)' , self .__new_funscript )
121+ self .ui .menuFile .addAction ('Save (Ctrl+S)' , self .__save_funscript )
122+ self .ui .menuFile .addAction ('Clear History (Ctrl+C)' , self .__clear_funscript_history )
124123
125124 helpMenu = self .ui .menubar .addMenu ("Help" )
126125 # TODO we schold use an http server to show the documentation
@@ -154,6 +153,8 @@ def __setup_shortcut_bindings(self):
154153 QtWidgets .QShortcut ('8' , self ).activated .connect (lambda : self .__add_action (80 ))
155154 QtWidgets .QShortcut ('9' , self ).activated .connect (lambda : self .__add_action (90 ))
156155
156+ QtWidgets .QShortcut ('CTRL+o' , self ).activated .connect (self .__open_video )
157+ QtWidgets .QShortcut ('CTRL+c' , self ).activated .connect (self .__clear_funscript_history )
157158 QtWidgets .QShortcut ('CTRL+g' , self ).activated .connect (lambda : self .__generateFunscript .emit ())
158159 QtWidgets .QShortcut ('CTRL+i' , self ).activated .connect (self .video_player .toogle_stroke_indicator_inversion )
159160 QtWidgets .QShortcut ('CTRL+s' , self ).activated .connect (self .__save_funscript )
@@ -170,12 +171,16 @@ def __delete_folowing(self):
170171 self .funscript_visualizer .update ()
171172
172173 def __clear_funscript_history (self ):
174+ if self .funscript is None : return
175+ if self .video_player is None : return
176+ if self .video_player .get_video_file is None : return
173177 self .__save_funscript ()
174178 funscript_path = '' .join (self .video_player .get_video_file [:- 4 ]) + '.funscript'
175179 num = 0
176180 while (os .path .exists (funscript_path + str (num ))):
177181 os .remove (funscript_path + str (num ))
178182 num += 1
183+ self .video_player .show_message ("The funscript history was cleaned" )
179184
180185 def __seek_to_first_action (self ):
181186 if self .funscript is not None :
@@ -204,10 +209,6 @@ def __seek_prev(self):
204209 max ((0.0 , self .video_player .get_current_timestamp_in_millis \
205210 / float (1000 ) - UI_CONFIG ['seek_prev_sec' ])))
206211
207- def __ground_all (self ):
208- if self .funscript is None : return
209- self .funscript .ground_all ()
210- self .funscript_visualizer .update ()
211212
212213 def __invert_actions (self ):
213214 if self .funscript is None : return
@@ -235,6 +236,8 @@ def __video_player_on_key_press(self, key):
235236 if key == 'shift+end' : self .__seek_to_last_action ()
236237 if key == 'shift+home' : self .__seek_to_first_action ()
237238 if key == 'ctrl+n' : self .__new_funscript ()
239+ if key == 'ctrl+o' : self .__open_video ()
240+ if key == 'ctrl+c' : self .__clear_funscript_history ()
238241
239242 def __show_message (self , message ):
240243 msg = QtWidgets .QMessageBox ()
@@ -285,6 +288,9 @@ def __generator_status_changed(self, current):
285288 self .statusBar ().showMessage ("{} ({})" .format (current , datetime .now ().strftime ("%H:%M:%S" )))
286289
287290 def __generate_funscript (self ):
291+ if self .funscript is None : return
292+ if self .video_player is None : return
293+ if self .video_player .get_video_file is None : return
288294 start_frame = self .video_player .get_current_frame \
289295 if self .funscript .get_last_action_time () < self .video_player .get_current_timestamp_in_millis \
290296 else self .video_player .millisec_to_frame (self .funscript .get_last_action_time ())
0 commit comments