Helpviewer/WebPlugins/ClickToFlash/ClickToFlash.py

changeset 1960
d8c45fe8a1b9
parent 1651
bc68f24d5658
child 1965
96f5a76e1845
equal deleted inserted replaced
1957:2fed7bc4ad83 1960:d8c45fe8a1b9
8 """ 8 """
9 9
10 10
11 from PyQt4.QtCore import pyqtSlot, QUrl, Qt, QByteArray, QTimer 11 from PyQt4.QtCore import pyqtSlot, QUrl, Qt, QByteArray, QTimer
12 from PyQt4.QtGui import QWidget, QMenu, QCursor, QDialog, QLabel, QFormLayout 12 from PyQt4.QtGui import QWidget, QMenu, QCursor, QDialog, QLabel, QFormLayout
13 from PyQt4.QtNetwork import QNetworkRequest
13 from PyQt4.QtWebKit import QWebHitTestResult, QWebElement, QWebView, QWebElementCollection 14 from PyQt4.QtWebKit import QWebHitTestResult, QWebElement, QWebView, QWebElementCollection
14 15
15 from .Ui_ClickToFlash import Ui_ClickToFlash 16 from .Ui_ClickToFlash import Ui_ClickToFlash
16 17
17 import UI.PixmapCache 18 import UI.PixmapCache
42 43
43 # Check AdBlock first 44 # Check AdBlock first
44 manager = Helpviewer.HelpWindow.HelpWindow.adblockManager() 45 manager = Helpviewer.HelpWindow.HelpWindow.adblockManager()
45 if manager.isEnabled(): 46 if manager.isEnabled():
46 urlString = bytes(url.toEncoded()).decode() 47 urlString = bytes(url.toEncoded()).decode()
48 urlDomain = url.host()
47 for subscription in manager.subscriptions(): 49 for subscription in manager.subscriptions():
48 if not subscription.allow(urlString) and subscription.block(urlString): 50 blockedRule = subscription.match(
51 QNetworkRequest(url), urlDomain, urlString)
52 if blockedRule:
49 QTimer.singleShot(200, self.__hideAdBlocked) 53 QTimer.singleShot(200, self.__hideAdBlocked)
50 return 54 return
51 55
52 self.setupUi(self) 56 self.setupUi(self)
53 57
234 """ 238 """
235 Private slot to hide the object. 239 Private slot to hide the object.
236 """ 240 """
237 self.__findElement() 241 self.__findElement()
238 if not self.__element.isNull(): 242 if not self.__element.isNull():
239 self.__element.setStyleProperty("visibility", "hidden") 243 self.__element.setStyleProperty("display", "none")
240 else: 244 else:
241 self.hide() 245 self.hide()
242 246
243 def __showInfo(self): 247 def __showInfo(self):
244 """ 248 """

eric ide

mercurial