cosmic-newlog/newlog/config.py

15 lines
397 B
Python

from configparser import ConfigParser
from os.path import expanduser as resolvePath
class Config:
def __init__(self,path="~/.config/newlog/config.ini"):
with open(resolvePath(path)) as f:
self.config = ConfigParser(f)
self.ship = False
def setShip(self,ship):
self.ship=ship
def getProperty(self,name):
if not self.ship:
return False
return self.config.get(self.ship,property)