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

py_selection.C File Reference

#include "py_commands.h"
#include "AtomSel.h"
#include "VMDApp.h"
#include "MoleculeList.h"
#include "SymbolTable.h"
#include "Measure.h"
#include "SpatialSearch.h"

Go to the source code of this file.

Defines

#define SYMBOL_TABLE_FUNC(funcname, elemtype)

Functions

PyObject * py_getmacro (PyObject *self, PyObject *args, PyObject *kwargs)
PyObject * py_allmacros (PyObject *self, PyObject *args)
PyObject * py_addmacro (PyObject *self, PyObject *args, PyObject *kwargs)
PyObject * py_delmacro (PyObject *self, PyObject *args, PyObject *kwargs)
PyObject * initselection ()

Variables

const char getmacro_doc []
const char allmacro_doc []
const char addmacro_doc []
const char delmacro_doc []
PyMethodDef selection_methods []
const char module_doc []


Define Documentation

#define SYMBOL_TABLE_FUNC funcname,
elemtype   
 

Value:

static PyObject *funcname(PyObject *self) { \
  VMDApp *app = get_vmdapp(); \
  if (!app) return NULL; \
  PyObject *result = PyList_New(0); \
  if (!result) return NULL; \
  SymbolTable *table = app->atomSelParser; \
  int i, n = table->fctns.num(); \
  for (i=0; i<n; i++) \
    if (table->fctns.data(i)->is_a == elemtype && \
        strlen(table->fctns.name(i))) { \
      PyObject *tmp = as_pystring(table->fctns.name(i)); \
      PyList_Append(result, tmp); \
      Py_XDECREF(tmp); \
  } \
  return result; \
}

Definition at line 153 of file py_selection.C.


Function Documentation

PyObject* initselection  
 

Definition at line 213 of file py_selection.C.

References module_doc, NULL, and selection_methods.

PyObject* py_addmacro PyObject *    self,
PyObject *    args,
PyObject *    kwargs
[static]
 

Definition at line 105 of file py_selection.C.

References SymbolTable::add_custom_singleword, VMDApp::atomSelParser, get_vmdapp, and NULL.

PyObject* py_allmacros PyObject *    self,
PyObject *    args
[static]
 

Definition at line 60 of file py_selection.C.

References as_pystring, VMDApp::atomSelParser, SymbolTable::custom_singleword_name, get_vmdapp, NULL, SymbolTable::num_custom_singleword, and result.

PyObject* py_delmacro PyObject *    self,
PyObject *    args,
PyObject *    kwargs
[static]
 

Definition at line 131 of file py_selection.C.

References VMDApp::atomSelParser, get_vmdapp, NULL, and SymbolTable::remove_custom_singleword.

PyObject* py_getmacro PyObject *    self,
PyObject *    args,
PyObject *    kwargs
[static]
 

Definition at line 34 of file py_selection.C.

References as_pystring, VMDApp::atomSelParser, SymbolTable::get_custom_singleword, get_vmdapp, and NULL.


Variable Documentation

const char addmacro_doc[] [static]
 

Initial value:

"Create a new atom selection macro. A macro is a word or words that expand\n"
"to be a much larger selection string, for example 'noh' is a built-in macro\n"
"that expands to 'not hydrogen'\n\n"
"Args:\n"
"    name (str): Macro name\n"
"    selection (str): Atom selection that macro will expand to"

Definition at line 98 of file py_selection.C.

const char allmacro_doc[] [static]
 

Initial value:

"Get all defined macros\n\n"
"Returns:\n"
"    (list of str): All defined macro names"

Definition at line 56 of file py_selection.C.

const char delmacro_doc[] [static]
 

Initial value:

"Delete an atom selection macro, by name\n\n"
"Args:\n"
"    name (str): Macro name to delete"

Definition at line 127 of file py_selection.C.

const char getmacro_doc[] [static]
 

Initial value:

"Gets the atom selection string corresponding to a macro\n\n"
"Args:\n"
"    name (str): Macro name\n"
"Returns:\n"
"    (str): Atom selection string that macro expands to"

Definition at line 28 of file py_selection.C.

const char module_doc[] [static]
 

Initial value:

"Methods for creating, modifying, or deleting macros for atom selections."

Definition at line 197 of file py_selection.C.

Referenced by initselection.

PyMethodDef selection_methods[] [static]
 

Initial value:

 {
  {"add_macro", (PyCFunction)py_addmacro, METH_VARARGS | METH_KEYWORDS, addmacro_doc},
  {"get_macro", (PyCFunction)py_getmacro, METH_VARARGS | METH_KEYWORDS, getmacro_doc},
  {"all_macros", (PyCFunction)py_allmacros, METH_NOARGS, allmacro_doc},
  {"del_macro", (PyCFunction)py_delmacro, METH_VARARGS | METH_KEYWORDS, delmacro_doc},
  {"keywords", (PyCFunction)keywords, METH_NOARGS,
    "keywords() -> List of available atom selection keywords."},
  {"booleans", (PyCFunction)booleans, METH_NOARGS,
    "booleans() -> List of available atom selection boolean tokens."},
  {"functions", (PyCFunction)functions, METH_NOARGS,
    "functions() -> List of available atom selection functions."},
  {"stringfunctions", (PyCFunction)stringfunctions, METH_NOARGS,
    "stringfunctions() -> List of available atom selection string functions."},
  { NULL, NULL }
}

Definition at line 180 of file py_selection.C.

Referenced by initselection.


Generated on Thu Apr 18 02:46:12 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002