Coder Social home page Coder Social logo

anki-enhanced-cloze's Introduction

Enhanced cloze 2.1

This add-on allows to improve clozes usage. See the original author description for more details. The only thing that changed is that you don't need JSbooster anymore.

Warning

Make a backup before updating from 2.0 note type to 2.1 note type.

If you used those cards with anki 2.0, you need:

  • either to change the note type to "Enhanced cloze 2.1" Improving «change note type» may help you to do the change more safely, since those are clozed note.
  • or to copy the front of the note type "Enhanced cloze 2.1" to "Enhanced cloze", remove "Enhanced cloze 2.1" and rename "Enhanced cloze" to "Enhanced cloze 2.1" (this one is more technical, but also safer)

Internal

It edit the method aqt.editor.Editor.saveNow, the new method calls the last one.

Version 2.0

Here

Links, licence and credits

Key Value
Version 2.0 by https://github.com/luzhe610/anki-enhanced-cloze
Ported to 2.1 by Arthur Milchior [email protected]
Based on Anki code by Damien Elmes [email protected]
License GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
Source in https://github.com/Arthur-Milchior/anki-enhanced-cloze
Addon number 2062736101
Support luzhe610 https://www.paypal.me/LuZhe610

anki-enhanced-cloze's People

Contributors

arthur-milchior avatar luzhe610 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

ijgnd

anki-enhanced-cloze's Issues

cloze doesn't work for me ?

First of all: Thanks for updating this add-on.

Pressing "Ctrl+shift+c"/the cloze button in the field # Content doesn't surround the selected text with {{Cn::}} for me in 2.1.13. I might miss something obvious. Here's a video: https://streamable.com/ovcqt . On the left side Anki 2.0.52 and on the right side it's anki 2.1.13 (as a flatpak so that I can run them in parallel. I'm scrolling a bit much at the end but hopefully you see what I mean.

Not Working: name 'DEFAULT_ANKI_CLOZE' is not defined

Error 
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. 
If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. 
When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site. 
Debug info:
Anki 2.1.14 (7b93e985) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Windows 10
Flags: frz=True ao=True sv=1

Caught exception:
  File "aqt\webview.py", line 27, in cmd
  File "aqt\webview.py", line 87, in _onCmd
  File "aqt\webview.py", line 368, in _onBridgeCmd
  File "<decorator-gen-56>", line 2, in _linkHandler
  File "anki\hooks.py", line 74, in decorator_wrapper
  File "anki\hooks.py", line 71, in repl
  File "C:\Users\Steve\AppData\Roaming\Anki2\addons21\review_heatmap\links.py", line 74, in heatmapLinkHandler
    return None if not _old else _old(self, url)
  File "aqt\overview.py", line 37, in _linkHandler
  File "aqt\main.py", line 485, in moveToState
  File "aqt\main.py", line 515, in _reviewState
  File "aqt\reviewer.py", line 46, in show
  File "aqt\reviewer.py", line 96, in nextCard
  File "aqt\reviewer.py", line 172, in _showQuestion
  File "aqt\reviewer.py", line 156, in _mungeQA
  File "aqt\reviewer.py", line 304, in typeAnsFilter
  File "C:\Users\Steve\AppData\Roaming\Anki2\addons21\1933645497\handler.py", line 76, in typeAnsQuestionFilter
    return re.sub(ref.typeAnsPat, DEFAULT_ANKI_CLOZE % (ref.typeFont, ref.typeSize), buf)
<class 'NameError'>: name 'DEFAULT_ANKI_CLOZE' is not defined

I have tried to delete the card type and reinstall the add-on, still not working

add-on changes/breaks navigation with keyboard in browser

I tried with Anki 2.1.14 (linux, compiled version from website) and the add-on version you released to Ankiweb on 2019-07-04. I didn't have any other add-ons.

Anki without any add-ons behaves like this: When I'm in the browser I press "Ctrl+Shift+L" to focus on the card list. Then when I press <down> <down> (I mean pressing the "down arrow key" twice) I go two cards down in the list.

With your add-on: When I'm in the browser I press "Ctrl+Shift+L" to focus on the card list. Then when I press <down> <down> (I mean pressing the "down arrow key" twice) I go one card down in the list. The second <down> is send to the editor which scrolls down a bit.

Maybe related: In #6 I also reported a problem that I can't reproduce with the latest version from ankiweb: "Also Ctrl+A seems to be affected: ...."

The fact that I can't use the arrow keys for navigating the list is obviously not important: Instead of the arrow keys I can use Ctrl+n/Ctrl+p to go through the list. But maybe you have an idea while you still know the code ...

