bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
1  | 
# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
 | 
2  | 
#
 | 
|
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
|
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
7  | 
#
 | 
|
8  | 
# This program is distributed in the hope that it will be useful,
 | 
|
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
12  | 
#
 | 
|
13  | 
# You should have received a copy of the GNU General Public License
 | 
|
14  | 
# along with this program; if not, write to the Free Software
 | 
|
15  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
16  | 
||
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
17  | 
from gi.repository import Gtk  | 
18  | 
||
19  | 
||
| 
775.1.4
by Curtis Hovey
 Switched from Gtk.VPaned to Gtk.Paned.new(Gtk.Orientation.VERTICAL).  | 
20  | 
class PluginsPage(Gtk.Paned):  | 
| 
713
by Jelmer Vernooij
 Remove some unused imports, fix some formatting.  | 
21  | 
|
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
22  | 
def __init__(self):  | 
| 
734.1.51
by Curtis Hovey
 Fix the initializer for many classes.  | 
23  | 
super(PluginsPage, self).__init__()  | 
| 
775.1.4
by Curtis Hovey
 Switched from Gtk.VPaned to Gtk.Paned.new(Gtk.Orientation.VERTICAL).  | 
24  | 
self.set_orientation(Gtk.Orientation.VERTICAL)  | 
| 
615
by rodney.dawes at canonical
 * preferences/__init__.py:  | 
25  | 
self.set_border_width(12)  | 
26  | 
self.set_position(216)  | 
|
27  | 
||
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
28  | 
scrolledwindow = Gtk.ScrolledWindow()  | 
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
29  | 
scrolledwindow.set_policy(  | 
30  | 
Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)  | 
|
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
31  | 
scrolledwindow.set_shadow_type(Gtk.ShadowType.IN)  | 
32  | 
self.model = Gtk.ListStore(str, str)  | 
|
33  | 
treeview = Gtk.TreeView()  | 
|
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
34  | 
scrolledwindow.add(treeview)  | 
35  | 
self.pack1(scrolledwindow, resize=True, shrink=False)  | 
|
36  | 
||
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
37  | 
self.table = Gtk.Table(columns=2)  | 
| 
615
by rodney.dawes at canonical
 * preferences/__init__.py:  | 
38  | 
self.table.set_border_width(12)  | 
| 
450.1.14
by Jelmer Vernooij
 Fix regressions in plugins tab.  | 
39  | 
self.table.set_row_spacings(6)  | 
40  | 
self.table.set_col_spacings(6)  | 
|
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
41  | 
|
42  | 
treeview.set_headers_visible(False)  | 
|
| 
450.1.14
by Jelmer Vernooij
 Fix regressions in plugins tab.  | 
43  | 
treeview.set_model(self.model)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
44  | 
treeview.connect("row-activated", self.row_selected)  | 
| 
734.1.28
by Curtis Hovey
 Show the python plugin info when the cursor gives a row focus.  | 
45  | 
treeview.connect("cursor-changed", self.row_selected)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
46  | 
|
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
47  | 
cell = Gtk.CellRendererText()  | 
48  | 
column = Gtk.TreeViewColumn()  | 
|
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
49  | 
column.pack_start(cell, True)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
50  | 
column.add_attribute(cell, "text", 0)  | 
51  | 
treeview.append_column(column)  | 
|
52  | 
||
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
53  | 
cell = Gtk.CellRendererText()  | 
54  | 
column = Gtk.TreeViewColumn()  | 
|
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
55  | 
column.pack_start(cell, True)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
56  | 
column.add_attribute(cell, "text", 1)  | 
57  | 
treeview.append_column(column)  | 
|
| 
713
by Jelmer Vernooij
 Remove some unused imports, fix some formatting.  | 
58  | 
|
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
59  | 
import bzrlib.plugin  | 
60  | 
plugins = bzrlib.plugin.plugins()  | 
|
61  | 
plugin_names = plugins.keys()  | 
|
62  | 
plugin_names.sort()  | 
|
63  | 
for name in plugin_names:  | 
|
| 
450.1.14
by Jelmer Vernooij
 Fix regressions in plugins tab.  | 
64  | 
self.model.append([name, getattr(plugins[name], '__file__', None)])  | 
| 
713
by Jelmer Vernooij
 Remove some unused imports, fix some formatting.  | 
65  | 
|
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
66  | 
scrolledwindow = Gtk.ScrolledWindow()  | 
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
67  | 
scrolledwindow.set_policy(  | 
68  | 
Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)  | 
|
| 
450.1.14
by Jelmer Vernooij
 Fix regressions in plugins tab.  | 
69  | 
scrolledwindow.add_with_viewport(self.table)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
70  | 
self.pack2(scrolledwindow, resize=False, shrink=True)  | 
71  | 
self.show()  | 
|
72  | 
||
| 
734.1.28
by Curtis Hovey
 Show the python plugin info when the cursor gives a row focus.  | 
73  | 
def row_selected(self, tv, path=None, tvc=None):  | 
74  | 
if path is None:  | 
|
75  | 
(path, focus) = tv.get_cursor()  | 
|
| 
772.1.1
by Curtis Hovey
 Return early if the widget is being destroyed.  | 
76  | 
if path is None:  | 
77  | 
            # The event was fired as the widget was destroyed.
 | 
|
78  | 
            return
 | 
|
| 
450.1.14
by Jelmer Vernooij
 Fix regressions in plugins tab.  | 
79  | 
import bzrlib  | 
| 
560.1.1
by Jasper Groenewegen
 Fix plugin description in gpreferences  | 
80  | 
p = bzrlib.plugin.plugins()[self.model[path][0]].module  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
81  | 
from inspect import getdoc  | 
82  | 
||
| 
450.1.14
by Jelmer Vernooij
 Fix regressions in plugins tab.  | 
83  | 
for w in self.table.get_children():  | 
84  | 
self.table.remove(w)  | 
|
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
85  | 
|
86  | 
if getattr(p, '__author__', None) is not None:  | 
|
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
87  | 
align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)  | 
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
88  | 
label = Gtk.Label()  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
89  | 
label.set_markup("<b>Author:</b>")  | 
90  | 
align.add(label)  | 
|
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
91  | 
self.table.attach(align, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
92  | 
align.show()  | 
93  | 
label.show()  | 
|
94  | 
||
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
95  | 
align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)  | 
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
96  | 
author = Gtk.Label()  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
97  | 
author.set_text(p.__author__)  | 
98  | 
author.set_selectable(True)  | 
|
99  | 
align.add(author)  | 
|
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
100  | 
self.table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
101  | 
|
102  | 
if getattr(p, '__version__', None) is not None:  | 
|
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
103  | 
align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)  | 
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
104  | 
label = Gtk.Label()  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
105  | 
label.set_markup("<b>Version:</b>")  | 
106  | 
align.add(label)  | 
|
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
107  | 
self.table.attach(align, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
108  | 
align.show()  | 
109  | 
label.show()  | 
|
110  | 
||
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
111  | 
align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)  | 
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
112  | 
author = Gtk.Label()  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
113  | 
author.set_text(p.__version__)  | 
114  | 
author.set_selectable(True)  | 
|
115  | 
align.add(author)  | 
|
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
116  | 
self.table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
117  | 
|
118  | 
if getdoc(p) is not None:  | 
|
| 
734.1.16
by Curtis Hovey
 Updated gpreferences to gtk3.  | 
119  | 
align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)  | 
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
120  | 
description = Gtk.Label()  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
121  | 
description.set_text(getdoc(p))  | 
122  | 
description.set_selectable(True)  | 
|
123  | 
align.add(description)  | 
|
| 
734.1.1
by Curtis Hovey
 Mechanical changes made by pygi.convert.sh.  | 
124  | 
self.table.attach(align, 0, 2, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)  | 
| 
450.3.2
by Jelmer Vernooij
 Split plugins page out into a separate file.  | 
125  | 
|
| 
450.1.14
by Jelmer Vernooij
 Fix regressions in plugins tab.  | 
126  | 
self.table.show_all()  |