added dependencies [dev] closes #18

master
Josef Dabrowski 6 years ago
parent b597543189
commit 00a15f0c81

Binary file not shown.

@ -15,9 +15,7 @@ class Manager():
def __init__(self): def __init__(self):
self.manager_id = gen_id() self.manager_id = gen_id()
self.devices = [] self.devices = []
self.config = {} self.config = self.import_config_file()
self.import_config_file()
self.construct_from_config() self.construct_from_config()
def add_device(self, name, resolution): #add parameters for Device class constructor 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 = toml.load(os.path.join(mydir, 'config.toml'))
#config = convert(uni_config) #config = convert(uni_config)
restored_data = restore(config) restored_data = restore(config)
self.config = restored_data return restored_data
self.devices = self.config['devices']
except: except:
return None return None
@ -48,6 +45,12 @@ class Manager():
with open(path, "w+") as config_file: with open(path, "w+") as config_file:
config_file.write(toml.dumps({'devices': preserved_data})) 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): #def update_config(self, new_config_tuple):
# new_device_list = [] # new_device_list = []
# for dev in devices: # for dev in devices:
@ -64,14 +67,7 @@ class Manager():
def clear_layout(self, device): def clear_layout(self, device):
device.layout = {} 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 @preservable
class Device(): class Device():
@ -91,10 +87,9 @@ class Device():
#generated #generated
self.device_image = None self.device_image = None
class Layout(): #@preservable
# Layout class to contain a layout and functions to manipulate that layout. #class Widget():
def __init__(self):
self.layout = {}
# Global Functions # Global Functions

@ -1,7 +1,7 @@
[[devices]] [[devices]]
name = "test" name = "test"
resolution = [ 1, 2,] resolution = [ 1, 2,]
device_id = "e79e6f13-60a8-4dd9-b7ba-665a0939f9f5" device_id = "1f85b632-4457-4097-859a-03ae24cd3ad7"
widgets = [] widgets = []
"<_jam>" = "Device" "<_jam>" = "Device"

@ -3,7 +3,19 @@ from distutils.core import setup
setup( setup(
name='Notiframe', name='Notiframe',
version='0.1dev', version='0.1dev',
url='https://git.distreon.net/josef/NotiFrame',
packages=['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(), long_description=open('README.md').read(),
url='https://git.distreon.net/josef/NotiFrame', long_description_content_type='text/markdown'
) )

@ -12,4 +12,5 @@ def test_config_dumpload():
mgr.export_config_file() mgr.export_config_file()
mgr = Notiframe.Manager() mgr = Notiframe.Manager()
assert mgr.devices[0].name == 'test' assert mgr.devices[0].name == 'test'

Loading…
Cancel
Save