Пример #1
0
 def on_add_folders(self, paths=None):
     if not paths:
         paths = directory_chooser_dialog(_("Choose folders to open"), FC().last_dir)
     if paths:
         def task():
             path = paths[0]
             list = path.split("/")
             FC().last_dir = path[:path.rfind("/")]
             name = list[len(list) - 1]
             parent = FModel(name)
             self.append_to_new_notebook(name, [])
     
             all_beans = []
             all_beans.append(parent)
             for bean in get_all_music_by_paths(paths, self):
                 if not bean.is_file:
                     bean.parent(parent).add_is_file(False)
                 all_beans.append(bean)
     
             if all_beans:
                 self.append_to_current_notebook(all_beans)
             else:
                 self.append([self.SearchCriteriaBeen(_("Nothing found to play in the folder(s)") + paths[0])])
                 
         self.in_thread.run_with_progressbar(task)
Пример #2
0
def copy_to(old_paths):
    destinations = directory_chooser_dialog(_("Choose Folder"), FC().last_dir)
    if not destinations:
        return
    from foobnix.helpers.window import CopyProgressWindow
    pr_window = CopyProgressWindow(_("Progress"), old_paths, 300, 100)
    pr_window.label_to.set_text(_("To: ") + destinations[0] + "\n")
    if destinations:
        for old_path in old_paths:
            if not os.path.exists(old_path):
                logging.warning("File " + old_path + " not exists")
                continue
            pr_window.label_from.set_text(
                _("Copying: ") + os.path.dirname(old_path))

            def task():
                copy_move_with_progressbar(pr_window, old_path,
                                           destinations[0])
                pr_window.response(Gtk.ResponseType.OK)

            t = threading.Thread(target=task)
            t.start()
            if pr_window.run() == Gtk.ResponseType.REJECT:
                pr_window.exit = True
                t.join()
    pr_window.destroy()
Пример #3
0
    def on_add_folders(self, paths=None):
        if not paths:
            paths = directory_chooser_dialog(_("Choose folders to open"),
                                             FC().last_dir)
        if paths:

            def task():
                path = paths[0]
                list = path.split("/")
                FC().last_dir = path[:path.rfind("/")]
                name = list[len(list) - 1]
                parent = FModel(name)
                self.append_to_new_notebook(name, [])

                all_beans = []
                all_beans.append(parent)
                for bean in get_all_music_by_paths(paths, self):
                    if not bean.is_file:
                        bean.parent(parent).add_is_file(False)
                    all_beans.append(bean)

                if all_beans:
                    self.append_to_current_notebook(all_beans)
                else:
                    self.append([
                        self.SearchCriteriaBeen(
                            _("Nothing found to play in the folder(s)") +
                            paths[0])
                    ])

            self.in_thread.run_with_progressbar(task)
Пример #4
0
 def on_add_folders(self, paths=None):
     if not paths:
         paths = directory_chooser_dialog(_("Choose folders to open"), FC().last_dir)
     if paths:
         path = paths[0]
         list = path.split("/")
         FC().last_dir = path[:path.rfind("/")]
         name = list[len(list) - 1]
         parent = FModel(name)
         self.append_to_new_notebook(name, [])
 
         all_beans = []
         all_beans.append(parent)
         for path in paths:
             if path == "/":
                 logging.info("Skip root folder")
                 continue;
             beans = get_all_music_by_path(path)
             
             for bean in beans:
                 if not bean.is_file:
                     bean.parent(parent).add_is_file(False)
                 all_beans.append(bean)
 
         if all_beans:
             self.append_to_current_notebook(all_beans)
         else:
             self.append([self.SearchCriteriaBeen(_("Nothing found to play in the folder(s)") + paths[0])])
Пример #5
0
 def add_dir(self, *a):
     current_folder = FCache().last_music_path if FCache().last_music_path else None
     paths = directory_chooser_dialog(_("Choose directory with music"), current_folder)
     if not paths:
         return
     path = paths[0]
     FCache().last_music_path = path[:path.rfind("/")]
     for path in paths:
         if path not in self.temp_music_paths:
             self.tree_controller.append(FDModel(os.path.basename(path), path).add_is_file(False))
             self.temp_music_paths.append(path)
Пример #6
0
 def add_dir(self, *a):
     current_folder = FCache().last_music_path if FCache().last_music_path else None
     paths = directory_chooser_dialog(_("Choose directory with music"), current_folder)
     if not paths:
         return
     path = paths[0]
     FCache().last_music_path = path[:path.rfind("/")]          
     for path in paths:            
         if path not in self.temp_music_paths:
             self.tree_controller.append(FDModel(os.path.basename(path), path).add_is_file(False))
             self.temp_music_paths.append(path)
Пример #7
0
 def on_add_folders(self, paths=None):
     if not paths:
         paths = directory_chooser_dialog(_("Choose folders to open"), FC().last_dir)
         if not paths:
             return
     tree = self.notetabs.get_current_tree()
     FC().last_dir = os.path.dirname(paths[0])
     if tree.is_empty():
         if len(paths) > 1:
             tabname = os.path.basename(FC().last_dir)
         else:
             tabname = os.path.basename(paths[0])
         self.notetabs.rename_tab(tree.scroll, tabname)
     tree.append(paths)
Пример #8
0
def copy_to(old_paths):
        destinations = directory_chooser_dialog(_("Choose Folder"), FC().last_dir)
        if not destinations:
            return
        from foobnix.helpers.window import CopyProgressWindow
        pr_window = CopyProgressWindow(_("Progress"), old_paths, 300, 100)
        pr_window.label_to.set_text(_("To: ") + destinations[0] + "\n")
        if destinations:
            for old_path in old_paths:
                if not os.path.exists(old_path):
                    logging.warning("File " + old_path + " not exists")
                    continue
                pr_window.label_from.set_text(_("Copying: ") + os.path.dirname(old_path))
                def task():
                    copy_move_with_progressbar(pr_window, old_path, destinations[0])
                    pr_window.response(Gtk.ResponseType.OK)
                t = threading.Thread(target=task)
                t.start()
                if pr_window.run() == Gtk.ResponseType.REJECT:
                    pr_window.exit = True
                    t.join()
        pr_window.destroy()
Пример #9
0
 def append_tasks_with_dialog(self, beans):
     paths = directory_chooser_dialog(_("Choose Folder"), FC().last_dir)
     if paths:
         self.append_tasks(beans, paths[0])
Пример #10
0
 def append_tasks_with_dialog(self, beans):
     paths = directory_chooser_dialog(_("Choose Folder"), FC().last_dir)
     if paths:
         self.append_tasks(beans, paths[0])