move audio_modem icons to plugin dir, so that the plugin is self-contained.
This requires changing the API of OverlayControlMixin.addButton
This commit is contained in:
@@ -3,5 +3,6 @@
|
||||
"fullname": "Audio MODEM",
|
||||
"description": "Provides support for air-gapped transaction signing.",
|
||||
"requires": [["amodem", "http://github.com/romanz/amodem/"]],
|
||||
"icon":"speaker.png",
|
||||
"available_for": ["qt"]
|
||||
}
|
||||
|
||||
BIN
electrum/plugins/audio_modem/microphone.png
Normal file
BIN
electrum/plugins/audio_modem/microphone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 199 B |
@@ -12,6 +12,7 @@ from electrum.plugin import BasePlugin, hook
|
||||
from electrum.gui.qt.util import WaitingDialog, EnterButton, WindowModalDialog, read_QIcon
|
||||
from electrum.i18n import _
|
||||
from electrum.logging import get_logger
|
||||
from electrum.gui.qt.util import read_QIcon_from_bytes
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from electrum.gui.qt.transaction_dialog import TxDialog
|
||||
@@ -74,8 +75,8 @@ class Plugin(BasePlugin):
|
||||
@hook
|
||||
def transaction_dialog(self, dialog: 'TxDialog'):
|
||||
b = QPushButton()
|
||||
b.setIcon(read_QIcon("speaker.png"))
|
||||
|
||||
icon = read_QIcon_from_bytes(self.read_file("speaker.png"))
|
||||
b.setIcon(icon)
|
||||
def handler():
|
||||
blob = dialog.tx.serialize()
|
||||
self._send(parent=dialog, blob=blob)
|
||||
@@ -84,15 +85,16 @@ class Plugin(BasePlugin):
|
||||
|
||||
@hook
|
||||
def scan_text_edit(self, parent):
|
||||
parent.addButton('microphone.png', partial(self._recv, parent),
|
||||
_("Read from microphone"))
|
||||
icon = read_QIcon_from_bytes(self.read_file("microphone.png"))
|
||||
parent.addButton(icon, partial(self._recv, parent), _("Read from microphone"))
|
||||
|
||||
@hook
|
||||
def show_text_edit(self, parent):
|
||||
def handler():
|
||||
blob = str(parent.toPlainText())
|
||||
self._send(parent=parent, blob=blob)
|
||||
parent.addButton('speaker.png', handler, _("Send to speaker"))
|
||||
icon = read_QIcon_from_bytes(self.read_file("speaker.png"))
|
||||
parent.addButton(icon, handler, _("Send to speaker"))
|
||||
|
||||
def _audio_interface(self):
|
||||
interface = amodem.audio.Interface(config=self.modem_config)
|
||||
|
||||
BIN
electrum/plugins/audio_modem/speaker.png
Normal file
BIN
electrum/plugins/audio_modem/speaker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 392 B |
@@ -14,7 +14,7 @@ from electrum.hw_wallet.qt import QtHandlerBase, QtPluginBase
|
||||
from electrum.hw_wallet.plugin import only_hook_if_libraries_available, OperationCancelled
|
||||
|
||||
from electrum.gui.qt.wizard.wallet import WCScriptAndDerivation, WCHWUnlock, WCHWUninitialized, WCHWXPub
|
||||
from electrum.gui.qt.util import WindowModalDialog, OkButton, ButtonsTextEdit
|
||||
from electrum.gui.qt.util import WindowModalDialog, OkButton, ButtonsTextEdit, read_QIcon
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from electrum.gui.qt.wizard.wallet import QENewWalletWizard
|
||||
@@ -58,7 +58,7 @@ class Plugin(BitBox02Plugin, QtPluginBase):
|
||||
)
|
||||
|
||||
device_name = "{} ({})".format(self.device, keystore.label)
|
||||
mpk_text.addButton("eye1.png", on_button_click, _("Show on {}").format(device_name))
|
||||
mpk_text.addButton(read_QIcon("eye1.png"), on_button_click, _("Show on {}").format(device_name))
|
||||
|
||||
@hook
|
||||
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
|
||||
Reference in New Issue
Block a user