PEP 8 compliance.
This commit is contained in:
parent
e8d06c616f
commit
ff384678de
1 changed files with 48 additions and 43 deletions
|
@ -6,29 +6,33 @@ import tomlkit
|
||||||
|
|
||||||
from cliff.command import Command
|
from cliff.command import Command
|
||||||
|
|
||||||
THUMB_WIDTH=1280
|
THUMB_WIDTH = 1280
|
||||||
THUMB_HEIGHT=720
|
THUMB_HEIGHT = 720
|
||||||
FONT="League-Spartan-Bold"
|
FONT = "League-Spartan-Bold"
|
||||||
TEXT_FILL_COLOR="white"
|
TEXT_FILL_COLOR = "white"
|
||||||
TEXT_STROKE_COLOR="srgb(176,0,0)"
|
TEXT_STROKE_COLOR = "srgb(176,0,0)"
|
||||||
|
|
||||||
MIRROR="https://youfailit.net/pub/idgames" # NYC
|
MIRROR = "https://youfailit.net/pub/idgames" # NYC
|
||||||
|
|
||||||
|
|
||||||
class Base(Command):
|
class Base(Command):
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument('--doom', default=pathlib.Path.home().joinpath("doom"))
|
parser.add_argument(
|
||||||
|
'--doom', default=pathlib.Path.home().joinpath("doom"))
|
||||||
parser.add_argument('--config-name', default='config.toml')
|
parser.add_argument('--config-name', default='config.toml')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def init_base(self, parsed_args):
|
def init_base(self, parsed_args):
|
||||||
self._doom = pathlib.Path(parsed_args.doom)
|
self._doom = pathlib.Path(parsed_args.doom)
|
||||||
self._config_name = parsed_args.config_name
|
self._config_name = parsed_args.config_name
|
||||||
self._config = tomlkit.toml_file.TOMLFile(self.doom.joinpath(self.config_name)).read()
|
self._config = tomlkit.toml_file.TOMLFile(
|
||||||
|
self.doom.joinpath(self.config_name)).read()
|
||||||
self._dsda = self._config.get("dsda")
|
self._dsda = self._config.get("dsda")
|
||||||
if self.dsda is None:
|
if self.dsda is None:
|
||||||
raise Exception(f"required key 'dsda' not set in config {self.doom.joinpath(self.config_name)}.")
|
raise Exception(
|
||||||
|
"required key 'dsda' not set in config "
|
||||||
|
+ f"{self.doom.joinpath(self.config_name)}.")
|
||||||
for d in ("iwads", "pwads", "demos", "fabricate"):
|
for d in ("iwads", "pwads", "demos", "fabricate"):
|
||||||
self._init_path(d)
|
self._init_path(d)
|
||||||
|
|
||||||
|
@ -37,8 +41,10 @@ class Base(Command):
|
||||||
self.take_action(parsed_args)
|
self.take_action(parsed_args)
|
||||||
|
|
||||||
def _init_path(self, what):
|
def _init_path(self, what):
|
||||||
setattr(self, f"_{what}", self.doom.joinpath(self._config.get(what, what)))
|
setattr(
|
||||||
setattr(type(self), what, property(lambda self: getattr(self, f"_{what}")))
|
self, f"_{what}", self.doom.joinpath(self._config.get(what, what)))
|
||||||
|
setattr(
|
||||||
|
type(self), what, property(lambda self: getattr(self, f"_{what}")))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def doom(self):
|
def doom(self):
|
||||||
|
@ -59,4 +65,3 @@ class Base(Command):
|
||||||
with io.open(iwadpath) as f:
|
with io.open(iwadpath) as f:
|
||||||
iwad = self.iwads.joinpath(f.read().strip() + ".WAD")
|
iwad = self.iwads.joinpath(f.read().strip() + ".WAD")
|
||||||
return iwad
|
return iwad
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue