This commit is contained in:
Yuvi9587
2025-07-13 21:45:30 -07:00
parent 21ecb60cb5
commit 6b57ee099d
3 changed files with 17 additions and 51 deletions

View File

@@ -893,6 +893,7 @@ class PostProcessorWorker:
total_downloaded_this_post =0
total_skipped_this_post =0
history_data_for_this_post =None
temp_filepath_for_return = None
parsed_api_url =urlparse (self .api_url_input )
referer_url =f"https://{parsed_api_url .netloc }/"
@@ -1297,10 +1298,12 @@ class PostProcessorWorker:
with open(temp_filepath, 'w', encoding='utf-8') as f:
json.dump(content_data, f, indent=2)
self.logger(f" Saved temporary text for '{post_title}' for single PDF compilation.")
return 0, 0, [], [], [], None, temp_filepath
self._emit_signal('worker_finished', (0, 0, [], [], [], None, temp_filepath)) # <--- CHANGE THIS
return (0, 0, [], [], [], None, temp_filepath)
except Exception as e:
self.logger(f" ❌ Failed to write temporary file for single PDF: {e}")
return 0, 0, [], [], [], None, None
self._emit_signal('worker_finished', (0, 0, [], [], [], [], None))
return (0, 0, [], [], [], [], None)
# --- Logic for Individual File Saving ---
else:
@@ -1747,12 +1750,8 @@ class PostProcessorWorker:
permanent_failures_this_post, history_data_for_this_post,
None) # The 7th item is None because we already saved the temp file
# In Single PDF mode, the 7th item is the temp file path we created.
if self.single_pdf_mode and os.path.exists(temp_filepath):
result_tuple = (0, 0, [], [], [], None, temp_filepath)
self._emit_signal('worker_finished', result_tuple)
return # The method now returns nothing.
return result_tuple
class DownloadThread (QThread ):
progress_signal =pyqtSignal (str )
@@ -1932,11 +1931,13 @@ class DownloadThread (QThread ):
# Initialize the shared counter to the next number, protected by a thread lock
self.manga_date_file_counter_ref = [highest_num + 1, threading.Lock()]
self.logger(f" [Thread] Manga Date Mode: Initialized date-based counter at {self.manga_date_file_counter_ref[0]}.")
pass
if self.manga_mode_active and self.manga_filename_style == STYLE_POST_TITLE_GLOBAL_NUMBERING and not self.extract_links_only and self.manga_global_file_counter_ref is None:
# Initialize the shared counter at 1, protected by a thread lock
self.manga_global_file_counter_ref = [1, threading.Lock()]
self.logger(f" [Thread] Manga Title+GlobalNum Mode: Initialized global counter at {self.manga_global_file_counter_ref[0]}.")
pass
worker_signals_obj = PostProcessorSignals()
try:
@@ -2084,6 +2085,7 @@ class DownloadThread (QThread ):
# Emit the final signal with all collected results
self.finished_signal.emit(grand_total_downloaded_files, grand_total_skipped_files, self.isInterruptionRequested(), grand_list_of_kept_original_filenames)
def receive_add_character_result (self ,result ):
with QMutexLocker (self .prompt_mutex ):
self ._add_character_response =result

View File

@@ -22,7 +22,7 @@ class MoreOptionsDialog(QDialog):
layout.addWidget(self.description_label)
self.radio_button_group = QButtonGroup(self)
self.radio_content = QRadioButton("Description/Content")
self.radio_comments = QRadioButton("Comments (Not Working)")
self.radio_comments = QRadioButton("Comments")
self.radio_button_group.addButton(self.radio_content)
self.radio_button_group.addButton(self.radio_comments)
layout.addWidget(self.radio_content)

View File

