about summary refs log tree commit diff stats
path: root/code
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
parentec338c02cf3b31d2ed1438752c338bd6123f3044 (diff)
downloadranger-2b3db775535290cbbaae570dc79ed3438afe4795.tar.gz
the basic loop
Diffstat (limited to 'code')
-rw-r--r--code/__init__.py0
-rw-r--r--code/__init__.pycbin0 -> 125 bytes
-rw-r--r--code/debug.py12
-rw-r--r--code/fm.py38
-rw-r--r--code/options.py5
-rw-r--r--code/ui.py4
6 files changed, 59 insertions, 0 deletions
diff --git a/code/__init__.py b/code/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/code/__init__.py
diff --git a/code/__init__.pyc b/code/__init__.pyc
new file mode 100644
index 00000000..2479f90e
--- /dev/null
+++ b/code/__init__.pyc
Binary files differdiff --git a/code/debug.py b/code/debug.py
new file mode 100644
index 00000000..12d5d654
--- /dev/null
+++ b/code/debug.py
@@ -0,0 +1,12 @@
+# a module to faciliate debuggin
+
+LOGFILE = '/tmp/errorlog'
+
+def log(txt):
+	f = open(LOGFILE, 'a')
+	f.write("r1: ")
+	f.write(str(txt))
+	f.write("\n")
+	f.close()
+
+
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)
+
diff --git a/code/options.py b/code/options.py
new file mode 100644
index 00000000..eed79f1e
--- /dev/null
+++ b/code/options.py
@@ -0,0 +1,5 @@
+def get():
+	return []
+
+def dummy():
+	return []
diff --git a/code/ui.py b/code/ui.py
new file mode 100644
index 00000000..0e48a68a
--- /dev/null
+++ b/code/ui.py
@@ -0,0 +1,4 @@
+class UI():
+	def draw(self):
+		import time
+		time.sleep(0.1)
id='n277' href='#n277'>277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401