Commit Graph

103 Commits

Author SHA1 Message Date
Damien Elmes
a602f0342c fix Qt translations in macOS packaged build 2021-02-04 20:28:25 +10:00
Damien Elmes
168963460f update to latest mypy_protobuf
The handling of enum types has improved - we no longer need to import
separate types at typechecking time.
2021-02-03 13:31:52 +10:00
Damien Elmes
6426edb0ac more typing updates 2021-02-02 23:31:55 +10:00
Damien Elmes
7fc32db0c9 fix: slowdowns after import; hard to read popup
QTextEdit() will pin the CPU at 100% for seconds to minutes when
fed a large string to display - work around it by switching to
QPlainTextEdit().

Also strip HTML before showing the user - easier to read, and less
text to display. And turn off word wrap, as it makes it easier to skim,
and further reduces the work the widget needs to do.

https://forums.ankiweb.net/t/big-issue-where-anki-gets-slow-when-you-import-this-deck/7050
2021-02-02 15:49:47 +10:00
Damien Elmes
98f4b3db81 add types to utils.py
The function signatures for things like getFile() are awful, but
sadly are used by a bunch of add-ons.
2021-02-01 20:23:48 +10:00
Damien Elmes
9d853bbb03 start work on more clearly defining backend/protobuf boundaries
- anki._backend stores the protobuf files and rsbackend.py code
- pylib modules import protobuf messages directly from the
_pb2 files, and explicitly export any will be returned or consumed
by public pylib functions, so that calling code can import from pylib
- the "rsbackend" no longer imports and re-exports protobuf messages
- pylib can just consume them directly.
- move errors to errors.py

Still todo:

- rsbridge
- finishing the work on rsbackend, and check what we need to add
back to the original file location to avoid breaking add-ons
2021-01-31 18:55:45 +10:00
Damien Elmes
a03da5ce89 add type check to textFormat arg 2021-01-27 14:22:17 +10:00
Damien Elmes
e324f06348
Merge pull request #944 from Arthur-Milchior/help
NF: HelpPage in an enum
2021-01-26 11:33:39 +10:00
Arthur Milchior
e0a2d90a68 NF: HelpPage in an enum
Hopefully, this can help with updating on next manual update and maybe even linking to manual translation
2021-01-26 02:16:37 +01:00
RumovZ
060fdc824b Move show_invalid_search_error to utils 2021-01-25 23:19:19 +01:00
Damien Elmes
9db3f0dd19 drop tags/decks/etc from Filter button
https://github.com/ankitects/help-wanted/issues/6

These are a relic from when the sidebar defaulted to off, and I don't
think enough people are using them to bother keeping them around.
Once the the card state and saved filter functionality moves into the
sidebar and top menus, we may be able to remove the Filter button
completely.
2021-01-23 18:21:44 +10:00
wallgrenen
e001cd4d3a remove unused variables and commented-out code 2021-01-08 20:53:27 +01:00
Damien Elmes
94064b8230 convert setWindowFlags call into helper, and fix invalid variables
"type: ignore" was masking the invalid references to self in places
like showText()
2021-01-07 14:24:49 +10:00
BlueGreenMagick
6224658c0d remove context help button 2021-01-06 22:15:48 +09:00
Damien Elmes
ffa26fe4bc fix remaining _() references; remove unused imports 2020-11-18 12:43:46 +10:00
Damien Elmes
2453e5c488 update temporary val="%s" references to standard ftl 2020-11-17 22:00:44 +10:00
Damien Elmes
6418993840 merge bulk of qt/ - designer files still to do 2020-11-17 17:42:43 +10:00
Damien Elmes
e99c0dbe15
Merge pull request #793 from nwwt/object-audio-tags-support
Audio & object tag support
2020-11-11 10:33:31 +10:00
Andreas Reis
e68a40f13e cleanup / renames
・ soundRegexps →  sound_regexps

・ htmlRegexps →  html_media_regexps

・ HTML_TAGS →  HTML_MEDIA_TAGS

・ escapeImages →  escape_media_filenames + alias

・ strip_html_preserving_image_filenames →  strip_html_preserving_media_filenames
2020-11-10 14:53:04 +01:00
Damien Elmes
0d354da93a move aqt_data into source folder; implement wheel building 2020-11-04 12:14:03 +10:00
Damien Elmes
99140f6023 always return str in aqt_data_folder() 2020-11-01 14:38:13 +10:00
Damien Elmes
aea0a6fcc6 initial Bazel conversion
Running and testing should be working on the three platforms, but
there's still a fair bit that needs to be done:

