Git Product home page Git Product logo

ccbc's Introduction

CCBC

Download:

Please see the release page.

About:

CCBC is based on Anki 2.1.15's backend and 2.0.52's frontend code. It uses QtWebkit which is licensed under AGPL. This is essentially upgrading 2.0 to python 3.

Use cases of QtWebKit: https://github.com/annulen/webkit/wiki/Use-cases-of-QtWebKit

Why QWebEngine is bad for IR?

I find that QWebEngine is too sluggish for ebook reading. After importing any uncompressed 200kb file or "The Complete History of Supermemo" or "Supermemo 20 Rules", the webpage really starts to lag behind and in some cases freeze five seconds after every extraction.

"setHtml works by converting the html code you provide to percent-encoding, putting data: in front and using it as url which it navigates to, so the html code you provide becomes a url which exceeds the 2mb limit." Source

In other words, a 100kb webpage with the space character encoded as "%20", as well as user highlights and annotations added on top could potentially become more than 2MB, freezing Anki as a result.

Correction: I was not referring to the current version of IR. The current public version, IR v4 maintaied by luoliyan, does not use "setHtml" and should not be affected by this problem.

Naming:

What does CCBC stand for?
Cannabis & Coffee; Breakfast of Champions.

What is an adze?
An adze is a tool used in woodworking that is extremely cheap to make and could be purchased for a buck at Dollar Generals. However, to make it right, and not scratch up the surface of the project, is a craftmanship in itself. They are hard to come by even for those willing to pay. Similarly, plugins are cheap to make, but to do it right is difficult and time consuming. For that reason, CCBC addons end with a .adze extension.

Sync:

Sync has been disabled, but can be enabled for custom servers using modules.

Addons:

Some reasonable addons are integrated into CCBC.

See: https://github.com/lovac42/CCBC/blob/master/doc/addons.md

Zooming:

Fullscreen (F11) and zooming is builtin. Use Ctrl++/Ctrl+- to zoom-in/out or add Shift for finer control.

Zoom adjustments are saved per card model based on front or back view. IR cards are saved per card.

Multi AddCard Dialog:

Allows opening of multiple addcard dialogs for entering cards to different decks or with different tags.

Portable mode, windows only:

Portable mode is enabled if a file named portable.dat is in the ccbc.exe folder at the time it launches. All user data are stored in a folder called Data.

Multiple instances:

CCBC allows multiple instances on different profiles to be run on the same system.

Drag and drop:

Drag and drop for imports and addons.

Shuffle or Show Next Card Button:

Added a small button to drop current card from the reviewer. The card will re-appear again in a few moments, this helps to alleviate tip-of-the-tongue phenomenons without failing the card in the event of a temporary mental lapse. The shuffling will be performed by the Hoochie addons if available.

Hotkey: CTRL+Enter (on question side only)

Lightbox:

Lightbox allows zooming in on small images without resizing. All images in the reviewer are affected.

Screenshots:

ccbc's People

Contributors

lovac42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hqlulu

ccbc's Issues

ccbc\media.py - showWarning is not imported

I noticed by putting a lot of html source code in the edit html window where I got this message:

Anki 2.1.13_ccbc (eef86bf3) Python 3.7.3 Qt 4.8.7 PyQt 4.11.4
Platform: Windows 10
Flags: frz=True ao=False sv=1

Caught exception:
File "aqt\editor.py", line 430, in onHtmlEdit
File "html\parser.py", line 111, in feed
File "html\parser.py", line 171, in goahead
File "html\parser.py", line 345, in parse_starttag
File "ccbc\cleaner.py", line 58, in handle_starttag
File "ccbc\cleaner.py", line 100, in importMedia
File "ccbc\media.py", line 51, in handle_resource
File "ccbc\media.py", line 76, in importImg
<class 'NameError'>: name 'showWarning' is not defined

image download and UnicodeEncodeError, continuation of #7

I tried in Fedora30 with the version from the latest commit 28a1b23.

I made a new topic because #7 also contained some general discussions.

