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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user