@ -196,7 +196,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
tabs . addTab ( tab , icon , description . replace ( " & " , " " ) )
add_optional_tab ( tabs , self . addresses_tab , read_QIcon ( " tab_addresses.png " ) , _ ( " &Addresses " ) , " addresses " )
if self . config . get ( ' lightning ' ) :
if self . wallet . has_lightning ( ) :
add_optional_tab ( tabs , self . channels_tab , read_QIcon ( " lightning.png " ) , _ ( " Channels " ) , " channels " )
add_optional_tab ( tabs , self . utxo_tab , read_QIcon ( " tab_coins.png " ) , _ ( " Co&ins " ) , " utxo " )
add_optional_tab ( tabs , self . contacts_tab , read_QIcon ( " tab_contacts.png " ) , _ ( " Con&tacts " ) , " contacts " )
@ -232,7 +232,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
interests = [ ' wallet_updated ' , ' network_updated ' , ' blockchain_updated ' ,
' new_transaction ' , ' status ' ,
' banner ' , ' verified ' , ' fee ' , ' fee_histogram ' , ' on_quotes ' ,
' on_history ' , ' channel ' , ' channels ' ,
' on_history ' , ' channel ' , ' channels_updated ' ,
' invoice_status ' , ' request_status ' ]
# To avoid leaking references to "self" that prevent the
# window from being GC-ed when closed, callbacks should be
@ -377,8 +377,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self . on_fx_quotes ( )
elif event == ' on_history ' :
self . on_fx_history ( )
elif event == ' channels ' :
self . channels_list . update_rows . emit ( )
elif event == ' channels_updated ' :
self . channels_list . update_rows . emit ( * args )
elif event == ' channel ' :
self . channels_list . update_single_row . emit ( * args )
self . update_status ( )
@ -583,7 +583,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
file_menu . addAction ( _ ( " &Quit " ) , self . close )
wallet_menu = menubar . addMenu ( _ ( " &Wallet " ) )
wallet_menu . addAction ( _ ( " &Information " ) , self . show_master_public_keys )
wallet_menu . addAction ( _ ( " &Information " ) , self . show_wallet_info )
wallet_menu . addSeparator ( )
self . password_menu = wallet_menu . addAction ( _ ( " &Password " ) , self . change_password_dialog )
self . seed_menu = wallet_menu . addAction ( _ ( " &Seed " ) , self . show_seed_dialog )
@ -623,7 +623,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
view_menu = menubar . addMenu ( _ ( " &View " ) )
add_toggle_action ( view_menu , self . addresses_tab )
add_toggle_action ( view_menu , self . utxo_tab )
if self . config . get ( ' lightning ' ) :
if self . wallet . has_lightning ( ) :
add_toggle_action ( view_menu , self . channels_tab )
add_toggle_action ( view_menu , self . contacts_tab )
add_toggle_action ( view_menu , self . console_tab )
@ -633,7 +633,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
# Settings / Preferences are all reserved keywords in macOS using this as work around
tools_menu . addAction ( _ ( " Electrum preferences " ) if sys . platform == ' darwin ' else _ ( " Preferences " ) , self . settings_dialog )
tools_menu . addAction ( _ ( " &Network " ) , lambda : self . gui_object . show_network_dialog ( self ) )
if self . config . get ( ' lightning ' ) :
if self . wallet . has_lightning ( ) :
tools_menu . addAction ( _ ( " &Lightning " ) , self . gui_object . show_lightning_dialog )
tools_menu . addAction ( _ ( " &Watchtower " ) , self . gui_object . show_watchtower_dialog )
tools_menu . addAction ( _ ( " &Plugins " ) , self . plugins_dialog )
@ -985,7 +985,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
buttons . addStretch ( 1 )
buttons . addWidget ( self . clear_invoice_button )
buttons . addWidget ( self . create_invoice_button )
if self . config . get ( ' lightning ' ) :
if self . wallet . has_lightning ( ) :
self . create_lightning_invoice_button = QPushButton ( _ ( ' Lightning ' ) )
self . create_lightning_invoice_button . setIcon ( read_QIcon ( " lightning.png " ) )
self . create_lightning_invoice_button . clicked . connect ( lambda : self . create_invoice ( True ) )
@ -2300,7 +2300,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
sb . addPermanentWidget ( StatusBarButton ( read_QIcon ( " preferences.png " ) , _ ( " Preferences " ) , self . settings_dialog ) )
self . seed_button = StatusBarButton ( read_QIcon ( " seed.png " ) , _ ( " Seed " ) , self . show_seed_dialog )
sb . addPermanentWidget ( self . seed_button )
if self . config . get ( ' lightning ' ) :
if self . wallet . has_lightning ( ) :
self . lightning_button = StatusBarButton ( read_QIcon ( " lightning.png " ) , _ ( " Lightning Network " ) , self . gui_object . show_lightning_dialog )
sb . addPermanentWidget ( self . lightning_button )
self . status_button = StatusBarButton ( read_QIcon ( " status_disconnected.png " ) , _ ( " Network " ) , lambda : self . gui_object . show_network_dialog ( self ) )
@ -2390,7 +2390,16 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
if d . exec_ ( ) :
self . set_contact ( line2 . text ( ) , line1 . text ( ) )
def show_master_public_keys ( self ) :
def enable_lightning ( self ) :
warning1 = _ ( " Lightning support in Electrum is experimental. Do not put large amounts in lightning channels. " )
warning2 = _ ( " Funds stored in lightning channels are not recoverable from your seed. You must backup your wallet file everytime you crate a new channel. " )
r = self . question ( _ ( ' Enable Lightning payments? ' ) + ' \n \n ' + _ ( ' WARNINGS ' ) + ' : ' + ' \n \n ' + warning1 + ' \n \n ' + warning2 )
if not r :
return
self . wallet . init_lightning ( )
self . show_warning ( _ ( ' Lightning keys have been initialized. Please restart Electrum ' ) )
def show_wallet_info ( self ) :
dialog = WindowModalDialog ( self , _ ( " Wallet Information " ) )
dialog . setMinimumSize ( 500 , 100 )
mpk_list = self . wallet . get_master_public_keys ( )
@ -2414,6 +2423,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
grid . addWidget ( QLabel ( _ ( " Keystore type " ) + ' : ' ) , 4 , 0 )
ks_type = str ( keystore_types [ 0 ] ) if keystore_types else _ ( ' No keystore ' )
grid . addWidget ( QLabel ( ks_type ) , 4 , 1 )
# lightning
if self . wallet . has_lightning ( ) :
lightning_b = None
lightning_label = QLabel ( _ ( ' Enabled ' ) )
else :
lightning_b = QPushButton ( _ ( ' Enable ' ) )
lightning_b . clicked . connect ( self . enable_lightning )
lightning_label = QLabel ( _ ( ' Disabled ' ) )
grid . addWidget ( QLabel ( _ ( ' Lightning ' ) ) , 5 , 0 )
grid . addWidget ( lightning_label , 5 , 1 )
grid . addWidget ( lightning_b , 5 , 2 )
vbox . addLayout ( grid )
if self . wallet . is_deterministic ( ) :