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
f758d7e0
Commit
f758d7e0
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Added error when not enough sources / money is available
parent
c9ea98e7
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cutecoin/core/wallet.py
+2
-1
2 additions, 1 deletion
src/cutecoin/core/wallet.py
src/cutecoin/gui/transfer.py
+5
-0
5 additions, 0 deletions
src/cutecoin/gui/transfer.py
src/cutecoin/tools/exceptions.py
+6
-2
6 additions, 2 deletions
src/cutecoin/tools/exceptions.py
with
13 additions
and
3 deletions
src/cutecoin/core/wallet.py
+
2
−
1
View file @
f758d7e0
...
...
@@ -178,7 +178,8 @@ class Wallet(object):
self
.
available_inputs
=
(
block
[
'
number
'
],
buf_inputs
)
return
inputs
raise
NotEnoughMoneyError
(
amount
,
value
)
raise
NotEnoughMoneyError
(
amount
,
community
.
currency
,
len
(
inputs
),
value
)
return
[]
def
tx_outputs
(
self
,
pubkey
,
amount
,
inputs
):
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/transfer.py
+
5
−
0
View file @
f758d7e0
...
...
@@ -5,6 +5,7 @@ Created on 2 févr. 2014
'''
from
PyQt5.QtWidgets
import
QDialog
,
QErrorMessage
,
QInputDialog
,
QLineEdit
,
QMessageBox
from
..tools.exceptions
import
NotEnoughMoneyError
from
..core.person
import
Person
from
..gen_resources.transfer_uic
import
Ui_TransferMoneyDialog
...
...
@@ -65,6 +66,10 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog):
QMessageBox
.
critical
(
self
,
"
Money transfer
"
,
"
Something wrong happened : {0}
"
.
format
(
e
),
QMessageBox
.
Ok
)
except
NotEnoughMoneyError
as
e
:
QMessageBox
.
critical
(
self
,
"
Money transfer
"
,
"
You don
'
t have enough money available in this block :
\n
{0}
"
.
format
(
e
.
message
))
self
.
accepted
.
emit
()
self
.
close
()
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/tools/exceptions.py
+
6
−
2
View file @
f758d7e0
...
...
@@ -120,9 +120,13 @@ class NotEnoughMoneyError(Error):
a key already used for another account.
'''
def
__init__
(
self
,
available
,
requested
):
def
__init__
(
self
,
available
,
currency
,
nb_inputs
,
requested
):
'''
Constructor
'''
super
()
.
__init__
(
"
Key owns only {0} money, needs {1}
"
.
format
(
available
,
requested
))
"
Only {0} {1} available in {2} sources, needs {3}
"
.
format
(
available
,
currency
,
nb_inputs
,
requested
))
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