Fix relative import syntax.
[calibcant.git] / calibcant / common.py
index 24e5f1d9449c926c2fbe4ae523c3e4eff553b4ac..3f09e9d295615b3be26fb5c412ed492bc201cdef 100644 (file)
@@ -1,36 +1,34 @@
 # calibcant - tools for thermally calibrating AFM cantilevers
 #
-# Copyright (C) 2007,2008, William Trevor King
+# Copyright (C) 2008-2010 W. Trevor King <wking@drexel.edu>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
+# This file is part of CalibCant.
 #
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
+# CalibCant is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation, either
+# version 3 of the License, or (at your option) any later version.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# CalibCant is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
 #
-# The author may be contacted at <wking@drexel.edu> on the Internet, or
-# write to Trevor King, Drexel University, Physics Dept., 3141 Chestnut St.,
-# Philadelphia PA 19104, USA.
+# You should have received a copy of the GNU Lesser General Public
+# License along with CalibCant.  If not, see
+# <http://www.gnu.org/licenses/>.
 
-import config
+from . import VERSION
+from . import config
 
-VERSION="0.2"
 
 # handle extra verbose input modules, only imported if we need them
 _flush_plot = None
 _final_flush_plot = None
 _pylab = None
+def _dummy_fn(): pass
 
-def _import_pylab() :
+def _import_pylab() :  # TODO: auto detect no DISPLAY and abort
     """Import pylab plotting functions for when we need to plot.  This
     function can be called multiple times, and ensures that the pylab
     setup is only imported once.  It defines the functions
@@ -46,12 +44,12 @@ def _import_pylab() :
         if config.PYLAB_INTERACTIVE :
             _flush_plot = _pylab.draw
         else :
-            def _flush_plot () : pass
+            _flush_plot = _pylab.show #_dummy_fn
     if _final_flush_plot == None :
         if config.PYLAB_INTERACTIVE :
             _final_flush_plot = _pylab.draw
         else :
-            _final_flush_plot = _pylab.show
+            _final_flush_plot = _dummy_fn # _pylab.show
 
 def write_array(ofile, array, seperator):
     """Erite an iterable array seperated by seperator.