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
c410db6b
Commit
c410db6b
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Working on transactions history
parent
f1207b80
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
res/ui/currency_tab.ui
+60
-0
60 additions, 0 deletions
res/ui/currency_tab.ui
src/cutecoin/gui/currency_tab.py
+21
-2
21 additions, 2 deletions
src/cutecoin/gui/currency_tab.py
src/cutecoin/models/txhistory.py
+25
-3
25 additions, 3 deletions
src/cutecoin/models/txhistory.py
with
106 additions
and
5 deletions
res/ui/currency_tab.ui
+
60
−
0
View file @
c410db6b
...
...
@@ -67,6 +67,33 @@
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<property
name=
"topMargin"
>
<number>
5
</number>
</property>
<item>
<widget
class=
"QDateTimeEdit"
name=
"date_from"
>
<property
name=
"displayFormat"
>
<string>
dd/MM/yyyy
</string>
</property>
<property
name=
"calendarPopup"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QDateTimeEdit"
name=
"date_to"
>
<property
name=
"displayFormat"
>
<string>
dd/MM/yyyy
</string>
</property>
<property
name=
"calendarPopup"
>
<bool>
true
</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget
class=
"QTableView"
name=
"table_history"
>
<attribute
name=
"horizontalHeaderShowSortIndicator"
stdset=
"0"
>
...
...
@@ -127,9 +154,42 @@
</hint>
</hints>
</connection>
<connection>
<sender>
date_from
</sender>
<signal>
dateTimeChanged(QDateTime)
</signal>
<receiver>
CurrencyTabWidget
</receiver>
<slot>
dates_changed(QDateTime)
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
114
</x>
<y>
73
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
199
</x>
<y>
149
</y>
</hint>
</hints>
</connection>
<connection>
<sender>
date_to
</sender>
<signal>
dateTimeChanged(QDateTime)
</signal>
<receiver>
CurrencyTabWidget
</receiver>
<slot>
dates_changed(QDateTime)
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
285
</x>
<y>
73
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
199
</x>
<y>
149
</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>
refresh_wallet_content(QModelIndex)
</slot>
<slot>
wallet_context_menu(QPoint)
</slot>
<slot>
dates_changed(QDateTime)
</slot>
</slots>
</ui>
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/currency_tab.py
+
21
−
2
View file @
c410db6b
...
...
@@ -9,8 +9,8 @@ import time
import
requests
from
ucoinpy.api
import
bma
from
PyQt5.QtWidgets
import
QWidget
,
QMenu
,
QAction
,
QApplication
,
QMessageBox
from
PyQt5.QtCore
import
QModelIndex
,
Qt
,
pyqtSlot
,
QObject
,
QThread
,
pyqtSignal
from
PyQt5.QtWidgets
import
QWidget
,
QMenu
,
QAction
,
QApplication
from
PyQt5.QtCore
import
QModelIndex
,
Qt
,
pyqtSlot
,
QObject
,
QThread
,
pyqtSignal
,
QDateTime
from
PyQt5.QtGui
import
QIcon
from
..gen_resources.currency_tab_uic
import
Ui_CurrencyTabWidget
from
.community_tab
import
CommunityTabWidget
...
...
@@ -90,6 +90,19 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
else
:
self
.
tabs_account
.
setEnabled
(
True
)
self
.
refresh_wallets
()
blockchain_init
=
QDateTime
()
blockchain_init
.
setTime_t
(
self
.
community
.
get_block
(
1
).
mediantime
)
blockchain_lastblock
=
QDateTime
()
blockchain_lastblock
.
setTime_t
(
self
.
community
.
get_block
().
mediantime
)
self
.
date_from
.
setMinimumDateTime
(
blockchain_init
)
self
.
date_from
.
setDateTime
(
blockchain_init
)
self
.
date_from
.
setMaximumDateTime
(
blockchain_lastblock
)
self
.
date_to
.
setMinimumDateTime
(
blockchain_init
)
self
.
date_to
.
setDateTime
(
blockchain_lastblock
)
self
.
date_to
.
setMaximumDateTime
(
blockchain_lastblock
)
self
.
table_history
.
setModel
(
HistoryTableModel
(
self
.
app
.
current_account
,
self
.
community
))
...
...
@@ -192,3 +205,9 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
def
closeEvent
(
self
,
event
):
self
.
bc_watcher
.
deleteLater
()
self
.
watcher_thread
.
deleteLater
()
def
dates_changed
(
self
,
datetime
):
ts_from
=
self
.
date_from
.
dateTime
().
toTime_t
()
ts_to
=
self
.
date_to
.
dateTime
().
toTime_t
()
if
self
.
table_history
.
model
():
self
.
table_history
.
model
().
set_period
(
ts_from
,
ts_to
)
This diff is collapsed.
Click to expand it.
src/cutecoin/models/txhistory.py
+
25
−
3
View file @
c410db6b
...
...
@@ -7,7 +7,7 @@ Created on 5 févr. 2014
import
logging
from
..core.person
import
Person
from
..tools.exceptions
import
PersonNotFoundError
from
PyQt5.QtCore
import
QAbstractTableModel
,
Qt
,
QVariant
,
Q
SortFilter
ProxyModel
from
PyQt5.QtCore
import
QAbstractTableModel
,
Qt
,
QVariant
,
Q
Abstract
ProxyModel
from
PyQt5.QtGui
import
QFont
from
operator
import
itemgetter
import
datetime
...
...
@@ -27,8 +27,7 @@ class HistoryTableModel(QAbstractTableModel):
self
.
account
=
account
self
.
community
=
community
self
.
columns
=
(
'
Date
'
,
'
UID/Public key
'
,
'
Payment
'
,
'
Deposit
'
,
'
Comment
'
)
self
.
section_sorting
=
0
self
.
reversed
=
True
self
.
sorting
=
lambda
self
.
transactions
=
self
.
account
.
transactions_sent
(
self
.
community
)
+
\
self
.
account
.
transactions_awaiting
(
self
.
community
)
+
\
self
.
account
.
transactions_received
(
self
.
community
)
...
...
@@ -151,11 +150,34 @@ class HistoryTableModel(QAbstractTableModel):
3
:
amount_received
,
4
:
comment
}
self
.
transactions
=
self
.
account
.
transactions_sent
(
self
.
community
)
+
\
self
.
account
.
transactions_awaiting
(
self
.
community
)
+
\
self
.
account
.
transactions_received
(
self
.
community
)
self
.
transactions
=
sorted
(
self
.
transactions
,
reverse
=
(
order
==
Qt
.
DescendingOrder
),
key
=
key_getter
[
section
])
self
.
layoutChanged
.
emit
()
def
set_period
(
self
,
ts_from
,
ts_to
):
"""
Filter table by given timestamps
"""
self
.
layoutAboutToBeChanged
.
emit
()
logging
.
debug
(
"
Filtering from {0} to {1}
"
.
format
(
ts_from
,
ts_to
))
def
in_period
(
tx
):
block
=
self
.
community
.
get_block
(
tx
[
0
])
return
(
block
.
mediantime
in
range
(
ts_from
,
ts_to
))
self
.
transactions
=
self
.
account
.
transactions_sent
(
self
.
community
)
+
\
self
.
account
.
transactions_awaiting
(
self
.
community
)
+
\
self
.
account
.
transactions_received
(
self
.
community
)
self
.
transactions
=
[
tx
for
tx
in
filter
(
in_period
,
self
.
transactions
)]
self
.
layoutChanged
.
emit
()
def
flags
(
self
,
index
):
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