Commit Graph

1504 Commits

Author SHA1 Message Date
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
SomberNight
5398b9d9c9 qr qrtextedit: move functionality up to ButtonsWidget 2022-05-14 18:56:07 +02:00
SomberNight
6bb057b548 qt refactor qrtextedit.py, create "ScanShowQRTextEdit" 2022-05-14 18:56:01 +02:00
ghost43
849ad5f5f9 Merge pull request #7812 from baam25simo/show_signature_with_qr
Show message signature as QR code
2022-05-14 16:42:56 +00:00
baam25simo
33208bfdc3 Qt: sign_message: added button to show signature in QR code. 2022-05-14 18:37:16 +02:00
SomberNight
2b7cf31308 qt: don't show empty BalanceDialog 2022-05-14 18:32:52 +02:00
SomberNight
2e260bd602 qt PayToEdit: rm redundant code
This is already handled by `self.textChanged.connect(self.check_text)` in __init__.
2022-05-14 01:28:37 +02:00
ThomasV
c945f2292e (minor) Fix receive_qr_visible.
Rename method: toggle_qr_window
2022-05-12 12:40:58 +02:00
ThomasV
0d66409fbd follow-up prev commit 2022-05-11 09:43:10 +02:00
ThomasV
a8fc0a8f81 Qt: move open_channel_dialog code in separate module
(no functional change in this commit)
2022-05-11 09:39:45 +02:00
ThomasV
1274ec7655 Qt balance piechart: show lightning funds that are frozen 2022-05-10 20:07:30 +02:00
SomberNight
3535eef8f8 (trivial) qt locktimeedit: fix a DeprecationWarning
/home/user/wspace/electrum/electrum/gui/qt/locktimeedit.py:145: DeprecationWarning: an integer is required (got type Alignment).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  painter.drawText(textRect, Qt.AlignRight | Qt.AlignVCenter, "height")
2022-05-09 19:50:38 +02:00
SomberNight
2e99ac9a94 qt preferences: fix "allow_instant_swaps" checkbox 2022-05-07 16:20:16 +02:00
ThomasV
2022b2e341 Merge pull request #7797 from SomberNight/202205_distutils
vendor a part of `distutils`, to be removed from stdlib in py3.12
2022-05-07 09:45:29 +02:00
SomberNight
37ba7277ae qt main_window: fix visual artifact when opening (re invoice lists)
InvoiceList.update() calls hide_if_empty(), which calls setVisible().
setVisible(True) should not be called before the widget is properly parented and put into a layout,
as that results in a blank window flashing up (appearing and disappearing) briefly.
2022-05-06 20:02:53 +02:00
ThomasV
b0a6f895b2 Qt: add help text to receive address widget 2022-05-06 11:35:52 +02:00
ThomasV
ad70659a66 qr code widget: set margin to zero, print warning if cannot draw 2022-05-06 11:33:10 +02:00
SomberNight
d429b58168 vendor a part of distutils, to be removed from stdlib in py3.12
distutils (a module in the python standard library that we use) got deprecated in python 3.10,
and is planned to be removed from the stdlib in python 3.12.
see 9d38120e33/Lib/distutils/__init__.py (L16)
We only use it in the Qt update_checker (for signed version notifications), to compare version numbers.
That is, we only use a very small part of it (only `distutils.version.StrictVersion`).

```
.../electrum/electrum/gui/qt/update_checker.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.version import StrictVersion
```

