def __init__(self): # load in our glade interface xml = Gtk.Builder() xml.add_from_file('glade/gdocker_registry.glade') self.window_run = xml.get_object('window_run') self.run_param_container_name = xml.get_object('run_widget_name') self.run_param_treeview = xml.get_object('run_widget_list') self.run_param_liststore = xml.get_object('run_widget_liststore') self.run_widget_launch = xml.get_object('run_widget_launch') self.run_widget_add_row = xml.get_object('run_widget_add_row') self.file_chooser_volumes = xml.get_object('file_chooseer_volumes') self.run_widget_add_row_param_type = xml.get_object('run_widget_param_type') self.run_widget_add_param1 = xml.get_object('run_widget_param1') self.run_widget_add_param2 = xml.get_object('run_widget_param2') self.run_widget_daemon = xml.get_object('run_widget_daemon') self.run_widget_interactive = xml.get_object('run_widget_interactive') self.run_widget_terminal = xml.get_object('run_widget_terminal') self.run_widget_priviledged = xml.get_object('run_widget_priviledged') self.run_widget_default_configs = xml.get_object('run_widget_default_configs') self.run_widget_default_configs_list = xml.get_object('run_widget_default_configs_list') self.run_widget_default_configs.connect('changed', self.change_config) self.run_widget_add_row.connect('button_press_event', self.add_row_to_container) self.run_widget_launch.connect('button_press_event', self.run_widget_launcher) self.window = xml.get_object('window_registry') self.window.connect('delete_event', self.hide) self.widget_image_list = xml.get_object('lb_image_list') self.registry_list = xml.get_object('cmb_registrys') self.registry_list.connect('changed', self.search_registry) self.pull_progress = xml.get_object('image_progress') self.search_registry_widget = xml.get_object('image_search') self.search_registry_widget.connect('activate', self.search_registry) for registry in settings.registry_list: self.registry_list.append_text(registry[0]) self.registry_list.set_active(0) for image in get_registry_images('localhost', version='l', search=''): self.add_image(image.get('name')) self.menu = Gtk.Menu() menu_item1 = Gtk.MenuItem("Pull Image") menu_item1.connect('activate', self.pull_image) menu_remove_image = Gtk.MenuItem("Remove Image") menu_remove_image.connect('activate', self.remove_image) self.menu.append(menu_item1) # self.menu.connect('button_press_event', self.container_delete, items['row'], container) menu_item2 = Gtk.MenuItem("Start Container") self.menu.append(menu_item2) self.populate_config_dropdown() self.update_create_properties_from_config()
def search_registry(self, widget): for row in self.widget_image_list.get_children(): row.destroy() registry_url = self.registry_list.get_active_text() search_value = self.search_registry_widget.get_text() result = [(reg[0], reg[1]) for reg in settings.registry_list if reg[0] == registry_url] self.showing_local_images = False if registry_url == 'localhost': self.showing_local_images = True if result: registry_url, registry_version = result[0] for item in get_registry_images(registry_url, version=registry_version, search=search_value): self.add_image(item.get('name')) self.widget_image_list.show_all()