##// END OF EJS Templates
Added image for midi/mid file format. Store only common file formats (e.g. same image for different formats) in the code, otherwise get the image file directly from the statics
neko259 -
r1779:96b4c2f6 default
parent child Browse files
Show More
1 NO CONTENT: new file 100644, binary diff hidden
@@ -10,6 +10,7 b' from boards.utils import get_domain, cac'
10 10
11 11 FILE_STUB_IMAGE = 'images/file.png'
12 12 FILE_STUB_URL = 'url'
13 FILE_FILEFORMAT = 'images/fileformats/{}.png'
13 14
14 15
15 16 FILE_TYPES_VIDEO = (
@@ -33,14 +34,10 b' FILE_TYPES_IMAGE = ('
33 34 )
34 35
35 36 PLAIN_FILE_FORMATS = {
36 'pdf': 'pdf',
37 'djvu': 'djvu',
38 'txt': 'txt',
39 'tex': 'tex',
40 'xcf': 'xcf',
41 37 'zip': 'archive',
42 38 'tar': 'archive',
43 39 'gz': 'archive',
40 'mid' : 'midi',
44 41 }
45 42
46 43 URL_PROTOCOLS = {
@@ -84,9 +81,11 b' class AbstractViewer:'
84 81 self.file_type, filesizeformat(self.file.size))
85 82
86 83 def get_format_view(self):
87 if self.file_type in PLAIN_FILE_FORMATS:
88 image = 'images/fileformats/{}.png'.format(
89 PLAIN_FILE_FORMATS[self.file_type])
84 image_name = PLAIN_FILE_FORMATS.get(self.file_type, self.file_type)
85 file_name = FILE_FILEFORMAT.format(image_name)
86
87 if file_exists(file_name):
88 image = file_name
90 89 else:
91 90 image = FILE_STUB_IMAGE
92 91
General Comments 0
You need to be logged in to leave comments. Login now