Commit Graph

1545 Commits

Author SHA1 Message Date
SomberNight
450476dcb6 qt seed_dialog: warn when trying to restore standard seed as 2FA wallet
closes https://github.com/spesmilo/electrum/issues/7837
2022-06-03 19:05:48 +02:00
SomberNight
780408285c qt "Wallet Info" dialog: show bip32 root fingerprint
and also show it in DeviceMgr.select_device

follow-up 998cd0d356
2022-06-03 18:02:58 +02:00
SomberNight
998cd0d356 hww: make DeviceMgr.select_device dlg msg more explicit (add details)
related https://github.com/spesmilo/electrum/issues/4199#issuecomment-1145063552
2022-06-03 17:14:47 +02:00
SomberNight
a758c99bbe kivy: add "clear all gossip" button in ln gossip dialog
One usecase is perhaps to save space if using trampoline anyway...
more importantly, if using gossip, LNGossip is heavily filtering what messages we request and get,
and e.g. can missing new NodeAnnouncements, etc,
and this is a quick-and-dirty workaround to force a fresh start.
2022-06-02 18:28:21 +02:00
SomberNight
fbc750bab1 qt.util: HelpLabel, HelpButton, InfoButton: factor out HelpMixin
based on 3ca8854007

Co-authored-by: Calin Culianu <calin.culianu@gmail.com>
2022-06-02 15:25:07 +02:00
Jonas Lundqvist
b7b53e56bc Qt PayToEdit: add option to scan QR code from screen(shot)
this ports the following commits:
448376e441
6053f6f696
2022-06-01 19:10:01 +02:00
SomberNight
9d125118da qrreader.get_qr_reader: raise instead of returning None
move MissingQrDetectionLib to core lib
2022-06-01 18:54:24 +02:00
Axel Gembe
01d20cba49 qt PayToEdit: various fixes, incl icon size/pos, field size, scrollbar
this ports https://github.com/Electron-Cash/Electron-Cash/pull/1371

including commits:
---
bab816e2c3

Buttons Editor: Make background non-transparent and change to push button

There were some issues with transparent backgrounds with QToolButton on
Linux and as there is no real reason for them to be transparent we just
make them opaque.
---
2cb698affc
Pay to editor: Fix size computations to use the proper values

Previously this did not take into account the spacing between lines nor
the margins of the control and the document. There is also a sensible
minimum height of one line now and it expands to up to 10 lines before
we show the scroll bar. When the scroll bar is active, we move the buttons
so they do not obscure the scroll bar.
---
1b7a70f4f5
Pay to editor: Increase height by one if cursor is under buttons
---
abd42d9f66
 Buttons Editor: Always center if the document is just one line high
---
33bd0b82e0
Pay to editor: Make button movement on scrollbar change reliable
---
94f8476c2e
Pay to editor: Use document lineCount instead of height
---
5bedfce392
Buttons Editor: Improve vertical centering of the buttons, needs to take into account the frame width
---
0cd0b490c4
Buttons Editor: Add transparent border which is somehow needed for correct macOS layout
2022-06-01 18:24:37 +02:00
Axel Gembe
2d1727520f qt ButtonsWidget: refactor into OverlayControlMixin; fix alignmt/hover
This ports the following:
782f213bbd
2e5af27a7c
889fcbd26a
c07b0ad616
2022-06-01 17:27:32 +02:00
Axel Gembe
798dbca880 qt ButtonsWidget: Don't pass app instance to addCopyButton
Doesn't make sense to pass the application when we can just use
QApplication.instance() instead.

from 54ccf640c5
2022-06-01 17:01:21 +02:00
SomberNight
abe3955d91 qt.util.ButtonsWidget: add custom setText arg to methods
I am planning to use this in qt.PayToEdit.
2022-05-31 16:40:22 +02:00
SomberNight
5e0df77df6 kivy: fix threading issue when scanning bip70 qr code on newer kivy
kivy 2.1 seemingly became more sensitive to threading issues.
This used to work on kivy 2.0 and older, but 2.1 is complaining.

