From: ewt Date: Tue, 28 Oct 1997 01:52:43 +0000 (+0000) Subject: added screen size stuff X-Git-Tag: r0-20~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f0ab2ace790d27ee16282eff950893a516829ca;p=thirdparty%2Fnewt.git added screen size stuff --- diff --git a/snack.py b/snack.py index c796640..4274975 100644 --- 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): diff --git a/snackmodule.c b/snackmodule.c index da32106..d60443a 100644 --- a/snackmodule.c +++ b/snackmodule.c @@ -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;