toxygen/src/util.py

42 lines
804 B
Python
Raw Normal View History

import os
2016-02-26 14:32:36 +00:00
import time
from platform import system
2016-02-19 21:10:24 +00:00
program_version = '0.0.1 (alpha)'
2016-02-19 21:10:24 +00:00
def log(data):
with open('logs.log', 'a') as fl:
fl.write(str(data) + '\n')
2016-02-19 21:10:24 +00:00
2016-02-20 08:06:24 +00:00
def curr_directory():
return os.path.dirname(os.path.realpath(__file__))
2016-02-26 14:32:36 +00:00
def curr_time():
2016-02-27 17:03:33 +00:00
return time.strftime("%H:%M")
2016-02-26 14:32:36 +00:00
def get_style(style):
if style != 'default':
return style
else:
if system() == 'Linux':
return 'gtk'
elif system() == 'Windows':
return 'windows'
class Singleton(object):
2016-03-03 19:19:09 +00:00
def __new__(cls, *args, **kwargs):
if not hasattr(cls, '_instance'):
cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs)
return cls._instance
@classmethod
def get_instance(cls):
return cls._instance