Giter Club home page Giter Club logo

read-activity's Introduction

What is this?

Read activity allows the laptop to act as a book reader. It has a simple interface, and will view many kinds of text and image-based book-like materials.

How to use?

Read is part of the Sugar desktop. Please refer to;

Branches

  • use master branch for Fedora and Debian systems, with Python 3 and WebKit2 API, such as Ubuntu 20.04,
  • use python2 branch and version series v122.x for Fedora and Debian systems, with Python 2 and WebKit2 API, such as Ubuntu 18.04,
  • use fedora18 branch and version series v118.x for Fedora 18 systems, with Python 2 and WebKit API.

read-activity's People

Contributors

ayushnawal avatar clytie avatar dcbw avatar erikos avatar godiard avatar heeres avatar hoboprimate avatar hrishi1999 avatar humitos avatar iamutkarshtiwari avatar icarito avatar jdsimmons avatar khaledhosny avatar korakurider avatar leonardcj avatar lkundrak avatar lucian1900 avatar manuq avatar mslg avatar pootle-sugarlabs avatar quozl avatar rdrsadhu avatar rhl-bthr avatar samdroid-apps avatar sayamindu avatar shaansubbaiah avatar silbe avatar tchx84 avatar tomeuv avatar vipulgupta2048 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

read-activity's Issues

AttributeError: 'JavascriptResult' object has no attribute 'get_js_value'

Read-122.1 does not scroll an epub when used on Ubuntu 16.04 (xenial). Logs contain

Traceback (most recent call last):
  File "/usr/share/sugar/activities/Read.activity/epubview/widgets.py", line 101, in callback
    res[0] = result.get_js_value().to_string()
AttributeError: 'JavascriptResult' object has no attribute 'get_js_value'

Workaround is to upgrade to Ubuntu 18.04 (bionic).

ZeroDivisionError: float division by zero

Scrolling an EPUB may cause traceback;

Traceback (most recent call last):
  File "/usr/share/sugar/activities/Read.activity/epubview/epubview.py", line 369, in _view_scrolled_cb
    scrollfactor = scrollval / (scroll_upper - scroll_page_size)
ZeroDivisionError: float division by zero

Fail to resume journal object of content type application/pdf

Traceback (most recent call last):
  File "/usr/bin/sugar-activity3", line 5, in <module>
    activityinstance.main()
  File "/usr/lib/python3.7/dist-packages/sugar3/activity/activityinstance.py", line 230, in main
    instance = create_activity_instance(activity_constructor, activity_handle)
  File "/usr/lib/python3.7/dist-packages/sugar3/activity/activityinstance.py", line 59, in create_activity_instance
    activity = constructor(handle)
  File "/home/guest/Activities/Read.activity/readactivity.py", line 372, in __init__
    self.read_file(self._jobject.file_path)
  File "/home/guest/Activities/Read.activity/readactivity.py", line 737, in read_file
    self._load_document('file://' + tempfile)
  File "/home/guest/Activities/Read.activity/readactivity.py", line 1008, in _load_document
    self.filehash = get_md5(filepath)
  File "/home/guest/Activities/Read.activity/readactivity.py", line 99, in get_md5
    buf = fh.read(4096)
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 10: invalid continuation byte

Reproducer: use Browse to view a PDF file from a web server or local filesystem, click on Save PDF to Journal, close Browse, view Journal, click on PDF file.

Add touch scrolling

On EPUB viewer, touching the screen does nothing.

On PDF viewer, sometimes touching the screen scrolls, sometimes it starts a drag and drop operation.

Test items were Pride and Prejudice, by Jane Austen, from Feedbooks and Internet Archive, using the Get Books activity.

Release new version.

The current version on aslo is v119, while v120 comes with sucrose. So it is necessary to release the latest version.
@nswarup14 you might be interested. Thanks!

add back EPUB support

EPUB support was removed from Read because of port complexity and nobody available to do it.

EPUB support could be added by either;

  • reverting the commit and port the code to WebKit2 API,
  • using Gepub via PyGObject introspection,
  • using MuPDF.

Steps;

  • someone interested in doing this,
  • a separate branch, epub,
  • initial prototype,
  • testing by others,
  • merge back into master and release.

Fail to resume text/plain object

Reproducer: create a content-type text/plain object, e.g. a text clipping, or a .txt file from Documents, show the journal, right-click on the object, and select Start with, then Read.

Expected result: text shown

Observed result: fail to start, with logs;

Traceback (most recent call last):
  File "/usr/share/sugar/activities/Read.activity/readactivity.py", line 373, in __init__
    self.read_file(self._jobject.file_path)
  File "/usr/share/sugar/activities/Read.activity/readactivity.py", line 742, in read_file
    self._load_document('file://' + tempfile)
  File "/usr/share/sugar/activities/Read.activity/readactivity.py", line 1005, in _load_document
    self._view.load_document(filepath)
  File "/usr/share/sugar/activities/Read.activity/textadapter.py", line 133, in load_document
    self.set_current_page(0)
  File "/usr/share/sugar/activities/Read.activity/textadapter.py", line 349, in set_current_page
    self._show_page(self._current_page)
  File "/usr/share/sugar/activities/Read.activity/textadapter.py", line 152, in _show_page
    label_text = label_text + str(line,  "iso-8859-1")
TypeError: decoding str is not supported
Exited with status 1, pid 31355 activity_id 8dc4e46bf9c56c8db3d6c1e29977efa4a10910e5

Add dark mode for PDFs

Evince has an Inverted Colours toggle in the File options with a shortcut of ctrl+i. Add the same shortcut to invert colours when viewing a PDF with Read.

Format string with unnamed arguments

setup.py genpot does this;

readactivity.py:1036: warning: 'msgid' format string with unnamed arguments cannot be properly localized:
                               The translator cannot reorder the arguments.
                               Please consider using a format string with named arguments,
                               and a mapping instead of a tuple for the arguments.
readactivity.py:1228: warning: 'msgid' format string with unnamed arguments cannot be properly localized:
                               The translator cannot reorder the arguments.
                               Please consider using a format string with named arguments,
                               and a mapping instead of a tuple for the arguments.

Logged in case anyone else wants to fix it.

traceback on inconsistent journal object type and content

When a journal object with MIME-type set to application/pdf actually contains text/plain, Read reports this log;

1536845187.043496 ERROR read-activity: Can not load document:
  ev-document-error-quark: File type plain text document (text/plain) is not supported (0)

Traceback (most recent call last):
  File "/usr/bin/sugar-activity", line 219, in <module>
    main()
  File "/usr/bin/sugar-activity", line 214, in main
    instance = create_activity_instance(activity_constructor, activity_handle)
  File "/usr/bin/sugar-activity", line 48, in create_activity_instance
    activity = constructor(handle)
  File "/home/ibiam/Activities/read-activity/readactivity.py", line 366, in __init__
    self.read_file(self._jobject.file_path)
  File "/home/ibiam/Activities/read-activity/readactivity.py", line 731, in read_file
    self._load_document('file://' + tempfile)
  File "/home/ibiam/Activities/read-activity/readactivity.py", line 1033, in _load_document
    self._update_toc()
  File "/home/ibiam/Activities/read-activity/readactivity.py", line 611, in _update_toc
    if self._view.update_toc(self):
  File "/home/ibiam/Activities/read-activity/evinceadapter.py", line 278, in update_toc
    if not doc.has_document_links():
AttributeError: 'NoneType' object has no attribute 'has_document_links'

Reported by @chimosky.

Workaround; delete the journal object, it is corrupt. If the journal object can be created by any activity, then that other activity should be fixed.

Port to WebKit2 4.0 API

Read uses for EPUB viewing the WebKit 3.0 API, based on WebKit 2.4, which is unmaintained and dangerous. Port to WebKit2 4.0 API based on WebKit 2.16 or later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.