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