-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_base.py
48 lines (36 loc) · 1.51 KB
/
app_base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /usr/bin/env python
class BaseApp(object):
'''Base App class.'''
def __init__(self, settings, key_bindings):
self.debug_level = 0
def handle_input(self, input_image, input_label, input_filename, panes):
pass
def handle_key(self, key, panes):
'''Handle key and return either key (to let someone downstream handle it) or None (if this app handled it)'''
pass
def handle_mouse_left_click(self, x, y, flags, param, panes):
'''Handle mouse events'''
pass
def redraw_needed(self, key, panes):
'''App should return whether or not its internal state has
been updated (perhaps in response to handle_key, handle_input,
or some internal processing finishing).
'''
return False
def draw(self, panes):
'''Tells the app to draw in the given panes. Returns True if panes were changed and require a redraw, False if nothing was changed.'''
return False
def draw_help(self, panes):
'''Tells the app to draw its help screen in the given pane. No return necessary.'''
pass
def start(self, live_vis):
'''Notify app to start, possibly creating any necessary threads'''
pass
def get_heartbeats(self):
'''Returns a list of heartbeat functions, if any, that should be called regularly.'''
return []
def set_debug(self, level):
self.debug_level = level
def quit(self):
'''Notify app to quit, possibly joining any threads'''
pass