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
ddb2361d
Commit
ddb2361d
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Context menu for history table added
parent
0193eba6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
res/ui/currency_tab.ui
+17
-0
17 additions, 0 deletions
res/ui/currency_tab.ui
src/cutecoin/gui/currency_tab.py
+12
-8
12 additions, 8 deletions
src/cutecoin/gui/currency_tab.py
src/cutecoin/models/txhistory.py
+21
-4
21 additions, 4 deletions
src/cutecoin/models/txhistory.py
with
50 additions
and
12 deletions
res/ui/currency_tab.ui
+
17
−
0
View file @
ddb2361d
...
...
@@ -189,10 +189,27 @@
</hint>
</hints>
</connection>
<connection>
<sender>
table_history
</sender>
<signal>
customContextMenuRequested(QPoint)
</signal>
<receiver>
CurrencyTabWidget
</receiver>
<slot>
history_context_menu(QPoint)
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
199
</x>
<y>
180
</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>
<slot>
history_context_menu(QPoint)
</slot>
</slots>
</ui>
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/currency_tab.py
+
12
−
8
View file @
ddb2361d
...
...
@@ -178,7 +178,7 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
def
wallet_context_menu
(
self
,
point
):
index
=
self
.
list_wallets
.
indexAt
(
point
)
model
=
self
.
list_wallets
.
model
()
if
index
.
row
()
<
model
.
rowCount
(
None
):
if
index
.
row
()
<
model
.
rowCount
(
QModelIndex
()
):
wallet
=
model
.
wallets
[
index
.
row
()]
menu
=
QMenu
(
model
.
data
(
index
,
Qt
.
DisplayRole
),
self
)
...
...
@@ -198,17 +198,19 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
def
history_context_menu
(
self
,
point
):
index
=
self
.
table_history
.
indexAt
(
point
)
model
=
self
.
table_history
.
model
()
if
index
.
row
()
<
model
.
rowCount
(
None
):
wallet
=
model
.
wallets
[
index
.
row
()]
menu
=
QMenu
(
model
.
data
(
index
,
Qt
.
DisplayRole
),
self
)
if
index
.
row
()
<
model
.
rowCount
(
QModelIndex
()):
if
index
.
column
()
==
model
.
sourceModel
().
columns
.
index
(
'
UID/Public key
'
):
source_index
=
model
.
mapToSource
(
index
)
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
.
triggered
.
connect
(
self
.
copy_pubkey_to_clipboard
)
copy_pubkey
.
setData
(
wallet
)
copy_pubkey
=
QAction
(
"
Copy pubkey to clipboard
"
,
self
)
copy_pubkey
.
triggered
.
connect
(
self
.
copy_pubkey_to_clipboard
)
copy_pubkey
.
setData
(
person
)
menu
.
addAction
(
copy_pubkey
)
# Show the context menu.
menu
.
exec_
(
self
.
list_wallets
.
mapToGlobal
(
point
))
menu
.
exec_
(
self
.
table_history
.
mapToGlobal
(
point
))
def
rename_wallet
(
self
):
index
=
self
.
sender
().
data
()
...
...
@@ -221,6 +223,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
clipboard
.
setText
(
data
.
pubkey
)
elif
data
.
__class__
is
Person
:
clipboard
.
setText
(
data
.
pubkey
)
elif
data
.
__class__
is
str
:
clipboard
.
setText
(
data
)
def
wallet_changed
(
self
):
self
.
app
.
save
(
self
.
app
.
current_account
)
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/models/txhistory.py
+
21
−
4
View file @
ddb2361d
...
...
@@ -42,6 +42,19 @@ class TxFilterProxyModel(QSortFilterProxyModel):
right_data
=
self
.
sourceModel
().
data
(
right
,
Qt
.
DisplayRole
)
return
(
left_data
<
right_data
)
def
data
(
self
,
index
,
role
):
source_index
=
self
.
mapToSource
(
index
)
source_data
=
self
.
sourceModel
().
data
(
source_index
,
role
)
if
role
==
Qt
.
DisplayRole
:
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
.
index
(
'
UID/Public key
'
):
if
source_data
.
__class__
==
Person
:
tx_person
=
source_data
.
name
else
:
tx_person
=
"
pub:{0}
"
.
format
(
source_data
[:
5
])
source_data
=
tx_person
return
source_data
return
source_data
class
HistoryTableModel
(
QAbstractTableModel
):
...
...
@@ -82,9 +95,11 @@ class HistoryTableModel(QAbstractTableModel):
comment
=
tx
[
1
].
comment
pubkey
=
tx
[
1
].
issuers
[
0
]
try
:
sender
=
Person
.
lookup
(
pubkey
,
self
.
community
).
name
#sender = Person.lookup(pubkey, self.community).name
sender
=
Person
.
lookup
(
pubkey
,
self
.
community
)
except
PersonNotFoundError
:
sender
=
"
pub:{0}
"
.
format
(
pubkey
[:
5
])
#sender = "pub:{0}".format(pubkey[:5])
sender
=
pubkey
date_ts
=
self
.
community
.
get_block
(
tx
[
0
]).
time
date
=
QDateTime
.
fromTime_t
(
date_ts
)
...
...
@@ -107,9 +122,11 @@ class HistoryTableModel(QAbstractTableModel):
comment
=
tx
[
1
].
comment
pubkey
=
outputs
[
0
].
pubkey
try
:
receiver
=
Person
.
lookup
(
pubkey
,
self
.
community
).
name
#receiver = Person.lookup(pubkey, self.community).name
receiver
=
Person
.
lookup
(
pubkey
,
self
.
community
)
except
PersonNotFoundError
:
receiver
=
"
pub:{0}
"
.
format
(
pubkey
[:
5
])
#receiver = "pub:{0}".format(pubkey[:5])
receiver
=
pubkey
date_ts
=
self
.
community
.
get_block
(
tx
[
0
]).
time
date
=
QDateTime
.
fromTime_t
(
date_ts
)
...
...
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