/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: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-07 16:51:21 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060807165121-10fe27c374bbdffd
Added new artwork.

2006-08-07  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive.galde: added custom artwork (icons)
    * icons/*: new icons for the toolbar
    * setup.py: install the icons

Show diffs side-by-side

added added

removed removed

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