diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-06 12:23:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-06 12:23:58 +0200 |
commit | 5db96406dd142b9a84d459ab45a10465bdb61740 (patch) | |
tree | eb7d4844047d6bd8560aa4032a6f3cf9f5cb82ec /g4f/gui | |
parent | Update client.md (diff) | |
parent | Update README.md (diff) | |
download | gpt4free-5db96406dd142b9a84d459ab45a10465bdb61740.tar gpt4free-5db96406dd142b9a84d459ab45a10465bdb61740.tar.gz gpt4free-5db96406dd142b9a84d459ab45a10465bdb61740.tar.bz2 gpt4free-5db96406dd142b9a84d459ab45a10465bdb61740.tar.lz gpt4free-5db96406dd142b9a84d459ab45a10465bdb61740.tar.xz gpt4free-5db96406dd142b9a84d459ab45a10465bdb61740.tar.zst gpt4free-5db96406dd142b9a84d459ab45a10465bdb61740.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/gui/server/api.py | 4 | ||||
-rw-r--r-- | g4f/gui/webview.py | 8 | ||||
-rw-r--r-- | windows/main.spec (renamed from g4f/gui/webview.spec) | 9 |
3 files changed, 12 insertions, 9 deletions
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 747d0c21..ab9ad331 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -136,8 +136,8 @@ 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 - if filename is not None and os.path.exists(filename): + filename = filename[0] if isinstance(filename, list) and filename else filename + if filename and os.path.exists(filename): self.image = filename else: self.image = None 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/windows/main.spec index 360e264e..9dd1d098 100644 --- a/g4f/gui/webview.spec +++ b/windows/main.spec @@ -5,11 +5,11 @@ block_cipher = None a = Analysis( - ['webview.py'], + ['main.py'], pathex=[], binaries=[], datas=[], - hiddenimports=[], + hiddenimports=['plyer.platforms.linux.filechooser', 'plyer.platforms.win.filechooser'], hookspath=[], hooksconfig={}, runtime_hooks=[], @@ -25,11 +25,11 @@ exe = EXE( pyz, a.scripts, a.binaries, - Tree('client', prefix='client'), + Tree('C:/Users/Docker/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0/LocalCache/local-packages/Python311/site-packages/g4f/gui/client', prefix='client'), a.zipfiles, a.datas, [], - name='webview', + name='g4f', debug=False, bootloader_ignore_signals=False, strip=False, @@ -42,4 +42,5 @@ exe = EXE( target_arch=None, codesign_identity=None, entitlements_file=None, + icon='icon.ico', ) |