/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: Jasper Groenewegen
  • Date: 2008-07-27 11:20:34 UTC
  • mto: (577.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 579.
  • Revision ID: colbrac@xs4all.nl-20080727112034-x3c07o6b5gk1drn5
Merge dialog: Add ability to choose between folder and custom location as merge source

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    pass
22
22
 
23
23
import gtk
24
 
from bzrlib.plugins.gtk import (
25
 
    _i18n,
26
 
    window,
27
 
    )
28
 
 
29
 
 
30
 
class StatusWindow(window.Window):
 
24
from bzrlib.plugins.gtk import _i18n
 
25
 
 
26
 
 
27
class StatusDialog(gtk.Dialog):
31
28
    """ Display Status window and perform the needed actions. """
32
29
    def __init__(self, wt, wtpath, revision=None):
33
30
        """ Initialize the Status window. """
34
 
        super(StatusWindow, self).__init__()
 
31
        super(StatusDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
35
32
        self.set_title("Working tree changes")
 
33
        self.set_default_response(gtk.RESPONSE_CLOSE)
36
34
        self._create()
37
35
        self.wt = wt
38
36
        self.wtpath = wtpath
39
37
 
40
38
        if revision is None:
41
39
            revision = self.wt.branch.last_revision()
42
 
 
 
40
            
43
41
        # Set the old working tree
44
42
        self.old_tree = self.wt.branch.repository.revision_tree(revision)
45
43
        # Generate status output
47
45
 
48
46
    def _create(self):
49
47
        self.set_default_size(400, 300)
 
48
        self.set_has_separator(False)
50
49
        sw = gtk.ScrolledWindow()
51
50
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
52
51
        sw.set_shadow_type(gtk.SHADOW_IN)
53
52
        self.treeview = gtk.TreeView()
54
53
        sw.add(self.treeview)
55
 
        self.add(sw)
 
54
        self.vbox.pack_start(sw, True, True)
 
55
        self.vbox.show_all()
56
56
 
57
57
        # sane border and spacing widths (as recommended by GNOME HIG) 
58
58
        self.set_border_width(5)
59
59
        sw.set_border_width(5)
60
 
        self.show_all()
 
60
        self.vbox.set_spacing(2)
 
61
        self.action_area.set_border_width(5)
61
62
 
62
63
 
63
64
    def row_diff(self, tv, path, tvc):
66
67
            return
67
68
        from bzrlib.plugins.gtk.diff import DiffWindow
68
69
        window = DiffWindow()
69
 
        window.set_diff("Working tree changes", self.wt, self.old_tree)
 
70
        window.set_diff("Working tree changes", self.old_tree, self.wt)
70
71
        window.set_file(file)
71
72
        window.show()
72
73
 
77
78
        self.treeview.set_headers_visible(False)
78
79
        self.treeview.set_model(self.model)
79
80
        self.treeview.connect("row-activated", self.row_diff)
80
 
 
 
81
        
81
82
        cell = gtk.CellRendererText()
82
83
        cell.set_property("width-chars", 20)
83
84
        column = gtk.TreeViewColumn()
84
85
        column.pack_start(cell, expand=True)
85
86
        column.add_attribute(cell, "text", 0)
86
87
        self.treeview.append_column(column)
87
 
 
 
88
        
88
89
        delta = self.wt.changes_from(self.old_tree)
89
90
 
90
91
        changes = False
91
 
 
 
92
        
92
93
        if len(delta.added):
93
94
            changes = True
94
95
            titer = self.model.append(None, [ _i18n('Added'), None ])
113
114
            titer = self.model.append(None, [ _i18n('Modified'), None ])
114
115
            for path, id, kind, text_modified, meta_modified in delta.modified:
115
116
                self.model.append(titer, [ path, path ])
116
 
 
 
117
        
117
118
        done_unknown = False
118
119
        for path in self.wt.unknowns():
119
120
            changes = True
126
127
            self.model.append(None, [ _i18n('No changes.'), None ])
127
128
 
128
129
        self.treeview.expand_all()
129
 
 
 
130
    
130
131
    def close(self, widget=None):
131
132
        self.window.destroy()