Mercurial > urwid-satext
changeset 112:b3e8edbe0a1e
FileDialog: a message can now be displayed above the file selector
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 25 Sep 2015 18:32:32 +0200 |
parents | 1cdf4a00b68d |
children | 77ccc1dd2261 |
files | urwid_satext/files_management.py |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/urwid_satext/files_management.py Sat Aug 22 09:26:32 2015 +0200 +++ b/urwid_satext/files_management.py Fri Sep 25 18:32:32 2015 +0200 @@ -130,19 +130,28 @@ class FileDialog(urwid.WidgetWrap): - def __init__(self, ok_cb, cancel_cb, title=_("Please select a file"), style=[]): + def __init__(self, ok_cb, cancel_cb, message=None, title=_("Please select a file"), style=[]): """Create file dialog + @param title: title of the window/popup + @param message: message to display, or None to only show title and file dialog + message will be passed to a Text widget, so markup can be used @param style: list of string: - 'dir' if a dir path must be selected """ self.ok_cb = ok_cb self._type = 'dir' if 'dir' in style else 'normal' self.__home_path = os.path.expanduser('~') + widgets = [] + if message: + widgets.append(urwid.Text(message)) + widgets.append(urwid.Divider(u'─')) self.path_wid = PathEdit(_('Path: ')) self.path_wid.setCompletionMethod(self._directory_completion) urwid.connect_signal(self.path_wid, 'change', self.onPathChange) - header = urwid.Pile([self.path_wid, urwid.Divider(u'─')]) + widgets.append(self.path_wid) + widgets.append(urwid.Divider(u'─')) + header = urwid.Pile(widgets) bookm_list = urwid.SimpleListWalker([]) self.bookmarks = list(self.getBookmarks()) self.bookmarks.sort()