aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-27 09:28:34 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-27 09:28:34 +0100
commitc657af1562c294837b93904cb2625809b2f7ead3 (patch)
treedffdf5f8bdc062baa3f909917365b20e77ae165b
parentconfigurability (diff)
downloadxpybar-c657af1562c294837b93904cb2625809b2f7ead3.tar.gz
xpybar-c657af1562c294837b93904cb2625809b2f7ead3.tar.bz2
xpybar-c657af1562c294837b93904cb2625809b2f7ead3.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rwxr-xr-xsrc/__main__.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/__main__.py b/src/__main__.py
index 38c5298..83d45f7 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -32,7 +32,8 @@ BACKGROUND, FOREGROUND = (0, 0, 0), (192, 192, 192)
def redraw():
'''
- Invoked when redraw is needed, feel free to replace it completely
+ Invoked when redraw is needed,
+ feel free to replace this completely
'''
global bar
bar.clear()
@@ -40,7 +41,7 @@ def redraw():
def start():
'''
Invoked when it is time to create panels and map them,
- feel free to replace it completely
+ feel free to replace this completely
'''
global bar
bar = Bar(OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND)
@@ -49,11 +50,20 @@ def start():
def stop():
'''
Invoked when it is time to unmap the panels,
- feel free to replace it completely
+ feel free to replace this completely
'''
global bar
bar.unmap()
+def unhandled_event(e):
+ '''
+ Invoked when an unrecognised even is polled,
+ feel free to replace this completely
+
+ @param e The event
+ '''
+ pass
+
class Bar:
'''
@@ -133,6 +143,8 @@ class Bar:
'''
draw_text(bar.window, bar.gc, x, y, text)
+ # TODO add draw_colour_text
+
def create_colour(self, red, green, blue):
'''
Create a colour instance
@@ -195,6 +207,8 @@ while True:
e = display.next_event()
if e.type == Xlib.X.DestroyNotify:
break
+ else:
+ unhandled_event(e)
except KeyboardInterrupt:
break
redraw()