Ejemplo n.º 1
0
def askdirectories(initialdir, title="Séléctionner", **options):
    """ folder selector:
        initialdir: directory where the filebrowser is opened
    """
    if tkfb:
        return tkfb.askopendirnames(title=title,
                                    initialdir=initialdir,
                                    **options)
    elif ZENITY:
        try:
            args = [
                "zenity", "--file-selection", "--filename", initialdir,
                "--directory", "--multiple", "--title", title
            ]
            folder = check_output(args).decode("utf-8").strip()
            return folder.split('|')
        except CalledProcessError:
            return ""
        except Exception:
            return filedialog.askdirectory(title=title,
                                           initialdir=initialdir,
                                           **options)
    else:
        return filedialog.askdirectory(title=title,
                                       initialdir=initialdir,
                                       **options)
Ejemplo n.º 2
0
 def select_folders(self):
     self.directories = askopendirnames(
         parent=root,
         title='Select folder(s)',
         initialdir='/home/jpereira/Downloads/Mariana'
     )  # Change to current working directory
     self.load_data()
Ejemplo n.º 3
0
def c_open_dir():
    dirnames = askopendirnames(parent=root, initialdir='/', initialfile='tmp')
    if dirnames:
        for dir_name in dirnames:
            error = ic.upload_folder(dir_name)
            if error:
                print("Error:", error)
    print("finished")
Ejemplo n.º 4
0
def select_dir_path():
    win_user_desktop = os.path.join(os.path.expanduser('~'), 'Desktop')
    dir_path_selected.append(
        tkfilebrowser.askopendirnames(title='选择照片文件夹',
                                      initialdir=win_user_desktop,
                                      okbuttontext='打开',
                                      cancelbuttontext='取消'))

    transform_dir_path_selected_ls = list_to_list(dir_path_selected)

    print('选中文件夹:', transform_dir_path_selected_ls,
          type(transform_dir_path_selected_ls))
    dir_path.set(transform_dir_path_selected_ls)

    # 选中文件夹为一个列表(列表元素为每次选择的元组),需要将其转换为字符串,再更新到配置文件
    transform_dir_path_selected_str = list_to_str(dir_path_selected)

    update_config_file('img_dir_name_list', transform_dir_path_selected_str)
Ejemplo n.º 5
0
    def select_directories(self):
        from tkfilebrowser import askopendirnames
        from tkinter import Tk
        # Create Tk root
        root = Tk()
        # Hide the main window
        root.withdraw()
        # Raise the root to the top of all windows.
        root.call('wm', 'attributes', '.', '-topmost', True)
        # List of selected fileswill be set to self.value
        self.directories = askopendirnames(initialdir=self.initialdir)

        if len(self.directories) > 0:
            self.description = "Directory Selected"
            self.icon = "check-square-o"
            self.style.button_color = "lightgreen"
            self.value = True
        else:
            self.value = False
Ejemplo n.º 6
0
def unlockDir():
    global recognizedflag
    from VFR_GUI_recognizer import recognizedFace

    recognizedflag = recognizedFace()
    if recognizedflag == 1:
        names = askopendirnames(initialdir=(
            "/home/pragyan/Documents/Facial recognition main project/FFRec-GUI_edit/"
        ),
                                okbuttontext=("Unlock"),
                                title=("Choose directory"),
                                filetypes=(("HTML files", "*.html;*.htm"),
                                           ("All files", "*.*")))
        for name in names:
            print name
            hiddenname = os.path.split(name)
            hiddenname2 = hiddenname[1].split(".")
            os.rename(name, hiddenname[0] + "/" + hiddenname2[1])
    else:
        tkMessageBox.showwarning("Unidentified face!", "A snapshot was taken!")
Ejemplo n.º 7
0
def c_open():
    rep = askopendirnames(parent=root)
    print(rep)
Ejemplo n.º 8
0
def ask_directories():
    root = create_root()
    directories = askopendirnames()
    root.destroy()
    return directories
Ejemplo n.º 9
0
def askDirs():
    dirs = tkfilebrowser.askopendirnames(title="Select Flight Data", foldercreation=False)
    return(dirs)