From e36e0864960ff20ad33ff08ccb57143f4835c61e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 27 Feb 2014 09:25:43 +0100 Subject: configurability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/__main__.py b/src/__main__.py index 55b5fe8..38c5298 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -22,11 +22,39 @@ import Xlib.display, Xlib.Xatom, Xlib.ext.randr, Xlib.X from x import * -OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 24, True +global OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND +global dislay, outputs, redraw, Bar, start, stop + +OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 0, True FONT = '-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*' BACKGROUND, FOREGROUND = (0, 0, 0), (192, 192, 192) +def redraw(): + ''' + Invoked when redraw is needed, feel free to replace it completely + ''' + global bar + bar.clear() + +def start(): + ''' + Invoked when it is time to create panels and map them, + feel free to replace it completely + ''' + global bar + bar = Bar(OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND) + bar.map() + +def stop(): + ''' + Invoked when it is time to unmap the panels, + feel free to replace it completely + ''' + global bar + bar.unmap() + + class Bar: ''' Docked panel @@ -154,12 +182,13 @@ class Bar: self.change_font(self.font) +# TODO load configurations + + open_x() display = get_display() outputs = get_monitors() -bar = Bar(OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND) - -bar.map() +start() while True: try: @@ -168,10 +197,9 @@ while True: break except KeyboardInterrupt: break - bar.clear() - bar.draw_text(0, 10, '°°° TEST °°°') + redraw() display.flush() -bar.unmap() +stop() close_x() -- cgit v1.2.3-70-g09d2