summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
Diffstat (limited to 'g4f')
-rw-r--r--g4f/gui/server/api.py2
-rw-r--r--g4f/gui/webview.py8
-rw-r--r--g4f/gui/webview.spec45
3 files changed, 6 insertions, 49 deletions
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py
index 747d0c21..29566595 100644
--- a/g4f/gui/server/api.py
+++ b/g4f/gui/server/api.py
@@ -136,7 +136,7 @@ class Api():
camera.take_picture(filename=filename, on_complete=self.on_camera)
def on_image_selection(self, filename):
- filename = filename[0] if isinstance(filename, list) else filename
+ filename = filename[0] if isinstance(filename, list) and filename else filename
if filename is not None and os.path.exists(filename):
self.image = filename
else:
diff --git a/g4f/gui/webview.py b/g4f/gui/webview.py
index b015dbed..0ea61adb 100644
--- a/g4f/gui/webview.py
+++ b/g4f/gui/webview.py
@@ -17,13 +17,14 @@ import g4f.debug
def run_webview(
debug: bool = False,
ssl: bool = True,
- storage_path: str = None
+ storage_path: str = None,
+ gui: str = None
):
if getattr(sys, 'frozen', False):
dirname = sys._MEIPASS
else:
dirname = os.path.dirname(__file__)
- webview.settings['OPEN_EXTERNAL_LINKS_IN_BROWSER'] = False
+ webview.settings['OPEN_EXTERNAL_LINKS_IN_BROWSER'] = True
webview.settings['ALLOW_DOWNLOADS'] = True
webview.create_window(
f"g4f - {g4f.version.utils.current_version}",
@@ -37,7 +38,8 @@ def run_webview(
private_mode=False,
storage_path=storage_path,
debug=debug,
- ssl=ssl
+ ssl=ssl,
+ gui=gui
)
if __name__ == "__main__":
diff --git a/g4f/gui/webview.spec b/g4f/gui/webview.spec
deleted file mode 100644
index 360e264e..00000000
--- a/g4f/gui/webview.spec
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- mode: python ; coding: utf-8 -*-
-
-
-block_cipher = None
-
-
-a = Analysis(
- ['webview.py'],
- pathex=[],
- binaries=[],
- datas=[],
- hiddenimports=[],
- hookspath=[],
- hooksconfig={},
- runtime_hooks=[],
- excludes=[],
- win_no_prefer_redirects=False,
- win_private_assemblies=False,
- cipher=block_cipher,
- noarchive=False,
-)
-pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
-
-exe = EXE(
- pyz,
- a.scripts,
- a.binaries,
- Tree('client', prefix='client'),
- a.zipfiles,
- a.datas,
- [],
- name='webview',
- debug=False,
- bootloader_ignore_signals=False,
- strip=False,
- upx=True,
- upx_exclude=[],
- runtime_tmpdir=None,
- console=False,
- disable_windowed_traceback=False,
- argv_emulation=False,
- target_arch=None,
- codesign_identity=None,
- entitlements_file=None,
-)