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
4146d6b5
Commit
4146d6b5
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Added currency name shortening
parent
a96715ca
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
src/cutecoin/core/account.py
+1
-1
1 addition, 1 deletion
src/cutecoin/core/account.py
src/cutecoin/core/community.py
+19
-0
19 additions, 0 deletions
src/cutecoin/core/community.py
src/cutecoin/models/txhistory.py
+9
-5
9 additions, 5 deletions
src/cutecoin/models/txhistory.py
with
29 additions
and
6 deletions
src/cutecoin/core/account.py
+
1
−
1
View file @
4146d6b5
...
@@ -39,7 +39,7 @@ class Account(object):
...
@@ -39,7 +39,7 @@ class Account(object):
be locally referenced by only one account.
be locally referenced by only one account.
'''
'''
referentials
=
{
'
Units
'
:
(
units
,
'
{0}
'
),
referentials
=
{
'
Units
'
:
(
units
,
'
{0}
'
),
'
UD
'
:
(
relative
,
'
UD
{0}
'
)
'
UD
'
:
(
relative
,
'
ud
{0}
'
)
}
}
def
__init__
(
self
,
salt
,
pubkey
,
name
,
communities
,
wallets
,
contacts
,
def
__init__
(
self
,
salt
,
pubkey
,
name
,
communities
,
wallets
,
contacts
,
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/community.py
+
19
−
0
View file @
4146d6b5
...
@@ -12,6 +12,7 @@ from ..tools.exceptions import NoPeerAvailable
...
@@ -12,6 +12,7 @@ from ..tools.exceptions import NoPeerAvailable
import
logging
import
logging
import
inspect
import
inspect
import
hashlib
import
hashlib
import
re
from
requests.exceptions
import
RequestException
,
Timeout
from
requests.exceptions
import
RequestException
,
Timeout
...
@@ -121,6 +122,24 @@ class Community(object):
...
@@ -121,6 +122,24 @@ class Community(object):
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
return
(
other
.
currency
==
self
.
currency
)
return
(
other
.
currency
==
self
.
currency
)
@property
def
short_currency
(
self
):
words
=
re
.
split
(
'
[_\W]+
'
,
self
.
currency
)
shortened
=
""
if
len
(
words
)
>
1
:
shortened
=
''
.
join
([
w
[
0
]
for
w
in
words
])
else
:
vowels
=
(
'
a
'
,
'
e
'
,
'
i
'
,
'
o
'
,
'
u
'
,
'
y
'
)
shortened
=
self
.
currency
shortened
=
''
.
join
([
c
for
c
in
shortened
if
c
not
in
vowels
])
return
shortened
@property
def
currency_symbol
(
self
):
letter
=
self
.
currency
[
0
]
u
=
ord
(
'
\u24B6
'
)
+
ord
(
letter
)
-
ord
(
'
A
'
)
return
chr
(
u
)
def
dividend
(
self
):
def
dividend
(
self
):
ud
=
self
.
request
(
bma
.
blockchain
.
UD
)
ud
=
self
.
request
(
bma
.
blockchain
.
UD
)
if
len
(
ud
[
'
result
'
][
'
blocks
'
])
>
0
:
if
len
(
ud
[
'
result
'
][
'
blocks
'
])
>
0
:
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/models/txhistory.py
+
9
−
5
View file @
4146d6b5
...
@@ -76,7 +76,7 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -76,7 +76,7 @@ class HistoryTableModel(QAbstractTableModel):
amount
=
0
amount
=
0
for
o
in
tx
[
1
].
outputs
:
for
o
in
tx
[
1
].
outputs
:
pubkeys
=
[
w
.
pubkey
for
w
in
self
.
account
.
wallets
]
pubkeys
=
[
w
.
pubkey
for
w
in
self
.
account
.
wallets
]
if
o
.
pubkey
not
in
pubkeys
:
if
o
.
pubkey
in
pubkeys
:
outputs
.
append
(
o
)
outputs
.
append
(
o
)
amount
+=
o
.
amount
amount
+=
o
.
amount
comment
=
tx
[
1
].
comment
comment
=
tx
[
1
].
comment
...
@@ -86,12 +86,14 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -86,12 +86,14 @@ class HistoryTableModel(QAbstractTableModel):
except
PersonNotFoundError
:
except
PersonNotFoundError
:
sender
=
pubkey
sender
=
pubkey
date_ts
=
self
.
community
.
get_block
(
tx
[
0
]).
median
time
date_ts
=
self
.
community
.
get_block
(
tx
[
0
]).
time
date
=
QDateTime
.
fromTime_t
(
date_ts
)
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
)
return
(
date
.
date
(),
sender
,
""
,
"
{0}
"
.
format
(
amount_ref
),
comment
)
return
(
date
.
date
(),
sender
,
""
,
"
{0} {1}
"
.
format
(
amount_ref
,
ref_name
),
comment
)
def
data_sent
(
self
,
tx
):
def
data_sent
(
self
,
tx
):
amount
=
0
amount
=
0
...
@@ -108,12 +110,14 @@ class HistoryTableModel(QAbstractTableModel):
...
@@ -108,12 +110,14 @@ class HistoryTableModel(QAbstractTableModel):
receiver
=
Person
.
lookup
(
pubkey
,
self
.
community
).
name
receiver
=
Person
.
lookup
(
pubkey
,
self
.
community
).
name
except
PersonNotFoundError
:
except
PersonNotFoundError
:
receiver
=
pubkey
receiver
=
pubkey
date_ts
=
self
.
community
.
get_block
(
tx
[
0
]).
median
time
date_ts
=
self
.
community
.
get_block
(
tx
[
0
]).
time
date
=
QDateTime
.
fromTime_t
(
date_ts
)
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
)
return
(
date
.
date
(),
receiver
,
"
{0}
"
.
format
(
amount_ref
),
""
,
comment
)
return
(
date
.
date
(),
receiver
,
"
{0} {1}
"
.
format
(
amount_ref
,
ref_name
),
""
,
comment
)
def
data
(
self
,
index
,
role
):
def
data
(
self
,
index
,
role
):
row
=
index
.
row
()
row
=
index
.
row
()
...
...
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