22import  sys 
33import  webbrowser 
44from  functools  import  partial 
5- from  typing  import  TYPE_CHECKING , Any , cast 
5+ from  typing  import  TYPE_CHECKING , Any , Literal ,  cast 
66from  urllib .error  import  URLError 
77from  urllib .request  import  urlopen 
88
2323    get_all_video_capture_devices ,
2424)
2525from  gen  import  about , design , settings  as  settings_ui , update_checker 
26- from  hotkeys  import  HOTKEYS , HOTKEYS_WHEN_AUTOCONTROLLED , set_hotkey 
26+ from  hotkeys  import  HOTKEYS , HOTKEYS_WHEN_AUTOCONTROLLED , CommandStr ,  set_hotkey 
2727from  utils  import  AUTOSPLIT_VERSION , GITHUB_REPOSITORY , ONE_SECOND , decimal , fire_and_forget 
2828
2929if  TYPE_CHECKING :
3838    +  "\n Run: sudo apt-get install scrot" 
3939) if  sys .platform  ==  "linux"  else  ""   # fmt: skip 
4040
41+ _DEBUG_SCREENSHOT_COMMANDS : tuple [CommandStr , ...] =  (
42+     "split" ,
43+     "start" ,
44+     "reset" ,
45+     "undo" ,
46+     "skip" ,
47+     "pause" ,
48+ )
49+ 
4150
4251class  __AboutWidget (QtWidgets .QWidget , about .Ui_AboutAutoSplitWidget ):  # noqa: N801 # Private class 
4352    """About Window.""" 
@@ -326,7 +335,7 @@ def __select_screenshot_directory(self):
326335        )
327336
328337    def  __setup_bindings (self ):
329-         """ Hotkey initial values and bindings.""" 
338+         #  Hotkey initial values and bindings
330339        for  hotkey  in  HOTKEYS :
331340            hotkey_input : QtWidgets .QLineEdit  =  getattr (self , f"{ hotkey }  )
332341            set_hotkey_hotkey_button : QtWidgets .QPushButton  =  getattr (
@@ -344,6 +353,21 @@ def __setup_bindings(self):
344353                    partial (set_hotkey , self ._autosplit_ref , hotkey = hotkey )
345354                )
346355
356+         # Debug screenshot selection checkboxes initial values and bindings 
357+         _screenshot_on_setting  =  self ._autosplit_ref .settings_dict ["screenshot_on" ]
358+         for  command  in  _DEBUG_SCREENSHOT_COMMANDS :
359+             checkbox : QtWidgets .QCheckBox  =  getattr (self , f"screenshot_on_{ command }  )
360+ 
361+             checkbox .setChecked (command  in  _screenshot_on_setting )
362+ 
363+             def  add_or_del (checked : Literal [0 , 2 ], command : CommandStr  =  command ):
364+                 if  checked :
365+                     _screenshot_on_setting .add (command )
366+                 else :
367+                     _screenshot_on_setting .remove (command )
368+ 
369+             checkbox .stateChanged .connect (add_or_del )
370+ 
347371        # region Set initial values 
348372        # Capture Settings 
349373        self .fps_limit_spinbox .setValue (self ._autosplit_ref .settings_dict ["fps_limit" ])
@@ -478,6 +502,10 @@ def get_default_settings_from_ui(autosplit: "AutoSplit"):
478502        "split_image_directory" : autosplit .split_image_folder_input .text (),
479503        "screenshot_directory" : default_settings_dialog .screenshot_directory_input .text (),
480504        "open_screenshot" : default_settings_dialog .open_screenshot_checkbox .isChecked (),
505+         "screenshot_on" : {
506+             getattr (default_settings_dialog , f"screenshot_on_{ command }  ).isChecked ()
507+             for  command  in  _DEBUG_SCREENSHOT_COMMANDS 
508+         },
481509        "captured_window_title" : "" ,
482510        "capture_region" : {
483511            "x" : autosplit .x_spinbox .value (),
0 commit comments