The selection view now works. Functions can return a dataset.Selection object which will be stored in the selection list.

This commit is contained in:
2006-08-29 23:57:21 +00:00
parent ae7a6a5a0e
commit 1b9aff1c5a
5 changed files with 133 additions and 26 deletions

View File

@@ -271,7 +271,7 @@ class GraphDataset(Dataset):
return G
Dataset._all_dims=set()
class ReverseDict(dict):
"""
A dictionary which can lookup values by key, and keys by value.
@@ -319,7 +319,25 @@ def from_file(filepath):
return out_data
class Selection:
class Selection(dict):
"""Handles selected identifiers along each dimension of a dataset"""
def __init__(self):
self.current_selection={}
def __init__(self, title='Unnamed Selecton'):
self.title = title
def __getitem__(self, key):
if not self.has_key(key):
return None
return dict.__getitem__(self, key)
def dims(self):
return self.keys()
def axis_len(self, axis):
if self._selection.has_key(axis):
return len(self._selection[axis])
return 0
def select(self, axis, labels):
self[axis] = labels