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
207513ba
Commit
207513ba
authored
5 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
[fix] fix identity view translation
parent
7ac54916
No related branches found
No related tags found
1 merge request
!775
0.50.0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sakia/gui/navigation/identity/view.py
+35
-34
35 additions, 34 deletions
src/sakia/gui/navigation/identity/view.py
with
35 additions
and
34 deletions
src/sakia/gui/navigation/identity/view.py
+
35
−
34
View file @
207513ba
from
PyQt5.QtWidgets
import
QWidget
,
QMessageBox
,
QAbstractItemView
,
QHeaderView
from
PyQt5.QtWidgets
import
QWidget
,
QMessageBox
,
QAbstractItemView
,
QHeaderView
from
PyQt5.QtCore
import
QEvent
,
QLocale
,
pyqtSignal
,
Qt
,
QDateTime
from
PyQt5.QtCore
import
QEvent
,
QLocale
,
pyqtSignal
,
Qt
,
QDateTime
,
QCoreApplication
from
.identity_uic
import
Ui_IdentityWidget
from
.identity_uic
import
Ui_IdentityWidget
from
enum
import
Enum
from
enum
import
Enum
from
sakia.helpers
import
timestamp_to_dhms
from
sakia.helpers
import
timestamp_to_dhms
...
@@ -69,7 +69,8 @@ class IdentityView(QWidget, Ui_IdentityWidget):
...
@@ -69,7 +69,8 @@ class IdentityView(QWidget, Ui_IdentityWidget):
self
.
button_membership
.
hide
()
self
.
button_membership
.
hide
()
else
:
else
:
if
data
[
"
written
"
]:
if
data
[
"
written
"
]:
written_value
=
self
.
tr
(
"
Identity written in blockchain
"
)
written_value
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Identity written in blockchain
"
)
pass
else
:
else
:
expiration_text
=
QLocale
.
toString
(
expiration_text
=
QLocale
.
toString
(
QLocale
(),
QLocale
(),
...
@@ -77,45 +78,45 @@ class IdentityView(QWidget, Ui_IdentityWidget):
...
@@ -77,45 +78,45 @@ class IdentityView(QWidget, Ui_IdentityWidget):
QLocale
.
dateTimeFormat
(
QLocale
(),
QLocale
.
ShortFormat
),
QLocale
.
dateTimeFormat
(
QLocale
(),
QLocale
.
ShortFormat
),
)
)
written_value
=
(
written_value
=
(
self
.
tr
(
"
Identity not written in blockchain
"
)
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Identity not written in blockchain
"
)
+
"
(
"
+
"
(
"
+
self
.
tr
(
"
Expires on: {0}
"
).
format
(
expiration_text
)
+
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Expires on: {0}
"
).
format
(
expiration_text
)
+
"
BAT)
"
+
"
BAT)
"
)
)
status_value
=
(
status_value
=
(
self
.
tr
(
"
Member
"
)
if
data
[
"
membership_state
"
]
else
self
.
tr
(
"
Not a member
"
)
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Member
"
)
if
data
[
"
membership_state
"
]
else
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Not a member
"
)
)
)
if
data
[
"
mstime
"
]
>
0
:
if
data
[
"
mstime
"
]
>
0
:
membership_action_value
=
self
.
tr
(
"
Renew membership
"
)
membership_action_value
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Renew membership
"
)
status_info
=
""
status_info
=
""
membership_action_enabled
=
True
membership_action_enabled
=
True
elif
data
[
"
membership_state
"
]:
elif
data
[
"
membership_state
"
]:
membership_action_value
=
self
.
tr
(
"
Renew membership
"
)
membership_action_value
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Renew membership
"
)
status_info
=
"
Your membership expired
"
status_info
=
"
Your membership expired
"
membership_action_enabled
=
True
membership_action_enabled
=
True
else
:
else
:
membership_action_value
=
self
.
tr
(
"
Request membership
"
)
membership_action_value
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Request membership
"
)
if
data
[
"
nb_certs
"
]
>
data
[
"
nb_certs_required
"
]:
if
data
[
"
nb_certs
"
]
>
data
[
"
nb_certs_required
"
]:
status_info
=
self
.
tr
(
"
Identity registration ready
"
)
status_info
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Identity registration ready
"
)
membership_action_enabled
=
True
membership_action_enabled
=
True
else
:
else
:
status_info
=
self
.
tr
(
"
{0} more certifications required
"
).
format
(
status_info
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
{0} more certifications required
"
).
format
(
data
[
"
nb_certs_required
"
]
-
data
[
"
nb_certs
"
]
data
[
"
nb_certs_required
"
]
-
data
[
"
nb_certs
"
]
)
)
membership_action_enabled
=
True
membership_action_enabled
=
True
if
data
[
"
mstime
"
]
>
0
:
if
data
[
"
mstime
"
]
>
0
:
days
,
hours
,
minutes
,
seconds
=
timestamp_to_dhms
(
data
[
"
mstime
"
])
days
,
hours
,
minutes
,
seconds
=
timestamp_to_dhms
(
data
[
"
mstime
"
])
mstime_remaining_text
=
self
.
tr
(
"
Expires in
"
)
mstime_remaining_text
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Expires in
"
)
if
days
>
0
:
if
days
>
0
:
mstime_remaining_text
+=
"
{days} days
"
.
format
(
days
=
days
)
mstime_remaining_text
+=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
{days} days
"
)
.
format
(
days
=
days
)
else
:
else
:
mstime_remaining_text
+=
"
{hours} hours and {min} min.
"
.
format
(
mstime_remaining_text
+=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
{hours} hours and {min} min.
"
)
.
format
(
hours
=
hours
,
min
=
minutes
hours
=
hours
,
min
=
minutes
)
)
else
:
else
:
mstime_remaining_text
=
self
.
tr
(
"
Expired or never published
"
)
mstime_remaining_text
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Expired or never published
"
)
ms_status_color
=
"
#00AA00
"
if
data
[
"
membership_state
"
]
else
"
#FF0000
"
ms_status_color
=
"
#00AA00
"
if
data
[
"
membership_state
"
]
else
"
#FF0000
"
outdistanced_status_color
=
(
outdistanced_status_color
=
(
...
@@ -132,13 +133,13 @@ class IdentityView(QWidget, Ui_IdentityWidget):
...
@@ -132,13 +133,13 @@ class IdentityView(QWidget, Ui_IdentityWidget):
<body>
<body>
<p><span style=
"
font-weight:600;
"
>{status_label}</span>
<p><span style=
"
font-weight:600;
"
>{status_label}</span>
: <span style=
"
color:{ms_status_color};
"
>{status}</span>
: <span style=
"
color:{ms_status_color};
"
>{status}</span>
-
<span>{status_info}</span></p>
<span>{status_info}</span></p>
</body>
</body>
</html>
"""
.
format
(
</html>
"""
.
format
(
ms_status_color
=
ms_status_color
,
ms_status_color
=
ms_status_color
,
status_label
=
self
.
tr
(
"
Status
"
),
status_label
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Status
"
),
status
=
status_value
,
status
=
status_value
,
status_info
=
status_info
,
status_info
=
status_info
)
)
description_identity
=
"""
<html>
description_identity
=
"""
<html>
<body>
<body>
...
@@ -146,11 +147,11 @@ class IdentityView(QWidget, Ui_IdentityWidget):
...
@@ -146,11 +147,11 @@ class IdentityView(QWidget, Ui_IdentityWidget):
<p><span style=
"
font-weight:600;
"
>{mstime_remaining_label}</span> : {mstime_remaining}</p>
<p><span style=
"
font-weight:600;
"
>{mstime_remaining_label}</span> : {mstime_remaining}</p>
</body>
</body>
</html>
"""
.
format
(
</html>
"""
.
format
(
nb_certs_label
=
self
.
tr
(
"
Certs. received
"
),
nb_certs_label
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Certs. received
"
),
nb_certs
=
data
[
"
nb_certs
"
],
nb_certs
=
data
[
"
nb_certs
"
],
outdistanced_text
=
data
[
"
outdistanced
"
],
outdistanced_text
=
data
[
"
outdistanced
"
],
outdistanced_status_color
=
outdistanced_status_color
,
outdistanced_status_color
=
outdistanced_status_color
,
mstime_remaining_label
=
self
.
tr
(
"
Membership
"
),
mstime_remaining_label
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Membership
"
),
mstime_remaining
=
mstime_remaining_text
,
mstime_remaining
=
mstime_remaining_text
,
)
)
...
@@ -180,13 +181,13 @@ class IdentityView(QWidget, Ui_IdentityWidget):
...
@@ -180,13 +181,13 @@ class IdentityView(QWidget, Ui_IdentityWidget):
async
def
licence_dialog
(
self
,
currency
,
params
):
async
def
licence_dialog
(
self
,
currency
,
params
):
dt_dhms
=
timestamp_to_dhms
(
params
.
dt
)
dt_dhms
=
timestamp_to_dhms
(
params
.
dt
)
if
dt_dhms
[
0
]
>
0
:
if
dt_dhms
[
0
]
>
0
:
dt_as_str
=
self
.
tr
(
"
{:} day(s) {:} hour(s)
"
).
format
(
*
dt_dhms
)
dt_as_str
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
{:} day(s) {:} hour(s)
"
).
format
(
*
dt_dhms
)
else
:
else
:
dt_as_str
=
self
.
tr
(
"
{:} hour(s)
"
).
format
(
dt_dhms
[
1
])
dt_as_str
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
{:} hour(s)
"
).
format
(
dt_dhms
[
1
])
if
dt_dhms
[
2
]
>
0
or
dt_dhms
[
3
]
>
0
:
if
dt_dhms
[
2
]
>
0
or
dt_dhms
[
3
]
>
0
:
dt_dhms
+=
"
, {:} minute(s) and {:} second(s)
"
.
format
(
*
dt_dhms
[
1
:])
dt_dhms
+=
"
, {:} minute(s) and {:} second(s)
"
.
format
(
*
dt_dhms
[
1
:])
dt_reeval_dhms
=
timestamp_to_dhms
(
params
.
dt_reeval
)
dt_reeval_dhms
=
timestamp_to_dhms
(
params
.
dt_reeval
)
dt_reeval_as_str
=
self
.
tr
(
"
{:} day(s) {:} hour(s)
"
).
format
(
*
dt_reeval_dhms
)
dt_reeval_as_str
=
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
{:} day(s) {:} hour(s)
"
).
format
(
*
dt_reeval_dhms
)
message_box
=
QMessageBox
(
self
)
message_box
=
QMessageBox
(
self
)
...
@@ -224,35 +225,35 @@ and that you will only certify persons that you know well enough.</b>
...
@@ -224,35 +225,35 @@ and that you will only certify persons that you know well enough.</b>
ROOT_SERVERS
[
currency
][
"
display
"
],
ROOT_SERVERS
[
currency
][
"
display
"
],
params
.
c
,
params
.
c
,
QLocale
().
toString
(
params
.
dt
/
86400
,
"
f
"
,
2
),
QLocale
().
toString
(
params
.
dt
/
86400
,
"
f
"
,
2
),
self
.
tr
(
"
Fundamental growth (c)
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Fundamental growth (c)
"
),
params
.
ud0
,
params
.
ud0
,
self
.
tr
(
"
Initial Universal Dividend UD(0) in
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Initial Universal Dividend UD(0) in
"
),
ROOT_SERVERS
[
currency
][
"
display
"
],
ROOT_SERVERS
[
currency
][
"
display
"
],
dt_as_str
,
dt_as_str
,
self
.
tr
(
"
Time period between two UD
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Time period between two UD
"
),
dt_reeval_as_str
,
dt_reeval_as_str
,
self
.
tr
(
"
Time period between two UD reevaluation
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Time period between two UD reevaluation
"
),
ROOT_SERVERS
[
currency
][
"
display
"
],
ROOT_SERVERS
[
currency
][
"
display
"
],
QLocale
().
toString
(
params
.
sig_period
/
86400
,
"
f
"
,
2
),
QLocale
().
toString
(
params
.
sig_period
/
86400
,
"
f
"
,
2
),
self
.
tr
(
"
Minimum delay between 2 certifications (in days)
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Minimum delay between 2 certifications (in days)
"
),
QLocale
().
toString
(
params
.
sig_validity
/
86400
,
"
f
"
,
2
),
QLocale
().
toString
(
params
.
sig_validity
/
86400
,
"
f
"
,
2
),
self
.
tr
(
"
Maximum validity time of a certification (in days)
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Maximum validity time of a certification (in days)
"
),
params
.
sig_qty
,
params
.
sig_qty
,
self
.
tr
(
"
Minimum quantity of certifications to be part of the WoT
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Minimum quantity of certifications to be part of the WoT
"
),
params
.
sig_stock
,
params
.
sig_stock
,
self
.
tr
(
"
Maximum quantity of active certifications per member
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Maximum quantity of active certifications per member
"
),
params
.
sig_window
,
params
.
sig_window
,
self
.
tr
(
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Maximum time before a pending certification expire
"
"
Maximum time before a pending certification expire
"
),
),
params
.
xpercent
,
params
.
xpercent
,
self
.
tr
(
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Minimum percent of sentries to reach to match the distance rule
"
"
Minimum percent of sentries to reach to match the distance rule
"
),
),
params
.
ms_validity
/
86400
,
params
.
ms_validity
/
86400
,
self
.
tr
(
"
Maximum validity time of a membership (in days)
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Maximum validity time of a membership (in days)
"
),
params
.
step_max
,
params
.
step_max
,
self
.
tr
(
"
Maximum distance between each WoT member and a newcomer
"
),
QCoreApplication
.
translate
(
"
IdentityView
"
,
"
Maximum distance between each WoT member and a newcomer
"
),
)
)
)
)
message_box
.
setStandardButtons
(
QMessageBox
.
Yes
|
QMessageBox
.
No
)
message_box
.
setStandardButtons
(
QMessageBox
.
Yes
|
QMessageBox
.
No
)
...
...
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