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
Snippets
Deploy
Releases
Container Registry
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
Show more breadcrumbs
Santiago
sakia
Commits
6f9caa06
Commit
6f9caa06
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Better handling of unjoinable communities
parent
019f243a
No related branches found
Branches containing commit
Tags
0.7.5
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cutecoin/core/account.py
+6
-3
6 additions, 3 deletions
src/cutecoin/core/account.py
src/cutecoin/core/community.py
+28
-8
28 additions, 8 deletions
src/cutecoin/core/community.py
src/cutecoin/gui/mainwindow.py
+0
-5
0 additions, 5 deletions
src/cutecoin/gui/mainwindow.py
with
34 additions
and
16 deletions
src/cutecoin/core/account.py
+
6
−
3
View file @
6f9caa06
...
...
@@ -69,9 +69,11 @@ class Account(object):
dead_communities
=
[]
for
data
in
json_data
[
'
communities
'
]:
try
:
communities
.
append
(
Community
.
load
(
data
))
community
=
Community
.
load
(
data
)
communities
.
append
(
community
)
except
NoPeerAvailable
:
dead_communities
.
append
(
data
[
'
currency
'
])
community
=
Community
.
without_network
(
data
)
dead_communities
.
append
(
community
)
account
=
cls
(
salt
,
pubkey
,
name
,
communities
,
wallets
,
contacts
,
dead_communities
)
...
...
@@ -210,7 +212,8 @@ class Account(object):
def
jsonify
(
self
):
data_communities
=
[]
for
c
in
self
.
communities
:
communities
=
self
.
communities
+
self
.
dead_communities
for
c
in
communities
:
data_communities
.
append
(
c
.
jsonify
())
data_wallets
=
[]
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/community.py
+
28
−
8
View file @
6f9caa06
...
...
@@ -59,18 +59,16 @@ class Community(object):
self
.
peers
=
[
p
for
p
in
peers
if
p
.
currency
==
currency
]
self
.
_cache
=
Cache
(
self
)
# After initializing the community from latest peers,
# we refresh its peers tree
logging
.
debug
(
"
Creating community
"
)
self
.
peers
=
self
.
peering
()
logging
.
debug
(
"
{0} peers found
"
.
format
(
len
(
self
.
peers
)))
logging
.
debug
([
peer
.
pubkey
for
peer
in
peers
])
self
.
_cache
.
refresh
()
@classmethod
def
create
(
cls
,
currency
,
peer
):
return
cls
(
currency
,
[
peer
])
community
=
cls
(
currency
,
[
peer
])
logging
.
debug
(
"
Creating community
"
)
community
.
peers
=
community
.
peering
()
logging
.
debug
(
"
{0} peers found
"
.
format
(
len
(
community
.
peers
)))
logging
.
debug
([
peer
.
pubkey
for
peer
in
community
.
peers
])
return
community
@classmethod
def
load
(
cls
,
json_data
):
...
...
@@ -92,6 +90,28 @@ class Community(object):
except
:
pass
community
=
cls
(
currency
,
peers
)
logging
.
debug
(
"
Creating community
"
)
community
.
peers
=
community
.
peering
()
logging
.
debug
(
"
{0} peers found
"
.
format
(
len
(
community
.
peers
)))
logging
.
debug
([
peer
.
pubkey
for
peer
in
community
.
peers
])
return
community
@classmethod
def
without_network
(
cls
,
json_data
):
peers
=
[]
currency
=
json_data
[
'
currency
'
]
for
data
in
json_data
[
'
peers
'
]:
endpoints
=
[]
for
e
in
data
[
'
endpoints
'
]:
endpoints
.
append
(
Endpoint
.
from_inline
(
e
))
peer
=
Peer
(
PROTOCOL_VERSION
,
currency
,
data
[
'
pubkey
'
],
"
0-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709
"
,
endpoints
,
None
)
peers
.
append
(
peer
)
community
=
cls
(
currency
,
peers
)
return
community
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/mainwindow.py
+
0
−
5
View file @
6f9caa06
...
...
@@ -172,11 +172,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
action_configure_parameters
.
setEnabled
(
False
)
self
.
action_set_as_default
.
setEnabled
(
False
)
else
:
for
dead
in
self
.
app
.
current_account
.
dead_communities
:
QMessageBox
.
critical
(
self
,
"
:(
"
,
"
No {0} peers could be joined. Connection to its network is lost.
"
.
format
(
dead
),
QMessageBox
.
Ok
)
self
.
action_set_as_default
.
setEnabled
(
self
.
app
.
current_account
.
name
!=
self
.
app
.
default_account
)
self
.
password_asker
=
PasswordAskerDialog
(
self
.
app
.
current_account
)
...
...
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