|
33 | 33 | open_update_checker, |
34 | 34 | view_help, |
35 | 35 | ) |
36 | | -from region_selection import align_region, select_region, select_window, validate_before_parsing |
37 | | -from split_parser import BELOW_FLAG, DUMMY_FLAG, PAUSE_FLAG, parse_and_validate_images |
| 36 | +from region_selection import align_region, select_region, select_window |
| 37 | +from split_parser import BELOW_FLAG, DUMMY_FLAG, PAUSE_FLAG, parse_and_validate_images, validate_before_parsing |
38 | 38 | from user_profile import DEFAULT_PROFILE |
39 | 39 | from utils import ( |
40 | 40 | AUTOSPLIT_VERSION, |
@@ -381,18 +381,24 @@ def __update_height(self): |
381 | 381 | self.settings_dict["capture_region"]["height"] = self.height_spinbox.value() |
382 | 382 |
|
383 | 383 | def __take_screenshot(self): |
384 | | - if not validate_before_parsing(self, check_empty_directory=False): |
| 384 | + if not self.capture_method.check_selected_region_exists(): |
| 385 | + error_messages.region() |
| 386 | + return |
| 387 | + |
| 388 | + screenshot_directory = self.settings_dict["screenshot_directory"] or self.settings_dict["split_image_directory"] |
| 389 | + if not screenshot_directory: |
| 390 | + error_messages.split_image_directory() |
| 391 | + return |
| 392 | + if not os.path.exists(screenshot_directory): |
| 393 | + error_messages.invalid_directory(screenshot_directory) |
385 | 394 | return |
386 | 395 |
|
387 | 396 | # Check if file exists and rename it if it does. |
388 | 397 | # Below starts the file_name_number at #001 up to #999. After that it will go to 1000, |
389 | 398 | # which is a problem, but I doubt anyone will get to 1000 split images... |
390 | 399 | screenshot_index = 1 |
391 | 400 | while True: |
392 | | - screenshot_path = os.path.join( |
393 | | - self.settings_dict["screenshot_directory"] or self.settings_dict["split_image_directory"], |
394 | | - f"{screenshot_index:03}_SplitImage.png", |
395 | | - ) |
| 401 | + screenshot_path = os.path.join(screenshot_directory, f"{screenshot_index:03}_SplitImage.png") |
396 | 402 | if not os.path.exists(screenshot_path): |
397 | 403 | break |
398 | 404 | screenshot_index += 1 |
|
0 commit comments