labels need to be specified with colour code
also fixed duplicate QubesDispVmLabels
This commit is contained in:
Wojciech Porczyk 2014-01-10 16:58:46 +01:00 committed by Wojciech Zygmunt Porczyk
parent 631f5f8383
commit 962d3da42e
No known key found for this signature in database
GPG Key ID: 0E0BCB3897BA8CC9
2 changed files with 19 additions and 30 deletions

View File

@ -23,17 +23,7 @@
import sys import sys
from qubes.qubes import QubesVm,QubesVmLabel,register_qubes_vm_class from qubes.qubes import QubesVm,QubesVmLabel,register_qubes_vm_class
from qubes.qubes import QubesDispVmLabels
QubesDispVmLabels = {
"red" : QubesVmLabel ("red", 1, icon="dispvm-red"),
"orange" : QubesVmLabel ("orange", 2, icon="dispvm-orange"),
"yellow" : QubesVmLabel ("yellow", 3, icon="dispvm-yellow"),
"green" : QubesVmLabel ("green", 4, color="0x5fa05e", icon="dispvm-green"),
"gray" : QubesVmLabel ("gray", 5, icon="dispvm-gray"),
"blue" : QubesVmLabel ("blue", 6, icon="dispvm-blue"),
"purple" : QubesVmLabel ("purple", 7, color="0xb83374", icon="dispvm-purple"),
"black" : QubesVmLabel ("black", 8, icon="dispvm-black"),
}
class QubesDisposableVm(QubesVm): class QubesDisposableVm(QubesVm):
""" """
@ -93,5 +83,4 @@ class QubesDisposableVm(QubesVm):
return True return True
# register classes # register classes
sys.modules['qubes.qubes'].QubesDispVmLabels = QubesDispVmLabels
register_qubes_vm_class(QubesDisposableVm) register_qubes_vm_class(QubesDisposableVm)

View File

@ -166,35 +166,35 @@ class QubesHost(object):
return (current_time, current) return (current_time, current)
class QubesVmLabel(object): class QubesVmLabel(object):
def __init__(self, name, index, color = None, icon = None): def __init__(self, index, color, name, icon = None):
self.name = name self.name = name
self.index = index self.index = index
self.color = color if color is not None else name self.color = color
self.icon = icon if icon is not None else name self.icon = icon if icon is not None else name
self.icon_path = os.path.join( self.icon_path = os.path.join(
system_path['qubes_icon_dir'], self.icon) + ".png" system_path['qubes_icon_dir'], self.icon) + ".png"
# Globally defined lables # Globally defined lables
QubesVmLabels = { QubesVmLabels = {
"red" : QubesVmLabel ("red", 1), "red": QubesVmLabel(1, "0xcc0000", "red" ),
"orange" : QubesVmLabel ("orange", 2), "orange": QubesVmLabel(2, "0xf57900", "orange" ),
"yellow" : QubesVmLabel ("yellow", 3), "yellow": QubesVmLabel(3, "0xedd400", "yellow" ),
"green" : QubesVmLabel ("green", 4, color="0x5fa05e"), "green": QubesVmLabel(4, "0x73d216", "green" ),
"gray" : QubesVmLabel ("gray", 5), "gray": QubesVmLabel(5, "0x555753", "gray" ),
"blue" : QubesVmLabel ("blue", 6), "blue": QubesVmLabel(6, "0x3465a4", "blue" ),
"purple" : QubesVmLabel ("purple", 7, color="0xb83374"), "purple": QubesVmLabel(7, "0x75507b", "purple" ),
"black" : QubesVmLabel ("black", 8), "black": QubesVmLabel(8, "0x000000", "black" ),
} }
QubesDispVmLabels = { QubesDispVmLabels = {
"red" : QubesVmLabel ("red", 1, icon="dispvm-red"), "red": QubesVmLabel(1, "0xcc0000", "red", icon="dispvm-red" ),
"orange" : QubesVmLabel ("orange", 2, icon="dispvm-orange"), "orange": QubesVmLabel(2, "0xf57900", "orange", icon="dispvm-orange"),
"yellow" : QubesVmLabel ("yellow", 3, icon="dispvm-yellow"), "yellow": QubesVmLabel(3, "0xedd400", "yellow", icon="dispvm-yellow"),
"green" : QubesVmLabel ("green", 4, color="0x5fa05e", icon="dispvm-green"), "green": QubesVmLabel(4, "0x73d216", "green", icon="dispvm-green" ),
"gray" : QubesVmLabel ("gray", 5, icon="dispvm-gray"), "gray": QubesVmLabel(5, "0x555753", "gray", icon="dispvm-gray" ),
"blue" : QubesVmLabel ("blue", 6, icon="dispvm-blue"), "blue": QubesVmLabel(6, "0x3465a4", "blue", icon="dispvm-blue" ),
"purple" : QubesVmLabel ("purple", 7, color="0xb83374", icon="dispvm-purple"), "purple": QubesVmLabel(7, "0x75507b", "purple", icon="dispvm-purple"),
"black" : QubesVmLabel ("black", 8, icon="dispvm-black"), "black": QubesVmLabel(8, "0x000000", "black", icon="dispvm-black" ),
} }
defaults["appvm_label"] = QubesVmLabels["red"] defaults["appvm_label"] = QubesVmLabels["red"]