Commit Graph

1560 Commits

Author SHA1 Message Date
SomberNight
be322f7ea7 qt dialogs: disconnect signals and unregister callbacks in closeEvent 2022-06-22 02:13:19 +02:00
ghost43
c3093ded21 Merge pull request #7858 from spesmilo/event_listener
EventListener class to handle callbacks
2022-06-22 00:12:34 +00:00
SomberNight
5b000a871f EventListener follow-ups: adapt left-out classes and minor clean-ups 2022-06-22 02:09:26 +02:00
ThomasV
dbf055de9a EventListener class to handle callbacks
and QtEventListener for Qt
2022-06-22 02:07:46 +02:00
SomberNight
fbb3491e97 fix typo: stdio gui with no wallet
same as https://github.com/spesmilo/electrum/pull/3223 - should have been included there
2022-06-22 00:38:41 +02:00
ThomasV
034bd42d9c text guii: display full history 2022-06-17 12:59:35 +02:00
ThomasV
55f46fb61e adb fixes for text and stdio GUIs 2022-06-17 10:04:28 +02:00
ThomasV
79428756b2 kivy: in event handlers, check wallet.
We might receive events before the wallet is loaded.
2022-06-16 16:50:31 +02:00
ThomasV
f1289a2a5e fix #7851: store addresses_beyond_gap_limit in address_list 2022-06-16 08:52:30 +02:00
ThomasV
1915330039 Qt receive widgets: do not show request that have expired
They may still be retrieved from the menu
2022-06-14 20:26:54 +02:00
ThomasV
c7418d4dc7 Qt: payment received notification, show label and amount instead of key
The key may be a bitcoin address, even for a lightning payment.
2022-06-14 20:10:24 +02:00
SomberNight
f12e87be93 lnchannel: add new states: WE_ARE_TOXIC, REQUESTED_FCLOSE
The `WE_ARE_TOXIC` state is added as a sanity check to ensure that if
the remote has proven that we have lost state we do not accidentally
do a local force-close. E.g. if we receive an "error" message for the
channel, we might normally do an automatic force-close. Manually
force-closing in such a state is not offered anymore by the GUI.

The `REQUESTED_FCLOSE` state is added as it is quite likely that
we receive an error message from the remote after requesting a fclose,
e.g. during a later chan-reestablish. In such a scenario, we should
not do an auto-local-fclose, however the manual option of a local-fclose
should still be offered.
2022-06-10 17:09:33 +02:00
ThomasV
151500fb72 follow-up afa2ed1fe285886fdd087aa8b1e303e2634d9098 2022-06-10 13:07:53 +02:00
ThomasV
121d8732f1 Persist LNWatcher transactions in wallet file:
- separate AddressSynchronizer from Wallet and LNWatcher
 - the AddressSynchronizer class is referred to as 'adb' (address database)
 - Use callbacks to replace overloaded methods
2022-06-10 13:07:53 +02:00
SomberNight
f7573dbce6 qt main_window: (trivial) rm dead code, and fix copy-paste error 2022-06-07 19:57:53 +02:00
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