def __init__(self): rename_process('telecentros') mkdir(CACHE_PATH) logging.info('Starting Telecentros Client') self.conf_client = get_default_client() if not self.conf_client.get_string('hash_id'): self.conf_client.set_string('hash_id', generate_id_bytime()) #Generate Hash_ID if not self.conf_client.get_string('server'): dlg = dialogs.ConnectServer() host = dlg.run() if host: self.conf_client.set_string('server', host) else: sys.exit(0)
from time import strftime from TeleCentros import main from TeleCentros.utils import rename_process, pid_alive from TeleCentros.utils import generate_id_bytime #USE MAC from TeleCentros.ui import dialogs # Check OpenlhClient is already running if pid_alive('TeleCentros', CLIENT_PID_FILE): dialogs.ok_only(_('TeleCentros is already running'), ICON=dialogs.gtk.MESSAGE_ERROR) sys.exit(3) pid_dir = os.path.dirname(CLIENT_PID_FILE) if not os.path.exists(pid_dir): mkdir(pid_dir) f = open(CLIENT_PID_FILE, 'w') f.write(str(os.getpid())) f.close() del pid_dir del f class TeleCentros: def __init__(self): rename_process('telecentros') mkdir(CACHE_PATH) logging.info('Starting Telecentros Client') self.conf_client = get_default_client()