Helpviewer/HelpBrowserWV.py

changeset 1415
28fa9633d57e
parent 1232
ed31e909cf2e
child 1474
1eaec11a0078
equal deleted inserted replaced
1413:7b9d59fc16e8 1415:28fa9633d57e
456 self.__accessKeyLabels = [] 456 self.__accessKeyLabels = []
457 self.__accessKeyNodes = {} 457 self.__accessKeyNodes = {}
458 458
459 self.page().loadStarted.connect(self.__hideAccessKeys) 459 self.page().loadStarted.connect(self.__hideAccessKeys)
460 self.page().scrollRequested.connect(self.__hideAccessKeys) 460 self.page().scrollRequested.connect(self.__hideAccessKeys)
461
462 self.__rss = []
461 463
462 def __addExternalBinding(self, frame=None): 464 def __addExternalBinding(self, frame=None):
463 """ 465 """
464 Private slot to add javascript bindings for adding search providers. 466 Private slot to add javascript bindings for adding search providers.
465 467
1613 self.__enableAccessKeys = Preferences.getHelp("AccessKeysEnabled") 1615 self.__enableAccessKeys = Preferences.getHelp("AccessKeysEnabled")
1614 if not self.__enableAccessKeys: 1616 if not self.__enableAccessKeys:
1615 self.__hideAccessKeys() 1617 self.__hideAccessKeys()
1616 1618
1617 self.reload() 1619 self.reload()
1620
1621 ############################################################################
1622 ## RSS related methods below
1623 ############################################################################
1624
1625 def checkRSS(self):
1626 """
1627 Public method to check, if the loaded page contains feed links.
1628
1629 @return flag indicating the existence of feed links (boolean)
1630 """
1631 self.__rss = []
1632
1633 frame =self.page().mainFrame()
1634 linkElementsList = frame.findAllElements("link").toList()
1635
1636 for linkElement in linkElementsList:
1637 # only atom+xml and rss+xml will be processed
1638 if linkElement.attribute("rel") != "alternate" or \
1639 (linkElement.attribute("type") != "application/rss+xml" and \
1640 linkElement.attribute("type") != "application/atom+xml"):
1641 continue
1642
1643 title = linkElement.attribute("title")
1644 href = linkElement.attribute("href")
1645 if href == "" or title == "":
1646 continue
1647 self.__rss.append((title, href))
1648
1649 return len(self.__rss) > 0
1650
1651 def getRSS(self):
1652 """
1653 Public method to get the extracted RSS feeds.
1654
1655 @return list of RSS feeds (list of tuples of two strings)
1656 """
1657 return self.__rss
1658
1659 def hasRSS(self):
1660 """
1661 Public method to check, if the loaded page has RSS links.
1662
1663 @return flag indicating the presence of RSS links (boolean)
1664 """
1665 return len(self.__rss) > 0
1618 1666
1619 1667
1620 def contentSniff(data): 1668 def contentSniff(data):
1621 """ 1669 """
1622 Module function to do some content sniffing to check, if the data is HTML. 1670 Module function to do some content sniffing to check, if the data is HTML.

eric ide

mercurial