示例#1
0
    def initialize_data(self):
        config = get_full_config()

        self.selected_device = None
        self.device_details.opacity = 0.0
        self.device_list.adapter = ListAdapter(data=config.keys(), cls=ListItemButton)
        self.device_list.adapter.data = config.keys()
        self.device_list.adapter.bind(on_selection_change=self.on_select)
示例#2
0
def DeviceCompleter(prefix, **kwargs):
    '''
    Autocomplete device name
    '''
    try:
        config = local_config.get_full_config()
    except:
        return ()
    else:
        return (name for name, conf in config.items())
示例#3
0
def display_config():
    '''
    Display config file in a human readable way.
    '''
    config = local_config.get_full_config()
    for device in config.keys():
        print 'Configuration for device %s:' % device
        for key in config[device].keys():
            print '    %s = %s' % (key, config[device][key])
        print ' '
示例#4
0
def reset():
    '''
    Reset local and remote configuration by:

    * Unmounting each device folder.
    * Removing each device on corresponding remote cozies.
    * Removing configuration file.
    * Destroy corresponding DBs.
    '''
    # Remove devices remotely
    try:
        config = local_config.get_full_config()
    except local_config.NoConfigFile:
        print 'No config file found, cannot reset anything'
        sys.exit(1)

    for name in config.keys():
        print '- Clearing %s' % name
        remove_device(name)

    # Remove local config file
    local_config.clear()
    print '[reset] Configuration files deleted, folder unmounted.'