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')
48
48
# Communication object
51
51
self.dialog = dialog
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')
59
56
# Check if current location is a branch
90
87
# Create the file list
91
88
self._create_file_view()
90
# Some additional widgets
91
self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
92
self.textview = self.glade.get_widget('textview_commit')
94
95
""" Display the Push dialog. """
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.')
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",
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))
125
for path, id, kind in self.delta.added:
126
self.file_store.append([ True, path, _('added') ])
128
for path, id, kind in self.delta.removed:
129
self.file_store.append([ True, path, _('removed') ])
131
for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
132
self.file_store.append([ True, oldpath, _('renamed') ])
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" ])
130
for path, _, _ in self.delta.removed:
131
self.file_store.append([ True, path, "removed" ])
133
for oldpath, _, _, _, _, _ in self.delta.renamed:
134
self.file_store.append([ True, oldpath, "renamed"])
136
for path, _, _, _, _ in self.delta.modified:
137
self.file_store.append([ True, path, "modified"])
137
139
def _get_specific_files(self):
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)
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)
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)
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)
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)
195
197
except errors.BoundBranchOutOfDate, errmsg:
196
self.dialog.error_dialog(_('Bound branch is out of date'),
198
self.dialog.error_dialog('Bound branch is out of date',
198
200
self.comm.set_busy(self.window, False)