diff --git a/pym/cl_utils2.py b/pym/cl_utils2.py index de5bafa..6e7bc3c 100644 --- a/pym/cl_utils2.py +++ b/pym/cl_utils2.py @@ -463,7 +463,7 @@ class cl_smartcon(object): sys.stdout.write(string) sys.stdout.flush() - def printLine(self, argL, argR): + def printLine(self, argL, argR, offsetL=0, printBR=True): """Печатает справа и слева консоли цветные сообщения""" #Допустимые цвета colorDict = {\ @@ -479,7 +479,7 @@ class cl_smartcon(object): 'yellowBr':self.yellowBrightPrint, } # cмещение от левого края консоли - offsetL = 0 + #offsetL = 0 for color,leftString in argL: offsetL += self.lenString(leftString) if colorDict.has_key(color): @@ -492,16 +492,18 @@ class cl_smartcon(object): for color,rightString in argR: offsetR += self.lenString(rightString) # Добавляем пробелы - self.printRight(offsetL, offsetR) - for color,rightString in argR: - if colorDict.has_key(color): - # печатаем и считаем смещение - colorDict[color](rightString) - else: - colorDict[''](rightString) - print "" + if offsetR: + self.printRight(offsetL, offsetR) + for color,rightString in argR: + if colorDict.has_key(color): + # печатаем и считаем смещение + colorDict[color](rightString) + else: + colorDict[''](rightString) + if printBR: + print "" - def printNotOK(self, string): + def printNotOK(self, string, offsetL=0, printBR=True): """Вывод на печать в случае сбоя""" self.printLine((('greenBr',' * '), ('',string), @@ -509,10 +511,17 @@ class cl_smartcon(object): (('blueBr','['), ('redBr',' !! '), ('blueBr',']'), - ) - ) + ), offsetL, printBR) + + def printOnlyNotOK(self, string, offsetL=0, printBR=True): + """Вывод на печать в случае сбоя""" + self.printLine((('', string),), + (('blueBr','['), + ('redBr',' !! '), + ('blueBr',']'), + ), offsetL, printBR) - def printOK(self, string): + def printOK(self, string, offsetL=0, printBR=True): """Вывод на печать в случае успеха""" self.printLine((('greenBr',' * '), ('',string), @@ -520,29 +529,36 @@ class cl_smartcon(object): (('blueBr','['), ('greenBr',' ok '), ('blueBr',']'), - ) - ) - def printWARNING(self, string): + ), offsetL, printBR) + + def printOnlyOK(self, string, offsetL=0, printBR=True): + """Вывод на печать в случае успеха""" + self.printLine((('',string),), + (('blueBr','['), + ('greenBr',' ok '), + ('blueBr',']'), + ), offsetL, printBR) + + def printWARNING(self, string, offsetL=0, printBR=True): """Вывод на печать предупреждения""" self.printLine((('yellowBr',' * '), ('',string), ), (('',''), - ) - ) - def printERROR(self, string): + ), offsetL, printBR) + + def printERROR(self, string, offsetL=0, printBR=True): """Вывод на печать предупреждения""" self.printLine((('redBr',' * '), ('',string), ), (('',''), - ) - ) - def printSUCCESS(self, string): + ), offsetL, printBR) + + def printSUCCESS(self, string, offsetL=0, printBR=True): """Вывод на печать в случае успеха без [ok] справа""" self.printLine((('greenBr',' * '), ('',string), ), (('',''), - ) - ) + ), offsetL, printBR)