コード例 #1
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printDevInfo(dict_dev):
    if not dict_dev:
        return
    mode = 'bold'
    fore = 'black'
    fore_error = 'white'
    back = 'green'
    back_default = 'green'
    back_error = 'red'
    back_change = 'yellow'
    x = 1
    y = 3

    for k in dict_dev:
        string, index, state = dict_dev[k]
        if state == 1:
            back = back_change
        elif state == -1:
            back = back_error
            fore = fore_error
        else:
            back = back_default
        string = info_template % (k, string)
        myprint.printHLine(x, y + index, myprint.terminal_width, ' ', mode,
                           fore, back, False)
        myprint.printString(x, y + index, string, mode, fore, back, False)
    sys.stdout.flush()
コード例 #2
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printTitle(dev_id, time_interval, num_test_error, num_test_total):
	mode = 'bold'
	fore = 'white'
	back = 'green'
	title = title_template % (dev_id, time_interval, num_test_error, num_test_total)
	myprint.printHLine(1, 1, myprint.terminal_width, ' ', mode, fore, back)
	myprint.printString_Center(1, title, mode, fore, back)
コード例 #3
0
def printInfo(devices_id, num, test_items, stat_dict):
	x = 1
	y = 3
	mode = 'bold'
	fore = 'white'
	back = 'blue'
	fore_error = 'red'
	dev_id = devices_id[num]
	dev_stat = stat_dict[dev_id]
	string = ''

	str_dev = dev_id
	total_error = dev_stat['Total']
	if total_error > 0:
		str_dev += '[%d]' % total_error
		str_dev = myprint.useStyle(str_dev, mode, fore_error, back)
	else:
		str_dev = myprint.useStyle(str_dev, mode, fore, back)
	string += str_dev + '\t'

	for item in test_items:
		str_tmp = item
		cnt_error = dev_stat[item]
		if cnt_error > 0:
			str_tmp += '[%d]' % cnt_error
			str_tmp	= myprint.useStyle(str_tmp, mode, fore_error, back)
		else:
			str_tmp = myprint.useStyle(str_tmp, mode, fore, back)
		string += str_tmp + '\t'

	myprint.printHLine(x, y+num, myprint.terminal_width, ' ', mode, fore, back, False)
	myprint.printString(x, y+num, string)
	myprint.moveCursor(0, myprint.terminal_hight)
	sys.stdout.flush()
コード例 #4
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printTitle(num, time_interval, cnt):
	mode = 'bold'
	fore = 'white'
	back = 'green'	
	title = title_template % (num, str(time_interval), cnt)
	myprint.printHLine(1, 1, myprint.terminal_width, ' ', mode, fore, back, False)
	myprint.printString_Center(1, title, mode, fore, back)
コード例 #5
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printDevInfo(dict_dev):
	if not dict_dev:
		return
	mode = 'bold'
	fore = 'black'
	fore_error = 'white'
	back = 'green'
	back_default = 'green'
	back_error = 'red'
	back_change = 'yellow'
	x = 1
	y = 3

	for k in dict_dev:
		string, index, state = dict_dev[k]
		if state == 1:
			back = back_change
		elif state == -1:
			back = back_error
			fore = fore_error
		else:
			back = back_default
		string  = info_template % (k, string)
		myprint.printHLine(x, y+index, myprint.terminal_width, ' ', mode, fore, back, False)
		myprint.printString(x, y+index, string, mode, fore, back, False)
	sys.stdout.flush()
コード例 #6
0
def printTitle(num, time_interval, cnt):
    mode = 'bold'
    fore = 'white'
    back = 'green'
    title = title_template % (num, str(time_interval), cnt)
    myprint.printHLine(1, 1, myprint.terminal_width, ' ', mode, fore, back,
                       False)
    myprint.printString_Center(1, title, mode, fore, back)
コード例 #7
0
def printTitle(dev_num, dev_error_num, cnt, reboot):
	x = 1
	y = 1
	mode = 'bold'
	fore = 'white'
	back = 'green'
	title = title_temp % (dev_error_num, dev_num, cnt, reboot)
	myprint.printHLine(x, y, myprint.terminal_width, ' ', mode, fore, back, False)
	myprint.printString(x + 2, y, title, mode, fore, back)
コード例 #8
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def initTitle(dev_id, time_interval, num_test):
	global len_title
	mode = 'bold'
	fore = 'white'
	back = 'green'
	title = title_template_ % (dev_id, time_interval)
	len_title = len(title)
	title = title_template % (dev_id, time_interval, num_test)
	myprint.printHLine(1, 1, myprint.terminal_width, ' ', mode, fore, back)
	myprint.printString(1, 1, title, mode, fore, back)
コード例 #9
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def initTitle(dev_id, time_interval, num_test):
    global len_title
    mode = 'bold'
    fore = 'white'
    back = 'green'
    title = title_template_ % (dev_id, time_interval)
    len_title = len(title)
    title = title_template % (dev_id, time_interval, num_test)
    myprint.printHLine(1, 1, myprint.terminal_width, ' ', mode, fore, back)
    myprint.printString(1, 1, title, mode, fore, back)
コード例 #10
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printUnknowIP(unknow_ip, len_dev):
	mode = 'bold'
	fore = 'white'
	back = 'blue'
	x = 1
	y = len_dev + 3
	for index, info in enumerate(unknow_ip):
		string = "%s : %s" % info
		myprint.printHLine(x, y+index, myprint.terminal_width, ' ', mode, fore, back, False)
		myprint.printString(x, y+index, string, mode, fore, back, False)
	myprint.moveCursor(0, myprint.terminal_hight)
	sys.stdout.flush()
