diff options
Diffstat (limited to 'rcon.py')
-rw-r--r-- | rcon.py | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -20,12 +20,24 @@ class JournalViewer: self.root = self.list_box self.proc = None + self.following = True + + # FIXME: call this whenever the user scrolls through the log + def update(self): + lc = len(self.list_walker) + + if self.following: + self.list_box.set_focus(lc - 1) + + self.status.set_text("%d/%d line%s, [F]ollow: %s" % ( + self.list_box.focus_position + 1, + lc, "" if lc == 1 else "s", + "on" if self.following else "off")) + def write(self, text): for line in str(text).split("\n"): self.list_walker.append(urwid.Text(line)) - - lc = len(self.list_walker) - self.status.set_text("%d line%s" % (lc, "" if lc == 1 else "s")) + self.update() def proc_open(self, argv): if self.proc is not None: @@ -129,6 +141,9 @@ class Console: command = self.edit.get_edit_text() self.edit.set_edit_text("") self.execute(command) + elif text == "f": + self.viewer.following = not self.viewer.following + self.viewer.update() def select_server(self, server): self.server = server |