Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

py_axes.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2008 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: py_axes.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.9 $       $Date: 2008/03/27 19:36:51 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *  Python Axes control interface.
00019  ***************************************************************************/
00020 
00021 #include "py_commands.h"
00022 #include "CommandQueue.h"
00023 #include "VMDApp.h"
00024 #include "Axes.h"
00025 
00026 // get_location()
00027 static PyObject *get_location(PyObject *self, PyObject *args) {
00028   if (!PyArg_ParseTuple(args, (char *)":axes.get_location"))
00029     return NULL;
00030 
00031   VMDApp *app = get_vmdapp(); 
00032   return PyString_FromString(app->axes->loc_description(app->axes->location()));
00033 }
00034 
00035 // set_location(locale)
00036 static PyObject *set_location(PyObject *self, PyObject *args) {
00037   char *location;
00038   if (!PyArg_ParseTuple(args, (char *)"s:axes.set_location", &location))
00039     return NULL;
00040 
00041   VMDApp *app = get_vmdapp();
00042   if (app->axes_set_location(location)) {
00043     Py_INCREF(Py_None);
00044     return Py_None;
00045   }
00046   PyErr_SetString(PyExc_ValueError, (char *)"Invalid axes location");
00047   return NULL;
00048 }
00049   
00050 static PyMethodDef methods[] = {
00051   {(char *)"get_location", (vmdPyMethod)get_location, METH_VARARGS},
00052   {(char *)"set_location", (vmdPyMethod)set_location, METH_VARARGS},
00053   {NULL, NULL}
00054 };
00055 
00056 void initaxes() {
00057   PyObject *m = Py_InitModule((char *)"axes", methods);
00058   VMDApp *app = get_vmdapp();
00059   PyModule_AddStringConstant(m, (char *)"OFF", (char *)app->axes->loc_description(0));
00060   PyModule_AddStringConstant(m, (char *)"ORIGIN", (char *)app->axes->loc_description(1));
00061   PyModule_AddStringConstant(m, (char *)"LOWERLEFT", (char *)app->axes->loc_description(2));
00062   PyModule_AddStringConstant(m, (char *)"LOWERRIGHT", (char *)app->axes->loc_description(3));
00063   PyModule_AddStringConstant(m, (char *)"UPPERLEFT", (char *)app->axes->loc_description(4));
00064   PyModule_AddStringConstant(m, (char *)"UPPERRIGHT", (char *)app->axes->loc_description(5));
00065 }

Generated on Fri Sep 5 01:25:10 2008 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002