Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
2928a2bb
Commit
2928a2bb
authored
10 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
Add member informations menu in member table context menu
parent
61d86c38
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cutecoin/core/graph.py
+38
-2
38 additions, 2 deletions
src/cutecoin/core/graph.py
src/cutecoin/gui/community_tab.py
+10
-1
10 additions, 1 deletion
src/cutecoin/gui/community_tab.py
src/cutecoin/gui/wot_tab.py
+3
-3
3 additions, 3 deletions
src/cutecoin/gui/wot_tab.py
with
51 additions
and
6 deletions
src/cutecoin/core/graph.py
+
38
−
2
View file @
2928a2bb
...
...
@@ -52,6 +52,13 @@ class Graph(dict):
return
path
def
explore_to_find_member
(
self
,
person
,
nodes
=
None
,
done
=
None
):
"""
Scan graph recursively to find person
:param Person person: Person instance to find
:param list nodes: Optional, default=None, List of nodes around the person
:param list done: Optional, default=None, List of node already scanned
:return:
"""
# 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
))
...
...
@@ -80,6 +87,13 @@ class Graph(dict):
return
True
def
find_shortest_path
(
self
,
start
,
end
,
path
=
list
()):
"""
Find recursively the shortest path between two nodes
:param dict start:
:param dict end:
:param list path:
:return:
"""
path
=
path
+
[
start
]
if
start
[
'
id
'
]
==
end
[
'
id
'
]:
return
path
...
...
@@ -94,9 +108,16 @@ class Graph(dict):
shortest
=
newpath
return
shortest
def
add_certifier_list
(
self
,
certifiers
,
person
,
person_account
):
def
add_certifier_list
(
self
,
certifier_list
,
person
,
person_account
):
"""
Add list of certifiers to graph
:param list certifier_list: List of certifiers from api
:param Person person: Person instance which is certified
:param Person person_account: Account person instance
:return:
"""
# add certifiers of uid
for
certifier
in
tuple
(
certifier
s
):
for
certifier
in
tuple
(
certifier
_list
):
# add only valid certification...
if
(
time
.
time
()
-
certifier
[
'
cert_time
'
][
'
medianTime
'
])
>
self
.
signature_validity
:
continue
...
...
@@ -141,6 +162,13 @@ class Graph(dict):
self
[
person
.
pubkey
][
'
nodes
'
].
append
(
self
[
certifier
[
'
pubkey
'
]])
def
add_certified_list
(
self
,
certified_list
,
person
,
person_account
):
"""
Add list of certified from api to graph
:param list certified_list: List of certified from api
:param Person person: Person instance which is certifier
:param Person person_account: Account person instance
:return:
"""
# add certified by uid
for
certified
in
tuple
(
certified_list
):
# add only valid certification...
...
...
@@ -196,6 +224,14 @@ class Graph(dict):
self
[
person
.
pubkey
][
'
nodes
'
].
append
(
self
[
certified
[
'
pubkey
'
]])
def
add_person
(
self
,
person
,
status
=
0
,
arcs
=
None
,
nodes
=
None
):
"""
Add person as a new node in graph
:param Person person: Person instance
:param int status: Node status (see cutecoin.gui.views.wot)
:param list arcs: List of arcs (certified by person)
:param list nodes: List of nodes around person
:return:
"""
# functions keywords args are persistent... Need to reset it with None trick
arcs
=
arcs
or
(
list
()
and
(
arcs
is
None
))
nodes
=
nodes
or
(
list
()
and
(
nodes
is
None
))
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/community_tab.py
+
10
−
1
View file @
2928a2bb
...
...
@@ -65,6 +65,10 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
member
=
Person
.
lookup
(
pubkey
,
self
.
community
)
menu
=
QMenu
(
self
)
informations
=
QAction
(
"
Informations
"
,
self
)
informations
.
triggered
.
connect
(
self
.
menu_informations
)
informations
.
setData
(
member
)
add_contact
=
QAction
(
"
Add as contact
"
,
self
)
add_contact
.
triggered
.
connect
(
self
.
menu_add_as_contact
)
add_contact
.
setData
(
member
)
...
...
@@ -81,6 +85,7 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
view_wot
.
triggered
.
connect
(
self
.
view_wot
)
view_wot
.
setData
(
member
)
menu
.
addAction
(
informations
)
menu
.
addAction
(
add_contact
)
menu
.
addAction
(
send_money
)
menu
.
addAction
(
certify
)
...
...
@@ -89,6 +94,10 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
# Show the context menu.
menu
.
exec_
(
QCursor
.
pos
())
def
menu_informations
(
self
):
person
=
self
.
sender
().
data
()
self
.
member_informations
(
person
)
def
menu_add_as_contact
(
self
):
person
=
self
.
sender
().
data
()
self
.
add_member_as_contact
(
person
)
...
...
@@ -101,7 +110,7 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
person
=
self
.
sender
().
data
()
self
.
certify_member
(
person
)
def
show_
member
(
self
,
person
):
def
member
_informations
(
self
,
person
):
dialog
=
MemberDialog
(
self
.
account
,
self
.
community
,
person
)
dialog
.
exec_
()
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/wot_tab.py
+
3
−
3
View file @
2928a2bb
...
...
@@ -39,7 +39,7 @@ class WotTabWidget(QWidget, Ui_WotTabWidget):
self
.
graphicsView
.
scene
().
node_signed
.
connect
(
self
.
sign_node
)
self
.
graphicsView
.
scene
().
node_transaction
.
connect
(
self
.
send_money_to_node
)
self
.
graphicsView
.
scene
().
node_contact
.
connect
(
self
.
add_node_as_contact
)
self
.
graphicsView
.
scene
().
node_member
.
connect
(
self
.
show_
member
)
self
.
graphicsView
.
scene
().
node_member
.
connect
(
self
.
member
_informations
)
self
.
account
=
account
self
.
community
=
community
...
...
@@ -141,9 +141,9 @@ class WotTabWidget(QWidget, Ui_WotTabWidget):
metadata
)
def
show_
member
(
self
,
metadata
):
def
member
_informations
(
self
,
metadata
):
person
=
get_person_from_metadata
(
metadata
)
self
.
parent
.
show_
member
(
person
)
self
.
parent
.
member
_informations
(
person
)
def
sign_node
(
self
,
metadata
):
person
=
get_person_from_metadata
(
metadata
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment