diff --git a/editor.py b/editor.py new file mode 100644 index 0000000..6fc2ce9 --- /dev/null +++ b/editor.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# coding:utf-8 +""" + Author: Sir Garbagetruck -- + Purpose: make editing the list.sahli file easier + Created: 2020/04/09 +""" + +import json +import argparse +import sahliEditorPython + + +def main(args): + """maintain a list.sahli file""" + if args.new: + mysahli = sahliEditorPython.sahlifile() + else: + mysahli = sahliEditorPython.sahlifile(args.filename) + a = 5 + + +if __name__ == '__main__': + ap = argparse.ArgumentParser() + ap.add_argument('-f', '--filename', default='list.sahli') + ap.add_argument('-n', '--new', action='store_true') + main(ap.parse_args()) diff --git a/sahli-editor-python/__init__.py b/sahliEditorPython/__init__.py similarity index 100% rename from sahli-editor-python/__init__.py rename to sahliEditorPython/__init__.py diff --git a/sahliEditorPython/sahlifile.py b/sahliEditorPython/sahlifile.py new file mode 100644 index 0000000..8d366bc --- /dev/null +++ b/sahliEditorPython/sahlifile.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# coding:utf-8 +""" + Author: Sir Garbagetruck -- + Purpose: base class for Sahli file + Created: 2020/04/09 +""" + +import json +######################################################################## + + +class sahlifile: + """the Sahli file structure and classes to futz with""" + + # ---------------------------------------------------------------------- + def __init__(self, filename): + """Constructor""" + self.valid_filetypes = [ + "plain", + "ansi", + "xbin", + "ice", + "adf", + "avatar", + "bin", + "idf", + "pcboard", + "tundra" + ] + self.valid_fonts = [ + 'Propaz', 'ansifont', 'mOsOul', 'Microknight', 'p0t-nOodle' + ] + if filename is not None: + with open(filename) as f: + self.sahli = json.load(f) + else: + location = self.blank_location() + slides = self.blank_slides() + filedata = [ + self.blank_filedata() + ] + self.sahli = { + 'location': location, + 'slides': slides, + 'filedata': filedata + } + + def blank_slides(self): + """blank slide structure""" + slides = { + 'background': '', + 'template': '', + 'css': '' + } + + def blank_location(self): + "blank location structure" + return '' + + def blank_filedata(self): + """Blank filedata structure""" + + filedata = { + 'file': '', + 'name': '', + 'amiga': False, + 'filetype': 'image', + 'width': '', + 'author': '', + 'font': 'Propaz', + 'color': [0, 0, 0, 255], + 'bg': [255, 255, 255, 255], + 'line1': '', + 'line2': '', + 'text': '' + } + return filedata diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..fe18ef9 --- /dev/null +++ b/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# coding:utf-8 +""" + Author: Sir Garbagetruck -- + Purpose: setup script for Sahli editor tools + Created: 2020/04/09 +""" + +from setuptools import setup, find_packages + +setup( + name="SahliEditor", + version="0.1", + packages=find_packages() +)