4 Basic Viewer and ascii saver example
6 Copyright (C) 2008 Alberto Gomez-Casado (University of Twente).
8 This program is released under the GNU General Public License version 2.
12 import liboutlet as lout
13 import libinput as linput
19 action=[] #alias to call the actual viewer function, makes it general
22 def setdtype(self, dt):
23 #determines wich type of data will be retrieved from outlet
27 #TODO should print only data matching 'type'
28 self.source.printbuf()
31 #retrieves data from outlet
32 self.data=self.source.read_type(self.dtype)
37 #example viewer, it just retrieves data and writes it to a text file
38 #probably this should be in viewer.py?
40 def __init__(self,outref):
42 #tells the viewer which outlet has the data (so far only one in hooke)
44 #this allows to call dump (or any other function, depending on the viewer) from the CLI using 'vwaction'
47 #retrieves and saves data
49 destination=linput.safeinput('Enter filename:',['results.txt'])
50 destfile=open(destination,'w+')
51 destfile.write('\n'.join(self.data))