def refresh_start(builder, lets_connect): # type: (Gtk.builder, bool) -> None logger.info(u"composing list of current eduVPN configurations") config_list = builder.get_object('configs-model') introduction = builder.get_object('introduction') main_image = builder.get_object('main_image') window = builder.get_object('eduvpn-window') logo, name = get_brand(lets_connect) main_image.set_from_file(logo) window.set_title("{} Configuration Manager".format(name)) config_list.clear() providers = list(list_providers()) providers.sort(key=lambda x: x.display_name) if len(providers) > 0: logger.info(u"hiding introduction") introduction.hide() for meta in providers: connection_type = u"<b>{}</b>\n{}\n<small><i>{}</i></small>".format(meta.display_name, meta.connection_type, meta.profile_display_name) if meta.icon_data: icon = bytes2pixbuf(base64.b64decode(meta.icon_data.encode())) else: icon, _ = get_pixbuf(logo) config_list.append((meta.uuid, meta.display_name, icon, connection_type)) else: logger.info(u"showing introduction") introduction.show()
def update_providers(builder): logger.info("composing list of current eduVPN configurations") config_list = builder.get_object('configs-model') introduction = builder.get_object('introduction') config_list.clear() providers = list(list_providers()) if len(providers) > 0: logger.info("hiding introduction") introduction.hide() for meta in providers: connection_type = "{}\n{}".format(meta.display_name, meta.connection_type) if meta.icon_data: icon = bytes2pixbuf(base64.b64decode(meta.icon_data.encode())) else: icon, _ = get_pixbuf() config_list.append((meta.uuid, meta.display_name, icon, connection_type)) else: logger.info("showing introduction") introduction.show()
def test_list_providers(self): list_providers()