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

Filechooser overlapping text on scroll with screens #6742

Closed
kumarvaradarajulu opened this issue Feb 20, 2020 · 5 comments
Closed

Filechooser overlapping text on scroll with screens #6742

kumarvaradarajulu opened this issue Feb 20, 2020 · 5 comments

Comments

@kumarvaradarajulu
Copy link

Versions

  • Python: 3.7
  • OS: Windows 10
  • Kivy: 1.11.1
  • Kivy installation method: pip

Description

FileChooser overlaps text on scrolling through files list. Looks like the 1st content stays and on scroll the content of scrolled data is getting displayed on top of 1st content.

Code and Logs

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.uix.popup import Popup
from kivy.properties import ObjectProperty, BoundedNumericProperty, StringProperty
from kivy.lang import Builder

class FirstWindow(Screen):
    def show_load(self):
        content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
        self._popup = Popup(title="Load file", content=content,
                            size_hint=(0.9, 0.9))
        self._popup.open()

    def dismiss_popup(self):
        self._popup.dismiss()

    def cancel(self):
        pass

    def load(path, selection):
        print(path, selection)

class LoadDialog(FloatLayout):
    load = ObjectProperty(None)
    cancel = ObjectProperty(None)

class EditorApp(App):
    def build(self):
        kv = Builder.load_file("editor.kv")
        self.screen_manager = ScreenManager()

        screen = FirstWindow(name="first")
        self.screen_manager.add_widget(screen)
        self.screen_manager.current = "first"

        return self.screen_manager

if __name__ == "__main__":
    editor_app = EditorApp()
    editor_app.run()

KV File

<FirstWindow>:
  BoxLayout:
    orientation: "vertical"
    Button:
      text: "Select Folder"
      on_release: root.show_load()

<LoadDialog>:
  BoxLayout:
    size: root.size
    pos: root.pos
    orientation: "vertical"
    FileChooserListView:
      id: filechooser

    BoxLayout:
      size_hint_y: None
      height: 30
      Button:
        text: "Cancel"
        on_release: root.cancel()

      Button:
        text: "Load"
        on_release: root.load(filechooser.path, filechooser.selection)

Screenshots
image

@kumarvaradarajulu
Copy link
Author

Can someone please acknowledge this?

@matham
Copy link
Member

matham commented Feb 25, 2020

I could not reproduce it on my system. Perhaps something is strange with your dpi/resolution?

In any case, filechooser is a pretty old widget in serious need of overhaul. May I suggest plyer's native file chooser? I switched to it recently and it was much better, given it's using the OS's built in file browser.

@kumarvaradarajulu
Copy link
Author

Thanks Matham will give plyer a try.

@kumarvaradarajulu
Copy link
Author

Matham's solution was much more elegant and works perfectly, hence closing this issue

@MFA-X-AI
Copy link

If someone is still searching for this in the future - the bug comes from loading your kv file twice using Builder.load_file and name convention. Remember that kivy also automatically searches for a kv file based on your app name, ie if you name it EditorApp, kivy will search for editor.kv.

To fix this simply rename your kv file into something else or remove the Builder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants