Added/updated test-only files

This commit is contained in:
2017-08-06 03:56:50 +02:00
parent fa6f295dda
commit 89223c8c57
5 changed files with 242 additions and 0 deletions

30
src/fileChoserDialog.py Normal file
View File

@@ -0,0 +1,30 @@
from selectionDialog import SelectionDialog
import os
def openFileChoserDialog(title, path, preview = True):
choices = list()
file_list = list()
for filename in os.listdir(path):
fullpath = path + "/" + filename
file_list.append(fullpath)
with open(fullpath, "r") as fhandle:
appendstring = ""
if preview:
line = fhandle.readline()
line = line.rstrip()
if len(line) > 20:
line = line[:17]
line += "..."
appendstring += line + "\n("
appendstring += filename
if preview:
appendstring += ")"
choices.append(appendstring)
choice = SelectionDialog(title, choices, 20).start()
print(file_list[choice])