@@ -2683,26 +2683,17 @@ class DownloaderApp (QWidget ):
format_display = f" ({self.text_export_format.upper()})"
if self.single_pdf_setting:
format_display = " (Single PDF)"
# Store original multithreading state before unchecking
self._original_multithreading_state = self.use_multithreading_checkbox.isChecked() if hasattr(self, 'use_multithreading_checkbox') else False
# --- NEW: Disable checkboxes if Single PDF is active ---
if hasattr(self, 'use_multithreading_checkbox'):
self.use_multithreading_checkbox.setChecked(False) # Explicitly UNCHECK IT
self.use_multithreading_checkbox.setEnabled(False) # Disable the checkbox
self.thread_count_input.setEnabled(False) # Disable thread count input
self.thread_count_label.setEnabled(False) # Disable thread count label
self.log_signal.emit(" Multithreading disabled for text-only mode to ensure sequential processing and proper PDF compilation.")
self.use_multithreading_checkbox.setChecked(False)
self.use_multithreading_checkbox.setEnabled(False)
if hasattr(self, 'use_subfolders_checkbox'):
self.use_subfolders_checkbox.setChecked(False)
self.use_subfolders_checkbox.setEnabled(False)
else:
# Re-enable based on its original state if it wasn't a single PDF request
if hasattr(self, 'use_multithreading_checkbox'):
self.use_multithreading_checkbox.setEnabled(True)
# Call the handler to update its text and thread count input state
self._handle_multithreading_toggle(self.use_multithreading_checkbox.isChecked())
if hasattr(self, 'use_subfolders_checkbox'):
self.use_subfolders_checkbox.setEnabled(True)
# --- NEW: Re-enable checkboxes if Single PDF is not active ---
if hasattr(self, 'use_multithreading_checkbox'): self.use_multithreading_checkbox.setEnabled(True)
if hasattr(self, 'use_subfolders_checkbox'): self.use_subfolders_checkbox.setEnabled(True)
self.radio_more.setText(f"{scope_text}{format_display}")
@@ -2712,33 +2703,6 @@ class DownloaderApp (QWidget ):
else:
self.log_signal.emit(" 'More' filter selection cancelled. Reverting to 'All'.")
self.radio_all.setChecked(True)
# Restore original multithreading state if the dialog was cancelled and we revert to 'All'
if hasattr(self, 'use_multithreading_checkbox'):
self.use_multithreading_checkbox.setEnabled(True)
# Restore previous checked state of multithreading checkbox
if hasattr(self, '_original_multithreading_state'):
self.use_multithreading_checkbox.setChecked(self._original_multithreading_state)
del self._original_multithreading_state # Clean up the stored state
self.thread_count_input.setEnabled(True)
self.thread_count_label.setEnabled(True)
self._handle_multithreading_toggle(self.use_multithreading_checkbox.isChecked())
if hasattr(self, 'use_subfolders_checkbox'):
self.use_subfolders_checkbox.setEnabled(True)
# If a button other than "More" is selected, reset the UI or ensure multithreading is re-enabled.
elif button != self.radio_more and checked:
self.radio_more.setText("More")
self.more_filter_scope = None
self.single_pdf_setting = False # Reset the setting
# Re-enable the checkboxes
if hasattr(self, 'use_multithreading_checkbox'):
self.use_multithreading_checkbox.setEnabled(True)
# Restore previous checked state if it exists
if hasattr(self, '_original_multithreading_state'):
self.use_multithreading_checkbox.setChecked(self._original_multithreading_state)
del self._original_multithreading_state # Clean up
self._handle_multithreading_toggle(self.use_multithreading_checkbox.isChecked())
if hasattr(self, 'use_subfolders_checkbox'):
self.use_subfolders_checkbox.setEnabled(True)
def delete_selected_character (self ):
global KNOWN_NAMES
@@ -3828,7 +3792,7 @@ class DownloaderApp (QWidget ):
'manga_global_file_counter_ref','manga_date_prefix',
'manga_mode_active','unwanted_keywords','manga_filename_style','scan_content_for_images',
'allow_multipart_download','use_cookie','cookie_text','app_base_dir','selected_cookie_file','override_output_dir','project_root_dir',
'text_only_scope', 'text_export_format',
'text_only_scope',
'single_pdf_mode'
]
args_template ['skip_current_file_flag']=None