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