]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
GridForm's run_once separated from run, so that run can be called multiple
authorjohnsonm <johnsonm>
Mon, 27 Oct 1997 22:38:27 +0000 (22:38 +0000)
committerjohnsonm <johnsonm>
Mon, 27 Oct 1997 22:38:27 +0000 (22:38 +0000)
times.

peanuts.py
snack.py

index a8bc4326ec76c00134b5b8bd94e854467f57d134..a9067109067b576b6a5ef7a58d5c8381a733e4c9 100755 (executable)
@@ -18,7 +18,7 @@ g.add(li, 0, 0)
 g.add(rb, 0, 1, (0, 1, 0, 1))
 g.add(bb, 0, 2, growx = 1)
 
-result = g.run()
+result = g.run_once()
 
 screen.finish()
 
index 9baa6684c2d3e0930108196f505852929a11db99..42697b56ac74472a197c3dffcc34e2d624543bf8 100644 (file)
--- a/snack.py
+++ b/snack.py
@@ -241,6 +241,7 @@ class GridForm(Grid):
        self.title = title
        self.form = Form()
        self.childList = []
+       self.form_created = 0
        args = list(args)
        args[:0] = [self]
        apply(Grid.__init__, tuple(args))
@@ -253,12 +254,18 @@ class GridForm(Grid):
                      growx, growy);
        self.childList.append(widget)
 
-    def run(self):
-       self.place(1,1)
-       for child in self.childList:
-           self.form.add(child)
-       self.screen.gridWrappedWindow(self, self.title)
-       result = self.form.run()
+    def run_once(self):
+       result = self.run()
        self.screen.popWindow()
        return result
 
+    def run(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
+       return self.form.run()
+       
+