Starting the import in a timer could cause the collection to be unloaded
while the deck list was being displayed, leading to an inconsistent
state.
The timer was originally required to avoid importing on startup,
but profile load is already delayed until after startup these days,
so the workaround should no longer be necessary.
Ensures that decks refresh properly even if the webview has previously
failed to load due to a bug (such as the render routine being called
while the collection is closed)
A race condition could cause domDone to get stuck on false, causing
any further bridge messages and setHtml() calls to be ignored. Fix
the issue by clearing pending actions and resetting domDone when
setting HTML.
Caught exception:
File "aqt\main.py", line 237, in onOpenBackup
File "aqt\profiles.py", line 264, in backupFolder
File "aqt\profiles.py", line 274, in _ensureExists
File "os.py", line 220, in makedirs
<class 'FileNotFoundError'>: [WinError 3] The system cannot find the path specified: 'C:\\Users\\xxx\\AppData\\Roaming\\Anki2\\xxx \\backups'
Can't reproduce the issue, but it seems the user was able to open the
preferences screen when no collection was loaded. If an error was
caught in loadCollection() the main window was not being hidden, so
perhaps a timing issue was preventing the profiles screen from taking
modal focus.
Removed the check in the prefs init - it is hopefully no longer
necessary, and returning before QDialog.__init__() was called was
causing the problem.
Caught exception:
File "aqt/webview.py", line 27, in cmd
File "aqt/webview.py", line 85, in _onCmd
File "aqt/webview.py", line 360, in _onBridgeCmd
File "aqt/toolbar.py", line 56, in _linkHandler
File "aqt/toolbar.py", line 80, in _syncLinkHandler
File "aqt/main.py", line 669, in onSync
File "aqt/main.py", line 365, in unloadCollection
File "aqt/main.py", line 611, in closeAllWindows
File "aqt/__init__.py", line 110, in closeAll
<class 'RuntimeError'>: super-class __init__() of type Preferences was never called
- don't require collection for initial blank content
- defer profile load until initial blank content loaded
- use plain text for blank content to prevent initial flash of white
qtwebengineprocess.exe inherits the current working directory, so if
it is started after the profile is loaded, it prevents the profile
media folder from being renamed/deleted
also, load profile on first run at the same point we normally load
the profile
Addresses a rare instance of update checks failing when locally
installed packages point to a shared ID that has yet to be updated
to 2.1. In those instances Anki's update API returns null, which
causes a ValueError downstream when comparing the timestamps
against each other.
Extends the AddonManager API with two new methods, setWebExports and
getWebExports. setWebExports expects an add-on module name and a
valid RegEx pattern to match subpaths in the add-on folder against.
Any matching subpaths will be accessible in Anki's web views by
referencing them with /_addons/{addon_id}/{subpath}.
For instance, to allow access to .css and .png files in your add-on's
user_files directory you would call:
> mw.addonManager.setWebExports(__name__, r"user_files/.+(\.png|\.css)")
You could then reference these files in web views as such:
> <img src="/_addons/{addon_id}/user_files/test.png">
Please note that this bypasses the default security policies used
in Anki webviews. You should take care to construct your RegEx
patterns specific enough so that they do not match any sensitive
files of our add-on.
fixes visible redraw when:
- opening preview screen while cursor in field (as editTimer
fires even if note has not changed)
- moving between cards (as loadNote and rowChanged hooks are both
fired)
Qt.transparent prevents subpixel anti-aliasing from working, resulting
in slightly blurry fonts on non-retina displays.
(The window background color is not determined correctly on macOS, so
we hardcode it.)
Credits for discovering this issue go to the unknown author of
https://ankiweb.net/shared/info/94394764
Supplies information on platform, app, toolkit, and installed add-ons.
Should come in useful to troubleshoot issues that do not produce an
error message, especially for add-on developers.
Sets the foundation for more elaborate additions to the manifest.
Manifest files are still only being read for local imports, but with
this commit that could be easily changed in the future.
If an add-on folder contains only number, but does not contains a
meta.json file, or if this file does not contains a "mod" value, then
the following uninformative message error occur:
```Python
File "aqt/addons.py", line 387, in onCheckForUpdates
File "aqt/addons.py", line 183, in checkForUpdates
File "aqt/addons.py", line 199, in _updatedIds
<class 'TypeError'>: '<' not supported between instances of 'NoneType' and 'int'
```
This is because there is a .get in a code while the None value makes
no sens. Thus, I replaced None by a 0 value. Which ensure that, if the
last modification time is missing, the update will be done. Three case
may occur:
* either the addon is already up to date, and it's only a waste of
bandwidth
* either the add-on is not up to date, and updating was the initial
goal anyway
* Or some change did occur in the add-on folder (which is actually
probably, since it would explain the "missing mod problem"; in this
case this change may be lost, but thout would be the same problem
if the mod number was still there.
Other solutions which I could implement would be:
* asking for the user whether they want to update
* considering that it's not an ankiweb related add-on anymore, and
ignore it.
Adds a new button to the add-on dialog that allows users to select
and install add-ons from local files.
Introduces APKX, a zip-based and manifest-backed filetype for
Anki add-on packages.