Added modular directory structure.
[hooke.git] / hooke / hooke_cli.py
old mode 100755 (executable)
new mode 100644 (file)
index fc0cee3..886563b
@@ -10,14 +10,7 @@ Copyright (C) 2006 Massimo Sandal (University of Bologna, Italy).
 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)
@@ -47,17 +40,19 @@ from numpy import __version__ as numpy_version
 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
         '''
@@ -71,8 +66,6 @@ class HookeCli(cmd.Cmd):
         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
@@ -239,10 +232,11 @@ Syntax: loadlist [playlist file]
             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'])
@@ -514,8 +508,8 @@ Plots the current force curve
 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()