コード例 #1
0
 def table_set_sensitive(self, table, sensitive):
     items = table.shared
     for item in items:
         if item[1] != None:
             map(lambda i: i.set_sensitive(sensitive), item)
         else:
             log.debug("radio button", item)
コード例 #2
0
 def wired_device_deactive(self, widget, new_state, old_state, reason):
     log.debug(new_state, old_state, reason, widget)
     if reason == 36:
         print "in fact there's device removed"
         ########################
         net_manager.init_devices()
         self.wired_devices = net_manager.wired_devices
         self._init_signals()
         self.tree.delete_all_items()
         item_list = self.get_list()
         if item_list:
             item_list[-1].is_last = True
             self.tree.add_items(item_list, 0, True)
             self.tree.set_size_request(-1,
                                        len(self.tree.visible_items) * 30)
     for i, d in enumerate(self.wired_devices):
         if d.get_state() == 100:
             self.tree.visible_items[i].set_net_state(2)
         elif d.get_state() <= 30:
             self.tree.visible_items[i].set_net_state(0)
     if not any([
             d.get_state() == 100
             for d in net_manager.device_manager.wired_devices
     ]):
         self.wire.set_active(False)
コード例 #3
0
    def save_changes(self, widget):

        log.debug(self.manual_radio.get_active())
        #self.proxysetting.set_proxy_mode("none")
        if self.manual_radio.get_active():
            http_host = self.http_entry.get_text()
            http_port = self.http_spin.get_value()
            https_host = self.https_entry.get_text()
            https_port = self.https_spin.get_value()
            ftp_host = self.ftp_entry.get_text()
            ftp_port = self.ftp_spin.get_value()
            socks_host = self.socks_entry.get_text()
            socks_port = self.socks_spin.get_value()

            mode = "manual"
            self.proxysetting.set_proxy_mode(mode)
            self.proxysetting.set_http_host(http_host)
            self.proxysetting.set_http_port(http_port)
            self.proxysetting.set_https_host(https_host)
            self.proxysetting.set_https_port(https_port)
            self.proxysetting.set_ftp_host(ftp_host)
            self.proxysetting.set_ftp_port(ftp_port)

            self.proxysetting.set_socks_host(socks_host)
            self.proxysetting.set_socks_port(socks_port)

        else:
            conf_url = self.conf_entry.get_text()
            self.proxysetting.set_proxy_mode("auto")
            self.proxysetting.set_proxy_autoconfig_url(conf_url)

        Dispatcher.to_main_page()
コード例 #4
0
    def wireless_activate_start(self, widget, new_state, old_state, reason):
        log.debug(new_state, old_state, reason)
        if widget not in net_manager.device_manager.wireless_devices:
            return

        #if old_state == 120 or self.dialog_toggled_flag:
        #wifi = nm_module.cache.get_spec_object(widget.object_path)
        #wifi.device_wifi_disconnect()
        #return
        #try:
        #items = self.get_item_by_connection(widget.get_real_active_connection())
        #self.try_hardly_item = items[0]
        #log.debug(self.try_hardly_item)
        #except:
        #pass

        if not self.wireless.get_active():
            self.wireless.set_active(True)

        if self._get_active_item():
            for item in self._get_active_item():
                tray_log.debug(item, "set net state 0")
                item.set_net_state(0)

        if self.selected_item:
            self.selected_item.set_net_state(1)
        else:
            index = self.get_actives(self.ap_list)
            if index and self.tree.visible_items:
                for i, s in index:
                    self.tree.visible_items[i].set_net_state(1)
コード例 #5
0
    def wireless_device_deactive(self, widget, new_state, old_state, reason):
        log.info(widget, new_state, old_state, reason)
        if widget not in net_manager.device_manager.wireless_devices:
            return
        #self.wireless.set_sensitive(True)
        if reason == 36:
            log.info("some device removed")
            net_manager.init_devices()
            self.remove_switcher()
            return
        if old_state == 120:
            if self.selected_item:
                log.debug("try disconnect")
                wifi = nm_module.cache.get_spec_object(widget.object_path)
                wifi.device_wifi_disconnect()

        if old_state == 50:
            if self._get_active_item():
                for item in self._get_active_item():
                    item.set_net_state(0)
            return
        if reason == 39:
            if any([
                    d.get_state() == 100
                    for d in net_manager.device_manager.wireless_devices
            ]):
                return
            else:

                self.wireless.set_active(False)
                return

        if self._get_active_item():
            for item in self._get_active_item():
                item.set_net_state(0)
