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
3cdb6990
Commit
3cdb6990
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Better proxying
parent
44cd9a84
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/currency_tab.py
+2
-2
2 additions, 2 deletions
src/cutecoin/gui/currency_tab.py
src/cutecoin/models/txhistory.py
+31
-23
31 additions, 23 deletions
src/cutecoin/models/txhistory.py
with
33 additions
and
25 deletions
src/cutecoin/gui/currency_tab.py
+
2
−
2
View file @
3cdb6990
...
@@ -199,10 +199,10 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
...
@@ -199,10 +199,10 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
index
=
self
.
table_history
.
indexAt
(
point
)
index
=
self
.
table_history
.
indexAt
(
point
)
model
=
self
.
table_history
.
model
()
model
=
self
.
table_history
.
model
()
if
index
.
row
()
<
model
.
rowCount
(
QModelIndex
()):
if
index
.
row
()
<
model
.
rowCount
(
QModelIndex
()):
menu
=
QMenu
(
model
.
data
(
index
,
Qt
.
DisplayRole
),
self
)
source_index
=
model
.
mapToSource
(
index
)
if
index
.
column
()
==
model
.
sourceModel
().
columns
.
index
(
'
UID/Public key
'
):
if
index
.
column
()
==
model
.
sourceModel
().
columns
.
index
(
'
UID/Public key
'
):
source_index
=
model
.
mapToSource
(
index
)
person
=
model
.
sourceModel
().
data
(
source_index
,
Qt
.
DisplayRole
)
person
=
model
.
sourceModel
().
data
(
source_index
,
Qt
.
DisplayRole
)
menu
=
QMenu
(
model
.
data
(
index
,
Qt
.
DisplayRole
),
self
)
copy_pubkey
=
QAction
(
"
Copy pubkey to clipboard
"
,
self
)
copy_pubkey
=
QAction
(
"
Copy pubkey to clipboard
"
,
self
)
copy_pubkey
.
triggered
.
connect
(
self
.
copy_pubkey_to_clipboard
)
copy_pubkey
.
triggered
.
connect
(
self
.
copy_pubkey_to_clipboard
)
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/models/txhistory.py
+
31
−
23
View file @
3cdb6990
...
@@ -29,14 +29,17 @@ class TxFilterProxyModel(QSortFilterProxyModel):
...
@@ -29,14 +29,17 @@ class TxFilterProxyModel(QSortFilterProxyModel):
self
.
ts_to
=
ts_to
self
.
ts_to
=
ts_to
def
filterAcceptsRow
(
self
,
sourceRow
,
sourceParent
):
def
filterAcceptsRow
(
self
,
sourceRow
,
sourceParent
):
def
in_period
(
date
):
def
in_period
(
date
_ts
):
return
(
QDateTime
(
date
).
toTime_t
()
in
range
(
self
.
ts_from
,
self
.
ts_to
))
return
(
date_ts
in
range
(
self
.
ts_from
,
self
.
ts_to
))
date_col
=
self
.
sourceModel
().
columns
.
index
(
'
Date
'
)
date_col
=
self
.
sourceModel
().
columns
.
index
(
'
Date
'
)
source_index
=
self
.
sourceModel
().
index
(
sourceRow
,
date_col
)
source_index
=
self
.
sourceModel
().
index
(
sourceRow
,
date_col
)
date
=
self
.
sourceModel
().
data
(
source_index
,
Qt
.
DisplayRole
)
date
=
self
.
sourceModel
().
data
(
source_index
,
Qt
.
DisplayRole
)
return
in_period
(
date
)
return
in_period
(
date
)
def
columnCount
(
self
,
parent
):
return
self
.
sourceModel
().
columnCount
(
None
)
-
1
def
lessThan
(
self
,
left
,
right
):
def
lessThan
(
self
,
left
,
right
):
"""
"""
Sort table by given column number.
Sort table by given column number.
...
@@ -48,6 +51,9 @@ class TxFilterProxyModel(QSortFilterProxyModel):
...
@@ -48,6 +51,9 @@ class TxFilterProxyModel(QSortFilterProxyModel):
def
data
(
self
,
index
,
role
):
def
data
(
self
,
index
,
role
):
source_index
=
self
.
mapToSource
(
index
)
source_index
=
self
.
mapToSource
(
index
)
source_data
=
self
.
sourceModel
().
data
(
source_index
,
role
)
source_data
=
self
.
sourceModel
().
data
(
source_index
,
role
)
state_col
=
self
.
sourceModel
().
columns
.
index
(
'
State
'
)
state_index
=
self
.
sourceModel
().
index
(
source_index
.
row
(),
state_col
)
state_data
=
self
.
sourceModel
().
data
(
state_index
,
Qt
.
DisplayRole
)
if
role
==
Qt
.
DisplayRole
:
if
role
==
Qt
.
DisplayRole
:
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
.
index
(
'
UID/Public key
'
):
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
.
index
(
'
UID/Public key
'
):
if
source_data
.
__class__
==
Person
:
if
source_data
.
__class__
==
Person
:
...
@@ -56,6 +62,23 @@ class TxFilterProxyModel(QSortFilterProxyModel):
...
@@ -56,6 +62,23 @@ class TxFilterProxyModel(QSortFilterProxyModel):
tx_person
=
"
pub:{0}
"
.
format
(
source_data
[:
5
])
tx_person
=
"
pub:{0}
"
.
format
(
source_data
[:
5
])
source_data
=
tx_person
source_data
=
tx_person
return
source_data
return
source_data
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
.
index
(
'
Date
'
):
date
=
QDateTime
.
fromTime_t
(
source_data
)
return
date
.
date
()
if
role
==
Qt
.
FontRole
:
font
=
QFont
()
if
state_data
==
Transfer
.
AWAITING
:
font
.
setItalic
(
True
)
elif
state_data
==
Transfer
.
REFUSED
:
font
.
setItalic
(
True
)
else
:
font
.
setItalic
(
False
)
return
font
if
role
==
Qt
.
ForegroundRole
:
if
state_data
==
Transfer
.
REFUSED
:
return
QColor
(
Qt
.
red
)
return
source_data
return
source_data
...
@@ -72,7 +95,8 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -72,7 +95,8 @@ class HistoryTableModel(QAbstractTableModel):
super
().
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
account
=
account
self
.
account
=
account
self
.
community
=
community
self
.
community
=
community
self
.
columns
=
(
'
Date
'
,
'
UID/Public key
'
,
'
Payment
'
,
'
Deposit
'
,
'
Comment
'
)
self
.
columns
=
(
'
Date
'
,
'
UID/Public key
'
,
'
Payment
'
,
'
Deposit
'
,
'
Comment
'
,
'
State
'
)
@property
@property
def
transfers
(
self
):
def
transfers
(
self
):
...
@@ -100,13 +124,12 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -100,13 +124,12 @@ class HistoryTableModel(QAbstractTableModel):
sender
=
pubkey
sender
=
pubkey
date_ts
=
transfer
.
metadata
[
'
time
'
]
date_ts
=
transfer
.
metadata
[
'
time
'
]
date
=
QDateTime
.
fromTime_t
(
date_ts
)
amount_ref
=
self
.
account
.
units_to_ref
(
amount
,
self
.
community
)
amount_ref
=
self
.
account
.
units_to_ref
(
amount
,
self
.
community
)
ref_name
=
self
.
account
.
ref_name
(
self
.
community
.
short_currency
)
ref_name
=
self
.
account
.
ref_name
(
self
.
community
.
short_currency
)
return
(
date
.
date
()
,
sender
,
""
,
"
{0:.2f} {1}
"
.
format
(
amount_ref
,
ref_name
),
return
(
date
_ts
,
sender
,
""
,
"
{0:.2f} {1}
"
.
format
(
amount_ref
,
ref_name
),
comment
)
comment
,
transfer
.
state
)
def
data_sent
(
self
,
transfer
):
def
data_sent
(
self
,
transfer
):
amount
=
transfer
.
metadata
[
'
amount
'
]
amount
=
transfer
.
metadata
[
'
amount
'
]
...
@@ -121,13 +144,12 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -121,13 +144,12 @@ class HistoryTableModel(QAbstractTableModel):
receiver
=
pubkey
receiver
=
pubkey
date_ts
=
transfer
.
metadata
[
'
time
'
]
date_ts
=
transfer
.
metadata
[
'
time
'
]
date
=
QDateTime
.
fromTime_t
(
date_ts
)
amount_ref
=
self
.
account
.
units_to_ref
(
-
amount
,
self
.
community
)
amount_ref
=
self
.
account
.
units_to_ref
(
-
amount
,
self
.
community
)
ref_name
=
self
.
account
.
ref_name
(
self
.
community
.
short_currency
)
ref_name
=
self
.
account
.
ref_name
(
self
.
community
.
short_currency
)
return
(
date
.
date
()
,
receiver
,
"
{0:.2f} {1}
"
.
format
(
amount_ref
,
ref_name
),
return
(
date
_ts
,
receiver
,
"
{0:.2f} {1}
"
.
format
(
amount_ref
,
ref_name
),
""
,
comment
)
""
,
comment
,
transfer
.
state
)
def
data
(
self
,
index
,
role
):
def
data
(
self
,
index
,
role
):
row
=
index
.
row
()
row
=
index
.
row
()
...
@@ -143,19 +165,5 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -143,19 +165,5 @@ class HistoryTableModel(QAbstractTableModel):
else
:
else
:
return
self
.
data_sent
(
transfer
)[
col
]
return
self
.
data_sent
(
transfer
)[
col
]
if
role
==
Qt
.
FontRole
:
font
=
QFont
()
if
transfer
.
state
==
Transfer
.
AWAITING
:
font
.
setItalic
(
True
)
elif
transfer
.
state
==
Transfer
.
REFUSED
:
font
.
setItalic
(
True
)
else
:
font
.
setItalic
(
False
)
return
font
if
role
==
Qt
.
ForegroundRole
:
if
transfer
.
state
==
Transfer
.
REFUSED
:
return
QColor
(
Qt
.
red
)
def
flags
(
self
,
index
):
def
flags
(
self
,
index
):
return
Qt
.
ItemIsSelectable
|
Qt
.
ItemIsEnabled
return
Qt
.
ItemIsSelectable
|
Qt
.
ItemIsEnabled
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