33
44from PyQt5 .QtCore import Qt , QObject , pyqtSignal
55from PyQt5 .QtGui import QTextOption
6- from PyQt5 .QtWidgets import QSizePolicy , QVBoxLayout , QHBoxLayout , QLabel , QLineEdit , QTextEdit , QComboBox , QPushButton , QFormLayout
6+ from PyQt5 .QtWidgets import QSizePolicy , QVBoxLayout , QHBoxLayout , QLabel , QLineEdit , QTextEdit , QComboBox , QPushButton , QFormLayout , QCheckBox
77
88from electrum .i18n import _
99from electrum .plugin import hook
@@ -66,7 +66,11 @@ def settings_dialog(self, window):
6666 form .addRow ('' , helptext (_ ('Used for reading the cookie file. Ignored if auth is set.' ), False ))
6767
6868 wallet_e = input (self .bitcoind_wallet , 150 )
69- form .addRow (_ ('Wallet:' ), wallet_e )
69+ wallet_ch = checkbox ('Create if missing' , self .create_wallet_if_missing )
70+ wallet_hbox = QHBoxLayout ()
71+ wallet_hbox .addWidget (wallet_e )
72+ wallet_hbox .addWidget (wallet_ch )
73+ form .addRow (_ ('Wallet:' ), wallet_hbox )
7074 form .addRow ('' , helptext (_ ('For use with multi-wallet. Leave blank to use the default wallet.' ), False ))
7175
7276
@@ -115,6 +119,7 @@ def save_config_and_run():
115119 self .bitcoind_dir = str (dir_e .text ())
116120 self .bitcoind_auth = str (auth_e .text ())
117121 self .bitcoind_wallet = str (wallet_e .text ())
122+ self .create_wallet_if_missing = wallet_ch .isChecked ()
118123 self .rescan_since = get_rescan_value (rescan_c , rescan_e )
119124 self .custom_opt = str (custom_opt_e .text ())
120125 self .verbose = verbose_c .currentIndex ()
@@ -124,6 +129,7 @@ def save_config_and_run():
124129 self .config .set_key ('bwt_bitcoind_dir' , self .bitcoind_dir )
125130 self .config .set_key ('bwt_bitcoind_auth' , self .bitcoind_auth )
126131 self .config .set_key ('bwt_bitcoind_wallet' , self .bitcoind_wallet )
132+ self .config .set_key ('bwt_create_wallet_if_missing' , self .create_wallet_if_missing )
127133 self .config .set_key ('bwt_rescan_since' , self .rescan_since )
128134 self .config .set_key ('bwt_custom_opt' , self .custom_opt )
129135 self .config .set_key ('bwt_verbose' , self .verbose )
@@ -179,6 +185,11 @@ def helptext(text, wrap=True):
179185 l .setStyleSheet ('QLabel { color: #aaa; font-size: 0.9em }' )
180186 return l
181187
188+ def checkbox (text , selected = False ):
189+ ch = QCheckBox (text )
190+ ch .setChecked (selected )
191+ return ch
192+
182193def show_log (log_t , level , pkg , msg ):
183194 scrollbar = log_t .verticalScrollBar ()
184195 wasOnBottom = scrollbar .value () >= scrollbar .maximum () - 5
0 commit comments