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
34abc6f0
Commit
34abc6f0
authored
8 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Add requirements info to tile
parent
77f11eba
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/core/registry/identity.py
+18
-0
18 additions, 0 deletions
src/sakia/core/registry/identity.py
src/sakia/gui/community_tile.py
+28
-1
28 additions, 1 deletion
src/sakia/gui/community_tile.py
with
46 additions
and
1 deletion
src/sakia/core/registry/identity.py
+
18
−
0
View file @
34abc6f0
...
@@ -496,6 +496,24 @@ class Identity(QObject):
...
@@ -496,6 +496,24 @@ class Identity(QObject):
return
parameters
[
'
sigPeriod
'
]
-
(
current_time
-
latest_time
)
return
parameters
[
'
sigPeriod
'
]
-
(
current_time
-
latest_time
)
return
0
return
0
async
def
requirements
(
self
,
community
):
"""
Get the current requirements data.
:param sakia.core.Community community: the community
:return: the requirements
:rtype: dict
"""
try
:
requirements
=
await
community
.
bma_access
.
future_request
(
bma
.
wot
.
Requirements
,
{
'
search
'
:
self
.
pubkey
})
for
req
in
requirements
[
'
identities
'
]:
if
req
[
'
pubkey
'
]
==
self
.
pubkey
and
req
[
'
uid
'
]
==
self
.
uid
and
\
BlockUID
.
from_str
(
req
[
'
meta
'
][
'
timestamp
'
])
==
self
.
_sigdate
:
return
req
except
errors
.
DuniterError
as
e
:
logging
.
debug
(
str
(
e
))
return
None
def
_refresh_uid
(
self
,
uids
):
def
_refresh_uid
(
self
,
uids
):
"""
"""
Refresh UID from uids list, got from a successful lookup request
Refresh UID from uids list, got from a successful lookup request
...
...
This diff is collapsed.
Click to expand it.
src/sakia/gui/community_tile.py
+
28
−
1
View file @
34abc6f0
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
import
enum
import
enum
from
PyQt5.QtWidgets
import
QFrame
,
QLabel
,
QVBoxLayout
,
QLayout
from
PyQt5.QtWidgets
import
QFrame
,
QLabel
,
QVBoxLayout
,
QLayout
from
PyQt5.QtCore
import
QSize
,
pyqtSignal
from
PyQt5.QtCore
import
QSize
,
pyqtSignal
,
QDateTime
from
duniterpy.documents.block
import
Block
from
duniterpy.documents.block
import
Block
from
duniterpy.api
import
errors
from
duniterpy.api
import
errors
...
@@ -94,6 +94,26 @@ background-color: palette(base);
...
@@ -94,6 +94,26 @@ background-color: palette(base);
else
:
else
:
localized_monetary_mass
=
""
localized_monetary_mass
=
""
status
=
self
.
app
.
current_account
.
pubkey
in
members_pubkeys
status
=
self
.
app
.
current_account
.
pubkey
in
members_pubkeys
account_identity
=
await
self
.
app
.
current_account
.
identity
(
self
.
community
)
mstime_remaining_text
=
self
.
tr
(
"
Expired or never published
"
)
outdistanced_text
=
self
.
tr
(
"
Outdistanced
"
)
requirements
=
await
account_identity
.
requirements
(
self
.
community
)
mstime_remaining
=
0
nb_certs
=
0
if
requirements
:
mstime_remaining
=
requirements
[
'
membershipExpiresIn
'
]
nb_certs
=
len
(
requirements
[
'
certifications
'
])
if
not
requirements
[
'
outdistanced
'
]:
outdistanced_text
=
self
.
tr
(
"
In WoT range
"
)
if
mstime_remaining
>
0
:
mstime_remaining_localized
=
QDateTime
.
fromTime_t
(
mstime_remaining
).
toString
(
"
HH:ss.
"
)
\
.
replace
(
"
:
"
,
self
.
tr
(
"
hours and
"
)).
replace
(
"
.
"
,
self
.
tr
(
"
min
"
))
mstime_remaining_text
=
self
.
tr
(
"
Expires in {0}
"
).
format
(
mstime_remaining_localized
)
status_value
=
self
.
tr
(
"
Member
"
)
if
status
else
self
.
tr
(
"
Non-Member
"
)
status_value
=
self
.
tr
(
"
Member
"
)
if
status
else
self
.
tr
(
"
Non-Member
"
)
status_color
=
'
#00AA00
'
if
status
else
self
.
tr
(
'
#FF0000
'
)
status_color
=
'
#00AA00
'
if
status
else
self
.
tr
(
'
#FF0000
'
)
description
=
"""
<html>
description
=
"""
<html>
...
@@ -104,6 +124,8 @@ background-color: palette(base);
...
@@ -104,6 +124,8 @@ background-color: palette(base);
<p>{nb_members} {members_label}</p>
<p>{nb_members} {members_label}</p>
<p><span style=
"
font-weight:600;
"
>{monetary_mass_label}</span> : {monetary_mass}</p>
<p><span style=
"
font-weight:600;
"
>{monetary_mass_label}</span> : {monetary_mass}</p>
<p><span style=
"
font-weight:600;
"
>{status_label}</span> : <span style=
"
color:{status_color};
"
>{status}</span></p>
<p><span style=
"
font-weight:600;
"
>{status_label}</span> : <span style=
"
color:{status_color};
"
>{status}</span></p>
<p><span style=
"
font-weight:600;
"
>{nb_certs_label}</span> : {nb_certs} ({outdistanced_text})</p>
<p><span style=
"
font-weight:600;
"
>{mstime_remaining_label}</span> : {mstime_remaining}</p>
<p><span style=
"
font-weight:600;
"
>{balance_label}</span> : {balance}</p>
<p><span style=
"
font-weight:600;
"
>{balance_label}</span> : {balance}</p>
</body>
</body>
</html>
"""
.
format
(
currency
=
self
.
community
.
currency
,
</html>
"""
.
format
(
currency
=
self
.
community
.
currency
,
...
@@ -114,6 +136,11 @@ background-color: palette(base);
...
@@ -114,6 +136,11 @@ background-color: palette(base);
status_color
=
status_color
,
status_color
=
status_color
,
status_label
=
self
.
tr
(
"
Status
"
),
status_label
=
self
.
tr
(
"
Status
"
),
status
=
status_value
,
status
=
status_value
,
nb_certs_label
=
self
.
tr
(
"
Certs. received
"
),
nb_certs
=
nb_certs
,
outdistanced_text
=
outdistanced_text
,
mstime_remaining_label
=
self
.
tr
(
"
Memberships
"
),
mstime_remaining
=
mstime_remaining_text
,
balance_label
=
self
.
tr
(
"
Balance
"
),
balance_label
=
self
.
tr
(
"
Balance
"
),
balance
=
localized_amount
)
balance
=
localized_amount
)
self
.
text_label
.
setText
(
description
)
self
.
text_label
.
setText
(
description
)
...
...
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