|
|
@@ -30,10 +30,11 @@ def file_menu():
|
|
30
|
30
|
index = 0
|
|
31
|
31
|
for file in os.listdir("/sd"):
|
|
32
|
32
|
filename = str(file)
|
|
33
|
|
- if index == open_cursor:
|
|
34
|
|
- filename = "> " + filename
|
|
35
|
|
- files_text = files_text + filename+"\n"
|
|
36
|
|
- index += 1
|
|
|
33
|
+ if ".txt" in filename:
|
|
|
34
|
+ if index == open_cursor:
|
|
|
35
|
+ filename = "> " + filename
|
|
|
36
|
+ files_text = files_text + filename+"\n"
|
|
|
37
|
+ index += 1
|
|
37
|
38
|
files_group.text = files_text
|
|
38
|
39
|
|
|
39
|
40
|
## SD Card set up for saving text to SD card
|
|
|
@@ -151,11 +152,8 @@ while True:
|
|
151
|
152
|
|
|
152
|
153
|
## The save file menu - for typing the filename
|
|
153
|
154
|
elif page == "save":
|
|
154
|
|
- if key == "DOWN":
|
|
155
|
|
- filename_text = filename_text + "."
|
|
156
|
|
- filename_group.text = filename_text
|
|
157
|
|
- elif key == "\n":
|
|
158
|
|
- with open("/sd/"+filename_text, "w") as f:
|
|
|
155
|
+ if key == "\n":
|
|
|
156
|
+ with open("/sd/"+filename_text+".txt", "w") as f:
|
|
159
|
157
|
f.write(text)
|
|
160
|
158
|
f.close()
|
|
161
|
159
|
board.DISPLAY.root_group = intro_text_area
|
|
|
@@ -188,7 +186,7 @@ while True:
|
|
188
|
186
|
for line in lines:
|
|
189
|
187
|
text = text + line
|
|
190
|
188
|
text_area.text = text
|
|
191
|
|
- filename_text = fn
|
|
|
189
|
+ filename_text = fn.split(".txt")[0]
|
|
192
|
190
|
filename_group.text=filename_text
|
|
193
|
191
|
page = "editor"
|
|
194
|
192
|
board.DISPLAY.root_group = intro_text_area
|