[Kst] branches/work/kst/portto4/kst

Barth Netterfield netterfield at astro.utoronto.ca
Mon Nov 14 14:49:11 UTC 2011


SVN commit 1264183 by netterfield:

Clean up things to make scripting more installable.

Create a pyKst/INSTALL file to explain how to manually install.
This should be easy to do with cmake, but I don't know how, because I don't
know cmake.



 M  +2 -1      cmake/src/kst/CMakeLists.txt  
 M  +40 -21    pyKst/INSTALL  
 M  +0 -7      pyKst/README  
 A             pyKst/demo/vectors.py   pyKst/vectors.py#1257600
 M  +5 -4      pyKst/pykstpp.py  
 A             pyKst/pykstpp_h.py  
 D             pyKst/vectors.py  
 A             src/images/icons.qrc   src/images/images.qrc#1255012
 D             src/images/images.qrc  
 D             src/images/kstScript.txt  
 A             src/libkstapp/kstScript.txt   src/images/kstScript.txt#1257170
 M  +1 -1      src/libkstapp/lineitem.cpp  
 A             src/libkstapp/script.qrc  
 M  +0 -2      src/libkstapp/view.cpp  
 M  +1 -1      src/libkstmath/image.cpp  
 M  +1 -1      src/plugins/dataobject/noiseaddition/noiseaddition.cpp  
 M  +3 -3      tests/dirfile_maker/dirfile_maker.c  


--- branches/work/kst/portto4/kst/cmake/src/kst/CMakeLists.txt #1264182:1264183
@@ -16,7 +16,8 @@
 	endif()
 endif()
 
-kst_add_resources(src/images/images.qrc src/libkstapp/script.qrc)
+kst_add_resources(src/images/icons.qrc)
+kst_add_resources(src/libkstapp/script.qrc)
 
 kst_find_info_files(KstCMakeFiles ${kst_dir}/cmake/*)
 kst_find_info_files(KstCMakeFiles ${kst_dir}/cmake/modules/*)
--- branches/work/kst/portto4/kst/pyKst/INSTALL #1264182:1264183
@@ -1,30 +1,49 @@
-0) make sure you have the absolute latest kst2 from steve
-# sudo apt-get update
-# sudo apt-get upgrade
+To manually install pyKst:
 
-It hopefully will update kst2.
+i) edit pykstpp_h.py to match your local invironment
+You probably only have to edit INCLUDES
 
+ii) install requirements
+-python2 (not python3), because of the following requirement
+-numpy >= 1.6 (1.6.1 is known to work) 
+-scipy >= 0.9 (0.9.0 is known to work)
+   These packages have requirements.
+-QtPy
+
+iii) copy pykstpp.py, pykstpp_h.py, and pykst.py to your system's python script directory
+eg, 
+  [host]$ sudo cp pykstpp.py pykstpp_h.py pykst.py /usr/lib/python2.7
+
+iv) To test it, go into the demo directory, and try one.
+  [host]$ python2 vectors.py
+
+I have no idea if this works on anything other than linux.
+
+======
+Example for ubuntu:
+
+0) make sure you have the absolute latest kst2 from steve.  See kst.kde.org
+
 1) install dependencies for numpy and scipy
 sudo apt-get install python python-dev libatlas-base-dev gcc gfortran g++
 
-2) Install numpy 1.6.1
-# tar xvfz numpy-1.6.1.tar.gz
-# cd numpy-1.6.1/
-# python setup.py build --fcompiler=gnu95
-# sudo python setup.py install
+2) Install numpy 1.6.1 (ubuntu's default is not new enough)
+[host]$ tar xvfz numpy-1.6.1.tar.gz
+[host]$ cd numpy-1.6.1/
+[host]$ python setup.py build --fcompiler=gnu95
+[host]$ sudo python setup.py install
 
-3) Install scipy-0.9.0 +
-# tar xvfz scipy-0.9.0.tar.gz
-# cd cd scipy-0.9.0
-# sudo python setup.py install
+3) Install scipy-0.9.0 (ubuntu's default is not new enough)
+[host]$ tar xvfz scipy-0.9.0.tar.gz
+[host]$ cd scipy-0.9.0
+[host]$ sudo python setup.py install
 
-4) copy pykstpp.py and pykst.py into the directory where you will be writing and running your own python scripts.
-(Note: this is totally lame, and will change 'soon'.)
-(Note: you may want to get new versions of these from time to time until I properly fix things)
+4) edit pykstpp_h.py
+Change INCLUDES as suggested by comments in pykstpp_h.py
 
-5) testing it
-vectors.py and matrix.py are two test scripts that you can run to see if everything is working.
-pykstpp.py and pykst.py need to be in the same directory as these scripts if you expect it to work.
+5) copy files
+  [host]$ sudo cp pykstpp.py pykstpp_h.py pykst.py /usr/lib/python2.7
 
-
-
+6) test it
+[host]$ cd demo
+[host]$ python2.7 vectors.py
--- branches/work/kst/portto4/kst/pyKst/README #1264182:1264183
@@ -28,10 +28,3 @@
 
 ----------------
 
-Adding a scripting command:
-
-i) add to pykst.py
-
-ii) add to scriptserver.h
-iii) define in scriptserver.cpp
-
--- branches/work/kst/portto4/kst/pyKst/pykstpp.py #1264182:1264183
@@ -1,5 +1,6 @@
 import numpy as npy
 from scipy.weave import inline
+import pykstpp_h as pykstpp_h
 
 def get_arr(arr,socket,handle):
     dtype2ctype = {
@@ -56,7 +57,7 @@
 
     socket=str(socket)
     handle=str(handle)
-    inline(code, ['arr','socket','handle'],support_code=support_code,include_dirs=["/usr/include/qt4/QtCore","/usr/include/qt4/QtNetwork","/usr/include/qt4"],libraries=["QtCore","QtNetwork"],runtime_library_dirs=["/usr/lib/"])
+    inline(code, ['arr','socket','handle'],support_code=support_code,include_dirs=pykstpp_h.INCLUDES,libraries=pykstpp_h.LIBS,runtime_library_dirs=pykstpp_h.LIBDIRS)
     # I'm not sure if the above line can be made portable or not...
 
 
@@ -126,7 +127,7 @@
 
     socket=str(socket)
     handle=str(handle)
-    inline(code, ['arr','socket','handle'],support_code=support_code,include_dirs=["/usr/include/qt4/QtCore","/usr/include/qt4/QtNetwork","/usr/include/qt4"],libraries=["QtCore","QtNetwork"],runtime_library_dirs=["/usr/lib/"])
+    inline(code, ['arr','socket','handle'],support_code=support_code,include_dirs=pykstpp_h.INCLUDES,libraries=pykstpp_h.LIBS,runtime_library_dirs=pykstpp_h.LIBDIRS)
     # I'm not sure if the above line can be made portable or not...
 
 
@@ -196,7 +197,7 @@
 
     socket=str(socket)
     handle=str(handle)
-    inline(code, ['arr','socket','handle'],support_code=support_code,include_dirs=["/usr/include/qt4/QtCore","/usr/include/qt4/QtNetwork","/usr/include/qt4"],libraries=["QtCore","QtNetwork"],runtime_library_dirs=["/usr/lib/"])
+    inline(code, ['arr','socket','handle'],support_code=support_code,include_dirs=pykstpp_h.INCLUDES,libraries=pykstpp_h.LIBS,runtime_library_dirs=pykstpp_h.LIBDIRS)
     # I'm not sure if the above line can be made portable or not...
 
 
@@ -260,5 +261,5 @@
 
     socket=str(socket)
     handle=str(handle)
-    inline(code, ['arr','nX','nY','socket','handle'],support_code=support_code,include_dirs=["/usr/include/qt4/QtCore","/usr/include/qt4/QtNetwork","/usr/include/qt4"],libraries=["QtCore","QtNetwork"],runtime_library_dirs=["/usr/lib/"])
+    inline(code, ['arr','nX','nY','socket','handle'],support_code=support_code,include_dirs=pykstpp_h.INCLUDES,libraries=pykstpp_h.LIBS,runtime_library_dirs=pykstpp_h.LIBDIRS)
     # I'm not sure if the above line can be made portable or not...
--- branches/work/kst/portto4/kst/src/libkstapp/lineitem.cpp #1264182:1264183
@@ -186,7 +186,7 @@
     return QGraphicsRectItem::mouseMoveEvent(event);
 
   QPointF p = event->pos();
-  QPointF s = event->scenePos();
+  //QPointF s = event->scenePos();
 
   if (gripMode() == ViewItem::Resize) {
     switch(activeGrip()) {
--- branches/work/kst/portto4/kst/src/libkstapp/view.cpp #1264182:1264183
@@ -624,10 +624,8 @@
 // plot, then break.
 void View::configurePlotFontDefaults(PlotItem *plot) {
   if (plot) {
-    bool configured = false;
     foreach(PlotItem* plotItem, PlotItemManager::self()->plotsForView(this)) {
       if (plot != plotItem) {
-        configured = true;
         plot->setGlobalFont(plotItem->globalFont());
         plot->setGlobalFontScale(plotItem->globalFontScale());
         plot->setGlobalFontColor(plotItem->globalFontColor());
--- branches/work/kst/portto4/kst/src/libkstmath/image.cpp #1264182:1264183
@@ -589,7 +589,7 @@
 #endif
       //draw the contourmap
       if (image->hasContourMap()) {
-        QColor tempColor = image->contourColor();
+        //QColor tempColor = image->contourColor();
         bool variableWeight = image->contourWeight() < 0;
         int lineWeight=1;
         if (!variableWeight) {
--- branches/work/kst/portto4/kst/src/plugins/dataobject/noiseaddition/noiseaddition.cpp #1264182:1264183
@@ -169,7 +169,7 @@
     gsl_rng_free( pRandomNumberGenerator );
   }
 
-  return true;
+  return iRetVal;
 }
 
 
--- branches/work/kst/portto4/kst/tests/dirfile_maker/dirfile_maker.c #1264182:1264183
@@ -83,10 +83,10 @@
   fclose(fpf);
 
   /* make curfile */
-  fpf = fopen("dm.cur", "w");
-  fprintf(fpf,"%s", dirfilename);
-  fclose(fpf);
+  unlink("dm.lnk");
+  symlink(dirfilename, "dm.lnk");
 
+  printf("starting loop\n");
   while (1) {
     /* write 'fcount' */
     for (i=0; i<df[FCOUNT].spf; i++) {


More information about the Kst mailing list