]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added draw methods
authorewt <ewt>
Thu, 29 Apr 1999 20:06:02 +0000 (20:06 +0000)
committerewt <ewt>
Thu, 29 Apr 1999 20:06:02 +0000 (20:06 +0000)
snack.py
snackmodule.c

index ee1520e177a172647df0d1f35a528bec72f4ace2..96a3aa4366c02391a6d761a53ccd6cc858fb2fe7 100644 (file)
--- a/snack.py
+++ b/snack.py
@@ -145,6 +145,10 @@ class Form:
 
        return hotkeys[which]
 
+    def draw(self):
+       self.w.draw()
+       return None
+
     def __init__(self):
        self.trans = {}
        self.w = _snack.form()
@@ -329,21 +333,24 @@ class GridForm(Grid):
        self.screen.popWindow()
        return result
 
-    def run(self):
+    def create(self):
        if not self.form_created:
            self.place(1,1)
            for child in self.childList:
                self.form.add(child)
            self.screen.gridWrappedWindow(self, self.title)
            self.form_created = 1
+
+    def run(self):
+       self.create()
        return self.form.run()
+
+    def draw(self):
+       self.create()
+       return self.form.draw()
        
     def runPopup(self):
-       if not self.form_created:
-           self.place(1,1)
-           for child in self.childList:
-               self.form.add(child)
-           self.form_created = 1
+       self.create()
        self.screen.gridWrappedWindow(self, self.title)
        result = self.form.run()
        self.screen.popWindow()
index ceb71774e190f346f10ad46aefdc8a811bc02f1d..26c37079b399b5b940bf9cc3e46e885e1dd65a7c 100644 (file)
@@ -105,11 +105,13 @@ struct snackForm_s {
 
 static PyObject * formGetAttr(PyObject * s, char * name);
 static PyObject * formAdd(snackForm * s, PyObject * args);
+static PyObject * formDraw(snackForm * s, PyObject * args);
 static PyObject * formRun(snackForm * s, PyObject * args);
 static PyObject * formHotKey(snackForm * s, PyObject * args);
 
 static PyMethodDef formMethods[] = {
     { "add", (PyCFunction) formAdd, METH_VARARGS, NULL },
+    { "draw", (PyCFunction) formDraw, METH_VARARGS, NULL },
     { "run", (PyCFunction) formRun, METH_VARARGS, NULL },
     { "addhotkey", (PyCFunction) formHotKey, METH_VARARGS, NULL },
     { NULL }
@@ -524,6 +526,13 @@ static PyObject * formGetAttr(PyObject * s, char * name) {
     return Py_FindMethod(formMethods, s, name);
 }
 
+static PyObject * formDraw(snackForm * s, PyObject * args) {
+    newtDrawForm(s->fo);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
 static PyObject * formAdd(snackForm * s, PyObject * args) {
     snackWidget * w;
     int size = PyTuple_Size(args), i;