Lookup status icons based on libvirt constant, not the translatable(!) string

This commit is contained in:
Daniel P. Berrange 2006-08-08 11:51:58 -04:00
parent cf68b91069
commit 0c8c6f9d7a
2 changed files with 10 additions and 10 deletions

View File

@ -19,6 +19,7 @@
import gconf
import gtk.gdk
import libvirt
from virtManager.keyring import *
@ -39,16 +40,15 @@ class vmmConfig:
self.keyring = None
self.status_icons = {
"blocked": gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_blocked.png", 18, 18),
"crashed": gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_crashed.png", 18, 18),
"paused": gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_paused.png", 18, 18),
"running": gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_running.png", 18, 18),
"shutdown": gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_shutdown.png", 18, 18),
"shutoff": gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_shutoff.png", 18, 18),
"idle": gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_idle.png", 18, 18),
libvirt.VIR_DOMAIN_BLOCKED: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_blocked.png", 18, 18),
libvirt.VIR_DOMAIN_CRASHED: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_crashed.png", 18, 18),
libvirt.VIR_DOMAIN_PAUSED: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_paused.png", 18, 18),
libvirt.VIR_DOMAIN_RUNNING: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_running.png", 18, 18),
libvirt.VIR_DOMAIN_SHUTDOWN: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_shutdown.png", 18, 18),
libvirt.VIR_DOMAIN_SHUTOFF: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_shutoff.png", 18, 18),
libvirt.VIR_DOMAIN_NOSTATE: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_idle.png", 18, 18),
}
def get_vm_status_icon(self, state):
return self.status_icons[state]

View File

@ -20,6 +20,7 @@
import gobject
import libvirt
class vmmDomain(gobject.GObject):
__gsignals__ = {
"status-changed": (gobject.SIGNAL_RUN_FIRST,
@ -261,8 +262,7 @@ class vmmDomain(gobject.GObject):
raise _("Unknown status code")
def run_status_icon(self):
status = self.run_status()
return self.config.get_vm_status_icon(status.lower())
return self.config.get_vm_status_icon(self.status())
def get_console_info(self):
# XXX don't hardcode me! need to really extract info from