]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added suspend and resume to snack
authorewt <ewt>
Thu, 2 Sep 1999 00:57:09 +0000 (00:57 +0000)
committerewt <ewt>
Thu, 2 Sep 1999 00:57:09 +0000 (00:57 +0000)
newt.spec
snack.py
snackmodule.c

index f4e62068b3d4394fc7784d6825790ad91a23a936..73a9967f57706a81ddc1ddaf64cab728f7217e50 100644 (file)
--- 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 <ewt@redhat.com>
+- added suspend/resume to snack
+
 * Tue Aug 31 1999 Matt Wilson <msw@redhat.com>
 - enable gpm support
 
index 27a28056b26d828cc1bb6bde197221e51f29164b..f43ab9006bcb34671f5fd2605b601e3821bfa591 100644 (file)
--- 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)
index d0be0712699ef27a2b51526d2577a0313e92e9a2..800ee5ddb596ddf037e955dcbed79ae1601f1b91 100644 (file)
@@ -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);