Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilePicker in Flet 0.6.0 pops up 2 windows instead of 1 #1324

Closed
ningzichun opened this issue Apr 23, 2023 · 1 comment · Fixed by #1333
Closed

FilePicker in Flet 0.6.0 pops up 2 windows instead of 1 #1324

ningzichun opened this issue Apr 23, 2023 · 1 comment · Fixed by #1333
Labels
bug Something isn't working

Comments

@ningzichun
Copy link

Description

Calling FilePicker on upper view since Flet 0.6.0.dev1309 results in 2 windows popping up instead of the expected 1. This behavior was not present in version 0.5.2.

Code example to reproduce the issue:

import flet as ft

def main(page: ft.Page):
    page.title = "Routes Example"


    file_picker = ft.FilePicker()
    page.overlay.append(file_picker)

    def route_change(route):
        page.views.clear()
        page.views.append(
            ft.View(
                "/",
                [
                    ft.AppBar(title=ft.Text("Flet app"), bgcolor=ft.colors.SURFACE_VARIANT),
                    ft.ElevatedButton("Click this will pop up 1 window",
                        on_click=lambda _: file_picker.pick_files(allow_multiple=True)),
                    ft.ElevatedButton("Visit Store", on_click=lambda _: page.go("/store")),
                ],
            )
        )
        if page.route == "/store":
            page.views.append(
                ft.View(
                    "/store",
                    [
                        ft.AppBar(title=ft.Text("Store"), bgcolor=ft.colors.SURFACE_VARIANT),
                        ft.ElevatedButton("Click this will pop up 2 windows",
                            on_click=lambda _: file_picker.pick_files(allow_multiple=True)),
                        ft.ElevatedButton("Go Home", on_click=lambda _: page.go("/")),
                    ],
                )
            )
        page.update()

    def view_pop(view):
        page.views.pop()
        top_view = page.views[-1]
        page.go(top_view.route)

    page.on_route_change = route_change
    page.on_view_pop = view_pop
    page.go(page.route)


ft.app(target=main)

Describe the results you received:
ss01

Describe the results you expected:

The expected behavior is that only 1 window should pop up.

Additional information you deem important (e.g. issue happens only occasionally):

Flet version (pip show flet):

Name: flet
Version: 0.6.0.dev1309
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page: 
Author: Appveyor Systems Inc.
Author-email: hello@flet.dev
License: Apache-2.0
Location: /opt/homebrew/lib/python3.11/site-packages
Requires: flet-core, httpx, oauthlib, packaging, watchdog, websocket-client, websockets
Required-by: 

Operating system:

Tested on MacOS and Windows

Additional environment details:
Python 3.11

@FeodorFitsner FeodorFitsner added the bug Something isn't working label Apr 23, 2023
@FeodorFitsner
Copy link
Contributor

Will take a look.

Could be related to #1236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants