]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added help line and root text
authorewt <ewt>
Tue, 28 Oct 1997 01:25:37 +0000 (01:25 +0000)
committerewt <ewt>
Tue, 28 Oct 1997 01:25:37 +0000 (01:25 +0000)
snack.py
snackmodule.c

index c25870de8e4b3d938d44b1e963c32fc5ddbfae4c..68c3c57f6dd5753bb3c1fab3c42812e6c851a030 100644 (file)
--- a/snack.py
+++ b/snack.py
@@ -164,6 +164,7 @@ class SnackScreen:
 
     def __init__(self):
        _snack.init()
+       self.pushHelpLine(None)
 
     def finish(self):
        return _snack.finish()
@@ -171,6 +172,18 @@ class SnackScreen:
     def openWindow(self, left, top, width, height, title):
        return _snack.openwindow(left, top, width, height, title)
 
+    def pushHelpLine(self, text):
+       if (not text):
+           return _snack.pushhelpline("*default*")
+       else:
+           return _snack.pushhelpline(text)
+
+    def popHelpLine(self):
+       return _snack.pophelpline()
+
+    def drawRootText(self, left, top, text):
+       return _snack.drawroottext(left, top, text)
+
     def centeredWindow(self, width, height, title):
        return _snack.centeredwindow(width, height, title)
 
index a3424073ca5b6d663b294fbb82cefd1530b15b08..fd9aab265cf4287df038a2765bbbe5880fbdaf04 100644 (file)
@@ -18,6 +18,7 @@ static PyObject * centeredWindow(PyObject * s, PyObject * args);
 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 snackForm * formCreate(PyObject * s, PyObject * args);
 static snackGrid * gridCreate(PyObject * s, PyObject * args);
 static PyObject * gridWrappedWindow(PyObject * s, PyObject * args);
@@ -27,7 +28,9 @@ static snackWidget * labelWidget(PyObject * s, PyObject * args);
 static snackWidget * listboxWidget(PyObject * s, PyObject * args);
 static PyObject * messageWindow(PyObject * s, PyObject * args);
 static PyObject * openWindow(PyObject * s, PyObject * args);
+static PyObject * popHelpLine(PyObject * s, PyObject * args);
 static PyObject * popWindow(PyObject * s, PyObject * args);
+static PyObject * pushHelpLine(PyObject * s, PyObject * args);
 static snackWidget * radioButtonWidget(PyObject * s, PyObject * args);
 static PyObject * refreshScreen(PyObject * s, PyObject * args);
 static PyObject * reflowText(PyObject * s, PyObject * args);
@@ -39,6 +42,7 @@ static PyMethodDef snackModuleMethods[] = {
     { "checkbox", (PyCFunction) checkboxWidget, METH_VARARGS, NULL },
     { "choice", choiceWindow, METH_VARARGS, NULL },
     { "centeredwindow", centeredWindow, METH_VARARGS, NULL },
+    { "drawroottext", drawRootText, METH_VARARGS, NULL },
     { "entry", (PyCFunction) entryWidget, METH_VARARGS, NULL },
     { "finish", finishScreen, METH_VARARGS, NULL },
     { "form", (PyCFunction) formCreate, METH_VARARGS, NULL },
@@ -49,7 +53,9 @@ static PyMethodDef snackModuleMethods[] = {
     { "listbox", (PyCFunction) listboxWidget, METH_VARARGS, NULL },
     { "message", messageWindow, METH_VARARGS, NULL },
     { "openwindow", openWindow, METH_VARARGS, NULL },
+    { "pophelpline", popHelpLine, METH_VARARGS, NULL },
     { "popwindow", popWindow, METH_VARARGS, NULL },
+    { "pushhelpline", pushHelpLine, METH_VARARGS, NULL },
     { "radiobutton", (PyCFunction) radioButtonWidget, METH_VARARGS, NULL },
     { "reflow", (PyCFunction) reflowText, METH_VARARGS, NULL },
     { "refresh", refreshScreen, METH_VARARGS, NULL },
@@ -187,6 +193,40 @@ static PyObject * refreshScreen(PyObject * s, PyObject * args) {
     return Py_None;
 }
 
+static PyObject * drawRootText(PyObject * s, PyObject * args) {
+    int left, top;
+    char * text;
+
+    if (!PyArg_ParseTuple(args, "iis", &left, &top, &text))
+       return NULL;
+
+    newtDrawRootText(left, top, NULL);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject * popHelpLine(PyObject * s, PyObject * args) {
+    newtPopHelpLine();
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject * pushHelpLine(PyObject * s, PyObject * args) {
+    char * text;
+
+    if (!PyArg_ParseTuple(args, "s", &text))
+       return NULL;
+
+    if (!strcmp(text, "*default*"))
+       newtPushHelpLine(NULL);
+    else
+       newtPushHelpLine(text);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
 static PyObject * reflowText(PyObject * s, PyObject * args) {
     char * text, * new;
     int width, minus = 5, plus = 5;