Ejemplo n.º 1
0
    def __init__(self, screen):
        super(DemoFrame, self).__init__(
            screen, screen.height, screen.width, has_border=False, name="My Form")

        # Create the (very simple) form layout...
        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)

        # Now populate it with the widgets we want to use.
        self._details = Text()
        self._details.disabled = True
        self._details.custom_colour = "field"
        self._list = FileBrowser(Widget.FILL_FRAME,
                                 os.path.abspath("."),
                                 name="mc_list",
                                 on_select=self.popup,
                                 on_change=self.details)
        layout.add_widget(Label("Local disk browser sample"))
        layout.add_widget(Divider())
        layout.add_widget(self._list)
        layout.add_widget(Divider())
        layout.add_widget(self._details)
        layout.add_widget(Label("Press Enter to select or `q` to quit."))

        # Prepare the Frame for use.
        self.fix()
Ejemplo n.º 2
0
    def __init__(self, screen, controller):
        super(LoadStartListView, self).__init__(screen,
                                          screen.height * 2 // 3,
                                          screen.width * 2 // 3,
                                          hover_focus=True,
                                          title="Load Start List",
                                          reduce_cpu=True)

        self._file_browser = FileBrowser(
            Widget.FILL_FRAME,
            ".",
            name="fileBrowser",
            on_select=self._ok)
        self._ok_button = Button("Ok", self._ok)
        self._cancel_button = Button("Cancel", self._cancel)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(Label("Start list should be in a UTF-8 text file with the format '[number],[competitor name],[category],[team name]"))
        layout.add_widget(Divider())
        layout.add_widget(self._file_browser)
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("OK", self._ok), 0)
        layout2.add_widget(Button("Cancel", self._cancel), 3)
        self._controller = controller
        self.fix()
Ejemplo n.º 3
0
 def add_file_browser(self, path='/', height=15, on_change_fn=None, add_divider=True):
     layout = Layout([100])
     self.add_layout(layout)
     browser = FileBrowser(height, path, on_change=on_change_fn)
     layout.add_widget(browser)
     if add_divider: 
         layout.add_widget(Divider(draw_line=False))
     return lambda: browser._value
Ejemplo n.º 4
0
 def _compose_file_picker_layout(self):
     layout = Layout([1])
     self.add_layout(layout)
     layout.add_widget(
         FileBrowser(
             height=11,
             root=os.getcwd(),
             on_change=self._on_browser_change,
             on_select=self._on_file_selected_in_browser,
             name="file_browser",
         ))
     layout.add_widget(Divider())
    def __init__(self, screen, model):
        super(FileChooseView, self).__init__(screen,
                                             height=screen.height,
                                             width=screen.width,
                                             can_scroll=False,
                                             title='Config file')

        self._model = model
        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)

        self._fileChoose = FileBrowser(Widget.FILL_FRAME,
                                       root='.',
                                       on_select=self._ok)
        layout.add_widget(self._fileChoose)

        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("OK", self._ok), 0)
        layout2.add_widget(Button("Cancel", self._cancel), 3)

        self.fix()