Пример #1
0
 def setValues(self):
     conn = self.conn
     self.device_items = []
     if conn:
         self.name.edit.setText(unicode(conn.name))
         if conn.devname:
             self.device.setText(conn.devname)
         self.device_uid = self.conn.devid
         if "remote" in self.link.modes:
             if conn.remote:
                 self.remote.setText(conn.remote)
             if conn.apmac:
                 self.apmac = conn.apmac
             else:
                 self.apmac = ''
         if "net" in self.link.modes:
             if conn.net_mode == "auto":
                 self.r1.setChecked(True)
             else:
                 self.r2.setChecked(True)
                 if conn.net_addr:
                     self.address.setText(conn.net_addr)
                 if conn.net_mask:
                     self.netmask.setText(conn.net_mask)
                 if conn.net_gate:
                     self.gateway.setText(conn.net_gate)
             if conn.dns_mode == "default":
                 self.dns1.setChecked(True)
             elif conn.dns_mode == "auto":
                 self.dns2.setChecked(True)
             else:
                 self.dns3.setChecked(True)
                 if conn.dns_server:
                     self.dns_text.setText(conn.dns_server)
         if "auth" in self.link.modes:
             self.auth_mode.setCurrentItem(0)
             if conn.auth_mode != "none":
                 i = 1
                 for mode in self.link.auth_modes:
                     if mode.id == conn.auth_mode:
                         if mode.type == "pass":
                             self.auth_passphrase.setText(unicode(conn.auth_pass))
                         elif mode.type == "login":
                             self.auth_user.setText(unicode(conn.auth_user))
                             self.auth_password.setText(unicode(conn.auth_pass))
                         self.auth_mode.setCurrentItem(i)
                         self.slotAuthToggle(i)
                         break
                     i += 1
     else:
         self.name.edit.setText(unicode(comlink.uniqueName()))
         self.device_uid = self.new_conn[0]
         self.device.setText(self.new_conn[1])
         if "net" in self.link.modes:
             self.r1.setChecked(True)
             self.dns1.setChecked(True)
     if "net" in self.link.modes:
         self.slotFields()
Пример #2
0
 def setValues(self):
     conn = self.conn
     self.device_items = []
     if conn:
         self.name.edit.setText(unicode(conn.name))
         if conn.devname:
             self.device.setText(conn.devname)
         self.device_uid = self.conn.devid
         if "devicemode" in self.link.modes:
             if conn.device_mode == "ad-hoc":
                 self.selected_device_mode.setCurrentText("Ad-Hoc")
             elif conn.device_mode == "managed":
                 self.selected_device_mode.setCurrentText("Managed")
             else:
                 self.selected_device_mode.setCurrentText("Select Mode")
         if "remote" in self.link.modes:
             if conn.remote:
                 self.remote.setText(conn.remote)
             if conn.apmac:
                 self.apmac = conn.apmac
             else:
                 self.apmac = ''
         if "net" in self.link.modes:
             if conn.net_mode == "auto":
                 self.r1.setChecked(True)
             else:
                 self.r2.setChecked(True)
                 if conn.net_addr:
                     self.address.setText(conn.net_addr)
                 if conn.net_mask:
                     self.netmask.setCurrentText(conn.net_mask)
                 if conn.net_gate:
                     self.gateway.setText(conn.net_gate)
             if conn.dns_mode == "default":
                 self.dns1.setChecked(True)
             elif conn.dns_mode == "auto":
                 self.dns2.setChecked(True)
             else:
                 self.dns3.setChecked(True)
                 if conn.dns_server:
                     self.dns_text.setText(conn.dns_server)
         if "auth" in self.link.modes:
             self.auth_mode.setCurrentItem(0)
             if conn.auth_mode != "none":
                 i = 1
                 for mode in self.link.auth_modes:
                     if mode.id == conn.auth_mode:
                         if mode.type == "pass":
                             self.auth_passphrase.setText(unicode(conn.auth_pass))
                         elif mode.type == "login":
                             self.auth_user.setText(unicode(conn.auth_user))
                             self.auth_password.setText(unicode(conn.auth_pass))
                         self.auth_mode.setCurrentItem(i)
                         self.slotAuthToggle(i)
                         break
                     i += 1
     else:
         self.name.edit.setText(unicode(comlink.uniqueName()))
         self.device_uid = self.new_conn[0]
         self.device.setText(self.new_conn[1])
         if "net" in self.link.modes:
             self.r1.setChecked(True)
             self.dns1.setChecked(True)
     if "net" in self.link.modes:
         self.slotFields()
Пример #3
0
    def setValues(self):
        conn = self.conn
        self.device_items = []
        if conn:
            self.name.edit.setText(unicode(conn.name))
            if conn.devname:
                self.device.setText(conn.devname)
            self.device_uid = self.conn.devid
            if "devicemode" in self.link.modes:
                self.selected_device_mode.setCurrentText(conn.device_mode)
            if "remote" in self.link.modes:
                if conn.remote:
                    self.remote.setText(conn.remote)
                if conn.apmac:
                    self.apmac = conn.apmac
                else:
                    self.apmac = ''
            if "net" in self.link.modes:
                if conn.net_mode == "auto":
                    self.r1.setChecked(True)
                    if conn.net_addr:
                        self.auto_addr.setChecked(True)
                        self.address.setText(conn.net_addr)
                        if conn.net_mask:
                            self.netmask.setCurrentText(conn.net_mask)
                    if conn.net_gate:
                        self.auto_gate.setChecked(True)
                        self.gateway.setText(conn.net_gate)
                else:
                    self.r2.setChecked(True)
                    if conn.net_addr:
                        self.address.setText(conn.net_addr)
                    if conn.net_mask:
                        self.netmask.setCurrentText(conn.net_mask)
                    if conn.net_gate:
                        self.gateway.setText(conn.net_gate)
                if conn.dns_mode == "default":
                    self.dns1.setChecked(True)
                elif conn.dns_mode == "auto":
                    self.dns2.setChecked(True)
                else:
                    self.dns3.setChecked(True)
                    if conn.dns_server:
                        self.dns_text.setText(conn.dns_server)
            if "auth" in self.link.modes:
                self.security_mode_combo.setCurrentItem(0)
                auth_mode, auth_parameters = comlink.getAuth(self.link.script, conn.name)
                if auth_mode != "none":
                    i = 1
                    for mode in self.link.auth_modes:
                        if mode.id == auth_mode:
                            if len(mode.paramters) == 1:
                                self.auth_passphrase_line.setText(unicode(auth_parameters.get("password", "")))
                                self.security_mode_combo.setCurrentItem(i)
                                self.slotSecurityToggle(i)
                            if len(mode.paramters) == 2:
                                self.auth_user_line.setText(unicode(auth_parameters.get("username", "")))
                                self.auth_passphrase_line.setText(unicode(auth_parameters.get("password", "")))
                                self.security_mode_combo.setCurrentItem(i)
                                self.slotSecurityToggle(i)
                            elif len(mode.paramters) > 2:
                                pass
                                """
                                if mode.id == conn.auth_mode:
                                    self.security_mode_combo.setCurrentItem(i)
                                    self.slotSecurityToggle(i)

                                self.auth_client_cert = conn.auth_client_cert
                                self.auth_ca_cert = conn.auth_ca_cert
                                self.auth_private_key = conn.auth_private_key
                                self.auth_user_line.setText(unicode(conn.auth_user))
                                self.auth_passphrase_line.setText(unicode(conn.auth_pass))
                                self.auth_anon_id_line.setText(unicode(conn.auth_anon))
                                self.auth_ca_cert_but.setText(unicode(conn.auth_ca_cert).split('/')[-1])
                                self.auth_client_cert_but.setText(unicode(conn.auth_client_cert).split('/')[-1])
                                self.auth_private_key_but.setText(unicode(conn.auth_private_key).split('/')[-1])
                                self.auth_private_key_pass_line.setText(unicode(conn.auth_private_key_pass))
                                for j in self.auth_dict:
                                    if conn.auth_auth == j:
                                        self.auth_mode_combo.setCurrentItem(self.auth_dict.keys().index(j))
                                        self.slotAuthToggle(self.auth_dict.keys().index(j))
                                        if j != "TLS":
                                            self.auth_inner_combo.setCurrentItem(self.auth_dict[j].index(conn.auth_inner))
                                """
                            break
                        i += 1
        else:
            self.name.edit.setText(unicode(comlink.uniqueName()))
            self.device_uid = self.new_conn[0]
            self.device.setText(self.new_conn[1])
            if "net" in self.link.modes:
                self.r1.setChecked(True)
                self.dns2.setChecked(True)
        if "net" in self.link.modes:
            self.slotFields()
Пример #4
0
    def setValues(self):
        conn = self.conn
        self.device_items = []

        if conn:
            self.name.edit.setText(unicode(conn.name))
            if conn.devname:
                self.device.setText(conn.devname)
            self.device_uid = self.conn.devid

            if "remote" in self.link.modes:
                if conn.remote:
                    self.remote.setText(conn.remote)
                if conn.apmac:
                    self.apmac = conn.apmac
                else:
                    self.apmac = ''
            if "net" in self.link.modes:
                if conn.net_mode == "auto":
                    self.r1.setChecked(True)
                    if conn.net_addr:
                        self.auto_addr.setChecked(True)
                        self.address.setText(conn.net_addr)
                        if conn.net_mask:
                            self.netmask.setCurrentText(conn.net_mask)
                    if conn.net_gate:
                        self.auto_gate.setChecked(True)
                        self.gateway.setText(conn.net_gate)
                else:
                    self.r2.setChecked(True)
                    if conn.net_addr:
                        self.address.setText(conn.net_addr)
                    if conn.net_mask:
                        self.netmask.setCurrentText(conn.net_mask)
                    if conn.net_gate:
                        self.gateway.setText(conn.net_gate)
                if conn.dns_mode == "default":
                    self.dns1.setChecked(True)
                elif conn.dns_mode == "auto":
                    self.dns2.setChecked(True)
                else:
                    self.dns3.setChecked(True)
                    if conn.dns_server:
                        self.dns_text.setText(conn.dns_server)
            if "auth" in self.link.modes:
                self.security_mode_combo.setCurrentItem(0)
                if conn.auth_mode != "none":
                    i = 1
                    for mode in self.link.auth_modes:
                        if mode.id == conn.auth_mode:
                            if mode.type == "pass":
                                self.auth_passphrase_line.setText(
                                    unicode(conn.auth_pass))
                                self.security_mode_combo.setCurrentItem(i)
                                self.slotSecurityToggle(i)
                            elif mode.type == "login":
                                if mode.id == conn.auth_mode:
                                    self.security_mode_combo.setCurrentItem(i)
                                    self.slotSecurityToggle(i)

                                self.auth_client_cert = conn.auth_client_cert
                                self.auth_ca_cert = conn.auth_ca_cert
                                self.auth_private_key = conn.auth_private_key
                                self.auth_user_line.setText(
                                    unicode(conn.auth_user))
                                self.auth_passphrase_line.setText(
                                    unicode(conn.auth_pass))
                                self.auth_anon_id_line.setText(
                                    unicode(conn.auth_anon))
                                self.auth_ca_cert_but.setText(
                                    unicode(conn.auth_ca_cert).split('/')[-1])
                                self.auth_client_cert_but.setText(
                                    unicode(
                                        conn.auth_client_cert).split('/')[-1])
                                self.auth_private_key_but.setText(
                                    unicode(
                                        conn.auth_private_key).split('/')[-1])
                                self.auth_private_key_pass_line.setText(
                                    unicode(conn.auth_private_key_pass))
                                for j in self.auth_dict:
                                    if conn.auth_auth == j:
                                        self.auth_mode_combo.setCurrentItem(
                                            self.auth_dict.keys().index(j))
                                        self.slotAuthToggle(
                                            self.auth_dict.keys().index(j))
                                        if j != "TLS":
                                            self.auth_inner_combo.setCurrentItem(
                                                self.auth_dict[j].index(
                                                    conn.auth_inner))
                            break
                        i += 1
        else:
            self.name.edit.setText(unicode(comlink.uniqueName()))
            self.device_uid = self.new_conn[0]
            self.device.setText(self.new_conn[1])
            if "net" in self.link.modes:
                self.r1.setChecked(True)
                self.dns1.setChecked(True)
        if "net" in self.link.modes:
            self.slotFields()
