]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added screen size stuff
authorewt <ewt>
Tue, 28 Oct 1997 01:52:43 +0000 (01:52 +0000)
committerewt <ewt>
Tue, 28 Oct 1997 01:52:43 +0000 (01:52 +0000)
snack.py
snackmodule.c

index c79664069efe307ad89f6063be6ef7c4aa50f372..42749750d95491eb7af06a51bbf66a1bfea3143d 100644 (file)
--- a/snack.py
+++ b/snack.py
@@ -167,6 +167,7 @@ class SnackScreen:
 
     def __init__(self):
        _snack.init()
+       size = _snack.size()
        self.pushHelpLine(None)
 
     def finish(self):
index da321068e31bb256eab130873442cc60f205bb6a..d60443a899508d64d0303919017d334c3b4974ef 100644 (file)
@@ -33,6 +33,7 @@ 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 * screenSize(PyObject * s, PyObject * args);
 static PyObject * reflowText(PyObject * s, PyObject * args);
 static snackWidget * textWidget(PyObject * s, PyObject * args);
 static PyObject * ternaryWindow(PyObject * s, PyObject * args);
@@ -59,6 +60,7 @@ static PyMethodDef snackModuleMethods[] = {
     { "radiobutton", (PyCFunction) radioButtonWidget, METH_VARARGS, NULL },
     { "reflow", (PyCFunction) reflowText, METH_VARARGS, NULL },
     { "refresh", refreshScreen, METH_VARARGS, NULL },
+    { "size", screenSize, METH_VARARGS, NULL },
     { "ternary", ternaryWindow, METH_VARARGS, NULL },
     { "textbox", (PyCFunction) textWidget, METH_VARARGS, NULL },
     { NULL }
@@ -193,6 +195,17 @@ static PyObject * refreshScreen(PyObject * s, PyObject * args) {
     return Py_None;
 }
 
+static PyObject * screenSize(PyObject * s, PyObject * args) {
+    int width, height;
+
+    if (!PyArg_ParseTuple(args, ""))
+       return NULL;
+
+    newtGetScreenSize(&width, &height);
+
+    return Py_BuildValue("(ii)", width, height);
+}
+
 static PyObject * drawRootText(PyObject * s, PyObject * args) {
     int left, top;
     char * text;