# Path: FabLabKasse/scriptHelper.py
# def setupLogging(logfile):
# def setupSigInt():
#     def sigint(num, frame):
# def setupGraphicalExceptHook():
#     def myNewExceptionHook(exctype, value, tb):
# def getConfig(path="./"):
# def getDB():
#     def __init__(self, name):
# class FileLock(object):


import os
import sys
import subprocess
import time
import shutil
from FabLabKasse import scriptHelper
    os.chdir(currentDir)
    currentDir = os.getcwd() + "/"
    os.chdir(currentDir + "/FabLabKasse/")

    if "--example" in sys.argv:
        # load example config
        # test that there is no config.ini yet
        if file_exists("config.ini"):
            print("Warning: Configuration FabLabKasse/config.ini already exists, will not overwrite it.")
            if "--only-load-config" not in sys.argv:
                print("You can just start run.py without the --example argument to make this message disappear.")
                time.sleep(2)
        else:
            print("loading example configuration file. edit FabLabKasse/config.ini to change. You do not need the --example parameter later.")
            shutil.copyfile("config.ini.example", "config.ini")
    if "--only-load-config" in sys.argv:
         # the Vagrant VM provisioning script uses this to copy a default config before the first start.
         sys.exit(0)


    os.chdir(currentDir + "/FabLabKasse/UI/")
    subprocess.call("./compile_all.py")

    os.chdir(currentDir + "/FabLabKasse/")
    # subprocess.call("./importProdukte.py")
    myEnv = dict(os.environ)
    myEnv["LANG"] = "de_DE.UTF-8"
    myEnv["PYTHONIOENCODING"] = "UTF-8"
    myEnv["PYTHONPATH"] = currentDir  # FabLabKasse git folder should be the main module starting point


# Path: FabLabKasse/scriptHelper.py
# def setupLogging(logfile):
# def setupSigInt():
#     def sigint(num, frame):
# def setupGraphicalExceptHook():
#     def myNewExceptionHook(exctype, value, tb):
# def getConfig(path="./"):
# def getDB():
#     def __init__(self, name):
# class FileLock(object):


# Path: run.py
import os
import sys
import subprocess
import time
import shutil
from FabLabKasse import scriptHelper

    os.chdir(currentDir)
    currentDir = os.getcwd() + "/"
    os.chdir(currentDir + "/FabLabKasse/")

    if "--example" in sys.argv:
        # load example config
        # test that there is no config.ini yet
        if file_exists("config.ini"):
            print("Warning: Configuration FabLabKasse/config.ini already exists, will not overwrite it.")
            if "--only-load-config" not in sys.argv:
                print("You can just start run.py without the --example argument to make this message disappear.")
                time.sleep(2)
        else:
            print("loading example configuration file. edit FabLabKasse/config.ini to change. You do not need the --example parameter later.")
            shutil.copyfile("config.ini.example", "config.ini")
    if "--only-load-config" in sys.argv:
         # the Vagrant VM provisioning script uses this to copy a default config before the first start.
         sys.exit(0)


    os.chdir(currentDir + "/FabLabKasse/UI/")
    subprocess.call("./compile_all.py")

    os.chdir(currentDir + "/FabLabKasse/")
    # subprocess.call("./importProdukte.py")
    myEnv = dict(os.environ)
    myEnv["LANG"] = "de_DE.UTF-8"
    myEnv["PYTHONIOENCODING"] = "UTF-8"
    myEnv["PYTHONPATH"] = currentDir  # FabLabKasse git folder should be the main module starting point


    cfg = scriptHelper.getConfig()