Summary: A development library for text mode user interfaces.
Name: newt
-%define version 0.50.24
+%define version 0.50.25
Version: %{version}
Release: 1
Copyright: LGPL
%endif
%changelog
+* Fri Jun 8 2001 Jeremy Katz <katzj@redhat.com>
+- added python binding for newtListboxClear() for Listbox and CListBox
+- let ButtonBars optionally be made of CompactButtons
+
* Wed Jun 6 2001 Crutcher Dunnavant <crutcher@redhat.com>
- added CListBox python convenience class
def setCurrent(self, item):
self.w.listboxSetCurrent(self.item2key[item])
+ def clear(self):
+ self.key2item = {}
+ self.item2key = {}
+ self.w.listboxClear()
+
def __init__(self, height, scroll = 0, returnExit = 0, width = 0):
self.w = _snack.listbox(height, scroll, returnExit)
self.key2item = {}
class ButtonBar(Grid):
- def __init__(self, screen, buttonlist):
+ def __init__(self, screen, buttonlist, compact = 0):
self.list = []
self.hotkeys = {}
self.item = 0
(title, value, hotkey) = blist
self.hotkeys[hotkey] = value
- b = Button(title)
+ if compact:
+ b = CompactButton(title)
+ else:
+ b = Button(title)
self.list.append((b, value))
self.setField(b, self.item, 0, (1, 0, 1, 0))
self.item = self.item + 1
delta = self.col_widths[i] - len(cstr)
if delta > 0:
if align == None:
- a = LEFT
- else:
- a = align[i]
+ a = LEFT
+ else:
+ a = align[i]
if a == LEFT:
cstr = cstr + (" " * delta)
def setCurrent(self, item):
self.listbox.setCurrent(item)
-
+
+ def clear(self):
+ self.listbox.clear()
static PyObject * widgetListboxDel(snackWidget * s, PyObject * args);
static PyObject * widgetListboxGet(snackWidget * s, PyObject * args);
static PyObject * widgetListboxSet(snackWidget * s, PyObject * args);
+static PyObject * widgetListboxClear(snackWidget * s, PyObject * args);
static PyObject * widgetTextboxText(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxTreeAddItem(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxTreeGetSel(snackWidget * s, PyObject * args);
{ "listboxSetCurrent", (PyCFunction) widgetListboxSet, METH_VARARGS, NULL },
{ "listboxSetWidth", (PyCFunction) widgetListboxSetW, METH_VARARGS, NULL },
{ "listboxDeleteItem", (PyCFunction) widgetListboxDel, METH_VARARGS, NULL },
+ { "listboxClear", (PyCFunction) widgetListboxClear, METH_VARARGS, NULL },
{ "scaleSet", (PyCFunction) scaleSet, METH_VARARGS, NULL },
{ "checkboxtreeAddItem", (PyCFunction) widgetCheckboxTreeAddItem,
METH_VARARGS, NULL },
return Py_None;
}
+static PyObject * widgetListboxClear(snackWidget * s, PyObject * args) {
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
+ newtListboxClear(s->co);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static void emptyDestructor(PyObject * s) {
}