示例#1
0
    def refresh(self):
        self.binder.unpopulate()

        self.find('sync-providers').labels = [
            x.title for x in UserSyncProvider.get_classes()
        ]
        self.find('sync-providers').values = [
            x.id for x in UserSyncProvider.get_classes()
        ]

        provider = UserManager.get(manager.context).get_sync_provider()
        self.find('sync-providers').value = provider.id
        self.find('add-user-button').visible = provider.id == ''
        self.find('sync-users-button').visible = provider.id != ''
        self.find('password').visible = provider.id == ''
        self.find('configure-sync-button'
                  ).visible = provider.classconfig_editor is not None

        try:
            provider.test()
            sync_ok = True
        except Exception as e:
            self.context.notify('error', str(e))
            sync_ok = False

        self.find('sync-status-ok').visible = sync_ok
        self.find('sync-status-fail').visible = not sync_ok

        languages = sorted(ajenti.locales.list_locales())
        self.find('language').labels = [_('Auto'), 'en_US'] + languages
        self.find('language').values = ['', 'en_US'] + languages

        self.binder.setup().populate()
        self.ccmgr.reload()
        self.classconfig_binding.setup().populate()
示例#2
0
    def refresh(self):
        self.binder.unpopulate()

        self.find('sync-providers').labels = [x.title for x in UserSyncProvider.get_classes()]
        self.find('sync-providers').values = [x.id    for x in UserSyncProvider.get_classes()]

        provider = UserManager.get(manager.context).get_sync_provider()
        self.find('sync-providers').value = provider.id
        self.find('add-user-button').visible = provider.id == ''
        self.find('sync-users-button').visible = provider.id != ''
        self.find('password').visible = provider.id == ''
        self.find('configure-sync-button').visible = provider.classconfig_editor is not None

        try:
            provider.test()
            sync_ok = True
        except Exception as e:
            self.context.notify('error', str(e))
            sync_ok = False

        self.find('sync-status-ok').visible = sync_ok
        self.find('sync-status-fail').visible = not sync_ok

        languages = sorted(ajenti.locales.list_locales())
        self.find('language').labels = [_('Auto'), 'en_US'] + languages
        self.find('language').values = ['', 'en_US'] + languages

        self.binder.setup().populate()
        self.ccmgr.reload()
        self.classconfig_binding.setup().populate()
示例#3
0
    def refresh(self):
        self.binder.reset()

        self.find('sync-providers').labels = [x.title for x in UserSyncProvider.get_classes()]
        self.find('sync-providers').values = [x.id    for x in UserSyncProvider.get_classes()]

        provider = UserManager.get(manager.context).get_sync_provider()
        self.find('sync-providers').value = provider.id
        self.find('add-user-button').visible = provider.id == ''
        self.find('sync-users-button').visible = provider.id != ''
        self.find('password').visible = provider.id == ''
        self.find('configure-sync-button').visible = provider.classconfig_editor is not None

        sync_ok = provider.test()
        self.find('sync-status-ok').visible = sync_ok
        self.find('sync-status-fail').visible = not sync_ok

        languages = sorted(ajenti.locales.list_locales())
        self.find('language').labels = [_('Auto')] + languages
        self.find('language').values = [''] + languages

        self.binder.autodiscover().populate()
        self.ccmgr.reload()
        self.classconfig_binding.reset().autodiscover().populate()