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
4df53d5f
Commit
4df53d5f
authored
10 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
Informations list separated in three groups
Catch exceptions on network request
parent
6451795d
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/informations_tab.py
+57
-16
57 additions, 16 deletions
src/cutecoin/gui/informations_tab.py
src/cutecoin/models/parameters.py
+0
-5
0 additions, 5 deletions
src/cutecoin/models/parameters.py
with
57 additions
and
21 deletions
src/cutecoin/gui/informations_tab.py
+
57
−
16
View file @
4df53d5f
...
@@ -4,6 +4,7 @@ Created on 2 févr. 2014
...
@@ -4,6 +4,7 @@ Created on 2 févr. 2014
@author: inso
@author: inso
"""
"""
import
logging
from
PyQt5.QtWidgets
import
QWidget
,
QHeaderView
from
PyQt5.QtWidgets
import
QWidget
,
QHeaderView
from
PyQt5.QtCore
import
Qt
from
PyQt5.QtCore
import
Qt
from
..models.parameters
import
ParametersModel
from
..models.parameters
import
ParametersModel
...
@@ -25,18 +26,43 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
...
@@ -25,18 +26,43 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
self
.
community
=
community
self
.
community
=
community
self
.
account
=
account
self
.
account
=
account
self
.
table_currency_informations
.
HorizontalHeader
=
QHeaderView
(
Qt
.
Orientation
(
Qt
.
Horizontal
))
self
.
table_general
.
HorizontalHeader
=
QHeaderView
(
Qt
.
Orientation
(
Qt
.
Horizontal
))
self
.
table_currency_informations
.
HorizontalHeader
.
setSectionResizeMode
(
QHeaderView
.
ResizeToContents
)
#self.table_general.HorizontalHeader.setSectionResizeMode(QHeaderView.ResizeToContents)
self
.
table_currency_informations
.
HorizontalHeader
.
setStretchLastSection
(
True
)
self
.
table_general
.
HorizontalHeader
.
setStretchLastSection
(
True
)
#self.table_currency_informations.HorizontalHeader.setSectionResizeMode(QHeaderView.Stretch)
self
.
table_general
.
setHorizontalHeader
(
self
.
table_general
.
HorizontalHeader
)
self
.
table_currency_informations
.
setHorizontalHeader
(
self
.
table_currency_informations
.
HorizontalHeader
)
self
.
table_general
.
horizontalHeader
().
hide
()
self
.
table_currency_informations
.
horizontalHeader
().
hide
()
self
.
table_general
.
verticalHeader
().
hide
()
self
.
table_currency_informations
.
verticalHeader
().
hide
()
self
.
table_money
.
HorizontalHeader
=
QHeaderView
(
Qt
.
Orientation
(
Qt
.
Horizontal
))
params
=
self
.
community
.
get_parameters
()
#self.table_money.HorizontalHeader.setSectionResizeMode(QHeaderView.ResizeToContents)
block
=
self
.
community
.
get_ud_block
()
self
.
table_money
.
HorizontalHeader
.
setStretchLastSection
(
True
)
infos
=
[
self
.
table_money
.
setHorizontalHeader
(
self
.
table_money
.
HorizontalHeader
)
# variables
self
.
table_money
.
horizontalHeader
().
hide
()
self
.
table_money
.
verticalHeader
().
hide
()
self
.
table_wot
.
HorizontalHeader
=
QHeaderView
(
Qt
.
Orientation
(
Qt
.
Horizontal
))
#self.table_wot.HorizontalHeader.setSectionResizeMode(QHeaderView.ResizeToContents)
self
.
table_wot
.
HorizontalHeader
.
setStretchLastSection
(
True
)
self
.
table_wot
.
setHorizontalHeader
(
self
.
table_wot
.
HorizontalHeader
)
self
.
table_wot
.
horizontalHeader
().
hide
()
self
.
table_wot
.
verticalHeader
().
hide
()
self
.
display_tables
()
def
display_tables
(
self
):
try
:
params
=
self
.
community
.
get_parameters
()
except
Exception
as
e
:
logging
.
debug
(
'
community get_parameters error :
'
+
str
(
e
))
return
False
try
:
block
=
self
.
community
.
get_ud_block
()
except
Exception
as
e
:
logging
.
debug
(
'
community get_ud_block error :
'
+
str
(
e
))
return
False
general
=
[
{
'
name
'
:
'
dividend
'
,
'
value
'
:
block
[
'
dividend
'
],
{
'
name
'
:
'
dividend
'
,
'
value
'
:
block
[
'
dividend
'
],
'
description
'
:
'
Universal Dividend UD(t) in currency units
'
},
'
description
'
:
'
Universal Dividend UD(t) in currency units
'
},
{
'
name
'
:
'
monetaryMass
'
,
'
value
'
:
block
[
'
monetaryMass
'
],
{
'
name
'
:
'
monetaryMass
'
,
'
value
'
:
block
[
'
monetaryMass
'
],
...
@@ -47,7 +73,12 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
...
@@ -47,7 +73,12 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
'
description
'
:
'
Monetary Mass per member M(t)/N(t) in currency units
'
},
'
description
'
:
'
Monetary Mass per member M(t)/N(t) in currency units
'
},
{
'
name
'
:
'
actualGrowth
'
,
{
'
name
'
:
'
actualGrowth
'
,
'
value
'
:
"
{:2.2%}
"
.
format
(
block
[
'
dividend
'
]
/
((
block
[
'
monetaryMass
'
]
-
(
block
[
'
membersCount
'
]
*
block
[
'
dividend
'
]))
/
block
[
'
membersCount
'
])),
'
value
'
:
"
{:2.2%}
"
.
format
(
block
[
'
dividend
'
]
/
((
block
[
'
monetaryMass
'
]
-
(
block
[
'
membersCount
'
]
*
block
[
'
dividend
'
]))
/
block
[
'
membersCount
'
])),
'
description
'
:
'
Actual % Growth (UD(t) / (M(t-1)/Nt))
'
},
'
description
'
:
'
Actual % Growth (UD(t) / (M(t-1)/Nt))
'
}
]
self
.
table_general
.
setModel
(
ParametersModel
(
general
))
update_table_height
(
self
.
table_general
,
len
(
general
))
money
=
[
# money params
# money params
{
'
name
'
:
'
c
'
,
'
value
'
:
"
{:2.0%}
"
.
format
(
params
[
'
c
'
]),
{
'
name
'
:
'
c
'
,
'
value
'
:
"
{:2.0%}
"
.
format
(
params
[
'
c
'
]),
'
description
'
:
'
% growth
'
},
'
description
'
:
'
% growth
'
},
...
@@ -64,7 +95,12 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
...
@@ -64,7 +95,12 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
{
'
name
'
:
'
blocksRot
'
,
'
value
'
:
params
[
'
blocksRot
'
],
{
'
name
'
:
'
blocksRot
'
,
'
value
'
:
params
[
'
blocksRot
'
],
'
description
'
:
'
The number of previous blocks to check for personalized difficulty
'
},
'
description
'
:
'
The number of previous blocks to check for personalized difficulty
'
},
{
'
name
'
:
'
percentRot
'
,
'
value
'
:
"
{:2.0%}
"
.
format
(
params
[
'
percentRot
'
]),
{
'
name
'
:
'
percentRot
'
,
'
value
'
:
"
{:2.0%}
"
.
format
(
params
[
'
percentRot
'
]),
'
description
'
:
'
The percent of previous issuers to reach for personalized difficulty
'
},
'
description
'
:
'
The percent of previous issuers to reach for personalized difficulty
'
}
]
self
.
table_money
.
setModel
(
ParametersModel
(
money
))
update_table_height
(
self
.
table_money
,
len
(
money
))
wot
=
[
# wot params
# wot params
{
'
name
'
:
'
sigDelay
'
,
'
value
'
:
params
[
'
sigDelay
'
]
/
86400
,
{
'
name
'
:
'
sigDelay
'
,
'
value
'
:
params
[
'
sigDelay
'
]
/
86400
,
'
description
'
:
'
Minimum delay between 2 identical certifications (in days)
'
},
'
description
'
:
'
Minimum delay between 2 identical certifications (in days)
'
},
...
@@ -79,7 +115,12 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
...
@@ -79,7 +115,12 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
{
'
name
'
:
'
stepMax
'
,
'
value
'
:
params
[
'
stepMax
'
],
{
'
name
'
:
'
stepMax
'
,
'
value
'
:
params
[
'
stepMax
'
],
'
description
'
:
'
Maximum distance between each WoT member and a newcomer
'
},
'
description
'
:
'
Maximum distance between each WoT member and a newcomer
'
},
]
]
self
.
table_wot
.
setModel
(
ParametersModel
(
wot
))
self
.
table_currency_informations
.
setModel
(
ParametersModel
(
infos
))
update_table_height
(
self
.
table_wot
,
len
(
wot
))
def
update_table_height
(
table
,
rows
):
row_height
=
table
.
rowHeight
(
0
)
table_height
=
(
rows
*
row_height
)
+
table
.
horizontalHeader
().
height
()
+
(
2
*
table
.
frameWidth
())
table
.
setMinimumHeight
(
table_height
)
table
.
setMaximumHeight
(
table_height
)
This diff is collapsed.
Click to expand it.
src/cutecoin/models/parameters.py
+
0
−
5
View file @
4df53d5f
...
@@ -41,11 +41,6 @@ class ParametersModel(QAbstractTableModel):
...
@@ -41,11 +41,6 @@ class ParametersModel(QAbstractTableModel):
font
=
QFont
()
font
=
QFont
()
font
.
setBold
(
True
)
font
.
setBold
(
True
)
return
font
return
font
elif
role
==
Qt
.
BackgroundColorRole
:
if
index
.
row
()
>
12
:
return
QColor
(
"
#dddddd
"
)
elif
index
.
row
()
>
4
:
return
QColor
(
"
#eeeeee
"
)
return
None
return
None
def
headerData
(
self
,
section
,
orientation
,
role
=
Qt
.
DisplayRole
):
def
headerData
(
self
,
section
,
orientation
,
role
=
Qt
.
DisplayRole
):
...
...
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