def __init__(self, parent=None): QWebView.__init__(self, parent) self.setWindowFlags(Qt.Popup) self.setFixedSize(600, 400) self.manager = Rpc.RpcNetworkAccessManager( self.page().networkAccessManager()) self.page().setNetworkAccessManager(self.manager) self.page().setLinkDelegationPolicy(QWebPage.DelegateExternalLinks) self.connect(self, SIGNAL('linkClicked(QUrl)'), self.openLink) # Determine appropiate position for the popup screenHeight = QApplication.desktop().screenGeometry().height() screenWidth = QApplication.desktop().screenGeometry().width() pos = parent.parent().mapToGlobal(parent.pos()) # Fix y coordinate y = pos.y() + parent.height() if y + self.height() > screenHeight: y = pos.y() - self.height() if y < 0: y = screenHeight - self.height() # Fix x coordinate x = pos.x() if x < 0: x = 0 elif x + self.width() > screenWidth: x = screenWidth - self.width() self.move(x, y) self._label = '' self._help = '' self._filter = () self._type = None
def __init__(self, parent=None): QWidget.__init__(self, parent) WebWidgetUi.__init__(self) self.setupUi(self) self.manager = Rpc.RpcNetworkAccessManager( self.uiWeb.page().networkAccessManager()) self.uiWeb.page().setNetworkAccessManager(self.manager) self.name = '' self.handlers = { 'Previous': self.previous, 'Next': self.__next__, 'Reload': self.reload, 'Find': self.find, }