Example #1
0
    def _setup_file_tree(self):
        self.file_tree_frame = Frame(self.content)
        self.file_tree_frame.grid(column=0, row=0, sticky=(N, S, E, W))

        self.file_tree = FileView(self.file_tree_frame, normalizer=self.filename_normalizer)
        self.file_tree.grid(column=0, row=0, sticky=(N, S, E, W))

        # # The tree's vertical scrollbar
        self.file_tree_scrollbar = Scrollbar(self.file_tree_frame, orient=VERTICAL)
        self.file_tree_scrollbar.grid(column=1, row=0, sticky=(N, S))

        # # Tie the scrollbar to the text views, and the text views
        # # to each other.
        self.file_tree.config(yscrollcommand=self.file_tree_scrollbar.set)
        self.file_tree_scrollbar.config(command=self.file_tree.yview)

        # Setup weights for the "file_tree" tree
        self.file_tree_frame.columnconfigure(0, weight=1)
        self.file_tree_frame.columnconfigure(1, weight=0)
        self.file_tree_frame.rowconfigure(0, weight=1)

        # Handlers for GUI events
        self.file_tree.bind('<<TreeviewSelect>>', self.on_file_selected)

        self.content.add(self.file_tree_frame)