Commit graph

2390 commits

Author SHA1 Message Date
Henrik Giesel
c62d2dc033 Export jquery via ts/reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
8ee6eb71eb Include css-browser-selector via ts/reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
11f06161c9 Include protobuf in clayout and browser (p)reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
2536063784 Export getTypedAnswer 2021-07-16 16:56:56 +02:00
Henrik Giesel
791d7f2f4b Move reviewer to ts/reviewer 2021-07-16 16:56:55 +02:00
Damien Elmes
df6d3ed116 Merge pull request #1288 from evandroforks/clayout_next_card_shortcut
Created shortcut to switch between card types on clayout.py
2021-07-16 10:51:40 +10:00
Damien Elmes
eb4e18a45f Merge pull request #1293 from RumovZ/find-and-replace
Find & Replace
2021-07-16 10:47:16 +10:00
Damien Elmes
2d0540b741 Revert "stop (un)escaping media filenames"
This was flawed - while non-Latin text is now acceptable
in an IRI, we still need to be concerned with reserved characters
such as spaces, and Anki unfortunately has been storing the filenames
in unencoded form in the DB, meaning we must encode them at display
time. We won't be able to move away from this until existing notes
are rewritten, and it will probably require breaking compatibility with
older clients.

https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier

This reverts commit b21af06d75.
2021-07-16 10:37:59 +10:00
evandrocoan
19ef304873 Created shortcut to switch between card types on clayout.py
editor window (F3 and F4) because it should be simple to use them
single hand and together with Ctrl+1, 2 and 3 combos.
2021-07-15 20:51:08 -03:00
RumovZ
9ba35b9efb Remove redundant QueryOp in rename_deck() 2021-07-15 08:56:47 +02:00
Damien Elmes
090a54c6e6 support numpad enter in type answer
https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/149

regression introduced in dc61a6f547
2021-07-15 14:46:39 +10:00
RumovZ
0804d054b7 Remove unused name prefix of sidebar templates 2021-07-13 16:41:50 +02:00
RumovZ
4f17400021 Add sidebar actions
- Find & Replace for notetype fields
- Rename with Parents for decks and tags
2021-07-13 16:34:02 +02:00
RumovZ
4b1218184d Rework Find & Replace dialog:
- Add option to affect whole collection
- Allow to open without selection
- Add parameter for presetting field
2021-07-13 16:33:45 +02:00
Damien Elmes
492137d264 Merge pull request #1291 from RumovZ/addon-cols
Show key of unknown browser columns
2021-07-13 13:35:54 +10:00
RumovZ
211f39836d Show key of unknown browser columns 2021-07-12 19:03:51 +02:00
RumovZ
300ff08ad0 Add mock browser model to support legacy resetting 2021-07-12 12:36:26 +02:00
Damien Elmes
2238cdaa43 rename Config in protobuf to avoid conflict with module name
+ use the enum directly, instead of wrapping it in an object

Python code retains the old "Config" name.
2021-07-11 19:27:08 +10:00
Damien Elmes
e86e0a64ea move proto files into separate py_library in same namespace
Will allow importing the Protobuf without pulling in the rest of
the library. This is not a full PEP420 namespace, and the wheel still
bundles everything - it just makes things easier in a Bazel workspace.
I originally tried with PEP420, but it required more invasive changes,
and I ran into issues with mypy.
2021-07-11 14:51:25 +10:00
Damien Elmes
5255409093 refactor protobuf handling for split/import
In order to split backend.proto into a more manageable size, the protobuf
handling needed to be updated. This took more time than I would have
liked, as each language handles protobuf differently:

