-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qt: widget for entering amounts, supports both BTC and sats #530
Conversation
Rebased |
Rebased again. Planning to work on the remaining stuff mentioned above, but some concept ACKs / NACKs would not hurt. |
Concept ACK |
First, sorry that this one's been a bit neglected!
Once the above is cleared up I'll check it again. I do think it's a good addition to the app though, thanks. |
Rebased and addressed comments by @AdamISZ. Currently works in a single send and settings tabs. Not yet in tumbler wizard. I tried to get that working some weeks ago, didn't finish, will get back to it at some point, but I think this is already useful, even without that. |
Test result:
|
@@ -527,7 +530,7 @@ def initUI(self): | |||
buttons.addWidget(self.startButton) | |||
buttons.addWidget(self.abortButton) | |||
self.abortButton.clicked.connect(self.abortTransactions) | |||
innerTopLayout.addLayout(buttons, len(self.widgets) + 1, 0, 1, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a shame to lose flexibility by hardcoding 5. But a really minor point so OK.
def __init__(self, parent): | ||
super(SchStaticPage, self).__init__(parent) | ||
self.setTitle("Manually create a schedule entry") | ||
# TODO implement this option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change this in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioned in initial comment when opening PR. It messes up syntax highlighting in vim sometimes, makes no difference otherwise. Can be removed if you insist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear: you're saying that using """
style comment sections is a problem for formatting sometimes? You think that should always be avoided outside of doc strings, then? Not unreasonable, if so, just I wasn't aware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it looks so. Can't say with 100% certainty, vim syntax highlighting acts strange sometimes. Also """
is meant for doc strings, #
is a proper way to comment out code blocks, I think.
Testing: 2c54542 I notice something that is probably a mistake: I can enter more than 8 decimal places for BTC amounts (specifically, 15 decimal places). From trying a coinjoin, I can confirm it simply rounds to the nearest 8 decimal places, as you'd expect, but this is not the correct behaviour imo: users should be constrained to 8 decimal places for an exact amount (and indeed all other wallets do this). AFAIR this can be set in a Apart from this point, everything else so far looks correct, including rejection of invalid input (negative or non-numeric input). Also the number of significant figures allowed for satoshi amounts looks correct, and non-integers are correctly rejected. I'll test a little more but the above point seems like it needs to be fixed. |
Good catch, |
Fixed |
Fix confirmed to above with 55f7f5f Testing autoconvert, I notice a behaviour which I don't think was intended: 34 sats converts to 3.4E-7 BTC. However, it does bring up "amount below dust threshold". Edit: this is not really relevant as a test case, but it amused me: although you can't enter non-numerics into the field because of the validator, if you switch say "10" in sats to BTC, it goes to 1.0E-7 and then you can edit the -7 to 30 and try to do a coinjoin of 10**30 BTC, unfortunately there was not enough liquidity in the orderbook ;) (i.e. the code got that far before it gave up; no crashes or errors, which is both good and bad). |
Fixed E notation issue, the same fix as in #573. |
For future reference, it's better to add commits one at a time and then squash at the end. That way I don't need to spend time finding the new code that fixes each bug. |
I'm guessing 6a659ac added this? 6a659ac#diff-3e361749da5986d8e0337a42d1eb755bR598 |
Yes |
OK tACK, I will merge this. |
Sorry, before I merge: you have tabs on empty lines at line 645 and 650, should be removed (don't know if other places, didn't check every line. Edited: checked again, it's just those two. Everything else looks good in the diff. |
Fixed. These two were the only places, checked with |
I'm still seeing them in 2645c1b ? |
I forgot to |
It has dropdown to switch between entering BTC or sats. From caller's perspective tries to behave like QLineEdit and always returns sats.
Currently used only in single join / send form. Should be added to other places, like Tumbler wizard too, but that takes extra work as QWizard does not know how to handle them by default and also needs more testing.
Changed code that creates controls in single send from loops to adding each control seperately. It's more readable and also gives more flexibility with using different controls in future (for example, mixdepth chooser could be drop down with mixdepth number and available balance in brackets).
Commented out unimplemented SchStaticPage with line comments, because """ approach sometimes messes up Vim's syntax highlightning.