def _reset_state(self): basename = "snapshot" def cb(n): return generatename.check_libvirt_collision( self.vm.get_backend().snapshotLookupByName, n) default_name = generatename.generate_name(basename, cb, sep="", start_num=1, force_num=True) self.widget("snapshot-new-name").set_text(default_name) self.widget("snapshot-new-name").emit("changed") self.widget("snapshot-new-description").get_buffer().set_text("") self.widget("snapshot-new-ok").grab_focus() self.widget("snapshot-new-status-text").set_text(self.vm.run_status()) self.widget("snapshot-new-status-icon").set_from_icon_name( self.vm.run_status_icon_name(), Gtk.IconSize.BUTTON) sn = self._get_screenshot() uiutil.set_grid_row_visible(self.widget("snapshot-new-screenshot"), bool(sn)) if sn: self.widget("snapshot-new-screenshot").set_from_pixbuf(sn) self.widget("snapshot-new-name").grab_focus()
def reset_state(self): self._xmleditor.reset_state() basename = "network" def cb(n): return generatename.check_libvirt_collision( self.conn.get_backend().networkLookupByName, n) default_name = generatename.generate_name(basename, cb) self.widget("net-name").set_text(default_name) self.widget("net-dns-use-netname").set_active(True) self.widget("net-ipv4-expander").set_visible(True) self.widget("net-ipv4-expander").set_expanded(False) self.widget("net-ipv6-expander").set_visible(True) self.widget("net-ipv6-expander").set_expanded(False) self.widget("net-dns-expander").set_visible(True) self.widget("net-dns-expander").set_expanded(False) self.widget("net-ipv4-enable").set_active(True) self.widget("net-ipv4-network").set_text("192.168.100.0/24") self.widget("net-dhcpv4-enable").set_active(True) self.widget("net-dhcpv4-start").set_text("192.168.100.128") self.widget("net-dhcpv4-end").set_text("192.168.100.254") self.widget("net-ipv6-enable").set_active(False) self.widget("net-ipv6-network").set_text("") self.widget("net-dhcpv6-enable").set_active(False) self.widget("net-dhcpv6-start").set_text("") self.widget("net-dhcpv6-end").set_text("") # Populate physical forward devices self.widget("net-forward-device").set_active(0) self.widget("net-forward-mode").set_active(0) self.widget("net-forward-manual").set_text("") # Populate hostdev forward devices devprettynames = [] ifnames = [] for pcidev in self.conn.filter_nodedevs("pci"): if not pcidev.xmlobj.is_pci_sriov(): continue devdesc = pcidev.pretty_name() for netdev in self.conn.filter_nodedevs("net"): if pcidev.xmlobj.name != netdev.xmlobj.parent: continue ifname = netdev.xmlobj.interface devprettyname = "%s (%s)" % (ifname, devdesc) devprettynames.append(devprettyname) ifnames.append(ifname) break pf_model = self.widget("net-hostdevs").get_model() pf_model.clear() for devprettyname, ifname in zip(devprettynames, ifnames): pf_model.append([ifname, devprettyname]) if len(pf_model) == 0: pf_model.append([None, _("No available device")]) self.widget("net-hostdevs").set_active(0)