コード例 #11
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printUnknowIP(unknow_ip, len_dev):
    mode = 'bold'
    fore = 'white'
    back = 'blue'
    x = 1
    y = len_dev + 3
    for index, info in enumerate(unknow_ip):
        string = "%s : %s" % info
        myprint.printHLine(x, y + index, myprint.terminal_width, ' ', mode,
                           fore, back, False)
        myprint.printString(x, y + index, string, mode, fore, back, False)
    myprint.moveCursor(0, myprint.terminal_hight)
    sys.stdout.flush()
コード例 #12
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printInfo(value_left, value_right):
	mode = ''
	fore = ''
	back = ''
	x = 1
	y = 3
	cup1_x = len("value_left: ")
	cup1_y = 5
	cup2_x = len("value_left: xxxx, value_right: ")
	cup2_y = 5

	myprint.printHLine(x, y, myprint.terminal_width, ' ', mode, fore, back)
	string = info_template % (str(value_left), str(value_right))
	myprint.printString(x, y, string, mode, fore, back)
	printCup(cup1_x, cup1_y, value_left)
	printCup(cup2_x, cup2_y, value_right)
コード例 #13
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printInfo(dev_id, dev_info, num, state):
	mode = 'bold'
	fore = 'black'
	fore_error = 'white'
	back = 'green'
	back_error = 'red'
	back_change = 'yellow'
	x = 1
	y = 3
	if state == 1:
		back = back_change
	elif state == -1:
		fore = fore_error
		back = back_error
	myprint.printHLine(x, y+num, myprint.terminal_width, ' ', mode, fore, back, False)
	string = info_template % (str(dev_id), str(dev_info))
	myprint.printString(x, y+num, string, mode, fore, back, False)
	myprint.moveCursor(0, myprint.terminal_hight)
	sys.stdout.flush()
コード例 #14
0
def printInfo(dev_id, dev_info, num, state):
    mode = 'bold'
    fore = 'black'
    fore_error = 'white'
    back = 'green'
    back_error = 'red'
    back_change = 'yellow'
    x = 1
    y = 3
    if state == 1:
        back = back_change
    elif state == -1:
        fore = fore_error
        back = back_error
    myprint.printHLine(x, y + num, myprint.terminal_width, ' ', mode, fore,
                       back, False)
    string = info_template % (str(dev_id), str(dev_info))
    myprint.printString(x, y + num, string, mode, fore, back, False)
    myprint.moveCursor(0, myprint.terminal_hight)
    sys.stdout.flush()
コード例 #15
0
ファイル: printInerface.py プロジェクト: SimleCat/work_qingli
def printCup(y, value, len_f_old, init=False):
    ch = ' '
    mode = ''
    fore = 'white'
    back = 'green'
    len_f = 0

    if init:
        myprint.printHLine(1, y, myprint.terminal_width, ch, mode, fore, fore,
                           False)

    hight_have = None
    if value is None:
        len_f = 0
    else:
        value = float(value)
        if value <= cup_scale_min:
            len_f = 0
        elif value >= cup_scale_max:
            len_f = myprint.terminal_width
        else:
            len_f = float((value - cup_scale_min)) / (
                cup_scale_max - cup_scale_min) * myprint.terminal_width
            len_f = int(len_f)
    if len_f > len_f_old:
        myprint.printHLine(len_f_old + 1, y, len_f - len_f_old, ch, mode, fore,
                           back, False)
    elif len_f < len_f_old:
        myprint.printHLine(len_f + 1, y, len_f_old - len_f, ch, mode, fore,
                           fore, False)
    return len_f
コード例 #16
0
ファイル: interface.py プロジェクト: SimleCat/work_qingli
def printCup(y, value, len_f_old, init=False):
	ch = ' '
	mode = ''
	fore = 'white'
	back = 'green'
	len_f = 0

	if init:
		myprint.printHLine(1, y, myprint.terminal_width, ch, mode, fore, fore, False)

	hight_have = None
	if value is None:
		len_f = 0
	else:
		value = float(value)
		if value <= cup_scale_min:
			len_f = 0
		elif value >= cup_scale_max:
			len_f = myprint.terminal_width
		else:
			len_f = float((value - cup_scale_min)) / (cup_scale_max - cup_scale_min) * myprint.terminal_width
			len_f = int(len_f)
	if len_f > len_f_old:
		myprint.printHLine(len_f_old+1, y, len_f-len_f_old, ch, mode, fore, back, False)
	elif len_f < len_f_old:
		myprint.printHLine(len_f+1, y, len_f_old-len_f, ch, mode, fore, fore, False)
	return len_f
コード例 #17
0
def printPowerMater_init():
	global len_f_left_old
	global len_f_right_old
	len_f_left_old = 0
	len_f_right_old = 0
	mode = ''
	fore = ''
	back = ''
	fore_cup = 'white'
	back_cup = fore_cup
	x = 1
	y = myprint.terminal_hight - 2
	cup1_y = y + 1
	cup2_y = y + 2
	myprint.printHLine(x, y-1, myprint.terminal_width, ' ', mode, fore, back, False)
	myprint.printHLine(x, y, myprint.terminal_width, ' ', mode, fore, back, False)
	myprint.printHLine(x, cup1_y, myprint.terminal_width, ' ', mode, fore_cup, back_cup, False)
	myprint.printHLine(x, cup2_y, myprint.terminal_width, ' ', mode, fore_cup, back_cup)