software: store selected packages in config

This commit is contained in:
Peter Eisenmann
2022-09-30 10:58:29 +02:00
parent 915e67c5ca
commit cc890e6c09
2 changed files with 9 additions and 10 deletions

View File

@@ -37,7 +37,7 @@ def _configure_variables_set(config):
'user_password' in config and
'formats' in config and
'timezone' in config and
'chosen_additional_software' in config)
'chosen_software_packages' in config)
def _load_default_config():
@@ -72,7 +72,8 @@ def _set_testing_defaults(config):
config["user_password"] = 'password'
config["formats"] = 'en_US.UTF-8'
config["timezone"] = 'UTC'
config["chosen_additional_software"] = ''
config["chosen_software_packages"] = ''
config["chosen_software"] = []
def _valid(config):
@@ -135,6 +136,6 @@ def create_envs(config, with_install_envs, with_configure_envs):
f'OSI_USER_PASSWORD="{config["user_password"]}"',
f'OSI_FORMATS="{config["formats"]}"',
f'OSI_TIMEZONE="{config["timezone"]}"',
f'OSI_ADDITIONAL_SOFTWARE="{config["chosen_additional_software"]}"',
f'OSI_ADDITIONAL_SOFTWARE="{config["chosen_software_packages"]}"',
]
return envs + [None]

View File

@@ -20,7 +20,7 @@ class SoftwarePage(Gtk.Box, Page):
Gtk.Box.__init__(self, **kwargs)
self.software_list.bind_model(
self.software_model,
lambda pkg: SelectionRow(pkg.name, pkg.description, pkg.icon_path, pkg.suggested, pkg.package))
lambda pkg: SelectionRow(pkg.name, pkg.description, pkg.icon_path, pkg.suggested, pkg))
def _setup_software(self):
suggestions = get_software_suggestions()
@@ -43,9 +43,7 @@ class SoftwarePage(Gtk.Box, Page):
self._setup_software()
def unload(self):
to_install = ''
for row in self.software_list:
if row.is_activated():
to_install += f' {row.info}'
global_state.set_config('chosen_additional_software', to_install.strip())
choices = [row.info for row in self.software_list if row.is_activated()]
packages = ' '.join([choice.package for choice in choices])
global_state.set_config('chosen_software_packages', packages)
global_state.set_config('chosen_software', choices)