Sat, 10 Oct 2020 15:16:17 +0200
AdBlockIcon: fixed issues setting the state and icon via the menu.
--- a/eric6/WebBrowser/AdBlock/AdBlockIcon.py Sat Oct 10 12:20:51 2020 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockIcon.py Sat Oct 10 15:16:17 2020 +0200 @@ -69,28 +69,24 @@ act = menu.addAction( UI.PixmapCache.getIcon("adBlockPlusDisabled"), self.tr("Disable AdBlock")) - act.setData(False) - act.triggered.connect(lambda: self.__enableAdBlock(act)) + act.triggered.connect(lambda: self.__enableAdBlock(False)) else: act = menu.addAction( UI.PixmapCache.getIcon("adBlockPlus"), self.tr("Enable AdBlock")) - act.setData(True) - act.triggered.connect(lambda: self.__enableAdBlock(act)) + act.triggered.connect(lambda: self.__enableAdBlock(True)) menu.addSeparator() if manager.isEnabled() and self.__mw.currentBrowser().url().host(): if self.__isCurrentHostExcepted(): act = menu.addAction( UI.PixmapCache.getIcon("adBlockPlus"), self.tr("Remove AdBlock Exception")) - act.setData(False) - act.triggered.connect(lambda: self.__setException(act)) + act.triggered.connect(lambda: self.__setException(False)) else: act = menu.addAction( UI.PixmapCache.getIcon("adBlockPlusGreen"), self.tr("Add AdBlock Exception")) - act.setData(True) - act.triggered.connect(lambda: self.__setException(act)) + act.triggered.connect(lambda: self.__setException(True)) menu.addAction( UI.PixmapCache.getIcon("adBlockPlusGreen"), self.tr("AdBlock Exceptions..."), manager.showExceptionsDialog) @@ -132,14 +128,14 @@ self.__createMenu(menu) menu.exec(pos) - def __enableAdBlock(self, act): + def __enableAdBlock(self, enable): """ Private slot to enable or disable AdBlock. - @param act reference to the action - @type QAction + @param enable flag indicating the desired enable state + @type bool """ - self.__mw.adBlockManager().setEnabled(act.data()) + self.__mw.adBlockManager().setEnabled(enable) def __isCurrentHostExcepted(self): """ @@ -171,16 +167,16 @@ else: self.setPixmap(UI.PixmapCache.getPixmap("adBlockPlus16")) - def __setException(self, act): + def __setException(self, enable): """ Private slot to add or remove the current host from the list of exceptions. - @param act referenced to the action - @type QAction + @param enable flag indicating to set or remove an exception + @type bool """ urlHost = self.__mw.currentBrowser().url().host() - if act.data(): + if enable: self.__mw.adBlockManager().addException(urlHost) else: self.__mw.adBlockManager().removeException(urlHost)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eric6/icons/breeze-dark/adBlockPlus16.svg Sat Oct 10 15:16:17 2020 +0200 @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + version="1.0" + id="svg12" + sodipodi:docname="adBlockPlus.svg" + inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1107" + inkscape:window-height="724" + id="namedview14" + showgrid="false" + inkscape:zoom="10.727273" + inkscape:cx="11" + inkscape:cy="11" + inkscape:window-x="621" + inkscape:window-y="362" + inkscape:window-maximized="0" + inkscape:current-layer="svg12" /> + <g + transform="matrix(0.06249685,0,0,0.06249678,-5.0621416,-10.084582)" + id="g10"> + <g + transform="matrix(8.259,0,0,8.259,-1246.1,-3046.4)" + id="g8"> + <path + transform="matrix(1.2678,1.7357,-1.7357,1.2678,187.63,395.98)" + d="m 3.8498,13 -5.7925,0.92859 -4.7525,-3.4393 -0.92859,-5.7925 3.4393,-4.7525 5.7925,-0.92859 4.7525,3.4393 0.92859,5.7925 z" + id="path2" + inkscape:connector-curvature="0" + style="fill:#ffffff;stroke:#000000;stroke-width:0.23263;stroke-linecap:square" /> + <path + transform="matrix(1.1488,1.5728,-1.5728,1.1488,186.64,396.59)" + d="m 3.8498,13 -5.7925,0.92859 -4.7525,-3.4393 -0.92859,-5.7925 3.4393,-4.7525 5.7925,-0.92859 4.7525,3.4393 0.92859,5.7925 z" + id="path4" + inkscape:connector-curvature="0" + style="fill:#ff0000" /> + <path + transform="matrix(0.96443,0,0,1.2232,150.79,384.56)" + d="m 19.535,18.613 h -3.5273 l -0.55664,1.5938 h -2.2676 l 3.2402,-8.748 h 2.6895 l 3.2402,8.748 h -2.2676 z M 16.5702,16.99 h 2.3965 l -1.1953,-3.4805 z m 10.441,-2.1445 c 0.35546,5e-6 0.625,-0.07812 0.80859,-0.23438 0.18359,-0.15624 0.27538,-0.38671 0.27539,-0.69141 -6e-6,-0.30078 -0.0918,-0.53027 -0.27539,-0.68848 -0.1836,-0.1582 -0.45313,-0.2373 -0.80859,-0.2373 h -1.248 v 1.8516 z m 0.07617,3.8262 c 0.45312,10e-7 0.79394,-0.0957 1.0225,-0.28711 0.22851,-0.1914 0.34277,-0.48047 0.34277,-0.86719 -6e-6,-0.3789 -0.11329,-0.66308 -0.33984,-0.85254 -0.22657,-0.18945 -0.56836,-0.28418 -1.0254,-0.28418 h -1.3242 v 2.291 z m 2.0977,-3.1465 c 0.48437,0.14063 0.85937,0.4004 1.125,0.7793 0.26562,0.37891 0.39843,0.84375 0.39844,1.3945 -8e-6,0.84375 -0.28516,1.4727 -0.85547,1.8867 -0.57032,0.41406 -1.4375,0.62109 -2.6016,0.62109 h -3.7441 v -8.748 h 3.3867 c 1.2148,9e-6 2.0947,0.1836 2.6396,0.55078 0.54491,0.3672 0.81738,0.95509 0.81738,1.7637 -8e-6,0.42579 -0.09962,0.78809 -0.29883,1.0869 -0.19923,0.29883 -0.48829,0.52051 -0.86719,0.66504 z m 3.4629,-4.0664 h 3.7441 c 1.1133,9e-6 1.9678,0.24708 2.5635,0.74121 0.5957,0.49415 0.89355,1.1982 0.89355,2.1123 -8e-6,0.91797 -0.29786,1.624 -0.89355,2.1182 -0.59571,0.49414 -1.4502,0.74121 -2.5635,0.74121 h -1.4883 v 3.0352 h -2.2559 z m 2.2559,1.6348 v 2.4434 h 1.248 c 0.4375,5e-6 0.77538,-0.10644 1.0137,-0.31934 0.23828,-0.21288 0.35742,-0.51464 0.35742,-0.90527 -6e-6,-0.39062 -0.11915,-0.6914 -0.35742,-0.90234 -0.23829,-0.21093 -0.57618,-0.3164 -1.0137,-0.31641 z" + id="path6" + inkscape:connector-curvature="0" + style="fill:#ffffff" /> + </g> + </g> +</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eric6/icons/breeze-light/adBlockPlus16.svg Sat Oct 10 15:16:17 2020 +0200 @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + version="1.0" + id="svg12" + sodipodi:docname="adBlockPlus.svg" + inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1107" + inkscape:window-height="724" + id="namedview14" + showgrid="false" + inkscape:zoom="10.727273" + inkscape:cx="11" + inkscape:cy="11" + inkscape:window-x="621" + inkscape:window-y="362" + inkscape:window-maximized="0" + inkscape:current-layer="svg12" /> + <g + transform="matrix(0.06249685,0,0,0.06249678,-5.0621416,-10.084582)" + id="g10"> + <g + transform="matrix(8.259,0,0,8.259,-1246.1,-3046.4)" + id="g8"> + <path + transform="matrix(1.2678,1.7357,-1.7357,1.2678,187.63,395.98)" + d="m 3.8498,13 -5.7925,0.92859 -4.7525,-3.4393 -0.92859,-5.7925 3.4393,-4.7525 5.7925,-0.92859 4.7525,3.4393 0.92859,5.7925 z" + id="path2" + inkscape:connector-curvature="0" + style="fill:#ffffff;stroke:#000000;stroke-width:0.23263;stroke-linecap:square" /> + <path + transform="matrix(1.1488,1.5728,-1.5728,1.1488,186.64,396.59)" + d="m 3.8498,13 -5.7925,0.92859 -4.7525,-3.4393 -0.92859,-5.7925 3.4393,-4.7525 5.7925,-0.92859 4.7525,3.4393 0.92859,5.7925 z" + id="path4" + inkscape:connector-curvature="0" + style="fill:#ff0000" /> + <path + transform="matrix(0.96443,0,0,1.2232,150.79,384.56)" + d="m 19.535,18.613 h -3.5273 l -0.55664,1.5938 h -2.2676 l 3.2402,-8.748 h 2.6895 l 3.2402,8.748 h -2.2676 z M 16.5702,16.99 h 2.3965 l -1.1953,-3.4805 z m 10.441,-2.1445 c 0.35546,5e-6 0.625,-0.07812 0.80859,-0.23438 0.18359,-0.15624 0.27538,-0.38671 0.27539,-0.69141 -6e-6,-0.30078 -0.0918,-0.53027 -0.27539,-0.68848 -0.1836,-0.1582 -0.45313,-0.2373 -0.80859,-0.2373 h -1.248 v 1.8516 z m 0.07617,3.8262 c 0.45312,10e-7 0.79394,-0.0957 1.0225,-0.28711 0.22851,-0.1914 0.34277,-0.48047 0.34277,-0.86719 -6e-6,-0.3789 -0.11329,-0.66308 -0.33984,-0.85254 -0.22657,-0.18945 -0.56836,-0.28418 -1.0254,-0.28418 h -1.3242 v 2.291 z m 2.0977,-3.1465 c 0.48437,0.14063 0.85937,0.4004 1.125,0.7793 0.26562,0.37891 0.39843,0.84375 0.39844,1.3945 -8e-6,0.84375 -0.28516,1.4727 -0.85547,1.8867 -0.57032,0.41406 -1.4375,0.62109 -2.6016,0.62109 h -3.7441 v -8.748 h 3.3867 c 1.2148,9e-6 2.0947,0.1836 2.6396,0.55078 0.54491,0.3672 0.81738,0.95509 0.81738,1.7637 -8e-6,0.42579 -0.09962,0.78809 -0.29883,1.0869 -0.19923,0.29883 -0.48829,0.52051 -0.86719,0.66504 z m 3.4629,-4.0664 h 3.7441 c 1.1133,9e-6 1.9678,0.24708 2.5635,0.74121 0.5957,0.49415 0.89355,1.1982 0.89355,2.1123 -8e-6,0.91797 -0.29786,1.624 -0.89355,2.1182 -0.59571,0.49414 -1.4502,0.74121 -2.5635,0.74121 h -1.4883 v 3.0352 h -2.2559 z m 2.2559,1.6348 v 2.4434 h 1.248 c 0.4375,5e-6 0.77538,-0.10644 1.0137,-0.31934 0.23828,-0.21288 0.35742,-0.51464 0.35742,-0.90527 -6e-6,-0.39062 -0.11915,-0.6914 -0.35742,-0.90234 -0.23829,-0.21093 -0.57618,-0.3164 -1.0137,-0.31641 z" + id="path6" + inkscape:connector-curvature="0" + style="fill:#ffffff" /> + </g> + </g> +</svg>