aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/model/youload_file_chooser.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/model/youload_file_chooser.py b/src/model/youload_file_chooser.py
index 80bded2..3f4af66 100644
--- a/src/model/youload_file_chooser.py
+++ b/src/model/youload_file_chooser.py
@@ -2,7 +2,9 @@ from kivy.uix.popup import Popup
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.filechooser import FileChooserListView
+from kivy.uix.textinput import TextInput
from pathlib import Path
+import os
class YouloadFileChooser(Popup):
@@ -13,18 +15,32 @@ class YouloadFileChooser(Popup):
self.title = "Find folder"
+ self.dirselect = True
+
+ # Path input.
+ self.path_input = TextInput(text=str(Path.home()), multiline=False, size_hint=(0.9, 1.0))
+ self.path_input.bind(text=self.uid_path_input)
+
# Close button.
- close_button = Button(text="Close", size_hint=(1.0, 0.1))
+ close_button = Button(text="Close", size_hint=(0.1, 1.0))
close_button.bind(on_press=self.close_button_cb)
+ top_bar_layout = BoxLayout(size_hint=(1.0, 0.1))
+ top_bar_layout.add_widget(self.path_input)
+ top_bar_layout.add_widget(close_button)
+
# File chooser.
- self.file_chooser = FileChooserListView(size_hint=(1.0, 0.8))
- self.file_chooser.rootpath = str(Path.home())
+ self.file_chooser = FileChooserListView(size_hint=(1.0, 0.9))
+ self.file_chooser.path = str(Path.home())
- layout.add_widget(close_button)
+ layout.add_widget(top_bar_layout)
layout.add_widget(self.file_chooser)
self.add_widget(layout)
def close_button_cb(self, instance):
self.parent.remove_widget(self)
+ def uid_path_input(self, instance, value):
+ if os.path.exists(value):
+ self.file_chooser.path = value
+