uiutil: Rename select_list_row* to match getter functions

This commit is contained in:
Cole Robinson
2015-05-19 18:13:33 -04:00
parent 490aee74de
commit 23bf115024
8 changed files with 25 additions and 25 deletions

View File

@ -879,7 +879,7 @@ class vmmAddHardware(vmmGObjectUI):
break
if default_bus:
uiutil.select_list_row_by_value(widget, default_bus)
uiutil.set_list_selection(widget, default_bus)
elif len(model) > 0:
widget.set_active(0)
@ -913,7 +913,7 @@ class vmmAddHardware(vmmGObjectUI):
if len(model) == 0:
model.append([_("No Devices Available"), None, None, None])
uiutil.select_list_row_by_number(devlist, 0)
uiutil.set_list_selection_by_number(devlist, 0)
def _populate_disk_format_combo_wrapper(self, create):
format_list = self.widget("config-storage-format")
@ -983,7 +983,7 @@ class vmmAddHardware(vmmGObjectUI):
for xmlval, label in values:
model.append([xmlval, label])
if default:
uiutil.select_list_row_by_value(combo, default)
uiutil.set_list_selection(combo, default)
def _build_rng_type_combo(self, combo):
types = []
@ -1043,7 +1043,7 @@ class vmmAddHardware(vmmGObjectUI):
return VirtualSerialDevice
def _set_hw_selection(self, page):
uiutil.select_list_row_by_number(self.widget("hw-list"), page)
uiutil.set_list_selection_by_number(self.widget("hw-list"), page)
def _get_hw_selection(self):
return uiutil.get_list_selected_row(self.widget("hw-list"))
@ -1232,7 +1232,7 @@ class vmmAddHardware(vmmGObjectUI):
text == VirtualChannelDevice.CHANNEL_NAME_LIBGUESTFS):
settype = "unix"
if settype:
uiutil.select_list_row_by_value(
uiutil.set_list_selection(
self.widget("char-device-type"), settype)
def _change_char_device_type(self, src):

View File

@ -206,9 +206,9 @@ class vmmConnect(vmmGObjectUI):
def set_default_hypervisor(self):
default = self.default_uri()
if not default or default.startswith("qemu"):
uiutil.select_list_row_by_value(self.widget("hypervisor"), HV_QEMU)
uiutil.set_list_selection(self.widget("hypervisor"), HV_QEMU)
elif default.startswith("xen"):
uiutil.select_list_row_by_value(self.widget("hypervisor"), HV_XEN)
uiutil.set_list_selection(self.widget("hypervisor"), HV_XEN)
def add_service(self, interface, protocol, name, typ, domain, flags):
ignore = flags

View File

@ -1112,7 +1112,7 @@ class vmmDetails(vmmGObjectUI):
def set_hw_selection(self, page, disable_apply=True):
if disable_apply:
self.disable_apply()
uiutil.select_list_row_by_number(self.widget("hw-list"), page)
uiutil.set_list_selection_by_number(self.widget("hw-list"), page)
def get_hw_row(self):
return uiutil.get_list_selected_row(self.widget("hw-list"))

View File

@ -342,8 +342,8 @@ class vmmHost(vmmGObjectUI):
_("Libvirt connection does not support interface management."))
if conn_active:
uiutil.select_list_row_by_number(self.widget("net-list"), 0)
uiutil.select_list_row_by_number(self.widget("interface-list"), 0)
uiutil.set_list_selection_by_number(self.widget("net-list"), 0)
uiutil.set_list_selection_by_number(self.widget("interface-list"), 0)
return
self.set_net_error_page(_("Connection not active."))
@ -701,7 +701,7 @@ class vmmHost(vmmGObjectUI):
finally:
net_list.set_model(model)
uiutil.select_list_row_by_value(net_list,
uiutil.set_list_selection(net_list,
curnet and curnet.get_connkey() or None)
@ -951,7 +951,7 @@ class vmmHost(vmmGObjectUI):
finally:
iface_list.set_model(model)
uiutil.select_list_row_by_value(iface_list,
uiutil.set_list_selection(iface_list,
curiface and curiface.get_connkey() or None)
def populate_interface_children(self):

View File

@ -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.select_list_row_by_value(combo, val)
uiutil.set_list_selection(combo, val)
def refresh_console_resizeguest(self):
combo = self.widget("prefs-console-resizeguest")
val = self.config.get_console_resizeguest()
uiutil.select_list_row_by_value(combo, val)
uiutil.set_list_selection(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.select_list_row_by_value(combo, gtype)
uiutil.set_list_selection(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.select_list_row_by_value(combo, val)
uiutil.set_list_selection(combo, val)
def refresh_storage_format(self):
combo = self.widget("prefs-storage-format")
val = self.config.get_default_storage_format(raw=True)
uiutil.select_list_row_by_value(combo, val)
uiutil.set_list_selection(combo, val)
def refresh_cpu_default(self):
combo = self.widget("prefs-cpu-default")
val = self.config.get_default_cpu_setting(raw=True)
uiutil.select_list_row_by_value(combo, val)
uiutil.set_list_selection(combo, val)
def refresh_cpu_poll(self):
self.widget("prefs-stats-enable-cpu").set_active(

View File

@ -54,7 +54,7 @@ class vmmStorageBrowser(vmmGObjectUI):
if not self._first_run:
self._first_run = True
pool = self.conn.get_default_pool()
uiutil.select_list_row_by_value(self.storagelist.widget("pool-list"),
uiutil.set_list_selection(self.storagelist.widget("pool-list"),
pool and pool.get_connkey() or None)
self.topwin.set_transient_for(parent)

View File

@ -404,7 +404,7 @@ class vmmStorageList(vmmGObjectUI):
finally:
pool_list.set_model(model)
uiutil.select_list_row_by_value(pool_list,
uiutil.set_list_selection(pool_list,
curpool and curpool.get_connkey() or None)
def _populate_vols(self):
@ -520,7 +520,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.select_list_row_by_value(self.widget("pool-list"), connkey)
uiutil.set_list_selection(self.widget("pool-list"), connkey)
def _vol_created(self, src, pool_connkey, volname):
# The vol list will have already been updated, since this
@ -532,7 +532,7 @@ class vmmStorageList(vmmGObjectUI):
return
# Select the new volume
uiutil.select_list_row_by_value(self.widget("vol-list"), volname)
uiutil.set_list_selection(self.widget("vol-list"), volname)
def _pool_autostart_changed(self, src):
ignore = src
@ -573,7 +573,7 @@ class vmmStorageList(vmmGObjectUI):
_("Libvirt connection does not support storage management."))
if conn_active:
uiutil.select_list_row_by_number(self.widget("pool-list"), 0)
uiutil.set_list_selection_by_number(self.widget("pool-list"), 0)
return
self._set_storage_error_page(_("Connection not active."))

View File

@ -91,7 +91,7 @@ def get_list_selection(widget, column=0, check_visible=False):
# UI setter helpers #
#####################
def select_list_row_by_number(widget, rownum):
def set_list_selection_by_number(widget, rownum):
"""
Helper to set list selection from the passed row number
"""
@ -103,7 +103,7 @@ def select_list_row_by_number(widget, rownum):
selection.select_path(path)
def select_list_row_by_value(widget, value, column=0):
def set_list_selection(widget, value, column=0):
"""
Set a list or tree selection given the passed key, expected to
be stored at the specified column.