def do_exec(self):

        if not self.exec_():
            return

        host = str(self.server_host.text())
        port = str(self.server_port.text())
        protocol = 's' if self.ssl_cb.isChecked() else 't'
        # sanitize
        try:
            deserialize_server(serialize_server(host, port, protocol))
        except:
            return

        if self.proxy_mode.currentText() != 'NONE':
            proxy = { 'mode':str(self.proxy_mode.currentText()).lower(),
                      'host':str(self.proxy_host.text()),
                      'port':str(self.proxy_port.text()) }
        else:
            proxy = None

        auto_connect = self.autoconnect_cb.isChecked()

        self.network.set_parameters(host, port, protocol, proxy, auto_connect)
        return True
Beispiel #2
0
 def follow_server(self, server):
     self.network.switch_to_interface(server)
     host, port, protocol, proxy, auto_connect = self.network.get_parameters(
     )
     host, port, protocol = deserialize_server(server)
     self.network.set_parameters(host, port, protocol, proxy, auto_connect)
     self.update()
    def accept(self):
        host = str(self.server_host.text())
        port = str(self.server_port.text())
        protocol = 's' if self.ssl_cb.isChecked() else 't'
        # sanitize
        try:
            deserialize_server(serialize_server(host, port, protocol))
        except:
            return

        if self.proxy_mode.currentText() != 'NONE':
            proxy = {
                'mode': str(self.proxy_mode.currentText()).lower(),
                'host': str(self.proxy_host.text()),
                'port': str(self.proxy_port.text())
            }
        else:
            proxy = None

        auto_connect = self.autoconnect_cb.isChecked()

        self.network.set_parameters(host, port, protocol, proxy, auto_connect)
Beispiel #4
0
 def set_server(self, s):
     host, port, protocol = deserialize_server(s)
     self.parent.server_host.setText(host)
     self.parent.server_port.setText(port)
     self.parent.set_server()