コード例 #1
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:
                edit = MaskingEdit(('editcp',language[field[1].lower().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)
コード例 #2
0
    def change_encrypt_method(self):
        """ Change encrypt method based on combobox. """
        #self.lbox_encrypt = urwid.ListBox()
        self.encryption_info = {}
        wid, ID = self.encryption_combo.get_focus()
        methods = self.encrypt_types

        # pylint: disable-msg=E0203
        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:
                try:
                    text = language[field[1].lower().replace(' ', '_')]
                except KeyError:
                    text = field[1].replace(' ', '_')
                edit = MaskingEdit(('editcp', text + ': '))
                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_]

                if self.wired:
                    edit.set_edit_text(
                        noneToBlankString(wired.GetWiredProperty(field[0])))
                else:
                    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.pile_encrypt.set_sensitive(self.encryption_chkbox.get_state())

        self._w.body.body.insert(self._w.body.body.__len__(),
                                 self.pile_encrypt)
コード例 #3
0
ファイル: netentry_curses.py プロジェクト: cdanyang/wicd
    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)