toxygen/src/util.py
ingvar1995 4c1a02c9a3 Merge branch 'file_transfers'
Conflicts:
	src/mainscreen.py
2016-03-22 20:32:29 +03:00

50 lines
969 B
Python

import os
import time
from platform import system
program_version = '0.0.2 (alpha)'
def log(data):
with open('logs.log', 'a') as fl:
fl.write(str(data) + '\n')
def curr_directory():
return os.path.dirname(os.path.realpath(__file__))
def curr_time():
return time.strftime('%H:%M')
def convert_time(t):
sec = int(t) - time.timezone
m, s = divmod(sec, 60)
h, m = divmod(m, 60)
d, h = divmod(h, 24)
return '%02d:%02d' % (h, m)
def get_style(style):
if style != 'default':
return style
else:
if system() == 'Linux':
return 'gtk'
elif system() == 'Windows':
return 'windows'
class Singleton(object):
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