38 lines
838 B
Python
38 lines
838 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Fri Jan 8 10:26:56 2021
|
|
|
|
@author: neal
|
|
"""
|
|
|
|
import os
|
|
import system
|
|
import yaml
|
|
|
|
class ArrowHandle():
|
|
def __init__(self, icon):
|
|
self.pathfilename = "./" + "config.yaml"
|
|
self.config = []
|
|
|
|
def find_config(self, path=".", file="config.yaml"):
|
|
# local first
|
|
if path.isfile(file):
|
|
self.pathfilename = file
|
|
return 1
|
|
elif path.isfile(path + "/" + file):
|
|
self.pathfilename = path + "/" + file
|
|
return 1
|
|
else:
|
|
print("Config file not found:", file)
|
|
return 0
|
|
|
|
def read_config(self, path=".", file="config.yaml"):
|
|
if self.find_config(path, file):
|
|
with open(self.pathfilename) as f:
|
|
self.config = yaml.load(f, Loader=yaml.FullLoader)
|
|
f.close()
|
|
else:
|
|
self.config= []
|
|
return self.config
|