Right now, selecting the file opens the very root directory as the default location, but I want it to skip this and open the default internal storage (sdcard), and the user can go down.
this is my debugged code so far Class:
class LoadDialog(FloatLayout): load = ObjectProperty(None) cancel = ObjectProperty(None)
Definition in kv file
<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)
Actual download code:
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 load(self, path, filename): wimg = os.path.join(path, filename[0]) self.image_source = wimg self.dismiss_popup()
Thus, basically the user does not need to go up 1 directory to get to the SD card, it should already be. In the worst case scenario, the filter will filter all other folders except those containing the word sdcard.
source share