Exemple #1
0
            def finish_up(status):
                status = map(lambda x: x[1], status)

                if len(ids) == 1:
                    rem_msg = "{!info!}Removing the following torrent:{!input!}"
                else:
                    rem_msg = "{!info!}Removing the following torrents:{!input!}"

                for i, (name, state) in enumerate(status):
                    color = colors.state_color[state]
                    rem_msg += "\n %s* {!input!}%s" % (color, name)
                    if i == 5:
                        if i < len(status):
                            rem_msg += "\n  {!red!}And %i more" % (
                                len(status) - 5)
                        break

                popup = InputPopup(mode,
                                   "(Esc to cancel, Enter to remove)",
                                   close_cb=do_remove)
                popup.add_text(rem_msg)
                popup.add_spaces(1)
                popup.add_select_input("{!info!}Torrent files:",
                                       'remove_files', ["Keep", "Remove"],
                                       [False, True], False)
                mode.set_popup(popup)
Exemple #2
0
            def finish_up(status):
                status = map(lambda x: x[1], status)

                if len(ids) == 1:
                    rem_msg = "{!info!}Removing the following torrent:{!input!}"
                else:
                    rem_msg = "{!info!}Removing the following torrents:{!input!}"

                for i, (name, state) in enumerate(status):
                    color = colors.state_color[state]
                    rem_msg += "\n %s* {!input!}%s" % (color, name)
                    if i == 5:
                        if i < len(status):
                            rem_msg += "\n  {!red!}And %i more" % (len(status) - 5)
                        break

                popup = InputPopup(mode, "(Esc to cancel, Enter to remove)", close_cb=do_remove)
                popup.add_text(rem_msg)
                popup.add_spaces(1)
                popup.add_select_input("{!info!}Torrent files:", 'remove_files', ["Keep", "Remove"], [False, True], False)
                mode.set_popup(popup)
Exemple #3
0
    def _show_rename_popup(self):
        #Perhaps in the future: Renaming multiple files
        if self.marked:
            title = "Error (Enter to close)"
            text = "Sorry, you can't rename multiple files, please clear selection with {!info!}'c'{!normal!} key"
            self.popup = MessagePopup(self, title, text)
        else:
            _file = self.__get_file_by_num(self.current_file_idx,
                                           self.file_list)
            old_filename = _file[0]

            idx = self._selection_to_file_idx()
            tid = self.torrentid

            if _file[3]:

                def do_rename(result):
                    if not result["new_foldername"]:
                        return
                    old_fname = self._get_full_folder_path(
                        self.current_file_idx)
                    new_fname = "%s/%s/" % (old_fname.strip("/").rpartition(
                        "/")[0], result["new_foldername"])
                    self._do_rename_folder(tid, old_fname, new_fname)

                popup = InputPopup(self,
                                   "Rename folder (Esc to cancel)",
                                   close_cb=do_rename)
                popup.add_text("{!info!}Renaming folder:{!input!}")
                popup.add_text(" * %s\n" % old_filename)
                popup.add_text_input("Enter new folder name:",
                                     "new_foldername", old_filename.strip("/"))

                self.popup = popup
            else:

                def do_rename(result):
                    fname = "%s/%s" % (self.full_names[idx].rpartition("/")[0],
                                       result["new_filename"])
                    self._do_rename_file(tid, idx, fname)

                popup = InputPopup(self,
                                   "Rename file (Esc to cancel)",
                                   close_cb=do_rename)
                popup.add_text("{!info!}Renaming file:{!input!}")
                popup.add_text(" * %s\n" % old_filename)
                popup.add_text_input("Enter new filename:", "new_filename",
                                     old_filename)

                self.popup = popup
Exemple #4
0
    def _show_rename_popup(self):
        #Perhaps in the future: Renaming multiple files
        if self.marked:
            title = "Error (Enter to close)"
            text = "Sorry, you can't rename multiple files, please clear selection with {!info!}'c'{!normal!} key"
            self.popup = MessagePopup(self, title, text)
        else:
            _file = self.__get_file_by_num(self.current_file_idx, self.file_list)
            old_filename = _file[0]

            idx = self._selection_to_file_idx()
            tid = self.torrentid

            if _file[3]:

                def do_rename(result):
                    if not result["new_foldername"]:
                        return
                    old_fname = self._get_full_folder_path(self.current_file_idx)
                    new_fname = "%s/%s/" % (old_fname.strip("/").rpartition("/")[0], result["new_foldername"])
                    self._do_rename_folder(tid, old_fname, new_fname)

                popup = InputPopup(self,"Rename folder (Esc to cancel)",close_cb=do_rename)
                popup.add_text("{!info!}Renaming folder:{!input!}")
                popup.add_text(" * %s\n" % old_filename)
                popup.add_text_input("Enter new folder name:", "new_foldername", old_filename.strip("/"))

                self.popup = popup
            else:

                def do_rename(result):
                    fname = "%s/%s" % (self.full_names[idx].rpartition("/")[0], result["new_filename"])
                    self._do_rename_file(tid, idx, fname)

                popup = InputPopup(self,"Rename file (Esc to cancel)",close_cb=do_rename)
                popup.add_text("{!info!}Renaming file:{!input!}")
                popup.add_text(" * %s\n" % old_filename)
                popup.add_text_input("Enter new filename:", "new_filename", old_filename)

                self.popup = popup