@@ -103,7 +103,8 @@ def display_files(self):
103
103
else :
104
104
parent = self .tree .insert (parent , "end" , text = subfolder , open = True )
105
105
for file_name in file_list :
106
- thumbnail = self .load_thumbnail (file_name )
106
+ parent_folder_path = os .path .join (self .sdk .parent_folder , folder ) # Define parentFolder
107
+ thumbnail = self .load_thumbnail (file_name , parent_folder_path )
107
108
if thumbnail :
108
109
self .tree .insert (parent , "end" , text = file_name , image = thumbnail , tags = (folder ,))
109
110
else :
@@ -160,7 +161,7 @@ def clear_selections(self):
160
161
for item in self .tree .selection ():
161
162
self .tree .selection_remove (item )
162
163
163
- def load_thumbnail (self , file_path ):
164
+ def load_thumbnail (self , file_path , parent = "" ):
164
165
"""
165
166
Load the appropriate thumbnail for a given file path.
166
167
@@ -189,19 +190,23 @@ def load_thumbnail(self, file_path):
189
190
".cfg" : "txt.png" ,
190
191
".sln" : "Visual_Studio.png" ,
191
192
".vpk" : "fileexplorer.png" ,
192
- # ".wav": "audio.png",
193
- # ".mp3": "audio.png",
194
- # ".bik": "video.png",
195
- ".bat" : "terminal.png" ,
193
+ ".wav" : "audio.png" ,
194
+ ".mp3" : "audio.png" ,
195
+ ".bik" : "video.png" ,
196
+ ".bat" : "terminal.png"
196
197
}
197
198
198
199
#ext = os.path.splitext(file_path)[1]
199
200
file_name , file_extension = os .path .splitext (file_path )
200
201
201
- if file_extension in file_icons and file_icons [file_extension ]:
202
- image = Image .open (os .path .join (base_path , "icons" , file_icons [file_extension ]))
202
+ if file_extension in file_icons :
203
+ if file_icons [file_extension ]:
204
+ image = Image .open (os .path .join (base_path , "icons" , file_icons [file_extension ]))
205
+ else :
206
+ image = Image .open (parent + "/" + file_path )
203
207
elif os .path .isdir (file_path ):
204
208
image = Image .open (os .path .join (base_path , "icons" , "fileexplorer.png" ))
209
+
205
210
206
211
if image :
207
212
image .thumbnail ((16 , 16 ))
0 commit comments