kivy-garden / filebrowser

An advanced kivy file browser.
MIT License
14 stars 2 forks source link

Selecting items in the LinkTree does not populate the selection #3

Closed rayzorben closed 5 years ago

rayzorben commented 7 years ago

On the LinkTree with the Favorites, Libraries, and Drives when you select one of these, it successfully navigates to it in the FileChooser, but it does not set it as a selection.

I think most of the time this is used to select Files so that will never be an issue, but when you select Directories only, the items in the LinkTree are valid selections, for example the E: drive. However, there is no way from the FileChooser to select the E: drive itself.

  FileBrowser:
        id: browser
        size_hint_x: 0.75
        dirselect: True
        filters: [root.is_dir]
        select_string: 'Add Library'
        cancel_string: 'Close'
        on_success: root.add_library(browser.selection)
        on_canceled: root.dispatch('on_close')
radiolondra commented 4 years ago
self.browser = FileBrowser(select_string='Select',
                                   cancel_state='down',
                                   ...)
...
link_tree = self.browser.ids.link_tree
link_tree.bind(on_touch_up=self.treetouch)

def treetouch(self, touch, mm):
        self.browser.ids.file_text.text = self.browser.ids.list_view.path
...

this should work