From: johnsonm Date: Mon, 27 Oct 1997 22:38:27 +0000 (+0000) Subject: GridForm's run_once separated from run, so that run can be called multiple X-Git-Tag: r0-20~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a30ba141b85158674d3b67ae5bbb1a7061130846;p=thirdparty%2Fnewt.git GridForm's run_once separated from run, so that run can be called multiple times. --- diff --git a/peanuts.py b/peanuts.py index a8bc432..a906710 100755 --- a/peanuts.py +++ b/peanuts.py @@ -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() diff --git a/snack.py b/snack.py index 9baa668..42697b5 100644 --- 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() + +