dangerzone/dangerzone/logic.py
deeplow 649e427486
Make DangerzoneGui a subclass of DangerzoneCore
Simplify state sharing by having all dangerzone core logic in one
single class instead of two.
2022-10-27 13:44:16 +01:00

38 lines
845 B
Python

import gzip
import json
import logging
import pathlib
import platform
import shutil
import subprocess
import sys
from typing import Optional
import appdirs
import colorama
from .container import convert
from .settings import Settings
from .util import get_resource_path
log = logging.getLogger(__name__)
class DangerzoneCore(object):
"""
Singleton of shared state / functionality throughout the app
"""
def __init__(self) -> None:
# Initialize terminal colors
colorama.init(autoreset=True)
# App data folder
self.appdata_path = appdirs.user_config_dir("dangerzone")
# Languages supported by tesseract
with open(get_resource_path("ocr-languages.json"), "r") as f:
self.ocr_languages = json.load(f)
# Load settings
self.settings = Settings(self)