eric6/WebBrowser/AdBlock/AdBlockRule.py

branch
without_py2_and_pyqt4
changeset 7201
6b42677d7043
parent 6942
2602857055c5
child 7229
53054eb5b15a
equal deleted inserted replaced
7200:ebab8ba287e6 7201:6b42677d7043
11 11
12 import re 12 import re
13 13
14 from enum import IntEnum 14 from enum import IntEnum
15 15
16 from PyQt5.QtCore import PYQT_VERSION, Qt, QRegExp 16 from PyQt5.QtCore import Qt, QRegExp
17 from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo 17 from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo
18
19 from Globals import qVersionTuple
20 18
21 19
22 def toSecondLevelDomain(url): 20 def toSecondLevelDomain(url):
23 """ 21 """
24 Module function to get a second level domain from the given URL. 22 Module function to get a second level domain from the given URL.
653 @return flag indicating a match 651 @return flag indicating a match
654 @rtype boolean 652 @rtype boolean
655 """ 653 """
656 match = ( 654 match = (
657 req.resourceType() == 655 req.resourceType() ==
658 QWebEngineUrlRequestInfo.ResourceTypeSubResource) 656 QWebEngineUrlRequestInfo.ResourceTypeSubResource
659 if qVersionTuple() >= (5, 7, 0) and PYQT_VERSION >= 0x50700: 657 )
660 match = match or ( 658 match = match or (
661 req.resourceType() == 659 req.resourceType() ==
662 QWebEngineUrlRequestInfo.ResourceTypePluginResource) 660 QWebEngineUrlRequestInfo.ResourceTypePluginResource
661 )
663 662
664 if self.__objectSubrequestException: 663 if self.__objectSubrequestException:
665 return not match 664 return not match
666 else: 665 else:
667 return match 666 return match

eric ide

mercurial