/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 olive/frontend/gtk/commit.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-15 18:59:46 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-20060815185946-8b169c3f73aef666
Added View menu; implemented Refresh; some TODO changes.

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

    * olive.glade: added View menu
    * olive/frontend/gtk/handler.py: implement the signal handlers
    * olive/frontend/gtk/__init__.py: connect the signals
    * TODO: some items marked as [DONE]

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
except:
30
30
    sys.exit(1)
31
31
 
32
 
from bzrlib import version_info
 
32
import bzrlib
33
33
 
34
 
if version_info < (0, 9):
 
34
if bzrlib.version_info < (0, 9):
35
35
    # function deprecated after 0.9
36
36
    from bzrlib.delta import compare_trees
37
37
 
43
43
    def __init__(self, gladefile, comm, dialog):
44
44
        """ Initialize the Commit dialog. """
45
45
        self.gladefile = gladefile
46
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_commit', 'olive-gtk')
 
46
        self.glade = gtk.glade.XML(self.gladefile, 'window_commit')
47
47
        
48
48
        # Communication object
49
49
        self.comm = comm
50
50
        # Dialog object
51
51
        self.dialog = dialog
52
52
        
53
 
        # Get some important widgets
 
53
        # Get the Commit dialog widget
54
54
        self.window = self.glade.get_widget('window_commit')
55
 
        self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
56
 
        self.textview = self.glade.get_widget('textview_commit')
57
 
        self.file_view = self.glade.get_widget('treeview_commit_select')
58
55
 
59
56
        # Check if current location is a branch
60
57
        try:
75
72
        
76
73
        # Set the delta
77
74
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
78
 
        if version_info < (0, 9):
 
75
        if bzrlib.version_info < (0, 9):
79
76
            self.delta = compare_trees(self.old_tree, self.wt)
80
77
        else:
81
78
            self.delta = self.wt.changes_from(self.old_tree)
89
86
        
90
87
        # Create the file list
91
88
        self._create_file_view()
 
89
        
 
90
        # Some additional widgets
 
91
        self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
 
92
        self.textview = self.glade.get_widget('textview_commit')
92
93
    
93
94
    def display(self):
94
95
        """ Display the Push dialog. """
95
96
        if self.notbranch:
96
 
            self.dialog.error_dialog(_('Directory is not a branch'),
97
 
                                     _('You can perform this action only in a branch.'))
 
97
            self.dialog.error_dialog('Directory is not a branch',
 
98
                                     'You can perform this action only in a branch.')
98
99
            self.close()
99
100
        else:
100
101
            from olive.backend.info import is_checkout
111
112
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,
112
113
                                        gobject.TYPE_STRING,
113
114
                                        gobject.TYPE_STRING)
 
115
        self.file_view = self.glade.get_widget('treeview_commit_select')
114
116
        self.file_view.set_model(self.file_store)
115
117
        crt = gtk.CellRendererToggle()
116
118
        crt.set_property("activatable", True)
117
119
        crt.connect("toggled", self._toggle_commit, self.file_store)
118
 
        self.file_view.append_column(gtk.TreeViewColumn(_('Commit'),
 
120
        self.file_view.append_column(gtk.TreeViewColumn("Commit",
119
121
                                     crt, active=0))
120
 
        self.file_view.append_column(gtk.TreeViewColumn(_('Path'),
 
122
        self.file_view.append_column(gtk.TreeViewColumn("Path",
121
123
                                     gtk.CellRendererText(), text=1))
122
 
        self.file_view.append_column(gtk.TreeViewColumn(_('Type'),
 
124
        self.file_view.append_column(gtk.TreeViewColumn("Type",
123
125
                                     gtk.CellRendererText(), text=2))
124
126
 
125
 
        for path, id, kind in self.delta.added:
126
 
            self.file_store.append([ True, path, _('added') ])
127
 
 
128
 
        for path, id, kind in self.delta.removed:
129
 
            self.file_store.append([ True, path, _('removed') ])
130
 
 
131
 
        for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
132
 
            self.file_store.append([ True, oldpath, _('renamed') ])
133
 
 
134
 
        for path, id, kind, text_modified, meta_modified in self.delta.modified:
135
 
            self.file_store.append([ True, path, _('modified') ])
 
127
        for path, _, _ in self.delta.added:
 
128
            self.file_store.append([ True, path, "added" ])
 
129
 
 
130
        for path, _, _ in self.delta.removed:
 
131
            self.file_store.append([ True, path, "removed" ])
 
132
 
 
133
        for oldpath, _, _, _, _, _ in self.delta.renamed:
 
134
            self.file_store.append([ True, oldpath, "renamed"])
 
135
 
 
136
        for path, _, _, _, _ in self.delta.modified:
 
137
            self.file_store.append([ True, path, "modified"])
136
138
    
137
139
    def _get_specific_files(self):
138
140
        ret = []
168
170
                           local=self.checkbutton_local.get_active(),
169
171
                           specific_files=specific_files)
170
172
        except errors.NotBranchError:
171
 
            self.dialog.error_dialog(_('Directory is not a branch'),
172
 
                                     _('You can perform this action only in a branch.'))
 
173
            self.dialog.error_dialog('Directory is not a branch',
 
174
                                     'You can perform this action only in a branch.')
173
175
            self.comm.set_busy(self.window, False)
174
176
            return
175
177
        except errors.LocalRequiresBoundBranch:
176
 
            self.dialog.error_dialog(_('Directory is not a checkout'),
177
 
                                     _('You can perform local commit only on checkouts.'))
 
178
            self.dialog.error_dialog('Directory is not a checkout',
 
179
                                     'You can perform local commit only on checkouts.')
178
180
            self.comm.set_busy(self.window, False)
179
181
            return
180
182
        except errors.PointlessCommit:
181
 
            self.dialog.error_dialog(_('No changes to commit'),
182
 
                                     _('Try force commit if you want to commit anyway.'))
 
183
            self.dialog.error_dialog('No changes to commit',
 
184
                                     'Try force commit if you want to commit anyway.')
183
185
            self.comm.set_busy(self.window, False)
184
186
            return
185
187
        except errors.ConflictsInTree:
186
 
            self.dialog.error_dialog(_('Conflicts in tree'),
187
 
                                     _('You need to resolve the conflicts before committing.'))
 
188
            self.dialog.error_dialog('Conflicts in tree'
 
189
                                     'You need to resolve the conflicts before committing.')
188
190
            self.comm.set_busy(self.window, False)
189
191
            return
190
192
        except errors.StrictCommitFailed:
191
 
            self.dialog.error_dialog(_('Strict commit failed'),
192
 
                                     _('There are unknown files in the working tree.\nPlease add or delete them.'))
 
193
            self.dialog.error_dialog('Strict commit failed'
 
194
                                     'There are unknown files in the working tree.\nPlease add or delete them.')
193
195
            self.comm.set_busy(self.window, False)
194
196
            return
195
197
        except errors.BoundBranchOutOfDate, errmsg:
196
 
            self.dialog.error_dialog(_('Bound branch is out of date'),
197
 
                                     _('%s') % errmsg)
 
198
            self.dialog.error_dialog('Bound branch is out of date',
 
199
                                     '%s' % errmsg)
198
200
            self.comm.set_busy(self.window, False)
199
201
            return
200
202
        except: