reogranized imports
This commit is contained in:
parent
dd2ffebca2
commit
5a4d30e162
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
__pycache__
|
||||
*.jpg
|
||||
*.jpg
|
||||
*.png
|
@ -1,6 +1,7 @@
|
||||
import json
|
||||
import re
|
||||
|
||||
|
||||
class Config:
|
||||
DEFAULT_FONT_FAMILY = "Ubuntu Mono"
|
||||
DEFAULT_FONT_SIZE = 16
|
||||
|
2
main.py
2
main.py
@ -3,6 +3,7 @@ import os
|
||||
|
||||
from schema import InstructionSetSchema
|
||||
|
||||
|
||||
description = """Examples:
|
||||
- Default theme (black on white):
|
||||
python main.py schema.xml -o out.jpg
|
||||
@ -17,6 +18,7 @@ description = """Examples:
|
||||
python main.py schema.xml -o out.png -c transparent.json
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description=description, formatter_class=argparse.RawTextHelpFormatter)
|
||||
parser.add_argument("schema", help="Path to the schema description. Accepted formats are: YAML, JSON and XML")
|
||||
|
2
range.py
2
range.py
@ -1,6 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
|
||||
|
||||
class Range:
|
||||
def __init__(self,
|
||||
start: int,
|
||||
|
14
renderer.py
14
renderer.py
@ -1,16 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import TYPE_CHECKING
|
||||
if TYPE_CHECKING:
|
||||
from config import Config
|
||||
from range import Range
|
||||
from schema import InstructionSetSchema
|
||||
|
||||
import pygame
|
||||
|
||||
from structure import Structure
|
||||
from vec import Vec
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from config import Config
|
||||
from range import Range
|
||||
from schema import InstructionSetSchema
|
||||
|
||||
|
||||
class Renderer:
|
||||
WIDTH = 1200
|
||||
HEIGHT = 800
|
||||
@ -45,8 +48,7 @@ class Renderer:
|
||||
|
||||
def drawStructure(self,
|
||||
struct: Structure,
|
||||
structures: dict[str,
|
||||
Structure],
|
||||
structures: dict[str, Structure],
|
||||
ox: float = 0,
|
||||
oy: float = 0) -> float:
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
import yaml
|
||||
|
||||
from config import Config
|
||||
@ -7,9 +8,11 @@ from renderer import Renderer
|
||||
from structure import Structure
|
||||
from xml_loader import XMLLoader
|
||||
|
||||
|
||||
class UnsupportedFormatException(Exception):
|
||||
...
|
||||
|
||||
|
||||
class InstructionSetSchema:
|
||||
VALID_EXTENSIONS = ("yaml", "json", "xml")
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from range import Range
|
||||
|
||||
|
||||
class Structure:
|
||||
def __init__(self,
|
||||
name: str,
|
||||
|
2
vec.py
2
vec.py
@ -1,6 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from math import sqrt
|
||||
|
||||
|
||||
class Vec:
|
||||
def __init__(self, x: float = 0, y: float = 0) -> None:
|
||||
self.x = x
|
||||
|
@ -1,7 +1,9 @@
|
||||
from __future__ import annotations
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from io import TextIOWrapper
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user