appmenus: convert eval's to lambda's

This commit is contained in:
Marek Marczykowski-Górecki 2015-05-02 21:05:11 +02:00
parent 59d9dc0307
commit febac40b05

View File

@ -49,20 +49,35 @@ system_path['appmenu_remove_cmd'] = \
def QubesVm_get_attrs_config(self, attrs): def QubesVm_get_attrs_config(self, attrs):
attrs["appmenus_templates_dir"] = { "eval": \ attrs["appmenus_templates_dir"] = {
'os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"]) if self.updateable else ' + \ "func": lambda x:
'self.template.appmenus_templates_dir if self.template is not None else None' } os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"])
attrs["appmenus_template_icons_dir"] = { "eval": \ if self.updateable else
'os.path.join(self.dir_path, vm_files["appmenus_template_icons_subdir"]) if self.updateable else ' + \ (self.template.appmenus_templates_dir if self.template is not None
'self.template.appmenus_template_icons_dir if self.template is not None else None' } else None)
attrs["appmenus_icons_dir"] = { "eval": \ }
'os.path.join(self.dir_path, vm_files["appmenus_icons_subdir"])' } 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 return attrs
def QubesTemplateVm_get_attrs_config(self, 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_templates_dir'] = {
attrs['appmenus_template_icons_dir'] = { 'eval': 'os.path.join(self.dir_path, vm_files["appmenus_template_icons_subdir"])' } '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 return attrs