ankitects / anki Goto Github PK
View Code? Open in Web Editor NEWAnki's shared backend and web components, and the Qt frontend
Home Page: https://apps.ankiweb.net
License: Other
Anki's shared backend and web components, and the Qt frontend
Home Page: https://apps.ankiweb.net
License: Other
Have a question or feature suggestion? Please post on the user forums instead.
Not 100% sure you've found a bug? Please post on the user forums instead.
Before reporting a bug, please make sure you've followed the troubleshooting guide, and please make sure you include as much information as possible.
For some languages, the completion figure is roughly half what it should be:
If you are interested in digging into this, I can provide a dump of the database - there's likely some difference between the languages that are failing and those that are displaying the correct amount.
deleted
I've upgraded my Anki apps set, and after that I've found little bug.
My cards contains custom set of fields (front, back, example, etc...). When I 'study' old cards I see all fields, but when I try to add new one I see only standard, built-in fields. I was trying to change type of card, but the 'variant' that theoretically contains all of my cards doesn't have my custom fields.
Unfortunately my 'variant' has been named "basic" (I didn't change original name). I've changed his name what fix the problem. It's simple but I've lost an hour for this, I think more people may have similar problem during upgrading they decks, and maybe you find some time to fix it.
The separate help-wanted has been running fine for months, so perhaps it's time to try enabling issues on this repo, as it will make it easier for developers to coordinate. I'm hoping the comments in the issue template will limit the number of support requests we get here. 🤞
pyaudio is a bit of a pain to install, as it requires portaudio dev libraries on Mac/Lin, and a third-party wheel not hosted on pypi for Windows. And the way we use it is rather naive, and can lead to the start of the recording being lost if the audio device takes a while to initialize.
Perhaps it may make sense to switch to a solution based on QAudioRecorder? We'll still only get a pcm file, so will still require lame, but it may make the recording process a bit smoother.
Greetings. I am bad at expressing longer thoughts, so I will be frugal with my words. Please do not perceive it in a negative way.
I find the multiple levels of correct answers very distracting. I would also rather sacrifice some efficiency to maximize the guarantee of remembering the material. With that in mind, I came up with my own scheduling system.
The repetition intervals would increase by one day with each strong recall; and decrease by one day with each weak recall, until value of one day is reached. Another rule is that the odd-counted entries in the current queue would have the interval length additionally decreased by one day in order to fuzz out groupings of similar cards. Initial interval would be set to two or three days depending on this rule.
Overall, there is no distinction of learning or recall phase. If the material is difficult to learn, the algorithm will quickly decrease the interval to one day and keep it there until the information is remembered successfully. On the other hand, if the material is easy to acquire, the interval will grow indefinitely, yet slowly. At any point, if the card is remembered weakly, the single-day decrease of the interval allows to strengthen this memory without going to directly to zero. There could be cases of cards which stay at a particular interval range due to their difficulty and that would be fine, too.
I have no programming skills and I do not know any programmer I could trust with this project. I run a self-employed business, so it would be easy to pay you with an invoice. The only questions are whether you are interested in implementing my scheduler and for how much money? If it is not obvious, let me add that I am not asking to replace the existing scheduler, but to have two of them available as options to choose from.
Best Regards,
Marek Paśnikowski from Poland
We already have keyPressEvent() in tagedit.py - maybe we could just extend it to swallow or handle the keystroke?
https://forums.ankiweb.net/t/multiple-cursors-can-be-active-at-once-in-the-add-window/4510
https://forums.ankiweb.net/t/anki-2-1-desktop-ctrl-f-jump-from-tags-does-not-work-correctly/3753
The size appears to be doubled without a corresponding increase in font size:
I'd like to refactor the import/export code soon, moving some or most of it to Rust. This will probably come after the scheduling rework.
When working on this:
Hello!
I'm a user of Anki and I would like to help contributing - however, as a newcomer, it's quite complicated to understand where I should start.
Today I came across this small post about ARCHITECTURE.md
and thought that it would be super neat if the Anki repository had one of these.
I'm sure there's a lot going on and it's time consuming to write documentation, but if someone could get around to it someday, even if it was a simple pointer as to where to start reading code, it would be helpful for new want-to-be-contributors like me.
Thank you,
~romes
Need to replace "&" with "&&". Will need to be done in _tagFilters() et al, as there may be add-ons or other parts of the code that expect MenuList() to support ampersands.
https://forums.ankiweb.net/t/bug-ampersand-is-not-escaped-in-browse-filter-menu/4056
After downloading / cloneing I tried to start anki with ./runanki.
It complained about not having a class which is called DeckAccessError.
After grepping the code, I found out, it's part of old anki, so I had a look into runanki.
Imho this can't be right:
import sys
sys.path.insert(0, "/usr/share/anki")
import aqt
aqt.run()
There was another version installed but it is wrong to just assume some path where anki is installed, because I also use the old version as fallback/export tool.
All the best,
Thomas
Anki currently bundles MathJax 2. MathJax 3 includes a bunch of improvements, but it appears to have changed the way it is configured. We need to investigate if the new version can be hooked into Anki's reviewing system. Some things to think about:
Does the existing functionality in reviewer.ts still work? We need to be able to register a function to be called once rendering is done, so we can defer card rendering
Can users still customize MathJax with some JS on their cards?
Will moving to MathJax 3 break things for existing users?
Anki does not bundle the entire MathJax distribution, so if all of the above are handled, we'll then need to strip out the unnecessary parts (MathML, unused fonts, etc) and commit the required parts to the tree.
Some users frequently search for accented text, and want to be able to type "foo" instead of "nc:foo" (https://anki.tenderapp.com/discussions/ankidesktop/41875-proposal-card-browser-search-change-default-search-behaviour-in-respect-to-accents-nc-syntax-as-default). This should be simple to implement in an add-on. In the master branch, the browser_will_search hook can be used to alter the search text, so implementing this is probably just a case of splitting ctx.search on whitespace, prepending substrings that don't have a ':' character, and then joining the substrings back into a single string.
Please note that ctx.search was ignored in earlier versions, so you'll need to test with the current master branch
https://anki.tenderapp.com/discussions/ankidesktop/42340-blurry-tags-in-night-mode
Seems to be an issue with icon_from_resources() in theme_manager.py
This one is a note rather than a request for help.
Slow scrolling performance on Windows - still a problem on 5.15.1:
https://forums.ankiweb.net/t/2-1-28-scroll-lags/1288
Large images (eg 6500x4000) load more slowly on Windows 5.15.x: https://forums.ankiweb.net/t/large-images-load-slowly-on-2-1-34/3752/6
Windows in tabs are no longer working on macOS - still an issue on 5.15.1: https://bugreports.qt.io/browse/QTBUG-85907
On latest macOS, spaces are missing after commas and periods (eg, "...latest MacOS,spaces are missing..."). Fixed in 5.15.3... which is only available to commercial customers.
Some users seem to be experiencing delays before an audio file plays, despite the fact that mpv is running in slave mode as a long-running process. If another developer is able to reproduce the issue on their Mac/Linux machine, perhaps experimenting with audio drivers in mpv or output device selection may reveal what's going wrong.
Original report:
https://anki.tenderapp.com/discussions/ankidesktop/41106-card-audio-playback-changes-bug-in-212x
Multiple selection is currently disabled.
There are two things we'll need to fix before we can turn it on:
Following on from b8d67cd#commitcomment-46786195
I wasn't sure about this one - it doesn't really fit in the "Recent" category, and felt a bit alone sitting at the top level by itself. Perhaps we could add it to the default saved searches for new users? Mind elaborating on how you use it in your workflow?
If additions to the tag list were timestamped (perhaps in CollectionState), then register_tag() could update it. Combined with a backend method to poll the tag modification time, it would allow the UI to check for tag changes fairly cheaply.
https://forums.ankiweb.net/t/propagating-tag-changes-to-the-sidebar-and-to-add-ons/3075
https://forums.ankiweb.net/t/renaming-clear-unused-tags/5481/5
Suggested on:
https://forums.ankiweb.net/t/suggestion-make-night-mode-toggleable-in-the-card-type-editor/321/2
Due to limited space, the "fill empty fields" button should probably be turned into an options button that reveals two menu items:
[x] Fill empty fields
[x] Invert night mode
An extra option "[x] Add mobile class" might be nice too.
bash-3.2$ /opt/anki/runanki
Traceback (most recent call last):
File "/opt/anki/runanki", line 3, in
import aqt
File "/opt/anki-2.1.14/aqt/init.py", line 14, in
from aqt.qt import *
File "/opt/anki-2.1.14/aqt/qt.py", line 17, in
from PyQt5.QtWebEngineWidgets import *
ImportError: dlopen: cannot load any more object with static TLS
If a note has a tag foobar
, using the tool for deleting tags with foo
will change the tag to bar
.
This is reproducable on the main branch and the current beta.
aqt.utils.saveGeom/restoreGeom can be used to remember size
original report: https://anki.tenderapp.com/discussions/ankidesktop/41780-html-editor-in-need-of-a-maximize-button
re: https://forums.ankiweb.net/t/quick-q-search-methods-in-anki-pylib/7543
The comments need to be turned into a docstring, and made more readable.
eg:
def find_notes(self, *terms: Union[str, SearchNode]) -> Sequence[int]:
"""Return note ids matching the provided search or searches.
If more than one search is provided, they will be ANDed together.
Eg: col.find_notes("test", "another") will search for "test AND another"
and return matching note ids.
Eg: col.find_notes(SearchNode(deck="test"), "foo") will return notes
that have a card in deck called "test", and have the text "foo".
"""
return self._backend.search_notes(self.build_search_string(*terms))
Some users have reported the following issue:
https://forums.ankiweb.net/t/bug-huge-sync-icon-in-main-window/4048/8
It appears to happen on both Linux and Windows. I have never come across it, but my primary development machine is a Mac. The fact that there were no errors when running with ANKIDEV=1 seems to imply the request is never being made or never being received. Someone who experiences it on their local machine may be able to look into it further, perhaps trying to reload the page multiple times in the Chrome dev tools, adding more instrumenting to mediasrv.py, etc.
Answering questions on the support site takes up a fair amount of time these days, as it's a busier place than it used to be. Any help you can provide answering people's questions would be appreciated. A lot of questions are FAQs, so in many cases linking people to the relevant knowledge base article is a good start.
Splitting the browser sidebar code into a separate file would be nice, but if we're going to break existing add-ons we should probably try to address a number of issues at the same time. Perhaps we could start with a switch to use the old implementation or a new implementation in a separate file until some/most of the following can be done:
httplib2-0.7.7 introduced the following changes:
http://code.google.com/p/httplib2/source/detail?r=1f1f7d61957691b482eea7b5c193b0c9c8ae338d
Patch for anki:
--- anki/sync.py
+++ anki/sync.py
@@ -16,6 +16,15 @@ from hooks import runHook
HTTP_TIMEOUT = 30
HTTP_PROXY = None
+try:
+ # httplib2 >=0.7.7
+ _proxy_info_from_environment = httplib2.proxy_info_from_environment
+ _proxy_info_from_url = httplib2.proxy_info_from_url
+except AttributeError:
+ # httplib2 <0.7.7
+ _proxy_info_from_environment = httplib2.ProxyInfo.from_environment
+ _proxy_info_from_url = httplib2.ProxyInfo.from_url
+
# Httplib2 connection object
######################################################################
@@ -42,7 +51,7 @@ def httpCon():
def _setupProxy():
global HTTP_PROXY
# set in env?
- p = httplib2.ProxyInfo.from_environment()
+ p = _proxy_info_from_environment()
if not p:
# platform-specific fetch
url = None
@@ -59,7 +68,7 @@ def _setupProxy():
elif 'http' in r:
url = r['http']
if url:
- p = httplib2.ProxyInfo.from_url(url, _proxyMethod(url))
+ p = _proxy_info_from_url(url, _proxyMethod(url))
HTTP_PROXY = p
def _proxyMethod(url):
The link of the readme.md points to a 404
cheers.
I'm not sure if this is a bug or a feature but I personally would rather have the "Tags" field emptied when changing card types in the "add new card" window (German: "Hinzufügen"), because usually that is when I change the "subject" of my entries/learning, be it completely or a "finegrained" change.
In the new versions it is emptied when closing and reopening the "add cards" window though, which also makes sense imho.
keep up the good work and warmest regards
Dirk
Currently, I'm implementing a feature in the browser to toggle between displaying cards and notes in the table. I got it to work passably but it was messy adding an if-else clause in every other method. So I went ahead and refactored the whole table view in a new class which takes care of all the model, header and (the newly added) state business.
Needless to say, that broke all kinds of other parts which rely on accessing the browser's fields (and fields of fields and so on) directly and they will need to be updated accordingly.
The project started out as an experiment, but now that it's not only working but also a major improvement in terms of code quality I'm wondering if there's any chance for it to be integrated into the main branch.
I've mostly read about moving pylib code into rslib, but what is your position regarding refactoring the aqt part? As an example, I would split a code monster like the browser into multiple submodules consisting of self-contained classes with strictly defined interfaces only accessing methods, not fields, of each other.
Obviously, that would be a quite an add-on killer, but once those are updated to use the proper access functions, it would save both core and add-on developers a tremendous amount of time that is currently wasted on understanding the code, legacy support and fixing things that broke by changing something seemingly completely unrelated.
Some TTS voices installed on Windows machines are not available in Anki, presumably because they don't provide a SAPI interface. If there's an alternative way to access them from Anki that doesn't involve adding a lot of extra code, it would be nice to support more voices.
Background:
https://anki.tenderapp.com/discussions/ankidesktop/39836-tts-in-anki-desktop
According to the following page, the WinRT API may expose more voices:
https://stackoverflow.com/a/40427509
Need to check:
Are the missing voices available in the new API?
Can they be accessed fairly easily from Python, using https://pypi.org/project/winrt/#description ?
Can the winrt package be bundled properly? Does it cause problems on unsupported Windows versions like Windows 8?
I have a Cloze note with the following content:
{{c1::\(\frac d {dx} (arccos(x))\)}} = {{c2::\(- \frac 1 {\sqrt{1 - x^2}}\)}}
Which is obviously not correct. If I remove the outer {{c2:: ... }}
, then it does render correctly:
It seems like only the second MathJax entry is rendered incorrectly:
I'm using Anki version 2.1.39.
https://forums.ankiweb.net/t/intermittent-hanging-on-add-screen-when-attempting-to-change-note-type/6003 reports that the screen is hanging, and I think there's a decent chance it's caused by the call to self.exec_(), which has been the source of crashes in the past. Taking a different approach by calling .setWindowModality() to make the window modal, and removing the .exec_() line may fix the issue. But as all users of StudyDeck currently expect .name to be set by the time the constructor finishes, the code will need to be refactored to accept a callback that is called once the dialog is closed.
mypy is currently of limited usefulness in the qt/ module, as many functions are lacking type signatures, and methods without type signatures do not get checked. If you edit qt/mypy.ini and uncomment "check_untyped_defs", currently there are 100+ typing errors that need addressing. Fixing them all at once is a big task, but if you pick a single file that needs fixes and add a check_untyped_defs definition just for that file (as can be seen at the bottom of mypy.ini), it makes the task more manageable. Once the codebase is error free, we'll be able to turn on check_untyped_defs and catch issues that are currently being missed, as has already been done for pylib.
As for what fixes are required, currently Qt's type definitions are fairly limited, so often times the "fix" is just to add a " # type: ignore" to the end of lines that reference Qt code. Apparently PyQt will be distributing types with PyQt in the future, so hopefully some positive changes are coming in the future.
Aside from getting check_untyped_defs going, adding hints to functions that are currently missing them would also be much appreciated!
This is the first time I use Anki after reading this article Memorizing a programming language using spaced repetition software . When I imported a text file which has media file. but I could not find the ~/Anki/User 1
When search the collection.media folder to place the media files.
I suggesst the following changes:
1, First change the location from ~/Anki
to ~/.Anki
, which is more conventional.
-- return os.path.expanduser("/Anki")/.Anki")
++ return os.path.expanduser("
2, Change the User 1
To User1
, so no space between is more friendly for Linux users.
-- self.create(("User 1"))
++ self.create(("User1"))
The first work after I change the code, but the second one failed(After I synced with the anki web account).
It is included in the source-tar.gz from the website but not in this repository.
All the best,
Thomas
Docsify has an annoying bug where sidebar clicks will not scroll:
Even if we're able to fix that issue, links to subsections near the end of a page aren't ideal - since the page can't scroll past the bottom, the section that we want the user to read may appear near the bottom of the window, requiring the user to skip their eyes over a number of sections above. To address that we'd need to pad out the bottom of each section as well.
It may be worth considering alternatives like mdbook instead. Mdbook positives:
Downsides:
Currently webview.py's eventFilter() captures native gesture events and ignores them to prevent pinch-to-zoom, because:
If the latter issue could be fixed/confirmed to no longer exist, selectively enabling pinch during review might be worth looking into.
Of further note, the event filter doesn't appear to work reliably anymore in recent Qt versions. On a Mac here for example, pinching in the main screen starts off, but once the congratulations screen is shown, pinching is now possible, even when returning to the deck list.
Related: https://forums.ankiweb.net/t/feature-request-enable-pinch-to-zoom-on-trackpad/5333
A video demonstrating the problem is here:
https://forums.ankiweb.net/t/crashing-anki-version-2-1-29-bbff62bf/1650/5
Currently the AddCards screen is a dialog instead of a main window, which means on macOS the top menubar shows the entries for the last active main window, such as the main screen or the browse screen. This causes browser-defined shortcuts to conflict, breaking the 'switch note type' shortcut key.
Moving AddCards to a main window would resolve the issue, but may introduce other issues.
https://anki.tenderapp.com/discussions/ankidesktop/42324-change-note-type-with-browser-open
2021/02/14 17:18:28 Downloading https://releases.bazel.build/3.7.0/release/bazel-3.7.0-linux-x86_64...
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
INFO: Repository npm instantiated at:
/home/jhart/temp4/anki-2.1.40/WORKSPACE:14:11: in
/home/jhart/temp4/anki-2.1.40/defs.bzl:46:17: in setup_deps
/home/jhart/.cache/bazel/_bazel_jhart/fb395a9cac4c0def01657d368845d2db/external/build_bazel_rules_nodejs/index.bzl:74:18: in yarn_install
Repository rule yarn_install defined at:
/home/jhart/.cache/bazel/_bazel_jhart/fb395a9cac4c0def01657d368845d2db/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl:463:31: in
Loading: 0 packages loaded
ERROR: An error occurred during the fetch of repository 'npm':
Traceback (most recent call last):
File "/home/jhart/.cache/bazel/_bazel_jhart/fb395a9cac4c0def01657d368845d2db/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 456, column 13, in _yarn_install_impl
fail("yarn_install failed: %s (%s)" % (result.stdout, result.stderr))
Error in fail: yarn_install failed: yarn install v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
(warning " > [email protected]" has incorrect peer dependency "protobufjs@~6.7.0".
warning " > [email protected]" has incorrect peer dependency "typescript@^4.1.2".
error /home/jhart/temp4/anki-2.1.40/ts/node_modules/protobufjs: Command failed.
Exit code: 126
Command: node scripts/postinstall
Arguments:
Directory: /home/jhart/temp4/anki-2.1.40/ts/node_modules/protobufjs
Output:
/bin/sh: /tmp/yarn--1613290775086-0.6220927402102825/node: /bin/sh: bad interpreter: Permission denied
)
Loading: 0 packages loaded
ERROR: no such package '@npm//@bazel/labs': yarn_install failed: yarn install v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
(warning " > [email protected]" has incorrect peer dependency "protobufjs@~6.7.0".
warning " > [email protected]" has incorrect peer dependency "typescript@^4.1.2".
error /home/jhart/temp4/anki-2.1.40/ts/node_modules/protobufjs: Command failed.
Exit code: 126
Command: node scripts/postinstall
Arguments:
Directory: /home/jhart/temp4/anki-2.1.40/ts/node_modules/protobufjs
Output:
/bin/sh: /tmp/yarn--1613290775086-0.6220927402102825/node: /bin/sh: bad interpreter: Permission denied
)
INFO: Elapsed time: 91.247s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
ERROR: Build failed. Not running target
FAILED: Build did NOT complete successfully (0 packages loaded)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.