```
I | paymentrequest | Error while contacting payment URL: https://bitpay.com/i/... -- error type: <class 'aiohttp.client_exceptions.ClientResponseError'> -- Got HTTP status code 404.
E | util | Exception in get_payment_request: TypeError('Cannot create graphics instruction outside the main Kivy thread')
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/util.py", line 1175, in wrapper
    return await func(*args, **kwargs)
  File "/home/user/wspace/electrum/electrum/util.py", line 1033, in get_payment_request
    on_pr(request)
  File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 460, in on_pr
    self.show_error("invoice error:" + pr.error)
  File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 1066, in show_error
    self.show_info_bubble(text=error, icon=icon, width=width,
  File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 1092, in show_info_bubble
    info_bubble = self.info_bubble = Factory.InfoBubble()
  File "/usr/local/lib/python3.8/dist-packages/kivy/uix/bubble.py", line 199, in __init__
    self._arrow_layout = BoxLayout()
  File "/usr/local/lib/python3.8/dist-packages/kivy/uix/boxlayout.py", line 145, in __init__
    super(BoxLayout, self).__init__(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/kivy/uix/layout.py", line 76, in __init__
    super(Layout, self).__init__(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/kivy/uix/widget.py", line 361, in __init__
    self.canvas = Canvas(opacity=self.opacity)
  File "kivy/graphics/instructions.pyx", line 608, in kivy.graphics.instructions.Canvas.__init__
  File "kivy/graphics/instructions.pyx", line 154, in kivy.graphics.instructions.InstructionGroup.__init__
  File "kivy/graphics/instructions.pyx", line 60, in kivy.graphics.instructions.Instruction.__init__
TypeError: Cannot create graphics instruction outside the main Kivy thread
```
2022-05-30 21:19:50 +02:00
ThomasV
c1c6c01e87 rebalance dialog: fix button disabling 2022-05-29 19:00:52 +02:00
ThomasV
8750936679 Rebalance dialog:
- move dialog code to own submodule and class
 - disable ok button if amount is out of bounds
 - add max button
 - add Rebalance button to channels tab
2022-05-29 18:40:45 +02:00
ThomasV
38b155c631 Qt receive widgets: factorize code 2022-05-29 13:54:38 +02:00
ThomasV
00183b5412 Qt: move current_request logic from main_window to requests_list 2022-05-28 17:52:07 +02:00
SomberNight
189390fb2d qt new_channel_dialog: use lnutil.MIN_FUNDING_SAT instead of ad-hoc val 2022-05-26 18:08:15 +02:00
SomberNight
ad42de03ac qt new_channel_dialog: fix regression: oepn chan with "max" amt
```
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\channels_list.py", line 377, in new_channel_with_warning
	self.new_channel_dialog()
  File "...\electrum\electrum\gui\qt\channels_list.py", line 399, in new_channel_dialog
	return d.run()
  File "...\electrum\electrum\gui\qt\new_channel_dialog.py", line 133, in run
	if self.min_amount_sat and funding_sat < self.min_amount_sat:
TypeError: '<' not supported between instances of 'str' and 'int'
```
2022-05-26 18:05:18 +02:00
ThomasV
035c877813 channels_list: do not add extra whitespaces when displaying amounts in HTLCs 2022-05-26 09:04:46 +02:00
ThomasV
adbabacc12 Stabilize size of receive_tabs widgets
- use SetMinimumSize instead of sizeHint
   (partially reverts 28f794b63b)
 - to deal with small window sizes, set MinimumHeight of the
   parent TabWidget (with a few extra pixels for margins)
 - add an extra layout around address_help_text, so that it has
   margins (margins were removed in 28f794b63b)
2022-05-25 10:17:39 +02:00
ThomasV
7abc7c720f receive_tabs: add tooltip to inner widgets 2022-05-24 19:30:51 +02:00
SomberNight
28f794b63b Qt receive tab: better receive_tabs widget size for small windows
Previously the receive_tabs widget was allowed to be much smaller
than its inner main widget (e.g. truncating visible QR code).
A bit hackish to overwrite/monkeypatch sizeHint,
but I've tried a few approaches and this seems to work best.
2022-05-24 18:15:12 +02:00
ThomasV
2e120d74b8 Qt: add name to coroutines_scheduled 2022-05-24 13:39:06 +02:00
ThomasV
3e0d7ff549 improve channels_list menus (minor) 2022-05-24 12:48:19 +02:00
ThomasV
f14c420c30 Qt: display number of tasks (window._coroutines_scheduled) in toolbar.
Disable rebalance/swap suggestions attached to requests/invoices if there is an ongoing task.
Note: This assumes that all tasks are lightning payments, which is true for the moment.
2022-05-24 12:18:32 +02:00
ThomasV
0431cd825e Allow the QR code in the receive tab to be variable size 2022-05-23 13:17:25 +02:00
ThomasV
2a31f80d09 QRCodeWidget: add margin of 1 block, remove fixedSize parameter 2022-05-23 11:38:09 +02:00
ThomasV
3b44646bd1 QRCodeWidget: show warning in GUI 2022-05-23 10:11:35 +02:00
ThomasV
155b3703ac QR window: fix tab order 2022-05-23 09:49:17 +02:00
ThomasV
50a272ec8f do not propose rebalance between channels to the same trampoline 2022-05-23 09:31:38 +02:00
ThomasV
53b4389e05 Qt: set fixed size for reveive help widgets 2022-05-23 09:20:14 +02:00
ThomasV
4cd2807563 Qt: rephrase messages, propose 'pay onchain' as the last option 2022-05-23 09:03:45 +02:00
ThomasV
5d659cda0e improve channel_funding_sat suggestion. add min_amount parameter to new_channel_dialog 2022-05-22 17:18:28 +02:00
ThomasV
e43983e854 Qt: update current request when update_tabs is called 2022-05-22 13:32:24 +02:00
ThomasV
23230c3c10 receive widget: minor improvements, more help text 2022-05-22 11:40:01 +02:00
ThomasV
53151244e2 LNWorker: Add suggest_rebalance methods for sending and receiving.
These methods return a list of channels that can be rebalanced,
in order to receive or send a given amount.

Also add 'channels' parameter to submarine swaps.
Previously, swaps were not considering which channel to use.

When we do not have liquidity to pay an invoice:
 - add 'rebalance' option in order to pay an invoice
 - use the suggested channel in the 'swap' option

When we do not have the liquidity to receive an invoice:
 - add 'Rebalance' and 'Swap' buttons to the receive tab
2022-05-21 20:25:44 +02:00
ThomasV
917f256e33 remove scheduled invoices: bad UX. better expect the user to retry later. 2022-05-21 12:24:26 +02:00
ThomasV
ac8a29efc2 kivy: minor fix 2022-05-21 12:23:01 +02:00
ThomasV
bc9cc51800 Add 'channels' parameter to create invoice and pay.
Add rebalance dialog to GUI
2022-05-21 11:35:44 +02:00
SomberNight
8ed52d4225 Qt change_password_dialog: fix deadlock in hww case if device unplugged
fixes https://github.com/spesmilo/electrum/pull/7819
2022-05-20 20:07:55 +02:00
SomberNight
a0b7782e6d Qt addr/utxo lists: in dark theme, fix item bgcolor (was pure black)
regression from e362d1aac4
2022-05-20 18:26:30 +02:00
SomberNight
57ec9612cb Qt ConfirmTxDialog: make sure dialog is deleted when closed
Same for BlockingWaitingDialog.

related: https://github.com/spesmilo/electrum/issues/3956#issuecomment-1017593613
Note that this change does not solve the "dialog sometimes does not get drawn properly" issue,
just the "dialog sometimes does not get closed properly" issue.

closes: https://github.com/spesmilo/electrum/issues/7816
2022-05-20 18:05:16 +02:00
ghost43
4e11116eab Merge pull request #7633 from JamieDriver/blockstream_jade_support
Add support for the Blockstream Jade hww
2022-05-20 15:14:03 +00:00
Jamie C. Driver
15f108aaa5 Add support for the Blockstream Jade hww 2022-05-20 16:03:46 +01:00
SomberNight
2ec9e869b3 invoice.get_amount_sat: handle None in more places
I believe lightning requests created before https://github.com/spesmilo/electrum/pull/7730
can have an amount of None - ones created after have amount 0 instead.
We could do a wallet db upgrade potentially.
Regardless, the type hint is `get_amount_sat(self) -> Union[int, str, None]`,
so None should be handled. (well, arguably "!" should be handled too...)

```
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\request_list.py", line 101, in item_changed
    self.parent.show_receive_request(req)
  File "...\electrum\electrum\gui\qt\main_window.py", line 1279, in show_receive_request
    URI = req.get_bip21_URI(lightning=bip21_lightning)
  File "...\electrum\electrum\invoices.py", line 164, in get_bip21_URI
    amount = int(self.get_amount_sat())
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
```

```
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\request_list.py", line 101, in item_changed
    self.parent.show_receive_request(req)
  File "...\electrum\electrum\gui\qt\main_window.py", line 1281, in show_receive_request
    can_receive_lightning = self.wallet.lnworker and req.get_amount_sat() <= self.wallet.lnworker.num_sats_can_receive()
TypeError: '<=' not supported between instances of 'NoneType' and 'decimal.Decimal'
```
2022-05-19 19:43:07 +02:00
ThomasV
476c0cbf70 swap dialog: disable amount edits and buttons if an amount is passed 2022-05-19 15:37:11 +02:00
ThomasV
3c47060cb2 receive_tab: better help text if lightning peers are disconnected 2022-05-19 15:08:44 +02:00
ThomasV
cf01a792df Qt: run swap_manager.get_pairs() before opening SwapDialog 2022-05-19 11:42:02 +02:00
ThomasV
cc3be95fcc Receive tab: toggle QR code by clicking on receive widget 2022-05-17 16:14:25 +02:00
SomberNight
3cc6c0dd2d qt: start using ButtonsWidget's add_qr_input_button/add_qr_show_button 2022-05-14 18:56:11 +02:00