From: ewt Date: Thu, 2 Sep 1999 00:57:09 +0000 (+0000) Subject: added suspend and resume to snack X-Git-Tag: r0-50~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1aef30bd3000701bc5319615bc979f530ac95ff;p=thirdparty%2Fnewt.git added suspend and resume to snack --- diff --git a/newt.spec b/newt.spec index f4e6206..73a9967 100644 --- a/newt.spec +++ b/newt.spec @@ -2,7 +2,7 @@ Summary: A development library for text mode user interfaces. Name: newt %define version 0.50 Version: %{version} -Release: 12 +Release: 13 Copyright: LGPL Group: System Environment/Libraries Source: ftp://ftp.redhat.com/pub/redhat/code/newt/newt-%{version}.tar.gz @@ -55,6 +55,9 @@ rm -rf $RPM_BUILD_ROOT %postun -p /sbin/ldconfig %changelog +* Wed Sep 01 1999 Erik Troan +- added suspend/resume to snack + * Tue Aug 31 1999 Matt Wilson - enable gpm support diff --git a/snack.py b/snack.py index 27a2805..f43ab90 100644 --- a/snack.py +++ b/snack.py @@ -233,6 +233,12 @@ class SnackScreen: def finish(self): return _snack.finish() + def resume(self): + _snack.resume() + + def suspend(self): + _snack.suspend() + def suspendCallback(self, cb, data = None): if data: return _snack.suspendcallback(cb, data) @@ -427,7 +433,7 @@ class CheckboxTree(Widget): def ListboxChoiceWindow(screen, title, text, items, buttons = ('Ok', 'Cancel'), - width = 40, scroll = 0, height = -1, default = 0): + width = 40, scroll = 0, height = -1, default = None): if (height == -1): height = len(items) bb = ButtonBar(screen, buttons) @@ -449,7 +455,8 @@ def ListboxChoiceWindow(screen, title, text, items, l.append(text, key) count = count + 1 - l.setCurrent (default) + if (default != None): + l.setCurrent (default) g = GridForm(screen, title, 1, 3) g.add(t, 0, 0) diff --git a/snackmodule.c b/snackmodule.c index d0be071..800ee5d 100644 --- a/snackmodule.c +++ b/snackmodule.c @@ -25,6 +25,9 @@ static snackWidget * checkboxWidget(PyObject * s, PyObject * args); static PyObject * choiceWindow(PyObject * s, PyObject * args); static snackWidget * entryWidget(PyObject * s, PyObject * args); static PyObject * drawRootText(PyObject * s, PyObject * args); +static PyObject * doResume(PyObject * s, PyObject * args); +static PyObject * doSuspend(PyObject * s, PyObject * args); +static PyObject * doSuspend(PyObject * s, PyObject * args); static snackForm * formCreate(PyObject * s, PyObject * args); static snackGrid * gridCreate(PyObject * s, PyObject * args); static PyObject * gridWrappedWindow(PyObject * s, PyObject * args); @@ -70,8 +73,10 @@ static PyMethodDef snackModuleMethods[] = { { "radiobutton", (PyCFunction) radioButtonWidget, METH_VARARGS, NULL }, { "reflow", (PyCFunction) reflowText, METH_VARARGS, NULL }, { "refresh", refreshScreen, METH_VARARGS, NULL }, + { "resume", doResume, METH_VARARGS, NULL }, { "scale", scaleWidget, METH_VARARGS, NULL }, { "size", screenSize, METH_VARARGS, NULL }, + { "suspend", doSuspend, METH_VARARGS, NULL }, { "suspendcallback", setSuspendCallback, METH_VARARGS, NULL }, { "ternary", ternaryWindow, METH_VARARGS, NULL }, { "textbox", (PyCFunction) textWidget, METH_VARARGS, NULL }, @@ -352,6 +357,20 @@ static PyObject * drawRootText(PyObject * s, PyObject * args) { return Py_None; } +static PyObject * doSuspend(PyObject * s, PyObject * args) { + newtSuspend(); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * doResume(PyObject * s, PyObject * args) { + newtResume(); + + Py_INCREF(Py_None); + return Py_None; +} + static PyObject * popHelpLine(PyObject * s, PyObject * args) { newtPopHelpLine(); Py_INCREF(Py_None);