- Wheel building + testing in a venv still needs to be implemented.
- Python requirements still need to be compiled with piptool and pinned;
need to compile on all platforms then merge
- Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally
unified into one place
- Currently using rustls to work around openssl compilation issues
on Linux, but this will break corporate proxies with custom SSL
authorities; need to conditionally use openssl or use
https://github.com/seanmonstar/reqwest/pull/1058
- Makefiles and docs still need cleaning up
- It may make sense to reparent ts/* to the top level, as we don't
nest the other modules under a specific language.
- rspy and pylib must always be updated in lock-step, so merging
rspy into pylib as a private module would simplify things.
- Merging desktop-ftl and mobile-ftl into the core ftl would make
managing and updating translations easier.
- Obsolete scripts need removing.
- And probably more.
2020-11-01 14:26:58 +10:00
johan456789
06f1aeb052 fix help url paths 2020-10-10 00:38:07 +08:00
Damien Elmes
603210149c update to latest isort, pylint and pytest 2020-08-31 12:05:36 +10:00
Damien Elmes
2a36455e88 fix untyped def issues in aqt/utils.py 2020-08-02 10:25:48 +10:00
evandrocoan
947f58032f Moved the utils.py new save/restore functions together 2020-06-08 16:23:32 -03:00
evandrocoan
38fba41fb2 Renamed save_combo_index to save_combo_index_for_session 2020-06-08 16:23:28 -03:00
evandrocoan
1d32873869 Renamed new function on qt/aqt/utils.py to snake case 2020-06-08 01:35:31 -03:00
evandrocoan
b23b404f68 Created the profiles.py session attribute for things to forgot
each time Anki restarted and set to only fill the find and replace
dialogs when they were filled on the actual session.
2020-06-08 01:35:31 -03:00
evandrocoan
4bc895f7df Moved restoreComboHistory below saveComboHistory as others 2020-06-08 01:35:31 -03:00
evandrocoan
bf55ebbd8a Added some type checking to utils.py QComboBox restore functions
# Conflicts:
#	qt/aqt/utils.py
2020-06-08 01:35:31 -03:00
evandrocoan
f27ad0c524 Moved restoreComboHistory closer to restoreComboIndex on utils.py 2020-06-08 01:35:31 -03:00
evandrocoan
6047c6ecc0 Renamed setupComboBoxHistory to restoreComboHisotory,
saveComboActiveIndex to saveComboIndex, saveComboBoxHistory to
saveComboHistory and restoreComboActiveIndex to restoreComboIndex.
2020-06-08 01:35:31 -03:00
evandrocoan
a74e43a515 Set to browser.py findreplace.ui remember the last selected field
by creating saveComboActiveIndex and restoreComboActiveIndex.

https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
40f98a244f Set to browser.py findreplace.ui remember the last regex/case
by creating the saveIsChecked and restoreIsChecked.

https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
54d7f136cb Created the setupComboBoxHistory and saveComboBoxHistory to remove
duplicated/common code.
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
Thomas B
26b94e1948 Update tooltip() in utils.py
Allow x,y offsets to be specified for tooltip(), useful for accomodating longer tooltips.
2020-06-07 16:06:23 -04:00
Damien Elmes
97618564f4 fix typechecking breaking with latest mypy_protobuf
the change that caused it:
https://github.com/dropbox/mypy-protobuf/issues/118

This is more awkward to handle now, as the types are only available
at type-checking time. Python's static typing is such a mess :-(
2020-05-27 09:14:02 +10:00
Damien Elmes
eec3fcf87a use qconnect everywhere, and fix some typing issues
a step towards check_untyped_defs in aqt, but there's still 100+
issues to resolve
2020-05-04 13:23:08 +10:00
Damien Elmes
0c49431719 FString -> TR 2020-02-27 12:25:19 +10:00
Damien Elmes
1afac2492b fix tr() 2020-02-24 18:37:02 +10:00
Damien Elmes
0e931808c9 translations no longer require an open collection 2020-02-23 14:57:02 +10:00
Damien Elmes
4430c67069 rework Fluent handling
- all .ftl files for a language are concatenated into a single file
at build time
- all languages are included in the binary
- external ftl files placed in the ftl folder can override the
built-in definitions
- constants are automatically generated for each string key
- dropped the separate StringsGroup enum
2020-02-23 13:22:50 +10:00
Damien Elmes
ca0df4929d add fallback for tr if collection not open
When syncing media on close, the collection may be closed before
media syncing completes.

A better solution in the future will be decouple translations from
the collection object.
2020-02-17 17:39:01 +10:00
Damien Elmes
67a741958c use new i18n infrastructure for more media check / media sync strings 2020-02-17 10:18:20 +10:00
ijgnd
6e1996f701 Extend Copy Debug Info 2020-02-04 04:16:51 +01:00
Damien Elmes
17ebdfc099 extract and flag AV tags as part of the render process
We can now show replay buttons for the audio contained in {{FrontSide}}
without having to play it again when the answer is shown.

The template code now always defers FrontSide rendering, as it wasn't
a big saving, and meant the logic had to be implemented twice.
2020-01-24 11:06:11 +10:00
Damien Elmes
e3fb184a84 fix night mode tooltips 2020-01-24 07:55:14 +10:00
Damien Elmes
5a79bc69b8 fix audio displaying console window on Windows 2020-01-23 17:27:07 +10:00
Damien Elmes
02ec3f149c update qt/ to use the new API 2020-01-20 20:10:38 +10:00
Glutanimate
1b236acb3d Fix mypy and black checks 2020-01-03 18:23:28 +01:00
Glutanimate
00991e8e8e Extend showInfo with the ability to add custom buttons
Grants more flexibility in user prompt design
2020-01-03 17:48:17 +01:00
Damien Elmes
5876866565 tweaking the folder names again
hopefully that's the last of it
2020-01-03 07:48:38 +10:00