コード例 #6
0
    def __init__(self,
                 connection,
                 set_button,
                 need_ssid=False,
                 settings_obj=None):
        gtk.Alignment.__init__(self, 0, 0, 0, 0)
        self.set_padding(35, 0, 20, 0)
        self.connection = connection
        self.set_button = set_button
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        if isinstance(connection, NMRemoteConnection):
            net_manager.set_primary_wireless(settings_obj.ap, connection)

        self.main_box = gtk.VBox()
        self.tab_name = ""
        basic = SettingSection(_("Basic"))
        log.debug("start section")

        if need_ssid:
            security = Security(connection,
                                set_button,
                                need_ssid,
                                settings_obj=settings_obj)
        else:
            security = Security(connection,
                                set_button,
                                settings_obj=settings_obj)
        security.button.connect("clicked", self.show_more_options)
        basic.load([security])
        self.main_box.pack_start(basic, False, False)

        self.add(self.main_box)
コード例 #7
0
    def set_ip_address(self, widget, content, index):
        # if you really want no gateway, just put a 0.0.0.0
        names = ["ip4", "netmask", "gw"]
        verbose_name = [_("IPv4"), _("Subnet Mask"), _("Gateway")]
        self.ip[index] = content

        if self.check_valid(names[index]):
            setattr(self, names[index] + "_flag", True)
            Dispatcher.set_tip(_("Valid %s address.") % verbose_name[index])
        else:
            setattr(self, names[index] + "_flag", False)
            Dispatcher.set_tip(_("Invalid %s address.") % verbose_name[index])

        ############
        # 检查ip、子网掩码、网关是否正确
        log.debug(widget, content, index)
        is_valid = True
        for n in names:
            if not getattr(self, "%s_flag" % n):
                is_valid = False
                break
        if is_valid:
            if self.setting.addresses:
                self.setting.clear_addresses()
            self.setting.add_address(self.ip)

        if self.settings_obj:
            self.settings_obj.ipv4_ip_is_valid = is_valid
            self.settings_obj.set_button("save", is_valid)
コード例 #8
0
    def wireless_device_deactive(self, widget, new_state, old_state, reason):
        log.info(widget, new_state, old_state, reason)
        if widget not in net_manager.device_manager.wireless_devices:
            return
        #self.wireless.set_sensitive(True)
        if reason == 36:
            log.info("some device removed")
            net_manager.init_devices()
            self.remove_switcher() 
            return 
        if old_state == 120:
            if self.selected_item: 
                log.debug("try disconnect")
                wifi = nm_module.cache.get_spec_object(widget.object_path)
                wifi.device_wifi_disconnect()

        if old_state == 50:
            if self._get_active_item():
                for item in self._get_active_item():
                    item.set_net_state(0)
            return
        if reason == 39:
            if any([d.get_state() == 100 for d in net_manager.device_manager.wireless_devices]):
                return
            else:

                self.wireless.set_active(False)
                return

        if self._get_active_item():
            for item in self._get_active_item():
                item.set_net_state(0)
コード例 #9
0
    def wireless_activate_start(self, widget, new_state, old_state, reason):
        log.debug(new_state, old_state, reason)
        if widget not in net_manager.device_manager.wireless_devices:
            return

        #if old_state == 120 or self.dialog_toggled_flag:
            #wifi = nm_module.cache.get_spec_object(widget.object_path)
            #wifi.device_wifi_disconnect()
            #return
        #try:
            #items = self.get_item_by_connection(widget.get_real_active_connection())
            #self.try_hardly_item = items[0]
            #log.debug(self.try_hardly_item)
        #except:
            #pass

        if not self.wireless.get_active():
            self.wireless.set_active(True)

        if self._get_active_item():
            for item in self._get_active_item():
                tray_log.debug(item, "set net state 0")
                item.set_net_state(0)
        
        if self.selected_item:
            self.selected_item.set_net_state(1)
        else:
            index = self.get_actives(self.ap_list)
            if index and self.tree.visible_items:
                for i,s in index:
                    self.tree.visible_items[i].set_net_state(1)
コード例 #10
0
    def set_ip_address(self, widget, content, index):
        # if you really want no gateway, just put a 0.0.0.0
        names = ["ip4", "netmask", "gw"]
        verbose_name = [_("IPv4"), _("Subnet Mask"), _("Gateway")]
        self.ip[index] = content

        if self.check_valid(names[index]):
            setattr(self, names[index] + "_flag", True)
            Dispatcher.set_tip(_("Valid %s address.")%verbose_name[index])
        else:
            setattr(self, names[index] + "_flag", False)
            Dispatcher.set_tip(_("Invalid %s address.")%verbose_name[index])

        ############
        # 检查ip、子网掩码、网关是否正确
        log.debug(widget, content, index)
        is_valid = True
        for n in names:
            if not getattr(self, "%s_flag"%n):
                is_valid = False
                break
        if is_valid:
            if self.setting.addresses:
                self.setting.clear_addresses()
            self.setting.add_address(self.ip)
        
        if self.settings_obj:
            self.settings_obj.ipv4_ip_is_valid = is_valid
            self.settings_obj.set_button("save", is_valid)
コード例 #11
0
 def table_set_sensitive(self, table, sensitive):
     items = table.shared
     for item in items:
         if item[1] != None:
             map(lambda i: i.set_sensitive(sensitive), item)
         else:
             log.debug("radio button", item)
コード例 #12
0
    def save_changes(self, widget):

        log.debug(self.manual_radio.get_active())
        #self.proxysetting.set_proxy_mode("none")
        if self.manual_radio.get_active():
            http_host = self.http_entry.get_text()
            http_port = self.http_spin.get_value()
            https_host = self.https_entry.get_text()
            https_port = self.https_spin.get_value()
            ftp_host = self.ftp_entry.get_text()
            ftp_port = self.ftp_spin.get_value()
            socks_host = self.socks_entry.get_text()
            socks_port = self.socks_spin.get_value()

            mode = "manual"
            self.proxysetting.set_proxy_mode(mode)
            self.proxysetting.set_http_host(http_host)
            self.proxysetting.set_http_port(http_port)
            self.proxysetting.set_https_host(https_host)
            self.proxysetting.set_https_port(https_port)
            self.proxysetting.set_ftp_host(ftp_host)
            self.proxysetting.set_ftp_port(ftp_port)

            self.proxysetting.set_socks_host(socks_host)
            self.proxysetting.set_socks_port(socks_port)

        else:
            conf_url = self.conf_entry.get_text()
            self.proxysetting.set_proxy_mode("auto")
            self.proxysetting.set_proxy_autoconfig_url(conf_url)

        Dispatcher.to_main_page()
コード例 #13
0
    def __init__(self, connection, set_button, need_ssid=False, settings_obj=None):
        gtk.Alignment.__init__(self, 0, 0 ,0, 0)
        self.set_padding(35, 0, 20, 0)
        self.connection = connection
        self.set_button = set_button
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        if isinstance(connection, NMRemoteConnection):
            net_manager.set_primary_wireless(settings_obj.ap, connection)

        self.main_box = gtk.VBox()
        self.tab_name = ""
        basic = SettingSection(_("Basic"))
        log.debug("start section")

        if need_ssid:
            security = Security(connection, set_button, need_ssid, settings_obj=settings_obj)
        else:
            security = Security(connection, set_button, settings_obj=settings_obj)
        security.button.connect("clicked", self.show_more_options)
        basic.load([security])
        self.main_box.pack_start(basic, False, False)

        self.add(self.main_box)
コード例 #14
0
 def wired_activate_failed(self, widget, new_state, old_state, reason):
     #pass
     log.debug(reason)
     index = self.wired_devices.index(widget)
     if self.tree.visible_items != []:
         print "device activate failed,set state 0"
         self.tree.visible_items[index].set_net_state(0)
         self.tree.queue_draw()
コード例 #15
0
    def wired_device_active(self, widget, new_state, old_state, reason):

        index = net_manager.device_manager.wired_devices.index(widget)
        if self.tree.visible_items != []:
            log.debug()
            self.tree.visible_items[index].set_net_state(2)
            self.tree.queue_draw()
        self.wire.set_active(True)
コード例 #16
0
 def wired_activate_failed(self, widget, new_state, old_state, reason):
     #pass
     log.debug(reason)
     index = self.wired_devices.index(widget)
     if self.tree.visible_items != []:
         print "device activate failed,set state 0"
         self.tree.visible_items[index].set_net_state(0)
         self.tree.queue_draw()
コード例 #17
0
 def __remove_all_items(self):
     if not self.get_children():
         log.debug("not items", self)
         return
     for c in self.get_children():
         log.debug(c)
         container_remove_all(c)
     container_remove_all(self)
コード例 #18
0
    def wired_device_active(self, widget, new_state, old_state, reason):

        index = net_manager.device_manager.wired_devices.index(widget)
        if self.tree.visible_items != []:
            log.debug()
            self.tree.visible_items[index].set_net_state(2)
            self.tree.queue_draw()
        self.wire.set_active(True)
コード例 #19
0
 def __remove_all_items(self):
     if not self.get_children():
         log.debug("not items", self)
         return
     for c in self.get_children():
         log.debug(c)
         container_remove_all(c)
     container_remove_all(self)
コード例 #20
0
    def vpn_disconnected(self, name, event, data):
        log.debug(data)
        if self.this_setting == None:
            map(lambda i: i.set_net_state(0), self.tree.visible_items)
            return

        items = filter(lambda p: p.connection.object_path == self.this_setting, self.tree.visible_items)
        map(lambda i: i.set_net_state(0), items)
        self.this_setting = None
        self.vpn_path = None
コード例 #21
0
 def toggle_on_after(self):
     log.debug()
     indexs = self.get_actives(self.ap_list)
     if indexs:
         map(lambda (i, s): self.tree.visible_items[i].set_net_state(s), indexs)
     else:
         for d in self.wireless_devices:
             log.debug("try auto start")
             wifi = nm_module.cache.get_spec_object(d.object_path)
             wifi.auto_connect()
コード例 #22
0
 def toggle_on_after(self):
     log.debug()
     indexs = self.get_actives(self.ap_list)
     if indexs:
         map(lambda (i, s): self.tree.visible_items[i].set_net_state(s),
             indexs)
     else:
         for d in self.wireless_devices:
             log.debug("try auto start")
             wifi = nm_module.cache.get_spec_object(d.object_path)
             wifi.auto_connect()
コード例 #23
0
    def vpn_disconnected(self, name, event, data):
        log.debug(data)
        if self.this_setting == None:
            map(lambda i: i.set_net_state(0), self.tree.visible_items)
            return

        items = filter(lambda p: p.connection.object_path == self.this_setting,
                       self.tree.visible_items)
        map(lambda i: i.set_net_state(0), items)
        self.this_setting = None
        self.vpn_path = None
コード例 #24
0
 def on_vpn_connecting(self, name, event, data):
     if not self.vpn.get_active():
         self.vpn.set_active(True)
         return
     log.debug("vpn start connect", data)
     self.vpn_path = data
     try:
         self.this_setting = nm_module.cache.getobject(data).get_connection().object_path
     except Exception, e:
         log.error(e)
         self.this_setting = None
コード例 #25
0
 def single_click(self, column, x, y):
     if column == 0 and self.network_state > 0:
         log.debug(self.device)
         net_manager.disactive_wired_device([self.device])
         #self.device.nm_device_disconnect()
     if column == 2:
         from lan_config import WiredSetting
         Dispatcher.to_setting_page(WiredSetting(self.device, net_manager.get_primary_wire(self.device)), False)
     else:
         device_ethernet = nm_module.cache.get_spec_object(self.device.object_path)
         device_ethernet.auto_connect()
     self.redraw()
コード例 #26
0
 def on_vpn_connecting(self, name, event, data):
     if not self.vpn.get_active():
         self.vpn.set_active(True)
         return
     log.debug("vpn start connect", data)
     self.vpn_path = data
     try:
         self.this_setting = nm_module.cache.getobject(
             data).get_connection().object_path
     except Exception, e:
         log.error(e)
         self.this_setting = None
コード例 #27
0
 def single_click(self, column, x, y):
     if column == 0 and self.network_state > 0:
         log.debug(self.device)
         net_manager.disactive_wired_device([self.device])
         #self.device.nm_device_disconnect()
     if column == 2:
         from lan_config import WiredSetting
         Dispatcher.to_setting_page(
             WiredSetting(self.device,
                          net_manager.get_primary_wire(self.device)), False)
     else:
         device_ethernet = nm_module.cache.get_spec_object(
             self.device.object_path)
         device_ethernet.auto_connect()
     self.redraw()
コード例 #28
0
    def reset(self, connection):
        self.setting = connection.get_setting("ipv4")
        if "ipv4" not in connection.settings_dict.iterkeys():
            log.debug("ipv4 not in settings dict, will create one")
            self.setting.method = "auto"
            connection.settings_dict["ipv4"] = self.setting.prop_dict

        if self.setting.method == 'link-local':
            self.link_section.switch.set_active(True)
        else:
            if self.setting.method == "auto":
                self.ip_section.set_active(True)

            else:
                log.debug("get addresses", self.setting.addresses)
                self.ip_section.set_active(False)
                #self.set_group_sensitive("ip", True)
                if not self.setting.addresses == []:
                    #print self.setting.addresses[0][0]
                    addr, mask, gate = self.setting.addresses[0]
                    #self.ip_section.set_active(True)
                    self.addr_row[1].set_address(addr)
                    self.mask_row[1].set_address(mask)
                    self.gate_row[1].set_address(gate)
                    self.ip = self.setting.addresses[0]

        if self.setting.dns == []:
            self.dns_section.set_active(True)
        else:
            self.dns_section.set_active(False)
            if len(self.setting.dns) == 1:
                self.dns = self.setting.dns + [""]
            else:
                self.dns = self.setting.dns

            self.master_row[1].set_address(self.dns[0])

            if self.dns[1]:
                self.slave_row[1].set_address(self.dns[1])

        self.reset_table()
コード例 #29
0
    def reset(self, connection):
        self.setting = connection.get_setting("ipv4")       
        if "ipv4" not in connection.settings_dict.iterkeys():
            log.debug("ipv4 not in settings dict, will create one")
            self.setting.method = "auto"
            connection.settings_dict["ipv4"] = self.setting.prop_dict

        if self.setting.method == 'link-local':
            self.link_section.switch.set_active(True)
        else:
            if self.setting.method == "auto":
                self.ip_section.set_active(True)
                    
            else:
                log.debug("get addresses", self.setting.addresses)
                self.ip_section.set_active(False)
                #self.set_group_sensitive("ip", True)
                if not self.setting.addresses == []:
                    #print self.setting.addresses[0][0]
                    addr, mask, gate = self.setting.addresses[0]
                    #self.ip_section.set_active(True)
                    self.addr_row[1].set_address(addr)
                    self.mask_row[1].set_address(mask)
                    self.gate_row[1].set_address(gate)
                    self.ip = self.setting.addresses[0]

        if self.setting.dns == []:
            self.dns_section.set_active(True)
        else:
            self.dns_section.set_active(False)
            if len(self.setting.dns) == 1:
                self.dns = self.setting.dns + [""]
            else:
                self.dns = self.setting.dns

            self.master_row[1].set_address(self.dns[0])
            
            if self.dns[1]:
                self.slave_row[1].set_address(self.dns[1])

        self.reset_table()
コード例 #30
0
 def wired_device_deactive(self, widget, new_state, old_state, reason):
     log.debug(new_state, old_state, reason, widget)
     if reason == 36:
         print "in fact there's device removed"
     ########################
         net_manager.init_devices()
         self.wired_devices = net_manager.wired_devices
         self._init_signals()
         self.tree.delete_all_items()
         item_list = self.get_list()
         if item_list:
             item_list[-1].is_last = True
             self.tree.add_items(item_list, 0, True)
             self.tree.set_size_request(-1, len(self.tree.visible_items)*30)
     for i, d in enumerate(self.wired_devices):
         if d.get_state() == 100:
             self.tree.visible_items[i].set_net_state(2)
         elif d.get_state() <= 30:
             self.tree.visible_items[i].set_net_state(0)
     if not any([d.get_state() == 100 for d in net_manager.device_manager.wired_devices]):
         self.wire.set_active(False)
コード例 #31
0
    def save_settings(self, widget, content, types):
        #value = None
        if types:
            setattr(self.ethernet, types, content)
        if self.settings_obj is None:
            return
        
        # check mac address whether is valid
        if types == "mac_address":
            mac_address = content
            cloned_mac_address = self.clone_entry.get_address()
        elif types == "cloned_mac_address":
            mac_address = self.mac_entry.get_address()
            cloned_mac_address = content
        else:
            mac_address = self.mac_entry.get_address()
            cloned_mac_address = self.clone_entry.get_address()

        if (mac_address == ":::::") or \
                (mac_address == "") or \
                (TypeConvert.is_valid_mac_address(mac_address)):
            mac_address_is_valid = True
        else:
            mac_address_is_valid = False
        if (cloned_mac_address == ":::::") or \
                (cloned_mac_address == "") or \
                (TypeConvert.is_valid_mac_address(cloned_mac_address)):
            cloned_mac_address_is_valid = True
        else:
            cloned_mac_address_is_valid = False
        if mac_address_is_valid and cloned_mac_address_is_valid:
            self.settings_obj.mac_is_valid = True
        else:
            self.settings_obj.mac_is_valid = False

        # 统一调用shared_methods.Settings的set_button
        log.debug('set_button True')
        self.settings_obj.set_button("save", True)

        """
コード例 #32
0
    def reset(self, connection):
        self.setting = connection.get_setting("ipv6")

        if "ipv6" not in connection.settings_dict.iterkeys():
            log.debug("ipv6 not in settings dict, will create one")
            self.setting.method = "auto"
            connection.settings_dict["ipv6"] = self.setting.prop_dict

        #  FIXME: ipv6 method刚开始为None并且还会记住上次操作,应该每次开始时为auto。
        if self.setting.method == 'link-local':
            self.link_section.switch.set_active(True)
        else:
            if self.setting.method == "auto" or self.setting.method is None:
                self.ip_section.set_active(True)
                self.set_group_sensitive("ip", False)

            else:
                self.ip_section.set_active(False)
                self.set_group_sensitive("ip", True)
                if not self.setting.addresses == []:
                    addr, mask, gate = self.setting.addresses[0]

                    self.addr_row[1].set_text(addr)
                    self.mask_row[1].set_text(mask)
                    self.gate_row[1].set_text(gate)
                    self.ip = self.setting.addresses

        if self.setting.dns == []:
            self.dns_section.set_active(True)
            self.set_group_sensitive("dns", False)
        else:
            #self.manual_dns.set_active(True)
            self.set_group_sensitive("dns", True)
            self.master_row[1].set_text(self.setting.dns[0])
            self.dns = self.setting_dns + [""]
            if len(self.setting.dns) > 1:
                self.slave_row[1].set_text(self.setting.dns[1])
                self.dns = self.setting.dns

        self.reset_table()
コード例 #33
0
    def reset(self, connection):
        self.setting = connection.get_setting("ipv6")       

        if "ipv6" not in connection.settings_dict.iterkeys():
            log.debug("ipv6 not in settings dict, will create one")
            self.setting.method = "auto"
            connection.settings_dict["ipv6"] = self.setting.prop_dict
        
        #  FIXME: ipv6 method刚开始为None并且还会记住上次操作,应该每次开始时为auto。
        if self.setting.method == 'link-local':
            self.link_section.switch.set_active(True)
        else:
            if self.setting.method == "auto" or self.setting.method is None:
                self.ip_section.set_active(True)
                self.set_group_sensitive("ip", False)
                
            else:
                self.ip_section.set_active(False)
                self.set_group_sensitive("ip", True)
                if not self.setting.addresses == []:
                    addr, mask, gate = self.setting.addresses[0]

                    self.addr_row[1].set_text(addr)
                    self.mask_row[1].set_text(mask)
                    self.gate_row[1].set_text(gate)
                    self.ip = self.setting.addresses

        if self.setting.dns == []:
            self.dns_section.set_active(True)
            self.set_group_sensitive("dns", False)
        else:
            #self.manual_dns.set_active(True)
            self.set_group_sensitive("dns", True)
            self.master_row[1].set_text(self.setting.dns[0])
            self.dns = self.setting_dns +[""]
            if len(self.setting.dns) > 1:
                self.slave_row[1].set_text(self.setting.dns[1])
                self.dns = self.setting.dns

        self.reset_table()
コード例 #34
0
 def wireless_redraw(self, widget):
     log.debug()
     if self.wireless.get_active():
         self.wireless.set_active(True, emit=True)
         self.show_all()
コード例 #35
0
 def set_selected_item(self, widget, item, column, x, y):
     log.debug(item)
     self.selected_item = item
コード例 #36
0
 def wireless_redraw(self, widget):
     log.debug()
     if self.wireless.get_active():
         self.wireless.set_active(True, emit=True)
         self.show_all()
コード例 #37
0
 def use_default_setting(self):
     log.debug()
     self.bssid_entry.set_address("")
     self.mac_entry.set_address("")
     self.clone_entry.set_address("")
     self.mtu_spin.set_value(0)
コード例 #38
0
 def user_toggle_off_vpn_tray(self, name, event, data):
     log.debug("toggle off vpn from tray")
     self.vpn.set_active(False)
コード例 #39
0
 def get_list(self):
     self.connections =  nm_module.nm_remote_settings.get_pppoe_connections()
     log.debug(self.connections)
     return map(lambda c: DSLItem(c, None), self.connections)
コード例 #40
0
    def reset(self, security=True):
        ## Add security
        container_remove_all(self.table)
        if self.need_ssid:
            self.table.attach(self.ssid_label_align, 0, 1, 0, 1)
            self.table.attach(self.ssid_entry_align, 1, 4, 0, 1)
        
        self.table.resize(2, 4)
        self.table.attach(self.security_label_align, 0, 1, 1, 2)
        self.table.attach(self.security_combo_align, 1, 4, 1, 2)

        if not security:
            self.presave_index = self.security_combo.get_select_index()
            return 
        
        keys = [None, "none", "none","wpa-psk"]
        
        self.key_mgmt = self.setting.key_mgmt
        if self.key_mgmt == "none":
            key_type = self.setting.wep_key_type
            self.security_combo.set_select_index(key_type)
        else:
            self.security_combo.set_select_index(keys.index(self.key_mgmt))

        if not self.security_combo.get_current_item()[1] == None: 
            try:
                (setting_name, method) = self.connection.guess_secret_info() 
                secret = nm_module.secret_agent.agent_get_secrets(self.connection.object_path,
                                                        setting_name,
                                                        method)
                if secret == None:
                    secret = ''
                log.debug("get secret", setting_name, method, "secret")
            except Exception, e:
                log.error("get secret error", e)
                secret = ""

            if self.security_combo.get_current_item()[1] == "wpa-psk":
                self.table.resize(4, 4)
                self.table.attach(self.password_label_align, 0, 1, 2, 3)
                self.table.attach(self.password_entry_align, 1, 4, 2, 3)
                self.table.attach(self.show_key_check_align, 1, 4, 3, 4)
                
                self.password_entry.entry.set_text(secret)
                if secret:
                    #Dispatcher.set_button("save", True)
                    ###########
                    self.settings_obj.wlan_encry_is_valid = True
                    self.settings_obj.set_button("save", True)
                self.setting.psk = secret

            elif self.security_combo.get_current_item()[1] == "none":
                self.table.resize(6, 4)
                # Add Key
                self.table.attach(self.key_label_align, 0, 1, 2, 3)
                self.table.attach(self.key_entry_align, 1, 4, 2, 3)
                self.table.attach(self.show_key_check_align, 1, 4, 3, 4)
                # Add wep index
                self.table.attach(self.wep_index_label_align, 0, 1, 4, 5)
                self.table.attach(self.wep_index_spin_align, 1, 4, 4, 5)
                # Add Auth
                self.table.attach(self.auth_label_align, 0, 1, 5, 6)
                self.table.attach(self.auth_combo_align, 1, 4, 5, 6)

                # Retrieve wep properties
                try:
                    index = self.setting.wep_tx_keyidx
                    auth = self.setting.auth_alg
                    log.debug(auth, index)
                    self.auth_combo.set_select_index(["shared", "open"].index(auth))
                except Exception, e:
                    log.error(e)
                    index = 0
                    auth = "shared"
                # must convert long int to int 
                index = int(index)
                
                #init_key = True
                #if isinstance(self.connection, NMRemoteConnection):
                    #init_setting = self.connection.get_setting("802-11-wireless-security")
                    #if init_setting.wep_key_type != self.setting.wep_key_type:
                        #init_key = False

                #if init_key:
                self.key_entry.entry.set_text(secret)
                self.setting.set_wep_key(index, secret)
                self.wep_index_spin.set_value(index + 1)
                self.auth_combo.set_select_index(["shared", "open"].index(auth))
コード例 #41
0
 def get_list(self):
     self.connections = nm_module.nm_remote_settings.get_pppoe_connections()
     log.debug(self.connections)
     return map(lambda c: DSLItem(c, None), self.connections)
コード例 #42
0
 def wired_activate_start(self, widget, new_state, old_state, reason):
     index = self.wired_devices.index(widget)
     log.debug(index)
     if self.tree.visible_items != []:
         self.tree.visible_items[index].set_net_state(1)
         self.tree.queue_draw()
コード例 #43
0
 def set_tab_content(self, connection):
     log.debug("set tab content", connection)
     setting = self.setting_group.init_items(connection)
     self.hbox.add(setting)
     self.hbox.show_all()
     self.foot_box.set_lock(False)
コード例 #44
0
 def set_selected_item(self, widget, item, column, x, y):
     log.debug(item)
     self.selected_item = item
コード例 #45
0
    def reset(self, security=True):
        ## Add security
        container_remove_all(self.table)
        if self.need_ssid:
            self.table.attach(self.ssid_label_align, 0, 1, 0, 1)
            self.table.attach(self.ssid_entry_align, 1, 4, 0, 1)

        self.table.resize(2, 4)
        self.table.attach(self.security_label_align, 0, 1, 1, 2)
        self.table.attach(self.security_combo_align, 1, 4, 1, 2)

        if not security:
            self.presave_index = self.security_combo.get_select_index()
            return

        keys = [None, "none", "none", "wpa-psk"]

        self.key_mgmt = self.setting.key_mgmt
        if self.key_mgmt == "none":
            key_type = self.setting.wep_key_type
            self.security_combo.set_select_index(key_type)
        else:
            self.security_combo.set_select_index(keys.index(self.key_mgmt))

        if not self.security_combo.get_current_item()[1] == None:
            try:
                (setting_name, method) = self.connection.guess_secret_info()
                secret = nm_module.secret_agent.agent_get_secrets(
                    self.connection.object_path, setting_name, method)
                if secret == None:
                    secret = ''
                log.debug("get secret", setting_name, method, "secret")
            except Exception, e:
                log.error("get secret error", e)
                secret = ""

            if self.security_combo.get_current_item()[1] == "wpa-psk":
                self.table.resize(4, 4)
                self.table.attach(self.password_label_align, 0, 1, 2, 3)
                self.table.attach(self.password_entry_align, 1, 4, 2, 3)
                self.table.attach(self.show_key_check_align, 1, 4, 3, 4)

                self.password_entry.entry.set_text(secret)
                if secret:
                    #Dispatcher.set_button("save", True)
                    ###########
                    self.settings_obj.wlan_encry_is_valid = True
                    self.settings_obj.set_button("save", True)
                self.setting.psk = secret

            elif self.security_combo.get_current_item()[1] == "none":
                self.table.resize(6, 4)
                # Add Key
                self.table.attach(self.key_label_align, 0, 1, 2, 3)
                self.table.attach(self.key_entry_align, 1, 4, 2, 3)
                self.table.attach(self.show_key_check_align, 1, 4, 3, 4)
                # Add wep index
                self.table.attach(self.wep_index_label_align, 0, 1, 4, 5)
                self.table.attach(self.wep_index_spin_align, 1, 4, 4, 5)
                # Add Auth
                self.table.attach(self.auth_label_align, 0, 1, 5, 6)
                self.table.attach(self.auth_combo_align, 1, 4, 5, 6)

                # Retrieve wep properties
                try:
                    index = self.setting.wep_tx_keyidx
                    auth = self.setting.auth_alg
                    log.debug(auth, index)
                    self.auth_combo.set_select_index(["shared",
                                                      "open"].index(auth))
                except Exception, e:
                    log.error(e)
                    index = 0
                    auth = "shared"
                # must convert long int to int
                index = int(index)

                #init_key = True
                #if isinstance(self.connection, NMRemoteConnection):
                #init_setting = self.connection.get_setting("802-11-wireless-security")
                #if init_setting.wep_key_type != self.setting.wep_key_type:
                #init_key = False

                #if init_key:
                self.key_entry.entry.set_text(secret)
                self.setting.set_wep_key(index, secret)
                self.wep_index_spin.set_value(index + 1)
                self.auth_combo.set_select_index(["shared",
                                                  "open"].index(auth))
コード例 #46
0
 def vpn_start_cb(self, widget, path):
     log.debug("vpn start by tray")
     vpn_active = nm_module.cache.get_spec_object(path)
     if vpn_active.get_vpnstate() < 5:
         self.vpn_path = path
         self.on_vpn_connecting(None, None, path)
コード例 #47
0
 def use_default_setting(self):
     log.debug()
     self.bssid_entry.set_address("")
     self.mac_entry.set_address("")
     self.clone_entry.set_address("")
     self.mtu_spin.set_value(0)
コード例 #48
0
 def set_connection_name(self, text):
     self.connection.get_setting("connection").id = text
     log.debug(text)
     if hasattr(self.connection, "settings_obj"):
         self.connection.settings_obj.set_button("save", True)
コード例 #49
0
 def user_toggle_off_vpn_tray(self, name, event, data):
     log.debug("toggle off vpn from tray")
     self.vpn.set_active(False)
コード例 #50
0
 def dsl_redraw(self, name, event, data):
     if self.dsl.get_active():
         log.debug("dsl redraw action")
         self.dsl.set_active(True, emit=True)
コード例 #51
0
 def auto_radio_selected_cb(self, widget):
     log.debug("")
     sensitive = widget.get_active()
     self.table_set_sensitive(self.auto_table, sensitive)
コード例 #52
0
 def vpn_connected(self, name, event, data):
     log.debug(data)
     items = filter(lambda p: p.connection.object_path == self.this_setting,
                    self.tree.visible_items)
     map(lambda i: i.set_net_state(2), items)
コード例 #53
0
 def toggle_off(self):
     log.debug()
     self.ap_list = []
     self.selected_item = None
     for wireless_device in self.wireless_devices:
         wireless_device.nm_device_disconnect()
コード例 #54
0
 def toggle_off(self):
     log.debug()
     self.ap_list = []
     self.selected_item = None
     for wireless_device in self.wireless_devices:
         wireless_device.nm_device_disconnect()
コード例 #55
0
 def dsl_redraw(self, name, event, data):
     if self.dsl.get_active():
         log.debug("dsl redraw action")
         self.dsl.set_active(True, emit=True)
コード例 #56
0
 def vpn_start_cb(self, widget, path):
     log.debug("vpn start by tray")
     vpn_active = nm_module.cache.get_spec_object(path)
     if vpn_active.get_vpnstate() < 5:
         self.vpn_path = path
         self.on_vpn_connecting(None, None, path)
コード例 #57
0
 def __init_paned(self, widget):
     log.debug("")
     self.hpaned.saved_position = 160
     self.hpaned.set_position(1)
     self.hpaned.animation_position_frames = [0]
     self.hpaned.update_position()
コード例 #58
0
 def toggle_off(self):
     log.debug()
     for wired_device in self.wired_devices:
         wired_device.nm_device_disconnect()