firstboot: add option to setup combined sys-net+sys-usb

Fixes QubesOS/qubes-issues#1629
release3.1
Marek Marczykowski-Górecki 8 years ago
parent 5a3df02a37
commit 098a2752af
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

@ -80,12 +80,14 @@ def started_from_usb():
class QubesChoice(object):
instances = []
def __init__(self, label, states, depend=None, extra_check=None):
def __init__(self, label, states, depend=None, extra_check=None,
replace=None):
self.widget = gtk.CheckButton(label)
self.states = states
self.depend = depend
self.extra_check = extra_check
self.selected = None
self.replace = replace
if self.depend is not None:
self.depend.widget.connect('toggled', self.friend_on_toggled)
@ -122,10 +124,17 @@ class QubesChoice(object):
@classmethod
def get_states(cls):
replaced = reduce(
lambda x, y: x+y if y else x,
(choice.replace for choice in cls.instances if
choice.get_selected()),
()
)
for choice in cls.instances:
if choice.get_selected():
for state in choice.states:
yield state
if state not in replaced:
yield state
class DisabledChoice(QubesChoice):
@ -382,6 +391,13 @@ class moduleClass(Module):
_('USB qube configuration disabled - you are using USB '
'keyboard or USB disk'))
self.choice_usb_with_net = QubesChoice(
_("Use sys-net qube for both networking and USB devices"),
('qvm.sys-net-with-usb',),
depend=self.choice_usb,
replace=('qvm.sys-usb',),
)
self.check_advanced = gtk.CheckButton(
_('Do not configure anything (for advanced users)'))
self.check_advanced.connect('toggled',

Loading…
Cancel
Save