about summary refs log tree commit diff stats
path: root/code/fm.py
blob: 76316a9d2c1ca0bef359c03d7d46046d5e7de834 (plain) (blame)
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
import time
import sys
from code import ui, debug

class FM():
	def __init__(self, options):
		self.singleton = None
		self.options = options
		self.ui = ui.UI()

	def run(self):
		try:
			while 1:
				try:
					self.ui.draw()
				except KeyboardInterrupt:
					self.interrupt()
				except:
					debug.log(sys.exc_info()[1])

				try:
					key = None
#					key = curses.getch()
#					curses.flushinp()
					self.press(key)
				except KeyboardInterrupt:
					self.interrupt()
		except:
			raise
			pass

	def press(self, key):
		pass

	def interrupt(self):
		self.buffer = ""
		time.sleep(0.2)