Skip to content
Snippets Groups Projects
Commit d8fa8c28 authored by Simon McVittie's avatar Simon McVittie
Browse files

test-ui: Allow configuring whether to copy the runtime

parent f05ebc4e
No related branches found
No related tags found
No related merge requests found
......@@ -166,6 +166,41 @@ class Gui:
row += 1
var_path = os.getenv('PRESSURE_VESSEL_COPY_RUNTIME_INTO', None)
if var_path is None:
value = False
var_path = os.getenv(
'PRESSURE_VESSEL_RUNTIME_BASE',
os.path.dirname(__file__) + '/../..',
) + '/var'
assert var_path is not None
else:
value = True
self.var_path = os.path.realpath(var_path)
self.copy_runtime_into_check = Gtk.CheckButton.new_with_label(
'Create temporary runtime copy on disk'
)
self.copy_runtime_into_check.set_active(value)
self.grid.attach(self.copy_runtime_into_check, 1, row, 1, 1)
row += 1
label = Gtk.Label.new('')
label.set_markup(
'<small><i>'
'The copy will be in {} and can be modified while the '
'container is running. It will be deleted next time you '
'run a game in this mode.'
'</i></small>'.format(
GLib.markup_escape_text(self.var_path),
)
)
label.set_halign(Gtk.Align.START)
label.set_line_wrap(True)
self.grid.attach(label, 1, row, 1, 1)
row += 1
self.host_graphics_check = Gtk.CheckButton.new_with_label(
'Use host-system graphics stack'
)
......@@ -349,8 +384,10 @@ class Gui:
def _container_runtime_changed(self, combo):
if combo.get_active_id() == '/':
self.copy_runtime_into_check.set_sensitive(False)
self.host_graphics_check.set_sensitive(False)
else:
self.copy_runtime_into_check.set_sensitive(True)
self.host_graphics_check.set_sensitive(True)
def _describe_runtime(
......@@ -460,6 +497,12 @@ class Gui:
else:
argv.append('--without-host-graphics')
if self.copy_runtime_into_check.get_active():
os.makedirs(self.var_path, mode=0o755, exist_ok=True)
argv.append('--copy-runtime-into=' + self.var_path)
else:
argv.append('--copy-runtime-into=')
if self.unshare_home_check.get_active():
argv.append('--unshare-home')
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment