From 0c89df9be987008e55c1b336489c41290653434b Mon Sep 17 00:00:00 2001 From: ThanosApollo Date: Thu, 1 Sep 2022 07:41:39 +0300 Subject: Remove anki addons --- .../addons21/anki_reworked/utils/css_files.py | 37 ---------------------- .../Anki2/addons21/anki_reworked/utils/logger.py | 17 ---------- .../Anki2/addons21/anki_reworked/utils/modules.py | 18 ----------- .../Anki2/addons21/anki_reworked/utils/themes.py | 34 -------------------- 4 files changed, 106 deletions(-) delete mode 100644 .local/share/Anki2/addons21/anki_reworked/utils/css_files.py delete mode 100644 .local/share/Anki2/addons21/anki_reworked/utils/logger.py delete mode 100644 .local/share/Anki2/addons21/anki_reworked/utils/modules.py delete mode 100644 .local/share/Anki2/addons21/anki_reworked/utils/themes.py (limited to '.local/share/Anki2/addons21/anki_reworked/utils') diff --git a/.local/share/Anki2/addons21/anki_reworked/utils/css_files.py b/.local/share/Anki2/addons21/anki_reworked/utils/css_files.py deleted file mode 100644 index 0b88564..0000000 --- a/.local/share/Anki2/addons21/anki_reworked/utils/css_files.py +++ /dev/null @@ -1,37 +0,0 @@ -import os -from aqt import mw - -mw.addonManager.setWebExports(__name__, r"files/.*\.(css|svg|gif|png)|user_files/.*\.(css|svg|gif|png)") -addon_package = mw.addonManager.addonFromModule(__name__) - -this_script_dir = os.path.join(os.path.dirname(__file__), "..") -files_dir = os.path.join(this_script_dir, 'files') -user_files_dir = os.path.join(this_script_dir, 'user_files') -css_files_dir = { - 'BottomBar': f"/_addons/{addon_package}/files/BottomBar.css", - 'CardLayout': f"/_addons/{addon_package}/files/CardLayout.css", - 'DeckBrowser': f"/_addons/{addon_package}/files/DeckBrowser.css", - 'Editor': f"/_addons/{addon_package}/files/Editor.css", - 'global': f"/_addons/{addon_package}/files/global.css", - 'legacy': f"/_addons/{addon_package}/files/legacy.css", - 'Overview': f"/_addons/{addon_package}/files/Overview.css", - 'QAbout': os.path.join(files_dir, 'QAbout.css'), - 'QAddCards': os.path.join(files_dir, 'QAddCards.css'), - 'QAddonsDialog': os.path.join(files_dir, 'QAddonsDialog.css'), - 'QBrowser': os.path.join(files_dir, 'QBrowser.css'), - 'QFilteredDeckConfigDialog': os.path.join(files_dir, 'QFilteredDeckConfigDialog.css'), - 'QEditCurrent': os.path.join(files_dir, 'QEditCurrent.css'), - 'QNewDeckStats': os.path.join(files_dir, 'QNewDeckStats.css'), - 'QPreferences': os.path.join(files_dir, 'QPreferences.css'), - 'Reviewer': f"/_addons/{addon_package}/files/Reviewer.css", - 'ReviewerBottomBar': f"/_addons/{addon_package}/files/ReviewerBottomBar.css", - 'TopToolbar': f"/_addons/{addon_package}/files/TopToolbar.css", -} -# Replace pathing for user customised styled files -for file in os.listdir(user_files_dir): - file = file.replace(".css", "") - if css_files_dir.get(file, "") != "": - if file.startswith("Q"): - css_files_dir[file] = os.path.join(user_files_dir, file+'.css') - else: - css_files_dir[file] = f"/_addons/{addon_package}/user_files/{file}.css" diff --git a/.local/share/Anki2/addons21/anki_reworked/utils/logger.py b/.local/share/Anki2/addons21/anki_reworked/utils/logger.py deleted file mode 100644 index 3c67988..0000000 --- a/.local/share/Anki2/addons21/anki_reworked/utils/logger.py +++ /dev/null @@ -1,17 +0,0 @@ -import os -import logging -# declare an empty logger class -class EmptyLogger(): - def debug(self, *_): - return None -logger = EmptyLogger() -# init logger -if 'ANKI_REDESIGN_DEBUG_LOGGING' in os.environ: - filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "user_files", "test.log") - logging.basicConfig(format='%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s', - datefmt='%Y%m%d-%H:%M:%S', - filename=filename, - level=logging.DEBUG) - logger = logging.getLogger('anki-redesign') - logger.setLevel(logging.DEBUG) - logger.debug("Initialized anki") diff --git a/.local/share/Anki2/addons21/anki_reworked/utils/modules.py b/.local/share/Anki2/addons21/anki_reworked/utils/modules.py deleted file mode 100644 index fc55a12..0000000 --- a/.local/share/Anki2/addons21/anki_reworked/utils/modules.py +++ /dev/null @@ -1,18 +0,0 @@ -def module_exists(module_name): - try: - __import__(module_name) - except ImportError: - return False - else: - return True - -def module_has_attribute(module_name, attribute): - if module_exists(module_name): - return hasattr(__import__(module_name), attribute) - return False - -def attribute_exists(object, attribute): - return attribute in object.__dict__ - -def context_name_includes(context, classname): - return classname in str(context.__class__) \ No newline at end of file diff --git a/.local/share/Anki2/addons21/anki_reworked/utils/themes.py b/.local/share/Anki2/addons21/anki_reworked/utils/themes.py deleted file mode 100644 index 36af2d9..0000000 --- a/.local/share/Anki2/addons21/anki_reworked/utils/themes.py +++ /dev/null @@ -1,34 +0,0 @@ -import os -import json -from aqt import mw -from .logger import logger - -this_script_dir = os.path.join(os.path.dirname(__file__), "..") -themes_dir = os.path.join(this_script_dir, 'themes') - -def get_themes_dict() -> dict: - # Replace pathing for theme files (ReColor compatible) - themes = {} - for file in os.listdir(themes_dir): - if "json" in file: - file = file.replace(".json", "") - if themes.get(file, "") == "": - themes[file] = os.path.join(themes_dir, file+'.json') - return themes - -def get_theme(theme: str) -> dict: - themes_parsed = json.loads(open(themes[theme], encoding='utf-8').read()) - theme_colors = themes_parsed.get("colors") - # Add extra color_keys on theme files if not exist (ReColor compatible) - if not theme_colors.get("PRIMARY_COLOR", False): - theme_colors["PRIMARY_COLOR"] = ["Primary Color", "#0093d0", "#0093d0", "--primary-color"] - if not theme_colors.get("FOCUS_SHADOW", False): - theme_colors["FOCUS_SHADOW"] = ["Focus Shadow", "#ff93d0", "#0093d0", "--focus-shadow-color"] - themes_parsed["colors"] = theme_colors - return themes_parsed - -def write_theme(file, theme_content): - with open(file, "w") as f: - json.dump(theme_content, f, indent=2, sort_keys=True) - -themes = get_themes_dict() -- cgit v1.2.3