From 8da4180509f924c85724a3d4ba50c93eec9d4fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Fri, 31 Mar 2017 10:38:51 -0600 Subject: [PATCH] FileBrowser: Added an empty item when there are no files in the current folder --- guicurses/widgets.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/guicurses/widgets.py b/guicurses/widgets.py index 017eb14..ec2a5a2 100644 --- a/guicurses/widgets.py +++ b/guicurses/widgets.py @@ -736,6 +736,12 @@ class fileBrowser(Listbox): continue files.append((os.path.abspath(i), i)) folders.extend(files) + # If there are no files or directories, let's say "empty" + # This will avoid the program to crash and will look nicer. + if len(folders) == 0: + folders.append(("collapse", _("empty"))) + if len(folders) + return folders def getDir(self):