I still get the download error I reported in #7: <class 'UnicodeEncodeError'>: 'ascii' codec can't encode characters in position 34-45: ordinal not in range(128). The full error message I get is at [1]. I found this error when I tried to copy and paste the contents of the print version of the wikipedia article about Tokyo into CCBC.

I put print(url) into the source code of _retrieveURL. I found that the error occurs when the method _retrieveURL(self, url) gets https://upload.wikimedia.org/wikipedia/commons/thumb/9/96/多摩ニュータウンの全景(2013年10月12日撮影).jpg/602px-多摩ニュータウンの全景(2013年10月12日撮影).jpg as the url argument. If I copy&paste this address into CCBC I get the error message.

I can't reproduce this problem with Anki 2.1.14.


[1]

Error
An error occurred. Please use Tools > Check Database to see if that fixes the problem. 
If problems persist, you are SOL.
Anki 2.1.13_ccbc (0.0.4) Python 3.7.3 Qt 4.8.7 PyQt 4.12.3
Platform: Linux
Flags: frz=False ao=False sv=1

Caught exception:
File "/home/myuser/CCBC/aqt/editor.py", line 185, in <lambda>
    s.connect(s, SIGNAL("activated()"), lambda:self.web.onPaste(True))
File "/home/myuser/CCBC/aqt/editor.py", line 887, in onPaste
    mime = self.mungeClip()
File "/home/myuser/CCBC/aqt/editor.py", line 944, in mungeClip
    mime = self._processMime(mime)
File "/home/myuser/CCBC/aqt/editor.py", line 974, in _processMime
    return self._processHtml(mime)
File "/home/myuser/CCBC/aqt/editor.py", line 1050, in _processHtml
    html = self.editor._filterHTML(html, localize=True)
File "/home/myuser/CCBC/aqt/editor.py", line 774, in _filterHTML
    fname = self.urlToFile(src)
File "/home/myuser/CCBC/aqt/editor.py", line 643, in urlToFile
    return self._retrieveURL(url)
File "/home/myuser/CCBC/aqt/editor.py", line 684, in _retrieveURL
    filecontents = urllib.request.urlopen(req).read()
File "/usr/lib64/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
File "/usr/lib64/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
File "/usr/lib64/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
File "/usr/lib64/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
File "/usr/lib64/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
File "/usr/lib64/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib64/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib64/python3.7/http/client.py", line 1255, in _send_request
    self.putrequest(method, url, **skips)
File "/usr/lib64/python3.7/http/client.py", line 1122, in putrequest
    self._output(request.encode('ascii'))
<class 'UnicodeEncodeError'>: 'ascii' codec can't encode characters in position 34-45: ordinal not in range(128)

various errors in linux

I don't know if this is interesting for you since I didn't use your compiled version but I ran from source in Fedora 30 which still has python3-PyQt4-webkit. I just wanted to see the speed difference for long cards during review. Maybe these errors are platform specific. If so don't waste your time on these.

On Linux besides the files from requirements.txt I also needed jsonschema and six

 

P.S.: One of the main reasons you stated for creating CCBC is that Anki 2.1 is slow for incremental reading. CCBC is a lot of work and still you created it. So you must love incremental reading. I'm very eager to see your workflow. I think you haven't published this anywhere? I'm sure other people would benefit, too.

I also like IR and I don't use the Anki incremental reading add-on because for me IR always means heavily editing the text. Since I saw the "Edit Field during Review" add-on in January I want to achieve this with a wysiwyg editor for use during reviews, see e.g. here. As an editor I use tinymce. So far I haven't managed to reliably load it into the anki reviewer. At the moment I think I'll use a separate window which would make it easier to adjust the decks I send my extracts to and how I schedule them. I still work on these features - so far only the window that loads and displays a card is finished: extended table editor. This can be opened from the editor to modify the contents of a field.

I got this error when I tried to copy & paste the article about Tokyo (the Capital) from the english wikipedia into CCBC. While I saw the image processing progress dialogs I got:

Error
An error occurred. Please use Tools > Check Database to see if that fixes the problem. 
If problems persist, you are SOL.
Anki 2.1.13_ccbc (eef86bf3) Python 3.7.3 Qt 4.8.7 PyQt 4.12.3
Platform: Linux
Flags: frz=False ao=False sv=1

Caught exception:
  File "/home/myuser/CCBC/aqt/editor.py", line 185, in <lambda>
    s.connect(s, SIGNAL("activated()"), lambda:self.web.onPaste(True))
  File "/home/myuser/CCBC/aqt/editor.py", line 887, in onPaste
    mime = self.mungeClip()
  File "/home/myuser/CCBC/aqt/editor.py", line 944, in mungeClip
    mime = self._processMime(mime)
  File "/home/myuser/CCBC/aqt/editor.py", line 974, in _processMime
    return self._processHtml(mime)
  File "/home/myuser/CCBC/aqt/editor.py", line 1050, in _processHtml
    html = self.editor._filterHTML(html, localize=True)
  File "/home/myuser/CCBC/aqt/editor.py", line 774, in _filterHTML
    fname = self.urlToFile(src)
  File "/home/myuser/CCBC/aqt/editor.py", line 643, in urlToFile
    return self._retrieveURL(url)
  File "/home/myuser/CCBC/aqt/editor.py", line 684, in _retrieveURL
    filecontents = urllib.request.urlopen(req).read()
  File "/usr/lib64/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib64/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/lib64/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib64/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib64/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.7/http/client.py", line 1255, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/lib64/python3.7/http/client.py", line 1122, in putrequest
    self._output(request.encode('ascii'))
<class 'UnicodeEncodeError'>: 'ascii' codec can't encode characters in position 34-45: ordinal not in range(128)

After closing this warning when I try to close the add dialog I get another error. I think at this time I had already closed the main window. But this same error message sometimes also appears if during reviews I click on Add and add some notes and try to close the window.

Error
An error occurred. Please use Tools > Check Database to see if that fixes the problem. 
If problems persist, you are SOL.
Anki 2.1.13_ccbc (eef86bf3) Python 3.7.3 Qt 4.8.7 PyQt 4.12.3
Platform: Linux
Flags: frz=False ao=False sv=?

Caught exception:
  File "/home/myuser/CCBC/aqt/addcards.py", line 234, in reject
    self.editor.setNote(None)
  File "/home/myuser/CCBC/aqt/editor.py", line 319, in setNote
    self.hideCompleters()
  File "/home/myuser/CCBC/aqt/editor.py", line 488, in hideCompleters
    self.tags.hideCompleter()
  File "/home/myuser/CCBC/aqt/tagedit.py", line 85, in hideCompleter
    if sip.isdeleted(self.completer):
<class 'TypeError'>: isdeleted() argument 1 must be sip.simplewrapper, not TagCompleter

Run on Parabola GNU/Linux

Hello,
I am trying to run CCBC on Parabola GNU/Linux ( a free ArchLinux derivative).
I installed the requirements with:

sudo pacman -S python-beautifulsoup4 python-send2trash python-pyaudio python-requests python-decorator python-markdown

Then tried to ./runanki:

  File "./runanki", line 3, in <module>
    import aqt
  File "/home/user/CCBC/aqt/__init__.py", line 16, in <module>
    from aqt.qt import *
  File "/home/user/CCBC/aqt/qt.py", line 10, in <module>
    import sip
ModuleNotFoundError: No module named 'sip'

So I installed python-sip.
After this, pyqt4 was still missing:

Traceback (most recent call last):
  File "./runanki", line 3, in <module>
    import aqt
  File "/home/user/CCBC/aqt/__init__.py", line 16, in <module>
    from aqt.qt import *
  File "/home/user/CCBC/aqt/qt.py", line 13, in <module>
    from anki.utils import isWin, isMac
  File "/home/user/CCBC/anki/__init__.py", line 14, in <module>
    from anki.storage import Collection
  File "/home/user/CCBC/anki/storage.py", line 13, in <module>
    from ccbc.collection import _ExtCollection
  File "/home/user/CCBC/ccbc/collection.py", line 19, in <module>
    from ccbc.media import ExtMediaManager
  File "/home/user/CCBC/ccbc/media.py", line 19, in <module>
    from ccbc.utils import isURL, isDataURL
  File "/home/user/CCBC/ccbc/utils.py", line 10, in <module>
    from PyQt4 import QtCore, QtGui
