@ -1479,11 +1479,13 @@ class JMWalletTab(QWidget):
# Show QR code option only for new addresses to avoid address reuse
# Show QR code option only for new addresses to avoid address reuse
if item . text ( 3 ) == " new " :
if item . text ( 3 ) == " new " :
menu . addAction ( " Show QR code " ,
menu . addAction ( " Show QR code " ,
lambda : self . openQRCodePopup ( txt ) )
lambda : self . openAddress QRCodePopup ( txt ) )
if xpub_exists :
if xpub_exists :
menu . addAction ( " Copy extended public key to clipboard " ,
menu . addAction ( " Copy extended public key to clipboard " ,
lambda : app . clipboard ( ) . setText ( xpub ) ,
lambda : app . clipboard ( ) . setText ( xpub ) ,
shortcut = QKeySequence ( QKeySequence . Copy ) )
shortcut = QKeySequence ( QKeySequence . Copy ) )
menu . addAction ( " Show QR code " ,
lambda : self . openQRCodePopup ( xpub , xpub ) )
menu . addAction ( " Refresh wallet " ,
menu . addAction ( " Refresh wallet " ,
lambda : mainWindow . updateWalletInfo ( None , " all " ) ,
lambda : mainWindow . updateWalletInfo ( None , " all " ) ,
shortcut = QKeySequence ( QKeySequence . Refresh ) )
shortcut = QKeySequence ( QKeySequence . Refresh ) )
@ -1491,7 +1493,11 @@ class JMWalletTab(QWidget):
#TODO add more items to context menu
#TODO add more items to context menu
menu . exec_ ( self . walletTree . viewport ( ) . mapToGlobal ( position ) )
menu . exec_ ( self . walletTree . viewport ( ) . mapToGlobal ( position ) )
def openQRCodePopup ( self , address ) :
def openQRCodePopup ( self , title , data ) :
popup = QRCodePopup ( self , title , data )
popup . show ( )
def openAddressQRCodePopup ( self , address ) :
bip21_uri = btc . encode_bip21_uri ( address , { } )
bip21_uri = btc . encode_bip21_uri ( address , { } )
# From BIP173 (bech32) spec:
# From BIP173 (bech32) spec:
# For presentation, lowercase is usually preferable, but inside
# For presentation, lowercase is usually preferable, but inside
@ -1502,8 +1508,7 @@ class JMWalletTab(QWidget):
# encoded in QR code to uppercase, if possible.
# encoded in QR code to uppercase, if possible.
if detect_script_type ( mainWindow . wallet_service . addr_to_script ( address ) ) == TYPE_P2WPKH :
if detect_script_type ( mainWindow . wallet_service . addr_to_script ( address ) ) == TYPE_P2WPKH :
bip21_uri = bip21_uri . upper ( )
bip21_uri = bip21_uri . upper ( )
popup = QRCodePopup ( self , address , bip21_uri )
self . openQRCodePopup ( address , bip21_uri )
popup . show ( )
def updateWalletInfo ( self , walletinfo = None ) :
def updateWalletInfo ( self , walletinfo = None ) :
max_mixdepth_count = jm_single ( ) . config . getint ( " GUI " , " max_mix_depth " )
max_mixdepth_count = jm_single ( ) . config . getint ( " GUI " , " max_mix_depth " )