示例#1
0
    def run(self):
        Instance.record("view", JWebView(self.config))

        if self.config['window']["transparent"]:
            from JAK.Utils import JavaScript
            JavaScript.css(
                "body, html {background-color:transparent !important;background-image:none !important;}",
                "JAK")

        if self.config['webview']["addCSS"]:
            from JAK.Utils import JavaScript
            JavaScript.css(self.config['webview']["addCSS"], "user")
            print("Custom CSS detected")

        if self.config['webview']["runJavaScript"]:
            from JAK.Utils import JavaScript
            JavaScript.send(self.config['webview']["runJavaScript"])
            print("Custom JavaScript detected")

        win = Instance.auto("win", JWindow(self.config))
        if self.config['window']["fullScreen"]:
            screen = getScreenGeometry()
            win.resize(screen.width(), screen.height())
        else:
            win.resize(win.default_size("width"), win.default_size("height"))

        win.setFocusPolicy(Qt.WheelFocus)
        win.show()
        win.setFocus()
        win.window_original_position = win.frameGeometry()
        result = self.exec_()
        sys.exit(result)
    def _page_load_finish(self) -> None:
        result = time.localtime(time.time())
        print(f"Document Ready in: {result.tm_sec} seconds")
        try:
            if self.custom_css:
                print("Custom CSS loaded")
                JavaScript.css(self, self.custom_css)
        except AttributeError:
            pass

        try:
            if self.custom_js:
                print("Custom JavaScript loaded")
                JavaScript.send(self, self.custom_js)
        except AttributeError:
            pass
示例#3
0
    def run(self):
        Instance.record("view", JWebView(self.config))

        if self.config["add_CSS"]:
            from JAK.Utils import JavaScript
            JavaScript.css(self.config["add_CSS"])
            print("Custom CSS detected")

        if self.config["run_JavaScript"]:
            from JAK.Utils import JavaScript
            JavaScript.send(self.config["run_JavaScript"])
            print("Custom JavaScript detected")

        win = Instance.auto("win", JWindow(self.config))
        win.resize(win.default_size("width"), win.default_size("height"))
        win.show()
        win.window_original_position = win.frameGeometry()
        result = self.exec_()
        sys.exit(result)