michaldaniel / ebook-viewer

Modern GTK Python Ebook Reader app to easily read epub files
GNU General Public License v3.0
406 stars 47 forks source link

WebKit2? #34

Open quozl opened 7 years ago

quozl commented 7 years ago

G'day Michal,

For your interest, I'm maintaining another viewer, the Read activity at Sugar Labs, which is bundled on the One Laptop per Child laptops. Our viewer like yours is Python GTK+ and uses WebKit to render EPUB files, and also uses Evince to render PDF files. See User Manual.

We're faced with the impending doom of obsolescence of the WebKit 3.0 API. Are you planning a port to WebKit2 4.0 API?

ghost commented 6 years ago

I looked a bit into this, porting should be straightforward, except for saving the scroll position.. that's gonna be a huge pain

quozl commented 6 years ago

Thanks. Yes, having control of scroll position was a huge pain, requiring asynchronous JavaScript, and I gave up on it after a week or so, ended up removing EPUB support from Read activity in Sugar, sadly.

fabiocolacio commented 6 years ago

@quozl @ghost, I maintain a markdown editor called Marker, which uses webkit2gtk-4.0 for a live HTML preview.

I too struggled a lot with controlling the scroll position using Javascript. I was having an issue where refreshing the web page would scroll to the top, and I wanted the page position to be saved. I eventually found a relatively simple solution, by writing a WebExtension.

Here is one of the first working versions of that WebExtension for reference.

Maybe this can help you out?

quozl commented 6 years ago

Thanks @fabiocolacio!

ArhantJain commented 6 years ago

Is this issue open? If Yes, plz guide me, about solving.

quozl commented 6 years ago

@ArhantJain, you will see in https://github.com/michaldaniel/Ebook-Viewer/blob/52c9d0f530557882b254f38c2eac68e25d930155/src/components/viewer.py#L19 that WebKit 3.0 API is still used. Suggested steps for solving;

ghost commented 6 years ago

For what it's worth, I just tried to install Ebook-Viewer on Fedora but I can't figure out how to do it since there's only webkitgtk4 as a package...

Is there any workaround for this?

quozl commented 6 years ago

Not really. Fedora dropped WebKit 3.0 API. You might rebuild the packages from an older release, but it will get harder and harder to do this as Fedora changes.