static void mol_active_cb(Fl_Widget *w, void *v) { VMDApp *app = (VMDApp *)w->user_data(); MolBrowser *browser = (MolBrowser *)v; for (int i=0; i<browser->size(); i++) { if (browser->selected(i+1)) { int molid = app->molecule_id(i); app->molecule_activate(molid, !app->molecule_is_active(molid)); } } }
static PyObject *activate(PyObject *self, PyObject *args) { int molid; PyObject *boolobj; if (!PyArg_ParseTuple(args, (char *)"iO", &molid, &boolobj)) return NULL; VMDApp *app = get_vmdapp(); Molecule *mol = app->moleculeList->mol_from_id(molid); if (!mol) { PyErr_SetString(PyExc_ValueError, (char *)"Invalid molecule id"); return NULL; } app->molecule_activate(molid, PyObject_IsTrue(boolobj)); Py_INCREF(Py_None); return Py_None; }