56
53
from bzrlib.plugins.gtk.conflicts import ConflictsDialog
57
54
from bzrlib.plugins.gtk.initialize import InitDialog
58
55
from bzrlib.plugins.gtk.push import PushDialog
59
from bzrlib.plugins.gtk.revbrowser import RevisionBrowser
62
""" Display the AboutDialog. """
63
from bzrlib.plugins.gtk import __version__
64
from bzrlib.plugins.gtk.olive.guifiles import GLADEFILENAME
66
# Load AboutDialog description
67
dglade = gtk.glade.XML(GLADEFILENAME, 'aboutdialog')
68
dialog = dglade.get_widget('aboutdialog')
71
dialog.set_version(__version__)
72
dialog.set_authors([ _i18n("Lead Developer:"),
73
"Szilveszter Farkas <szilveszter.farkas@gmail.com>",
74
_i18n("Contributors:"),
75
"Jelmer Vernooij <jelmer@samba.org>",
76
"Mateusz Korniak <mateusz.korniak@ant.gliwice.pl>",
77
"Gary van der Merwe <garyvdm@gmail.com>" ])
78
dialog.set_artists([ "Simon Pascal Klein <klepas@klepas.org>",
79
"Jakub Steiner <jimmac@novell.com>" ])
86
58
""" The main Olive GTK frontend class. This is called when launching the
106
78
# Get some important menu items
107
79
self.menuitem_add_files = self.toplevel.get_widget('menuitem_add_files')
108
80
self.menuitem_remove_files = self.toplevel.get_widget('menuitem_remove_file')
109
self.menuitem_file_bookmark = self.toplevel.get_widget('menuitem_file_bookmark')
110
81
self.menuitem_file_make_directory = self.toplevel.get_widget('menuitem_file_make_directory')
111
82
self.menuitem_file_rename = self.toplevel.get_widget('menuitem_file_rename')
112
83
self.menuitem_file_move = self.toplevel.get_widget('menuitem_file_move')
113
84
self.menuitem_file_annotate = self.toplevel.get_widget('menuitem_file_annotate')
114
85
self.menuitem_view_show_hidden_files = self.toplevel.get_widget('menuitem_view_show_hidden_files')
115
self.menuitem_view_show_ignored_files = self.toplevel.get_widget('menuitem_view_show_ignored_files')
116
86
self.menuitem_branch = self.toplevel.get_widget('menuitem_branch')
117
87
self.menuitem_branch_init = self.toplevel.get_widget('menuitem_branch_initialize')
118
88
self.menuitem_branch_get = self.toplevel.get_widget('menuitem_branch_get')
119
89
self.menuitem_branch_checkout = self.toplevel.get_widget('menuitem_branch_checkout')
120
90
self.menuitem_branch_pull = self.toplevel.get_widget('menuitem_branch_pull')
121
91
self.menuitem_branch_push = self.toplevel.get_widget('menuitem_branch_push')
122
self.menuitem_branch_update = self.toplevel.get_widget('menuitem_branch_update')
123
92
self.menuitem_branch_revert = self.toplevel.get_widget('menuitem_branch_revert')
124
93
self.menuitem_branch_merge = self.toplevel.get_widget('menuitem_branch_merge')
125
94
self.menuitem_branch_commit = self.toplevel.get_widget('menuitem_branch_commit')
163
126
"on_about_activate": self.on_about_activate,
164
127
"on_menuitem_add_files_activate": self.on_menuitem_add_files_activate,
165
128
"on_menuitem_remove_file_activate": self.on_menuitem_remove_file_activate,
166
"on_menuitem_file_bookmark_activate": self.on_menuitem_file_bookmark_activate,
167
129
"on_menuitem_file_make_directory_activate": self.on_menuitem_file_make_directory_activate,
168
130
"on_menuitem_file_move_activate": self.on_menuitem_file_move_activate,
169
131
"on_menuitem_file_rename_activate": self.on_menuitem_file_rename_activate,
170
132
"on_menuitem_file_annotate_activate": self.on_menuitem_file_annotate_activate,
171
133
"on_menuitem_view_show_hidden_files_activate": self.on_menuitem_view_show_hidden_files_activate,
172
"on_menuitem_view_show_ignored_files_activate": self.on_menuitem_view_show_ignored_files_activate,
173
134
"on_menuitem_view_refresh_activate": self.on_menuitem_view_refresh_activate,
174
135
"on_menuitem_branch_initialize_activate": self.on_menuitem_branch_initialize_activate,
175
136
"on_menuitem_branch_get_activate": self.on_menuitem_branch_get_activate,
194
154
"on_toolbutton_commit_clicked": self.on_menuitem_branch_commit_activate,
195
155
"on_toolbutton_pull_clicked": self.on_menuitem_branch_pull_activate,
196
156
"on_toolbutton_push_clicked": self.on_menuitem_branch_push_activate,
197
"on_toolbutton_update_clicked": self.on_menuitem_branch_update_activate,
198
157
"on_treeview_right_button_press_event": self.on_treeview_right_button_press_event,
199
158
"on_treeview_right_row_activated": self.on_treeview_right_row_activated,
200
159
"on_treeview_left_button_press_event": self.on_treeview_left_button_press_event,
201
"on_treeview_left_button_release_event": self.on_treeview_left_button_release_event,
202
160
"on_treeview_left_row_activated": self.on_treeview_left_row_activated,
203
161
"on_button_location_up_clicked": self.on_button_location_up_clicked,
204
162
"on_button_location_jump_clicked": self.on_button_location_jump_clicked,
205
"on_entry_location_key_press_event": self.on_entry_location_key_press_event,
206
"on_checkbutton_history_toggled": self.on_checkbutton_history_toggled,
207
"on_entry_history_revno_key_press_event": self.on_entry_history_revno_key_press_event,
208
"on_button_history_browse_clicked": self.on_button_history_browse_clicked
163
"on_entry_location_key_press_event": self.on_entry_location_key_press_event
211
166
# Connect the signals to the handlers
243
198
# Apply menu state
244
199
self.menuitem_view_show_hidden_files.set_active(self.pref.get_preference('dotted_files', 'bool'))
245
self.menuitem_view_show_ignored_files.set_active(self.pref.get_preference('ignored_files', 'bool'))
247
201
# We're starting local
248
202
self.remote = False
249
203
self.remote_branch = None
250
204
self.remote_path = None
251
self.remote_revision = None
253
206
self.set_path(os.getcwd())
254
207
self._load_right()
256
209
self._just_started = False
258
def set_path(self, path, force_remote=False):
211
def set_path(self, path):
259
212
self.notbranch = False
262
# Forcing remote mode (reading data from inventory)
214
if os.path.isdir(path):
215
self.image_location_error.destroy()
220
self.wt, self.wtpath = WorkingTree.open_containing(path)
221
except (bzrerrors.NotBranchError, bzrerrors.NoWorkingTree):
222
self.notbranch = True
224
# If we're in the root, we cannot go up anymore
225
if sys.platform == 'win32':
226
drive, tail = os.path.splitdrive(path)
227
if tail in ('', '/', '\\'):
228
self.button_location_up.set_sensitive(False)
230
self.button_location_up.set_sensitive(True)
233
self.button_location_up.set_sensitive(False)
235
self.button_location_up.set_sensitive(True)
236
elif not os.path.isfile(path):
237
# Doesn't seem to be a file nor a directory, trying to open a
263
239
self._show_stock_image(gtk.STOCK_DISCONNECT)
265
241
br = Branch.open_containing(path)[0]
266
242
except bzrerrors.NotBranchError:
267
243
self._show_stock_image(gtk.STOCK_DIALOG_ERROR)
268
self.check_history.set_active(False)
269
self.check_history.set_sensitive(False)
271
245
except bzrerrors.UnsupportedProtocol:
272
246
self._show_stock_image(gtk.STOCK_DIALOG_ERROR)
273
self.check_history.set_active(False)
274
self.check_history.set_sensitive(False)
277
249
self._show_stock_image(gtk.STOCK_CONNECT)
301
270
self.button_location_up.set_sensitive(False)
303
272
self.button_location_up.set_sensitive(True)
305
if os.path.isdir(path):
306
self.image_location_error.destroy()
311
self.wt, self.wtpath = WorkingTree.open_containing(path)
312
except (bzrerrors.NotBranchError, bzrerrors.NoWorkingTree):
313
self.notbranch = True
315
# If we're in the root, we cannot go up anymore
316
if sys.platform == 'win32':
317
drive, tail = os.path.splitdrive(path)
318
if tail in ('', '/', '\\'):
319
self.button_location_up.set_sensitive(False)
321
self.button_location_up.set_sensitive(True)
324
self.button_location_up.set_sensitive(False)
326
self.button_location_up.set_sensitive(True)
327
elif not os.path.isfile(path):
328
# Doesn't seem to be a file nor a directory, trying to open a
330
self._show_stock_image(gtk.STOCK_DISCONNECT)
332
br = Branch.open_containing(path)[0]
333
except bzrerrors.NotBranchError:
334
self._show_stock_image(gtk.STOCK_DIALOG_ERROR)
335
self.check_history.set_active(False)
336
self.check_history.set_sensitive(False)
338
except bzrerrors.UnsupportedProtocol:
339
self._show_stock_image(gtk.STOCK_DIALOG_ERROR)
340
self.check_history.set_active(False)
341
self.check_history.set_sensitive(False)
344
self._show_stock_image(gtk.STOCK_CONNECT)
349
self.remote_branch, self.remote_path = Branch.open_containing(path)
351
if self.remote_revision is None:
352
self.remote_revision = self.remote_branch.last_revision()
354
self.remote_entries = self.remote_branch.repository.get_inventory(self.remote_revision).entries()
356
if len(self.remote_path) == 0:
357
self.remote_parent = self.remote_branch.repository.get_inventory(self.remote_branch.last_revision()).iter_entries_by_dir().next()[1].file_id
359
for (name, type) in self.remote_entries:
360
if name == self.remote_path:
361
self.remote_parent = type.file_id
364
if not path.endswith('/'):
367
if self.remote_branch.base == path:
368
self.button_location_up.set_sensitive(False)
370
self.button_location_up.set_sensitive(True)
373
self.check_history.set_active(False)
374
self.check_history.set_sensitive(False)
376
self.check_history.set_sensitive(True)
378
274
self.statusbar.push(self.context_id, path)
379
275
self.entry_location.set_text(path)
391
287
return self.remote_branch.base
393
289
def on_about_activate(self, widget):
290
from bzrlib.plugins.gtk.dialog import about
396
def on_button_history_browse_clicked(self, widget):
397
""" Browse for revision button handler. """
399
br = self.remote_branch
403
revb = RevisionBrowser(br, self.window)
404
response = revb.run()
405
if response != gtk.RESPONSE_NONE:
408
if response == gtk.RESPONSE_OK:
409
if revb.selected_revno is not None:
410
self.entry_history.set_text(revb.selected_revno)
414
def on_button_location_jump_clicked(self, widget):
415
""" Location Jump button handler. """
416
location = self.entry_location.get_text()
418
if self.set_path(location):
421
293
def on_button_location_up_clicked(self, widget):
422
294
""" Location Up button handler. """
423
295
if not self.remote:
433
305
self.refresh_right()
435
def on_checkbutton_history_toggled(self, widget):
436
""" History Mode toggle handler. """
437
if self.check_history.get_active():
438
# History Mode activated
439
self.entry_history.set_sensitive(True)
440
self.button_history.set_sensitive(True)
442
# History Mode deactivated
443
self.entry_history.set_sensitive(False)
444
self.button_history.set_sensitive(False)
447
def on_entry_history_revno_key_press_event(self, widget, event):
448
""" Key pressed handler for the history entry. """
449
if event.keyval == gtk.gdk.keyval_from_name('Return') or event.keyval == gtk.gdk.keyval_from_name('KP_Enter'):
450
# Return was hit, so we have to load that specific revision
451
# Emulate being remote, so inventory should be used
452
path = self.get_path()
455
self.remote_branch = self.wt.branch
457
revno = int(self.entry_history.get_text())
458
self.remote_revision = self.remote_branch.get_rev_id(revno)
459
if self.set_path(path, True):
307
def on_button_location_jump_clicked(self, widget):
308
""" Location Jump button handler. """
309
location = self.entry_location.get_text()
311
if self.set_path(location):
462
314
def on_entry_location_key_press_event(self, widget, event):
463
315
""" Key pressed handler for the location entry. """
464
if event.keyval == gtk.gdk.keyval_from_name('Return') or event.keyval == gtk.gdk.keyval_from_name('KP_Enter'):
316
if event.keyval == 65293:
465
317
# Return was hit, so we have to jump
466
318
self.on_button_location_jump_clicked(widget)
537
374
from bzrlib.plugins.gtk.merge import MergeDialog
539
376
if self.check_for_changes():
540
error_dialog(_i18n('There are local changes in the branch'),
541
_i18n('Please commit or revert the changes before merging.'))
377
error_dialog(_('There are local changes in the branch'),
378
_('Please commit or revert the changes before merging.'))
543
parent_branch_path = self.wt.branch.get_parent()
544
merge = MergeDialog(self.wt, self.wtpath,default_branch_path=parent_branch_path )
380
merge = MergeDialog(self.wt, self.wtpath)
548
384
def on_menuitem_branch_missing_revisions_activate(self, widget):
549
385
""" Branch/Missing revisions menu handler. """
551
from bzrlib.missing import find_unmerged, iter_log_revisions
553
386
local_branch = self.wt.branch
554
parent_branch_path = local_branch.get_parent()
555
if parent_branch_path is None:
556
error_dialog(_i18n('Parent location is unknown'),
557
_i18n('Cannot determine missing revisions if no parent location is known.'))
388
other_branch = local_branch.get_parent()
389
if other_branch is None:
390
error_dialog(_('Parent location is unknown'),
391
_('Cannot determine missing revisions if no parent location is known.'))
560
parent_branch = Branch.open(parent_branch_path)
562
if parent_branch.base == local_branch.base:
563
parent_branch = local_branch
565
local_extra, remote_extra = find_unmerged(local_branch,parent_branch)
567
if local_extra or remote_extra:
569
## def log_revision_one_line_text(log_revision):
570
## """ Generates one line description of log_revison ended with end of line."""
571
## revision = log_revision.rev
572
## txt = "- %s (%s)\n" % (revision.get_summary(), revision.committer, )
573
## txt = txt.replace("<"," ") # Seems < > chars are expected to be xml tags ...
574
## txt = txt.replace(">"," ")
579
dlg_txt += _i18n('%d local extra revision(s). \n') % (len(local_extra),)
580
## NOTE: We do not want such ugly info about missing revisions
581
## Revision Browser should be used there
582
## max_revisions = 10
583
## for log_revision in iter_log_revisions(local_extra, local_branch.repository, verbose=1):
584
## dlg_txt += log_revision_one_line_text(log_revision)
585
## if max_revisions <= 0:
586
## dlg_txt += _i18n("more ... \n")
588
## max_revisions -= 1
591
dlg_txt += _i18n('%d local missing revision(s).\n') % (len(remote_extra),)
592
## max_revisions = 10
593
## for log_revision in iter_log_revisions(remote_extra, parent_branch.repository, verbose=1):
594
## dlg_txt += log_revision_one_line_text(log_revision)
595
## if max_revisions <= 0:
596
## dlg_txt += _i18n("more ... \n")
598
## max_revisions -= 1
600
info_dialog(_i18n('There are missing revisions'),
394
remote_branch = Branch.open(other_branch)
396
if remote_branch.base == local_branch.base:
397
remote_branch = local_branch
399
ret = len(local_branch.missing_revisions(remote_branch))
402
info_dialog(_('There are missing revisions'),
403
_('%d revision(s) missing.') % ret)
603
info_dialog(_i18n('Local branch up to date'),
604
_i18n('There are no missing revisions.'))
405
info_dialog(_('Local branch up to date'),
406
_('There are no missing revisions.'))
607
409
def on_menuitem_branch_pull_activate(self, widget):
619
421
if branch_to.get_parent() is None:
620
422
branch_to.set_parent(branch_from.base)
424
#old_rh = branch_to.revision_history()
425
#if tree_to is not None:
426
# tree_to.pull(branch_from)
428
# branch_to.pull(branch_from)
622
429
ret = branch_to.pull(branch_from)
624
info_dialog(_i18n('Pull successful'), _i18n('%d revision(s) pulled.') % ret)
627
def on_menuitem_branch_update_activate(self, widget):
628
""" Brranch/checkout update menu handler. """
630
ret = self.wt.update()
631
conflicts = self.wt.conflicts()
633
info_dialog(_i18n('Update successful but conflicts generated'), _i18n('Number of conflicts generated: %d.') % (len(conflicts),) )
635
info_dialog(_i18n('Update successful'), _i18n('No conflicts generated.') )
431
info_dialog(_('Pull successful'), _('%d revision(s) pulled.') % ret)
637
433
def on_menuitem_branch_push_activate(self, widget):
638
434
""" Branch/Push... menu handler. """
639
push = PushDialog(repository=None,revid=None,branch=self.wt.branch, parent=self.window)
435
push = PushDialog(self.wt.branch, self.window)
640
436
response = push.run()
641
437
if response != gtk.RESPONSE_NONE:
676
472
def on_menuitem_branch_tags_activate(self, widget):
677
473
""" Branch/Tags... menu handler. """
678
474
from bzrlib.plugins.gtk.tags import TagsWindow
680
window = TagsWindow(self.wt.branch, self.window)
682
window = TagsWindow(self.remote_branch, self.window)
475
window = TagsWindow(self.wt.branch, self.window)
685
478
def on_menuitem_file_annotate_activate(self, widget):
686
479
""" File/Annotate... menu handler. """
687
480
if self.get_selected_right() is None:
688
error_dialog(_i18n('No file was selected'),
689
_i18n('Please select a file from the list.'))
481
error_dialog(_('No file was selected'),
482
_('Please select a file from the list.'))
692
485
branch = self.wt.branch
693
486
file_id = self.wt.path2id(self.wt.relpath(os.path.join(self.path, self.get_selected_right())))
695
window = GAnnotateWindow(all=False, plain=False, parent=self.window)
488
window = GAnnotateWindow(all=False, plain=False)
696
489
window.set_title(os.path.join(self.path, self.get_selected_right()) + " - Annotate")
697
490
config = GAnnotateConfig(window)
759
540
def on_menuitem_stats_infos_activate(self, widget):
760
541
""" Statistics/Informations... menu handler. """
761
542
from info import OliveInfo
763
info = OliveInfo(self.remote_branch)
765
info = OliveInfo(self.wt.branch)
543
info = OliveInfo(self.wt)
768
546
def on_menuitem_stats_log_activate(self, widget):
769
547
""" Statistics/Log... menu handler. """
548
window = branchwin.BranchWindow()
771
549
if not self.remote:
772
branch = self.wt.branch
550
window.set_branch(self.wt.branch, self.wt.branch.last_revision(), None)
774
branch = self.remote_branch
776
window = branchwin.BranchWindow(branch, branch.last_revision(), None, parent=self.window)
552
window.set_branch(self.remote_branch, self.remote_branch.last_revision(), None)
779
555
def on_menuitem_view_refresh_activate(self, widget):
845
601
selected=self.get_selected_right(),
847
603
# get the menu items
848
m_open = menu.ui.get_widget('/context_right/open')
849
604
m_add = menu.ui.get_widget('/context_right/add')
850
605
m_remove = menu.ui.get_widget('/context_right/remove')
851
606
m_rename = menu.ui.get_widget('/context_right/rename')
852
607
m_revert = menu.ui.get_widget('/context_right/revert')
853
608
m_commit = menu.ui.get_widget('/context_right/commit')
854
m_annotate = menu.ui.get_widget('/context_right/annotate')
855
609
m_diff = menu.ui.get_widget('/context_right/diff')
856
610
# check if we're in a branch
858
612
from bzrlib.branch import Branch
859
613
Branch.open_containing(self.get_path())
861
m_open.set_sensitive(False)
862
m_add.set_sensitive(False)
863
m_remove.set_sensitive(False)
864
m_rename.set_sensitive(False)
865
m_revert.set_sensitive(False)
866
m_commit.set_sensitive(False)
867
m_annotate.set_sensitive(False)
868
m_diff.set_sensitive(False)
870
m_open.set_sensitive(True)
871
m_add.set_sensitive(True)
872
m_remove.set_sensitive(True)
873
m_rename.set_sensitive(True)
874
m_revert.set_sensitive(True)
875
m_commit.set_sensitive(True)
876
m_annotate.set_sensitive(True)
877
m_diff.set_sensitive(True)
614
m_add.set_sensitive(True)
615
m_remove.set_sensitive(True)
616
m_rename.set_sensitive(True)
617
m_revert.set_sensitive(True)
618
m_commit.set_sensitive(True)
619
m_diff.set_sensitive(True)
878
620
except bzrerrors.NotBranchError:
879
m_open.set_sensitive(True)
880
621
m_add.set_sensitive(False)
881
622
m_remove.set_sensitive(False)
882
623
m_rename.set_sensitive(False)
883
624
m_revert.set_sensitive(False)
884
625
m_commit.set_sensitive(False)
885
m_annotate.set_sensitive(False)
886
626
m_diff.set_sensitive(False)
889
menu.right_context_menu().popup(None, None, None, 0,
892
menu.remote_context_menu().popup(None, None, None, 0,
628
menu.right_context_menu().popup(None, None, None, 0,
895
631
def on_treeview_right_row_activated(self, treeview, path, view_column):
896
632
""" Occurs when somebody double-clicks or enters an item in the
961
697
def _load_right(self):
962
698
""" Load data into the right panel. (Filelist) """
963
699
# Create ListStore
964
# Model: [ icon, dir, name, status text, status, size (int), size (human), mtime (int), mtime (local), fileid ]
965
liststore = gtk.ListStore(gobject.TYPE_STRING,
966
gobject.TYPE_BOOLEAN,
700
# Model: [icon, dir, name, status text, status, size (int), size (human), mtime (int), mtime (local)]
701
liststore = gtk.ListStore(str, gobject.TYPE_BOOLEAN, str, str, str, gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_INT, gobject.TYPE_STRING)
1023
734
for rpath, rpathnew, id, kind, text_modified, meta_modified in delta.renamed:
1024
735
if rpathnew == filename:
1025
736
status = 'renamed'
1027
737
for rpath, id, kind in delta.added:
1028
738
if rpath == filename:
1029
739
status = 'added'
1031
740
for rpath, id, kind in delta.removed:
1032
741
if rpath == filename:
1033
742
status = 'removed'
1035
743
for rpath, id, kind, text_modified, meta_modified in delta.modified:
1036
744
if rpath == filename:
1037
745
status = 'modified'
1039
746
for rpath, id, kind in delta.unchanged:
1040
747
if rpath == filename:
1041
748
status = 'unchanged'
1043
749
for rpath, file_class, kind, id, entry in self.wt.list_files():
1044
750
if rpath == filename and file_class == 'I':
1045
751
status = 'ignored'
1047
753
self.wt.unlock()
756
# status = fileops.status(path + os.sep + item)
757
#except errors.PermissionDenied:
1049
760
if status == 'renamed':
1050
st = _i18n('renamed')
1051
762
elif status == 'removed':
1052
st = _i18n('removed')
1053
764
elif status == 'added':
1055
766
elif status == 'modified':
1056
st = _i18n('modified')
1057
768
elif status == 'unchanged':
1058
st = _i18n('unchanged')
1059
770
elif status == 'ignored':
1060
st = _i18n('ignored')
1062
st = _i18n('unknown')
1065
statinfo = os.stat(self.path + os.sep + item)
1071
liststore.append([gtk.STOCK_FILE,
1076
str(statinfo.st_size), # NOTE: if int used there it will fail for large files (size expressed as long int)
1077
self._format_size(statinfo.st_size),
1079
self._format_date(statinfo.st_mtime),
775
statinfo = os.stat(self.path + os.sep + item)
776
liststore.append([gtk.STOCK_FILE, False, item, st, status, statinfo.st_size, self._format_size(statinfo.st_size), statinfo.st_mtime, self._format_date(statinfo.st_mtime)])
1082
778
# Create the columns and add them to the TreeView
1083
779
self.treeview_right.set_model(liststore)
1084
self._tvcolumn_filename = gtk.TreeViewColumn(_i18n('Filename'))
1085
self._tvcolumn_status = gtk.TreeViewColumn(_i18n('Status'))
1086
self._tvcolumn_size = gtk.TreeViewColumn(_i18n('Size'))
1087
self._tvcolumn_mtime = gtk.TreeViewColumn(_i18n('Last modified'))
780
self._tvcolumn_filename = gtk.TreeViewColumn(_('Filename'))
781
self._tvcolumn_status = gtk.TreeViewColumn(_('Status'))
782
self._tvcolumn_size = gtk.TreeViewColumn(_('Size'))
783
self._tvcolumn_mtime = gtk.TreeViewColumn(_('Last modified'))
1088
784
self.treeview_right.append_column(self._tvcolumn_filename)
1089
785
self.treeview_right.append_column(self._tvcolumn_status)
1090
786
self.treeview_right.append_column(self._tvcolumn_size)
1164
850
def set_sensitivity(self):
1165
851
""" Set menu and toolbar sensitivity. """
1168
self.menuitem_branch_init.set_sensitive(self.notbranch)
1169
self.menuitem_branch_get.set_sensitive(self.notbranch)
1170
self.menuitem_branch_checkout.set_sensitive(self.notbranch)
1171
self.menuitem_branch_pull.set_sensitive(not self.notbranch)
1172
self.menuitem_branch_push.set_sensitive(not self.notbranch)
1173
self.menuitem_branch_update.set_sensitive(not self.notbranch)
1174
self.menuitem_branch_revert.set_sensitive(not self.notbranch)
1175
self.menuitem_branch_merge.set_sensitive(not self.notbranch)
1176
self.menuitem_branch_commit.set_sensitive(not self.notbranch)
1177
self.menuitem_branch_tags.set_sensitive(not self.notbranch)
1178
self.menuitem_branch_status.set_sensitive(not self.notbranch)
1179
self.menuitem_branch_missing.set_sensitive(not self.notbranch)
1180
self.menuitem_branch_conflicts.set_sensitive(not self.notbranch)
1181
self.menuitem_stats.set_sensitive(not self.notbranch)
1182
self.menuitem_stats_diff.set_sensitive(not self.notbranch)
1183
self.menuitem_add_files.set_sensitive(not self.notbranch)
1184
self.menuitem_remove_files.set_sensitive(not self.notbranch)
1185
self.menuitem_file_make_directory.set_sensitive(not self.notbranch)
1186
self.menuitem_file_rename.set_sensitive(not self.notbranch)
1187
self.menuitem_file_move.set_sensitive(not self.notbranch)
1188
self.menuitem_file_annotate.set_sensitive(not self.notbranch)
1189
#self.menutoolbutton_diff.set_sensitive(True)
1190
self.toolbutton_diff.set_sensitive(not self.notbranch)
1191
self.toolbutton_log.set_sensitive(not self.notbranch)
1192
self.toolbutton_commit.set_sensitive(not self.notbranch)
1193
self.toolbutton_pull.set_sensitive(not self.notbranch)
1194
self.toolbutton_push.set_sensitive(not self.notbranch)
1195
self.toolbutton_update.set_sensitive(not self.notbranch)
1198
self.menuitem_branch_init.set_sensitive(False)
1199
self.menuitem_branch_get.set_sensitive(True)
1200
self.menuitem_branch_checkout.set_sensitive(True)
1201
self.menuitem_branch_pull.set_sensitive(False)
1202
self.menuitem_branch_push.set_sensitive(False)
1203
self.menuitem_branch_update.set_sensitive(False)
1204
self.menuitem_branch_revert.set_sensitive(False)
1205
self.menuitem_branch_merge.set_sensitive(False)
1206
self.menuitem_branch_commit.set_sensitive(False)
1207
self.menuitem_branch_tags.set_sensitive(True)
1208
self.menuitem_branch_status.set_sensitive(False)
1209
self.menuitem_branch_missing.set_sensitive(False)
1210
self.menuitem_branch_conflicts.set_sensitive(False)
1211
self.menuitem_stats.set_sensitive(True)
1212
self.menuitem_stats_diff.set_sensitive(False)
1213
self.menuitem_add_files.set_sensitive(False)
1214
self.menuitem_remove_files.set_sensitive(False)
1215
self.menuitem_file_make_directory.set_sensitive(False)
1216
self.menuitem_file_rename.set_sensitive(False)
1217
self.menuitem_file_move.set_sensitive(False)
1218
self.menuitem_file_annotate.set_sensitive(False)
1219
#self.menutoolbutton_diff.set_sensitive(True)
1220
self.toolbutton_diff.set_sensitive(False)
1221
self.toolbutton_log.set_sensitive(True)
1222
self.toolbutton_commit.set_sensitive(False)
1223
self.toolbutton_pull.set_sensitive(False)
1224
self.toolbutton_push.set_sensitive(False)
1225
self.toolbutton_update.set_sensitive(False)
852
self.menuitem_branch_init.set_sensitive(self.notbranch)
853
self.menuitem_branch_get.set_sensitive(self.notbranch)
854
self.menuitem_branch_checkout.set_sensitive(self.notbranch)
855
self.menuitem_branch_pull.set_sensitive(not self.notbranch)
856
self.menuitem_branch_push.set_sensitive(not self.notbranch)
857
self.menuitem_branch_revert.set_sensitive(not self.notbranch)
858
self.menuitem_branch_merge.set_sensitive(not self.notbranch)
859
self.menuitem_branch_commit.set_sensitive(not self.notbranch)
860
self.menuitem_branch_tags.set_sensitive(not self.notbranch)
861
self.menuitem_branch_status.set_sensitive(not self.notbranch)
862
self.menuitem_branch_missing.set_sensitive(not self.notbranch)
863
self.menuitem_branch_conflicts.set_sensitive(not self.notbranch)
864
self.menuitem_stats.set_sensitive(not self.notbranch)
865
self.menuitem_add_files.set_sensitive(not self.notbranch)
866
self.menuitem_remove_files.set_sensitive(not self.notbranch)
867
self.menuitem_file_make_directory.set_sensitive(not self.notbranch)
868
self.menuitem_file_rename.set_sensitive(not self.notbranch)
869
self.menuitem_file_move.set_sensitive(not self.notbranch)
870
self.menuitem_file_annotate.set_sensitive(not self.notbranch)
871
#self.menutoolbutton_diff.set_sensitive(True)
872
self.toolbutton_diff.set_sensitive(not self.notbranch)
873
self.toolbutton_log.set_sensitive(not self.notbranch)
874
self.toolbutton_commit.set_sensitive(not self.notbranch)
875
self.toolbutton_pull.set_sensitive(not self.notbranch)
876
self.toolbutton_push.set_sensitive(not self.notbranch)
1227
878
def refresh_left(self):
1228
879
""" Refresh the bookmark list. """
1328
961
for rpath, rpathnew, id, kind, text_modified, meta_modified in delta.renamed:
1329
962
if rpathnew == filename:
1330
963
status = 'renamed'
1332
964
for rpath, id, kind in delta.added:
1333
965
if rpath == filename:
1336
967
for rpath, id, kind in delta.removed:
1337
968
if rpath == filename:
1338
969
status = 'removed'
1340
970
for rpath, id, kind, text_modified, meta_modified in delta.modified:
1341
971
if rpath == filename:
1342
972
status = 'modified'
1344
973
for rpath, id, kind in delta.unchanged:
1345
974
if rpath == filename:
1346
975
status = 'unchanged'
1348
976
for rpath, file_class, kind, id, entry in self.wt.list_files():
1349
977
if rpath == filename and file_class == 'I':
1350
978
status = 'ignored'
1352
980
self.wt.unlock()
1354
982
if status == 'renamed':
1355
st = _i18n('renamed')
1356
984
elif status == 'removed':
1357
st = _i18n('removed')
1358
986
elif status == 'added':
1360
988
elif status == 'modified':
1361
st = _i18n('modified')
1362
990
elif status == 'unchanged':
1363
st = _i18n('unchanged')
1364
992
elif status == 'ignored':
1365
st = _i18n('ignored')
1366
if not ignored_files:
1369
st = _i18n('unknown')
1372
statinfo = os.stat(self.path + os.sep + item)
1378
liststore.append([gtk.STOCK_FILE,
1383
str(statinfo.st_size),
1384
self._format_size(statinfo.st_size),
1386
self._format_date(statinfo.st_mtime),
997
statinfo = os.stat(self.path + os.sep + item)
998
liststore.append([gtk.STOCK_FILE, False, item, st, status, statinfo.st_size, self._format_size(statinfo.st_size), statinfo.st_mtime, self._format_date(statinfo.st_mtime)])