- The Python Protobuf code ignores "package" directives, and relies
solely on how the files are laid out on disk. While it would have been
nice to keep the generated files in a private subpackage, Protobuf gets
confused if the files are located in a location that does not match
their original .proto layout, so the old approach of storing them in
_backend/ will not work. They now clutter up pylib/anki instead. I'm
rather annoyed by that, but alternatives seem to be having to add an extra
level to the Protobuf path, making the other languages suffer, or trying
to hack around the issue by munging sys.modules.
- Protobufjs fails to expose packages if they don't start with a capital
letter, despite the fact that lowercase packages are the norm in most
languages :-( This required a patch to fix.
- Rust was the easiest, as Prost is relatively straightforward compared
to Google's tools.

The Protobuf files are now stored in /proto/anki, with a separate package
for each file. I've split backend.proto into a few files as a test, but
the majority of that work is still to come.

The Python Protobuf building is a bit of a hack at the moment, hard-coding
"proto" as the top level folder, but it seems to get the job done for now.

Also changed the workspace name, as there seems to be a number of Bazel
repos moving away from the more awkward reverse DNS naming style.
2021-07-10 19:17:05 +10:00
Damien Elmes
3ca4ca397a add workaround for protobufjs requiring uppercase package names
I mourn the time lost trying to track this down :-(

https://github.com/protobufjs/protobuf.js/issues/1014

We can't patch the minified file in dist without essentially duplicating
it, so this change also switches from the external file to including
the src file as part of the bundle.
2021-07-10 15:24:01 +10:00
Damien Elmes
bfa8ee6b96 more friendly message for v2 import into v1 2021-07-08 10:32:27 +10:00
Damien Elmes
af6a80c4ec Merge pull request #1277 from RumovZ/config-keys
Add constants for literal config keys
2021-07-07 09:14:40 +10:00
RumovZ
e763745e05 Add pylib/browser.py for literal config keys
Also, remove config bools for sort order.
2021-07-05 12:44:48 +02:00
hikaru-y
00eaf63d41 Follow-up to #1271
- remove no-longer-required 'escape_media_filenames()' b21af06d
- clean up previewer.py
2021-07-05 01:13:17 +09:00
Damien Elmes
447bd2671c Merge pull request #1273 from hgiesel/macshortcuts
Execute Ctrl+C/V/X/A via execCommand in editor
2021-07-04 16:02:52 +10:00
Damien Elmes
289845a049 remove old Mac shortcut code completely
The shortcuts seem to work correctly without it on Qt 5.14, so this
code seems to have only been required for older Qt releases.
2021-07-04 16:00:23 +10:00
Damien Elmes
29808094c8 Merge pull request #1271 from hikaru-y/preload-images
Preload answer images
2021-07-04 15:50:55 +10:00
Damien Elmes
d0480ff529 Merge pull request #1270 from RumovZ/flag-manager
Add flag manager and hook
2021-07-04 15:45:11 +10:00
Damien Elmes
b21af06d75 stop (un)escaping media filenames
Back in the WebKit days, images with Unicode filenames would fail to
appear if they weren't percent-escaped. This no longer seems to be the
case - with this patch, images appear correctly on the Mac and Windows
platforms I tested with.

Fixes https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/96
Fixes #1219
2021-07-04 15:27:29 +10:00
hikaru-y
bf93324448 Preload images to be displayed on answer side 2021-07-03 21:33:00 +09:00
Henrik Giesel
b74258f79e Satisfy qt formatter 2021-07-03 01:54:10 +02:00
Henrik Giesel
5b2290f868 Execute Ctrl+C/V/X/A through execCommand in editor (so we can customize it) 2021-07-03 01:48:49 +02:00
RumovZ
94cc0cf901 Add flag manager and hook
'FlagManager' allows cached access to the flag objects, takes care of
renaming flags and notifies GUI components with the hook
'flag_label_did_change'.
2021-07-02 11:16:10 +02:00
Henrik Giesel
db4cbfcb26 More uniform file naming
kebap-case for .ts, .scss, .html, and directories
2021-07-01 12:24:16 +02:00
Henrik Giesel
01cc9df232 Add flag icons from mdi after all
- This way, we can also use their modifier versions with little pluses/minuses
2021-07-01 01:16:50 +02:00
Henrik Giesel
d5f8a6e50c Remove multiple icons, new notetype/cardtype icons 2021-07-01 01:12:11 +02:00
Henrik Giesel
eec7eae885 Remove name_prefix from field sidebar item 2021-06-30 21:02:23 +02:00
Henrik Giesel
e1c171b819 Add missing type hint 2021-06-30 21:02:23 +02:00
Henrik Giesel
32f3c5dbe7 Replace card state and clock icon 2021-06-30 21:02:23 +02:00
Henrik Giesel
1850f24c4b Replace saved search icon 2021-06-30 21:02:23 +02:00
Henrik Giesel
5031bafb61 Add NOTETYPE_FIELD sidebar items 2021-06-30 21:02:23 +02:00
Henrik Giesel
fecceb1997 Add notetype icons 2021-06-30 21:02:23 +02:00
Henrik Giesel
5fe2519619 Add new icons for decks 2021-06-30 21:02:23 +02:00
Henrik Giesel
d9a368631f Add tag_multiple icon 2021-06-30 21:02:23 +02:00
Damien Elmes
309f5ee528 minor follow-up to #1257
No need for a separate argument, as we only want to scroll when
searching.
2021-06-29 11:53:10 +10:00
Damien Elmes
8743ccf682 Merge pull request #1257 from abdnh/sidebar-scroll-to-first-match
Scroll to first sidebar search match
2021-06-29 11:44:28 +10:00
Damien Elmes
2bada06570 use inner function instead of return value in _expand_where_necessary() 2021-06-29 11:40:59 +10:00
abdo
27313ba53d Scroll to first sidebar search match 2021-06-28 14:44:09 +03:00
RumovZ
1be1ca5911 Fix id check for today and card state items 2021-06-28 12:55:59 +02:00