eric6/WebBrowser/Tools/WebBrowserTools.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8221
0572a215bd2f
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
105 Module function to generate a file name based on the given URL. 105 Module function to generate a file name based on the given URL.
106 106
107 @param url URL (QUrl) 107 @param url URL (QUrl)
108 @return file name (string) 108 @return file name (string)
109 """ 109 """
110 fileName = url.toString(QUrl.RemoveFragment | QUrl.RemoveQuery | 110 fileName = url.toString(
111 QUrl.RemoveScheme | QUrl.RemovePort) 111 QUrl.UrlFormattingOption.RemoveFragment |
112 QUrl.UrlFormattingOption.RemoveQuery |
113 QUrl.UrlFormattingOption.RemoveScheme |
114 QUrl.UrlFormattingOption.RemovePort
115 )
112 if fileName.find("/") != -1: 116 if fileName.find("/") != -1:
113 pos = fileName.rfind("/") 117 pos = fileName.rfind("/")
114 fileName = fileName[pos:] 118 fileName = fileName[pos:]
115 fileName = fileName.replace("/", "") 119 fileName = fileName.replace("/", "")
116 120
169 @return byte array containing the pixmap 173 @return byte array containing the pixmap
170 @rtype QByteArray 174 @rtype QByteArray
171 """ 175 """
172 byteArray = QByteArray() 176 byteArray = QByteArray()
173 buffer = QBuffer(byteArray) 177 buffer = QBuffer(byteArray)
174 buffer.open(QIODevice.WriteOnly) 178 buffer.open(QIODevice.OpenModeFlag.WriteOnly)
175 if pixmap.save(buffer, "PNG"): 179 if pixmap.save(buffer, "PNG"):
176 return buffer.buffer().toBase64() 180 return buffer.buffer().toBase64()
177 181
178 return QByteArray() 182 return QByteArray()
179 183

eric ide

mercurial