diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-10-27 19:04:46 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 13:29:16 +0000 |
commit | 4c828782255d1de8fac70757492a331d3d1abdbe (patch) | |
tree | 320b450fb32a84828b90076cf91b9cf1c1b5af6c /bitbake/lib | |
parent | 3e1e8e6a99ebe17cce96db812e1cac2c206a2839 (diff) | |
download | poky-4c828782255d1de8fac70757492a331d3d1abdbe.tar.gz |
bitbake: toaster: ToasterTables simplify filter function move common part to widget
Move part of the functionality of the filter functions to the Table
widget. We don't need to implement it in each subclass.
(Bitbake rev: 16e48829f6fd96c1d21339253871f2a9b2446f87)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index e9f1fdccb1..7b335c8870 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
@@ -658,7 +658,37 @@ class SelectPackagesTable(ToasterTable): | |||
658 | help_text="Use the add and remove buttons to modify " | 658 | help_text="Use the add and remove buttons to modify " |
659 | "the package content of you custom image", | 659 | "the package content of you custom image", |
660 | static_data_name="add_rm_pkg_btn", | 660 | static_data_name="add_rm_pkg_btn", |
661 | static_data_template='{% include "pkg_add_rm_btn.html" %}') | 661 | static_data_template='{% include "pkg_add_rm_btn.html" %}', |
662 | static_data_template='{% include "pkg_add_rm_btn.html" %}' | ||
663 | ) | ||
664 | |||
665 | def setup_filters(self, *args, **kwargs): | ||
666 | project = Project.objects.get(pk=kwargs['pid']) | ||
667 | self.project_layers = ProjectLayer.objects.filter(project=project) | ||
668 | |||
669 | |||
670 | self.add_filter(title="Filter by added packages", | ||
671 | name="in_current_image", | ||
672 | filter_actions=[ | ||
673 | self.make_filter_action( | ||
674 | "in_image", | ||
675 | "Packages in %s" % self.cust_recipe.name, | ||
676 | self.filter_in_image), | ||
677 | self.make_filter_action( | ||
678 | "not_in_image", | ||
679 | "Packages not added to %s" % | ||
680 | self.cust_recipe.name, | ||
681 | self.filter_not_in_image) | ||
682 | ]) | ||
683 | |||
684 | def filter_in_image(self, count_only=False): | ||
685 | return self.queryset.filter( | ||
686 | pk__in=self.static_context_extra['current_packages']) | ||
687 | |||
688 | |||
689 | def filter_not_in_image(self, count_only=False): | ||
690 | return self.queryset.exclude( | ||
691 | pk__in=self.static_context_extra['current_packages']) | ||
662 | 692 | ||
663 | class ProjectsTable(ToasterTable): | 693 | class ProjectsTable(ToasterTable): |
664 | """Table of projects in Toaster""" | 694 | """Table of projects in Toaster""" |