toxygen/src/util.py

26 lines
475 B
Python
Raw Normal View History

import os
2016-02-26 15:32:36 +01:00
import time
2016-02-19 22:10:24 +01:00
program_version = '0.0.1 (alpha)'
2016-02-19 22:10:24 +01:00
def log(data):
with open('logs.log', 'a') as fl:
fl.write(str(data) + '\n')
2016-02-19 22:10:24 +01:00
2016-02-20 09:06:24 +01:00
def curr_directory():
return os.path.dirname(os.path.realpath(__file__))
2016-02-26 15:32:36 +01:00
def curr_time():
2016-02-27 18:03:33 +01:00
return time.strftime("%H:%M")
2016-02-26 15:32:36 +01:00
class Singleton(object):
2016-02-25 21:40:00 +01:00
def __new__(cls, *args):
if not hasattr(cls, 'instance'):
2016-02-25 21:40:00 +01:00
cls.instance = super(Singleton, cls,).__new__(cls, *args)
return cls.instance