9 |
9 |
10 |
10 |
11 import os |
11 import os |
12 import re |
12 import re |
13 |
13 |
14 from PyQt5.QtCore import QFile, QByteArray, QUrl, QCoreApplication, QBuffer, \ |
14 from PyQt5.QtCore import ( |
15 QIODevice |
15 QFile, QByteArray, QUrl, QCoreApplication, QBuffer, QIODevice |
|
16 ) |
16 from PyQt5.QtGui import QPixmap |
17 from PyQt5.QtGui import QPixmap |
17 |
18 |
18 |
19 |
19 def readAllFileContents(filename): |
20 def readAllFileContents(filename): |
20 """ |
21 """ |
118 Module function to filter illegal characters. |
120 Module function to filter illegal characters. |
119 |
121 |
120 @param name name to be sanitized (string) |
122 @param name name to be sanitized (string) |
121 @return sanitized name (string) |
123 @return sanitized name (string) |
122 """ |
124 """ |
123 return name\ |
125 return ( |
124 .replace("/", "_")\ |
126 name |
125 .replace("\\", "")\ |
127 .replace("/", "_") |
126 .replace(":", "")\ |
128 .replace("\\", "") |
127 .replace("*", "")\ |
129 .replace(":", "") |
128 .replace("?", "")\ |
130 .replace("*", "") |
129 .replace('"', "")\ |
131 .replace("?", "") |
130 .replace("<", "")\ |
132 .replace('"', "") |
131 .replace(">", "")\ |
133 .replace("<", "") |
|
134 .replace(">", "") |
132 .replace("|", "") |
135 .replace("|", "") |
|
136 ) |
133 |
137 |
134 |
138 |
135 def pixmapFromByteArray(data): |
139 def pixmapFromByteArray(data): |
136 """ |
140 """ |
137 Module function to convert a byte array to a pixmap. |
141 Module function to convert a byte array to a pixmap. |