def wallet_widgets(self, wallet: Wallet, tab: QWidget) -> None: usechange_cb = QCheckBox(_('Use change addresses')) usechange_cb.setChecked(wallet.get_use_change()) usechange_cb.setEnabled(app_state.config.is_modifiable('use_change')) usechange_cb.setToolTip( _('Using a different change key each time improves your privacy by ' 'making it more difficult for others to analyze your transactions.' )) def on_usechange(state): usechange_result = state == Qt.Checked if wallet.get_use_change() != usechange_result: wallet.set_use_change(usechange_result) multiple_cb.setEnabled(wallet.get_use_change()) usechange_cb.stateChanged.connect(on_usechange) multiple_cb = QCheckBox(_('Use multiple change addresses')) multiple_cb.setChecked(wallet.get_multiple_change()) multiple_cb.setEnabled(wallet.get_use_change()) multiple_cb.setToolTip('\n'.join([ _('In some cases, use up to 3 change keys in order to break ' 'up large coin amounts and obfuscate the recipient key.'), _('This may result in higher transactions fees.') ])) def on_multiple(state): multiple = state == Qt.Checked if wallet.get_multiple_change() != multiple: wallet.set_multiple_change(multiple) multiple_cb.stateChanged.connect(on_multiple) options_box = QGroupBox() options_vbox = QVBoxLayout() options_box.setLayout(options_vbox) options_vbox.addWidget(usechange_cb) options_vbox.addWidget(multiple_cb) transaction_cache_size = wallet.get_cache_size_for_tx_bytedata() # nz_label = HelpLabel(_('Transaction Cache Size (MB)') + ':', # _("This allows setting a per-wallet limit on the amount of transaction data cached " # "in memory. A value of 0 will disable the cache, and setting low values can cause " # "wallet slowness due to continual fetching of transaction data from the database.")) nz_modifiable = app_state.config.is_modifiable( 'tx_bytedata_cache_size') nz = QSpinBox() nz.setAlignment(Qt.AlignRight) nz.setMinimum(MINIMUM_TXDATA_CACHE_SIZE_MB) nz.setMaximum(MAXIMUM_TXDATA_CACHE_SIZE_MB) nz.setValue(transaction_cache_size) nz.setEnabled(nz_modifiable) def on_nz(): value = nz.value() # This will not resize the cache, as we do not want to be doing it with every # change and some changes may be bad to actually put in place. wallet.set_cache_size_for_tx_bytedata(value) nz.valueChanged.connect(on_nz) tx_cache_layout = QHBoxLayout() tx_cache_layout.setSpacing(15) tx_cache_layout.addWidget(nz) tx_cache_layout.addWidget(QLabel(_("MiB"))) form = FormSectionWidget(minimum_label_width=120) form.add_row(_('Options'), options_box, True) form.add_row(_('Transaction Cache Size'), tx_cache_layout) vbox = QVBoxLayout() vbox.addWidget(form) vbox.addStretch(1) tab.setLayout(vbox)
def _wallet_widgets(self, wallet: Wallet, tab: QWidget) -> None: use_change_addresses_cb = QCheckBox(_('Use change addresses')) use_change_addresses_cb.setChecked( wallet.get_boolean_setting(WalletSettings.USE_CHANGE, True)) use_change_addresses_cb.setEnabled( app_state.config.is_modifiable(WalletSettings.USE_CHANGE)) use_change_addresses_cb.setToolTip( _('Using a different change key each time improves your privacy by ' 'making it more difficult for others to analyze your transactions.') ) def on_usechange(state: int): should_enable = state == Qt.Checked if wallet.get_boolean_setting(WalletSettings.USE_CHANGE, True) != should_enable: wallet.set_boolean_setting(WalletSettings.USE_CHANGE, should_enable) multiple_change_cb.setEnabled(should_enable) use_change_addresses_cb.stateChanged.connect(on_usechange) multiple_change_cb = QCheckBox(_('Use multiple change addresses')) multiple_change_cb.setChecked( wallet.get_boolean_setting(WalletSettings.MULTIPLE_CHANGE, True)) multiple_change_cb.setEnabled(wallet.get_boolean_setting(WalletSettings.USE_CHANGE, True)) multiple_change_cb.setToolTip('\n'.join([ _('In some cases, use up to 3 change keys in order to break ' 'up large coin amounts and obfuscate the recipient key.'), _('This may result in higher transactions fees.') ])) def on_multiple_change_toggled(state: int) -> None: multiple = state == Qt.Checked if wallet.get_boolean_setting(WalletSettings.MULTIPLE_CHANGE, True) != multiple: wallet.set_boolean_setting(WalletSettings.MULTIPLE_CHANGE, multiple) multiple_change_cb.stateChanged.connect(on_multiple_change_toggled) coinsplitting_option_cb = QCheckBox(_('Show coin-splitting option on the Send tab')) coinsplitting_option_cb.setChecked(wallet.get_boolean_setting(WalletSettings.ADD_SV_OUTPUT)) coinsplitting_option_cb.setEnabled( app_state.config.is_modifiable(WalletSettings.ADD_SV_OUTPUT)) coinsplitting_option_cb.setToolTip( _('Whether to feature the the option to add Bitcoin SV only data to the transaction ' 'on the Send tab. Will only be shown for compatible account types.') ) def on_coinsplitting_option_cb(state: int): should_enable = state == Qt.Checked if wallet.get_boolean_setting(WalletSettings.ADD_SV_OUTPUT) != should_enable: wallet.set_boolean_setting(WalletSettings.ADD_SV_OUTPUT, should_enable) coinsplitting_option_cb.stateChanged.connect(on_coinsplitting_option_cb) options_box = QGroupBox() options_vbox = QVBoxLayout() options_box.setLayout(options_vbox) options_vbox.addWidget(use_change_addresses_cb) options_vbox.addWidget(multiple_change_cb) options_vbox.addWidget(coinsplitting_option_cb) multiple_accounts_cb = QCheckBox(_('Enable multiple accounts')) multiple_accounts_cb.setChecked( wallet.get_boolean_setting(WalletSettings.MULTIPLE_ACCOUNTS)) multiple_accounts_cb.setToolTip('\n'.join([ _('Multiple accounts are to a large degree ready for use, but not tested to the level ' 'where they are enabled for general use. Users who may wish to use these are warned ' 'that they are in the experimental section for a reason.') ])) def on_multiple_accounts_toggled(state: int) -> None: should_enable = state == Qt.Checked is_enabled = wallet.get_boolean_setting(WalletSettings.MULTIPLE_ACCOUNTS) if should_enable != is_enabled: wallet.set_boolean_setting(WalletSettings.MULTIPLE_ACCOUNTS, should_enable) multiple_accounts_cb.stateChanged.connect(on_multiple_accounts_toggled) experimental_box = QGroupBox() experimental_vbox = QVBoxLayout() experimental_box.setLayout(experimental_vbox) experimental_vbox.addWidget(multiple_accounts_cb) # Todo - add ability here to toggle deactivation of used keys - AustEcon transaction_cache_size = wallet.get_cache_size_for_tx_bytedata() # nz_label = HelpLabel(_('Transaction Cache Size (MB)') + ':', # _("This allows setting a per-wallet limit on the amount of transaction data cached " # "in memory. A value of 0 will disable the cache, and setting low values can cause " # "wallet slowness due to continual fetching of transaction data from the database.")) nz_modifiable = app_state.config.is_modifiable('tx_bytedata_cache_size') nz = QSpinBox() nz.setAlignment(Qt.AlignRight) nz.setMinimum(MINIMUM_TXDATA_CACHE_SIZE_MB) nz.setMaximum(MAXIMUM_TXDATA_CACHE_SIZE_MB) nz.setValue(transaction_cache_size) nz.setEnabled(nz_modifiable) def on_nz(): value = nz.value() # This will not resize the cache, as we do not want to be doing it with every # change and some changes may be bad to actually put in place. wallet.set_cache_size_for_tx_bytedata(value) nz.valueChanged.connect(on_nz) tx_cache_layout = QHBoxLayout() tx_cache_layout.setSpacing(15) tx_cache_layout.addWidget(nz) tx_cache_layout.addWidget(QLabel(_("MiB"))) form = FormSectionWidget(minimum_label_width=120) form.add_row(_('General options'), options_box, True) form.add_row(_('Experimental options'), experimental_box, True) form.add_row(_('Transaction Cache Size'), tx_cache_layout) vbox = QVBoxLayout() vbox.addWidget(form) vbox.addStretch(1) tab.setLayout(vbox)