Skip to content
Snippets Groups Projects
Commit 61d86c38 authored by Vincent Texier's avatar Vincent Texier
Browse files

Display path to account in member window

parent 96db7af6
No related branches found
No related tags found
No related merge requests found
...@@ -9,15 +9,27 @@ from cutecoin.gui.views.wot import NODE_STATUS_HIGHLIGHTED, NODE_STATUS_OUT, ARC ...@@ -9,15 +9,27 @@ from cutecoin.gui.views.wot import NODE_STATUS_HIGHLIGHTED, NODE_STATUS_OUT, ARC
class Graph(dict): class Graph(dict):
def __init__(self, community): def __init__(self, community):
"""
Init Graph instance
:param cutecoin.core.community.Community community:
:return:
"""
self.community = community self.community = community
self.signature_validity = self.community.get_parameters()['sigValidity'] self.signature_validity = self.community.get_parameters()['sigValidity']
# arc considered strong during 75% of signature validity time # arc considered strong during 75% of signature validity time
self.ARC_STATUS_STRONG_time = int(self.signature_validity * 0.75) self.ARC_STATUS_STRONG_time = int(self.signature_validity * 0.75)
def get_shortest_path_between_members(self, from_person, to_person): def get_shortest_path_between_members(self, from_person, to_person):
"""
Return path list of nodes from from_person to to_person
:param Person from_person:
:param Person to_person:
:return:
"""
path = list() path = list()
graph_tmp = copy.deepcopy(self) graph_tmp = copy.deepcopy(self)
logging.debug("path between %s to %s..." % (from_person.name, to_person.name))
if from_person.pubkey not in graph_tmp.keys(): if from_person.pubkey not in graph_tmp.keys():
graph_tmp.add_person(from_person) graph_tmp.add_person(from_person)
certifier_list = from_person.certifiers_of(self.community) certifier_list = from_person.certifiers_of(self.community)
...@@ -39,7 +51,12 @@ class Graph(dict): ...@@ -39,7 +51,12 @@ class Graph(dict):
return path return path
def explore_to_find_member(self, person, nodes=list(), done=list()): def explore_to_find_member(self, person, nodes=None, done=None):
# functions keywords args are persistent... Need to reset it with None trick
nodes = nodes or (list() and (nodes is None))
done = done or (list() and (done is None))
logging.debug("search %s in " % person.name)
logging.debug([node['text'] for node in nodes])
for node in tuple(nodes): for node in tuple(nodes):
if node['id'] in tuple(done): if node['id'] in tuple(done):
continue continue
...@@ -180,8 +197,8 @@ class Graph(dict): ...@@ -180,8 +197,8 @@ class Graph(dict):
def add_person(self, person, status=0, arcs=None, nodes=None): def add_person(self, person, status=0, arcs=None, nodes=None):
# functions keywords args are persistent... Need to reset it with None trick # functions keywords args are persistent... Need to reset it with None trick
arcs = list() and (arcs is None) arcs = arcs or (list() and (arcs is None))
nodes = list() and (nodes is None) nodes = nodes or (list() and (nodes is None))
self[person.pubkey] = { self[person.pubkey] = {
'id': person.pubkey, 'id': person.pubkey,
'arcs': arcs, 'arcs': arcs,
......
...@@ -282,7 +282,7 @@ class Node(QGraphicsEllipseItem): ...@@ -282,7 +282,7 @@ class Node(QGraphicsEllipseItem):
# create node context menus # create node context menus
self.menu = QMenu() self.menu = QMenu()
# action show member # action show member
self.action_show_member = QAction('Show member', self.scene()) self.action_show_member = QAction('Informations', self.scene())
self.menu.addAction(self.action_show_member) self.menu.addAction(self.action_show_member)
self.action_show_member.triggered.connect(self.member_action) self.action_show_member.triggered.connect(self.member_action)
# action add identity as contact # action add identity as contact
......
...@@ -58,7 +58,7 @@ class WotTabWidget(QWidget, Ui_WotTabWidget): ...@@ -58,7 +58,7 @@ class WotTabWidget(QWidget, Ui_WotTabWidget):
:param dict metadata: Graph node metadata of the identity :param dict metadata: Graph node metadata of the identity
""" """
logging.debug("draw graph !!!!!!!!!!!! - " + metadata['text']) logging.debug("Draw graph - " + metadata['text'])
# create Person from node metadata # create Person from node metadata
person = get_person_from_metadata(metadata) person = get_person_from_metadata(metadata)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment