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
GitLab 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
9450780a
Commit
9450780a
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Save when root node changes
parent
7bddd262
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cutecoin/core/app.py
+5
-2
5 additions, 2 deletions
src/cutecoin/core/app.py
src/cutecoin/core/net/network.py
+7
-0
7 additions, 0 deletions
src/cutecoin/core/net/network.py
src/cutecoin/gui/network_tab.py
+2
-0
2 additions, 0 deletions
src/cutecoin/gui/network_tab.py
with
14 additions
and
2 deletions
src/cutecoin/core/app.py
+
5
−
2
View file @
9450780a
...
@@ -254,8 +254,11 @@ class Application(QObject):
...
@@ -254,8 +254,11 @@ class Application(QObject):
for
community
in
account
.
communities
:
for
community
in
account
.
communities
:
community
.
network
.
blockchain_rollback
.
connect
(
community
.
rollback_cache
)
community
.
network
.
blockchain_rollback
.
connect
(
community
.
rollback_cache
)
community
.
network
.
new_block_mined
.
connect
(
lambda
b
,
co
=
community
:
account
.
refresh_transactions
(
self
,
co
))
community
.
network
.
new_block_mined
.
connect
(
lambda
b
,
co
=
community
:
community
.
network
.
blockchain_rollback
.
connect
(
lambda
b
,
co
=
community
:
account
.
rollback_transaction
(
self
,
co
))
account
.
refresh_transactions
(
self
,
co
))
community
.
network
.
blockchain_rollback
.
connect
(
lambda
b
,
co
=
community
:
account
.
rollback_transaction
(
self
,
co
))
community
.
network
.
root_nodes_changed
.
connect
(
lambda
acc
=
account
:
self
.
save
(
acc
))
def
load_cache
(
self
,
account
):
def
load_cache
(
self
,
account
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/net/network.py
+
7
−
0
View file @
9450780a
...
@@ -23,6 +23,7 @@ class Network(QObject):
...
@@ -23,6 +23,7 @@ class Network(QObject):
given community.
given community.
"""
"""
nodes_changed
=
pyqtSignal
()
nodes_changed
=
pyqtSignal
()
root_nodes_changed
=
pyqtSignal
()
new_block_mined
=
pyqtSignal
(
int
)
new_block_mined
=
pyqtSignal
(
int
)
blockchain_rollback
=
pyqtSignal
(
int
)
blockchain_rollback
=
pyqtSignal
(
int
)
...
@@ -238,12 +239,16 @@ class Network(QObject):
...
@@ -238,12 +239,16 @@ class Network(QObject):
n
.
state
=
Node
.
DESYNCED
n
.
state
=
Node
.
DESYNCED
def
_check_nodes_unique
(
self
):
def
_check_nodes_unique
(
self
):
"""
Check that all nodes are unique by them pubkeys
"""
pubkeys
=
set
()
pubkeys
=
set
()
unique_nodes
=
[]
unique_nodes
=
[]
for
n
in
self
.
nodes
:
for
n
in
self
.
nodes
:
if
n
.
pubkey
not
in
pubkeys
:
if
n
.
pubkey
not
in
pubkeys
:
unique_nodes
.
append
(
n
)
unique_nodes
.
append
(
n
)
pubkeys
.
add
(
n
.
pubkey
)
pubkeys
.
add
(
n
.
pubkey
)
self
.
_nodes
=
unique_nodes
self
.
_nodes
=
unique_nodes
def
fork_window
(
self
,
members_pubkeys
):
def
fork_window
(
self
,
members_pubkeys
):
...
@@ -272,12 +277,14 @@ class Network(QObject):
...
@@ -272,12 +277,14 @@ class Network(QObject):
Add a node to the root nodes list
Add a node to the root nodes list
"""
"""
self
.
_root_nodes
.
append
(
node
)
self
.
_root_nodes
.
append
(
node
)
self
.
root_nodes_changed
.
emit
()
def
remove_root_node
(
self
,
index
):
def
remove_root_node
(
self
,
index
):
"""
"""
Remove a node from the root nodes list
Remove a node from the root nodes list
"""
"""
self
.
_root_nodes
.
pop
(
index
)
self
.
_root_nodes
.
pop
(
index
)
self
.
root_nodes_changed
.
emit
()
def
is_root_node
(
self
,
node
):
def
is_root_node
(
self
,
node
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/network_tab.py
+
2
−
0
View file @
9450780a
...
@@ -91,11 +91,13 @@ class NetworkTabWidget(QWidget, Ui_NetworkTabWidget):
...
@@ -91,11 +91,13 @@ class NetworkTabWidget(QWidget, Ui_NetworkTabWidget):
def
set_root_node
(
self
):
def
set_root_node
(
self
):
node
=
self
.
sender
().
data
()
node
=
self
.
sender
().
data
()
self
.
community
.
network
.
add_root_node
(
node
)
self
.
community
.
network
.
add_root_node
(
node
)
self
.
table_network
.
model
().
sourceModel
().
refresh_nodes
()
@pyqtSlot
()
@pyqtSlot
()
def
unset_root_node
(
self
):
def
unset_root_node
(
self
):
index
=
self
.
sender
().
data
()
index
=
self
.
sender
().
data
()
self
.
community
.
network
.
remove_root_node
(
index
)
self
.
community
.
network
.
remove_root_node
(
index
)
self
.
table_network
.
model
().
sourceModel
().
refresh_nodes
()
@pyqtSlot
()
@pyqtSlot
()
def
open_node_in_browser
(
self
):
def
open_node_in_browser
(
self
):
...
...
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