~mmcg069/software-center/catviewgtk-code-reorg

« back to all changes in this revision

Viewing changes to doc/example_plugin.py

  • Committer: Michael Vogt
  • Date: 2010-07-26 12:09:44 UTC
  • Revision ID: michael.vogt@ubuntu.com-20100726120944-c09u14x3nuvf3ykp
add example plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import gtk
 
3
 
 
4
import softwarecenter.plugin
 
5
 
 
6
from gettext import gettext as _
 
7
 
 
8
class ExamplePlugin(softwarecenter.plugin.Plugin):
 
9
    """ mock plugin """
 
10
 
 
11
    VIEW_PAGE_EXAMPLE_PLUGIN = "view-page-example-plugin"
 
12
 
 
13
    def init_plugin(self):
 
14
        print "init_plugin"
 
15
        self.plugin_view = gtk.VBox()
 
16
        self.plugin_view.pack_start(gtk.Label("lala"))
 
17
        self.app.view_manager.register(self.plugin_view, 
 
18
                                       self.VIEW_PAGE_EXAMPLE_PLUGIN)
 
19
 
 
20
        # FIXME: workaround for imperfect apps.py
 
21
        self.plugin_view.apps_filter = None
 
22
 
 
23
        # FIXME: this needs to get better
 
24
        model = self.app.view_switcher.get_model()
 
25
        icon = None
 
26
        parent_iter = None
 
27
        channel = None
 
28
        model.append(parent_iter, [icon, _("Example Plugin"), 
 
29
                                   self.VIEW_PAGE_EXAMPLE_PLUGIN, channel])
 
30