|
|
@@ -104,56 +104,57 @@ class View():
|
|
|
self.refresh = False
|
|
|
|
|
|
#-----------------------------------------------------------------
|
|
|
- # Render get_info()
|
|
|
+ # Render dnet.get_info() RPC call
|
|
|
#-----------------------------------------------------------------
|
|
|
def draw_info(self, node_name, info):
|
|
|
- logging.debug('draw_info() [START]')
|
|
|
- if 'spawns' in info and info['spawns']:
|
|
|
- logging.debug(f'drawing lilith {info}')
|
|
|
+ #logging.debug('draw_info() [START]')
|
|
|
+ if 'spawns' in info:
|
|
|
+ #logging.debug(f'drawing lilith name={node_name} info={info}')
|
|
|
self.draw_lilith(node_name, info)
|
|
|
- return
|
|
|
|
|
|
- node = Node(node_name, "node")
|
|
|
- node.set_txt(False)
|
|
|
- self.listw.append(node)
|
|
|
-
|
|
|
- if 'outbound' in info and info['outbound']:
|
|
|
- session = Session(node_name, "outbound")
|
|
|
- session.set_txt()
|
|
|
- self.listw.append(session)
|
|
|
- for i, addr in info['outbound'].items():
|
|
|
- slot = Slot(node_name, "outbound-slot")
|
|
|
- slot.set_txt(i, addr)
|
|
|
- self.listw.append(slot)
|
|
|
-
|
|
|
- if 'inbound' in info and info['inbound']:
|
|
|
- if any(info['inbound'].values()):
|
|
|
- session = Session(node_name, "inbound")
|
|
|
+ else:
|
|
|
+ #logging.debug(f'drawing node name={node_name} info={info}')
|
|
|
+ node = Node(node_name, "node")
|
|
|
+ node.set_txt(False)
|
|
|
+ self.listw.append(node)
|
|
|
+
|
|
|
+ if 'outbound' in info and info['outbound']:
|
|
|
+ session = Session(node_name, "outbound")
|
|
|
+ session.set_txt()
|
|
|
+ self.listw.append(session)
|
|
|
+ for i, addr in info['outbound'].items():
|
|
|
+ slot = Slot(node_name, "outbound-slot")
|
|
|
+ slot.set_txt(i, addr)
|
|
|
+ self.listw.append(slot)
|
|
|
+
|
|
|
+ if 'inbound' in info and info['inbound']:
|
|
|
+ if any(info['inbound'].values()):
|
|
|
+ session = Session(node_name, "inbound")
|
|
|
+ session.set_txt()
|
|
|
+ self.listw.append(session)
|
|
|
+ for i, addr in info['inbound'].items():
|
|
|
+ if bool(addr):
|
|
|
+ slot = Slot(node_name, "inbound-slot")
|
|
|
+ slot.set_txt(i, addr)
|
|
|
+ self.listw.append(slot)
|
|
|
+
|
|
|
+ if 'manual' in info and info['manual']:
|
|
|
+ session = Session(node_name, "manual")
|
|
|
+ session.set_txt()
|
|
|
+ self.listw.append(session)
|
|
|
+ for i, addr in info['manual'].items():
|
|
|
+ slot = Slot(node_name, "manual-slot")
|
|
|
+ slot.set_txt(i, addr)
|
|
|
+ self.listw.append(slot)
|
|
|
+
|
|
|
+ if 'seed' in info and info['seed']:
|
|
|
+ session = Session(node_name, "seed")
|
|
|
session.set_txt()
|
|
|
self.listw.append(session)
|
|
|
- for i, addr in info['inbound'].items():
|
|
|
- if bool(addr):
|
|
|
- slot = Slot(node_name, "inbound-slot")
|
|
|
- slot.set_txt(i, addr)
|
|
|
- self.listw.append(slot)
|
|
|
-
|
|
|
- if 'manual' in info and info['manual']:
|
|
|
- session = Session(node_name, "manual")
|
|
|
- session.set_txt()
|
|
|
- self.listw.append(session)
|
|
|
- for i, addr in info['manual'].items():
|
|
|
- slot = Slot(node_name, "manual-slot")
|
|
|
- slot.set_txt(i, addr)
|
|
|
- self.listw.append(slot)
|
|
|
-
|
|
|
- if 'seed' in info and info['seed']:
|
|
|
- session = Session(node_name, "seed")
|
|
|
- session.set_txt()
|
|
|
- self.listw.append(session)
|
|
|
- for i, info in info['seed'].items():
|
|
|
- slot = Slot(node_name, "seed-slot")
|
|
|
- slot.set_txt(i, addr)
|
|
|
- self.listw.append(slot)
|
|
|
+ for i, info in info['seed'].items():
|
|
|
+ slot = Slot(node_name, "seed-slot")
|
|
|
+ slot.set_txt(i, addr)
|
|
|
+ self.listw.append(slot)
|
|
|
|
|
|
def draw_lilith(self, node_name, info):
|
|
|
node = Node(node_name, "lilith-node")
|
|
|
@@ -170,7 +171,8 @@ class View():
|
|
|
self.listw.append(node)
|
|
|
|
|
|
#-----------------------------------------------------------------
|
|
|
- # Render subscribe_events() (left menu)
|
|
|
+ # Render dnet.subscribe_events() RPC call
|
|
|
+ # Left hand panel only
|
|
|
#-----------------------------------------------------------------
|
|
|
def fill_left_box(self):
|
|
|
live_inbound = []
|
|
|
@@ -185,6 +187,10 @@ class View():
|
|
|
slot.set_txt(item.i, info)
|
|
|
self.listw[index] = slot
|
|
|
|
|
|
+ #-----------------------------------------------------------------
|
|
|
+ # Render lilith.spawns() RPC call
|
|
|
+ # Right hand panel only
|
|
|
+ #-----------------------------------------------------------------
|
|
|
def fill_lilith_right_box(self):
|
|
|
self.pile.contents.clear()
|
|
|
focus_w = self.list.get_focus()
|
|
|
@@ -239,7 +245,8 @@ class View():
|
|
|
self.pile.options()))
|
|
|
|
|
|
#-----------------------------------------------------------------
|
|
|
- # Render subscribe_events() (right menu)
|
|
|
+ # Render dnet.subscribe_events() RPC call
|
|
|
+ # Right hand menu only
|
|
|
#-----------------------------------------------------------------
|
|
|
def fill_right_box(self):
|
|
|
self.pile.contents.clear()
|
|
|
@@ -320,7 +327,10 @@ class View():
|
|
|
f" {host}"),
|
|
|
self.pile.options()))
|
|
|
|
|
|
- # Sort nodes into lists.
|
|
|
+ #-----------------------------------------------------------------
|
|
|
+ # Sort through node info, checking whether we are already
|
|
|
+ # tracking this node or if the node's state has changed.
|
|
|
+ #-----------------------------------------------------------------
|
|
|
def sort(self, nodes):
|
|
|
for name, info in nodes:
|
|
|
if bool(info) and name not in self.live_nodes:
|
|
|
@@ -334,7 +344,10 @@ class View():
|
|
|
logging.debug("Refresh: online node offline.")
|
|
|
self.refresh = True
|
|
|
|
|
|
- # Display nodes according to list.
|
|
|
+ #-----------------------------------------------------------------
|
|
|
+ # Checks whether we are already displaying this node, and draw
|
|
|
+ # it if not.
|
|
|
+ #-----------------------------------------------------------------
|
|
|
async def display(self, nodes):
|
|
|
for name, info in nodes:
|
|
|
if name in self.live_nodes and name not in self.known_nodes:
|
|
|
@@ -352,8 +365,9 @@ class View():
|
|
|
self.refresh = False
|
|
|
self.listw.clear()
|
|
|
logging.debug("Refresh complete.")
|
|
|
-
|
|
|
+ #-----------------------------------------------------------------
|
|
|
# Handle events.
|
|
|
+ #-----------------------------------------------------------------
|
|
|
def draw_events(self, nodes):
|
|
|
for name, info in nodes:
|
|
|
if bool(info) and name in self.known_nodes:
|
|
|
@@ -399,6 +413,8 @@ class View():
|
|
|
liliths = self.model.liliths.items()
|
|
|
evloop.call_soon(loop.draw_screen)
|
|
|
|
|
|
+ # We first ensure that we are keeping track
|
|
|
+ # of all the displayed widgets.
|
|
|
for index, item in enumerate(self.listw):
|
|
|
# Keep track of known nodes.
|
|
|
if item.node_name not in self.known_nodes:
|