2020-01-10 12:00:48 +01:00
|
|
|
// Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
|
2020-01-29 04:17:20 +01:00
|
|
|
#![deny(unused_must_use)]
|
|
|
|
|
Simplify note adding and the deck/notetype choosers
The existing code was really difficult to reason about:
- The default notetype depended on the selected deck, and vice versa,
and this logic was buried in the deck and notetype choosing screens,
and models.py.
- Changes to the notetype were not passed back directly, but were fired
via a hook, which changed any screen in the app that had a notetype
selector.
It also wasn't great for performance, as the most recent deck and tags
were embedded in the notetype, which can be expensive to save and sync
for large notetypes.
To address these points:
- The current deck for a notetype, and notetype for a deck, are now
stored in separate config variables, instead of directly in the deck
or notetype. These are cheap to read and write, and we'll be able to
sync them individually in the future once config syncing is updated in
the future. I seem to recall some users not wanting the tag saving
behaviour, so I've dropped that for now, but if people end up missing
it, it would be simple to add as an extra auxiliary config variable.
- The logic for getting the starting deck and notetype has been moved
into the backend. It should be the same as the older Python code, with
one exception: when "change deck depending on notetype" is enabled in
the preferences, it will start with the current notetype ("curModel"),
instead of first trying to get a deck-specific notetype.
- ModelChooser has been duplicated into notetypechooser.py, and it
has been updated to solely be concerned with keeping track of a selected
notetype - it no longer alters global state.
2021-03-08 14:23:24 +01:00
|
|
|
pub mod adding;
|
2019-12-24 23:59:33 +01:00
|
|
|
pub mod backend;
|
2020-05-26 09:18:50 +02:00
|
|
|
mod backend_proto;
|
2021-03-30 12:08:35 +02:00
|
|
|
pub mod browser_table;
|
2020-03-17 03:33:29 +01:00
|
|
|
pub mod card;
|
2020-01-27 11:41:23 +01:00
|
|
|
pub mod cloze;
|
2020-03-05 05:35:48 +01:00
|
|
|
pub mod collection;
|
2020-03-17 08:02:58 +01:00
|
|
|
pub mod config;
|
2020-05-03 04:24:18 +02:00
|
|
|
pub mod dbcheck;
|
2021-04-20 13:54:24 +02:00
|
|
|
pub mod deckconfig;
|
2020-03-17 08:02:58 +01:00
|
|
|
pub mod decks;
|
2021-04-01 08:06:24 +02:00
|
|
|
pub mod error;
|
2020-05-05 12:50:17 +02:00
|
|
|
pub mod findreplace;
|
2020-02-14 05:51:07 +01:00
|
|
|
pub mod i18n;
|
2020-02-11 04:11:20 +01:00
|
|
|
pub mod latex;
|
2021-07-22 10:03:03 +02:00
|
|
|
pub mod links;
|
2020-02-29 10:50:15 +01:00
|
|
|
pub mod log;
|
2021-02-06 06:02:40 +01:00
|
|
|
mod markdown;
|
2020-01-28 11:52:10 +01:00
|
|
|
pub mod media;
|
2020-03-05 07:29:04 +01:00
|
|
|
pub mod notes;
|
2020-04-08 02:05:07 +02:00
|
|
|
pub mod notetype;
|
2021-03-13 11:10:03 +01:00
|
|
|
pub mod ops;
|
2020-05-11 10:35:15 +02:00
|
|
|
mod preferences;
|
2020-05-26 09:18:50 +02:00
|
|
|
pub mod prelude;
|
2020-05-30 12:21:44 +02:00
|
|
|
pub mod revlog;
|
2021-02-23 05:36:30 +01:00
|
|
|
pub mod scheduler;
|
2020-03-15 10:11:45 +01:00
|
|
|
pub mod search;
|
2020-03-30 06:39:46 +02:00
|
|
|
pub mod serde;
|
2020-06-15 06:14:18 +02:00
|
|
|
mod stats;
|
2020-03-03 06:04:03 +01:00
|
|
|
pub mod storage;
|
2020-05-26 09:18:50 +02:00
|
|
|
mod sync;
|
2020-04-03 11:30:42 +02:00
|
|
|
pub mod tags;
|
2019-12-24 05:05:15 +01:00
|
|
|
pub mod template;
|
2020-01-10 12:04:52 +01:00
|
|
|
pub mod template_filters;
|
2020-01-10 12:01:23 +01:00
|
|
|
pub mod text;
|
2020-03-26 03:59:51 +01:00
|
|
|
pub mod timestamp;
|
2020-02-10 05:19:39 +01:00
|
|
|
pub mod types;
|
2020-03-29 09:52:16 +02:00
|
|
|
pub mod undo;
|
2020-05-26 09:18:50 +02:00
|
|
|
pub mod version;
|
2021-05-14 14:16:53 +02:00
|
|
|
|
|
|
|
use std::env;
|
|
|
|
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
|
|
|
|
lazy_static! {
|
|
|
|
pub(crate) static ref PYTHON_UNIT_TESTS: bool = env::var("ANKI_TEST_MODE").is_ok();
|
|
|
|
}
|