/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-08-12 20:25:28 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110812202528-4xf4a2t23urx50d2
Updated gst to gtk3.

Show diffs side-by-side

added added

removed removed

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