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
3c7e0833
Commit
3c7e0833
authored
10 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
"add identity as contact" action in wot
parent
2bfa2a44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cutecoin/gui/views/wot.py
+13
-0
13 additions, 0 deletions
src/cutecoin/gui/views/wot.py
src/cutecoin/gui/wot_tab.py
+11
-6
11 additions, 6 deletions
src/cutecoin/gui/wot_tab.py
with
24 additions
and
6 deletions
src/cutecoin/gui/views/wot.py
+
13
−
0
View file @
3c7e0833
...
@@ -59,6 +59,7 @@ class Scene(QGraphicsScene):
...
@@ -59,6 +59,7 @@ class Scene(QGraphicsScene):
node_clicked
=
pyqtSignal
(
str
,
name
=
'
nodeClicked
'
)
node_clicked
=
pyqtSignal
(
str
,
name
=
'
nodeClicked
'
)
node_signed
=
pyqtSignal
(
dict
,
name
=
'
nodeSigned
'
)
node_signed
=
pyqtSignal
(
dict
,
name
=
'
nodeSigned
'
)
node_transaction
=
pyqtSignal
(
dict
,
name
=
'
nodeTransaction
'
)
node_transaction
=
pyqtSignal
(
dict
,
name
=
'
nodeTransaction
'
)
node_contact
=
pyqtSignal
(
dict
,
name
=
'
nodeContact
'
)
def
__init__
(
self
,
parent
=
None
):
def
__init__
(
self
,
parent
=
None
):
"""
"""
...
@@ -171,6 +172,7 @@ class Node(QGraphicsEllipseItem):
...
@@ -171,6 +172,7 @@ class Node(QGraphicsEllipseItem):
self
.
menu
=
None
self
.
menu
=
None
self
.
action_sign
=
None
self
.
action_sign
=
None
self
.
action_transaction
=
None
self
.
action_transaction
=
None
self
.
action_contact
=
None
# color around ellipse
# color around ellipse
outline_color
=
QColor
(
'
grey
'
)
outline_color
=
QColor
(
'
grey
'
)
...
@@ -244,6 +246,11 @@ class Node(QGraphicsEllipseItem):
...
@@ -244,6 +246,11 @@ class Node(QGraphicsEllipseItem):
self
.
action_transaction
=
QAction
(
'
Send money to identity
'
,
self
.
scene
())
self
.
action_transaction
=
QAction
(
'
Send money to identity
'
,
self
.
scene
())
self
.
menu
.
addAction
(
self
.
action_transaction
)
self
.
menu
.
addAction
(
self
.
action_transaction
)
self
.
action_transaction
.
triggered
.
connect
(
self
.
transaction_action
)
self
.
action_transaction
.
triggered
.
connect
(
self
.
transaction_action
)
# action add identity as contact
self
.
action_contact
=
QAction
(
'
Add identity as contact
'
,
self
.
scene
())
self
.
menu
.
addAction
(
self
.
action_contact
)
self
.
action_contact
.
triggered
.
connect
(
self
.
contact_action
)
# run menu
self
.
menu
.
exec
(
event
.
screenPos
())
self
.
menu
.
exec
(
event
.
screenPos
())
def
add_arc
(
self
,
arc
):
def
add_arc
(
self
,
arc
):
...
@@ -268,6 +275,12 @@ class Node(QGraphicsEllipseItem):
...
@@ -268,6 +275,12 @@ class Node(QGraphicsEllipseItem):
# trigger scene signal
# trigger scene signal
self
.
scene
().
node_transaction
.
emit
(
self
.
metadata
)
self
.
scene
().
node_transaction
.
emit
(
self
.
metadata
)
def
contact_action
(
self
):
"""
Transaction action to identity node
"""
# trigger scene signal
self
.
scene
().
node_contact
.
emit
(
self
.
metadata
)
class
Arc
(
QGraphicsLineItem
):
class
Arc
(
QGraphicsLineItem
):
def
__init__
(
self
,
source_node
,
destination_node
,
metadata
):
def
__init__
(
self
,
source_node
,
destination_node
,
metadata
):
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/wot_tab.py
+
11
−
6
View file @
3c7e0833
...
@@ -12,6 +12,7 @@ from .certification import CertificationDialog
...
@@ -12,6 +12,7 @@ from .certification import CertificationDialog
from
.add_contact
import
AddContactDialog
from
.add_contact
import
AddContactDialog
from
.transfer
import
TransferMoneyDialog
from
.transfer
import
TransferMoneyDialog
class
WotTabWidget
(
QWidget
,
Ui_WotTabWidget
):
class
WotTabWidget
(
QWidget
,
Ui_WotTabWidget
):
def
__init__
(
self
,
account
,
community
,
parent
=
None
):
def
__init__
(
self
,
account
,
community
,
parent
=
None
):
"""
"""
...
@@ -34,6 +35,7 @@ class WotTabWidget(QWidget, Ui_WotTabWidget):
...
@@ -34,6 +35,7 @@ class WotTabWidget(QWidget, Ui_WotTabWidget):
self
.
graphicsView
.
scene
().
node_clicked
.
connect
(
self
.
draw_graph
)
self
.
graphicsView
.
scene
().
node_clicked
.
connect
(
self
.
draw_graph
)
self
.
graphicsView
.
scene
().
node_signed
.
connect
(
self
.
sign_node
)
self
.
graphicsView
.
scene
().
node_signed
.
connect
(
self
.
sign_node
)
self
.
graphicsView
.
scene
().
node_transaction
.
connect
(
self
.
send_money_to_node
)
self
.
graphicsView
.
scene
().
node_transaction
.
connect
(
self
.
send_money_to_node
)
self
.
graphicsView
.
scene
().
node_contact
.
connect
(
self
.
add_node_as_contact
)
self
.
account
=
account
self
.
account
=
account
self
.
community
=
community
self
.
community
=
community
...
@@ -175,15 +177,18 @@ class WotTabWidget(QWidget, Ui_WotTabWidget):
...
@@ -175,15 +177,18 @@ class WotTabWidget(QWidget, Ui_WotTabWidget):
dialog
.
radio_pubkey
.
setChecked
(
True
)
dialog
.
radio_pubkey
.
setChecked
(
True
)
dialog
.
exec_
()
dialog
.
exec_
()
def
add_node_as_contact
(
self
,
metadata
):
dialog
=
AddContactDialog
(
self
.
account
,
self
.
window
())
dialog
.
edit_name
.
setText
(
metadata
[
'
text
'
])
dialog
.
edit_pubkey
.
setText
(
metadata
[
'
id
'
])
dialog
.
exec_
()
def
send_money_to_node
(
self
,
metadata
):
def
send_money_to_node
(
self
,
metadata
):
dialog
=
TransferMoneyDialog
(
self
.
account
)
dialog
=
TransferMoneyDialog
(
self
.
account
)
dialog
.
edit_pubkey
.
setText
(
metadata
[
'
id
'
])
dialog
.
edit_pubkey
.
setText
(
metadata
[
'
id
'
])
dialog
.
combo_community
.
setCurrentText
(
self
.
community
.
name
())
dialog
.
combo_community
.
setCurrentText
(
self
.
community
.
name
())
dialog
.
radio_pubkey
.
setChecked
(
True
)
dialog
.
radio_pubkey
.
setChecked
(
True
)
dialog
.
exec_
()
dialog
.
exec_
()
def
add_node_as_contact
(
self
,
metadata
):
# check if contact already exists...
if
metadata
[
'
id
'
]
==
self
.
account
.
pubkey
or
metadata
[
'
id
'
]
in
[
contact
.
pubkey
for
contact
in
self
.
account
.
contacts
]:
return
False
dialog
=
AddContactDialog
(
self
.
account
,
self
.
window
())
dialog
.
edit_name
.
setText
(
metadata
[
'
text
'
])
dialog
.
edit_pubkey
.
setText
(
metadata
[
'
id
'
])
dialog
.
exec_
()
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