(self)
The configuration menu
The configuration menu
The configuration menu
def gen_config_menu(self):
        '''The configuration menu'''

        self.config = parse_config(self)
        menu = 1
        while True:
            menu = self.gen_menu(menu,
                ((1, 0, 'Delete clipboard automatically: ' +
                  str(self.config['del_clip'])),
                 (2, 0, 'Waiting time (seconds): ' +
                  str(self.config['clip_delay'])),
                 (3, 0, 'Lock database automatically: ' +
                  str(self.config['lock_db'])),
                 (4, 0, 'Waiting time (seconds): ' +
                  str(self.config['lock_delay'])),
                 (5, 0, 'Remember last database: ' +
                  str(self.config['rem_db'])),
                 (6, 0, 'Remember last keyfile: ' +
                  str(self.config['rem_key'])),
                 (7, 0, 'Use directly password and key if one of the two '
                        'above is True: ' +
                  str(self.config['skip_menu'])),
                 (8, 0, 'Pin server certificate: ' + str(self.config['pin'])),
                 (9, 0, 'Generate default configuration'),
                 (10, 0, 'Write config')),
                (12, 0, 'Automatic locking works only for saved databases!'))
            if menu == 1:
                if self.config['del_clip'] is True:
                    self.config['del_clip'] = False
                elif self.config['del_clip'] is False:
                    self.config['del_clip'] = True
            elif menu == 2:
                delay = self.get_num('Waiting time: ',
                                     str(self.config['clip_delay']))
                if delay is False:
                    continue
                elif delay == -1:
                    self.close()
                else:
                    self.config['clip_delay'] = delay
            elif menu == 3:
                if self.config['lock_db'] is True:
                    self.config['lock_db'] = False
                elif self.config['lock_db'] is False:
                    self.config['lock_db'] = True
            elif menu == 4:
                delay = self.get_num('Waiting time: ',
                                     str(self.config['lock_delay']))
                if delay is False:
                    continue
                elif delay == -1:
                    self.close()
                else:
                    self.config['lock_delay'] = delay
            elif menu == 5:
                if self.config['rem_db'] is True:
                    self.config['rem_db'] = False
                elif self.config['rem_db'] is False:
                    self.config['rem_db'] = True
            elif menu == 6:
                if self.config['rem_key'] is True:
                    self.config['rem_key'] = False
                elif self.config['rem_key'] is False:
                    self.config['rem_key'] = True
            elif menu == 7:
                if self.config['skip_menu'] is True:
                    self.config['skip_menu'] = False
                elif self.config['skip_menu'] is False:
                    self.config['skip_menu'] = True
            elif menu == 8:
                if self.config['pin'] is True:
                    self.config['pin'] = False
                elif self.config['pin'] is False:
                    self.config['pin'] = True
            elif menu == 9:
                self.config = {'del_clip': True,  # standard config
                               'clip_delay': 20,
                               'lock_db': True,
                               'lock_delay': 60,
                               'rem_db': True,
                               'rem_key': False,
                               'skip_menu': False,
                               'pin': True}
            elif menu == 10:
                write_config(self, self.config)
                return True
            elif menu is False:
                return False
            elif menu == -1:
                self.close()
def gen_config_menu ( self ) : self . config = parse_config ( self ) menu = 1 while True : menu = self . gen_menu ( menu , ( ( 1 , 0 , 'Delete clipboard automatically: ' + str ( self . config [ 'del_clip' ] ) ) , ( 2 , 0 , 'Waiting time (seconds): ' + str ( self . config [ 'clip_delay' ] ) ) , ( 3 , 0 , 'Lock database automatically: ' + str ( self . config [ 'lock_db' ] ) ) , ( 4 , 0 , 'Waiting time (seconds): ' + str ( self . config [ 'lock_delay' ] ) ) , ( 5 , 0 , 'Remember last database: ' + str ( self . config [ 'rem_db' ] ) ) , ( 6 , 0 , 'Remember last keyfile: ' + str ( self . config [ 'rem_key' ] ) ) , ( 7 , 0 , 'Use directly password and key if one of the two ' 'above is True: ' + str ( self . config [ 'skip_menu' ] ) ) , ( 8 , 0 , 'Pin server certificate: ' + str ( self . config [ 'pin' ] ) ) , ( 9 , 0 , 'Generate default configuration' ) , ( 10 , 0 , 'Write config' ) ) , ( 12 , 0 , 'Automatic locking works only for saved databases!' ) ) if menu == 1 : if self . config [ 'del_clip' ] is True : self . config [ 'del_clip' ] = False elif self . config [ 'del_clip' ] is False : self . config [ 'del_clip' ] = True elif menu == 2 : delay = self . get_num ( 'Waiting time: ' , str ( self . config [ 'clip_delay' ] ) ) if delay is False : continue elif delay == - 1 : self . close ( ) else : self . config [ 'clip_delay' ] = delay elif menu == 3 : if self . config [ 'lock_db' ] is True : self . config [ 'lock_db' ] = False elif self . config [ 'lock_db' ] is False : self . config [ 'lock_db' ] = True elif menu == 4 : delay = self . get_num ( 'Waiting time: ' , str ( self . config [ 'lock_delay' ] ) ) if delay is False : continue elif delay == - 1 : self . close ( ) else : self . config [ 'lock_delay' ] = delay elif menu == 5 : if self . config [ 'rem_db' ] is True : self . config [ 'rem_db' ] = False elif self . config [ 'rem_db' ] is False : self . config [ 'rem_db' ] = True elif menu == 6 : if self . config [ 'rem_key' ] is True : self . config [ 'rem_key' ] = False elif self . config [ 'rem_key' ] is False : self . config [ 'rem_key' ] = True elif menu == 7 : if self . config [ 'skip_menu' ] is True : self . config [ 'skip_menu' ] = False elif self . config [ 'skip_menu' ] is False : self . config [ 'skip_menu' ] = True elif menu == 8 : if self . config [ 'pin' ] is True : self . config [ 'pin' ] = False elif self . config [ 'pin' ] is False : self . config [ 'pin' ] = True elif menu == 9 : self . config = { 'del_clip' : True , # standard config 'clip_delay' : 20 , 'lock_db' : True , 'lock_delay' : 60 , 'rem_db' : True , 'rem_key' : False , 'skip_menu' : False , 'pin' : True } elif menu == 10 : write_config ( self , self . config ) return True elif menu is False : return False elif menu == - 1 : self . close ( )