23
23
from capture_method import CaptureMethodBase , CaptureMethodEnum
24
24
from gen import about , design , settings , update_checker
25
25
from hotkeys import HOTKEYS , after_setting_hotkey , send_command
26
- from menu_bar import (about_qt , about_qt_for_python , check_for_updates , get_default_settings_from_ui , open_about ,
27
- open_settings , open_update_checker , view_help )
26
+ from menu_bar import (
27
+ about_qt , about_qt_for_python , check_for_updates , get_default_settings_from_ui , open_about , open_settings ,
28
+ open_update_checker , view_help ,
29
+ )
28
30
from region_selection import align_region , select_region , select_window , validate_before_parsing
29
31
from split_parser import BELOW_FLAG , DUMMY_FLAG , PAUSE_FLAG , parse_and_validate_images
30
32
from user_profile import DEFAULT_PROFILE
31
- from utils import (AUTOSPLIT_VERSION , FIRST_WIN_11_BUILD , FROZEN , START_AUTO_SPLITTER_TEXT , WINDOWS_BUILD_NUMBER ,
32
- auto_split_directory , decimal , is_valid_image )
33
+ from utils import (
34
+ AUTOSPLIT_VERSION , FIRST_WIN_11_BUILD , FROZEN , START_AUTO_SPLITTER_TEXT , WINDOWS_BUILD_NUMBER , auto_split_directory ,
35
+ decimal , is_valid_image ,
36
+ )
33
37
34
38
CHECK_FPS_ITERATIONS = 10
35
39
@@ -172,9 +176,8 @@ def __init__(self, parent: QWidget | None = None): # pylint: disable=too-many-s
172
176
self .align_region_button .clicked .connect (lambda : align_region (self ))
173
177
self .select_window_button .clicked .connect (lambda : select_window (self ))
174
178
self .reload_start_image_button .clicked .connect (lambda : self .__load_start_image (True , True ))
175
- self .action_check_for_updates_on_open .changed .connect (lambda : user_profile .set_check_for_updates_on_open (
176
- self ,
177
- self .action_check_for_updates_on_open .isChecked ())
179
+ self .action_check_for_updates_on_open .changed .connect (
180
+ lambda : user_profile .set_check_for_updates_on_open (self , self .action_check_for_updates_on_open .isChecked ()),
178
181
)
179
182
180
183
# update x, y, width, and height when changing the value of these spinbox's are changed
@@ -186,8 +189,9 @@ def __init__(self, parent: QWidget | None = None): # pylint: disable=too-many-s
186
189
# connect signals to functions
187
190
self .after_setting_hotkey_signal .connect (lambda : after_setting_hotkey (self ))
188
191
self .start_auto_splitter_signal .connect (self .__auto_splitter )
189
- self .update_checker_widget_signal .connect (lambda latest_version , check_on_open :
190
- open_update_checker (self , latest_version , check_on_open ))
192
+ self .update_checker_widget_signal .connect (
193
+ lambda latest_version , check_on_open : open_update_checker (self , latest_version , check_on_open ),
194
+ )
191
195
self .load_start_image_signal .connect (self .__load_start_image )
192
196
self .load_start_image_signal [bool ].connect (self .__load_start_image )
193
197
self .load_start_image_signal [bool , bool ].connect (self .__load_start_image )
@@ -225,7 +229,8 @@ def __browse(self):
225
229
new_split_image_directory = QFileDialog .getExistingDirectory (
226
230
self ,
227
231
"Select Split Image Directory" ,
228
- os .path .join (self .settings_dict ["split_image_directory" ] or auto_split_directory , ".." ))
232
+ os .path .join (self .settings_dict ["split_image_directory" ] or auto_split_directory , ".." ),
233
+ )
229
234
230
235
# If the user doesn't select a folder, it defaults to "".
231
236
if new_split_image_directory :
@@ -260,9 +265,11 @@ def __load_start_image(self, started_by_button: bool = False, wait_for_delay: bo
260
265
261
266
if self .start_image :
262
267
if not self .is_auto_controlled \
263
- and (not self .settings_dict ["split_hotkey" ]
264
- or not self .settings_dict ["reset_hotkey" ]
265
- or not self .settings_dict ["pause_hotkey" ]):
268
+ and (
269
+ not self .settings_dict ["split_hotkey" ]
270
+ or not self .settings_dict ["reset_hotkey" ]
271
+ or not self .settings_dict ["pause_hotkey" ]
272
+ ):
266
273
error_messages .load_start_image ()
267
274
QApplication .processEvents ()
268
275
return
@@ -334,7 +341,8 @@ def __start_image_function(self):
334
341
while time () - delay_start_time < start_delay :
335
342
delay_time_left = start_delay - (time () - delay_start_time )
336
343
self .current_split_image .setText (
337
- f"Delayed Before Starting:\n { seconds_remaining_text (delay_time_left )} " )
344
+ f"Delayed Before Starting:\n { seconds_remaining_text (delay_time_left )} " ,
345
+ )
338
346
QTest .qWait (1 )
339
347
340
348
self .start_image_status_value_label .setText ("started" )
@@ -366,7 +374,8 @@ def __take_screenshot(self):
366
374
while True :
367
375
screenshot_path = os .path .join (
368
376
self .settings_dict ["split_image_directory" ],
369
- f"{ screenshot_index :03} _SplitImage.png" )
377
+ f"{ screenshot_index :03} _SplitImage.png" ,
378
+ )
370
379
if not os .path .exists (screenshot_path ):
371
380
break
372
381
screenshot_index += 1
@@ -426,7 +435,7 @@ def undo_split(self, navigate_image_only: bool = False):
426
435
return
427
436
428
437
if not navigate_image_only :
429
- for i , group in enumerate (self .split_groups , ):
438
+ for i , group in enumerate (self .split_groups ):
430
439
if i > 0 and self .split_image_number in group :
431
440
self .split_image_number = self .split_groups [i - 1 ][- 1 ]
432
441
break
@@ -508,10 +517,13 @@ def __auto_splitter(self):
508
517
# Construct a list of images + loop count tuples.
509
518
self .split_images_and_loop_number = [
510
519
item for flattenlist
511
- in [[(split_image , i + 1 ) for i in range (split_image .loops )]
520
+ in [
521
+ [(split_image , i + 1 ) for i in range (split_image .loops )]
512
522
for split_image
513
- in self .split_images ]
514
- for item in flattenlist ]
523
+ in self .split_images
524
+ ]
525
+ for item in flattenlist
526
+ ]
515
527
516
528
# Construct groups of splits
517
529
self .split_groups = []
@@ -649,7 +661,8 @@ def __similarity_threshold_loop(self, number_of_split_images: int, dummy_splits_
649
661
continue
650
662
651
663
elif ( # pylint: disable=confusing-consecutive-elif
652
- self .split_image .check_flag (BELOW_FLAG ) and self .split_below_threshold ):
664
+ self .split_image .check_flag (BELOW_FLAG ) and self .split_below_threshold
665
+ ):
653
666
self .split_below_threshold = False
654
667
break
655
668
@@ -758,10 +771,12 @@ def __get_capture_for_comparison(self):
758
771
if recovered :
759
772
capture , _ = self .capture_method .get_frame (self )
760
773
761
- return (None
762
- if not is_valid_image (capture )
763
- else cv2 .resize (capture , COMPARISON_RESIZE , interpolation = cv2 .INTER_NEAREST ),
764
- is_old_image )
774
+ return (
775
+ None
776
+ if not is_valid_image (capture )
777
+ else cv2 .resize (capture , COMPARISON_RESIZE , interpolation = cv2 .INTER_NEAREST ),
778
+ is_old_image ,
779
+ )
765
780
766
781
def __reset_if_should (self , capture : cv2 .Mat | None ):
767
782
"""
@@ -856,7 +871,8 @@ def exit_program():
856
871
self ,
857
872
"AutoSplit" ,
858
873
f"Do you want to save changes made to settings file { settings_file_name } ?" ,
859
- QMessageBox .StandardButton .Yes | QMessageBox .StandardButton .No | QMessageBox .StandardButton .Cancel )
874
+ QMessageBox .StandardButton .Yes | QMessageBox .StandardButton .No | QMessageBox .StandardButton .Cancel ,
875
+ )
860
876
861
877
if warning is QMessageBox .StandardButton .Yes :
862
878
if user_profile .save_settings (self ):
@@ -887,10 +903,13 @@ def set_preview_image(qlabel: QLabel, image: cv2.Mat | None, transparency: bool)
887
903
capture = cv2 .cvtColor (image , color_code )
888
904
height , width , channels = capture .shape
889
905
qimage = QtGui .QImage (capture .data , width , height , width * channels , image_format )
890
- qlabel .setPixmap (QtGui .QPixmap (qimage ).scaled (
891
- qlabel .size (),
892
- QtCore .Qt .AspectRatioMode .IgnoreAspectRatio ,
893
- QtCore .Qt .TransformationMode .SmoothTransformation ))
906
+ qlabel .setPixmap (
907
+ QtGui .QPixmap (qimage ).scaled (
908
+ qlabel .size (),
909
+ QtCore .Qt .AspectRatioMode .IgnoreAspectRatio ,
910
+ QtCore .Qt .TransformationMode .SmoothTransformation ,
911
+ ),
912
+ )
894
913
895
914
896
915
def seconds_remaining_text (seconds : float ):
0 commit comments