+0.54 -> 0.55
+ - added newtCheckboxTreeGetCurrent() and snack bindings
+ - updated snack stuff to allow manual placement of grid
+ wrapped windows
+
+0.53 -> 0.54
+ - fix segfault in newtRadioGetCurrent
+
0.52 -> 0.53
- place cursor in checkboxtree's more carefully
install -m 755 _snackmodule.so $(instroot)/$(pythonbindir)
install -m 755 snack.py $(instroot)/$(pythondir)
-archive:
+configure: configure.in
+ autoconf
+ echo "You need to rerun ./configure before continuing"
+ exit 1
+
+archive: configure
@cvs tag -F $(CVSTAG)
@rm -rf /tmp/newt-$(VERSION) /tmp/newt
@cd /tmp; cvs export -r$(CVSTAG) newt; mv newt newt-$(VERSION)
return NULL;
}
-static void listSelected(struct items * items, int * num, void ** list, int seqindex) {
+static void listSelected(struct items * items, int * num, const void ** list, int seqindex) {
while (items) {
if ((seqindex ? items->selected==seqindex : items->selected) && !items->branch)
list[(*num)++] = items->data;
}
}
-void ** newtCheckboxTreeGetSelection(newtComponent co, int *numitems)
+const void ** newtCheckboxTreeGetSelection(newtComponent co, int *numitems)
{
return newtCheckboxTreeGetMultiSelection(co, numitems, 0);
}
-void ** newtCheckboxTreeGetMultiSelection(newtComponent co, int *numitems, char seqnum)
+const void ** newtCheckboxTreeGetMultiSelection(newtComponent co, int *numitems, char seqnum)
{
struct CheckboxTree * ct;
- void **retval;
+ const void **retval;
int seqindex=0;
if(!co || !numitems) return NULL;
return er;
}
+
+const void * newtCheckboxTreeGetCurrent(newtComponent co) {
+ struct CheckboxTree * ct = co->data;
+
+ if (!ct->currItem) return NULL;
+ return (*ct->currItem)->data;
+}
AC_INIT(newt_pr.h)
AC_CONFIG_HEADER(config.h)
-VERSION=0.50.4
+VERSION=0.50.5
SONAME=0.50
AC_SUBST(VERSION)
AC_SUBST(SONAME)
newtComponent newtCheckboxTree(int left, int top, int height, int flags);
newtComponent newtCheckboxTreeMulti(int left, int top, int height, char *seq, int flags);
-void ** newtCheckboxTreeGetSelection(newtComponent co, int *numitems);
-void ** newtCheckboxTreeGetMultiSelection(newtComponent co, int *numitems, char seqnum);
+const void ** newtCheckboxTreeGetSelection(newtComponent co, int *numitems);
+const void * newtCheckboxTreeGetCurrent(newtComponent co);
+const void ** newtCheckboxTreeGetMultiSelection(newtComponent co, int *numitems, char seqnum);
/* last item is NEWT_ARG_LAST for all of these */
int newtCheckboxTreeAddItem(newtComponent co,
const char * text, const void * data,
%postun -p /sbin/ldconfig
%changelog
+* Thu Jan 20 2000 Erik Troan <ewt@redhat.com>
+- see CHANGES
+
* Thu Jan 20 2000 Preston Brown <pbrown@redhat.com>
- fix segfault in newtRadioGetCurrent
li.delete("a")
ct = CheckboxTree(5, scroll = 1)
ct.append("Colors")
-ct.addItem("Red", (0, snackArgs['append']))
+ct.addItem("Red", (0, snackArgs['append']), "red item key")
ct.addItem("Yellow", (0, snackArgs['append']))
ct.addItem("Blue", (0, snackArgs['append']))
ct.append("Flavors")
print foo
print 'lbcw', lbcw
+print "ct selected", ct.getSelection()
+print "ct current", ct.getCurrent()
def centeredWindow(self, width, height, title):
return _snack.centeredwindow(width, height, title)
- def gridWrappedWindow(self, grid, title):
+ def gridWrappedWindow(self, grid, title, x = None, y = None):
+ if x and y:
+ return _snack.gridwrappedwindow(grid.g, title, x, y)
+
return _snack.gridwrappedwindow(grid.g, title)
def popWindow(self):
growx, growy);
self.childList.append(widget)
- def runOnce(self):
- result = self.run()
+ def runOnce(self, x = None, y = None):
+ result = self.run(x, y)
self.screen.popWindow()
return result
def setTimer(self, keyname):
self.form.setTimer(keyname)
- def create(self):
+ def create(self, x = None, y = None):
if not self.form_created:
self.place(1,1)
for child in self.childList:
self.form.add(child)
- self.screen.gridWrappedWindow(self, self.title)
+ self.screen.gridWrappedWindow(self, self.title, x, y)
self.form_created = 1
- def run(self):
- self.create()
+ def run(self, x = None, y = None):
+ self.create(x, y)
return self.form.run()
def draw(self):
self.key2item[key] = item
self.item2key[item] = key
+ def getCurrent(self):
+ curr = self.w.checkboxtreeGetCurrent()
+ return self.key2item[curr]
+
def __init__(self, height, scroll = 0):
self.w = _snack.checkboxtree(height, scroll)
self.key2item = {}
def ButtonChoiceWindow(screen, title, text,
buttons = [ 'Ok', 'Cancel' ],
- width = 40):
+ width = 40, x = None, y = None):
bb = ButtonBar(screen, buttons)
t = TextboxReflowed(width, text, maxHeight = screen.height - 12)
g = GridForm(screen, title, 1, 2)
g.add(t, 0, 0, padding = (0, 0, 0, 1))
g.add(bb, 0, 1, growx = 1)
- return bb.buttonPressed(g.runOnce())
+ return bb.buttonPressed(g.runOnce(x, y))
def EntryWindow(screen, title, text, prompts, allowCancel = 1, width = 40,
entryWidth = 20, buttons = [ 'Ok', 'Cancel' ]):
static PyObject * widgetTextboxText(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxTreeAddItem(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxTreeGetSel(snackWidget * s, PyObject * args);
+static PyObject * widgetCheckboxTreeGetCur(snackWidget * s, PyObject * args);
static PyObject * widgetEntrySetFlags(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxSetFlags(snackWidget * s, PyObject * args);
{ "scaleSet", (PyCFunction) scaleSet, METH_VARARGS, NULL },
{ "checkboxtreeAddItem", (PyCFunction) widgetCheckboxTreeAddItem,
METH_VARARGS, NULL },
+ { "checkboxtreeGetCurrent", (PyCFunction) widgetCheckboxTreeGetCur,
+ METH_VARARGS, NULL },
{ "checkboxtreeGetSelection", (PyCFunction) widgetCheckboxTreeGetSel,
METH_VARARGS, NULL },
{ "entrySetFlags", (PyCFunction) widgetEntrySetFlags, METH_VARARGS, NULL },
static PyObject * gridWrappedWindow(PyObject * s, PyObject * args) {
snackGrid * grid;
char * title;
+ int x = -1, y = -1;
- if (!PyArg_ParseTuple(args, "O!s", &snackGridType, &grid, &title))
+ if (!PyArg_ParseTuple(args, "O!s|ii", &snackGridType, &grid, &title,
+ &x, &y))
return NULL;
- newtGridWrappedWindow(grid->grid, title);
+ if (y == -1)
+ newtGridWrappedWindow(grid->grid, title);
+ else
+ newtGridWrappedWindowAt(grid->grid, title, x, y);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(s->anint++);
}
+static PyObject * widgetCheckboxTreeGetCur(snackWidget * s, PyObject * args) {
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
+ return PyInt_FromLong((int) newtCheckboxTreeGetCurrent(s->co));
+}
+
static PyObject * widgetCheckboxTreeGetSel(snackWidget * s,
PyObject * args) {
void ** selection;
int i;
PyObject * sel;
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
selection = newtCheckboxTreeGetSelection(s->co, &numselected);
sel = PyList_New(0);