Migration advice in PEP-632 suggests ( https://peps.python.org/pep-0632/#migration-advice ):
> `distutils.version` — use the `packaging` package

Note that `packaging` is a 3rd party package, i.e. it would be a new dependency.
Also, it does not provide an identical replacement for `distutils.version.StrictVersion`.

Care needs to be taken when changing the semantics of version numbers...
E.g. `packaging.parse` and `packaging.Version` are less strict than what we currently use.
We have to be careful that old code recognises new electrum version numbers as both valid
and numerically greater than their version.

I think the easiest approach is for us to vendor this small part of distutils.
Re directory structure, this is based on `pip`:
bab5bfce50/src/pip/_vendor
(although the approach here is much more naive ofc)
2022-05-04 19:59:59 +02:00
ThomasV
6a9df7d827 Merge pull request #7792 from SomberNight/202204_asyncio_cleanups
asyncio: stop using get_event_loop(). introduce ~singleton loop.
2022-05-04 09:28:54 +02:00
ThomasV
56124ad15a swap_dialog: raise recv_amount when min_mount is received 2022-04-30 15:23:47 +02:00
SomberNight
2c57c78ebe asyncio: stop using get_event_loop(). introduce ~singleton loop.
asyncio.get_event_loop() became deprecated in python3.10. (see https://github.com/python/cpython/issues/83710)
```
.../electrum/electrum/daemon.py:470: DeprecationWarning: There is no current event loop
  self.asyncio_loop = asyncio.get_event_loop()
.../electrum/electrum/network.py:276: DeprecationWarning: There is no current event loop
  self.asyncio_loop = asyncio.get_event_loop()
```
Also, according to that thread, "set_event_loop() [... is] not deprecated by oversight".
So, we stop using get_event_loop() and set_event_loop() in our own code.
Note that libraries we use (such as the stdlib for python <3.10), might call get_event_loop,
which then relies on us having called set_event_loop e.g. for the GUI thread. To work around
this, a custom event loop policy providing a get_event_loop implementation is used.

Previously, we have been using a single asyncio event loop, created with
util.create_and_start_event_loop, and code in many places got a reference to this loop
using asyncio.get_event_loop().
Now, we still use a single asyncio event loop, but it is now stored as a global in
util._asyncio_event_loop (access with util.get_asyncio_loop()).

I believe these changes also fix https://github.com/spesmilo/electrum/issues/5376
2022-04-29 18:49:07 +02:00
ThomasV
fdee31af05 Qt settings_dialog: use signals
- changes must apply to all windows
 - do not keep reference to the window object
2022-04-29 17:04:16 +02:00
ThomasV
334da245dc (minor) fix checkbox in qt settings 2022-04-29 13:03:33 +02:00
ThomasV
f4e902e907 LNWorker: give up payment after timeout, not number of attempts.
Limiting attempts may interrupt a MPP before we receive a MPP_timeout
The attempts parameter is still used in unit tests.
2022-04-29 12:17:38 +02:00
ThomasV
1f7ada3486 minor: fix #7789 2022-04-28 15:26:20 +02:00
ThomasV
96433ea2b4 Merge pull request #7778 from SomberNight/202204_invoice_recalc_ids
wallet_db upgrade: recalc keys of outgoing on-chain invoices
2022-04-28 15:12:29 +02:00
ThomasV
e3beae5c00 Merge pull request #7761 from SomberNight/202204_versioninfo_cmd
add `version_info` command
2022-04-27 09:59:27 +02:00
Rogach
6d049a30f2 fix typo in warning message shown when enabling lightning (#7782) 2022-04-25 21:35:42 +00:00
ThomasV
a0a81c31bd Qt: hide receive tabs when payment is received. 2022-04-23 19:25:24 +02:00
ThomasV
31dc93eade Qt: remove QR button from receive text widget. Add tooltip instead 2022-04-23 10:43:50 +02:00
ThomasV
b9139a2472 minor fix: update_receive_address_styling 2022-04-23 09:28:41 +02:00
SomberNight
adfe542fae wallet_db upgrade: recalc keys of outgoing on-chain invoices
closes https://github.com/spesmilo/electrum/issues/7777
2022-04-22 19:53:55 +02:00
ThomasV
fb6047ec46 lnworker: fix can_pay_invoice for trampoline MPP
Call it from the GUI
2022-04-22 15:13:12 +02:00
ThomasV
d34f513532 Qt: adapt receive_lightning_help text 2022-04-22 12:03:51 +02:00
ThomasV
7be7ea71db follow-up e992e3a9b2 2022-04-21 11:50:42 +02:00
ThomasV
e992e3a9b2 Qt: follow-up e362d1aac4 2022-04-20 13:42:06 +02:00
ThomasV
ba018c707f Qt: add bolt11_fallback and bip21_lightning options to preferences 2022-04-20 12:48:22 +02:00
ThomasV
cbb51b31d8 kivy updates 2022-04-20 12:48:22 +02:00
ThomasV
0c64a884c9 Qt: show single balance in statusbar
- details in popup dialop
  - piechart in status bar
2022-04-20 12:48:22 +02:00
ThomasV
60865f3902 Show options if we do not have the liquidity to pay a lightning invoice:
pay onchain, open channel, rebalance.

If we do a swap or open a channel, the payment will be scheduled.
2022-04-20 12:48:22 +02:00
ThomasV
2c6e36e89d Fallback addresses
- add fallback address to BOLT-11 LN invoices
   - Qt: if LN payment fails, propose onchain fallback
2022-04-20 12:48:22 +02:00
ThomasV
f18a042955 Qt: receive_lightning_help text 2022-04-20 12:48:22 +02:00