Commit Graph

3022 Commits

Author SHA1 Message Date
Damien Elmes
cddfddf1c8 save filters and field name separately 2020-01-16 18:47:21 +10:00
Damien Elmes
bdac937802 show missing field errors in the same way as the other errors 2020-01-16 18:47:21 +10:00
Damien Elmes
b56c9591c0 more useful template error message 2020-01-16 18:47:21 +10:00
Damien Elmes
81f7e634d1
Merge pull request #423 from Arthur-Milchior/fixReorder
Order by creation of note
2020-01-16 18:47:12 +10:00
Arthur Milchior
2c0de4948b add in contributor 2020-01-16 00:33:39 -08:00
Arthur Milchior
d9b5a1da89 Order by creation of note
This commit solve a problem I actually have for some strange
reason. Here is how to reproduce the problem

1. Create a note of type Basic (and reversed card) in a deck D with front "First"
and no back
2. Wait a day (or install an add-on which show hour and minutes of
creation time in browser)
3. create a second note, with front "Last" and no back
4. In first note, add in back field "First" and delete the front field
5. Use "Empty card".
6. In the setting of the deck D, set in random order, and then back in
the "order added"
7. Review deck D. You'll see card 1 of the second note. (Don't review
it)
8. Open the browser. Show the column "due" and created. You'll see
that the first card (first) have due value 2, while it was created
before according to the created date. The card "last" have due value
1.

This is due to the fact that the value "created" is linked to note
creation, while the order is linked to the card creation time, and
card may be created after other note
2020-01-15 23:42:54 -08:00
Damien Elmes
af5e60dffa fix formatting 2020-01-16 12:45:48 +10:00
Damien Elmes
4c0b7d37c9 option to invert paste handling in prefs 2020-01-16 12:36:04 +10:00
Damien Elmes
6906b366c0 fix preview button shortcut
Qt 'helpfully' erases any existing shortcuts when .setText() is called,
and as PyQt's generated forms set the text after the shortcut is set,
it gets lost.

https://anki.tenderapp.com/discussions/ankidesktop/38038-does-ctrlshiftp-doesnt-trigger-preview-in-browse
2020-01-16 12:31:02 +10:00
Damien Elmes
d5707a6388 don't change current deck if custom study fails to create
just a quick fix for now

https://anki.tenderapp.com/discussions/ankidesktop/37834-bug-custom-study-session-created-even-when-there-are-no-cards-that-match-selected-criteria
2020-01-16 11:26:22 +10:00
Damien Elmes
bf93731e49 revert to the old wrap() behaviour
wrap2() was introduced recently to try and resolve an issue where
styling outside of the wrapped section was getting lost. eg,

<b>some [text] etc</b>

When the user created a cloze deletion or added math tags to the [text]
part, the text ended up not being bold - the inner portion is displayed
without styling.

wrap2() used setFormat("inserttext", ...), which did fix that issue
- but it also introduced multiple new issues:

- any HTML inside the selected area, including newlines and images,
was lost
- the unicode entities inserted when creating a cloze deletion in
RTL mode end up inserted as plain text

For now, I'm just going to revert to the old behaviour. If anyone
has a suggestion for an approach that is able to preserve both the
inner formatting and the surrounding formatting, a pull request
or post on the forums would be appreciated!
2020-01-16 10:33:36 +10:00
Damien Elmes
69a7ee430d type hints 2020-01-16 09:19:53 +10:00
Damien Elmes
cc9a36c11a simplify previewCards() and use existing card ids where possible
The type arg is no longer used, as neither type 0 nor 1 appears to
have been used in the codebase.

By using the existing card ids, it allows add-ons that gather
information about a card to work properly in the card template screen
without extra hacks.
2020-01-16 09:19:41 +10:00
Damien Elmes
391d849e51 fix invalid func name in unfocus hook
Don't know why mypy and pylint both failed to catch this :-(
2020-01-16 08:53:28 +10:00
Damien Elmes
6d9baaf052 check_untyped_defs in mypy for pylib 2020-01-16 08:10:49 +10:00
Damien Elmes
8cb980bacc fix checkLeech hint 2020-01-16 07:59:57 +10:00
Damien Elmes
886536d78f fix cases where we used the wrong type sig to connect to gui hook 2020-01-16 07:53:12 +10:00
Damien Elmes
8310cb7a0e add qconnect helper and some type hints
The type hints allow mypy to check the gui_hook calls, revealing a
bunch of places that are broken as they expect no arguments like the
legacy hooks.

To make mypy happy about PyQt's signal.connect(func), a qconnect()
helper has been added.
2020-01-16 07:41:23 +10:00
Damien Elmes
c6d0425020 basic anti spam protection 2020-01-15 20:34:10 +10:00
Damien Elmes
967b8a038d
Merge pull request #421 from ErezVolk/tag-changed-grooming
Tag modified grooming
2020-01-15 20:25:51 +10:00
Damien Elmes
99c45c5fbc allow an empty field name if filters are provided
This is to make it easier for add-ons to provide extra content that
degrades nicely on platforms that don't have the add-on.
2020-01-15 18:48:23 +10:00
Erez Volk
bd9aaa9296 Small fixes and tweaks to "Tag Modified":
- No need for the checkbox, as an unchecked box is equal to an empty
`QLineEdit`.
- The value was saved to the profile but not loaded.
- And the real pièce de résistance: I've figured out how to "Promote"
the `QLineEdit` to a `TagEdit`.

Hope you like it! :)
2020-01-15 10:46:05 +02:00
Damien Elmes
a34e5b3246 update contrib to reflect the naming tweaks 2020-01-15 17:51:42 +10:00
Damien Elmes
b09e7e8247 more tweaks for readability/consistency 2020-01-15 17:45:35 +10:00
Damien Elmes
237c0791f8 more hook tweaks, and merge the pre-render field and template hooks 2020-01-15 17:18:11 +10:00
Damien Elmes
cab572b63c remove _hook/_filter suffix 2020-01-15 16:53:24 +10:00
Damien Elmes
b2f756f1b7 tweak the hook names in anki/
still a work in progress
2020-01-15 16:43:22 +10:00
Damien Elmes
eb6723a2ee fix stdmodels type hint 2020-01-15 15:30:40 +10:00
Damien Elmes
c3775e572d fix file path in comment 2020-01-15 15:29:23 +10:00
Damien Elmes
fbd7d966ea update contrib file 2020-01-15 14:26:50 +10:00
Damien Elmes
72c06a4aef bump version
.19 will be another bugfix release
2020-01-15 13:50:26 +10:00
Damien Elmes
89fce1f6b7 migrate addHook/remHook calls 2020-01-15 13:49:26 +10:00
Damien Elmes
26cb9851b4 idempotent hook removal
This matches remHook()'s behaviour
2020-01-15 13:16:43 +10:00
Damien Elmes
97bd86e0ad tidy hooks, add reviewCleanup 2020-01-15 13:03:11 +10:00
Damien Elmes
660685375f migrate most of the remaining runHook() calls 2020-01-15 12:46:53 +10:00
Damien Elmes
67a3223623 remove unused function 2020-01-15 12:17:29 +10:00
Damien Elmes
84c17e1f02 add more hooks, tweak wording for consistency 2020-01-15 12:16:54 +10:00
Damien Elmes
f021d616dd add optional docstring to hooks 2020-01-15 12:14:32 +10:00
Damien Elmes
dbca596b41 clean stale build folders before build
setuptools will bundle up files from that folder even if they're
no longer in the source tree.
2020-01-15 10:07:39 +10:00
Damien Elmes
c67aefa3ea move hook gen code out of anki/
It's not needed at runtime, and this allows hooks to be updated
even when the code is broken.
2020-01-15 09:11:20 +10:00
Damien Elmes
cb14963066 add _ prefix to generated classes to improve code completion 2020-01-15 08:58:27 +10:00
Damien Elmes
2fa662f7ae add some more hooks; stringify fully qualified types
To avoid circular imports, types that contain a '.' are automatically
converted to strings.
2020-01-15 08:56:56 +10:00
Damien Elmes
2921037c7b remove some comments that are no longer relevant 2020-01-14 20:45:18 +10:00
Damien Elmes
c9cf6316bd bump version 2020-01-14 17:28:55 +10:00
Damien Elmes
d962c0d8cb if profile is corrupt and is reset, need to set default lang again
Fixes https://anki.tenderapp.com/discussions/ankidesktop/37994-traceback-error-with-windows-64bit-standard-installation
2020-01-14 15:18:07 +10:00
Damien Elmes
1824ca1b5d fix startup when prefs.db not readable
If we fail to open the Anki 2.0 prefs.db file, on the second try
we need to revert to a new file instead of trying the same broken
file again.
2020-01-14 14:59:46 +10:00
Damien Elmes
ba670c4be1 if pm.meta() fails, need to unset pm
This prevents a startup failure caused by trying to set
the UI scale when .meta() is not working. Startup still
fails, but the correct message is displayed now.
2020-01-14 14:57:24 +10:00
Damien Elmes
2fb5ff5d9c fix broken answer displaying 2020-01-14 09:00:52 +10:00
Damien Elmes
662eb53e6a switch to classes for hooks
This allows us to add a docstring to .append() so users can see
the names of the arguments that are being passed, and means we
don't have to remember to prepend run_ when calling a hook.
2020-01-14 08:54:07 +10:00
Damien Elmes
9d84f8fb70 fix overlapping clozes 2020-01-14 07:07:21 +10:00