fix: pass selected cache path to conversion worker
- Worker now accepts cache_path parameter - _start_conversion passes the selected path to worker - Fixes 'Cache folder not found' error during conversion
This commit is contained in:
parent
681b07688c
commit
46e84b39e3
|
|
@ -29,15 +29,20 @@ class TGAConvertWorker(QThread):
|
||||||
conversion_complete = pyqtSignal(int, int) # success_count, total_count
|
conversion_complete = pyqtSignal(int, int) # success_count, total_count
|
||||||
conversion_error = pyqtSignal(str)
|
conversion_error = pyqtSignal(str)
|
||||||
|
|
||||||
def __init__(self, converter: TGAConverter):
|
def __init__(self, converter: TGAConverter, cache_path: Optional[Path] = None):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.converter = converter
|
self.converter = converter
|
||||||
|
self.cache_path = cache_path
|
||||||
self._is_running = True
|
self._is_running = True
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Run the conversion."""
|
"""Run the conversion."""
|
||||||
try:
|
try:
|
||||||
# Find cache folder
|
# Use provided cache path or find it
|
||||||
|
if self.cache_path and self.cache_path.exists():
|
||||||
|
cache_path = self.cache_path
|
||||||
|
self.progress_update.emit(f"Using cache folder: {cache_path}")
|
||||||
|
else:
|
||||||
self.progress_update.emit("Finding cache folder...")
|
self.progress_update.emit("Finding cache folder...")
|
||||||
cache_path = self.converter.find_cache_folder()
|
cache_path = self.converter.find_cache_folder()
|
||||||
|
|
||||||
|
|
@ -281,8 +286,9 @@ class TGAConverterDialog(QDialog):
|
||||||
self.results_list.clear()
|
self.results_list.clear()
|
||||||
self.converted_files = []
|
self.converted_files = []
|
||||||
|
|
||||||
# Start worker
|
# Start worker with the selected cache path
|
||||||
self.convert_worker = TGAConvertWorker(self.converter)
|
cache_path = self.converter._cache_path if self.converter._cache_path else None
|
||||||
|
self.convert_worker = TGAConvertWorker(self.converter, cache_path)
|
||||||
self.convert_worker.progress_update.connect(self._on_progress)
|
self.convert_worker.progress_update.connect(self._on_progress)
|
||||||
self.convert_worker.file_converted.connect(self._on_file_converted)
|
self.convert_worker.file_converted.connect(self._on_file_converted)
|
||||||
self.convert_worker.conversion_complete.connect(self._on_conversion_complete)
|
self.convert_worker.conversion_complete.connect(self._on_conversion_complete)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue