281
280
self.tb_refresh_icon.set_from_file(icon_path("refresh.png"))
282
281
self.tb_refresh = gtk.ToolButton(self.tb_refresh_icon, _i18n("Refresh"))
283
282
self.tb_refresh.connect('clicked', self.signal.on_menuitem_view_refresh_activate)
284
self.tb_refresh.set_tooltip_text(_i18n("Refresh the file list"))
285
self.tb_refresh.set_is_important(True)
286
283
self.tb.add(self.tb_refresh)
288
285
self.tb_diff_icon = gtk.Image()
289
286
self.tb_diff_icon.set_from_file(icon_path("diff.png"))
290
287
self.tb_diff = gtk.ToolButton(self.tb_diff_icon, _i18n("Diff"))
291
288
self.tb_diff.connect('clicked', self.signal.on_menuitem_stats_diff_activate)
292
self.tb_diff.set_tooltip_text(_i18n("View changes since last commit"))
293
289
self.tb.add(self.tb_diff)
295
291
self.tb_log_icon = gtk.Image()
296
292
self.tb_log_icon.set_from_file(icon_path("log.png"))
297
293
self.tb_log = gtk.ToolButton(self.tb_log_icon, _i18n("Log"))
298
294
self.tb_log.connect('clicked', self.signal.on_menuitem_stats_log_activate)
299
self.tb_log.set_tooltip_text(_i18n("View the revision history"))
300
295
self.tb.add(self.tb_log)
302
297
self.tb.add(gtk.SeparatorToolItem())
315
308
self.tb_pull_icon.set_from_file(icon_path("pull.png"))
316
309
self.tb_pull = gtk.ToolButton(self.tb_pull_icon, _i18n("Pull"))
317
310
self.tb_pull.connect('clicked', self.signal.on_menuitem_branch_pull_activate)
318
self.tb_pull.set_tooltip_text(_i18n("Pull changes from the parent branch"))
319
311
self.tb.add(self.tb_pull)
321
313
self.tb_push_icon = gtk.Image()
322
314
self.tb_push_icon.set_from_file(icon_path("push.png"))
323
315
self.tb_push = gtk.ToolButton(self.tb_push_icon, _i18n("Push"))
324
316
self.tb_push.connect('clicked', self.signal.on_menuitem_branch_push_activate)
325
self.tb_push.set_tooltip_text(_i18n("Push the branch to a remote location"))
326
317
self.tb.add(self.tb_push)
328
319
self.tb_update_icon = gtk.Image()
329
320
self.tb_update_icon.set_from_file(icon_path("pull.png"))
330
321
self.tb_update = gtk.ToolButton(self.tb_update_icon, _i18n("Update"))
331
322
self.tb_update.connect('clicked', self.signal.on_menuitem_branch_update_activate)
332
self.tb_update.set_tooltip_text(_i18n("Update the working tree"))
333
323
self.tb.add(self.tb_update)
335
325
def _create_locationbar(self):
348
338
self.entry_location.connect("activate", self.signal.on_button_location_jump_clicked)
349
339
self.locationbar.pack_start(self.entry_location, True, True, 0)
351
self.location_status = gtk.Image()
352
self.location_status.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_BUTTON)
353
self.locationbar.pack_start(self.location_status, False, False, 0)
341
self.image_location_error = gtk.Image()
342
self.image_location_error.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_BUTTON)
343
self.locationbar.pack_start(self.image_location_error, False, False, 0)
355
345
self.button_location_jump = gtk.Button(stock=gtk.STOCK_JUMP_TO)
356
346
self.button_location_jump.set_relief(gtk.RELIEF_NONE)
383
373
self.scrolledwindow_left.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
385
375
self.treeview_left = gtk.TreeView()
376
self.treeview_left.set_headers_visible(False)
386
377
self.treeview_left.connect("button-press-event", self.signal.on_treeview_left_button_press_event)
387
378
self.treeview_left.connect("row-activated", self.signal.on_treeview_left_row_activated)
388
379
self.scrolledwindow_left.add(self.treeview_left)
390
self.bookmarklist = gtk.ListStore(gobject.TYPE_STRING,
393
self.treeview_left.set_model(self.bookmarklist)
395
icon = gtk.CellRendererPixbuf()
396
cell = gtk.CellRendererText()
398
col_bookmark = gtk.TreeViewColumn(_i18n('Bookmarks'))
399
col_bookmark.pack_start(icon, False)
400
col_bookmark.pack_start(cell, False)
401
col_bookmark.set_attributes(icon, stock_id=2)
402
col_bookmark.add_attribute(cell, 'text', 0)
403
self.treeview_left.append_column(col_bookmark)
381
# Move olive/__init__.py _load_left List creation here
405
383
def _create_filelist(self):
406
384
""" Creates the file list (a ListStore in a TreeView in a ScrolledWindow)"""
385
# Model: [ icon, dir, name, status text, status, size (int), size (human), mtime (int), mtime (local), fileid ]
407
386
self.scrolledwindow_right = gtk.ScrolledWindow()
408
387
self.scrolledwindow_right.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
411
390
self.treeview_right.connect("button-press-event", self.signal.on_treeview_right_button_press_event)
412
391
self.treeview_right.connect("row-activated", self.signal.on_treeview_right_row_activated)
413
392
self.scrolledwindow_right.add(self.treeview_right)
415
# Model: [ icon, dir, name, status text, status, size (int), size (human), mtime (int), mtime (local), fileid ]
416
self.filelist = gtk.ListStore(gobject.TYPE_STRING,
417
gobject.TYPE_BOOLEAN,
426
self.treeview_right.set_model(self.filelist)
429
cellpb = gtk.CellRendererPixbuf()
430
cell = gtk.CellRendererText()
431
# For columns that get a different text color based on status (4)
432
cellstatus = gtk.CellRendererText()
434
self.col_filename = gtk.TreeViewColumn(_i18n('Filename'))
435
self.col_filename.pack_start(cellpb, False)
436
self.col_filename.pack_start(cell, True)
437
self.col_filename.set_attributes(cellpb, stock_id=0)
438
self.col_filename.add_attribute(cell, 'text', 2)
439
self.col_filename.set_resizable(True)
440
self.treeview_right.append_column(self.col_filename)
442
self.col_status = gtk.TreeViewColumn(_i18n('Status'))
443
self.col_status.pack_start(cellstatus, True)
444
self.col_status.add_attribute(cellstatus, 'text', 3)
445
self.col_status.set_cell_data_func(cellstatus, self._map_status_color)
446
self.col_status.set_resizable(True)
447
self.treeview_right.append_column(self.col_status)
449
self.col_size = gtk.TreeViewColumn(_i18n('Size'))
450
self.col_size.pack_start(cell, True)
451
self.col_size.add_attribute(cell, 'text', 6)
452
self.col_size.set_resizable(True)
453
self.treeview_right.append_column(self.col_size)
455
self.col_mtime = gtk.TreeViewColumn(_i18n('Last modified'))
456
self.col_mtime.pack_start(cell, True)
457
self.col_mtime.add_attribute(cell, 'text', 8)
458
self.col_mtime.set_resizable(True)
459
self.treeview_right.append_column(self.col_mtime)
461
# Set up the properties of the TreeView
462
self.treeview_right.set_headers_visible(True)
463
self.treeview_right.set_headers_clickable(True)
464
self.treeview_right.set_search_column(1)
467
self.filelist.set_sort_func(13, self.signal._sort_filelist_callback, None)
468
self.filelist.set_sort_column_id(13, gtk.SORT_ASCENDING)
469
self.col_filename.set_sort_column_id(13)
470
self.col_status.set_sort_column_id(3)
471
self.col_size.set_sort_column_id(5)
472
self.col_mtime.set_sort_column_id(7)
474
def _map_status_color(self, column, cell, model, iter):
475
status = model.get_value(iter, 4)
476
if status == 'unchanged':
477
colorstatus = gtk.gdk.color_parse('black')
478
weight = 400 # standard value
479
elif status == 'removed':
480
colorstatus = gtk.gdk.color_parse('red')
482
elif status == 'added':
483
colorstatus = gtk.gdk.color_parse('green')
485
elif status == 'modified':
486
colorstatus = gtk.gdk.color_parse("#FD00D3")
488
elif status == 'renamed':
489
colorstatus = gtk.gdk.color_parse('blue')
491
elif status == 'ignored':
492
colorstatus = gtk.gdk.color_parse('grey')
494
else: # status == unknown
495
colorstatus = gtk.gdk.color_parse('orange')
497
cell.set_property('foreground-gdk', colorstatus)
498
cell.set_property('weight', weight)
394
# Move olive/__init__.py _load_right List creation here
500
396
def set_view_to_localbranch(self, notbranch=False):
501
397
""" Change the sensitivity of gui items to reflect the fact that the path is a branch or not"""
556
452
self.tb_pull.set_sensitive(False)
557
453
self.tb_push.set_sensitive(False)
558
454
self.tb_update.set_sensitive(False)
560
def set_location_status(self, stock_id, allowPopup=False):
561
self.location_status.destroy()
563
self.location_status = gtk.Button()
564
self.location_status.set_relief(gtk.RELIEF_NONE)
565
image = gtk.image_new_from_stock(stock_id, gtk.ICON_SIZE_BUTTON)
567
self.location_status.add(image)
569
self.location_status = gtk.image_new_from_stock(stock_id, gtk.ICON_SIZE_BUTTON)
570
self.locationbar.pack_start(self.location_status, False, False, 0)
571
if sys.platform == 'win32':
572
self.locationbar.reorder_child(self.location_status, 2)
574
self.locationbar.reorder_child(self.location_status, 1)
575
self.location_status.show()