Commit Graph

5269 Commits

Author SHA1 Message Date
kelciour
72ea605050 Revert back to listening for idle callback
https://forums.ankiweb.net/t/anki-2-1-33-linux-audio-stops-working/3023
2020-09-16 09:25:18 +03:00
Damien Elmes
a8eba9d341
Merge pull request #758 from hgiesel/synchook
Add sync_will_start and sync_did_finish hook
2020-09-15 21:20:46 +10:00
Henrik Giesel
f147e90146 Move sync_did_finish before reset 2020-09-15 13:06:11 +02:00
Damien Elmes
dd1e19d5af
Merge pull request #760 from abdnh/extended-drop
Support extended drag & drop
2020-09-15 20:31:43 +10:00
abdo
151f854fa2 Support extended drag & drop 2020-09-14 17:07:31 +03:00
Henrik Giesel
0c7caa1644 Add some documentation to sync_did_finish hook 2020-09-14 13:18:16 +02:00
Henrik Giesel
6e5a826993 Put sync_did_finish hook before after_sync because it might unload collection 2020-09-14 13:06:20 +02:00
Henrik Giesel
8dcd84e7c0 Add sync_will_start and sync_did_finish hook 2020-09-14 12:22:01 +02:00
Damien Elmes
340c749d4c add pointers to other README files 2020-09-09 10:01:42 +10:00
Damien Elmes
8accd96823
Merge pull request #753 from kaczmarj/add/dockerfile
add Dockerfile
2020-09-09 09:49:13 +10:00
Damien Elmes
061d89bbda fix padding in RTL langs
closes #757
2020-09-09 09:44:15 +10:00
Jakub Kaczmarzyk
d808415a9e
Merge branch 'master' into add/dockerfile 2020-09-08 14:59:32 -04:00
Jakub Kaczmarzyk
d07185693c
Update Dockerfile and add README.docker
- Fix permissions in `/opt` to allow non-root user to compile Anki (which requires reading and/or creating files below `/opt`).
- Create `pythonbuilder` stage, which runs only `make build`. The wheels from this stage are copied into the final stage.
- Add README.docker
2020-09-08 14:58:25 -04:00
Damien Elmes
4faaeb492f typo 2020-09-07 16:09:52 +10:00
Damien Elmes
d4edbd5b11 doc updates
thanks to Robert: https://github.com/ankitects/anki/pull/756

closes #756
2020-09-07 16:03:48 +10:00
Damien Elmes
0f1e277c59
Merge pull request #752 from cyphar/rust-deps
rust: switch to stable compilers
2020-09-07 15:25:38 +10:00
Aleksa Sarai
16864e616f
rust: switch to stable compilers
The only dependency which required nightly compilers was pyo3, which
supports stable Rust (1.39.0 and later) since version 0.11.0. Supporting
stable Rust makes it easier to package Anki for distributions. No other
code changes were required.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-05 19:39:51 +10:00
Aleksa Sarai
d2ada5a1ee
rslib: disable bzip2 feature
We can't link against libzip2.so.1 when building manylinux wheels, but
the only dependency which required this was "zip" and we don't appear to
make use of bzip2 in Anki.

