/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: Jelmer Vernooij
  • Date: 2008-03-28 19:39:35 UTC
  • mto: (450.1.13 trunk)
  • mto: This revision was merged to the branch mainline in revision 458.
  • Revision ID: jelmer@samba.org-20080328193935-ih23kvdwk3w0adp5
Split identity settings out of main preferences window.

Show diffs side-by-side

added added

removed removed

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