From 35be32378fe2326f354a21b06ec1cfab48e7feae Mon Sep 17 00:00:00 2001 From: akshayaurora Date: Fri, 25 Jul 2014 03:36:54 +0530 Subject: [PATCH] uix:FileChooser fix multiselect behavior consistent, honor dirselect. --- kivy/uix/filechooser.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/kivy/uix/filechooser.py b/kivy/uix/filechooser.py index 3160114c2..7242f1453 100644 --- a/kivy/uix/filechooser.py +++ b/kivy/uix/filechooser.py @@ -435,20 +435,27 @@ class FileChooserController(FloatLayout): 'button' in touch.profile and touch.button in ( 'scrollup', 'scrolldown', 'scrollleft', 'scrollright')): return False + + _dir = self.file_system.is_dir(entry.path) + dirselect = self.dirselect + + if _dir and dirselect and touch.is_double_tap: + self.open_entry(entry) + return + if self.multiselect: - if self.file_system.is_dir(entry.path) and touch.is_double_tap: - self.open_entry(entry) + if entry.path in self.selection: + self.selection.remove(entry.path) else: - if entry.path in self.selection: - self.selection.remove(entry.path) - else: - self.selection.append(entry.path) + if _dir and not self.dirselect: + self.open_entry(entry) + return + self.selection.append(entry.path) else: - if self.file_system.is_dir(entry.path): - if self.dirselect: - self.selection = [entry.path, ] - else: - self.selection = [entry.path, ] + if _dir and not self.dirselect: + self.open_entry + return + self.selection = [entry.path, ] def entry_released(self, entry, touch): '''(internal) This method must be called by the template when an entry