trivial: Catch bug if package candidate is None
[appstream:software-center.git] / doc / example_plugin.py
1
2 from gi.repository import GObject
3 import sys
4
5 import softwarecenter.plugin
6
7
8 class ExamplePlugin(softwarecenter.plugin.Plugin):
9     """ example plugin that will hide the exhibits banner """
10
11     def _try_to_hide_banner(self):
12         if not self.app.available_pane.view_initialized:
13             # wait for the pane to fully initialize
14             return True
15         self.app.available_pane.cat_view.vbox.get_children()[0].hide()
16         return False
17
18     def init_plugin(self):
19         sys.stderr.write("init_plugin\n")
20
21         GObject.timeout_add(100, self._try_to_hide_banner)