mirror of
https://github.com/Yuvi9587/Kemono-Downloader.git
synced 2025-12-17 15:36:51 +00:00
Update main_window.py
This commit is contained in:
parent
ccc7804505
commit
76d4a3ea8a
@ -4715,12 +4715,10 @@ class DownloaderApp (QWidget ):
|
|||||||
def reset_application_state(self):
|
def reset_application_state(self):
|
||||||
self.log_signal.emit("🔄 Resetting application state to defaults...")
|
self.log_signal.emit("🔄 Resetting application state to defaults...")
|
||||||
|
|
||||||
# --- MODIFIED PART: Signal all threads to stop first, but do not wait ---
|
|
||||||
if self._is_download_active():
|
if self._is_download_active():
|
||||||
self.log_signal.emit(" Cancelling all active background tasks for reset...")
|
self.log_signal.emit(" Cancelling all active background tasks for reset...")
|
||||||
self.cancellation_event.set() # Signal all threads to stop
|
self.cancellation_event.set()
|
||||||
|
|
||||||
# Initiate non-blocking shutdowns
|
|
||||||
if self.download_thread and self.download_thread.isRunning():
|
if self.download_thread and self.download_thread.isRunning():
|
||||||
self.download_thread.requestInterruption()
|
self.download_thread.requestInterruption()
|
||||||
if self.thread_pool:
|
if self.thread_pool:
|
||||||
@ -4731,9 +4729,8 @@ class DownloaderApp (QWidget ):
|
|||||||
if hasattr(self, 'retry_thread_pool') and self.retry_thread_pool:
|
if hasattr(self, 'retry_thread_pool') and self.retry_thread_pool:
|
||||||
self.retry_thread_pool.shutdown(wait=False, cancel_futures=True)
|
self.retry_thread_pool.shutdown(wait=False, cancel_futures=True)
|
||||||
self.retry_thread_pool = None
|
self.retry_thread_pool = None
|
||||||
|
|
||||||
self.cancellation_event.clear() # Reset the event for the next run
|
self.cancellation_event.clear()
|
||||||
# --- END OF MODIFIED PART ---
|
|
||||||
|
|
||||||
if self.pause_event:
|
if self.pause_event:
|
||||||
self.pause_event.clear()
|
self.pause_event.clear()
|
||||||
@ -4805,123 +4802,6 @@ class DownloaderApp (QWidget ):
|
|||||||
self.interrupted_session_data = None
|
self.interrupted_session_data = None
|
||||||
self.is_restore_pending = False
|
self.is_restore_pending = False
|
||||||
self.last_link_input_text_for_queue_sync = ""
|
self.last_link_input_text_for_queue_sync = ""
|
||||||
|
|
||||||
def _reset_ui_to_defaults(self):
|
|
||||||
"""Resets all UI elements and relevant state to their default values."""
|
|
||||||
self.link_input.clear()
|
|
||||||
self.custom_folder_input.clear()
|
|
||||||
self.character_input.clear()
|
|
||||||
self.skip_words_input.clear()
|
|
||||||
self.start_page_input.clear()
|
|
||||||
self.end_page_input.clear()
|
|
||||||
self.new_char_input.clear()
|
|
||||||
if hasattr(self, 'remove_from_filename_input'):
|
|
||||||
self.remove_from_filename_input.clear()
|
|
||||||
self.character_search_input.clear()
|
|
||||||
self.thread_count_input.setText("4")
|
|
||||||
if hasattr(self, 'manga_date_prefix_input'):
|
|
||||||
self.manga_date_prefix_input.clear()
|
|
||||||
self.radio_all.setChecked(True)
|
|
||||||
self.skip_zip_checkbox.setChecked(True)
|
|
||||||
self.download_thumbnails_checkbox.setChecked(False)
|
|
||||||
self.compress_images_checkbox.setChecked(False)
|
|
||||||
self.use_subfolders_checkbox.setChecked(False)
|
|
||||||
self.use_subfolder_per_post_checkbox.setChecked(True)
|
|
||||||
self.use_multithreading_checkbox.setChecked(True)
|
|
||||||
if self.favorite_mode_checkbox:
|
|
||||||
self.favorite_mode_checkbox.setChecked(False)
|
|
||||||
|
|
||||||
if hasattr(self, 'keep_duplicates_checkbox'):
|
|
||||||
self.keep_duplicates_checkbox.setChecked(False)
|
|
||||||
|
|
||||||
self.external_links_checkbox.setChecked(False)
|
|
||||||
if self.manga_mode_checkbox:
|
|
||||||
self.manga_mode_checkbox.setChecked(False)
|
|
||||||
if hasattr(self, 'use_cookie_checkbox'):
|
|
||||||
self.use_cookie_checkbox.setChecked(False)
|
|
||||||
self.selected_cookie_filepath = None
|
|
||||||
if hasattr(self, 'cookie_text_input'):
|
|
||||||
self.cookie_text_input.clear()
|
|
||||||
if self.main_log_output:
|
|
||||||
self.main_log_output.clear()
|
|
||||||
if self.external_log_output:
|
|
||||||
self.external_log_output.clear()
|
|
||||||
if self.missed_character_log_output:
|
|
||||||
self.missed_character_log_output.clear()
|
|
||||||
self.progress_label.setText(self._tr("progress_idle_text", "Progress: Idle"))
|
|
||||||
self.file_progress_label.setText("")
|
|
||||||
self.missed_title_key_terms_count.clear()
|
|
||||||
self.missed_title_key_terms_examples.clear()
|
|
||||||
self.logged_summary_for_key_term.clear()
|
|
||||||
self.already_logged_bold_key_terms.clear()
|
|
||||||
self.missed_key_terms_buffer.clear()
|
|
||||||
self.permanently_failed_files_for_dialog.clear()
|
|
||||||
self.only_links_log_display_mode = LOG_DISPLAY_LINKS
|
|
||||||
self.cancellation_message_logged_this_session = False
|
|
||||||
self.mega_download_log_preserved_once = False
|
|
||||||
self.allow_multipart_download_setting = False
|
|
||||||
self.skip_words_scope = SKIP_SCOPE_POSTS
|
|
||||||
self.char_filter_scope = CHAR_SCOPE_TITLE
|
|
||||||
self.manga_filename_style = STYLE_POST_TITLE
|
|
||||||
self.favorite_download_scope = FAVORITE_SCOPE_SELECTED_LOCATION
|
|
||||||
self._update_skip_scope_button_text()
|
|
||||||
self._update_char_filter_scope_button_text()
|
|
||||||
self._update_manga_filename_style_button_text()
|
|
||||||
self._update_multipart_toggle_button_text()
|
|
||||||
self._update_favorite_scope_button_text()
|
|
||||||
self.current_log_view = 'progress'
|
|
||||||
self.is_paused = False
|
|
||||||
if self.pause_event:
|
|
||||||
self.pause_event.clear()
|
|
||||||
|
|
||||||
self.external_link_queue.clear()
|
|
||||||
self.extracted_links_cache = []
|
|
||||||
self._is_processing_external_link_queue = False
|
|
||||||
self._current_link_post_title = None
|
|
||||||
if self.download_extracted_links_button:
|
|
||||||
self.download_extracted_links_button.setEnabled(False)
|
|
||||||
self.favorite_download_queue.clear()
|
|
||||||
self.is_processing_favorites_queue = False
|
|
||||||
self.current_processing_favorite_item_info = None
|
|
||||||
self.interrupted_session_data = None
|
|
||||||
self.is_restore_pending = False
|
|
||||||
self.last_link_input_text_for_queue_sync = ""
|
|
||||||
self._update_button_states_and_connections()
|
|
||||||
self.total_posts_to_process = 0
|
|
||||||
self.processed_posts_count = 0
|
|
||||||
self.download_counter = 0
|
|
||||||
self.skip_counter = 0
|
|
||||||
self.all_kept_original_filenames = []
|
|
||||||
if self.log_view_stack:
|
|
||||||
self.log_view_stack.setCurrentIndex(0)
|
|
||||||
if self.progress_log_label:
|
|
||||||
self.progress_log_label.setText(self._tr("progress_log_label_text", "📜 Progress Log:"))
|
|
||||||
if self.log_verbosity_toggle_button:
|
|
||||||
self.log_verbosity_toggle_button.setText(self.EYE_ICON)
|
|
||||||
self.log_verbosity_toggle_button.setToolTip("Current View: Progress Log. Click to switch to Missed Character Log.")
|
|
||||||
self.filter_character_list("")
|
|
||||||
self._handle_multithreading_toggle(self.use_multithreading_checkbox.isChecked())
|
|
||||||
self.update_ui_for_manga_mode(False)
|
|
||||||
self.update_custom_folder_visibility(self.link_input.text())
|
|
||||||
self.update_page_range_enabled_state()
|
|
||||||
self._update_cookie_input_visibility(False)
|
|
||||||
self._update_cookie_input_placeholders_and_tooltips()
|
|
||||||
self.download_btn.setEnabled(True)
|
|
||||||
self.cancel_btn.setEnabled(False)
|
|
||||||
if self.reset_button:
|
|
||||||
self.reset_button.setEnabled(True)
|
|
||||||
self.reset_button.setText(self._tr("reset_button_text", "🔄 Reset"))
|
|
||||||
self.reset_button.setToolTip(self._tr("reset_button_tooltip", "Reset all inputs and logs to default state (only when idle)."))
|
|
||||||
if hasattr(self, 'favorite_mode_checkbox'):
|
|
||||||
self._handle_favorite_mode_toggle(False)
|
|
||||||
if hasattr(self, 'scan_content_images_checkbox'):
|
|
||||||
self.scan_content_images_checkbox.setChecked(False)
|
|
||||||
if hasattr(self, 'download_thumbnails_checkbox'):
|
|
||||||
self._handle_thumbnail_mode_change(self.download_thumbnails_checkbox.isChecked())
|
|
||||||
|
|
||||||
self.set_ui_enabled(True)
|
|
||||||
self.log_signal.emit("✅ UI reset to defaults. Ready for new operation.")
|
|
||||||
self._update_button_states_and_connections()
|
|
||||||
|
|
||||||
def _show_feature_guide (self ):
|
def _show_feature_guide (self ):
|
||||||
steps_content_keys =[
|
steps_content_keys =[
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user