Closing anki when the preferences dialog
is open will cause an exception since
self.mw.col in Preferences is not available
anymore.
Avoid the exception by checking self.mw.col
again on accept().
fixes the following:
- create a filtered deck and sync it
- review cards in the filtered deck and delete it
- sync again
The filtered deck deletion was bumping the mod time on cards at the
start of the sync, preventing the reviews from being synced from the
other side, leading to lost reviews and sanity check errors.
Adding 'webp' was necessary for Anki to recognize WebP images
(https://developers.google.com/speed/webp/?csw=1) as images rather than
audio. The addition of the audio formats was incidental, as it appears Anki
assumes audio files if a file is not an image file.
Fix error message when editFocusLost is called after editor destruction
https://anki.tenderapp.com/discussions/ankidesktop/11175-bug-in-browser-revealed-by-add-on?unresolve=true
To reproduce:
1. Install the attached add-on. (All it does is register a function on the editFocusLost hook, and set the flag to 1 to signify that a field has been updated).
2. Run Anki. Enter the Browse window. Press Enter to display your deck.
3. Select one card.
4. Click inside one of the fields for that card. Now, when you leave that field, the editFocusLost hook will be called.
5. Now, select 2 notes from the browser, with your mouse, without clicking anywhere else before.
You will observe this error message:
Traceback (most recent call last):
File "aqt/progress.pyc", line 69, in handler
File "aqt/editor.pyc", line 467, in onUpdate
File "aqt/editor.pyc", line 572, in checkValid AttributeError: 'NoneType' object has no attribute 'fields'
When a user renames or deletes a field, Anki tries to go through the
user's templates to substitute occurrences of that field name with its
new name or remove the field.
However, if the user has multiple Mustache placeholders on a single
line, this does not work as intended because the leading (.*) capture
group grabs the text in-between the two (or more) Mustache placeholders.
Examples:
{{#Flag}}
...
{{/Flag}}{{^Flag}}
...
{{/Flag}}
or
{{Front}} {{#Flag}}...{{/Flag}}
or
{{Front}} Hello. {{Victim}}
the canFocus/canCopy separate variables was silly, as we ended up
with text that could be copied from the context menu but not with
a shortcut key. also we default to allowing focus now, since that's
the more sensible default. fixes copy issues with card info dialog and
some addons