diff options
author | hut <hut@lavabit.com> | 2009-11-23 12:00:05 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-11-23 12:00:05 +0100 |
commit | b0f0027f94a9619652392f1df9ad6c7346f46c0f (patch) | |
tree | df693321e687c117cad96ade9f6f037900fa81ed /code/ui.py | |
parent | 2b3db775535290cbbaae570dc79ed3438afe4795 (diff) | |
download | ranger-b0f0027f94a9619652392f1df9ad6c7346f46c0f.tar.gz |
a bunch of half assed implementations
Diffstat (limited to 'code/ui.py')
-rw-r--r-- | code/ui.py | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/code/ui.py b/code/ui.py index 0e48a68a..7d8fd828 100644 --- a/code/ui.py +++ b/code/ui.py @@ -1,4 +1,41 @@ +import curses class UI(): + def __init__(self, options): + self.scr = curses.initscr() + self.scr.leaveok(1) + curses.noecho() + curses.halfdelay(3) + + self.options = options + self.directories = None + self.pwd = None + self.cf = None + self.termsize = None + self.rows = 0 + self.cols = 0 + + def feed(self, directories, pwd, cf, termsize): + self.directories = directories + self.pwd = pwd + self.cf = cf + self.termsize = termsize + self.cols = termsize.x + self.rows = termsize.y + + def exit(self): + curses.nocbreak() + curses.echo() + curses.endwin() + def draw(self): import time - time.sleep(0.1) + self.scr.erase() + for i in range(1, len(self.pwd)): + self.scr.addstr(i, 0, self.pwd[i]) + self.scr.refresh() + + def get_next_key(self): + key = self.scr.getch() + curses.flushinp() + return key + |