示例#1
0
    def change_encrypt_method(self, widget=None):
        """ Load all the entries for a given encryption method. """
        for z in self.vbox_encrypt_info:
            z.destroy()  # Remove stuff in there already
        ID = self.combo_encryption.get_active()
        methods = self.encrypt_types
        self.encryption_info = {}
        
        # If nothing is selected, select the first entry.
        if ID == -1:
            self.combo_encryption.set_active(0)
            ID = 0

        for type_ in ['required', 'optional']:
            fields = methods[ID][type_]
            for field in fields:
                if language.has_key(field[1]):
                    field_text = language[field[1].lower().replace(' ','_')]
                else:
                    field_text = field[1].replace('_',' ')
               
                if field in methods[ID]['protected']:
                    box = ProtectedLabelEntry(field_text)
                else:
                    box = LabelEntry(field_text)

                self.vbox_encrypt_info.pack_start(box)
                # Add the data to a dict, so that the information
                # can be easily accessed by giving the name of the wanted
                # data.
                self.encryption_info[field[0]] = [box, type_]

                box.entry.set_text(noneToBlankString(
                    wireless.GetWirelessProperty(self.networkID, field[0])))
        self.vbox_encrypt_info.show_all()
示例#2
0
    def change_encrypt_method(self, widget=None):
        """ Load all the entries for a given encryption method. """
        for z in self.vbox_encrypt_info:
            z.destroy()  # Remove stuff in there already
        ID = self.combo_encryption.get_active()
        methods = self.encrypt_types
        self.encryption_info = {}

        # If nothing is selected, select the first entry.
        if ID == -1:
            self.combo_encryption.set_active(0)
            ID = 0

        for type_ in ['required', 'optional']:
            fields = methods[ID][type_]
            for field in fields:
                if language.has_key(field[1]):
                    box = LabelEntry(language[field[1].lower().replace(
                        ' ', '_')])
                else:
                    box = LabelEntry(field[1].replace('_', ' '))
                box.set_auto_hidden(True)
                self.vbox_encrypt_info.pack_start(box)
                # Add the data to a dict, so that the information
                # can be easily accessed by giving the name of the wanted
                # data.
                self.encryption_info[field[0]] = [box, type_]

                box.entry.set_text(
                    noneToBlankString(
                        wireless.GetWirelessProperty(self.networkID,
                                                     field[0])))
        self.vbox_encrypt_info.show_all()
示例#3
0
    def change_encrypt_method(self):
        #self.lbox_encrypt = urwid.ListBox()
        self.encryption_info = {}
        wid,ID = self.encryption_combo.get_focus()
        methods = misc.LoadEncryptionMethods()

        if self._w.body.body.__contains__(self.pile_encrypt):
            self._w.body.body.pop(self._w.body.body.__len__()-1)

        # If nothing is selected, select the first entry.
        if ID == -1:
            self.encryption_combo.set_focus(0)
            ID = 0

        theList = []
        for type_ in ['required', 'optional']:
            fields = methods[ID][type_]
            for field in fields:
                if language.has_key(field[1]):
                    edit = MaskingEdit(('editcp',language[field[1].lower().replace(' ','_')]+': '))
                else:
                    edit = MaskingEdit(('editcp',field[1].replace('_',' ')+': '))
                edit.set_mask_mode('no_focus')
                theList.append(edit)
                # Add the data to any array, so that the information
                # can be easily accessed by giving the name of the wanted
                # data.
                self.encryption_info[field[0]] = [edit, type_]

                edit.set_edit_text(noneToBlankString(
                    wireless.GetWirelessProperty(self.networkid, field[0])))

        #FIXME: This causes the entire pile to light up upon use.
        # Make this into a listbox?
        self.pile_encrypt = DynWrap(urwid.Pile(theList),attrs=('editbx','editnfc'))
        self._w.body.body.insert(self._w.body.body.__len__(),self.pile_encrypt)