ModuleNotFoundError: No module named 'PyQt4'

Parabola/Arch provides https://www.parabola.nu/packages/community/x86_64/python-qtpy/ which "Provides an uniform layer to support PyQt5, PyQt4 and PySide with a single codebase".

Installing it, did not help.

Parabola/Arch currently support pyqt5, I think the support for pyqt5 is dropped. Is there any way for me to get CCBC running? Or are there any plans to update to pyqt5?

Thanks alot!

error in Add window in Fedora Linux 30

I don't get this error in Windows with the binary you provided CCBC_Win_x64_v0.0.4_beta.7z.

So this is maybe out of scope and maybe there's something about my dependencies on my system. But maybe you have an idea? Thanks.

 

I tested in Fedora 30 with the latest commit 81300a9 (Anki 2.1.14_ccbc (0.0.4) Python 3.7.3 Qt 4.8.7 PyQt 4.12.3. ) and an empty profile without add-ons: After adding the first note I get these errors: https://streamable.com/iy2f1

I looked at the sourcecode and don't really understand the sip module and the line if sip.isdeleted(self.completer). I commented out this if-loop and so far (a few hours) I haven't seen any problems. This if-loop was added last year to counter some occasional errors, see anki commit eca6ecf.

error I get when I press the Add button:

Caught exception:
  File "/home/fifi/CCBC/aqt/addcards.py", line 207, in addCards
    self.editor.saveAddModeVars()
  File "/home/fifi/CCBC/aqt/editor.py", line 477, in saveAddModeVars
    m = self.note.model()
<class 'AttributeError'>: 'NoneType' object has no attribute 'model'

error I get when I click on an entry in the history list:

Caught exception:
  File "/home/fifi/CCBC/aqt/addcards.py", line 170, in <lambda>
    a.triggered.connect(lambda b, nid=nid: self.editHistory(nid))
  File "/home/fifi/CCBC/aqt/addcards.py", line 178, in editHistory
    browser = aqt.dialogs.open("Browser", self.mw)
  File "/home/fifi/CCBC/aqt/__init__.py", line 71, in open
    instance = creator(*args)
  File "/home/fifi/CCBC/aqt/browser.py", line 380, in __init__
    self.onSearch()
  File "/home/fifi/CCBC/aqt/browser.py", line 558, in onSearch
    self.model.search(txt, reset)
  File "/home/fifi/CCBC/aqt/browser.py", line 125, in search
    self.beginReset()
  File "/home/fifi/CCBC/aqt/browser.py", line 152, in beginReset
    self.browser.editor.setNote(None, hide=False)
  File "/home/fifi/CCBC/aqt/editor.py", line 316, in setNote
    self.hideCompleters()
  File "/home/fifi/CCBC/aqt/editor.py", line 482, in hideCompleters
    self.tags.hideCompleter()
  File "/home/fifi/CCBC/aqt/tagedit.py", line 85, in hideCompleter
    if sip.isdeleted(self.completer):
<class 'TypeError'>: isdeleted() argument 1 must be sip.simplewrapper, not TagCompleter

error when I press the close button:

Caught exception:
  File "/home/fifi/CCBC/aqt/addcards.py", line 234, in reject
    self.editor.setNote(None)
  File "/home/fifi/CCBC/aqt/editor.py", line 316, in setNote
    self.hideCompleters()
  File "/home/fifi/CCBC/aqt/editor.py", line 482, in hideCompleters
    self.tags.hideCompleter()
  File "/home/fifi/CCBC/aqt/tagedit.py", line 85, in hideCompleter
    if sip.isdeleted(self.completer):
<class 'TypeError'>: isdeleted() argument 1 must be sip.simplewrapper, not TagCompleter

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.