Thanks again for updating this important add-on.

Shortcuts don't work:

When I try to create a cloze for a different scentence/word with the Shortcut ctrl-shift-alt-c which should add a cloze that's the same number as the cloze before it, it instead adds a cloze add the end of the text.

for ex I have the text:
Hello world: inside cloze one
Hello skies: also inside cloze one
Hello birds: inside cloze two

First step is make the first cloze with ctrl-shift-c:
Hello world: {{c1::inside cloze one}}
Hello skies: also inside cloze one
Hello birds: inside cloze two

Yay it worked, second step make another cloze 1 for the second line using the shortcut ctrl-shit-alt-c:

What I expect:
Hello world: {{c1::inside cloze one}}
Hello skies: {{c1::also inside cloze one}}
Hello birds: inside cloze two

What I get:
Hello world: {{c1::inside cloze one}}
Hello skies: also inside cloze one
Hello birds: inside cloze two{{c1::}}

Adding a second cloze to the third
Hello world: {{c1::inside cloze one}}
Hello skies: also inside cloze one
Hello birds: {{c2::inside cloze two}}{{c1::}}
~Works normally

Much tears, panic and confusion

error while searching in the browser or closing anki

I get this addon error :
(after updating to the last version)

Debug info:
Anki 2.1.13 (3ba55990) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Linux
Flags: frz=True ao=True sv=2
Add-ons possibly involved: Enhanced cloze 21

Caught exception:
  File "aqt/browser.py", line 571, in onSearchActivated
  File "/home/marcozer/.local/share/Anki2/addons21/2062736101/src/__init__.py", line 208, in on_save_now
    return _oldSaveNow(self, callback, keepFocus=False)
<class 'NameError'>: name 'callback' is not defined

and while closing anki :

Debug info:
Anki 2.1.13 (3ba55990) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Linux
Flags: frz=True ao=True sv=2
Add-ons possibly involved: Enhanced cloze 21, Opening the same window multiple time, Web Browser - Search selection Import texts and images automatically

Caught exception:
  File "/home/marcozer/.local/share/Anki2/addons21/864545277/browser.py", line 85, in clozeBrowser
    fn(evt)
  File "aqt/main.py", line 805, in closeEvent
  File "aqt/main.py", line 311, in unloadProfileAndExit
  File "aqt/main.py", line 286, in unloadProfile
  File "aqt/main.py", line 379, in unloadCollection
  File "aqt/main.py", line 632, in closeAllWindows
  File "/home/marcozer/.local/share/Anki2/addons21/354407385/multiple.py", line 140, in closeAll
    instance.closeWithCallback(callback)
  File "aqt/browser.py", line 525, in closeWithCallback
  File "/home/marcozer/.local/share/Anki2/addons21/2062736101/src/__init__.py", line 208, in on_save_now
    return _oldSaveNow(self, callback, keepFocus=False)
<class 'NameError'>: name 'callback' is not defined

Thank you for your help

name 'callback' is not defined

I did git clone https://github.com/Arthur-Milchior/anki-enhanced-cloze/ (as of 97aff30) into my addons21 folder and then ran anki without any other add-ons.

When I go to the browser I get this error:

...__init__.py", line 209, in on_save_now
    return _oldSaveNow(self, callback, keepFocus=False)
<class 'NameError'>: name 'callback' is not defined

I think you forgot to replace callback with *args in line 208 .return _oldSaveNow(self, callback, keepFocus=False)

Cannot do cloze one by one consistently

When I am reviewing a card and I press "i" to do each genuine or pseudo cloze it reveals them one by one, But when I go to review the card a short while later and press "i" it will reveal all of them. I was curious if there was a way for me to make it so it will always do one at a time when I press "i".

This plugin may cause some cards to be lost

When I click from card to card in the browser, sometimes the current clicked card content may be replaced with the content of other cards. I lost a bunch of cards in this way.
Then I dissabled this addon this strange bug stopped. I think this plugin is pretty good ,but I don't want such risk.

Conflict with Numeric Keypad Remapping

Addon seems to interfere with the "show answer using numerical keys" function of Numeric Keypad Remapping throwing the following error

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site.
Debug info:
Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Windows 10
Flags: frz=True ao=True sv=2