This fixes the following "make build" error on Linux:

  x maturin failed
    Caused by: Failed to ensure manylinux compliance
    Caused by: Your library is not manylinux compliant because it links the following forbidden libraries: ["libbz2.so.1"]

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-05 19:39:11 +10:00
Aleksa Sarai
312393e825
rs: remove most &mut references in BackendService
The previous implementation had some slightly questionable memory safety
properties (older versions of PyO3 didn't uphold the Rust aliasing rules
and would thus create multiple &mut references to #[pyclass] objects).
This explains why Backend has internal Mutex<T>s even though all of its
methods took &mut self.

The solution is to simply make all methods take &self, which luckily
doesn't pose too make issues -- most of the code inside Backend already
has sufficient locking. The only two things which needed to be
explicitly handled where:

1. "self.runtime" which was fairly easy to handle. All usages of
   the Runtime only require an immutable reference to create a new
   Handle, so we could switch to OnceCell which provides
   lazy-initialisation semantics without needing a more heavy-handed
   Mutex<tokio::runtime::Handle>.

2. "self.sync_abort" was simply wrapped in a Mutex<>, though some of the
   odd semantics of sync_abort (not being able to handle multiple
   processes synchronising at the same time) become pretty obvious with
   this change (for now we just log a warning in that case). In
   addition, switch to an RAII-style guard to make sure we don't forget
   to clear the abort_handle.

As a result, we now no longer break Rust's aliasing rules and we can
build with newer versions of PyO3 which have runtime checks for these
things (and build on stable Rust).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-05 19:37:59 +10:00
Aleksa Sarai
70339e07f9
rslib: auto-format protobuf code
prost-build doesn't generate rustfmt-safe code, so we had to add it to
the ignore list for rustfmt on "make check". However, the ignore list
isn't supported by stable rustfmt, so we have to work around this some
other way -- in this case, just do "rustfmt" on the generated file in
"build.rs" (this way, formatting errors in checked-in source code are
still caught but generated code doesn't cause spurrious errors).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-04 16:30:06 +10:00
Damien Elmes
0455e760c6 another showDupes fix from ANH
https://forums.ankiweb.net/t/show-duplicates-not-working/2883/10
2020-09-04 10:13:30 +10:00
Damien Elmes
21749a3b0c sound tags need filename html escaped
https://forums.ankiweb.net/t/unable-to-play-longer-audio-on-cards/1313/30
2020-09-04 09:36:38 +10:00
Damien Elmes
c82a084edf handle quoted html chars in media check
https://forums.ankiweb.net/t/unable-to-play-longer-audio-on-cards/1313/30
2020-09-04 09:36:38 +10:00
Damien Elmes
dc1f489d3e Revert "Merge pull request #749 from ANH25/editor-media-autoplay"
This reverts commit 9aa3d7867e, reversing
changes made to c3a1acb524.

https://github.com/ankitects/anki/pull/749#issuecomment-686385112
2020-09-04 08:34:26 +10:00
Damien Elmes
a43135f3d5 fix custom study link being shown in filtered deck
https://forums.ankiweb.net/t/crashing-after-custom-study-learn-forgotten-cards/3013
2020-09-04 08:31:33 +10:00
Jakub Kaczmarzyk
a22f671f3b add maintainer label 2020-09-03 09:21:02 -04:00
Damien Elmes
ade7f438ce rebuild_filtered_deck() and new_filtered() 2020-09-03 18:02:47 +10:00
Damien Elmes
f87fa762be empty_filtered_deck() 2020-09-03 17:43:07 +10:00
Damien Elmes
56ceb6ba76 set_deck() 2020-09-03 17:42:46 +10:00
Damien Elmes
9214c4a700 support did:[deck id] search 2020-09-03 16:43:22 +10:00
Damien Elmes
97778bec43 log 0 day interval as 1 day
Allows distinguishing it from resetting to new, and is treated as
a one day delay when answering anyway.
2020-09-03 16:00:06 +10:00
Damien Elmes
b65174a026 move card sorting and resetting to backend 2020-09-03 15:54:15 +10:00
Damien Elmes
e56f83be84 set local offset when saving preferences 2020-09-03 12:43:18 +10:00
Jakub Kaczmarzyk
de5feef0a4 fix jakub kaczmarzyk's email 2020-09-02 16:12:52 -04:00
Jakub Kaczmarzyk
6e5519ef80 add Jakub Kaczmarzyk + rm whitespace 2020-09-02 15:58:26 -04:00
Jakub Kaczmarzyk
fa43164ba8 add Dockerfile
Docker provides a standard way of installing software. This is particularly useful with software that requires fairly complex dependencies, like Anki. The Dockerfile added in this commit builds a Docker image with Anki. The Docker image is based on `python:3.8`, which is based on a Debian Buster image. This Docker image can be useful to end users, because it can be installed on any system that has Docker (e.g., Windows, macOS, Linux), and it is also useful to developers who might not have -- or want to install -- the dependencies that Anki requires at compile time.

To build the image, run `docker build --tag anki .` in the project root directory.

To run the image with a GUI (on Unix-like systems), run

```
docker run --rm -it --env "DISPLAY=$DISPLAY" --volume /tmp/.X11-unix:/tmp/.X11-unix anki
```

One may also mount a user's Anki directory into the container and run the container as the current user.

One may also run with Singularity (which typically has more transparent support for GUI applications and behaving as the current user) by first building the Docker image as above and then converting to Singularity Image Format (SIF) with

```
sudo singularity build anki.sif docker-daemon://anki:latest
```

Run the Singularity image with

```
singularity run anki.sif
```
2020-09-02 15:35:18 -04:00
Damien Elmes
ce49ca9401 log manual reschedule, but ignore the log entry in the stats 2020-09-02 17:56:23 +10:00
Damien Elmes
39212a38aa move reschedCards() to backend 2020-09-02 17:56:23 +10:00
Damien Elmes
8f9037cf0f move filtered deck empty/fill to backend
emptying of individual card ids still to be done
2020-09-02 17:56:23 +10:00
Damien Elmes
8d2867aa2d fix night mode on old graphs 2020-09-02 17:56:12 +10:00
Damien Elmes
ccfd6244de ensure background override works in night mode 2020-09-01 12:20:45 +10:00
Damien Elmes
449f335dde add a small default margin 2020-09-01 10:24:38 +10:00
Damien Elmes
a834df60ce rename some card+note fields in backend 2020-09-01 10:24:38 +10:00
Damien Elmes
d3dede057a move bury/suspend into backend 2020-09-01 10:24:38 +10:00
Damien Elmes
ac265fe75a formatting fixes for latest black 2020-09-01 10:24:38 +10:00
Damien Elmes
ccfa989c62 move unbury/unsuspend routines into backend 2020-09-01 10:24:38 +10:00
Damien Elmes
e80b3eeeef fix some lints 2020-09-01 10:24:38 +10:00
Damien Elmes
ac6397ae9e add separate sched/user bury searches, and fix bury enums 2020-09-01 10:24:38 +10:00
Damien Elmes
e4fa549af2 default to true in want_release_gil() 2020-09-01 10:24:38 +10:00
Damien Elmes
67cb510c8e add a hook to support extending external .html files 2020-09-01 10:24:38 +10:00