mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-11 20:48:11 +01:00
Refactor for load configs
This commit is contained in:
parent
262b23f6be
commit
ab9ff1137d
2 changed files with 6 additions and 6 deletions
|
@ -8,7 +8,7 @@ from pathlib import Path
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
class LoadConfigs:
|
class Load:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
bold = '\033[1m'
|
bold = '\033[1m'
|
||||||
|
@ -17,7 +17,7 @@ class LoadConfigs:
|
||||||
self.endc: str = '\x1b[0m'
|
self.endc: str = '\x1b[0m'
|
||||||
self.bred: str = f'{bold}{red}'
|
self.bred: str = f'{bold}{red}'
|
||||||
|
|
||||||
def file(self, path: str, file: str) -> dict: # type: ignore
|
def config_file(self, path: str, file: str) -> dict: # type: ignore
|
||||||
try:
|
try:
|
||||||
""" Load the configs from the file. """
|
""" Load the configs from the file. """
|
||||||
config_path_file = Path(path, f'{file}.toml')
|
config_path_file = Path(path, f'{file}.toml')
|
||||||
|
@ -120,8 +120,8 @@ class Configs:
|
||||||
file_pattern_conf: str = ""
|
file_pattern_conf: str = ""
|
||||||
|
|
||||||
# Load configurations from the file.
|
# Load configurations from the file.
|
||||||
load = LoadConfigs()
|
load = Load()
|
||||||
configs = load.file(etc_path, prog_name)
|
configs = load.config_file(etc_path, prog_name)
|
||||||
|
|
||||||
if configs:
|
if configs:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -5,7 +5,7 @@ import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.configs import LoadConfigs
|
from slpkg.configs import Load
|
||||||
from slpkg.dialog_box import DialogBox
|
from slpkg.dialog_box import DialogBox
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class FormConfigs(Configs):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Configs).__init__()
|
super(Configs).__init__()
|
||||||
self.load_configs = LoadConfigs()
|
self.load_configs = Load()
|
||||||
self.dialogbox = DialogBox()
|
self.dialogbox = DialogBox()
|
||||||
self.color = self.colour()
|
self.color = self.colour()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue