Replace set_property("visible") with modern set_visible

This commit is contained in:
Cole Robinson 2013-09-01 20:18:14 -04:00
parent 1ce02cc7d9
commit 9d87b0d342
10 changed files with 50 additions and 58 deletions

View File

@ -931,12 +931,12 @@ class vmmAddHardware(vmmGObjectUI):
combo = self.widget(basename + "-combo")
label = self.widget(basename + "-label")
combo.set_property("visible", show_combo)
label.set_property("visible", not show_combo)
combo.set_visible(show_combo)
label.set_visible(not show_combo)
def show_check_button(self, basename, show):
check = self.widget(basename)
check.set_property("visible", show)
check.set_visible(show)
# Storage listeners
def browse_storage(self, ignore1):
@ -1076,11 +1076,10 @@ class vmmAddHardware(vmmGObjectUI):
if make_visible:
show_something = True
self.widget(widget_name).set_property("visible", make_visible)
self.widget(widget_name + "-label").set_property("visible",
make_visible)
self.widget(widget_name).set_visible(make_visible)
self.widget(widget_name + "-label").set_visible(make_visible)
self.widget("tpm-param-box").set_property("visible", show_something)
self.widget("tpm-param-box").set_visible(show_something)
def change_char_device_type(self, src):
self._update_doc("type")
@ -1101,11 +1100,10 @@ class vmmAddHardware(vmmGObjectUI):
if make_visible:
show_something = True
self.widget(widget_name).set_property("visible", make_visible)
self.widget(widget_name + "-label").set_property("visible",
make_visible)
self.widget(widget_name).set_visible(make_visible)
self.widget(widget_name + "-label").set_visible(make_visible)
self.widget("char-param-box").set_property("visible", show_something)
self.widget("char-param-box").set_visible(show_something)
has_mode = self._dev.supports_property("source_mode")
if has_mode and self.widget("char-mode").get_active() == -1:

View File

@ -330,8 +330,8 @@ class vmmCloneVM(vmmGObjectUI):
build_net_row(label, mac, newmac)
no_net = bool(len(self.net_list.keys()) == 0)
self.widget("clone-network-box").set_property("visible", not no_net)
self.widget("clone-no-net").set_property("visible", no_net)
self.widget("clone-network-box").set_visible(not no_net)
self.widget("clone-no-net").set_visible(no_net)
def check_all_storage(self):
"""
@ -560,10 +560,8 @@ class vmmCloneVM(vmmGObjectUI):
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)
self.widget("clone-storage-box").set_visible(not no_storage)
self.widget("clone-no-storage-pass").set_visible(no_storage)
skip_targets = []
new_disks = []

View File

@ -503,10 +503,8 @@ class vmmCreate(vmmGObjectUI):
# Container install options
method_container_app.set_active(True)
self.widget("virt-install-box").set_property("visible",
not is_container)
self.widget("container-install-box").set_property("visible",
is_container)
self.widget("virt-install-box").set_visible(not is_container)
self.widget("container-install-box").set_visible(is_container)
# Install local
iso_option = self.widget("install-local-iso")
@ -602,11 +600,11 @@ class vmmCreate(vmmGObjectUI):
net_expander.set_expanded(True)
if do_tooltip:
net_warn_icon.set_property("visible", show_warn)
net_warn_icon.set_visible(show_warn)
if msg:
net_warn_icon.set_tooltip_text(show_warn and msg or "")
else:
net_warn_box.set_property("visible", show_warn)
net_warn_box.set_visible(show_warn)
markup = show_warn and ("<small>%s</small>" % msg) or ""
net_warn_label.set_markup(markup)
@ -875,7 +873,7 @@ class vmmCreate(vmmGObjectUI):
title = "Ready to begin installation of <b>%s</b>" % self.guest.name
self.widget("finish-warn-os").set_property("visible", not have_os)
self.widget("finish-warn-os").set_visible(not have_os)
self.widget("summary-title").set_markup(title)
self.widget("summary-os").set_text(osstr)
self.widget("summary-install").set_text(install)
@ -1262,7 +1260,7 @@ class vmmCreate(vmmGObjectUI):
# at the moment
iscontainer = instpage in [INSTALL_PAGE_CONTAINER_APP,
INSTALL_PAGE_CONTAINER_OS]
osbox.set_property("visible", iscontainer)
osbox.set_visible(iscontainer)
# Detection only works/ is valid for URL,
# FIXME: Also works for CDROM if running as root (since we need to

View File

@ -392,8 +392,8 @@ class vmmCreateInterface(vmmGObjectUI):
for key, value in type_dict.items():
do_show = (key == itype)
self.widget("%s-label" % value).set_property("visible", do_show)
self.widget("%s-box" % value).set_property("visible", do_show)
self.widget("%s-label" % value).set_visible(do_show)
self.widget("%s-box" % value).set_visible(do_show)
if itype == Interface.Interface.INTERFACE_TYPE_BRIDGE:
self.update_bridge_desc()

View File

@ -288,8 +288,8 @@ class vmmCreatePool(vmmGObjectUI):
def show_options_by_pool(self):
def show_row(base, do_show):
self.widget(base + "-label").set_property("visible", do_show)
self.widget(base + "-box").set_property("visible", do_show)
self.widget(base + "-label").set_visible(do_show)
self.widget(base + "-box").set_visible(do_show)
src = hasattr(self._pool, "source_path")
src_b = src and not self.conn.is_remote()

View File

@ -974,7 +974,7 @@ class vmmDetails(vmmGObjectUI):
# Disk iotune expander
if not (self.conn.is_qemu() or self.conn.is_test_conn()):
self.widget("iotune-expander").set_property("visible", False)
self.widget("iotune-expander").set_visible(False)
# Network source
net_source = self.widget("network-source-combo")
@ -1064,8 +1064,8 @@ class vmmDetails(vmmGObjectUI):
if model_in_list:
idx = model_list.index(value)
model_label.set_property("visible", not model_in_list)
model_combo.set_property("visible", model_in_list)
model_label.set_visible(not model_in_list)
model_combo.set_visible(model_in_list)
model_label.set_text(label or "")
if model_in_list:
@ -1264,7 +1264,7 @@ class vmmDetails(vmmGObjectUI):
rem = pagetype in remove_pages
self.disable_apply()
self.widget("config-remove").set_property("visible", rem)
self.widget("config-remove").set_visible(rem)
self.widget("hw-panel").set_current_page(pagetype)
@ -1732,7 +1732,7 @@ class vmmDetails(vmmGObjectUI):
# Warn about overcommit
warn = bool(cur > host_active_count)
self.widget("config-vcpus-warn-box").set_property("visible", warn)
self.widget("config-vcpus-warn-box").set_visible(warn)
maxadj = self.widget("config-maxvcpus")
maxval = self.config_get_maxvcpus()
@ -2708,7 +2708,7 @@ class vmmDetails(vmmGObjectUI):
# Warn about overcommit
warn = bool(self.config_get_vcpus() > host_active_count)
self.widget("config-vcpus-warn-box").set_property("visible", warn)
self.widget("config-vcpus-warn-box").set_visible(warn)
def _refresh_cpu_pinning(self):
# Populate VCPU pinning
vcpupin = self.vm.vcpu_pinning()
@ -2963,7 +2963,7 @@ class vmmDetails(vmmGObjectUI):
# Virtualport config
show_vport = (nettype == "direct")
vport = net.virtualport
self.widget("vport-expander").set_property("visible", show_vport)
self.widget("vport-expander").set_visible(show_vport)
self.widget("vport-type").set_text(vport.type or "")
self.widget("vport-managerid").set_text(str(vport.managerid) or "")
self.widget("vport-typeid").set_text(str(vport.typeid) or "")
@ -3132,8 +3132,8 @@ class vmmDetails(vmmGObjectUI):
if not val and doshow:
val = getattr(tpmdev, param)
self.widget(widgetname).set_property("visible", doshow)
self.widget(labelname).set_property("visible", doshow)
self.widget(widgetname).set_visible(doshow)
self.widget(labelname).set_visible(doshow)
self.widget(widgetname).set_text(val or "-")
dev_type = tpmdev.type
@ -3163,8 +3163,8 @@ class vmmDetails(vmmGObjectUI):
if not val and doshow:
val = getattr(chardev, param)
self.widget(widgetname).set_property("visible", doshow)
self.widget(labelname).set_property("visible", doshow)
self.widget(widgetname).set_visible(doshow)
self.widget(labelname).set_visible(doshow)
self.widget(widgetname).set_text(val or "-")
def build_host_str(base):
@ -3334,9 +3334,9 @@ class vmmDetails(vmmGObjectUI):
show_init = self.vm.is_container()
show_boot = (not self.vm.is_container() and not self.vm.is_xenpv())
self.widget("boot-order-align").set_property("visible", show_boot)
self.widget("boot-kernel-align").set_property("visible", show_kernel)
self.widget("boot-init-align").set_property("visible", show_init)
self.widget("boot-order-align").set_visible(show_boot)
self.widget("boot-kernel-align").set_visible(show_kernel)
self.widget("boot-init-align").set_visible(show_init)
# Kernel/initrd boot
kernel, initrd, dtb, args = self.vm.get_boot_kernel_info()
@ -3681,5 +3681,5 @@ class vmmDetails(vmmGObjectUI):
combo = self.widget(basename)
label = self.widget(basename + "-title")
combo.set_property("visible", show)
label.set_property("visible", show)
combo.set_visible(show)
label.set_visible(show)

View File

@ -1181,10 +1181,8 @@ class vmmHost(vmmGObjectUI):
self.widget("interface-inuseby").set_text(used_by or "-")
# IP info
self.widget("interface-ipv4-expander").set_property("visible",
bool(ipv4))
self.widget("interface-ipv6-expander").set_property("visible",
bool(ipv6))
self.widget("interface-ipv4-expander").set_visible(bool(ipv4))
self.widget("interface-ipv6-expander").set_visible(bool(ipv6))
if ipv4:
mode = ipv4[0] and "DHCP" or "Static"
@ -1216,7 +1214,7 @@ class vmmHost(vmmGObjectUI):
show_child = (children or
itype in [Interface.Interface.INTERFACE_TYPE_BRIDGE,
Interface.Interface.INTERFACE_TYPE_BOND])
self.widget("interface-child-box").set_property("visible", show_child)
self.widget("interface-child-box").set_visible(show_child)
self.populate_interface_children()
def refresh_interface(self, src_ignore, name):

View File

@ -1029,9 +1029,9 @@ class vmmManager(vmmGObjectUI):
self.vmmenu_items["run"].set_sensitive(run)
self.vmmenu_items["shutdown"].set_sensitive(stop)
self.vmmenu_items["pause"].set_property("visible", not paused)
self.vmmenu_items["pause"].set_visible(not paused)
self.vmmenu_items["pause"].set_sensitive(stop)
self.vmmenu_items["resume"].set_property("visible", paused)
self.vmmenu_items["resume"].set_visible(paused)
self.vmmenu_items["resume"].set_sensitive(paused)
self.vmmenu_items["migrate"].set_sensitive(stop)
self.vmmenu_items["clone"].set_sensitive(not ro)

View File

@ -441,8 +441,8 @@ class vmmSystray(vmmGObject):
actions["reset"].set_sensitive(vm.is_destroyable())
actions["destroy"].set_sensitive(vm.is_destroyable())
actions["pause"].set_property("visible", not is_paused)
actions["resume"].set_property("visible", is_paused)
actions["pause"].set_visible(not is_paused)
actions["resume"].set_visible(is_paused)
def run_vm_action(self, ignore, signal_name, uuid):
uri = None

View File

@ -517,13 +517,13 @@ def net_list_changed(net_list, bridge_box,
if source_mode_box is not None:
show_source_mode = (row[0] ==
virtinst.VirtualNetworkInterface.TYPE_DIRECT)
source_mode_box.set_property("visible", show_source_mode)
source_mode_label.set_property("visible", show_source_mode)
vport_expander.set_property("visible", show_source_mode)
source_mode_box.set_visible(show_source_mode)
source_mode_label.set_visible(show_source_mode)
vport_expander.set_visible(show_source_mode)
show_bridge = row[5]
bridge_box.set_property("visible", show_bridge)
bridge_box.set_visible(show_bridge)
def get_network_selection(net_list, bridge_entry):