Exemple #1
0
 def fill_in_proxy_settings(self):
     self.filling_in = True
     self.check_disable_proxy(self.network.proxy is not None)
     self.proxy_cb.setChecked(self.network.proxy is not None)
     proxy = self.network.proxy or SVProxy('localhost:9050', 'SOCKS5', None)
     self.proxy_mode.setCurrentText(proxy.kind())
     self.proxy_host.setText(proxy.host())
     self.proxy_port.setText(str(proxy.port()))
     self.proxy_username.setText(proxy.username())
     self.proxy_password.setText(proxy.password())
     self.filling_in = False
 def set_proxy(self):
     if self.filling_in:
         return
     proxy = None
     if self.proxy_cb.isChecked():
         try:
             address = (self.proxy_host.text(), int(self.proxy_port.text()))
             if self.proxy_username.text():
                 auth = SVUserAuth(self.proxy_username.text(),
                                   self.proxy_password.text())
             else:
                 auth = None
             proxy = SVProxy(address, self.proxy_mode.currentText(), auth)
         except Exception:
             pass
     if not proxy:
         self.tor_cb.setChecked(False)
     self.network.set_proxy(proxy)