WebBrowser/Tools/WebBrowserTools.py

branch
QtWebEngine
changeset 4783
7de17766a5df
parent 4763
8ad353f31184
child 4810
f68d0446609e
equal deleted inserted replaced
4782:4ad656e4ebec 4783:7de17766a5df
14 pass 14 pass
15 15
16 import os 16 import os
17 17
18 from PyQt5.QtCore import QFile, QByteArray, QUrl 18 from PyQt5.QtCore import QFile, QByteArray, QUrl
19 from PyQt5.QtGui import QPixmap
19 20
20 21
21 def readAllFileContents(filename): 22 def readAllFileContents(filename):
22 """ 23 """
23 Function to read the string contents of the given file. 24 Function to read the string contents of the given file.
130 .replace("?", "")\ 131 .replace("?", "")\
131 .replace('"', "")\ 132 .replace('"', "")\
132 .replace("<", "")\ 133 .replace("<", "")\
133 .replace(">", "")\ 134 .replace(">", "")\
134 .replace("|", "") 135 .replace("|", "")
136
137
138 def pixmapFromByteArray(data):
139 """
140 Module function to convert a byte array to a pixmap.
141
142 @param data data for the pixmap
143 @type bytes or QByteArray
144 @return extracted pixmap
145 @rtype QPixmap
146 """
147 pixmap = QPixmap()
148 barray = QByteArray.fromBase64(data)
149 pixmap.loadFromData(barray)
150
151 return pixmap

eric ide

mercurial