diff options
Diffstat (limited to 'src/ventoo/AugFileTree.py')
-rw-r--r-- | src/ventoo/AugFileTree.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/ventoo/AugFileTree.py b/src/ventoo/AugFileTree.py new file mode 100644 index 0000000..7e6c85f --- /dev/null +++ b/src/ventoo/AugFileTree.py @@ -0,0 +1,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) |