def set_sparse_tooltip(widget): sparse_str = _("Fully allocating storage may take longer now, " "but the OS install phase will be quicker. \n\n" "Skipping allocation can also cause space issues on " "the host machine, if the maximum image size exceeds " "available storage space.") util.tooltip_wrapper(widget, sparse_str)
def destconn_changed(self, src): active = src.get_active() tooltip = None if active == -1: tooltip = _("A valid destination connection must be selected.") self.widget("migrate-finish").set_sensitive(active != -1) util.tooltip_wrapper(self.widget("migrate-finish"), tooltip)
def reset_state(self): title_str = ("<span size='large' color='white'>%s '%s'</span>" % (_("Migrate"), util.xml_escape(self.vm.get_name()))) self.widget("migrate-main-label").set_markup(title_str) self.widget("migrate-cancel").grab_focus() name = self.vm.get_name() srchost = self.conn.get_hostname() self.widget("migrate-label-name").set_text(name) self.widget("migrate-label-src").set_text(srchost) self.widget("migrate-set-interface").set_active(False) self.widget("migrate-set-rate").set_active(False) self.widget("migrate-set-port").set_active(False) self.widget("migrate-set-maxdowntime").set_active(False) self.widget("migrate-max-downtime").set_value(30) running = self.vm.is_active() self.widget("migrate-offline").set_active(not running) self.widget("migrate-offline").set_sensitive(running) self.widget("migrate-rate").set_value(0) self.widget("migrate-secure").set_active(False) downtime_box = self.widget("migrate-maxdowntime-box") support_downtime = self.vm.support_downtime() downtime_tooltip = "" if not support_downtime: downtime_tooltip = _("Libvirt version does not support setting " "downtime.") downtime_box.set_sensitive(support_downtime) util.tooltip_wrapper(downtime_box, downtime_tooltip) if self.conn.is_xen(): # Default xen port is 8002 self.widget("migrate-port").set_value(8002) else: # QEMU migrate port range is 49152+64 self.widget("migrate-port").set_value(49152) secure_box = self.widget("migrate-secure-box") support_secure = hasattr(libvirt, "VIR_MIGRATE_TUNNELLED") secure_tooltip = "" if not support_secure: secure_tooltip = _("Libvirt version does not support tunnelled " "migration.") secure_box.set_sensitive(support_secure) util.tooltip_wrapper(secure_box, secure_tooltip) self.rebuild_dest_rows()
def populate_storage_lists(self): storage_box = self.widget("clone-storage-box") for c in storage_box.get_children(): storage_box.remove(c) c.destroy() for target in self.target_list: disk = self.storage_list[target] self.build_storage_entry(disk, storage_box) num_c = min(len(self.target_list), 3) if num_c: scroll = self.widget("clone-storage-scroll") scroll.set_size_request(-1, 80 * num_c) storage_box.show_all() no_storage = not bool(len(self.target_list)) self.widget("clone-storage-box").set_property("visible", not no_storage) self.widget("clone-no-storage-pass").set_property("visible", no_storage) skip_targets = [] new_disks = [] for target in self.target_list: do_clone = self.storage_list[target][STORAGE_INFO_DO_CLONE] new_path = self.storage_list[target][STORAGE_INFO_NEW_PATH] if do_clone: new_disks.append(new_path) else: skip_targets.append(target) self.clone_design.skip_target = skip_targets self.clone_design.clone_devices = new_disks # If any storage cannot be cloned or shared, don't allow cloning clone = True tooltip = "" for row in self.storage_list.values(): can_clone = row[STORAGE_INFO_CAN_CLONE] can_share = row[STORAGE_INFO_CAN_SHARE] if not (can_clone or can_share): clone = False tooltip = _("One or more disks cannot be cloned or shared.") break ok_button = self.widget("clone-ok") ok_button.set_sensitive(clone) util.tooltip_wrapper(ok_button, tooltip)
def populate_storage_lists(self): storage_box = self.widget("clone-storage-box") for c in storage_box.get_children(): storage_box.remove(c) c.destroy() for target in self.target_list: disk = self.storage_list[target] self.build_storage_entry(disk, storage_box) num_c = min(len(self.target_list), 3) if num_c: scroll = self.widget("clone-storage-scroll") scroll.set_size_request(-1, 80 * num_c) storage_box.show_all() no_storage = not bool(len(self.target_list)) self.widget("clone-storage-box").set_property("visible", not no_storage) self.widget("clone-no-storage-pass").set_property( "visible", no_storage) skip_targets = [] new_disks = [] for target in self.target_list: do_clone = self.storage_list[target][STORAGE_INFO_DO_CLONE] new_path = self.storage_list[target][STORAGE_INFO_NEW_PATH] if do_clone: new_disks.append(new_path) else: skip_targets.append(target) self.clone_design.skip_target = skip_targets self.clone_design.clone_devices = new_disks # If any storage cannot be cloned or shared, don't allow cloning clone = True tooltip = "" for row in self.storage_list.values(): can_clone = row[STORAGE_INFO_CAN_CLONE] can_share = row[STORAGE_INFO_CAN_SHARE] if not (can_clone or can_share): clone = False tooltip = _("One or more disks cannot be cloned or shared.") break ok_button = self.widget("clone-ok") ok_button.set_sensitive(clone) util.tooltip_wrapper(ok_button, tooltip)
def init_fs_toolbar(self): scroll = self.widget("console-vnc-scroll") pages = self.widget("console-pages") pages.remove(scroll) self.fs_toolbar = gtk.Toolbar() self.fs_toolbar.set_show_arrow(False) self.fs_toolbar.set_no_show_all(True) self.fs_toolbar.set_style(gtk.TOOLBAR_BOTH_HORIZ) # Exit fullscreen button button = gtk.ToolButton(gtk.STOCK_LEAVE_FULLSCREEN) util.tooltip_wrapper(button, _("Leave fullscreen")) button.show() self.fs_toolbar.add(button) button.connect("clicked", self.leave_fullscreen) def keycombo_menu_clicked(src): ignore = src def menu_location(menu, toolbar): ignore = menu x, y = toolbar.window.get_origin() ignore, height = toolbar.window.get_size() return x, y + height, True self.keycombo_menu.popup(None, None, menu_location, 0, gtk.get_current_event_time(), self.fs_toolbar) self.send_key_button = gtk.ToolButton() self.send_key_button.set_icon_name( "preferences-desktop-keyboard-shortcuts") util.tooltip_wrapper(self.send_key_button, _("Send key combination")) self.send_key_button.show_all() self.send_key_button.connect("clicked", keycombo_menu_clicked) self.fs_toolbar.add(self.send_key_button) self.fs_drawer = AutoDrawer() self.fs_drawer.set_active(False) self.fs_drawer.set_over(self.fs_toolbar) self.fs_drawer.set_under(scroll) self.fs_drawer.set_offset(-1) self.fs_drawer.set_fill(False) self.fs_drawer.set_overlap_pixels(1) self.fs_drawer.set_nooverlap_pixels(0) self.fs_drawer.show_all() pages.add(self.fs_drawer)
def reset_state(self, conn=None): if conn and conn != self.conn: self.remove_conn() self.conn = conn pool_list = self.widget("pool-list") virtManager.host.populate_storage_pools(pool_list, self.conn) ids = [] ids.append(self.conn.connect("pool-added", self.repopulate_storage_pools)) ids.append(self.conn.connect("pool-removed", self.repopulate_storage_pools)) ids.append(self.conn.connect("pool-started", self.refresh_storage_pool)) ids.append(self.conn.connect("pool-stopped", self.refresh_storage_pool)) self.conn_signal_ids = ids # FIXME: Need a connection specific "vol-added" function? # Won't be able to pick that change up from outside? # Manually trigger vol_selected, so buttons are in the correct state self.vol_selected() self.pool_selected() tooltip = None is_remote = self.conn.is_remote() self.widget("browse-local").set_sensitive(not is_remote) if is_remote: tooltip = _("Cannot use local storage on remote connection.") util.tooltip_wrapper(self.widget("browse-local"), tooltip) # Set data based on browse type self.local_args["dialog_type"] = None self.local_args["browse_reason"] = self.browse_reason data = self.config.browse_reason_data.get(self.browse_reason) if data: self.topwin.set_title(data["storage_title"]) self.local_args["dialog_name"] = data["local_title"] self.local_args["dialog_type"] = data.get("dialog_type") self.local_args["choose_button"] = data.get("choose_button")
def reset_state(self, conn=None): if conn and conn != self.conn: self.remove_conn() self.conn = conn pool_list = self.widget("pool-list") virtManager.host.populate_storage_pools(pool_list, self.conn) ids = [] ids.append( self.conn.connect("pool-added", self.repopulate_storage_pools)) ids.append( self.conn.connect("pool-removed", self.repopulate_storage_pools)) ids.append(self.conn.connect("pool-started", self.refresh_storage_pool)) ids.append(self.conn.connect("pool-stopped", self.refresh_storage_pool)) self.conn_signal_ids = ids # FIXME: Need a connection specific "vol-added" function? # Won't be able to pick that change up from outside? # Manually trigger vol_selected, so buttons are in the correct state self.vol_selected() self.pool_selected() tooltip = None is_remote = self.conn.is_remote() self.widget("browse-local").set_sensitive(not is_remote) if is_remote: tooltip = _("Cannot use local storage on remote connection.") util.tooltip_wrapper(self.widget("browse-local"), tooltip) # Set data based on browse type self.local_args["dialog_type"] = None self.local_args["browse_reason"] = self.browse_reason data = self.config.browse_reason_data.get(self.browse_reason) if data: self.topwin.set_title(data["storage_title"]) self.local_args["dialog_name"] = data["local_title"] self.local_args["dialog_type"] = data.get("dialog_type") self.local_args["choose_button"] = data.get("choose_button")
def initialize_opt_media(self): widget = self.widget("cd-path") warn = self.widget("cd-path-warn") error = self.conn.mediadev_error uihelpers.init_mediadev_combo(widget) uihelpers.populate_mediadev_combo(self.conn, widget, self.media_type) if error: warn.show() util.tooltip_wrapper(warn, error) else: warn.hide() self.widget("physical-media").set_sensitive(not bool(error)) if self.media_type == MEDIA_FLOPPY: self.widget("physical-media").set_label(_("Floppy D_rive")) self.widget("iso-image").set_label(_("Floppy _Image"))
def populate_pool_state(self, uuid): pool = self.conn.get_pool(uuid) auto = pool.get_autostart() active = pool.is_active() # Set pool details state self.widget("pool-details").set_sensitive(True) self.widget("pool-name").set_markup("<b>%s:</b>" % pool.get_name()) self.widget("pool-sizes").set_markup( """<span size="large">%s Free</span> / <i>%s In Use</i>""" % (pool.get_pretty_available(), pool.get_pretty_allocation())) self.widget("pool-type").set_text( Storage.StoragePool.get_pool_type_desc(pool.get_type())) self.widget("pool-location").set_text( pool.get_target_path()) self.widget("pool-state-icon").set_from_icon_name( ((active and self.ICON_RUNNING) or self.ICON_SHUTOFF), gtk.ICON_SIZE_MENU) self.widget("pool-state").set_text( (active and _("Active")) or _("Inactive")) self.widget("pool-autostart").set_label( (auto and _("On Boot")) or _("Never")) self.widget("pool-autostart").set_active(auto) self.widget("vol-list").set_sensitive(active) self.populate_storage_volumes() self.widget("pool-delete").set_sensitive(not active) self.widget("pool-stop").set_sensitive(active) self.widget("pool-start").set_sensitive(not active) self.widget("vol-add").set_sensitive(active) self.widget("vol-delete").set_sensitive(False) if active: try: Storage.StoragePool.get_volume_for_pool(pool.get_type()) except Exception, e: self.widget("vol-add").set_sensitive(False) util.tooltip_wrapper(self.widget("vol-add"), str(e))
def populate_pool_state(self, uuid): pool = self.conn.get_pool(uuid) auto = pool.get_autostart() active = pool.is_active() # Set pool details state self.widget("pool-details").set_sensitive(True) self.widget("pool-name").set_markup("<b>%s:</b>" % pool.get_name()) self.widget("pool-sizes").set_markup( """<span size="large">%s Free</span> / <i>%s In Use</i>""" % (pool.get_pretty_available(), pool.get_pretty_allocation())) self.widget("pool-type").set_text( Storage.StoragePool.get_pool_type_desc(pool.get_type())) self.widget("pool-location").set_text(pool.get_target_path()) self.widget("pool-state-icon").set_from_icon_name( ((active and self.ICON_RUNNING) or self.ICON_SHUTOFF), gtk.ICON_SIZE_MENU) self.widget("pool-state").set_text((active and _("Active")) or _("Inactive")) self.widget("pool-autostart").set_label((auto and _("On Boot")) or _("Never")) self.widget("pool-autostart").set_active(auto) self.widget("vol-list").set_sensitive(active) self.populate_storage_volumes() self.widget("pool-delete").set_sensitive(not active) self.widget("pool-stop").set_sensitive(active) self.widget("pool-start").set_sensitive(not active) self.widget("vol-add").set_sensitive(active) self.widget("vol-delete").set_sensitive(False) if active: try: Storage.StoragePool.get_volume_for_pool(pool.get_type()) except Exception, e: self.widget("vol-add").set_sensitive(False) util.tooltip_wrapper(self.widget("vol-add"), str(e))