From b952f346b10cec28284bf18a64990d914236e41e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 27 Feb 2014 09:17:10 +0100 Subject: add Bar.clear MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/__main__.py b/src/__main__.py index dab6c49..55b5fe8 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -143,6 +143,15 @@ class Bar: @param font The font ''' self.gc.change(font = font) + + def clear(self): + ''' + Fill the panel with its background colour and reset the colour and font + ''' + self.change_colour(self.background) + self.window.fill_rectangle(self.gc, 0, 0, self.width, self.panel_height) + self.change_colour(self.foreground) + self.change_font(self.font) open_x() @@ -159,10 +168,7 @@ while True: break except KeyboardInterrupt: break - bar.change_colour(bar.background) - bar.window.fill_rectangle(bar.gc, 0, 0, bar.width, bar.panel_height) - bar.change_colour(bar.foreground) - bar.change_font(bar.font) + bar.clear() bar.draw_text(0, 10, '°°° TEST °°°') display.flush() -- cgit v1.2.3-70-g09d2