Commit Graph

68 Commits

Author SHA1 Message Date
Damien Elmes
479e19844b fix incorrect platform specifier
It should have been isLin, but we don't even need to check it -
the env var alone should suffice.
2021-06-01 17:41:15 +10:00
Damien Elmes
b9f8cdb8bc try to fall back to xcb if wayland forced on packaged build
https://forums.ankiweb.net/t/anki-doesnt-start-under-wayland-linux/10409/5
2021-06-01 17:38:35 +10:00
Damien Elmes
e687552aeb update TR references that crossed multiple lines 2021-03-26 14:38:15 +10:00
Damien Elmes
0c338bfd53 update no-arg tr references in qt/ 2021-03-26 13:48:26 +10:00
Damien Elmes
9aece2a7b8 rework translation handling
Instead of generating a fluent.proto file with a giant enum, create
a .json file representing the translations that downstream consumers
can use for code generation.

This enables the generation of a separate method for each translation,
with a docstring that shows the actual text, and any required arguments
listed in the function signature.

The codebase is still using the old enum for now; updating it will need
to come in future commits, and the old enum will need to be kept
around, as add-ons are referencing it.

Other changes:

- move translation code into a separate crate
- store the translations on a per-file/module basis, which will allow
us to avoid sending 1000+ strings on each JS page load in the future
- drop the undocumented support for external .ftl files, that we weren't
using
- duplicate strings in translation files are now checked for at build
time
- fix i18n test failing when run outside Bazel
- drop slog dependency in i18n module
2021-03-26 09:41:32 +10:00
Damien Elmes
5a1b00b6e6 dyndeckconf -> filtered_deck 2021-03-24 13:17:12 +10:00
Damien Elmes
1a7562e554 fix profile dumping on platforms other than Macs
https://github.com/ankitects/anki/pull/1082#issuecomment-803660818
2021-03-22 09:44:06 +10:00
Damien Elmes
0c59c8b591 fix a bunch of qt typing issues uncovered by the following commit 2021-03-19 19:45:21 +10:00
Damien Elmes
88c002f4eb convert qt strings to f-strings with flynt
Also revealed an incorrect type def in editor.py that mypy wasn't
noticing before :-(
2021-02-11 10:09:06 +10:00
Damien Elmes
b8d67cdad5 move remaining Filter button items into sidebar
- Closes #976
- Added helper to apply arbitrary colour to an icon.
- Fix #979 - low res icons in night mode.
- The icons and colours are not perfect - please feel free to send
through a PR if you can improve them.
- Convert colors dictionary into module consts, so we can
use code completion.
- Added "Edited Today" and "Due Tomorrow"
- Rename camelCase attribute to snake_case and tweak the wording
of some enum constants. We've already broken compatibility with the
major sidebar add-ons, so we may as well make these changes while we
can.
- Removed Filter button. Currently there is no exposed way to toggle
the Sidebar off - wonder if we still need it?
2021-02-05 18:58:22 +10:00
Damien Elmes
a602f0342c fix Qt translations in macOS packaged build 2021-02-04 20:28:25 +10:00
Damien Elmes
6426edb0ac more typing updates 2021-02-02 23:31:55 +10:00
Damien Elmes
7e22bc16bc fix: Qt translations not working
Will need to manually confirm this is working in the bundled builds
2021-02-02 21:12:28 +10:00
RumovZ
c18af2a0a9 Merge branch 'master' into dyn-deckconf 2021-02-01 23:33:41 +01:00
Damien Elmes
a56b09b987 add a bunch of return types 2021-02-01 23:53:23 +10:00
RumovZ
5aac81d15f Make DialogManager accept kwargs
When opening a dialogue accepting multiple optional arguments, relying
on position is error-prone and requires passing Nones to fill unused
parameter slots.
2021-02-01 08:50:19 +01:00
RumovZ
52867dfa6c Make dyndeckconf a registered dialogue 2021-01-31 22:37:08 +01: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
633034b24d add local sync server frontend 2021-01-13 11:42:00 +10:00
Henrik Giesel
44fb7e3dc2 Open AddonsDialog via dialog manager 2020-12-26 18:07:37 +01:00
Damien Elmes
0a633160c5 add video driver enum; allow setting angle+software on mac in prefs 2020-12-22 13:01:06 +10:00
Damien Elmes
32b6e8e198 document ANKI_PROFILE_CODE and add bazel command to run snakeviz 2020-12-17 12:03:24 +10:00
abdo
a8e4a58139 Fix UnboundLocalError in profiler code 2020-11-25 04:54:41 +03:00
abdo
7d7745fbb5 Set up default language before loading profile
We can make more strings translatable this way.
2020-11-21 05:29:23 +03:00
Damien Elmes
1c5f94d46f strip out unused gettext refs 2020-11-18 13:22:51 +10:00
Damien Elmes
ffa26fe4bc fix remaining _() references; remove unused imports 2020-11-18 12:43:46 +10:00
Damien Elmes
6e3f971ae1 handle packaged pylib buildinfo.txt; drop aqt buildinfo 2020-11-11 10:33:49 +10:00
Damien Elmes
06292a45f3 formatting fix
formatting fix
2020-10-14 10:35:57 +10:00
Damien Elmes
02ceab55c0
Update __init__.py 2020-10-14 09:45:34 +10:00
Andreas Reis
21f072a666 Add command-line argument to skip addons
Shift doesn't work for me occasionally, for whatever reason. So just add an -s to skip it that way.

(Also, update my github nick)
2020-10-14 01:31:07 +02:00
johan456789
91d3ded689 remove never used link 2020-10-10 00:07:34 +08:00
Damien Elmes
a517accee3 update to latest black 2020-08-31 13:29:28 +10:00
Damien Elmes
603210149c update to latest isort, pylint and pytest 2020-08-31 12:05:36 +10:00
Damien Elmes
3019d0dfdf fix Windows packages failing to start 2020-08-06 09:05:26 +10:00
Damien Elmes
5c176b23c4 fix untyped def issues in aqt/__init__.py 2020-08-02 10:22:08 +10:00
Damien Elmes
a8139ebb40 force stdout/stderr encoding to utf8
As a GUI app, Anki only uses these for debugging info, and we've been
bitten numerous times in the past by bugs caused by printing Unicode
when the console only supported ASCII. An ens var might have been
a better approach, but Pyinstaller does not support defining them before
Python is initialized from what I can tell.

Latest issue:
https://forums.ankiweb.net/t/crashing-anki-version-2-1-29-bbff62bf/1650
2020-08-01 11:31:22 +10:00
Damien Elmes
dbbdd16f0f apply AltGr workaround on qt 5.14 as well 2020-07-26 10:13:53 +10:00
Damien Elmes
2cba721702 formatting and debug statement tweak 2020-07-24 11:57:37 +10:00
Damien Elmes
c3266ea060 enable AltGr workaround by default
5.15.1 may still be another month away
2020-07-24 10:32:50 +10:00
Damien Elmes
01ff6ab55d apply rtl dir to webviews
https://forums.ankiweb.net/t/gui-problems-with-right-to-left-languages/1205
2020-07-21 11:52:25 +10:00
Damien Elmes
40f270c386 shift+click on the graphs button to access old graphs for now 2020-06-30 20:07:46 +10:00
evandrocoan
9867e5e1f7 Create the command line argument -v/--version to print version
https://forums.ankiweb.net/t/i-couldnt-open-anki-resetting-corrupt-global/190
2020-06-19 13:13:10 -03:00
Damien Elmes
caf95742da handle unicode hostnames
https://anki.tenderapp.com/discussions/ankidesktop/41915-something-wrong-and-i-cant-start-anki
2020-06-01 13:40:17 +10:00
evandrocoan
5bec874a7b Set to also print the correct QT log message category 2020-05-31 19:38:02 -03:00
evandrocoan
25ff525cc9 Print qt context if it exists
https://stackoverflow.com/questions/42561295/qt-error-is-printed-on-the-console-how-to-see-where-it-originates-from
https://stackoverflow.com/questions/35894171/redirect-qdebug-output-to-file-with-pyqt5
https://anki.tenderapp.com/discussions/ankidesktop/42070-anki-closes-without-warning-when-importing-conflicting-shared-deck
https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler
2020-05-31 19:38:02 -03:00
Damien Elmes
a53aac40f8
Merge pull request #610 from evandroforks/ask_confirmation_before_moving_anki_collection
Ask user confirmation before moving the Anki directory
2020-05-18 19:44:27 +10:00
Damien Elmes
578b60c104 save profile stats to file instead of generating report
Can use an external tool like snakeviz to query them after a run.
2020-05-16 12:53:01 +10:00
evandrocoan
5f9dbf9b7d Set to restart Anki application after profile directory migration
Ask user confirmation before moving the Anki directory
https://github.com/ankitects/anki/pull 610
2020-05-10 18:30:58 -03:00
Damien Elmes
2f57c646e0 benchmark->profile, and remove from error branches 2020-05-05 16:28:49 +10:00
Damien Elmes
e7ebcc7c75
Merge pull request #605 from evandroforks/benchmark_option
Created the --benchmark command line option
2020-05-05 16:23:00 +10:00