BallonsTranslator icon indicating copy to clipboard operation
BallonsTranslator copied to clipboard

Run on selected files.

Open heinrichI opened this issue 5 months ago • 14 comments

image

heinrichI avatar Aug 15 '25 08:08 heinrichI

awesome

bropines avatar Aug 15 '25 11:08 bropines

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)

heinrichI avatar Aug 15 '25 12:08 heinrichI

image

Here I also threw this with neurons and my own ideas. I can show the code (I have a different implementation)

bropines avatar Aug 16 '25 20:08 bropines

@dmMaze Should we push this to the repo?

bropines avatar Aug 16 '25 20:08 bropines

I have a different implementation

So maybe yours is better? Show.

heinrichI avatar Aug 16 '25 21:08 heinrichI

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

bropines avatar Aug 17 '25 19:08 bropines

https://disk.yandex.ru/i/FS3vKPQkb6xoMQ

Here's an example

bropines avatar Aug 17 '25 19:08 bropines

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()

heinrichI avatar Aug 19 '25 11:08 heinrichI

@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.

heinrichI avatar Aug 19 '25 11:08 heinrichI

@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 avatar Aug 19 '25 12:08 bropines

@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 avatar Aug 19 '25 13:08 bropines

@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".

heinrichI avatar Aug 19 '25 14:08 heinrichI

@bropines There is something wrong with your branch. When switching pages, the formatting, size and position of blocks are lost.

heinrichI avatar Aug 19 '25 17:08 heinrichI

@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

bropines avatar Aug 19 '25 19:08 bropines