WebBrowser/PersonalInformationManager/PersonalInformationManager.py

changeset 5001
08eaee907686
parent 4917
682750cc7bd5
child 5389
9b1c800daff3
equal deleted inserted replaced
5000:1a86b869d8a9 5001:08eaee907686
13 from PyQt5.QtCore import Qt, QObject, QPoint 13 from PyQt5.QtCore import Qt, QObject, QPoint
14 from PyQt5.QtWidgets import QDialog, QMenu 14 from PyQt5.QtWidgets import QDialog, QMenu
15 15
16 import Preferences 16 import Preferences
17 import UI.PixmapCache 17 import UI.PixmapCache
18
19 from ..WebBrowserPage import WebBrowserPage
18 20
19 21
20 class PersonalInformationManager(QObject): 22 class PersonalInformationManager(QObject):
21 """ 23 """
22 Class implementing the personal information manager used to complete form 24 Class implementing the personal information manager used to complete form
181 if (e) {{ 183 if (e) {{
182 var v = e.value.substring(0, e.selectionStart); 184 var v = e.value.substring(0, e.selectionStart);
183 v += "{2}" + e.value.substring(e.selectionEnd); 185 v += "{2}" + e.value.substring(e.selectionEnd);
184 e.value = v; 186 e.value = v;
185 }}""".format(self.__clickedPos.x(), self.__clickedPos.y(), info) 187 }}""".format(self.__clickedPos.x(), self.__clickedPos.y(), info)
186 self.__view.page().runJavaScript(source) 188 self.__view.page().runJavaScript(source, WebBrowserPage.SafeJsWorld)
187 189
188 def viewKeyPressEvent(self, view, evt): 190 def viewKeyPressEvent(self, view, evt):
189 """ 191 """
190 Protected method to handle key press events we are interested in. 192 Protected method to handle key press events we are interested in.
191 193
218 input.value = table[key]; 220 input.value = table[key];
219 break; 221 break;
220 }} 222 }}
221 }} 223 }}
222 }}""".format(self.__matchingJsTable()) 224 }}""".format(self.__matchingJsTable())
223 view.page().runJavaScript(source) 225 view.page().runJavaScript(source, WebBrowserPage.SafeJsWorld)
224 226
225 return True 227 return True
226 228
227 def connectPage(self, page): 229 def connectPage(self, page):
228 """ 230 """
262 'inset 0 0 2px 1px #000EEE'; 264 'inset 0 0 2px 1px #000EEE';
263 break; 265 break;
264 }} 266 }}
265 }} 267 }}
266 }}""".format(self.__matchingJsTable()) 268 }}""".format(self.__matchingJsTable())
267 page.runJavaScript(source) 269 page.runJavaScript(source, WebBrowserPage.SafeJsWorld)
268 270
269 def __matchingJsTable(self): 271 def __matchingJsTable(self):
270 """ 272 """
271 Private method to create the common part of the JavaScript sources. 273 Private method to create the common part of the JavaScript sources.
272 274

eric ide

mercurial