Caught exception:
File "C:\Users\John Smith\AppData\Roaming\Anki2\addons21\653807651_init_.py", line 118, in answerCaller
return onAnswerButton(int(closureKey))
File "C:\Users\John Smith\AppData\Roaming\Anki2\addons21\653807651_init_.py", line 90, in onAnswerButton
self.mw.reviewer._showAnswer()
File "", line 2, in _showAnswer
File "anki\hooks.py", line 74, in decorator_wrapper
File "anki\hooks.py", line 71, in repl
File "C:\Users\John Smith\AppData\Roaming\Anki2\addons21\1374772155\main.py", line 233, in onShowAnswer
return _old(self)
File "aqt\reviewer.py", line 217, in _showAnswer
File "aqt\reviewer.py", line 156, in _mungeQA
File "aqt\reviewer.py", line 306, in typeAnsFilter
File "aqt\reviewer.py", line 367, in typeAnsAnswerFilter
File "aqt\reviewer.py", line 431, in correct
File "aqt\reviewer.py", line 400, in tokenizeComparison
<class 'TypeError'>: normalize() argument 2 must be str, not None

removed from Ankiweb?

You recently removed this from ankiweb.

I assume it's because you don't use this add-on and because this add-on uses a lot of js and js might break with any update so that you don't want a future maintenance burden and don't want to tempt people into using this, etc.

Or is there another more specific reason for removing this?

Thanks for the 2.1 port. It has been useful in my family.

edits in browser affect multiple cards

When editing in browser a field and then selecting an other card, it automatically copies the previous edited field to replace the first field of the selected card, not matter which note type it is.
I lost many notes with this bug, which results in duplicates.

packaging problem on ankiweb (version uploaded on 2019-06-15)?

the latest version on ankiweb (on 2019-06-16 17:49 Central European Summer Time) does not generate clozes inside the text but adds them at the end of the field.

These files are in the add-on folder:

\2062736101
├── _Autolinker.min.js
├── __init__.py
├── _jquery-3.2.1.min.js
├── _jquery.hotkeys.js
├── _jquery.visible.min.js
├── meta.json
├── model.py
├── README.md
├── src
│   ├── __init__.py
│   └── model.py
└── zipping

If I clone this repo into addon21 I don't have this problem.

anki-enhanced-cloze: error in the editor

Hello,
Thank you for the update and sharing.
I am getting the following error with the add-on installed when I try to add clozes in the editor however:

Debug info:
Anki 2.1.13 (3ba55990) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Mac 10.14.5
Flags: frz=True ao=True sv=1
Add-ons possibly involved: cloze_overlapper

Caught exception:
File "aqt/editor.py", line 216, in checkFocus
File "", line 2, in onCloze
File "anki/hooks.py", line 74, in decorator_wrapper
File "anki/hooks.py", line 71, in repl
File "/Users/---/Library/Application Support/Anki2/addons21/cloze_overlapper/editor.py", line 191, in onInsertCloze
return _old(self)
File "aqt/editor.py", line 485, in onCloze
File "", line 2, in on_save_now
File "anki/hooks.py", line 74, in decorator_wrapper
File "anki/hooks.py", line 68, in repl
<class 'TypeError'>: onEditorSave() got an unexpected keyword argument 'keepFocus'

I've always felt somewhat uneasy about not contributing to projects.
I will look into Patreon page.
Thanks again.

Note: Cloze(Hide all) generates the same bug report as well.

typo in template

"Extrya" in model.py . Relevant because this typo is not included in the card template so that this field is not shown on a card.

latest version on ankiweb - most files are missing

the latest update from ankiweb only includes an __init__.py, readme.md, and zipping for me.

PS: Before posting #3 I had a brief look at the button issue and didn't quickly see the solution. After seeing yours it's obvious to me. That's what I mean that your add-ons are "instructive"/"informative" to me.

cloze button does not work for me (but the shortcuts do)

This is a repost of my answer on reddit from yesterday. I should have probably posted here directly.

This is a different problem from #3 so I create a new issue. I tested with the updated version from github (released on 2019-06-12) which includes the tiedid up model.py of commit 989b0a5. So my version should match the latest code from github.

The cloze button doesn't work for me. This still seems to call the built-in onCloze function: I ran anki from source with runanki with only your add-on installed and with a modified file editor.py which includes one print('original') line in the function onCloze. And I got this line in my terminal printed after I clicked the cloze button.

 

I searched the source code of other add-ons. As far as I see the only add-on for 2.1 that overwrites onCloze is "GODMODE: faster shortcuts and Cloze switching", https://ankiweb.net/shared/info/1508677152.

The only other add-on that affects saveNow seems to be "Import from Airtable", https://ankiweb.net/shared/info/428974728, which uses this line editor.Editor.saveNow = wrap(editor.Editor.saveNow, saveNow, "after"). This should work well with your add-on.

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.