1
0
Commit Graph

96 Commits

Author SHA1 Message Date
SomberNight
7fa204f16b qml: fix setting config.GUI_QML_SET_MAX_BRIGHTNESS_ON_QR_DISPLAY
follow-up https://github.com/spesmilo/electrum/pull/9321
2025-06-05 16:37:59 +00:00
f321x
38f51a3b13 qml: add terms of use to setup wizard 2025-05-13 14:28:13 +02:00
Sander van Grieken
3ff84f08a6 plugins: psbt_nostr: implement for qml 2025-04-15 14:06:29 +02:00
Sander van Grieken
eb29b7c95c qml: simplify QEConfig and QEDaemon use.
force QEDaemon singleton, and refer to QEDaemon.instance where possible
In cases where we would run into circular dependencies, pass the instance

also refer to singleton QEConfig instead of passing instance in qeapp.py
2025-04-09 13:44:26 +02:00
Sander van Grieken
1ac885ea40 qml: add android permission methods in AppController 2025-04-03 12:37:17 +02:00
Sander van Grieken
1559129016 qml: properly destroy ExceptionDialog after close, improve encapsulation 2025-03-28 14:51:12 +01:00
f321x
246f03fe20 allow all plugins to be either zip or directory based 2025-03-17 16:27:33 +01:00
ThomasV
840243e029 separate fee policy from config
- Wallet.make_unsigned_transaction takes a FeePolicy parameter
 - fee sliders act on a FeePolicy instead of config
 - different fee policies may be used for different purposes
 - do not detect dust outputs in lnsweep, delegate that to lnwatcher
2025-03-05 10:29:26 +01:00
Oren
0618fff03c Cache font-ids that were already loaded
`get_font_id` also saves the trouble of
specifying the entire path of the fonts.
2025-03-04 12:11:30 +02:00
Sander van Grieken
fc2d43acfd qt,qml: move fonts to /electrum/gui for use in all guis. 2025-03-03 13:47:03 +01:00
Josh Geden
6331448860 qml: add config setting for max brightness on qr display 2025-01-22 09:47:10 +01:00
Sander van Grieken
96f7d91e3a qml: improve validation of pubkey/connectstring 2024-10-23 16:09:28 +02:00
SomberNight
6e46fb329d qml/qeapp.py: (trivial) use os.path.join for constructing path
There is an issue with plyer on Windows, which I thought was related to the mixed
backwards/forward slashes in the path, but no, this change still did not fix it:
```
  1.84 | D | gui.qml.qeapp.QEAppController | sending push notification to OS: message='heyheyhey'
Traceback (most recent call last):
  File "...\electrum\electrum\util.py", line 1111, in run_with_except_hook
    run_original(*args2, **kwargs2)
  File "...\Python310\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "...\plyer\platforms\win\libs\balloontip.py", line 206, in balloon_tip
    WindowsBalloonTip(**kwargs)
  File "...\plyer\platforms\win\libs\balloontip.py", line 130, in __init__
    raise Exception('Could not load icon {}'.format(app_icon))
Exception: Could not load icon ...\electrum\electrum\gui\icons\electrum.png
```
2024-10-10 15:42:39 +00:00
accumulator
117c7b2c2a Merge pull request #9203 from accumulator/qml_sweep_privkeys
qml: Sweep from privkeys
2024-10-09 11:14:00 +02:00
SomberNight
9b1ccb9978 android: add comment that OS push notifications are broken 2024-09-19 16:46:07 +00:00
Sander van Grieken
44c0e583d6 qml: SweepDialog 2024-09-17 16:43:38 +02:00
SomberNight
7a7b43c0a8 qml/android: set max screen brightness when displaying QR codes
In some cases this makes it much easier to successfully scan a QR code.
I was trying to scan a PSBT using a laptop camera from my phone screen for 2 minutes, until I realised the screen brightness was the issue.  o.O
2024-08-21 23:37:36 +00:00
SomberNight
96bb1611c5 follow-up plugins changes: fix qml gui
follow-up https://github.com/spesmilo/electrum/pull/8713

```
  1.35 | E | __main__ | daemon.run_gui errored
Traceback (most recent call last):
  File "/home/user/wspace/electrum/./run_electrum", line 458, in handle_cmd
    d.run_gui()
  File "/home/user/wspace/electrum/electrum/daemon.py", line 623, in run_gui
    self.gui_object = gui.ElectrumGui(config=self.config, daemon=self, plugins=self._plugins)
  File "/home/user/wspace/electrum/electrum/util.py", line 482, in do_profile
    o = func(*args, **kw_args)
  File "/home/user/wspace/electrum/electrum/gui/qml/__init__.py", line 82, in __init__
    self.app = ElectrumQmlApplication(sys.argv, config=config, daemon=daemon, plugins=plugins)
  File "/home/user/wspace/electrum/electrum/gui/qml/qeapp.py", line 428, in __init__
    self.plugins.load_plugin('trustedcoin')
  File "/home/user/wspace/electrum/electrum/plugin.py", line 269, in load_plugin
    raise Exception(f"could not find plugin {name!r}")
Exception: could not find plugin 'trustedcoin'
```
2024-04-18 17:01:08 +00:00
Sander van Grieken
482ec89b5d minor, code style, imports 2024-02-05 21:25:13 +01:00
SomberNight
a9a8ed2eb4 follow-up: factor out more hardcoded "sat/byte" and "sat/b" strings
- rename globals
- also rm hardcoded strings from qml
- use consistent unit names in qml
  (previously mixed sat/vB and sat/byte (latter coming from core lib))
2024-02-03 05:26:31 +00:00
SomberNight
0dae17339d qml: add config setting to allow screenshots
On Android, we disallow screenshots on screens where the seed is visible.
(The seed is extremely sensitive data that should not be stored digitally without
significant precautions but it's also cumbersome to write down or memorise, so
some people instinctively just try to take a screenshot of it when creating a wallet.)
We do this by using the built-in OS mechanism of setting FLAG_SECURE on the window.
However, on some devices with custom ROMs (one report from LineageOS, one from /e/OS),
unsetting FLAG_SECURE crashes the application for some reason.

As a workaround, this commit adds a config setting into the Preferences,
to disable this mechanism and just always allow screenshots.
(note that you can get into the qml Preferences before creating/opening any wallet)

ref https://github.com/spesmilo/electrum/issues/8522
2023-12-27 07:28:39 +00:00
Sander van Grieken
42f323ac8d qml: remove APK version, add Qt and PyQt version strings to About page 2023-11-10 11:11:51 +01:00
SomberNight
5c3e14d8de qml: replace Send/ScanDialog with java bases zxing qr scan activity. 2023-11-07 10:17:10 +01:00
Sander van Grieken
a77ff9943a qml: refactor qr scan to qt6
As the method of capturing frames is totally different, the animation when
a QR is found has been removed.
2023-11-07 10:17:10 +01:00
Sander van Grieken
6270eae5c9 qml: port PyQt5 to PyQt6 2023-11-07 10:16:18 +01:00
Sander van Grieken
7ca9b735d5 daemon: refactor load_wallet to not just return None, but raise specific exceptions.
The following exceptions should be expected:
FileNotFoundError: given wallet path does not exist
StorageReadWriteError: given file is not readable/writable or containing folder is not writable
InvalidPassword: wallet requires a password but no password or an invalid password was given
WalletFileException: any internal wallet data issue. specific subclasses can be caught separately:
-  WalletRequiresSplit: wallet needs splitting (split_data passed in Exception)
-  WalletRequiresUpgrade: wallet needs upgrade, and no upgrade=True was passed to load_wallet
-  WalletUnfinished: wallet file contains an action and needs additional information to finalize. (WalletDB passed in exception)

Removed qml/qewalletdb.py

This patch also fixes load_wallet calls in electrum/scripts and adds a qml workaround for dialogs opening and closing so
fast that the dialog opened==true property change is missed (which we need to manage the dialog/page stack)
2023-10-10 17:42:07 +02:00
Sander van Grieken
dec4a8e2c7 qml: wizard fixes 2023-09-20 14:34:31 +02:00
Sander van Grieken
b6863b4854 qml: add LabelSync toggle 2023-07-11 12:51:37 +02:00
Sander van Grieken
f980bd97b5 payment_identifier: factor out bip21 functions to bip21.py to break cyclic dependencies,
parse bolt11 only once, store invoice internally instead of bolt11 string
add is_onchain method to indicate if payment identifier can be paid onchain
2023-07-08 12:18:37 +02:00
ThomasV
15eb765eac payment_identifiers:
- this separates GUI from core handling
 - the PaymentIdentifier class handles network requests
 - the GUI is agnostic about the type of PI
2023-06-28 16:49:28 +02:00
SomberNight
24980feab7 config: introduce ConfigVars
A new config API is introduced, and ~all of the codebase is adapted to it.
The old API is kept but mainly only for dynamic usage where its extra flexibility is needed.

Using examples, the old config API looked this:
```
>>> config.get("request_expiry", 86400)
604800
>>> config.set_key("request_expiry", 86400)
>>>
```

The new config API instead:
```
>>> config.WALLET_PAYREQ_EXPIRY_SECONDS
604800
>>> config.WALLET_PAYREQ_EXPIRY_SECONDS = 86400
>>>
```

The old API operated on arbitrary string keys, the new one uses
a static ~enum-like list of variables.

With the new API:
- there is a single centralised list of config variables, as opposed to
  these being scattered all over
- no more duplication of default values (in the getters)
- there is now some (minimal for now) type-validation/conversion for
  the config values

