Exemple #1
0
    def open_folder(self, folder=None):
        if self.net_hand.is_connected:
            self.back.config(state='disabled')
        else:
            self.back.config(state='normal')
        location = ""
        if folder:
            location = folder
        else:
            location = filedialog.askdirectory()

        if location != "":
            #clear text and delete current radio buttons

            self.workspace.open_directory(location)

            # clear text and delete current radio buttons
            self.code.text.delete("1.0", END)

            # folder = os.listdir(location)
            # for item in folder:
            #     item_path = location+ "/" + item
            #     # condition so that folders that start with "." are not displayed
            #     if os.path.isfile(item_path) or not item.startswith("."):
            #         Radiobutton(self.radio_frame, text = item, variable=self.current_file_name, command=self.open_item, value=item_path, indicator=0).pack(fill = 'x', ipady = 0)
            split = str(location).split("/")
            index = -1
            folder_name = split[index]
            while folder_name == "":
                index -= 1
                folder_name = split[index]
            self.directory.config(text="Current Folder:\n" + folder_name)
            # clear text and delete current radio buttons
            self.code.text.delete("1.0", END)
            self.radio_frame.destroy()
            self.radio_frame = Frame(self.files,
                                     width=self.files.cget("width"))
            self.radio_frame.pack(fill="both", expand=True)
            self.options = FilesFrame(self.radio_frame, window=self)
            self.options.populate(self.workspace)
            self.reset_terminal()