Exemplo n.º 1
0
    def __init__(self, gui, icon, do_user_config, qaction, us):
        QDialog.__init__(self, gui)
        self.main_gui = gui
        self.do_user_config = do_user_config
        self.qaction = qaction
        self.us = us

        #- main UI layout -----------------------------------------------------
        self.ll = QVBoxLayout()

        self.l = QHBoxLayout()
        self.l.setSpacing(0)
        #self.l.setMargin(0) # not in Qt5
        self.w = QWidget()
        self.w.setLayout(self.l)

        self.setLayout(self.ll)
        self.setWindowIcon(icon)
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)

        #- webkit -------------------------------------------------------------

        self.webview = QWebView()
        self.webview.setMaximumWidth(680)
        self.webview.setMaximumHeight(320)
        self.webview.setSizePolicy(QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        # self.webview.load(QUrl.fromLocalFile(
        #     os.path.join(self.us.portable_directory,
        #                  "portable/kaliweb.html")))
        self.loadUrl()
        self.webview.page().networkAccessManager().sslErrors.connect(
            self.sslErrorHandler)
        #self.connect(self.webview.page().networkAccessManager(),
        #             SIGNAL("sslErrors (QNetworkReply *, \
        #                                       const QList<QSslError> &)"),
        #             self.sslErrorHandler)

        logger.info("KALIWEB PATH: {}".format(
            os.path.join(self.us.portable_directory, "portable/kaliweb.html")))
        self.ll.addWidget(self.webview)