Пример #5
0
    def setValues(self):
        conn = self.conn
        self.device_items = []
        if conn:
            self.name.edit.setText(unicode(conn.name))
            if conn.devname:
                self.device.setText(conn.devname)
            self.device_uid = self.conn.devid
            if "vpn" in self.link.modes:
                if conn.vpn_domain:
                    self.domain.setText(conn.vpn_domain)
                if conn.vpn_port:
                    self.port.setText(conn.vpn_port)
                if conn.vpn_protocol:
                    if conn.vpn_protocol == "udp":
                        self.protocol.setCurrentItem(1)
                    else:
                        self.protocol.setCurrentItem(0)

                if conn.vpn_chipher:
                    self.chipher.setCurrentText(conn.vpn_chipher)
                if conn.vpn_ca:
                    self.ca = conn.vpn_ca
                    self.lab2.setText(self.ca)
                if conn.vpn_cert:
                    self.cert = conn.vpn_cert
                    self.lab3.setText(self.cert)
                if conn.vpn_key:
                    self.key = conn.vpn_key
                    self.lab4.setText(self.cert)
            if "remote" in self.link.modes:
                if conn.remote:
                    self.remote.setText(conn.remote)
                if conn.apmac:
                    self.apmac = conn.apmac
                else:
                    self.apmac = ''
            if "net" in self.link.modes:
                if conn.net_mode == "auto":
                    self.r1.setChecked(True)
                else:
                    self.r2.setChecked(True)
                    if conn.net_addr:
                        self.address.setText(conn.net_addr)
                    if conn.net_mask:
                        self.netmask.setText(conn.net_mask)
                    if conn.net_gate:
                        self.gateway.setText(conn.net_gate)
                if conn.dns_mode == "default":
                    self.dns1.setChecked(True)
                elif conn.dns_mode == "auto":
                    self.dns2.setChecked(True)
                else:
                    self.dns3.setChecked(True)
                    if conn.dns_server:
                        self.dns_text.setText(conn.dns_server)
            if "auth" in self.link.modes:
                self.auth_mode.setCurrentItem(0)
                if conn.auth_mode != "none":
                    i = 1
                    for mode in self.link.auth_modes:
                        if mode.id == conn.auth_mode:
                            if mode.type == "pass":
                                self.auth_passphrase.setText(
                                    unicode(conn.auth_pass))
                            elif mode.type == "login":
                                self.auth_user.setText(unicode(conn.auth_user))
                                self.auth_password.setText(
                                    unicode(conn.auth_pass))
                            self.auth_mode.setCurrentItem(i)
                            self.slotAuthToggle(i)
                            break
                        i += 1
        else:
            self.name.edit.setText(unicode(comlink.uniqueName()))
            self.device_uid = self.new_conn[0]
            self.device.setText(self.new_conn[1])
            if "net" in self.link.modes:
                self.r1.setChecked(True)
                self.dns1.setChecked(True)
        if "net" in self.link.modes:
            self.slotFields()