Run on selected files.
awesome
I don't like how the processing is done through page and page_index in on_pagtrans_finished, but I don't want to make more large-scale changes.
def on_pagtrans_finished(self, page: str):
keys_list = list(self.imgtrans_proj.pages.keys())
page_index = keys_list.index(page)
Here I also threw this with neurons and my own ideas. I can show the code (I have a different implementation)
@dmMaze Should we push this to the repo?
I have a different implementation
So maybe yours is better? Show.
I have a different implementation
So maybe yours is better? Show.
https://github.com/bropines/BallonsTranslator/commit/035d72e220375310903aacd8b674c77e4e500326
and this
https://github.com/bropines/BallonsTranslator/commit/849f1febea3645dd4007f1d7e5d72c7c5cd525a8
https://disk.yandex.ru/i/FS3vKPQkb6xoMQ
Here's an example
I would encapsulate the selected items in the signal data
run_on_selected = Signal(),
so there is no need to call
selected_items = self.pageList.selectedItems()
@bropines on translation:
Traceback (most recent call last):
File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 517, in run
self.job()
File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 315, in
On OCR:
Exception has occurred: NameError
name 'unload_modules' is not defined
File "J:\Comic translate\BallonsTranslator\ui\mainwindow.py", line 1103, in on_imgtrans_pipeline_finished
self.module_manager.unload_all_models()
File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 776, in finishImgtransPipeline
self.imgtrans_pipeline_finished.emit()
File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 734, in on_update_ocr_progress
self.finishImgtransPipeline()
File "J:\Comic translate\BallonsTranslator\launch.py", line 290, in main
sys.exit(app.exec())
File "J:\Comic translate\BallonsTranslator\launch.py", line 348, in
I tested your repository.
@bropines on translation: Traceback (most recent call last): File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 517, in run self.job() File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 315, in self.job = lambda: self._imgtrans_pipeline_selection(page_keys) File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 480, in _imgtrans_pipeline_selection self._process_single_page(imgname) File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 424, in _process_single_page elif not self.low_vram_trans: AttributeError: 'ImgtransThread' object has no attribute 'low_vram_trans'
On OCR: Exception has occurred: NameError name 'unload_modules' is not defined File "J:\Comic translate\BallonsTranslator\ui\mainwindow.py", line 1103, in on_imgtrans_pipeline_finished self.module_manager.unload_all_models() File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 776, in finishImgtransPipeline self.imgtrans_pipeline_finished.emit() File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 734, in on_update_ocr_progress self.finishImgtransPipeline() File "J:\Comic translate\BallonsTranslator\launch.py", line 290, in main sys.exit(app.exec()) File "J:\Comic translate\BallonsTranslator\launch.py", line 348, in main() NameError: name 'unload_modules' is not defined
I tested your repository.
I fix it
@bropines on translation: Traceback (most recent call last): File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 517, in run self.job() File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 315, in self.job = lambda: self._imgtrans_pipeline_selection(page_keys) File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 480, in _imgtrans_pipeline_selection self._process_single_page(imgname) File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 424, in _process_single_page elif not self.low_vram_trans: AttributeError: 'ImgtransThread' object has no attribute 'low_vram_trans'
On OCR: Exception has occurred: NameError name 'unload_modules' is not defined File "J:\Comic translate\BallonsTranslator\ui\mainwindow.py", line 1103, in on_imgtrans_pipeline_finished self.module_manager.unload_all_models() File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 776, in finishImgtransPipeline self.imgtrans_pipeline_finished.emit() File "J:\Comic translate\BallonsTranslator\ui\module_manager.py", line 734, in on_update_ocr_progress self.finishImgtransPipeline() File "J:\Comic translate\BallonsTranslator\launch.py", line 290, in main sys.exit(app.exec()) File "J:\Comic translate\BallonsTranslator\launch.py", line 348, in main() NameError: name 'unload_modules' is not defined
I tested your repository.
try
@bropines So, I managed to work with your version, it works. Passing page names looks nicer than my dictionary pass. The only thing is, as I said, it is better when there are fewer calls to global variables and replace the call to pageList.selectedItems() with the transfer of selected pages to the signal "run_on_selected".
@bropines There is something wrong with your branch. When switching pages, the formatting, size and position of blocks are lost.
@bropines There is something wrong with your branch. When switching pages, the formatting, size and position of blocks are lost.
Can I have a video? I didn't touch it... You seem to have my telegram. Write to me there. Because PR is not very convenient for such discussions