mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-05-07 16:45:04 -04:00
Added log display
This commit is contained in:
parent
48f3cd50c7
commit
8aec40fba2
6 changed files with 92 additions and 5 deletions
43
nomadnet/ui/textui/Log.py
Normal file
43
nomadnet/ui/textui/Log.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
import urwid
|
||||
import nomadnet
|
||||
|
||||
class LogDisplayShortcuts():
|
||||
def __init__(self, app):
|
||||
import urwid
|
||||
self.app = app
|
||||
|
||||
self.widget = urwid.AttrMap(urwid.Text("Log Display Shortcuts"), "shortcutbar")
|
||||
|
||||
class LogDisplay():
|
||||
def __init__(self, app):
|
||||
import urwid
|
||||
self.app = app
|
||||
self.log_term = LogTerminal(self.app)
|
||||
|
||||
pile = urwid.Pile([
|
||||
("weight", 90, self.log_term),
|
||||
("fixed", 1, urwid.Text(("body_text", "Log Display \U0001F332"))),
|
||||
])
|
||||
|
||||
self.shortcuts_display = LogDisplayShortcuts(self.app)
|
||||
self.widget = urwid.LineBox(self.log_term)
|
||||
|
||||
def shortcuts(self):
|
||||
return self.shortcuts_display
|
||||
|
||||
class LogTerminal(urwid.WidgetWrap):
|
||||
def __init__(self, app):
|
||||
self.app = app
|
||||
self.log_term = urwid.Terminal(
|
||||
("tail", "-fn50", self.app.logfilepath),
|
||||
encoding='utf-8',
|
||||
escape_sequence="up"
|
||||
)
|
||||
urwid.WidgetWrap.__init__(self, self.log_term)
|
||||
|
||||
|
||||
def keypress(self, size, key):
|
||||
if key == "up":
|
||||
nomadnet.NomadNetworkApp.get_shared_instance().ui.main_display.frame.set_focus("header")
|
||||
|
||||
return super(LogTerminal, self).keypress(size, key)
|
Loading…
Add table
Add a link
Reference in a new issue