blob: 7e6c85f8ffc4a69bf93037588f5383e5696dfcbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
"""
This file is part of the Ventoo program.
This is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this software. If not, see <http://www.gnu.org/licenses/>.
Copyright 2010 Christopher Harvey
"""
import os.path as osp
import pygtk
pygtk.require('2.0')
import gtk
class AugFileTree(gtk.TreeView):
def __init__(self):
self.tv_store = gtk.TreeStore(str)
gtk.TreeView.__init__(self, self.tv_store)
self.column = gtk.TreeViewColumn('Parsed files')
self.append_column(self.column)
self.cell = gtk.CellRendererText()
# add the cell to the tvcolumn and allow it to expand
self.column.pack_start(self.cell, True)
# set the cell "text" attribute to column 0 - retrieve text
# from that column in treestore
self.column.add_attribute(self.cell, 'text', 0)
def addPath(self, p):
self.tv_store.append(None, [p])
def clearFiles(self):
self.tv_store.clear()
def getSelectedConfigFilePath(self):
currentSelection = self.get_selection()
if currentSelection.count_selected_rows()!=1:
raise RuntimeException("User selected more that one row from the file list...should never be possible.")
selectedSystemPathTuple = currentSelection.get_selected()
selectedIter = selectedSystemPathTuple[1]
return self.tv_store.get_value(selectedIter, 0)
|