/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: 2012-02-09 02:55:06 UTC
  • mto: This revision was merged to the branch mainline in revision 776.
  • Revision ID: sinzui.is@verizon.net-20120209025506-qa8yd8livobyv5yy
Replace unsupports notify event with an new strategy to set and pane size
when the config is saved.
Hush lint.

Show diffs side-by-side

added added

removed removed

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