[SplashScreen] fic display of short filenames for now

This commit is contained in:
Jan Grewe 2021-01-03 01:20:08 +01:00
parent 5630b9eed9
commit bfeec0a041

View File

@ -119,7 +119,6 @@ class FileView(QWidget):
self._mdata_tree.resizeColumnToContents(i)
def reset(self):
print("FileView ", self._file_handler.is_valid)
pass
class SplashScreen(QWidget):
@ -159,12 +158,15 @@ class SplashScreen(QWidget):
def _create_short_filename(self, original, index, max_len=40):
short = original
parts = original.split(os.sep)
post = parts[-1]
if len(post) > max_len - 4:
post = post[:max_len - 4]
short = str("%i: " % index) + "... " + post
if len(parts) == 1:
short = "%i: %s" % (index, short[:max_len])
else:
short = str("%i: " % index) + " ... ".join([original[:max_len - len(post) - 4], post])
post = parts[-1]
if len(post) > max_len - 4:
post = post[:max_len - 4]
short = str("%i: " % index) + "... " + post
else:
short = str("%i: " % index) + " ... ".join([original[:max_len - len(post) - 4], post])
return short
def _read_recent_files(self):