QubesVmLabels(): introduce 'index' field, useful for sorting

This commit is contained in:
Joanna Rutkowska 2010-05-10 15:01:47 +02:00
parent cd20eeb8a4
commit da41cd2a4a

View File

@ -112,22 +112,23 @@ if not dry_run:
class QubesException (Exception) : pass class QubesException (Exception) : pass
class QubesVmLabel(object): class QubesVmLabel(object):
def __init__(self, name, color = None, icon = None): def __init__(self, name, index, color = None, icon = None):
self.name = name self.name = name
self.index = index
self.color = color if color is not None else name self.color = color if color is not None else name
self.icon = icon if icon is not None else name self.icon = icon if icon is not None else name
self.icon_path = "/usr/share/qubes/icons/" + self.icon + ".png" self.icon_path = "/usr/share/qubes/icons/" + self.icon + ".png"
# Globally defined lables # Globally defined lables
QubesVmLabels = { QubesVmLabels = {
"yellow" : QubesVmLabel ("yellow"), "red" : QubesVmLabel ("red", 0),
"orange" : QubesVmLabel ("orange"), "orange" : QubesVmLabel ("orange", 1),
"red" : QubesVmLabel ("red"), "yellow" : QubesVmLabel ("yellow", 2),
"purple" : QubesVmLabel ("purple", color="0xb83374"), "green" : QubesVmLabel ("green", 3, color="0x5fa05e"),
"green" : QubesVmLabel ("green", color="0x5fa05e"), "gray" : QubesVmLabel ("gray", 4),
"blue" : QubesVmLabel ("blue"), "blue" : QubesVmLabel ("blue", 5),
"gray" : QubesVmLabel ("gray"), "purple" : QubesVmLabel ("purple", 6, color="0xb83374"),
"black" : QubesVmLabel ("black"), "black" : QubesVmLabel ("black", 7),
} }
default_appvm_label = QubesVmLabels["red"] default_appvm_label = QubesVmLabels["red"]