Disable oniononly checkbox in Settings dialog if have no onion v3 nodes

This commit is contained in:
Lee Miller 2022-08-30 00:35:22 +03:00
parent 14340540ae
commit 7e5e30d125
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -6,6 +6,7 @@ import os
import sys import sys
import tempfile import tempfile
import six
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
import debug import debug
@ -160,6 +161,26 @@ class SettingsDialog(QtGui.QDialog):
else self.comboBoxProxyType.findText(self._proxy_type)) else self.comboBoxProxyType.findText(self._proxy_type))
self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex()) self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex())
if self._proxy_type:
for node, info in six.iteritems(
knownnodes.knownNodes.get(
min(state.streamsInWhichIAmParticipating), [])
):
if (
node.host.endswith('.onion') and len(node.host) > 22
and not info.get('self')
):
break
else:
if self.checkBoxOnionOnly.isChecked():
self.checkBoxOnionOnly.setText(
self.checkBoxOnionOnly.text() + ", " + _translate(
"MainWindow", "may cause connection problems!"))
self.checkBoxOnionOnly.setStyleSheet(
"QCheckBox { color : red; }")
else:
self.checkBoxOnionOnly.setEnabled(False)
self.lineEditSocksHostname.setText( self.lineEditSocksHostname.setText(
config.get('bitmessagesettings', 'sockshostname')) config.get('bitmessagesettings', 'sockshostname'))
self.lineEditSocksPort.setText(str( self.lineEditSocksPort.setText(str(