closes https://github.com/spesmilo/electrum/pull/5640
closes https://github.com/spesmilo/electrum/pull/5649

Note: there is yet a third API added here, for certain niche/abstract use-cases,
where we need a reference to the config variable itself.
It should only be used when needed:
```
>>> var = config.cv.WALLET_PAYREQ_EXPIRY_SECONDS
>>> var
<ConfigVarWithConfig key='request_expiry'>
>>> var.get()
604800
>>> var.set(3600)
>>> var.get_default_value()
86400
>>> var.is_set()
True
>>> var.is_modifiable()
True
```
2023-05-25 17:39:48 +00:00
Sander van Grieken
0e0c7980dd qml: implement bip39 account detection 2023-05-09 11:40:05 +02:00
Sander van Grieken
0672ea20ab qml: implement toggle for android SECURE_FLAG and add marker to wizard pages
that should be secured.
2023-05-02 15:16:51 +02:00
SomberNight
312f2641e7 don't use bare except
use "except Exception", or if really needed explicitly "except BaseException"
2023-04-24 12:58:01 +00:00
ThomasV
d4c386a62c qml: use daemon threads everywhere the network is involved
The app hangs indefinitely if we try to quit it while one of
these threads is active, because once asyncio has shut down,
futures never return. This was already fixed for lightning
payments in c5dc133, but there are many other cases.
2023-04-05 12:31:20 +02:00
Sander van Grieken
0c83f363eb qml: haptic use constant compatible with older android 2023-04-05 12:28:56 +02:00
Sander van Grieken
8f3f282b62 Revert "qml: haptic override global setting"
This reverts commit 3e4737d6e9.
2023-04-05 12:08:54 +02:00
Sander van Grieken
3e4737d6e9 qml: haptic override global setting 2023-04-05 11:38:38 +02:00
Sander van Grieken
6c65161d27 qml: refactor qeinvoice.py
QEInvoice/QEInvoiceParser now properly split for mapping to Invoice type (QEInvoice)
and parsing/resolving of payment identifiers (QEInvoiceParser).
additionally, old, unused QEUserEnteredPayment was removed.

invoices are now never saved with user-entered amount if the original invoice
did not specify an amount (e.g. address-only, no-amount bip21 uri, or no-amount
lightning invoice). Furthermore, QEInvoice now adds an isSaved property so the
UI doesn't need to infer that from the existence of the invoice key.

Payments of lightning invoices are now triggered through QEInvoice.pay_lightning_invoice(),
using the internally kept Invoice instance. This replaces the old call path of
QEWallet.pay_lightning_invoice(invoice_key) which required the invoice to be saved
in the backend wallet before payment.

The LNURLpay flow arriving on InvoiceDialog implicitly triggered payment, this is
now indicated by InvoiceDialog.payImmediately property instead of inferrred from the
QEInvoiceParser isLnurlPay property.
2023-04-04 16:13:00 +02:00
Sander van Grieken
8bb2464acd qml: add haptic feedback for android. Also preload most used classes to reduce
lag on first use.
2023-04-03 16:07:15 +02:00
SomberNight
d189fdce69 qml: crash reporter: fix "show never" option
102.82 | E | gui.qml.qeapp.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qml/qeapp.py", line 271, in showNever
    self.config.set_key(BaseCrashReporter.config_key, False)
AttributeError: 'QEAppController' object has no attribute 'config'
2023-03-30 00:58:51 +00:00
SomberNight
f4e66810e7 qml: ElectrumGui to inherit BaseElectrumGui 2023-03-29 16:41:04 +00:00
SomberNight
0ebcc7df63 qml: only do android-specific stuff when on android
don't log an error when running on desktop
2023-03-23 14:34:47 +00:00
SomberNight
ff2da7ceb9 crash reporter: hardcode gui text. do not trust the server with it
paranoia.
2023-03-16 19:48:35 +00:00
Sander van Grieken
90355a150f qml: fix exception handler register opened wallet 2023-03-03 12:26:36 +01:00
Sander van Grieken
6a6982cdae qml: defer intent handling at startup, otherwise it gets lost as the app is not handling the signal yet.
Also defer intent handling until a wallet is opened.
2023-02-27 12:20:51 +01:00
Sander van Grieken
fa45e1b7ba qml: fix name clash QML vs registered QObjects NewWalletWizard and ServerConnectWizard 2023-02-16 13:22:24 +01:00
Sander van Grieken
1bfc4f1529 qml: android notification params 2023-02-10 13:29:18 +01:00
Sander van Grieken
11439fb3fd qml: don't stack exception dialogs when multiple exceptions happen 2023-02-09 01:34:54 +01:00
Sander van Grieken
5eb7bcebef qml: remove ugly notification popup, add wallet name to notifications 2023-02-07 13:55:22 +01:00