mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-13 13:17:57 +03:00
Wrap all tooltip calls so we don't fail on older gtk (i.e. RHEL5)
This commit is contained in:
parent
c5c6aa8944
commit
3c587e9dda
@ -36,6 +36,7 @@ from virtManager.error import vmmErrorDialog
|
||||
from virtManager.addhardware import vmmAddHardware
|
||||
from virtManager.choosecd import vmmChooseCD
|
||||
from virtManager.serialcon import vmmSerialConsole
|
||||
from virtManager import util as util
|
||||
|
||||
import virtinst
|
||||
|
||||
@ -501,7 +502,7 @@ class vmmDetails(gobject.GObject):
|
||||
sensitive = True
|
||||
|
||||
if not sensitive:
|
||||
item.set_tooltip_text(msg)
|
||||
util.tooltip_wrapper(item, msg)
|
||||
item.set_sensitive(sensitive)
|
||||
|
||||
if sensitive and self.dynamic_tabs.count(dev[0]):
|
||||
|
@ -36,6 +36,7 @@ from virtManager.asyncjob import vmmAsyncJob
|
||||
from virtManager.create import vmmCreate
|
||||
from virtManager.host import vmmHost
|
||||
from virtManager.error import vmmErrorDialog
|
||||
import virtManager.util as util
|
||||
|
||||
class vmmEngine(gobject.GObject):
|
||||
__gsignals__ = {
|
||||
@ -580,7 +581,7 @@ class vmmEngine(gobject.GObject):
|
||||
mitem.set_sensitive(can_migrate)
|
||||
mitem.connect("activate", migrate_func)
|
||||
if tooltip:
|
||||
mitem.set_tooltip_text(tooltip)
|
||||
util.tooltip_wrapper(mitem, tooltip)
|
||||
mitem.show()
|
||||
|
||||
menu.add(mitem)
|
||||
|
@ -30,6 +30,7 @@ import libvirt
|
||||
from virtManager.connection import vmmConnection
|
||||
from virtManager.asyncjob import vmmAsyncJob
|
||||
from virtManager.error import vmmErrorDialog
|
||||
from virtManager import util as util
|
||||
|
||||
VMLIST_SORT_ID = 1
|
||||
VMLIST_SORT_NAME = 2
|
||||
@ -853,12 +854,7 @@ class vmmManager(gobject.GObject):
|
||||
# Handle, name, ID, status, status icon, cpu, [cpu graph], vcpus, mem, mem bar, uuid, diskRead, diskWrite, netRx, netTx
|
||||
model = gtk.TreeStore(object, str, str, str, gtk.gdk.Pixbuf, str, int, str, int, str, str, int, int, int, int)
|
||||
vmlist.set_model(model)
|
||||
try:
|
||||
vmlist.set_tooltip_column(ROW_HINT)
|
||||
except:
|
||||
# Catch & ignore errors - set_tooltip_column is in gtk >= 2.12
|
||||
# and we can easily work with lower versions
|
||||
pass
|
||||
util.tooltip_wrapper(vmlist, ROW_HINT, "set_tooltip_column")
|
||||
|
||||
nameCol = gtk.TreeViewColumn(_("Name"))
|
||||
idCol = gtk.TreeViewColumn(_("ID"))
|
||||
@ -1020,15 +1016,17 @@ class vmmManager(gobject.GObject):
|
||||
widgn = "menu_view_network_traffic"
|
||||
widget = self.window.get_widget(widgn)
|
||||
|
||||
tool_text = ""
|
||||
if conf_entry and (conf_entry == True or \
|
||||
conf_entry.get_value().get_bool()):
|
||||
widget.set_sensitive(True)
|
||||
widget.set_tooltip_text("")
|
||||
else:
|
||||
if widget.get_active():
|
||||
widget.set_active(False)
|
||||
widget.set_sensitive(False)
|
||||
widget.set_tooltip_text(_("Disabled in preferences dialog."))
|
||||
tool_text = _("Disabled in preferences dialog.")
|
||||
|
||||
util.tooltip_wrapper(widget, tool_text)
|
||||
|
||||
def toggle_virtual_cpus_visible_conf(self, menu):
|
||||
self.config.set_vmlist_virtual_cpus_visible(menu.get_active())
|
||||
|
@ -52,3 +52,13 @@ def build_default_pool(conn):
|
||||
except Exception, e:
|
||||
raise RuntimeError(_("Couldn't create default storage pool '%s': %s") %
|
||||
(DEFAULT_POOL_PATH, str(e)))
|
||||
|
||||
def tooltip_wrapper(obj, txt, func="set_tooltip_text"):
|
||||
# Catch & ignore errors - set_tooltip_* is in gtk >= 2.12
|
||||
# and we can easily work with lower versions
|
||||
try:
|
||||
funcptr = getattr(obj, func)
|
||||
funcptr(txt)
|
||||
except:
|
||||
# XXX: Catch a specific error here
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user