This commit is contained in:
Marek Marczykowski-Górecki 2014-09-09 22:27:58 +02:00
commit cd0118f7a6
2 changed files with 21 additions and 1 deletions

View File

@ -332,6 +332,13 @@ class QubesVm(object):
for hook in self.hooks_init:
hook(self)
def __repr__(self):
return '<{} at {:#0x} qid={!r} name={!r}>'.format(
self.__class__.__name__,
id(self),
self.qid,
self.name)
def absolute_path(self, arg, default):
if arg is not None and os.path.isabs(arg):
return arg

View File

@ -170,9 +170,11 @@ class QubesHost(object):
class QubesVmLabel(object):
def __init__(self, index, color, name, dispvm=False):
self.name = name
self.index = index
self.color = color
self.name = name
self.dispvm = dispvm
self.icon = '{}-{}'.format(('dispvm' if dispvm else 'appvm'), name)
# self.icon_path is obsolete
@ -180,6 +182,14 @@ class QubesVmLabel(object):
self.icon_path = os.path.join(
system_path['qubes_icon_dir'], self.icon) + ".png"
def __repr__(self):
return '{}({!r}, {!r}, {!r}, dispvm={!r})'.format(
self.__class__.__name__,
self.index,
self.color,
self.name,
self.dispvm)
# Globally defined lables
QubesVmLabels = {
"red": QubesVmLabel(1, "0xcc0000", "red" ),
@ -230,6 +240,9 @@ class QubesVmCollection(dict):
self.clockvm_qid = None
self.qubes_store_file = None
def __repr__(self):
return '<{} {!r}>'.format(self.__class__.__name__, list(sorted(self.keys())))
def values(self):
for qid in self.keys():
yield self[qid]