本文整理汇总了Python中virtManager.uiutil.get_list_selection函数的典型用法代码示例。如果您正苦于以下问题:Python get_list_selection函数的具体用法?Python get_list_selection怎么用?Python get_list_selection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_list_selection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validate_bond
def validate_bond(self, iobj, ifaces):
mode = uiutil.get_list_selection(self.widget("bond-mode"), 1)
mon = uiutil.get_list_selection(self.widget("bond-monitor-mode"), 1)
arp_val = uiutil.get_list_selection(self.widget("arp-validate"), 0)
mii_car = uiutil.get_list_selection(self.widget("mii-carrier"), 0)
# ARP params
arp_int = self.widget("arp-interval").get_value()
arp_tar = self.widget("arp-target").get_text()
# MII params
mii_freq = self.widget("mii-frequency").get_value()
mii_up = self.widget("mii-updelay").get_value()
mii_down = self.widget("mii-downdelay").get_value()
iobj.bond_mode = mode
if not mon:
# No monitor params, just return
return True
if mon == "arpmon":
iobj.arp_validate_mode = arp_val
iobj.arp_interval = int(arp_int)
iobj.arp_target = arp_tar or None
elif mon == "miimon":
iobj.mii_carrier_mode = mii_car
iobj.mii_frequency = int(mii_freq)
iobj.mii_updelay = int(mii_up)
iobj.mii_downdelay = int(mii_down)
return True
示例2: get_config_forwarding
def get_config_forwarding(self):
if self.widget("net-forward-none").get_active():
return [None, None]
name = uiutil.get_list_selection(self.widget("net-forward"), 1)
mode = uiutil.get_list_selection(self.widget("net-forward-mode"), 1)
return [name, mode]
示例3: update_bond_desc
def update_bond_desc(self):
mode = uiutil.get_list_selection(self.widget("bond-mode"), 0)
mon = uiutil.get_list_selection(self.widget("bond-monitor-mode"), 1)
txt = mode
if mon:
txt += ", %s" % mon
self.widget("bond-config-label").set_text(txt)
示例4: get_values
def get_values(self):
gtype = uiutil.get_list_selection(self.widget("graphics-type"), 0)
port, tlsport = self._get_config_graphics_ports()
addr = uiutil.get_list_selection(self.widget("graphics-address"), 0)
keymap = uiutil.get_combo_entry(self.widget("graphics-keymap"))
if keymap == "auto":
keymap = None
passwd = self.widget("graphics-password").get_text()
if not self.widget("graphics-password-chk").get_active():
passwd = None
return gtype, port, tlsport, addr, passwd, keymap
示例5: get_pool_to_validate
def get_pool_to_validate(self):
"""
Return a pool instance to use for parameter assignment validation.
For most pools this will be the one we built after step 1, but for
pools we find via FindPoolSources, this will be different
"""
source_list = self.widget("pool-source-path")
target_list = self.widget("pool-target-path")
pool = uiutil.get_list_selection(source_list, 2)
if pool is None:
pool = uiutil.get_list_selection(target_list, 2)
return pool
示例6: destconn_changed
def destconn_changed(self, src):
row = uiutil.get_list_selection(src, None)
tooltip = ""
if row:
tooltip = _("A valid destination connection must be selected.")
self.widget("migrate-finish").set_sensitive(bool(row))
self.widget("migrate-finish").set_tooltip_text(tooltip)
示例7: current_pool
def current_pool(self):
row = uiutil.get_list_selection(self.widget("pool-list"))
if not row:
return
try:
return self.conn.get_pool(row[0])
except KeyError:
return None
示例8: get_config_source_path
def get_config_source_path(self):
src = self.widget("pool-source-path")
if not src.get_sensitive():
return None
ret = uiutil.get_list_selection(src, 1)
if ret is not None:
return ret
return src.get_child().get_text().strip()
示例9: current_vol
def current_vol(self):
pool = self.current_pool()
if not pool:
return None
key = uiutil.get_list_selection(self.widget("vol-list"), 0)
try:
return key and pool.get_volume(key)
except KeyError:
return None
示例10: _repopulate_network_list
def _repopulate_network_list(self, *args, **kwargs):
ignore = args
ignore = kwargs
netlist = self.widget("net-source")
label = uiutil.get_list_selection(netlist, 2)
self._populate_network_list()
for row in netlist.get_model():
if label and row[2] == label:
netlist.set_active_iter(row.iter)
return
示例11: get_network_selection
def get_network_selection(self):
net_list = self.widget("net-source")
bridge_entry = self.widget("net-bridge-name")
row = uiutil.get_list_selection(net_list)
if not row:
return None, None, None
net_type = row[0]
net_src = row[1]
net_check_bridge = row[5]
if net_check_bridge and bridge_entry:
net_type = virtinst.VirtualNetworkInterface.TYPE_BRIDGE
net_src = bridge_entry.get_text()
mode = None
if self.widget("net-source-mode").is_visible():
mode = uiutil.get_list_selection(self.widget("net-source-mode"), 0)
return net_type, net_src, mode
示例12: bond_monitor_mode_changed
def bond_monitor_mode_changed(self, src):
value = uiutil.get_list_selection(src, 1)
bond_pages = self.widget("bond-pages")
if value == "arpmon":
page = BOND_PAGE_ARP
elif value == "miimon":
page = BOND_PAGE_MII
else:
page = BOND_PAGE_DEFAULT
bond_pages.set_current_page(page)
示例13: _get_selected_snapshot
def _get_selected_snapshot(self):
name = uiutil.get_list_selection(self.widget("snapshot-list"), 0)
if not name:
return None
try:
for snap in self.vm.list_snapshots():
if name == snap.get_name():
return snap
except:
pass
return None
示例14: _get_config_graphics_ports
def _get_config_graphics_ports(self):
port = uiutil.spin_get_helper(self.widget("graphics-port"))
tlsport = uiutil.spin_get_helper(self.widget("graphics-tlsport"))
gtype = uiutil.get_list_selection(self.widget("graphics-type"), 0)
if self.widget("graphics-port-auto").get_active():
port = -1
if self.widget("graphics-tlsport-auto").get_active():
tlsport = -1
if gtype != "spice":
tlsport = None
return port, tlsport
示例15: interface_apply
def interface_apply(self, src_ignore):
interface = self.current_interface()
if interface is None:
return
newmode = uiutil.get_list_selection(
self.widget("interface-startmode"), 0)
logging.debug("Applying changes for interface '%s'",
interface.get_name())
try:
interface.set_startmode(newmode)
except Exception, e:
self.err.show_err(_("Error setting interface startmode: %s") %
str(e))
return