View Single Post
Old 05-31-2025, 09:11 AM   #1
suprezg
Junior Member
suprezg began at the beginning.
 
suprezg's Avatar
 
Posts: 4
Karma: 10
Join Date: May 2025
Device: none
Seeking Guidance on Modularizing Calibre's Ebook Viewer and Organizing Source Code

I am currently working on a fork of Calibre and want to separate all code and files related solely to the ebook viewer into a dedicated directory. My goal is to make the viewer runnable as a standalone application by executing main.py from src/calibre/gui2/viewer.

If this separation is not feasible, I would like to know how I can write my own viewer that leverages Calibre’s ebook viewer features, such as read aloud, search, highlights, and bookmarks. Which classes or modules should I study so I can invoke these functionalities from my own code?

Additionally, I have noticed that running python -m src.calibre.gui2.viewer.main results in errors like "polyglot module not found," and even after fixing that, other errors appear. However, running calibre-debug -c "from calibre.gui2.viewer.main import main; main()" works fine and launches the viewer. What does calibre-debug do in the backend to make this work, and how can I replicate this behavior in my own setup?

Are there any tips or sources available for organizing the Calibre source code?

Any guidance or insights would be helpful!!!
suprezg is offline   Reply With Quote