/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to preferences/plugins.py

  • Committer: Daniel Schierbeck
  • Date: 2008-04-02 22:24:53 UTC
  • mfrom: (450.1.15 trunk)
  • mto: This revision was merged to the branch mainline in revision 481.
  • Revision ID: daniel.schierbeck@gmail.com-20080402222453-4dz37ykwfh5pyojn
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
        gtk.VPaned.__init__(self)
28
28
        scrolledwindow = gtk.ScrolledWindow()
29
29
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
30
 
        model = gtk.ListStore(str, str)
 
30
        self.model = gtk.ListStore(str, str)
31
31
        treeview = gtk.TreeView()
32
32
        scrolledwindow.add(treeview)
33
33
        self.pack1(scrolledwindow, resize=True, shrink=False)
34
34
 
35
 
        table = gtk.Table(columns=2)
36
 
        table.set_row_spacings(6)
37
 
        table.set_col_spacings(6)
 
35
        self.table = gtk.Table(columns=2)
 
36
        self.table.set_row_spacings(6)
 
37
        self.table.set_col_spacings(6)
38
38
 
39
39
        treeview.set_headers_visible(False)
40
 
        treeview.set_model(model)
 
40
        treeview.set_model(self.model)
41
41
        treeview.connect("row-activated", self.row_selected)
42
42
 
43
43
        cell = gtk.CellRendererText()
57
57
        plugin_names = plugins.keys()
58
58
        plugin_names.sort()
59
59
        for name in plugin_names:
60
 
            model.append([name, getattr(plugins[name], '__file__', None)])
 
60
            self.model.append([name, getattr(plugins[name], '__file__', None)])
61
61
                 
62
62
        scrolledwindow = gtk.ScrolledWindow()
63
63
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
64
 
        scrolledwindow.add_with_viewport(table)
 
64
        scrolledwindow.add_with_viewport(self.table)
65
65
        self.pack2(scrolledwindow, resize=False, shrink=True)
66
66
        self.show()
67
67
 
68
68
    def row_selected(self, tv, path, tvc):
69
 
        p = bzrlib.plugin.plugins()[model[path][0]]
 
69
        import bzrlib
 
70
        p = bzrlib.plugin.plugins()[self.model[path][0]]
70
71
        from inspect import getdoc
71
72
 
72
 
        for w in table.get_children():
73
 
            table.remove(w)
 
73
        for w in self.table.get_children():
 
74
            self.table.remove(w)
74
75
 
75
76
        if getattr(p, '__author__', None) is not None:
76
77
            align = gtk.Alignment(1.0, 0.5)
77
78
            label = gtk.Label()
78
79
            label.set_markup("<b>Author:</b>")
79
80
            align.add(label)
80
 
            table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
81
            self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
81
82
            align.show()
82
83
            label.show()
83
84
 
86
87
            author.set_text(p.__author__)
87
88
            author.set_selectable(True)
88
89
            align.add(author)
89
 
            table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
90
            self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
90
91
 
91
92
        if getattr(p, '__version__', None) is not None:
92
93
            align = gtk.Alignment(1.0, 0.5)
93
94
            label = gtk.Label()
94
95
            label.set_markup("<b>Version:</b>")
95
96
            align.add(label)
96
 
            table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
97
            self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
97
98
            align.show()
98
99
            label.show()
99
100
 
102
103
            author.set_text(p.__version__)
103
104
            author.set_selectable(True)
104
105
            align.add(author)
105
 
            table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
106
            self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
106
107
 
107
108
        if getdoc(p) is not None:
108
109
            align = gtk.Alignment(0.0, 0.5)
110
111
            description.set_text(getdoc(p))
111
112
            description.set_selectable(True)
112
113
            align.add(description)
113
 
            table.attach(align, 0, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
114
            self.table.attach(align, 0, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
114
115
 
115
 
        table.show_all()
 
116
        self.table.show_all()
116
117
 
117
118