import logging import kivy.app from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from kivy.uix.label import Label from kivy.uix.splitter import Splitter from kivy.uix.textinput import TextInput from kivy.uix.treeview import TreeView from kivy.uix.widget import Widget # +----------------------------------------------------+ # | +--------------+ +-----------+ +-----------+ | # | Path | | | Selct Btn | | Search | | # | +--------------+ +-----------+ +-----------+ | # | +------------------------------------------------+ | # | | Tree View | | # | | root | progress bar | |dedup btn| | | # | | + layer 1 | progress bar | |dedup btn| | | # | | | + layer 2 | progress bar | |dedup btn| | | # | | ..... | | # | | + layer N | progress bar | |dedup btn| | | # | +------------------------------------------------+ | # | +------------------------------------------------+ | # | | | | # | +------------------------------------------------+ | # +----------------------------------------------------+ LOG = logging.getLogger(__name__) class theApp(BoxLayout): def __init__(self, **kwargs): # force the widget into horizontal boxing so everything goes top-down kwargs["orientation"] = "horizontal" super(theApp, self).__init__(**kwargs) self.selected_directory = "" # path layout will use vertical boxing so everything goes left to right self.path_layout = BoxLayout(orientation='vertical') # [Path] label self.lbl_path = Label(text="Path") self.path_layout.add_widget(self.lbl_path) # Path input box - we'll let the user type it in self.txt_path = TextInput(text=self.selected_directory) # probably should add something to validate the text # and enable/disable the buttons based on the result self.path_layout.add_widget(self.txt_path) # Select button to pop-up the File/Direction Selection dialog self.btn_select_path = Button(text="Select...") self.btn_select_path.bind(self.select_path) self.path_layout.add_widget(self.btn_select_path) # Generate button to be used once the user has selected # entries in the tree view that is displaying the file system layout self.btn_generate_plan = Button(text="Generate Plan") self.btn_generate_plan.bind(self.generate_plan) self.path_layout.add_widget(self.btn_generate_plan) # splitter to be able to resize stuff self.splitter_path = Splitter(sizable_from="top") self.splitter_path.add_widget(self.path_layout) # tree view for the file system view self.filesystem_viewer = TreeView() self.add_widget(self.splitter_path) def select_path(self, btn, btn_state): pass def generate_plan(self, btn, btn_state): pass class App(kivy.app.App): def build(self): return theApp()