Mercurial > boomslang
diff pyntnclick/widgets/filechooser.py @ 712:f33dd2093f77 pyntnclick
Hook up image drawing code again
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sun, 05 Aug 2012 14:55:48 +0200 |
parents | d4f97c8e0dbe |
children | ab489f7e87f8 |
line wrap: on
line diff
--- a/pyntnclick/widgets/filechooser.py Sun Aug 05 14:54:49 2012 +0200 +++ b/pyntnclick/widgets/filechooser.py Sun Aug 05 14:55:48 2012 +0200 @@ -9,10 +9,12 @@ class FileChooser(Box): - def __init__(self, rect, gd, curdir, page_length=12, padding=2): + def __init__(self, rect, gd, curdir, ok_callback, + page_length=12, padding=2): super(FileChooser, self).__init__(rect, gd) self.page_length = page_length self.page = 0 + self.ok_callback = ok_callback self.curdir = os.path.realpath(os.path.normpath(curdir)) self.selected = None self.padding = padding @@ -136,11 +138,13 @@ if hasattr(self.parent, 'paused'): self.parent.paused = False self.parent.remove(self) - self.selected = None return True def ok(self, ev, widget): if hasattr(self.parent, 'paused'): self.parent.paused = False self.parent.remove(self) + if self.selected: + self.ok_callback(os.path.normpath(os.path.join(self.curdir, + self.selected))) return True