|
From: <ai...@us...> - 2008-12-16 23:41:03
|
Revision: 9157
http://plplot.svn.sourceforge.net/plplot/?rev=9157&view=rev
Author: airwin
Date: 2008-12-16 23:40:58 +0000 (Tue, 16 Dec 2008)
Log Message:
-----------
Update 31st python example to be standalone. Also implement some more of
the tests (although the list is not completed, yet).
Modified Paths:
--------------
trunk/examples/python/CMakeLists.txt
trunk/examples/python/x31
trunk/examples/python/xw31.py
Property Changed:
----------------
trunk/examples/python/xw31.py
Modified: trunk/examples/python/CMakeLists.txt
===================================================================
--- trunk/examples/python/CMakeLists.txt 2008-12-16 23:01:56 UTC (rev 9156)
+++ trunk/examples/python/CMakeLists.txt 2008-12-16 23:40:58 UTC (rev 9157)
@@ -48,7 +48,6 @@
"28"
"29"
"30"
-"31"
)
set(python_SCRIPTS)
@@ -66,9 +65,11 @@
pythondemos.py
x14
x17
+x31
prova.py
xw14.py
xw17.py
+xw31.py
plplot_logo.py
)
Modified: trunk/examples/python/x31
===================================================================
--- trunk/examples/python/x31 2008-12-16 23:01:56 UTC (rev 9156)
+++ trunk/examples/python/x31 2008-12-16 23:40:58 UTC (rev 9157)
@@ -1,54 +1,9 @@
#!/usr/bin/env python
-# Copyright (C) 2004 Alan W. Irwin
-# Copyright (C) 2004 Andrew Ross
-#
-# This file is part of PLplot.
-#
-# PLplot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as published
-# by the Free Software Foundation; version 2 of the License.
-#
-# PLplot 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 Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with the file PLplot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# This is a standalone example since at least one of the tests spans
+# plinit so must be done in the same module.
-
-# Run all python plplot examples non-interactively.
-
-# Append to effective python path so that can find plplot modules.
-from plplot_python_start import *
-
-import sys
-from plplot import *
-
-# Parse and process command line arguments
-plparseopts(sys.argv, PL_PARSE_FULL)
-
-# Test setting / getting page size.
-(xp, yp, xleng, yleng, xoff, yoff) = plgpage()
-xp2 = xp*0.9
-yp2 = yp*0.9
-xleng2 = int(xleng*0.9)
-yleng2 = int(yleng*0.9)
-plspage(xp2, yp2, xleng2, yleng2, xoff, yoff)
-(xp, yp, xleng, yleng, xoff, yoff) = plgpage()
-if xp != xp2*1.1 || yp != yp2 || xleng != xleng2 || yleng != yleng2:
- sys.stderr.write("plgpage test failed\n")
- plend()
- sys.exit(1)
-
-
-# Initialize plplot
-plinit()
-
+# However, provide this wrapper for the standalone module so that it
+# can be run just like the other python examples that are not standalone.
import xw31
-# Terminate plplot
-plend()
-
Modified: trunk/examples/python/xw31.py
===================================================================
--- trunk/examples/python/xw31.py 2008-12-16 23:01:56 UTC (rev 9156)
+++ trunk/examples/python/xw31.py 2008-12-16 23:40:58 UTC (rev 9157)
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
# $Id$
# Copyright (C) 2008 Alan W. Irwin
@@ -20,21 +21,85 @@
# along with PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
+# Append to effective python path so that can find plplot modules.
+from plplot_python_start import *
+
+import sys
+from plplot import *
+
+# Parse and process command line arguments
+plparseopts(sys.argv, PL_PARSE_FULL)
+
+# Test setting / getting page size across plinit.
+xp1 = 200.
+yp1 = 200.
+xleng1 = 400
+yleng1 = 200
+xoff1 = 10
+yoff1 = 20
+plspage(xp1, yp1, xleng1, yleng1, xoff1, yoff1)
+
+compression = plgcompression()
+compression1 = compression + 100
+plscompression(compression1)
+compression2 = plgcompression()
+if compression2 != compression1:
+ sys.stderr.write("plgcompression test failed\n")
+ plend()
+ sys.exit(1)
+plscompression(compression)
+
+(fam, num, bmax) = plgfam()
+fam1 = fam + 100
+num1 = num + 100
+bmax1 = bmax + 100
+plsfam(fam1, num1, bmax1)
+(fam2, num2, bmax2) = plgfam()
+if fam2 != fam1 or num2 != num1 or bmax2 != bmax1:
+ sys.stderr.write("plgfam test failed\n")
+ plend()
+ sys.exit(1)
+plsfam(fam, num, bmax)
+
+# Initialize plplot
+plinit()
+
from plplot_py_demos import *
def main():
+ # Test if device initialization screwed around with any of the
+ # preset page values.
+ (xp2, yp2, xleng2, yleng2, xoff2, yoff2) = plgpage()
+ if xp2 != xp1 or yp2 != yp1 or xleng2 != xleng1 or yleng2 != yleng1 or xoff2 != xoff1 or yoff2 != yoff1:
+ sys.stderr.write("plgpage test failed\n")
+ plend()
+ sys.exit(1)
+
+ # Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure
+ # they work without any obvious error messages.
+ plscolor(1)
+ plscol0(1, 255, 0, 0)
+ r1 = [0, 255]
+ g1 = [255, 0]
+ b1 = [0, 0]
+ a1 = [1.0, 1.0]
+ plscmap1(r1,g1,b1)
+ plscmap1a(r1,g1,b1,a1)
+
+ level = plglevel()
+ if level != 1:
+ sys.stderr.write("plglevel test failed. Level is %d, but 1 expected.\n" % level)
+ plend();
+ sys.exit(1);
+
pladv(0)
plvpor(0.0, 1.0, 0.0, 1.0)
- plwind(0.0, 1.0, 0.0, 1.0)
- plbox("bc", 0.0, 0, "bc", 0.0, 0)
+ plwind(0.2, 0.3, 0.4, 0.5)
- plsvpa(50.0, 150.0, 50.0, 100.0)
- plwind(0.0, 1.0, 0.0, 1.0)
- plbox("bc", 0.0, 0, "bc", 0.0, 0)
- plptex(0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)")
-
# Restore defaults
#plcol0(1)
main()
+# Terminate plplot
+plend()
Property changes on: trunk/examples/python/xw31.py
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|