From d49999183160898ca0daae3c9cdf0d4704b61d12 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 7 Sep 2023 10:41:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=93=E5=8C=85=E8=84=9A?= =?UTF-8?q?=E6=9C=AC;=20load=E6=96=B9=E6=B3=95=E6=94=AF=E6=8C=81http?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + build.sh | 1 + .../python3/dist-packages/webengine/gtk3/_webengine.py | 9 ++++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b35b847..0942f66 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__ +unpack *.deb \ No newline at end of file diff --git a/build.sh b/build.sh index cb3b392..d1e06c2 100755 --- a/build.sh +++ b/build.sh @@ -7,6 +7,7 @@ if [ -d unpack ]; then sudo rm -rf unpack fi +find usr -type d -name __pycache__ | xargs rm -rf mkdir -p unpack/DEBIAN diff --git a/usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py b/usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py index 4bc68f0..0b7bfcd 100644 --- a/usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py +++ b/usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py @@ -125,10 +125,13 @@ class WebEngine(WebKit2.WebView): def load(self, url = '/index.html'): - if self.root is None: - raise EnvironmentError('web root dir not set!') + if url.startswith('http:') or url.startswith('https:'): + self.load_uri(url) else: - self.load_uri(f"app://{url}") + if self.root is None: + raise EnvironmentError('web root dir not set!') + else: + self.load_uri(f"app://{url}")