Mods
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.6.0",
|
"version": "1.7.0",
|
||||||
"title": "Cromulant",
|
"title": "Cromulant",
|
||||||
"program": "cromulant",
|
"program": "cromulant",
|
||||||
"author": "madprops",
|
"author": "madprops",
|
||||||
|
@@ -8,12 +8,18 @@ from .config import Config
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .ants import Ant
|
from .ants import Ant
|
||||||
|
|
||||||
|
from .utils import Utils
|
||||||
|
|
||||||
|
|
||||||
class Storage:
|
class Storage:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_ants() -> Any:
|
def get_ants() -> Any:
|
||||||
with Config.ants_json.open() as file:
|
try:
|
||||||
return json.load(file)
|
with Config.ants_json.open() as file:
|
||||||
|
return json.load(file)
|
||||||
|
except Exception as e:
|
||||||
|
Utils.print(str(e))
|
||||||
|
return []
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def save_ants(ants: list[Ant]) -> None:
|
def save_ants(ants: list[Ant]) -> None:
|
||||||
@@ -29,8 +35,12 @@ class Storage:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_settings() -> Any:
|
def get_settings() -> Any:
|
||||||
with Config.settings_json.open() as file:
|
try:
|
||||||
return json.load(file)
|
with Config.settings_json.open() as file:
|
||||||
|
return json.load(file)
|
||||||
|
except Exception as e:
|
||||||
|
Utils.print(str(e))
|
||||||
|
return {}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def save_settings(settings: dict[str, Any]) -> None:
|
def save_settings(settings: dict[str, Any]) -> None:
|
||||||
|
@@ -10,7 +10,6 @@ from wonderwords import RandomWord, RandomSentence # type: ignore
|
|||||||
from fontTools.ttLib import TTFont # type: ignore
|
from fontTools.ttLib import TTFont # type: ignore
|
||||||
|
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .storage import Storage
|
|
||||||
|
|
||||||
|
|
||||||
class Utils:
|
class Utils:
|
||||||
@@ -21,6 +20,8 @@ class Utils:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare() -> None:
|
def prepare() -> None:
|
||||||
|
from .storage import Storage
|
||||||
|
|
||||||
Utils.names = Storage.get_names()
|
Utils.names = Storage.get_names()
|
||||||
Utils.countries = Storage.get_countries()
|
Utils.countries = Storage.get_countries()
|
||||||
Utils.rand_word = RandomWord()
|
Utils.rand_word = RandomWord()
|
||||||
|
Reference in New Issue
Block a user