Commit graph

51 commits

Author SHA1 Message Date
Damien Elmes
af4d4af55d fix race condition in tmp folder handling 2019-12-22 19:03:20 +10:00
Michal Pokorný (Rai)
67a39c58cb Add types for models, templates and field dicts 2019-12-21 12:02:16 +01:00
Damien Elmes
c1587254f4 use isort to tidy up imports 2019-12-20 19:19:29 +10:00
Damien Elmes
12093f2f2e add a bunch of extra hints for mypy 2019-12-20 16:40:20 +10:00
Damien Elmes
b6b8df2dcf add a bunch of annotations for mypy 2019-12-20 15:07:40 +10:00
Damien Elmes
6ffe82ac54 db/hooks/utils 2019-12-20 11:07:08 +10:00
Damien Elmes
6ecfff56c5 add pytype inferred types to anki/
I've corrected some obvious issues, and we can fix others over time.
Mypy tests are currently broken, as adding the type hints has increased
mypy's testing surface.
2019-12-20 11:07:08 +10:00
Damien Elmes
d2f4450dc0 platform-specific imports 2019-12-16 17:51:33 +10:00
Damien Elmes
a2c9b160ca don't try to remove tmp folder if it's already been removed 2019-12-16 10:07:20 +10:00
Damien Elmes
4e377a3b33 fix travis build 2019-12-16 08:22:47 +10:00
Arthur Milchior
26acc412b1 Adding explanation to translators
Some strings are missing in French at least. And some are quite
complex to understand. Especially without context, without knowledge
of Python. I tried to copy the only indication I found and add more
indication, hoping I did it correctly.
2019-10-24 02:36:32 +02:00
Damien Elmes
5c03653f3f keep json in utils for add-on compat
https://anki.tenderapp.com/discussions/beta-testing/1399-anki-2110-beta#comment_47036452
2019-03-06 07:18:26 +10:00
Damien Elmes
ebdd8dae4b tidy up unused imports 2019-03-04 17:25:19 +10:00
Damien Elmes
6e077ab414 use raw strings for regexs 2019-03-04 17:03:43 +10:00
Damien Elmes
f6b2135129 fix some warnings 2019-03-04 16:01:10 +10:00
Damien Elmes
ef23268573 use distro in place of deprecated dist() method 2019-03-04 15:39:10 +10:00
Damien Elmes
3721cc4604 silence some spurious errors and remove some unused code 2019-03-04 11:22:40 +10:00
Damien Elmes
a389b8b4a0 move versionWithBuild into anki module 2019-02-28 08:37:42 +10:00
Damien Elmes
372d5ed6e8 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Damien Elmes
a4edc57dc5 run latex commands without bundled libs
https://anki.tenderapp.com/discussions/ankidesktop/30531-latex-wont-generate-svgs-automatically-but-will-generate-pngs
2018-10-28 11:41:43 +10:00
Damien Elmes
8b6ef5579f remove comments when stripping
gets rid of unwanted metadata from ms word pastes
2018-06-09 16:27:46 +10:00
Damien Elmes
c67fc3e769 fix time translation patch 2017-12-04 12:33:23 +10:00
Damien Elmes
fcccf12ba6 night mode 2017-12-04 12:20:56 +10:00
Piotr Kubowicz
879ca0b72b Allow to better translate "in x minutes"
"There is 1 minute" and "in 1 minute" need to be translated
differently in Slavic languages.

Additionally remove unused afterTimeTable.
2017-11-30 20:03:51 +01:00
Damien Elmes
b04c2212b5 stripHTML() should work when tag split over multiple lines 2017-09-30 15:33:05 +10:00
Damien Elmes
0543a4533b add devMode flag to utils
also remove the extra toolbar call in loadProfile(), as we require a
restart to update the translations anyway
2017-08-01 14:28:13 +10:00
Damien Elmes
17d68cc957 use a clearer name for fmtQA() 2017-03-14 15:48:40 +09:00
Henrik Enggaard Hansen
1dfc4466f1 Move card formatting to anki.utils 2017-03-13 15:52:02 +01:00
Illia Volochii
13b7e01044 Stop inheriting from object
It is not needed in Python 3.
2017-02-07 00:21:33 +02:00
Damien Elmes
27c23c01d6 some html regexps should be case insensitive 2016-10-24 19:42:03 +10:00
Damien Elmes
04c13d1348 use full path to packaged audio commands
ensures we use the packaged version over the system version
2016-07-26 12:15:43 +10:00
Damien Elmes
63499fb7e9 fix entsToTxt() 2016-05-15 15:43:46 +10:00
Damien Elmes
15b349e3a8 start port to python 3
unit tests pass and main screens of GUI load
2016-05-12 14:45:35 +10:00
Soren I. Bjornstad
72b4148127 make sure temp folder hasn't been deleted since creation 2014-06-24 14:50:39 -05:00
dae
85488afb8f add TimedLog for debugging 2014-06-03 17:26:06 +09:00
Damien Elmes
3c36ddfb82 don't allow files named . or .. 2014-02-10 20:47:49 +09:00
Damien Elmes
db77c8c80b make sure simplejson always returns unicode 2013-11-10 04:57:15 +09:00
Damien Elmes
3ed2861115 include platform in cv 2013-10-06 04:37:39 +09:00
Damien Elmes
f23392b6a3 Merge pull request #35 from hssm/compile-regex
Pre-compile HTML-stripping regexes.
2013-10-04 13:39:44 -07:00
Damien Elmes
2ba8c41fec replace nbsp with standard space when stripping html
fixes https://anki.tenderapp.com/discussions/ankidesktop/1952-duplicate-not-detected-on-paste
2013-07-11 21:23:13 +09:00
Houssam Salem
0ce829b6b3 Pre-compile HTML-stripping regexes. 2013-06-23 18:37:39 +10:00
Damien Elmes
0dceb0ce22 round() doesn't convert to int 2013-05-15 23:37:27 +09:00
Mike Blume
dcf097b55f use futuristic division
Python used to use C-style division, where division of two ints was
truncated, and division involving a float resulted in a float.

This is confusing, because you often can't tell from looking at a
line of code in isolation what sort of division it's supposed to do.

With 'from __future__ import division' Python ensures that division is
always explicit.

// means (floored) integer division
/ means float division

regardless of argument types.

This should make the source a bit clearer now, as well as removing one
obstacle if Anki is ever ported to Python 3.
2013-05-05 11:09:16 -07:00
Damien Elmes
ed9fba954e handle extra attributes in imgs in condition repl (#700) 2013-04-11 18:34:53 +09:00
Damien Elmes
0b7344c84f when showing time with no decimal, round not floor 2013-04-01 14:48:17 +09:00
Damien Elmes
fa07268763 don't allow invalid chars in file export (#694) 2013-02-20 15:12:07 +09:00
Damien Elmes
ea89be5f4a make sure we encode data as utf8 before checksumming 2013-01-08 10:42:15 +09:00
Damien Elmes
8cf072c735 preserve image filenames when stripping html
- also do this for the sort field
2012-12-24 14:08:42 +09:00
Damien Elmes
b2457811a2 optimize imports 2012-12-22 09:17:10 +09:00
Damien Elmes
2095e5c4b3 strip HTML when calculating field checksum (users will need to checkDB) 2012-12-21 20:51:45 +09:00