mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-28 01:58:08 +03:00
uiutil: Clarify a few ambiguous function names
This commit is contained in:
parent
49e3ea2cdf
commit
6071ab0ea4
@ -236,7 +236,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
input_list = self.widget("input-type")
|
||||
input_model = Gtk.ListStore(str, str, str)
|
||||
input_list.set_model(input_model)
|
||||
uiutil.set_combo_text_column(input_list, 0)
|
||||
uiutil.init_combo_text_column(input_list, 0)
|
||||
|
||||
# Sound model list
|
||||
sound_list = self.widget("sound-model")
|
||||
@ -264,7 +264,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
# Mode name, desc
|
||||
char_mode_model = Gtk.ListStore(str, str)
|
||||
char_mode.set_model(char_mode_model)
|
||||
uiutil.set_combo_text_column(char_mode, 1)
|
||||
uiutil.init_combo_text_column(char_mode, 1)
|
||||
char_mode_model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
for t in VirtualSerialDevice.MODES:
|
||||
desc = VirtualSerialDevice.pretty_mode(t)
|
||||
@ -274,7 +274,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
lst = self.widget("char-target-type")
|
||||
model = Gtk.ListStore(str, str)
|
||||
lst.set_model(model)
|
||||
uiutil.set_combo_text_column(lst, 1)
|
||||
uiutil.init_combo_text_column(lst, 1)
|
||||
if self.conn.is_qemu():
|
||||
model.append(["virtio", "virtio"])
|
||||
else:
|
||||
@ -284,7 +284,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
lst = self.widget("char-target-name")
|
||||
model = Gtk.ListStore(str)
|
||||
lst.set_model(model)
|
||||
uiutil.set_combo_text_column(lst, 0)
|
||||
uiutil.init_combo_text_column(lst, 0)
|
||||
for n in VirtualChannelDevice.CHANNEL_NAMES:
|
||||
model.append([n])
|
||||
|
||||
@ -292,7 +292,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
lst = self.widget("char-device-type")
|
||||
model = Gtk.ListStore(str, str)
|
||||
lst.set_model(model)
|
||||
uiutil.set_combo_text_column(lst, 1)
|
||||
uiutil.init_combo_text_column(lst, 1)
|
||||
|
||||
# Watchdog widgets
|
||||
combo = self.widget("watchdog-model")
|
||||
@ -328,11 +328,11 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
combo = self.widget("controller-type")
|
||||
target_model = Gtk.ListStore(str, str)
|
||||
combo.set_model(target_model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
combo = self.widget("controller-model")
|
||||
target_model = Gtk.ListStore(str, str)
|
||||
combo.set_model(target_model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
# Available HW options
|
||||
is_local = not self.conn.is_remote()
|
||||
@ -515,7 +515,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def build_video_combo(vm, combo, no_default=None):
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
combo.get_model().set_sort_column_id(1, Gtk.SortType.ASCENDING)
|
||||
|
||||
vmmAddHardware.populate_video_combo(vm, combo, no_default)
|
||||
@ -524,7 +524,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def build_sound_combo(vm, combo, no_default=False):
|
||||
model = Gtk.ListStore(str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 0)
|
||||
uiutil.init_combo_text_column(combo, 0)
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
stable_defaults = vm.stable_defaults()
|
||||
@ -546,7 +546,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
ignore = vm
|
||||
model = Gtk.ListStore(str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 0)
|
||||
uiutil.init_combo_text_column(combo, 0)
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
for m in virtinst.VirtualWatchdog.MODELS:
|
||||
@ -561,7 +561,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
ignore = vm
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
for m in virtinst.VirtualWatchdog.ACTIONS:
|
||||
@ -597,7 +597,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def build_network_model_combo(vm, combo):
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
vmmAddHardware.populate_network_model_combo(vm, combo)
|
||||
@ -617,7 +617,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def build_smartcard_mode_combo(vm, combo):
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
vmmAddHardware.populate_smartcard_mode_combo(vm, combo)
|
||||
@ -645,7 +645,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def build_redir_type_combo(vm, combo):
|
||||
model = Gtk.ListStore(str, str, bool)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
vmmAddHardware.populate_redir_type_combo(vm, combo)
|
||||
combo.set_active(0)
|
||||
@ -664,7 +664,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def build_tpm_type_combo(vm, combo):
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
vmmAddHardware.populate_tpm_type_combo(vm, combo)
|
||||
@ -683,7 +683,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
ignore = vm
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
combo.set_active(-1)
|
||||
for m in virtinst.VirtualDisk.cache_types:
|
||||
@ -697,7 +697,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
ignore = vm
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
combo.set_active(-1)
|
||||
@ -713,7 +713,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
ignore = vm
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
|
||||
combo.set_active(-1)
|
||||
|
||||
@ -757,7 +757,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def populate_disk_format_combo(vm, combo, create):
|
||||
model = Gtk.ListStore(str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 0)
|
||||
uiutil.init_combo_text_column(combo, 0)
|
||||
|
||||
formats = ["raw", "qcow2", "qed"]
|
||||
no_create_formats = []
|
||||
@ -829,7 +829,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
break
|
||||
|
||||
if default_bus:
|
||||
uiutil.set_row_selection(widget, default_bus)
|
||||
uiutil.select_list_row_by_value(widget, default_bus)
|
||||
elif len(model) > 0:
|
||||
widget.set_active(0)
|
||||
|
||||
@ -863,7 +863,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
|
||||
if len(model) == 0:
|
||||
model.append([_("No Devices Available"), None, None, None])
|
||||
uiutil.set_list_selection(devlist, 0)
|
||||
uiutil.select_list_row_by_number(devlist, 0)
|
||||
|
||||
def populate_disk_format_combo_wrapper(self, create):
|
||||
format_list = self.widget("config-storage-format")
|
||||
@ -930,7 +930,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def build_combo_with_values(self, combo, values, default=None):
|
||||
dev_model = Gtk.ListStore(str, str)
|
||||
combo.set_model(dev_model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
dev_model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
types = combo.get_model()
|
||||
@ -1129,7 +1129,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
################
|
||||
|
||||
def set_hw_selection(self, page):
|
||||
uiutil.set_list_selection(self.widget("hw-list"), page)
|
||||
uiutil.select_list_row_by_number(self.widget("hw-list"), page)
|
||||
|
||||
def get_hw_selection(self):
|
||||
return uiutil.get_list_selection(self.widget("hw-list"), None)
|
||||
@ -1312,7 +1312,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
elif (text == VirtualChannelDevice.CHANNEL_NAME_QEMUGA or
|
||||
text == VirtualChannelDevice.CHANNEL_NAME_LIBGUESTFS):
|
||||
settype = "unix"
|
||||
uiutil.set_row_selection(self.widget("char-device-type"), settype)
|
||||
uiutil.select_list_row_by_value(self.widget("char-device-type"), settype)
|
||||
|
||||
def change_char_device_type(self, src):
|
||||
devtype = uiutil.get_list_selection(src, 0)
|
||||
|
@ -166,7 +166,7 @@ class vmmConnect(vmmGObjectUI):
|
||||
_add_hv_row(HV_LXC, "lxc", "LXC (Linux Containers)")
|
||||
_add_hv_row(HV_BHYVE, "bhyve", "Bhyve")
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
combo = self.widget("transport")
|
||||
model = Gtk.ListStore(str)
|
||||
@ -174,7 +174,7 @@ class vmmConnect(vmmGObjectUI):
|
||||
model.append(["TCP (SASL, Kerberos)"])
|
||||
model.append(["SSL/TLS with certificates"])
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 0)
|
||||
uiutil.init_combo_text_column(combo, 0)
|
||||
|
||||
# Hostname combo box entry
|
||||
hostListModel = Gtk.ListStore(str, str, str)
|
||||
@ -202,9 +202,9 @@ class vmmConnect(vmmGObjectUI):
|
||||
def set_default_hypervisor(self):
|
||||
default = self.default_uri()
|
||||
if not default or default.startswith("qemu"):
|
||||
uiutil.set_row_selection(self.widget("hypervisor"), HV_QEMU)
|
||||
uiutil.select_list_row_by_value(self.widget("hypervisor"), HV_QEMU)
|
||||
elif default.startswith("xen"):
|
||||
uiutil.set_row_selection(self.widget("hypervisor"), HV_XEN)
|
||||
uiutil.select_list_row_by_value(self.widget("hypervisor"), HV_XEN)
|
||||
|
||||
def add_service(self, interface, protocol, name, typ, domain, flags):
|
||||
ignore = flags
|
||||
|
@ -243,7 +243,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
conn_list = self.widget("create-conn")
|
||||
conn_model = Gtk.ListStore(str, str)
|
||||
conn_list.set_model(conn_model)
|
||||
uiutil.set_combo_text_column(conn_list, 1)
|
||||
uiutil.init_combo_text_column(conn_list, 1)
|
||||
|
||||
# ISO media list
|
||||
iso_list = self.widget("install-local-box")
|
||||
@ -275,13 +275,13 @@ class vmmCreate(vmmGObjectUI):
|
||||
os_type_list = self.widget("install-os-type")
|
||||
os_type_model = Gtk.ListStore(str, str, bool, bool)
|
||||
os_type_list.set_model(os_type_model)
|
||||
uiutil.set_combo_text_column(os_type_list, 1)
|
||||
uiutil.init_combo_text_column(os_type_list, 1)
|
||||
os_type_list.set_row_separator_func(sep_func, os_type_list)
|
||||
|
||||
os_variant_list = self.widget("install-os-version")
|
||||
os_variant_model = Gtk.ListStore(str, str, bool, bool)
|
||||
os_variant_list.set_model(os_variant_model)
|
||||
uiutil.set_combo_text_column(os_variant_list, 1)
|
||||
uiutil.init_combo_text_column(os_variant_list, 1)
|
||||
os_variant_list.set_row_separator_func(sep_func, os_variant_list)
|
||||
|
||||
entry = self.widget("install-os-version-entry")
|
||||
@ -296,19 +296,19 @@ class vmmCreate(vmmGObjectUI):
|
||||
archList = self.widget("config-arch")
|
||||
archModel = Gtk.ListStore(str, str)
|
||||
archList.set_model(archModel)
|
||||
uiutil.set_combo_text_column(archList, 1)
|
||||
uiutil.init_combo_text_column(archList, 1)
|
||||
archList.set_row_separator_func(
|
||||
lambda m, i, ignore: m[i][0] is None, None)
|
||||
|
||||
hyperList = self.widget("config-hv")
|
||||
hyperModel = Gtk.ListStore(str, str)
|
||||
hyperList.set_model(hyperModel)
|
||||
uiutil.set_combo_text_column(hyperList, 0)
|
||||
uiutil.init_combo_text_column(hyperList, 0)
|
||||
|
||||
lst = self.widget("config-machine")
|
||||
model = Gtk.ListStore(str)
|
||||
lst.set_model(model)
|
||||
uiutil.set_combo_text_column(lst, 0)
|
||||
uiutil.init_combo_text_column(lst, 0)
|
||||
lst.set_row_separator_func(lambda m, i, ignore: m[i][0] is None, None)
|
||||
|
||||
def reset_state(self, urihint=None):
|
||||
|
@ -178,7 +178,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
def build_interface_startmode_combo(combo):
|
||||
model = Gtk.ListStore(str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 0)
|
||||
uiutil.init_combo_text_column(combo, 0)
|
||||
|
||||
model.append(["none"])
|
||||
model.append(["onboot"])
|
||||
@ -195,7 +195,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
type_list = self.widget("interface-type")
|
||||
type_model = Gtk.ListStore(str, str)
|
||||
type_list.set_model(type_model)
|
||||
uiutil.set_combo_text_column(type_list, 1)
|
||||
uiutil.init_combo_text_column(type_list, 1)
|
||||
type_model.append([Interface.INTERFACE_TYPE_BRIDGE,
|
||||
_("Bridge")])
|
||||
type_model.append([Interface.INTERFACE_TYPE_BOND,
|
||||
@ -255,7 +255,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
mode_list = self.widget("bond-mode")
|
||||
mode_model = Gtk.ListStore(str, str)
|
||||
mode_list.set_model(mode_model)
|
||||
uiutil.set_combo_text_column(mode_list, 0)
|
||||
uiutil.init_combo_text_column(mode_list, 0)
|
||||
mode_model.append([_("System default"), None])
|
||||
for m in Interface.INTERFACE_BOND_MODES:
|
||||
mode_model.append([m, m])
|
||||
@ -263,7 +263,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
mon_list = self.widget("bond-monitor-mode")
|
||||
mon_model = Gtk.ListStore(str, str)
|
||||
mon_list.set_model(mon_model)
|
||||
uiutil.set_combo_text_column(mon_list, 0)
|
||||
uiutil.init_combo_text_column(mon_list, 0)
|
||||
mon_model.append([_("System default"), None])
|
||||
for m in Interface.INTERFACE_BOND_MONITOR_MODES:
|
||||
mon_model.append([m, m])
|
||||
@ -271,14 +271,14 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
validate_list = self.widget("arp-validate")
|
||||
validate_model = Gtk.ListStore(str)
|
||||
validate_list.set_model(validate_model)
|
||||
uiutil.set_combo_text_column(validate_list, 0)
|
||||
uiutil.init_combo_text_column(validate_list, 0)
|
||||
for m in Interface.INTERFACE_BOND_MONITOR_MODE_ARP_VALIDATE_MODES:
|
||||
validate_model.append([m])
|
||||
|
||||
carrier_list = self.widget("mii-carrier")
|
||||
carrier_model = Gtk.ListStore(str)
|
||||
carrier_list.set_model(carrier_model)
|
||||
uiutil.set_combo_text_column(carrier_list, 0)
|
||||
uiutil.init_combo_text_column(carrier_list, 0)
|
||||
for m in Interface.INTERFACE_BOND_MONITOR_MODE_MII_CARRIER_TYPES:
|
||||
carrier_model.append([m])
|
||||
|
||||
@ -286,13 +286,13 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
copy_iface = self.widget("ip-copy-interface-combo")
|
||||
copy_model = Gtk.ListStore(str, object, bool)
|
||||
copy_iface.set_model(copy_model)
|
||||
uiutil.set_combo_text_column(copy_iface, 0)
|
||||
uiutil.init_combo_text_column(copy_iface, 0)
|
||||
copy_iface.add_attribute(txt, "sensitive", 2)
|
||||
|
||||
ip_mode = self.widget("ipv4-mode")
|
||||
ip_model = Gtk.ListStore(str)
|
||||
ip_mode.set_model(ip_model)
|
||||
uiutil.set_combo_text_column(ip_mode, 0)
|
||||
uiutil.init_combo_text_column(ip_mode, 0)
|
||||
ip_model.insert(IP_DHCP, ["DHCP"])
|
||||
ip_model.insert(IP_STATIC, ["Static"])
|
||||
ip_model.insert(IP_NONE, ["No configuration"])
|
||||
@ -300,7 +300,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
ip_mode = self.widget("ipv6-mode")
|
||||
ip_model = Gtk.ListStore(str)
|
||||
ip_mode.set_model(ip_model)
|
||||
uiutil.set_combo_text_column(ip_mode, 0)
|
||||
uiutil.init_combo_text_column(ip_mode, 0)
|
||||
ip_model.insert(IP_DHCP, ["DHCP"])
|
||||
ip_model.insert(IP_STATIC, ["Static"])
|
||||
ip_model.insert(IP_NONE, ["No configuration"])
|
||||
|
@ -123,13 +123,13 @@ class vmmCreateNetwork(vmmGObjectUI):
|
||||
fw_list = self.widget("net-forward")
|
||||
fw_model = Gtk.ListStore(str, str)
|
||||
fw_list.set_model(fw_model)
|
||||
uiutil.set_combo_text_column(fw_list, 0)
|
||||
uiutil.init_combo_text_column(fw_list, 0)
|
||||
|
||||
# [ label, mode ]
|
||||
mode_list = self.widget("net-forward-mode")
|
||||
mode_model = Gtk.ListStore(str, str)
|
||||
mode_list.set_model(mode_model)
|
||||
uiutil.set_combo_text_column(mode_list, 0)
|
||||
uiutil.init_combo_text_column(mode_list, 0)
|
||||
|
||||
mode_model.append([_("NAT"), "nat"])
|
||||
mode_model.append([_("Routed"), "route"])
|
||||
|
@ -89,12 +89,12 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
type_list = self.widget("pool-type")
|
||||
type_model = Gtk.ListStore(str, str)
|
||||
type_list.set_model(type_model)
|
||||
uiutil.set_combo_text_column(type_list, 1)
|
||||
uiutil.init_combo_text_column(type_list, 1)
|
||||
|
||||
format_list = self.widget("pool-format")
|
||||
format_model = Gtk.ListStore(str, str)
|
||||
format_list.set_model(format_model)
|
||||
uiutil.set_combo_text_column(format_list, 1)
|
||||
uiutil.init_combo_text_column(format_list, 1)
|
||||
|
||||
# Target path combo box entry
|
||||
target_list = self.widget("pool-target-path")
|
||||
|
@ -123,7 +123,7 @@ class vmmCreateVolume(vmmGObjectUI):
|
||||
format_list = self.widget("vol-format")
|
||||
format_model = Gtk.ListStore(str, str)
|
||||
format_list.set_model(format_model)
|
||||
uiutil.set_combo_text_column(format_list, 1)
|
||||
uiutil.init_combo_text_column(format_list, 1)
|
||||
|
||||
|
||||
def _make_stub_vol(self):
|
||||
|
@ -780,7 +780,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
machtype_combo = self.widget("machine-type")
|
||||
machtype_model = Gtk.ListStore(str)
|
||||
machtype_combo.set_model(machtype_model)
|
||||
uiutil.set_combo_text_column(machtype_combo, 0)
|
||||
uiutil.init_combo_text_column(machtype_combo, 0)
|
||||
machtype_model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
|
||||
machines = []
|
||||
@ -1037,7 +1037,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
combo = self.widget("controller-model")
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
combo.set_active(-1)
|
||||
|
||||
|
||||
@ -1099,7 +1099,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
def set_hw_selection(self, page, disable_apply=True):
|
||||
if disable_apply:
|
||||
self.disable_apply()
|
||||
uiutil.set_list_selection(self.widget("hw-list"), page)
|
||||
uiutil.select_list_row_by_number(self.widget("hw-list"), page)
|
||||
|
||||
def get_hw_row(self):
|
||||
return uiutil.get_list_selection(self.widget("hw-list"), None)
|
||||
@ -2644,7 +2644,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
ignore = vm
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
model.append([None, _("Hypervisor default")])
|
||||
model.append(["filtered", "filtered"])
|
||||
model.append(["unfiltered", "unfiltered"])
|
||||
|
@ -89,7 +89,7 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
combo = self.widget(comboname)
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
if sort:
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
if capitalize:
|
||||
|
@ -71,13 +71,13 @@ class vmmGraphicsDetails(vmmGObjectUI):
|
||||
graphics_list = self.widget("graphics-type")
|
||||
graphics_model = Gtk.ListStore(str, str)
|
||||
graphics_list.set_model(graphics_model)
|
||||
uiutil.set_combo_text_column(graphics_list, 1)
|
||||
uiutil.init_combo_text_column(graphics_list, 1)
|
||||
graphics_model.clear()
|
||||
graphics_model.append(["spice", _("Spice server")])
|
||||
graphics_model.append(["vnc", _("VNC server")])
|
||||
|
||||
self.widget("graphics-address").set_model(Gtk.ListStore(str, str))
|
||||
uiutil.set_combo_text_column(self.widget("graphics-address"), 1)
|
||||
uiutil.init_combo_text_column(self.widget("graphics-address"), 1)
|
||||
|
||||
model = self.widget("graphics-address").get_model()
|
||||
model.clear()
|
||||
@ -89,7 +89,7 @@ class vmmGraphicsDetails(vmmGObjectUI):
|
||||
combo = self.widget("graphics-keymap")
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
model.append(["auto", "Auto"])
|
||||
model.append([virtinst.VirtualGraphics.KEYMAP_LOCAL,
|
||||
|
@ -346,8 +346,8 @@ class vmmHost(vmmGObjectUI):
|
||||
_("Libvirt connection does not support interface management."))
|
||||
|
||||
if conn_active:
|
||||
uiutil.set_list_selection(self.widget("net-list"), 0)
|
||||
uiutil.set_list_selection(self.widget("interface-list"), 0)
|
||||
uiutil.select_list_row_by_number(self.widget("net-list"), 0)
|
||||
uiutil.select_list_row_by_number(self.widget("interface-list"), 0)
|
||||
return
|
||||
|
||||
self.set_net_error_page(_("Connection not active."))
|
||||
@ -708,7 +708,7 @@ class vmmHost(vmmGObjectUI):
|
||||
Gtk.IconSize.LARGE_TOOLBAR,
|
||||
bool(net.is_active())])
|
||||
|
||||
uiutil.set_row_selection(net_list,
|
||||
uiutil.select_list_row_by_value(net_list,
|
||||
curnet and curnet.get_connkey() or None)
|
||||
|
||||
|
||||
@ -959,7 +959,7 @@ class vmmHost(vmmGObjectUI):
|
||||
"network-idle", Gtk.IconSize.LARGE_TOOLBAR,
|
||||
bool(iface.is_active())])
|
||||
|
||||
uiutil.set_row_selection(iface_list,
|
||||
uiutil.select_list_row_by_value(iface_list,
|
||||
curiface and curiface.get_connkey() or None)
|
||||
|
||||
def populate_interface_children(self):
|
||||
|
@ -88,7 +88,7 @@ class vmmNetworkList(vmmGObjectUI):
|
||||
# [xml value, label]
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
model.append(["bridge", "Bridge"])
|
||||
model.append(["vepa", "VEPA"])
|
||||
@ -100,7 +100,7 @@ class vmmNetworkList(vmmGObjectUI):
|
||||
# [xml value, label]
|
||||
model = Gtk.ListStore(str, str)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
self.conn.connect("net-added", self._repopulate_network_list)
|
||||
self.conn.connect("net-removed", self._repopulate_network_list)
|
||||
|
@ -110,7 +110,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
[2, _("Always")]]:
|
||||
model.append(row)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
combo = self.widget("prefs-console-resizeguest")
|
||||
# [gsettings value, string]
|
||||
@ -124,7 +124,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
for key, val in vals.items():
|
||||
model.append([key, val])
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
combo = self.widget("prefs-graphics-type")
|
||||
# [gsettings value, string]
|
||||
@ -134,7 +134,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
["vnc", "VNC"], ["spice", "Spice"]]:
|
||||
model.append(row)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
combo = self.widget("prefs-add-spice-usbredir")
|
||||
# [gsettings value, string]
|
||||
@ -144,7 +144,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
["yes", "Yes"], ["no", "No"]]:
|
||||
model.append(row)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
combo = self.widget("prefs-storage-format")
|
||||
# [gsettings value, string]
|
||||
@ -155,7 +155,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
["qcow2", "QCOW2"]]:
|
||||
model.append(row)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
combo = self.widget("prefs-cpu-default")
|
||||
# [gsettings value, string]
|
||||
@ -167,7 +167,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
["host-model", _("Copy host CPU definition")]]:
|
||||
model.append(row)
|
||||
combo.set_model(model)
|
||||
uiutil.set_combo_text_column(combo, 1)
|
||||
uiutil.init_combo_text_column(combo, 1)
|
||||
|
||||
|
||||
#########################
|
||||
@ -188,11 +188,11 @@ class vmmPreferences(vmmGObjectUI):
|
||||
def refresh_console_scaling(self):
|
||||
combo = self.widget("prefs-console-scaling")
|
||||
val = self.config.get_console_scaling()
|
||||
uiutil.set_row_selection(combo, val)
|
||||
uiutil.select_list_row_by_value(combo, val)
|
||||
def refresh_console_resizeguest(self):
|
||||
combo = self.widget("prefs-console-resizeguest")
|
||||
val = self.config.get_console_resizeguest()
|
||||
uiutil.set_row_selection(combo, val)
|
||||
uiutil.select_list_row_by_value(combo, val)
|
||||
|
||||
def refresh_new_vm_sound(self):
|
||||
self.widget("prefs-new-vm-sound").set_active(
|
||||
@ -200,19 +200,19 @@ class vmmPreferences(vmmGObjectUI):
|
||||
def refresh_graphics_type(self):
|
||||
combo = self.widget("prefs-graphics-type")
|
||||
gtype = self.config.get_graphics_type(raw=True)
|
||||
uiutil.set_row_selection(combo, gtype)
|
||||
uiutil.select_list_row_by_value(combo, gtype)
|
||||
def refresh_add_spice_usbredir(self):
|
||||
combo = self.widget("prefs-add-spice-usbredir")
|
||||
val = self.config.get_add_spice_usbredir(raw=True)
|
||||
uiutil.set_row_selection(combo, val)
|
||||
uiutil.select_list_row_by_value(combo, val)
|
||||
def refresh_storage_format(self):
|
||||
combo = self.widget("prefs-storage-format")
|
||||
val = self.config.get_default_storage_format(raw=True)
|
||||
uiutil.set_row_selection(combo, val)
|
||||
uiutil.select_list_row_by_value(combo, val)
|
||||
def refresh_cpu_default(self):
|
||||
combo = self.widget("prefs-cpu-default")
|
||||
val = self.config.get_default_cpu_setting(raw=True)
|
||||
uiutil.set_row_selection(combo, val)
|
||||
uiutil.select_list_row_by_value(combo, val)
|
||||
|
||||
def refresh_cpu_poll(self):
|
||||
self.widget("prefs-stats-enable-cpu").set_active(
|
||||
|
@ -54,7 +54,7 @@ class vmmStorageBrowser(vmmGObjectUI):
|
||||
if not self._first_run:
|
||||
self._first_run = True
|
||||
pool = self.conn.get_default_pool()
|
||||
uiutil.set_row_selection(self.storagelist.widget("pool-list"),
|
||||
uiutil.select_list_row_by_value(self.storagelist.widget("pool-list"),
|
||||
pool and pool.get_connkey() or None)
|
||||
|
||||
self.topwin.set_transient_for(parent)
|
||||
|
@ -399,7 +399,7 @@ class vmmStorageList(vmmGObjectUI):
|
||||
model.append(row)
|
||||
pool_list.set_model(model)
|
||||
|
||||
uiutil.set_row_selection(pool_list,
|
||||
uiutil.select_list_row_by_value(pool_list,
|
||||
curpool and curpool.get_connkey() or None)
|
||||
|
||||
def _populate_vols(self):
|
||||
@ -513,7 +513,7 @@ class vmmStorageList(vmmGObjectUI):
|
||||
# signal arrives only after pool-added. So all we do here is
|
||||
# select the pool we just created.
|
||||
ignore = src
|
||||
uiutil.set_row_selection(self.widget("pool-list"), connkey)
|
||||
uiutil.select_list_row_by_value(self.widget("pool-list"), connkey)
|
||||
|
||||
def _vol_created(self, src, pool_connkey, volname):
|
||||
# The vol list will have already been updated, since this
|
||||
@ -525,7 +525,7 @@ class vmmStorageList(vmmGObjectUI):
|
||||
return
|
||||
|
||||
# Select the new volume
|
||||
uiutil.set_row_selection(self.widget("vol-list"), volname)
|
||||
uiutil.select_list_row_by_value(self.widget("vol-list"), volname)
|
||||
|
||||
def _pool_autostart_changed(self, src):
|
||||
ignore = src
|
||||
@ -566,7 +566,7 @@ class vmmStorageList(vmmGObjectUI):
|
||||
_("Libvirt connection does not support storage management."))
|
||||
|
||||
if conn_active:
|
||||
uiutil.set_list_selection(self.widget("pool-list"), 0)
|
||||
uiutil.select_list_row_by_number(self.widget("pool-list"), 0)
|
||||
return
|
||||
|
||||
self._set_storage_error_page(_("Connection not active."))
|
||||
|
@ -29,7 +29,7 @@ except (ValueError, AttributeError):
|
||||
can_set_row_none = False
|
||||
|
||||
|
||||
def set_combo_text_column(combo, col):
|
||||
def init_combo_text_column(combo, col):
|
||||
"""
|
||||
Set the text column of the passed combo to 'col'. Does the
|
||||
right thing whether it's a plain combo or a comboboxentry. Saves
|
||||
@ -84,7 +84,7 @@ def get_list_selection(widget, rowindex, check_visible=False):
|
||||
return row[rowindex]
|
||||
|
||||
|
||||
def set_list_selection(widget, rownum):
|
||||
def select_list_row_by_number(widget, rownum):
|
||||
"""
|
||||
Helper to set list selection from the passed row number
|
||||
"""
|
||||
@ -96,7 +96,7 @@ def set_list_selection(widget, rownum):
|
||||
selection.select_path(path)
|
||||
|
||||
|
||||
def set_row_selection(listwidget, prevkey):
|
||||
def select_list_row_by_value(listwidget, prevkey, column=0):
|
||||
"""
|
||||
Set a list or tree selection given the passed key. The key is
|
||||
expected to be element 0 in the list rows.
|
||||
@ -105,7 +105,7 @@ def set_row_selection(listwidget, prevkey):
|
||||
_iter = None
|
||||
if prevkey is not None:
|
||||
for row in model:
|
||||
if row[0] == prevkey:
|
||||
if row[column] == prevkey:
|
||||
_iter = row.iter
|
||||
break
|
||||
if not _iter:
|
||||
|
Loading…
x
Reference in New Issue
Block a user