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
c3017a91
Commit
c3017a91
authored
8 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Display dividends in darkblue
parent
5d509f7e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/data/processors/dividends.py
+4
-3
4 additions, 3 deletions
src/sakia/data/processors/dividends.py
src/sakia/gui/navigation/txhistory/table_model.py
+5
-1
5 additions, 1 deletion
src/sakia/gui/navigation/txhistory/table_model.py
with
9 additions
and
4 deletions
src/sakia/data/processors/dividends.py
+
4
−
3
View file @
c3017a91
...
@@ -43,6 +43,7 @@ class DividendsProcessor:
...
@@ -43,6 +43,7 @@ class DividendsProcessor:
history_data
=
await
self
.
_bma_connector
.
get
(
identity
.
currency
,
bma
.
ud
.
history
,
history_data
=
await
self
.
_bma_connector
.
get
(
identity
.
currency
,
bma
.
ud
.
history
,
req_args
=
{
'
pubkey
'
:
identity
.
pubkey
})
req_args
=
{
'
pubkey
'
:
identity
.
pubkey
})
log_stream
(
"
Found {0} available dividends
"
.
format
(
len
(
history_data
[
"
history
"
][
"
history
"
])))
log_stream
(
"
Found {0} available dividends
"
.
format
(
len
(
history_data
[
"
history
"
][
"
history
"
])))
block_numbers
=
[]
for
ud_data
in
history_data
[
"
history
"
][
"
history
"
]:
for
ud_data
in
history_data
[
"
history
"
][
"
history
"
]:
dividend
=
Dividend
(
currency
=
identity
.
currency
,
dividend
=
Dividend
(
currency
=
identity
.
currency
,
pubkey
=
identity
.
pubkey
,
pubkey
=
identity
.
pubkey
,
...
@@ -51,6 +52,7 @@ class DividendsProcessor:
...
@@ -51,6 +52,7 @@ class DividendsProcessor:
amount
=
ud_data
[
"
amount
"
],
amount
=
ud_data
[
"
amount
"
],
base
=
ud_data
[
"
base
"
])
base
=
ud_data
[
"
base
"
])
log_stream
(
"
Dividend of block {0}
"
.
format
(
dividend
.
block_number
))
log_stream
(
"
Dividend of block {0}
"
.
format
(
dividend
.
block_number
))
block_numbers
.
append
(
dividend
.
block_number
)
try
:
try
:
self
.
_repo
.
insert
(
dividend
)
self
.
_repo
.
insert
(
dividend
)
except
sqlite3
.
IntegrityError
:
except
sqlite3
.
IntegrityError
:
...
@@ -59,11 +61,10 @@ class DividendsProcessor:
...
@@ -59,11 +61,10 @@ class DividendsProcessor:
for
tx
in
transactions
:
for
tx
in
transactions
:
txdoc
=
Transaction
.
from_signed_raw
(
tx
.
raw
)
txdoc
=
Transaction
.
from_signed_raw
(
tx
.
raw
)
for
input
in
txdoc
.
inputs
:
for
input
in
txdoc
.
inputs
:
if
input
.
source
==
"
D
"
:
if
input
.
source
==
"
D
"
and
input
.
index
not
in
block_numbers
:
block
=
await
self
.
_bma_connector
.
get
(
identity
.
currency
,
block
=
await
self
.
_bma_connector
.
get
(
identity
.
currency
,
bma
.
blockchain
.
block
,
req_args
=
{
'
number
'
:
input
.
index
})
bma
.
blockchain
.
block
,
req_args
=
{
'
number
'
:
input
.
index
})
if
input
.
amount
==
0
:
pass
dividend
=
Dividend
(
currency
=
identity
.
currency
,
dividend
=
Dividend
(
currency
=
identity
.
currency
,
pubkey
=
identity
.
pubkey
,
pubkey
=
identity
.
pubkey
,
block_number
=
input
.
index
,
block_number
=
input
.
index
,
...
...
This diff is collapsed.
Click to expand it.
src/sakia/gui/navigation/txhistory/table_model.py
+
5
−
1
View file @
c3017a91
...
@@ -141,6 +141,8 @@ class TxFilterProxyModel(QSortFilterProxyModel):
...
@@ -141,6 +141,8 @@ class TxFilterProxyModel(QSortFilterProxyModel):
if
source_index
.
column
()
==
model
.
columns_types
.
index
(
'
amount
'
):
if
source_index
.
column
()
==
model
.
columns_types
.
index
(
'
amount
'
):
if
source_data
<
0
:
if
source_data
<
0
:
return
QColor
(
Qt
.
darkRed
)
return
QColor
(
Qt
.
darkRed
)
elif
state_data
==
HistoryTableModel
.
DIVIDEND
:
return
QColor
(
Qt
.
darkBlue
)
if
role
==
Qt
.
TextAlignmentRole
:
if
role
==
Qt
.
TextAlignmentRole
:
if
self
.
sourceModel
().
columns_types
.
index
(
'
amount
'
):
if
self
.
sourceModel
().
columns_types
.
index
(
'
amount
'
):
...
@@ -171,6 +173,8 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -171,6 +173,8 @@ class HistoryTableModel(QAbstractTableModel):
A Qt abstract item model to display communities in a tree
A Qt abstract item model to display communities in a tree
"""
"""
DIVIDEND
=
32
def
__init__
(
self
,
parent
,
app
,
connection
,
identities_service
,
transactions_service
):
def
__init__
(
self
,
parent
,
app
,
connection
,
identities_service
,
transactions_service
):
"""
"""
History of all transactions
History of all transactions
...
@@ -299,7 +303,7 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -299,7 +303,7 @@ class HistoryTableModel(QAbstractTableModel):
receiver
=
dividend
.
pubkey
receiver
=
dividend
.
pubkey
date_ts
=
dividend
.
timestamp
date_ts
=
dividend
.
timestamp
return
(
date_ts
,
receiver
,
amount
,
""
,
Transaction
.
VALIDATE
D
,
0
,
return
(
date_ts
,
receiver
,
amount
,
""
,
HistoryTableModel
.
DIVIDEN
D
,
0
,
receiver
,
block_number
,
""
)
receiver
,
block_number
,
""
)
def
init_transfers
(
self
):
def
init_transfers
(
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