mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

This adds Python 3.9 and 3.10 typing syntax to files that import attributions from __future___. Python 3.9 should be able to cope with the 3.10 syntax, but Python 3.8 will no longer work. On Windows/Mac, install the latest Python 3.9 version from python.org. There are currently no orjson wheels for Python 3.10 on Windows/Mac, which will break the build unless you have Rust installed separately. On Linux, modern distros should have Python 3.9 available already. If you're on an older distro, you'll need to build Python from source first.
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
# Copyright: Ankitects Pty Ltd and contributors
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
|
|
class BrowserConfig:
|
|
ACTIVE_CARD_COLUMNS_KEY = "activeCols"
|
|
ACTIVE_NOTE_COLUMNS_KEY = "activeNoteCols"
|
|
CARDS_SORT_COLUMN_KEY = "sortType"
|
|
NOTES_SORT_COLUMN_KEY = "noteSortType"
|
|
CARDS_SORT_BACKWARDS_KEY = "sortBackwards"
|
|
NOTES_SORT_BACKWARDS_KEY = "browserNoteSortBackwards"
|
|
|
|
@staticmethod
|
|
def active_columns_key(is_notes_mode: bool) -> str:
|
|
if is_notes_mode:
|
|
return BrowserConfig.ACTIVE_NOTE_COLUMNS_KEY
|
|
return BrowserConfig.ACTIVE_CARD_COLUMNS_KEY
|
|
|
|
@staticmethod
|
|
def sort_column_key(is_notes_mode: bool) -> str:
|
|
if is_notes_mode:
|
|
return BrowserConfig.NOTES_SORT_COLUMN_KEY
|
|
return BrowserConfig.CARDS_SORT_COLUMN_KEY
|
|
|
|
@staticmethod
|
|
def sort_backwards_key(is_notes_mode: bool) -> str:
|
|
if is_notes_mode:
|
|
return BrowserConfig.NOTES_SORT_BACKWARDS_KEY
|
|
return BrowserConfig.CARDS_SORT_BACKWARDS_KEY
|
|
|
|
|
|
class BrowserDefaults:
|
|
CARD_COLUMNS = ["noteFld", "template", "cardDue", "deck"]
|
|
NOTE_COLUMNS = ["noteFld", "note", "noteCards", "noteTags"]
|