Don't add nonfunctional proxyconfig plugins in the Settings dialog

This commit is contained in:
Dmitri Bogomolov 2021-07-02 18:31:43 +03:00
parent 5fa8115273
commit a9488fb120
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -57,9 +57,16 @@ class SettingsDialog(QtGui.QDialog):
pass
else:
# Append proxy types defined in plugins
# FIXME: this should be a function in mod:`plugin`
for ep in pkg_resources.iter_entry_points(
'bitmessage.proxyconfig'):
self.comboBoxProxyType.addItem(ep.name)
try:
ep.load()
except Exception: # it should add only functional plugins
# many possible exceptions, which are don't matter
pass
else:
self.comboBoxProxyType.addItem(ep.name)
self.lineEditMaxOutboundConnections.setValidator(
QtGui.QIntValidator(0, 8, self.lineEditMaxOutboundConnections))