Skip to content

Commit 239a3f7

Browse files
committed
Wait for sessions
1 parent 6f401f4 commit 239a3f7

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

sdk/python/flet/flet.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,23 @@ def exit_gracefully(signum, frame):
9191
print("Connected to Flet app and handling user sessions...")
9292

9393
fvp = None
94-
if view == WEB_BROWSER:
95-
open_in_browser(conn.page_url)
94+
95+
if view == FLET_APP and not is_linux():
96+
fvp = _open_flet_view(conn.page_url)
97+
try:
98+
fvp.wait()
99+
except (Exception) as e:
100+
pass
101+
else:
102+
if view == WEB_BROWSER:
103+
open_in_browser(conn.page_url)
96104
try:
97105
if is_windows():
98106
input()
99107
else:
100108
terminate.wait()
101109
except (Exception) as e:
102110
pass
103-
elif view == FLET_APP and (is_macos() or is_windows()):
104-
fvp = _open_flet_view(conn.page_url)
105-
try:
106-
fvp.wait()
107-
except (Exception) as e:
108-
pass
109111

110112
conn.close()
111113

sdk/python/flet/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ def is_windows():
88
return platform.system() == "Windows"
99

1010

11+
def is_linux():
12+
return platform.system() == "Linux"
13+
14+
1115
def is_macos():
1216
return platform.system() == "Darwin"
1317

sdk/python/playground/todo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,4 @@ def main(page: Page):
173173
page.add(app.view)
174174

175175

176-
flet.app(name="test1", port=8550, target=main, view=flet.FLET_APP)
176+
flet.app(name="test1", port=8550, target=main, view=flet.WEB_BROWSER)

0 commit comments

Comments
 (0)