Exemple #1
0
def init(f):
    Conf.load(f)
    conf = Conf.getConf()
    monofont.init()
    pygame.display.init()
    # processing 'lie' section
    globals.font_size = conf.getint("lie", "font_size")
    globals.font = monofont.MonoFont(conf.get("lie", "font"), globals.font_size)
    globals.scale_horizontally = conf.getint("lie", "scale_horizontally")
    globals.darkest_gray = conf.getfloat("lie", "darkest_gray")
    (globals.cell_width, globals.cell_height) = (globals.font.w, globals.font.h)
    (globals.screen_width, globals.screen_height) = (conf.get("lie", "screen_width"), conf.get("lie", "screen_height"))
    if globals.screen_width[-2:] == "px":
        globals.screen_width = int(globals.screen_width[0:-2])
    else:
        globals.screen_width = globals.cell_width * int(globals.screen_width)
    if globals.screen_height[-2:] == "px":
        globals.screen_height = int(globals.screen_height[0:-2])
    else:
        globals.screen_height = globals.cell_height * int(globals.screen_height)
    globals.message_buffer_height = conf.get("lie", "message_buffer_height")
    if globals.message_buffer_height[-2:] == "px":
        globals.message_buffer_height = int(globals.message_buffer_height[0:-2])
    else:
        globals.message_buffer_height = int(globals.message_buffer_height) * globals.cell_height
    globals.grid_offset = globals.message_buffer_height
    globals.screen = pygame.display.set_mode((globals.screen_width, globals.screen_height))
    globals.screen.fill((0, 0, 0))
    globals.background = globals.screen.copy()
    globals.savefile_location = conf.get("lie", "savefile_location")
    globals.wizard_mode = conf.getboolean("lie", "wizard_mode")
    # processing 'logging' section
    for name, level in conf.items("logging"):
        logging.getLogger(name).setLevel(logging.getLevelName(level))
 def __init__(self):
     conf = Conf()
     conf.load('dspd.properties','../config')
     self.statuslog = StatusLog(conf,prefix = 'status_log_local')
     self.conf = conf
     self.dspd_key = conf.get('dspd_key_name')
     self.ard_key = conf.get('ard_key_name')
Exemple #3
0
def _test1():
    """Load the full coniguration"""
    logging.info("### TEST1 ###")
    mainDirs = "../../../../test/config"
    conf = Conf()
    conf.load("status_log.properties", mainDirs)
    conf.dump()

    # Default.  No connection information
    sl0 = StatusLog()
    sl0.dump()
    
    # Use init() to initialize
    sl1 = StatusLog()
    sl1.init(host='nn02.corp.xad.com', port=3306, user='******', password='******',
             dbname='xad_etl')
    sl1.dump()
    
    # Use conf to initialize.  Prefix = 'status_log'
    sl2 = StatusLog(conf)
    sl2._checkInit()
    sl2.dump()
    
    # Use conf to initialize.  Prefix = 'status_log_local'
    sl3 = StatusLog()
    sl3.confInit(conf, prefix='status_log_local')
    sl3.dump()
    
    #sl3.addStatus('TEST/statuslog_py/hourly', '2017/01/22/11')
    #sl3.addStatus('TEST/statuslog_py/DAILY', '2017/01/22')

    sl3._selectAll(50);
    
    _testStatus(sl3, 'TEST/statuslog_py/hourly', '2017/01/22/11')
    _testStatus(sl3, 'TEST/statuslog_py/hourly', '2017/01/22/12')