/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: Curtis Hovey
  • Date: 2011-07-31 15:52:43 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110731155243-ln8istmxbryhb4pz
Mechanical changes made by pygi.convert.sh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
try:
 
18
    import pygtk
 
19
    pygtk.require("2.0")
 
20
except:
 
21
    pass
 
22
 
17
23
from gi.repository import Gtk
18
24
 
19
25
 
20
26
class PluginsPage(Gtk.VPaned):
21
27
 
22
28
    def __init__(self):
23
 
        super(PluginsPage, self).__init__()
 
29
        GObject.GObject.__init__(self)
24
30
        self.set_border_width(12)
25
31
        self.set_position(216)
26
32
 
27
33
        scrolledwindow = Gtk.ScrolledWindow()
28
 
        scrolledwindow.set_policy(
29
 
            Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
 
34
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
30
35
        scrolledwindow.set_shadow_type(Gtk.ShadowType.IN)
31
36
        self.model = Gtk.ListStore(str, str)
32
37
        treeview = Gtk.TreeView()
41
46
        treeview.set_headers_visible(False)
42
47
        treeview.set_model(self.model)
43
48
        treeview.connect("row-activated", self.row_selected)
44
 
        treeview.connect("cursor-changed", self.row_selected)
45
49
 
46
50
        cell = Gtk.CellRendererText()
47
51
        column = Gtk.TreeViewColumn()
48
 
        column.pack_start(cell, True)
 
52
        column.pack_start(cell, True, True, 0)
49
53
        column.add_attribute(cell, "text", 0)
50
54
        treeview.append_column(column)
51
55
 
52
56
        cell = Gtk.CellRendererText()
53
57
        column = Gtk.TreeViewColumn()
54
 
        column.pack_start(cell, True)
 
58
        column.pack_start(cell, True, True, 0)
55
59
        column.add_attribute(cell, "text", 1)
56
60
        treeview.append_column(column)
57
61
 
63
67
            self.model.append([name, getattr(plugins[name], '__file__', None)])
64
68
 
65
69
        scrolledwindow = Gtk.ScrolledWindow()
66
 
        scrolledwindow.set_policy(
67
 
            Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
 
70
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
68
71
        scrolledwindow.add_with_viewport(self.table)
69
72
        self.pack2(scrolledwindow, resize=False, shrink=True)
70
73
        self.show()
71
74
 
72
 
    def row_selected(self, tv, path=None, tvc=None):
73
 
        if path is None:
74
 
            (path, focus) = tv.get_cursor()
 
75
    def row_selected(self, tv, path, tvc):
75
76
        import bzrlib
76
77
        p = bzrlib.plugin.plugins()[self.model[path][0]].module
77
78
        from inspect import getdoc
80
81
            self.table.remove(w)
81
82
 
82
83
        if getattr(p, '__author__', None) is not None:
83
 
            align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
 
84
            align = Gtk.Alignment.new(0.0, 0.5)
84
85
            label = Gtk.Label()
85
86
            label.set_markup("<b>Author:</b>")
86
87
            align.add(label)
88
89
            align.show()
89
90
            label.show()
90
91
 
91
 
            align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
 
92
            align = Gtk.Alignment.new(0.0, 0.5)
92
93
            author = Gtk.Label()
93
94
            author.set_text(p.__author__)
94
95
            author.set_selectable(True)
96
97
            self.table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
97
98
 
98
99
        if getattr(p, '__version__', None) is not None:
99
 
            align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
 
100
            align = Gtk.Alignment.new(0.0, 0.5)
100
101
            label = Gtk.Label()
101
102
            label.set_markup("<b>Version:</b>")
102
103
            align.add(label)
104
105
            align.show()
105
106
            label.show()
106
107
 
107
 
            align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
 
108
            align = Gtk.Alignment.new(0.0, 0.5)
108
109
            author = Gtk.Label()
109
110
            author.set_text(p.__version__)
110
111
            author.set_selectable(True)
112
113
            self.table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
113
114
 
114
115
        if getdoc(p) is not None:
115
 
            align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
 
116
            align = Gtk.Alignment.new(0.0, 0.5)
116
117
            description = Gtk.Label()
117
118
            description.set_text(getdoc(p))
118
119
            description.set_selectable(True)
120
121
            self.table.attach(align, 0, 2, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
121
122
 
122
123
        self.table.show_all()
 
124
 
 
125