# HG changeset patch # User Goffi # Date 1443198752 -7200 # Node ID b3e8edbe0a1e1525e08fb88eb358af56127578e5 # Parent 1cdf4a00b68d8fd72f18adaa6ed838b54e0c0ac7 FileDialog: a message can now be displayed above the file selector diff -r 1cdf4a00b68d -r b3e8edbe0a1e urwid_satext/files_management.py --- 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()