deluge.ui.console.modes package¶
Submodules¶
deluge.ui.console.modes.add_util module¶
- deluge.ui.console.modes.add_util.add_torrent(t_file, options, success_cb, fail_cb, ress)¶
deluge.ui.console.modes.addtorrents module¶
- class deluge.ui.console.modes.addtorrents.AddTorrents(alltorrentmode, stdscr, console_config, encoding=None)¶
Bases: deluge.ui.console.modes.basemode.BaseMode, deluge.component.Component
- back_to_overview()¶
- on_resize(*args)¶
- read_input()¶
- refresh(lines=None)¶
- scroll_list_down(distance)¶
- scroll_list_up(distance)¶
- set_popup(pu)¶
- start()¶
- update()¶
deluge.ui.console.modes.alltorrents module¶
- class deluge.ui.console.modes.alltorrents.AllTorrents(stdscr, encoding=None)¶
Bases: deluge.ui.console.modes.basemode.BaseMode, deluge.component.Component
- clear_marks()¶
- current_torrent_id()¶
- get_torrent_name(torrent_id)¶
- on_resize(*args)¶
- read_input()¶
- refresh(lines=None)¶
- report_message(title, message)¶
- resume()¶
- set_popup(pu)¶
- set_state(state, refresh)¶
- show_addtorrents_screen()¶
- show_preferences()¶
- show_torrent_details(tid)¶
- start()¶
- update()¶
- update_config()¶
deluge.ui.console.modes.basemode module¶
- class deluge.ui.console.modes.basemode.BaseMode(stdscr, encoding=None, do_refresh=True)¶
Bases: deluge.ui.console.modes.basemode.CursesStdIO
- add_string(row, string, scr=None, col=0, pad=True, trim=True)¶
Adds a string to the desired :param:row.
Parameters: - row – int, the row number to write the string
- string – string, the string of text to add
- scr – curses.window, optional window to add string to instead of self.stdscr
- col – int, optional starting column offset
- pad – bool, optional bool if the string should be padded out to the width of the screen
- trim – bool, optional bool if the string should be trimmed if it is too wide for the screen
The text can be formatted with color using the following format:
“{!fg, bg, attributes, ...!}”
See: http://docs.python.org/library/curses.html#constants for attributes.
Alternatively, it can use some built-in scheme for coloring. See colors.py for built-in schemes.
“{!scheme!}”
Examples:
“{!blue, black, bold!}My Text is {!white, black!}cool” “{!info!}I am some info text!” “{!error!}Uh oh!”
- clear_marks()¶
- close()¶
Clean up the curses stuff on exit.
- connectionLost(reason)¶
- doRead()¶
Called when there is data to be read, ie, input from the keyboard.
- draw_statusbars()¶
- on_resize(*args)¶
- on_resize_norefresh(*args)¶
- read_input()¶
- refresh()¶
Refreshes the screen. Updates the lines based on the`:attr:lines` based on the :attr:display_lines_offset attribute and the status bars.
- report_message()¶
- set_popup(popup)¶
deluge.ui.console.modes.column module¶
- deluge.ui.console.modes.column.format_queue(qnum)¶
- deluge.ui.console.modes.column.get_column_value(name, state)¶
- deluge.ui.console.modes.column.get_required_fields(cols)¶
deluge.ui.console.modes.connectionmanager module¶
A mode that show’s a popup to select which host to connect to
deluge.ui.console.modes.eventview module¶
deluge.ui.console.modes.format_utils module¶
- deluge.ui.console.modes.format_utils.format_column(col, lim)¶
- deluge.ui.console.modes.format_utils.format_date(time)¶
- deluge.ui.console.modes.format_utils.format_date_never(time)¶
- deluge.ui.console.modes.format_utils.format_float(x)¶
- deluge.ui.console.modes.format_utils.format_pieces(num, size)¶
- deluge.ui.console.modes.format_utils.format_priority(prio)¶
- deluge.ui.console.modes.format_utils.format_progress(perc)¶
- deluge.ui.console.modes.format_utils.format_row(row, column_widths)¶
- deluge.ui.console.modes.format_utils.format_seeds_peers(num, total)¶
- deluge.ui.console.modes.format_utils.format_speed(speed)¶
- deluge.ui.console.modes.format_utils.format_time(time)¶
- deluge.ui.console.modes.format_utils.pad_string(string, length, character=' ', side='right')¶
Pad string with specified character to desired length, considering double width characters.
- deluge.ui.console.modes.format_utils.remove_formatting(string)¶
- deluge.ui.console.modes.format_utils.strwidth(string)¶
Measure width of a string considering asian double width characters
- deluge.ui.console.modes.format_utils.trim_string(string, w, have_dbls)¶
- deluge.ui.console.modes.format_utils.wrap_string(string, width, min_lines=0, strip_colors=True)¶
Wrap a string to fit in a particular width. Returns a list of output lines.
Parameters: - string – str, the string to wrap
- width – int, the maximum width of a line of text
- min_lines – int, extra lines will be added so the output tuple contains at least min_lines lines
- strip_colors – boolean, if True, text in {!!} blocks will not be considered as adding to the width of the line. They will still be present in the output.
deluge.ui.console.modes.input_popup module¶
- class deluge.ui.console.modes.input_popup.CheckedInput(parent, message, name, checked=False, additional_formatting=False)¶
Bases: deluge.ui.console.modes.input_popup.InputField
- get_height()¶
- get_value()¶
- handle_read(c)¶
- render(screen, row, width, active, col=1)¶
- set_value(c)¶
- class deluge.ui.console.modes.input_popup.CheckedPlusInput(parent, message, name, child, checked=False, additional_formatting=False)¶
Bases: deluge.ui.console.modes.input_popup.InputField
- get_child()¶
- get_height()¶
- get_value()¶
- handle_read(c)¶
- render(screen, row, width, active, col=1)¶
- set_value(c)¶
- class deluge.ui.console.modes.input_popup.FloatSpinInput(parent, message, name, move_func, value, inc_amt, precision, min_val=None, max_val=None, additional_formatting=False)¶
Bases: deluge.ui.console.modes.input_popup.InputField
- get_height()¶
- get_value()¶
- handle_read(c)¶
- render(screen, row, width, active, col=1, cursor_offset=0)¶
- set_value(val)¶
- class deluge.ui.console.modes.input_popup.InputField¶
- depend = None¶
- depend_skip()¶
- get_height()¶
- get_value()¶
- handle_read(c)¶
- render(screen, row, width, selected, col=1)¶
- set_depend(i, inverse=False)¶
- set_value(value)¶
- class deluge.ui.console.modes.input_popup.InputPopup(parent_mode, title, width_req=0, height_req=0, align=5, close_cb=None, additional_formatting=True, immediate_action=False)¶
Bases: deluge.ui.console.modes.popup.Popup
- add_checked_input(message, name, checked=False)¶
- add_float_spin_input(message, name, value=0.0, inc_amt=1.0, precision=1, min_val=None, max_val=None)¶
- add_int_spin_input(message, name, value=0, min_val=None, max_val=None)¶
- add_select_input(message, name, opts, vals, default_index=0)¶
- add_spaces(num)¶
- add_string(row, string, scr=None, col=0, pad=True, trim=True)¶
- add_text(string)¶
- add_text_input(message, name, value='', complete=True)¶
Add a text input field to the popup.
Parameters: - message – string to display above the input field
- name – name of the field, for the return callback
- value – initial value of the field
- complete – should completion be run when tab is hit and this field is active
- getmaxyx()¶
- handle_read(c)¶
- move(r, c)¶
- class deluge.ui.console.modes.input_popup.IntSpinInput(parent, message, name, move_func, value, min_val=None, max_val=None, additional_formatting=False)¶
Bases: deluge.ui.console.modes.input_popup.InputField
- get_height()¶
- get_value()¶
- handle_read(c)¶
- render(screen, row, width, active, col=1, cursor_offset=0)¶
- set_value(val)¶
- class deluge.ui.console.modes.input_popup.SelectInput(parent, message, name, opts, vals, selidx, additional_formatting=False)¶
Bases: deluge.ui.console.modes.input_popup.InputField
- get_height()¶
- get_value()¶
- handle_read(c)¶
- render(screen, row, width, selected, col=1)¶
- set_value(nv)¶
- class deluge.ui.console.modes.input_popup.TextInput(parent, move_func, width, message, name, value, docmp, additional_formatting=False)¶
Bases: deluge.ui.console.modes.input_popup.InputField
- complete(line)¶
- get_height()¶
- get_value()¶
- handle_read(c)¶
- render(screen, row, width, selected, col=1, cursor_offset=0)¶
- set_value(val)¶
deluge.ui.console.modes.legacy module¶
- class deluge.ui.console.modes.legacy.Legacy(stdscr, encoding=None)¶
Bases: deluge.ui.console.modes.basemode.BaseMode, deluge.component.Component
- add_line(text, refresh=True)¶
Add a line to the screen. This will be showed between the two bars. The text can be formatted with color using the following format:
“{!fg, bg, attributes, ...!}”
See: http://docs.python.org/library/curses.html#constants for attributes.
Alternatively, it can use some built-in scheme for coloring. See colors.py for built-in schemes.
“{!scheme!}”
Examples:
“{!blue, black, bold!}My Text is {!white, black!}cool” “{!info!}I am some info text!” “{!error!}Uh oh!”
Parameters: - text (string) – the text to show
- refresh (bool) – if True, the screen will refresh after the line is added
- add_string(row, string)¶
Adds a string to the desired :param:row.
Parameters: row – int, the row number to write the string
- do_command(cmd)¶
Processes a command.
Parameters: cmd – str, the command string
- get_torrent_name(torrent_id)¶
Gets a torrent name from the torrents list.
Parameters: torrent_id – str, the torrent_id Returns: the name of the torrent or None
- match_torrent(string)¶
Returns a list of torrent_id matches for the string. It will search both torrent_ids and torrent names, but will only return torrent_ids.
Parameters: string – str, the string to match on Returns: list of matching torrent_ids. Will return an empty list if no matches are found.
- on_resize(*args)¶
- on_torrent_added_event(event, from_state=False)¶
- on_torrent_removed_event(event)¶
- read_input()¶
- refresh()¶
Refreshes the screen. Updates the lines based on the`:attr:lines` based on the :attr:display_lines_offset attribute and the status bars.
- set_batch_write(batch)¶
When this is set the screen is not refreshed after a :meth:write until this is set to False.
Parameters: batch (bool) – set True to prevent screen refreshes after a :meth:write
- tab_complete_path(line, type='file', ext='', sort='name', dirs_first=1)¶
- tab_complete_torrent(line)¶
Completes torrent_ids or names.
Parameters: line – str, the string to complete Returns: list of matches
- tab_completer(line, cursor, hits)¶
Called when the user hits ‘tab’ and will autocomplete or show options. If a command is already supplied in the line, this function will call the complete method of the command.
Parameters: - line – str, the current input string
- cursor – int, the cursor position in the line
- second_hit – bool, if this is the second time in a row the tab key has been pressed
Returns: 2-tuple (string, cursor position)
- update()¶
- write(line)¶
Writes a line out
Parameters: line – str, the line to print
- deluge.ui.console.modes.legacy.commonprefix(m)¶
Given a list of pathnames, returns the longest common leading component
- deluge.ui.console.modes.legacy.complete_line(line, possible_matches)¶
Find the common prefix of possible matches, proritizing matching-case elements
deluge.ui.console.modes.popup module¶
- class deluge.ui.console.modes.popup.ALIGN¶
- BOTTOM_CENTER = 8¶
- BOTTOM_LEFT = 7¶
- BOTTOM_RIGHT = 9¶
- DEFAULT = 5¶
- MIDDLE_CENTER = 5¶
- MIDDLE_LEFT = 4¶
- MIDDLE_RIGHT = 6¶
- TOP_CENTER = 2¶
- TOP_LEFT = 1¶
- TOP_RIGHT = 3¶
- class deluge.ui.console.modes.popup.MessagePopup(parent_mode, title, message, align=5, width_req=0.5)¶
Bases: deluge.ui.console.modes.popup.Popup
Popup that just displays a message
- handle_resize()¶
- class deluge.ui.console.modes.popup.Popup(parent_mode, title, width_req=0, height_req=0, align=5, close_cb=None, init_lines=None)¶
- add_divider()¶
- add_line(string)¶
- clear()¶
- handle_read(c)¶
- handle_resize()¶
- refresh()¶
- set_title(title)¶
- class deluge.ui.console.modes.popup.SelectablePopup(parent_mode, title, selection_callback, args=(), align=5, immediate_action=False)¶
Bases: deluge.ui.console.modes.popup.Popup
A popup which will let the user select from some of the lines that are added.
- add_divider(color='white')¶
- add_line(string, selectable=True, use_underline=True, data=None, foreground=None)¶
- current_selection()¶
Returns a tuple of (selected index, selected data)
- handle_read(c)¶
deluge.ui.console.modes.preference_panes module¶
- class deluge.ui.console.modes.preference_panes.BandwidthPane(offset, parent, width)¶
- class deluge.ui.console.modes.preference_panes.BasePane(offset, parent, width)¶
- add_checked_input(name, message, checked)¶
- add_checkedplus_input(name, message, child, checked)¶
- add_config_values(conf_dict)¶
- add_float_spin_input(name, message, value, inc_amt, precision, min_val, max_val)¶
- add_header(header, space_above=False, space_below=False)¶
- add_info_field(label, value, name)¶
- add_int_spin_input(name, message, value, min_val, max_val)¶
- add_select_input(name, msg, opts, vals, selidx)¶
- add_text_input(name, msg, dflt_val)¶
- handle_read(c)¶
- move(r, c)¶
- render(mode, screen, width, active)¶
- update_values(conf_dict)¶
- class deluge.ui.console.modes.preference_panes.CachePane(offset, parent, width)¶
Bases: deluge.ui.console.modes.preference_panes.BasePane
- update_cache_status(status)¶
- class deluge.ui.console.modes.preference_panes.ColumnsPane(offset, parent, width)¶
- class deluge.ui.console.modes.preference_panes.DaemonPane(offset, parent, width)¶
- class deluge.ui.console.modes.preference_panes.DownloadsPane(offset, parent, width)¶
- class deluge.ui.console.modes.preference_panes.Header(parent, header, space_above, space_below)¶
Bases: deluge.ui.console.modes.preference_panes.NoInput
- render(screen, row, width, active, offset)¶
- class deluge.ui.console.modes.preference_panes.InfoField(parent, label, value, name)¶
Bases: deluge.ui.console.modes.preference_panes.NoInput
- render(screen, row, width, active, offset)¶
- set_value(v)¶
- class deluge.ui.console.modes.preference_panes.InterfacePane(offset, parent, width)¶
- class deluge.ui.console.modes.preference_panes.NetworkPane(offset, parent, width)¶
- class deluge.ui.console.modes.preference_panes.OtherPane(offset, parent, width)¶
- class deluge.ui.console.modes.preference_panes.ProxyPane(offset, parent, width)¶
- class deluge.ui.console.modes.preference_panes.QueuePane(offset, parent, width)¶
deluge.ui.console.modes.preferences module¶
deluge.ui.console.modes.torrent_actions module¶
- class deluge.ui.console.modes.torrent_actions.ACTION¶
- DETAILS = 8¶
- EDIT_TRACKERS = 3¶
- MOVE_STORAGE = 9¶
- PAUSE = 0¶
- QUEUE = 10¶
- QUEUE_BOTTOM = 14¶
- QUEUE_DOWN = 13¶
- QUEUE_TOP = 11¶
- QUEUE_UP = 12¶
- REANNOUNCE = 2¶
- RECHECK = 4¶
- REMOVE = 5¶
- REMOVE_DATA = 6¶
- REMOVE_NODATA = 7¶
- RESUME = 1¶
- TORRENT_OPTIONS = 15¶
- deluge.ui.console.modes.torrent_actions.action_error(error, mode)¶
- deluge.ui.console.modes.torrent_actions.torrent_action(idx, data, mode, ids)¶
- deluge.ui.console.modes.torrent_actions.torrent_actions_popup(mode, tids, details=False, action=None)¶
deluge.ui.console.modes.torrentdetail module¶
- class deluge.ui.console.modes.torrentdetail.TorrentDetail(alltorrentmode, torrentid, stdscr, console_config, encoding=None)¶
Bases: deluge.ui.console.modes.basemode.BaseMode, deluge.component.Component
- back_to_overview()¶
- build_file_list(file_tuples, prog, prio)¶
- build_prio_list(files, ret_list, parent_prio, selected_prio)¶
- clear_marks()¶
- do_priority(idx, data, was_empty)¶
- draw_files(files, depth, off, idx)¶
- expcol_cur_file()¶
Expand or collapse current file
- file_list_down(rows=1)¶
- file_list_up(rows=1)¶
- on_resize(*args)¶
- read_input()¶
- refresh(lines=None)¶
- render_header(off)¶
- report_message(title, message)¶
- set_popup(pu)¶
- set_state(state)¶
- show_priority_popup(was_empty)¶
- start()¶
- update()¶