diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-01-18 14:51:54 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 13:29:20 +0000 |
commit | baac4589ae20b425f9afce1488cbd0d54bb36421 (patch) | |
tree | 3fbdfd0b3eca9378501278d28495778b29f34d1c | |
parent | efbffe3c298d57af34324639f2208e35735758a9 (diff) | |
download | poky-baac4589ae20b425f9afce1488cbd0d54bb36421.tar.gz |
bitbake: toaster: update custom image package table filters
The custom image package selection filters were using the old
ToasterTable filter approach, which caused the table filter to fail.
Amend the table to use the new ToasterTable filtering API to fix
this.
(Bitbake rev: 72a4cb30842fd053e46dc56df222729cbe735162)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index 7fb3f8605e..2903a81696 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
@@ -773,38 +773,32 @@ class SelectPackagesTable(PackagesTable): | |||
773 | self.add_column(title="Add | Remove", | 773 | self.add_column(title="Add | Remove", |
774 | hideable=False, | 774 | hideable=False, |
775 | help_text="Use the add and remove buttons to modify " | 775 | help_text="Use the add and remove buttons to modify " |
776 | "the package content of you custom image", | 776 | "the package content of your custom image", |
777 | static_data_name="add_rm_pkg_btn", | 777 | static_data_name="add_rm_pkg_btn", |
778 | static_data_template='{% include "pkg_add_rm_btn.html" %}', | 778 | static_data_template='{% include "pkg_add_rm_btn.html" %}', |
779 | filter_name="in_current_image" | 779 | filter_name='in_current_image_filter') |
780 | ) | ||
781 | 780 | ||
782 | def setup_filters(self, *args, **kwargs): | 781 | def setup_filters(self, *args, **kwargs): |
783 | project = Project.objects.get(pk=kwargs['pid']) | 782 | in_current_image_filter = TableFilter( |
784 | self.project_layers = ProjectLayer.objects.filter(project=project) | 783 | 'in_current_image_filter', |
784 | 'Filter by added packages' | ||
785 | ) | ||
785 | 786 | ||
787 | in_image_action = TableFilterActionToggle( | ||
788 | 'in_image', | ||
789 | 'Packages in %s' % self.cust_recipe.name, | ||
790 | Q(pk__in=self.static_context_extra['current_packages']) | ||
791 | ) | ||
792 | |||
793 | not_in_image_action = TableFilterActionToggle( | ||
794 | 'not_in_image', | ||
795 | 'Packages not added to %s' % self.cust_recipe.name, | ||
796 | ~Q(pk__in=self.static_context_extra['current_packages']) | ||
797 | ) | ||
786 | 798 | ||
787 | self.add_filter(title="Filter by added packages", | 799 | in_current_image_filter.add_action(in_image_action) |
788 | name="in_current_image", | 800 | in_current_image_filter.add_action(not_in_image_action) |
789 | filter_actions=[ | 801 | self.add_filter(in_current_image_filter) |
790 | self.make_filter_action( | ||
791 | "in_image", | ||
792 | "Packages in %s" % self.cust_recipe.name, | ||
793 | self.filter_in_image), | ||
794 | self.make_filter_action( | ||
795 | "not_in_image", | ||
796 | "Packages not added to %s" % | ||
797 | self.cust_recipe.name, | ||
798 | self.filter_not_in_image) | ||
799 | ]) | ||
800 | |||
801 | def filter_in_image(self): | ||
802 | return self.queryset.filter( | ||
803 | pk__in=self.static_context_extra['current_packages']) | ||
804 | |||
805 | def filter_not_in_image(self): | ||
806 | return self.queryset.exclude( | ||
807 | pk__in=self.static_context_extra['current_packages']) | ||
808 | 802 | ||
809 | class ProjectsTable(ToasterTable): | 803 | class ProjectsTable(ToasterTable): |
810 | """Table of projects in Toaster""" | 804 | """Table of projects in Toaster""" |