diff --git a/.coverage b/.coverage new file mode 100644 index 0000000..f840af9 Binary files /dev/null and b/.coverage differ diff --git a/notiframe/Notiframe.py b/notiframe/Notiframe.py index 954add2..363444a 100644 --- a/notiframe/Notiframe.py +++ b/notiframe/Notiframe.py @@ -15,9 +15,7 @@ class Manager(): def __init__(self): self.manager_id = gen_id() self.devices = [] - self.config = {} - - self.import_config_file() + self.config = self.import_config_file() self.construct_from_config() def add_device(self, name, resolution): #add parameters for Device class constructor @@ -36,8 +34,7 @@ class Manager(): config = toml.load(os.path.join(mydir, 'config.toml')) #config = convert(uni_config) restored_data = restore(config) - self.config = restored_data - self.devices = self.config['devices'] + return restored_data except: return None @@ -48,6 +45,12 @@ class Manager(): with open(path, "w+") as config_file: config_file.write(toml.dumps({'devices': preserved_data})) + def construct_from_config(self): + try: + self.devices = self.config['devices'] + except: + return None + #def update_config(self, new_config_tuple): # new_device_list = [] # for dev in devices: @@ -64,14 +67,7 @@ class Manager(): def clear_layout(self, device): device.layout = {} - def construct_from_config(self): - try: - for confdev in self.config.devices: - dev = Device(confdev.name, confdev.resolution, confdev.device_id) - #for cwidg in dev.widgets: ###add code to construct widgets as well - self.devices.append(dev) - except: - return None + @preservable class Device(): @@ -91,10 +87,9 @@ class Device(): #generated self.device_image = None -class Layout(): - # Layout class to contain a layout and functions to manipulate that layout. - def __init__(self): - self.layout = {} +#@preservable +#class Widget(): + # Global Functions diff --git a/notiframe/config.toml b/notiframe/config.toml index 08fe310..4bd7b55 100644 --- a/notiframe/config.toml +++ b/notiframe/config.toml @@ -1,7 +1,7 @@ [[devices]] name = "test" resolution = [ 1, 2,] -device_id = "e79e6f13-60a8-4dd9-b7ba-665a0939f9f5" +device_id = "1f85b632-4457-4097-859a-03ae24cd3ad7" widgets = [] "<_jam>" = "Device" diff --git a/setup.py b/setup.py index 2a260e3..a7143bd 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,19 @@ from distutils.core import setup setup( name='Notiframe', version='0.1dev', + url='https://git.distreon.net/josef/NotiFrame', packages=['notiframe',], + install_requires=[ + "toml", + "preserve@git+https://git.distreon.net/novirium/python-preserve.git" + ], + extras_require={ + 'dev': [ + 'pylint', + 'pytest', + 'pytest-cov', + ] + }, long_description=open('README.md').read(), - url='https://git.distreon.net/josef/NotiFrame', + long_description_content_type='text/markdown' ) \ No newline at end of file diff --git a/tests/test_manager.py b/tests/test_manager.py index fba90e5..c1de780 100644 --- a/tests/test_manager.py +++ b/tests/test_manager.py @@ -12,4 +12,5 @@ def test_config_dumpload(): mgr.export_config_file() mgr = Notiframe.Manager() - assert mgr.devices[0].name == 'test' \ No newline at end of file + assert mgr.devices[0].name == 'test' +