#!/usr/bin/env python
+# -*- coding: utf-8 -*-
'''
hooke_cli.py
This program is released under the GNU General Public License version 2.
'''
-from libhooke import * #FIXME
-import libhookecurve as lhc
-
-import libinput as linp
-import liboutlet as lout
-
-from libhooke import WX_GOOD
-from libhooke import HOOKE_VERSION
+from .libhooke import HOOKE_VERSION, WX_GOOD
import wxversion
wxversion.select(WX_GOOD)
from sys import version as python_version
import platform
+from .libhooke import PlaylistXML
+from . import libhookecurve as lhc
+from . import libinput as linp
+from . import liboutlet as lout
-class HookeCli(cmd.Cmd):
+
+class HookeCli(cmd.Cmd, object):
def __init__(self,frame,list_of_events,events_from_gui,config,drivers):
cmd.Cmd.__init__(self)
self.prompt = 'hooke: '
-
-
self.current_list=[] #the playlist we're using
-
self.current=None #the current curve under analysis.
self.plots=None
'''
then undergoes modifications by the plotmanip
modifier functions. The modified plot is saved in self.plots and used if needed by other functions.
'''
-
-
self.pointer=0 #a pointer to navigate the current list
#Things that come from outside
self.current_list, self.playlist_generics=playxml.load(play_to_load)
self.current_playxml=playxml
except IOError:
- print 'File not found.'
+ print 'File not found.', play_to_load
return
- print 'Loaded %s curves' %len(self.current_list)
+ print 'Loaded %s curves from %s' \
+ % (len(self.current_list), play_to_load)
if 'pointer' in self.playlist_generics.keys():
self.pointer=int(self.playlist_generics['pointer'])
else:
SLASH="/"
if list_path[-1] == SLASH:
- list_path=list_path+'*.*'
- else:
- list_path=list_path+SLASH+'*.*'
-
- #expanding correctly the input list with the glob module :)
+ list_path=list_path+'*'
+ else:
+ list_path=list_path+SLASH+'*'
+
+ #expanding correctly the input list with the glob module :)
list_files=glob.glob(list_path)
list_files.sort()
Syntax: plot
'''
def do_plot(self,args):
-
- self.current.identify(self.drivers)
+ if self.current.identify(self.drivers) == False:
+ return
self.plots=self.current.curve.default_plots()
try:
self.plots=self.current.curve.default_plots()
except:
pass
- columns=[]
+ try:
+ outofplot=self.plots[whichplot].vectors
+ except:
+ print "Plot index out of range."
+ return 0
+
+ columns=[]
for dataset in self.plots[whichplot].vectors:
for i in range(0,len(dataset)):
columns.append([])
print self.current_list[self.pointer].notes
else:
if self.notes_filename == None:
+ if not os.path.exists(os.path.realpath('output')):
+ os.mkdir('output')
self.notes_filename=raw_input('Notebook filename? ')
+ self.notes_filename=os.path.join(os.path.realpath('output'),self.notes_filename)
title_line='Notes taken at '+time.asctime()+'\n'
- f=open(self.notes_filename,'w')
+ f=open(self.notes_filename,'a')
f.write(title_line)
f.close()