From febac40b0501a8c7fde26dd2f29cab48bac2c831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 2 May 2015 21:05:11 +0200 Subject: [PATCH] appmenus: convert eval's to lambda's --- appmenus-scripts/qubes-core-appmenus.py | 35 ++++++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/appmenus-scripts/qubes-core-appmenus.py b/appmenus-scripts/qubes-core-appmenus.py index a6fe948..fa0cb4c 100644 --- a/appmenus-scripts/qubes-core-appmenus.py +++ b/appmenus-scripts/qubes-core-appmenus.py @@ -49,20 +49,35 @@ system_path['appmenu_remove_cmd'] = \ def QubesVm_get_attrs_config(self, attrs): - attrs["appmenus_templates_dir"] = { "eval": \ - 'os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"]) if self.updateable else ' + \ - 'self.template.appmenus_templates_dir if self.template is not None else None' } - attrs["appmenus_template_icons_dir"] = { "eval": \ - 'os.path.join(self.dir_path, vm_files["appmenus_template_icons_subdir"]) if self.updateable else ' + \ - 'self.template.appmenus_template_icons_dir if self.template is not None else None' } - attrs["appmenus_icons_dir"] = { "eval": \ - 'os.path.join(self.dir_path, vm_files["appmenus_icons_subdir"])' } + attrs["appmenus_templates_dir"] = { + "func": lambda x: + os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"]) + if self.updateable else + (self.template.appmenus_templates_dir if self.template is not None + else None) + } + attrs["appmenus_template_icons_dir"] = { + "func": lambda x: + os.path.join(self.dir_path, + vm_files["appmenus_template_icons_subdir"]) + if self.updateable else + (self.template.appmenus_template_icons_dir + if self.template is not None else None) + } + attrs["appmenus_icons_dir"] = { + "func": lambda x: + os.path.join(self.dir_path, vm_files["appmenus_icons_subdir"])} return attrs def QubesTemplateVm_get_attrs_config(self, attrs): - attrs['appmenus_templates_dir'] = { 'eval': 'os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"])' } - attrs['appmenus_template_icons_dir'] = { 'eval': 'os.path.join(self.dir_path, vm_files["appmenus_template_icons_subdir"])' } + attrs['appmenus_templates_dir'] = { + 'func': lambda x: + os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"])} + attrs['appmenus_template_icons_dir'] = { + 'func': lambda x: + os.path.join(self.dir_path, + vm_files["appmenus_template_icons_subdir"])} return attrs