/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 status.py

  • Committer: David Planella
  • Date: 2011-03-06 08:24:07 UTC
  • mfrom: (718 trunk)
  • mto: This revision was merged to the branch mainline in revision 719.
  • Revision ID: david.planella@ubuntu.com-20110306082407-y9zwkjje5oue9egw
Added preliminary internationalization support. Merged from trunk.

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
 
from gi.repository import Gtk
18
 
from bzrlib.plugins.gtk import window
19
 
from bzrlib.plugins.gtk.i18n import _i18n
 
17
try:
 
18
    import pygtk
 
19
    pygtk.require("2.0")
 
20
except:
 
21
    pass
 
22
 
 
23
import gtk
 
24
from bzrlib.plugins.gtk import (
 
25
    _i18n,
 
26
    window,
 
27
    )
20
28
 
21
29
 
22
30
class StatusWindow(window.Window):
23
31
    """ Display Status window and perform the needed actions. """
24
 
 
25
32
    def __init__(self, wt, wtpath, revision=None):
26
33
        """ Initialize the Status window. """
27
34
        super(StatusWindow, self).__init__()
40
47
 
41
48
    def _create(self):
42
49
        self.set_default_size(400, 300)
43
 
        sw = Gtk.ScrolledWindow()
44
 
        sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
45
 
        sw.set_shadow_type(Gtk.ShadowType.IN)
46
 
        self.treeview = Gtk.TreeView()
 
50
        sw = gtk.ScrolledWindow()
 
51
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 
52
        sw.set_shadow_type(gtk.SHADOW_IN)
 
53
        self.treeview = gtk.TreeView()
47
54
        sw.add(self.treeview)
48
55
        self.add(sw)
49
56
 
66
73
 
67
74
    def _generate_status(self):
68
75
        """ Generate 'bzr status' output. """
69
 
        self.model = Gtk.TreeStore(str, str)
 
76
        self.model = gtk.TreeStore(str, str)
70
77
        self.treeview.set_headers_visible(False)
71
78
        self.treeview.set_model(self.model)
72
79
        self.treeview.connect("row-activated", self.row_diff)
73
80
 
74
 
        cell = Gtk.CellRendererText()
 
81
        cell = gtk.CellRendererText()
75
82
        cell.set_property("width-chars", 20)
76
 
        column = Gtk.TreeViewColumn()
77
 
        column.pack_start(cell, True)
 
83
        column = gtk.TreeViewColumn()
 
84
        column.pack_start(cell, expand=True)
78
85
        column.add_attribute(cell, "text", 0)
79
86
        self.treeview.append_column(column)
80
87