|
@@ -107,7 +107,9 @@ class View():
|
|
|
# Render get_info()
|
|
# Render get_info()
|
|
|
#-----------------------------------------------------------------
|
|
#-----------------------------------------------------------------
|
|
|
def draw_info(self, node_name, info):
|
|
def draw_info(self, node_name, info):
|
|
|
|
|
+ logging.debug('draw_info() [START]')
|
|
|
if 'spawns' in info and info['spawns']:
|
|
if 'spawns' in info and info['spawns']:
|
|
|
|
|
+ logging.debug(f'drawing lilith {info}')
|
|
|
self.draw_lilith(node_name, info)
|
|
self.draw_lilith(node_name, info)
|
|
|
return
|
|
return
|
|
|
|
|
|
|
@@ -158,6 +160,7 @@ class View():
|
|
|
node.set_txt(False)
|
|
node.set_txt(False)
|
|
|
self.listw.append(node)
|
|
self.listw.append(node)
|
|
|
for (i, key) in enumerate(info['spawns'].keys()):
|
|
for (i, key) in enumerate(info['spawns'].keys()):
|
|
|
|
|
+ logging.debug(f'creating spawn slot {key}')
|
|
|
slot = Slot(node_name, "spawn-slot")
|
|
slot = Slot(node_name, "spawn-slot")
|
|
|
slot.set_txt(i, key)
|
|
slot.set_txt(i, key)
|
|
|
self.listw.append(slot)
|
|
self.listw.append(slot)
|
|
@@ -183,17 +186,53 @@ class View():
|
|
|
slot.set_txt(item.i, info)
|
|
slot.set_txt(item.i, info)
|
|
|
self.listw[index] = slot
|
|
self.listw[index] = slot
|
|
|
|
|
|
|
|
|
|
+ def fill_lilith_right_box(self):
|
|
|
|
|
+ self.pile.contents.clear()
|
|
|
|
|
+ focus_w = self.list.get_focus()
|
|
|
|
|
+ if focus_w[0] is None:
|
|
|
|
|
+ return
|
|
|
|
|
+ session = focus_w[0].session
|
|
|
|
|
+ if session == "spawn-slot":
|
|
|
|
|
+ node_name = focus_w[0].node_name
|
|
|
|
|
+ spawn_name = focus_w[0].id
|
|
|
|
|
+ lilith = self.model.liliths.get(node_name)
|
|
|
|
|
+ spawns = lilith.get('spawns')
|
|
|
|
|
+ info = spawns.get(spawn_name)
|
|
|
|
|
+
|
|
|
|
|
+ if info['urls']:
|
|
|
|
|
+ urls = info['urls']
|
|
|
|
|
+ self.pile.contents.append((urwid.Text(
|
|
|
|
|
+ f"Accept addrs:"),
|
|
|
|
|
+ self.pile.options()))
|
|
|
|
|
+ for url in urls:
|
|
|
|
|
+ self.pile.contents.append((urwid.Text(
|
|
|
|
|
+ f" {url}"),
|
|
|
|
|
+ self.pile.options()))
|
|
|
|
|
+
|
|
|
|
|
+ if info['hosts']:
|
|
|
|
|
+ hosts = info['hosts']
|
|
|
|
|
+ self.pile.contents.append((urwid.Text(
|
|
|
|
|
+ f"Hosts:"),
|
|
|
|
|
+ self.pile.options()))
|
|
|
|
|
+ for host in hosts:
|
|
|
|
|
+ self.pile.contents.append((urwid.Text(
|
|
|
|
|
+ f" {host}"),
|
|
|
|
|
+ self.pile.options()))
|
|
|
|
|
+
|
|
|
#-----------------------------------------------------------------
|
|
#-----------------------------------------------------------------
|
|
|
# Render subscribe_events() (right menu)
|
|
# Render subscribe_events() (right menu)
|
|
|
#-----------------------------------------------------------------
|
|
#-----------------------------------------------------------------
|
|
|
def fill_right_box(self):
|
|
def fill_right_box(self):
|
|
|
|
|
+ logging.debug('fill_right_box() [START]')
|
|
|
self.pile.contents.clear()
|
|
self.pile.contents.clear()
|
|
|
focus_w = self.list.get_focus()
|
|
focus_w = self.list.get_focus()
|
|
|
|
|
+ logging.debug(f'focus_w: {focus_w}')
|
|
|
if focus_w[0] is None:
|
|
if focus_w[0] is None:
|
|
|
return
|
|
return
|
|
|
session = focus_w[0].session
|
|
session = focus_w[0].session
|
|
|
|
|
|
|
|
if session == "outbound":
|
|
if session == "outbound":
|
|
|
|
|
+ logging.debug('outbound slot selected')
|
|
|
key = (focus_w[0].node_name, "outbound")
|
|
key = (focus_w[0].node_name, "outbound")
|
|
|
info = self.model.nodes.get(focus_w[0].node_name)
|
|
info = self.model.nodes.get(focus_w[0].node_name)
|
|
|
if key in info['event']:
|
|
if key in info['event']:
|
|
@@ -204,6 +243,7 @@ class View():
|
|
|
|
|
|
|
|
if (session == "outbound-slot" or session == "inbound-slot"
|
|
if (session == "outbound-slot" or session == "inbound-slot"
|
|
|
or session == "manual-slot" or session == "seed-slot"):
|
|
or session == "manual-slot" or session == "seed-slot"):
|
|
|
|
|
+ logging.debug('other slot selected')
|
|
|
addr = focus_w[0].addr
|
|
addr = focus_w[0].addr
|
|
|
node_name = focus_w[0].node_name
|
|
node_name = focus_w[0].node_name
|
|
|
info = self.model.nodes.get(node_name)
|
|
info = self.model.nodes.get(node_name)
|
|
@@ -218,32 +258,33 @@ class View():
|
|
|
f"{time}: {event}: {msg}"),
|
|
f"{time}: {event}: {msg}"),
|
|
|
self.pile.options()))
|
|
self.pile.options()))
|
|
|
|
|
|
|
|
- if session == "spawn-slot":
|
|
|
|
|
- node_name = focus_w[0].node_name
|
|
|
|
|
- spawn_name = focus_w[0].id
|
|
|
|
|
- lilith = self.model.liliths.get(node_name)
|
|
|
|
|
- spawns = lilith.get('spawns')
|
|
|
|
|
- info = spawns.get(spawn_name)
|
|
|
|
|
-
|
|
|
|
|
- if info['urls']:
|
|
|
|
|
- urls = info['urls']
|
|
|
|
|
- self.pile.contents.append((urwid.Text(
|
|
|
|
|
- f"Accept addrs:"),
|
|
|
|
|
- self.pile.options()))
|
|
|
|
|
- for url in urls:
|
|
|
|
|
- self.pile.contents.append((urwid.Text(
|
|
|
|
|
- f" {url}"),
|
|
|
|
|
- self.pile.options()))
|
|
|
|
|
-
|
|
|
|
|
- if info['hosts']:
|
|
|
|
|
- hosts = info['hosts']
|
|
|
|
|
- self.pile.contents.append((urwid.Text(
|
|
|
|
|
- f"Hosts:"),
|
|
|
|
|
- self.pile.options()))
|
|
|
|
|
- for host in hosts:
|
|
|
|
|
- self.pile.contents.append((urwid.Text(
|
|
|
|
|
- f" {host}"),
|
|
|
|
|
- self.pile.options()))
|
|
|
|
|
|
|
+ #if session == "spawn-slot":
|
|
|
|
|
+ # logging.debug('spawn slot selected')
|
|
|
|
|
+ # node_name = focus_w[0].node_name
|
|
|
|
|
+ # spawn_name = focus_w[0].id
|
|
|
|
|
+ # lilith = self.model.liliths.get(node_name)
|
|
|
|
|
+ # spawns = lilith.get('spawns')
|
|
|
|
|
+ # info = spawns.get(spawn_name)
|
|
|
|
|
+
|
|
|
|
|
+ # if info['urls']:
|
|
|
|
|
+ # urls = info['urls']
|
|
|
|
|
+ # self.pile.contents.append((urwid.Text(
|
|
|
|
|
+ # f"Accept addrs:"),
|
|
|
|
|
+ # self.pile.options()))
|
|
|
|
|
+ # for url in urls:
|
|
|
|
|
+ # self.pile.contents.append((urwid.Text(
|
|
|
|
|
+ # f" {url}"),
|
|
|
|
|
+ # self.pile.options()))
|
|
|
|
|
+
|
|
|
|
|
+ # if info['hosts']:
|
|
|
|
|
+ # hosts = info['hosts']
|
|
|
|
|
+ # self.pile.contents.append((urwid.Text(
|
|
|
|
|
+ # f"Hosts:"),
|
|
|
|
|
+ # self.pile.options()))
|
|
|
|
|
+ # for host in hosts:
|
|
|
|
|
+ # self.pile.contents.append((urwid.Text(
|
|
|
|
|
+ # f" {host}"),
|
|
|
|
|
+ # self.pile.options()))
|
|
|
|
|
|
|
|
# Sort nodes into lists.
|
|
# Sort nodes into lists.
|
|
|
def sort(self, nodes):
|
|
def sort(self, nodes):
|
|
@@ -260,7 +301,7 @@ class View():
|
|
|
self.refresh = True
|
|
self.refresh = True
|
|
|
|
|
|
|
|
# Display nodes according to list.
|
|
# Display nodes according to list.
|
|
|
- async def draw(self, nodes):
|
|
|
|
|
|
|
+ async def display(self, nodes):
|
|
|
for name, info in nodes:
|
|
for name, info in nodes:
|
|
|
if name in self.live_nodes and name not in self.known_nodes:
|
|
if name in self.live_nodes and name not in self.known_nodes:
|
|
|
self.draw_info(name, info)
|
|
self.draw_info(name, info)
|
|
@@ -279,10 +320,12 @@ class View():
|
|
|
logging.debug("Refresh complete.")
|
|
logging.debug("Refresh complete.")
|
|
|
|
|
|
|
|
# Handle events.
|
|
# Handle events.
|
|
|
- def events(self, nodes):
|
|
|
|
|
|
|
+ def draw_events(self, nodes):
|
|
|
for name, info in nodes:
|
|
for name, info in nodes:
|
|
|
if bool(info) and name in self.known_nodes:
|
|
if bool(info) and name in self.known_nodes:
|
|
|
|
|
+ logging.debug('fill left box')
|
|
|
self.fill_left_box()
|
|
self.fill_left_box()
|
|
|
|
|
+ logging.debug('fill right box')
|
|
|
self.fill_right_box()
|
|
self.fill_right_box()
|
|
|
|
|
|
|
|
if 'inbound' in info:
|
|
if 'inbound' in info:
|
|
@@ -341,7 +384,8 @@ class View():
|
|
|
self.sort(nodes)
|
|
self.sort(nodes)
|
|
|
self.sort(liliths)
|
|
self.sort(liliths)
|
|
|
|
|
|
|
|
- await self.draw(nodes)
|
|
|
|
|
- await self.draw(liliths)
|
|
|
|
|
|
|
+ await self.display(nodes)
|
|
|
|
|
+ await self.display(liliths)
|
|
|
|
|
|
|
|
- self.events(nodes)
|
|
|
|
|
|
|
+ self.fill_lilith_right_box()
|
|
|
|
|
+ self.draw_events(nodes)
|