cell1 = gtk.CellRendererText()
cell1.set_property('width', 90)
size_col.pack_start(cell1, True)
- size_col.add_attribute(cell1, 'text', 1)
+ size_col.add_attribute(cell1, 'text', 0)
treeview.append_column(size_col)
# 'Path' column
path_col = gtk.TreeViewColumn(_('Path'))
cell2 = gtk.CellRendererText()
path_col.pack_start(cell2, True)
- path_col.add_attribute(cell2, 'markup', 0)
+ path_col.add_attribute(cell2, 'markup', 1)
treeview.append_column(path_col)
# Column sorting
treeview.set_search_column(1)
- path_col.set_sort_column_id(0)
+ path_col.set_sort_column_id(1)
size_col.set_sort_column_id(2)
# Add treeview to scrolled window
relpaths_tbtn.connect('clicked', self._show_relpaths)
abspaths_tbtn.connect('clicked', self._show_abspaths)
+ bitesizes_tbtn = gtk.ToggleToolButton()
+ bitesizes_tbtn.set_label(_('Sizes in bytes'))
+ bitesizes_tbtn.connect('clicked', self._show_bitesizes)
+
saveresults_tbtn = gtk.ToolButton('gtk-save')
saveresults_tbtn.connect('clicked', self.save_results)
toolbar.insert(relpaths_tbtn, -1)
toolbar.insert(abspaths_tbtn, -1)
+ toolbar.insert(bitesizes_tbtn, -1)
toolbar.insert(saveresults_tbtn, -1)
toolbar.insert(copyresults_tbtn, -1)
def _show_relpaths(self, btn):
self.liststore.clear()
for bsize, path, size in self.filelist:
- self.liststore.append([path.replace(self.start_path,'', 1),
- size, bsize])
+ self.liststore.append([size, path.replace(self.start_path,'', 1),
+ bsize])
def _show_abspaths(self, btn):
self.liststore.clear()
for bsize, path, size in self.filelist:
#self.liststore.append([abspath(path), size, bsize])
# Mark absolute part of path with color
- self.liststore.append([
+ self.liststore.append([size,
'<span background="lawngreen">' + abspath(self.start_path) + '</span>' +
path.replace(self.start_path,'', 1),
- size, bsize])
+ bsize])
+
+ def _show_bitesizes(self, btn):
+ if btn.get_active():
+ for i, (bsize, path, size) in enumerate(self.filelist):
+ self.liststore[i][0] = bsize
+ else:
+ for i, (bsize, path, size) in enumerate(self.filelist):
+ self.liststore[i][0] = size
def save_results(self, btn):
"""Show 'Save to file' dialog."""