Commit ed68c1d9 authored by Russ Fish's avatar Russ Fish

Make various combinations of picking nodes, typing their names, and clicking...

Make various combinations of picking nodes, typing their names, and clicking "Go to top" play together nicely.
parent c0cb83e4
......@@ -800,6 +800,7 @@ static void SWIG_exception_(int code, const char *msg) {
#include <string>
extern void selectCB(std::string const &,int,int);
#ifdef __cplusplus
extern "C" {
#endif
......@@ -890,6 +891,33 @@ static PyObject *_wrap_getGraphCenter(PyObject *self, PyObject *args) {
}
static PyObject *_wrap_selectCB(PyObject *self, PyObject *args) {
PyObject *resultobj;
std::string *arg1 = 0 ;
int arg2 ;
int arg3 ;
std::string temp1 ;
PyObject * obj0 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"Oii:selectCB",&obj0,&arg2,&arg3)) goto fail;
{
if (PyString_Check(obj0)) {
temp1 = std::string(PyString_AsString(obj0),
PyString_Size(obj0));
arg1 = &temp1;
} else {
SWIG_exception(SWIG_TypeError, "string expected");
}
}
selectCB((std::string const &)*arg1,arg2,arg3);
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_new_HypView(PyObject *self, PyObject *args) {
PyObject *resultobj;
HypView *result;
......@@ -3196,6 +3224,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"hvReadFile", _wrap_hvReadFile, METH_VARARGS },
{ (char *)"getSelected", _wrap_getSelected, METH_VARARGS },
{ (char *)"getGraphCenter", _wrap_getGraphCenter, METH_VARARGS },
{ (char *)"selectCB", _wrap_selectCB, METH_VARARGS },
{ (char *)"new_HypView", _wrap_new_HypView, METH_VARARGS },
{ (char *)"HypView_afterRealize", _wrap_HypView_afterRealize, METH_VARARGS },
{ (char *)"delete_HypView", _wrap_delete_HypView, METH_VARARGS },
......
......@@ -73,6 +73,9 @@ extern char *getGraphCenter();
//%apply const std::string & INPUT { const string & id };
///}
// This callback is used in picking. Call it to simulate picking.
extern void selectCB(const std::string & INPUT, int shift, int control);
//================================================================
// Copyright 1998, Silicon Graphics, Inc. -- ALL RIGHTS RESERVED
......
......@@ -73,5 +73,8 @@ extern char *getGraphCenter();
//%apply const std::string & INPUT { const string & id };
///}
// This callback is used in picking. Call it to simulate picking.
extern void selectCB(const std::string & INPUT, int shift, int control);
//================================================================
......@@ -38,6 +38,8 @@ hvReadFile = _hv.hvReadFile
getSelected = _hv.getSelected
getGraphCenter = _hv.getGraphCenter
selectCB = _hv.selectCB
class HypView(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, HypView, name, value)
......
......@@ -49,7 +49,7 @@ char *getSelected(){
return prevsel;
}
// I guess I don't know how to handle a "string" returned by the SWIG Python wrapper.
// I guess I don't know how to handle a "string" returned by the SWIG Python wrapper...
char *getGraphCenter(){
string * result = new string(hv->getGraphCenter());
return (char *)result->c_str();
......@@ -57,6 +57,7 @@ char *getGraphCenter(){
void selectCB(const string & id, int shift, int control) {
//printf("selectCB id=%s, prevsel=%s\n", id.c_str(), prevsel);
//cerr << "selectCB id=" << id.c_str() << ", prevsel=" << prevsel << endl;
hv->setSelected(id, 1);
hv->setSelected(prevsel, 0);
hv->gotoNode(id, HV_ANIMATE);
......
......@@ -239,24 +239,44 @@ class hvFrame(hvFrameUI):
return
node = self.NodeName.GetValue()
self.vwr.gotoNode(node, HV_ANIMATE)
self.vwr.setSelected(node, True)
# Simulate picking the node as well.
hv.selectCB(node, 0, 0);
self.SelectedNode(node)
self.DrawGL()
pass
# Check boxes control boolean state.
def OnDrawSphere(self, cmdEvent):
if self.vwr is None:
return
self.vwr.setSphere(self.DrawSphere.IsChecked())
self.DrawGL()
pass
def OnDrawNodes(self, cmdEvent):
if self.vwr is None:
return
self.vwr.setDrawNodes(self.DrawNodes.IsChecked())
self.DrawGL()
pass
def OnDrawLinks(self, cmdEvent):
if self.vwr is None:
return
self.vwr.setDrawLinks(self.DrawLinks.IsChecked())
self.DrawGL()
pass
def OnKeepAspect(self, cmdEvent):
if self.vwr is None:
return
self.vwr.setKeepAspect(self.KeepAspect.IsChecked())
self.DrawGL()
pass
def OnLabelToRight(self, cmdEvent):
if self.vwr is None:
return
self.vwr.setLabelToRight(self.LabelToRight.IsChecked())
self.DrawGL()
pass
##
# Buttons issue commands.
......@@ -267,15 +287,13 @@ class hvFrame(hvFrameUI):
# Tell the HypView to reset.
self.vwr.gotoCenterNode(HV_ANIMATE)
# Unselect a previously picked node.
prevsel = hv.getSelected()
if prevsel != "":
self.vwr.setSelected(prevsel, 0);
# Update the node info and draw.
# Simulate picking the top node.
##ctr = self.vwr.getGraphCenter()
ctr = hv.getGraphCenter()
#print "center node", ctr
##print "center node", ctr
hv.selectCB(ctr, 0, 0);
# Update the node info and draw.
self.SelectedNode(ctr)
self.DrawGL()
pass
......@@ -300,6 +318,8 @@ class hvFrame(hvFrameUI):
##
# Combo boxes select between alternatives.
def OnLabelsMode(self, cmdEvent):
if self.vwr is None:
return
which = self.LabelsMode.GetSelection()
if which != -1:
self.vwr.setLabels(which)
......
......@@ -803,6 +803,7 @@ static void SWIG_exception_(int code, const char *msg) {
#include <string>
extern void selectCB(std::string const &,int,int);
#ifdef __cplusplus
extern "C" {
#endif
......@@ -893,6 +894,33 @@ static PyObject *_wrap_getGraphCenter(PyObject *self, PyObject *args) {
}
static PyObject *_wrap_selectCB(PyObject *self, PyObject *args) {
PyObject *resultobj;
std::string *arg1 = 0 ;
int arg2 ;
int arg3 ;
std::string temp1 ;
PyObject * obj0 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"Oii:selectCB",&obj0,&arg2,&arg3)) goto fail;
{
if (PyString_Check(obj0)) {
temp1 = std::string(PyString_AsString(obj0),
PyString_Size(obj0));
arg1 = &temp1;
} else {
SWIG_exception(SWIG_TypeError, "string expected");
}
}
selectCB((std::string const &)*arg1,arg2,arg3);
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_new_HypView(PyObject *self, PyObject *args) {
PyObject *resultobj;
HDC arg1 ;
......@@ -3255,6 +3283,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"hvReadFile", _wrap_hvReadFile, METH_VARARGS },
{ (char *)"getSelected", _wrap_getSelected, METH_VARARGS },
{ (char *)"getGraphCenter", _wrap_getGraphCenter, METH_VARARGS },
{ (char *)"selectCB", _wrap_selectCB, METH_VARARGS },
{ (char *)"new_HypView", _wrap_new_HypView, METH_VARARGS },
{ (char *)"HypView_afterRealize", _wrap_HypView_afterRealize, METH_VARARGS },
{ (char *)"HypView_getWidget", _wrap_HypView_getWidget, METH_VARARGS },
......
......@@ -35,7 +35,11 @@ hvmain = _hv.hvmain
hvReadFile = _hv.hvReadFile
selectCB = _hv.selectCB
getSelected = _hv.getSelected
getGraphCenter = _hv.getGraphCenter
class HypView(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, HypView, name, value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment