From e283151a9bfe320a3c80ca37b15ebf2c50888a69 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 25 Feb 2008 03:23:50 +0000 Subject: [PATCH] Visually truncating really long filenames. --- view/Progress_bar.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/view/Progress_bar.py b/view/Progress_bar.py index dee30a7..18ed3ef 100644 --- a/view/Progress_bar.py +++ b/view/Progress_bar.py @@ -22,7 +22,11 @@ def stream_progress( uploading_file, filename, fraction_reported ): """ + FILENAME_TRUNCATION_WIDTH = 40 base_filename = filename.split( u"/" )[ -1 ].split( u"\\" )[ -1 ] + if len( base_filename ) > FILENAME_TRUNCATION_WIDTH: + base_filename = base_filename[ : FILENAME_TRUNCATION_WIDTH ] + u"..." + yield \ u"""
uploading %s: