diff --git a/reporting/markslider.py b/reporting/markslider.py index c4c9df5..0231414 100755 --- a/reporting/markslider.py +++ b/reporting/markslider.py @@ -51,13 +51,16 @@ class bc: Z = '\033[0m' CLR = '\033[2J' CLREND = '\033[K' + CLRBEG = '\033[1K' color_keys="KRGBYMCWkrgbymcwSUZ" color_list=[K,R,G,B,Y,M,C,W,k,r,g,b,y,m,c,w,S,U,Z] def pos(self,y,x): return "\033["+str(y)+";"+str(x)+"H" - + def column(self,x): + return "\033["+str(x)+"G" + def posprint(self, y,x,s): sys.stdout.write( self.pos(y,x) + str(s) ) @@ -65,7 +68,27 @@ class bc: sys.stdout.write( self.CLR+self.pos(0,0) ) def clear_to_end(self): sys.stdout.write( self.CLREND ) + def clear_to_beginning(self): + sys.stdout.write( self.CLRBEG ) + + def up(self,n=1): + sys.stdout.write( "\033["+str(n)+"A" ) + def down(self,n=1): + sys.stdout.write( "\033["+str(n)+"B" ) + def right(self,n=1): + sys.stdout.write( "\033["+str(n)+"C" ) + def left(self,n=1): + sys.stdout.write( "\033["+str(n)+"D" ) + def up_line(self,n=1): + sys.stdout.write( "\033["+str(n)+"F" ) + def down_line(self,n=1): + sys.stdout.write( "\033["+str(n)+"E" ) + def save(self): + sys.stdout.write( "\033[s" ) + def restore(self): + sys.stdout.write( "\033[u" ) + def color_string(self,s): for i,c in enumerate(self.color_keys): s=s.replace("${"+c+"}",self.color_list[i]) @@ -535,8 +558,9 @@ def launch(reader,opts,offset): if len(output)==1: return [""] del output[-1] for y,l in enumerate(output): - bc.posprint(y+offset[1]-offset[0]+2,0,l) + bc.posprint(y+offset[1]-offset[0]+2,0,' '*len(l)) bc.clear_to_end() + bc.posprint(y+offset[1]-offset[0]+2,0,l) inkey=getch.get() return if run_command != None: