コード例 #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)
コード例 #2
0
ファイル: torrent_actions.py プロジェクト: Ashod/Deluge
            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)