summary refs log tree commit diff stats
path: root/code/fm.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-11-22 23:56:47 +0100
committerhut <hut@lavabit.com>2009-11-22 23:56:47 +0100
commit2b3db775535290cbbaae570dc79ed3438afe4795 (patch)
treea385d5c5a5491c4a19b77c945030ea141926de76 /code/fm.py
parentec338c02cf3b31d2ed1438752c338bd6123f3044 (diff)
downloadranger-2b3db775535290cbbaae570dc79ed3438afe4795.tar.gz
the basic loop
Diffstat (limited to 'code/fm.py')
-rw-r--r--code/fm.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/code/fm.py b/code/fm.py
new file mode 100644
index 00000000..76316a9d
--- /dev/null
+++ b/code/fm.py
@@ -0,0 +1,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)
+