deluge.ui.console.modes package
Subpackages
- deluge.ui.console.modes.preferences package
- deluge.ui.console.modes.torrentlist package
- Submodules
- deluge.ui.console.modes.torrentlist.add_torrents_popup module
- deluge.ui.console.modes.torrentlist.filtersidebar module
- deluge.ui.console.modes.torrentlist.queue_mode module
- deluge.ui.console.modes.torrentlist.search_mode module
- deluge.ui.console.modes.torrentlist.torrentactions module
- deluge.ui.console.modes.torrentlist.torrentlist module
- deluge.ui.console.modes.torrentlist.torrentview module
- deluge.ui.console.modes.torrentlist.torrentviewcolumns module
- Module contents
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(parent_mode, stdscr, console_config, encoding=None)
Bases:
deluge.ui.console.modes.basemode.BaseMode
- back_to_overview()
- on_resize(rows, cols)
- read_input()
- refresh(lines=None)
Refreshes the screen. Updates the lines based on the`:attr:lines` based on the :attr:display_lines_offset attribute and the status bars.
- scroll_list_down(distance)
- scroll_list_up(distance)
- set_popup(pu)
- start()
- update()
deluge.ui.console.modes.basemode module
- class deluge.ui.console.modes.basemode.BaseMode(stdscr, encoding=None, do_refresh=True, mode_name=None, depend=None)
Bases:
deluge.ui.console.modes.basemode.CursesStdIO
,deluge.component.Component
- __init__(stdscr, encoding=None, do_refresh=True, mode_name=None, depend=None)
A mode that provides a curses screen designed to run as a reader in a twisted reactor. This mode doesn’t do much, just shows status bars and “Base Mode” on the screen
Modes should subclass this and provide overrides for:
do_read(self) - Handle user input refresh(self) - draw the mode to the screen add_string(self, row, string) - add a string of text to be displayed. see method for detailed info
The init method of a subclass must call BaseMode.__init__
Useful fields after calling BaseMode.__init__: self.stdscr - the curses screen self.rows - # of rows on the curses screen self.cols - # of cols on the curses screen self.topbar - top statusbar self.bottombar - bottom statusbar
- add_string(row, string, scr=None, **kwargs)
- 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(top_row=0, bottom_row=- 1, topbar=None, bottombar=None, bottombar_help=True, scr=None)
- mode_paused()
- on_resize(rows, cols)
- pause()
- 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.
- resume()
- set_popup(popup)
- class deluge.ui.console.modes.basemode.CursesStdIO
Bases:
object
- fake fd to be registered as a reader with the twisted reactor.
Curses classes needing input should extend this
- doRead()
called when input is ready
- fileno()
We want to select on FD 0
- logPrefix()
- class deluge.ui.console.modes.basemode.InputKeyHandler
Bases:
object
- get_input_result()
- handle_read(c)
Handle a character read from curses screen
- Returns
int – One of the constants defined in util.curses_util.ReadState. ReadState.IGNORED: The key was not handled. Further processing should continue. ReadState.READ: The key was read and processed. Do no further processing ReadState.CHANGED: The key was read and processed. Internal state was changed leaving data to be read by the caller.
- set_input_result(result)
- class deluge.ui.console.modes.basemode.TermResizeHandler
Bases:
object
- static get_window_size(fd=0)
Return the tty window size as row, col.
- Return type
Tuple
[int
,int
]
- on_resize(_signum, _frame)
Handler for SIGWINCH when terminal changes size
- deluge.ui.console.modes.basemode.add_string(row, fstring, screen, encoding, col=0, pad=True, pad_char=' ', trim='..', leaveok=0)
Adds a string to the desired :param:row.
- Parameters
row (int) – the row number to write the string
row – the row number to write the string
fstring (str) – the (formatted) 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!”
- Returns
int – the next row
- deluge.ui.console.modes.basemode.mkpad(color, rows, cols)
- deluge.ui.console.modes.basemode.mkpanel(color, rows, cols, tly, tlx)
- deluge.ui.console.modes.basemode.mkwin(color, rows, cols, tly, tlx)
- deluge.ui.console.modes.basemode.move_cursor(screen, row, col)
deluge.ui.console.modes.cmdline module
- class deluge.ui.console.modes.cmdline.CmdLine(stdscr, encoding=None)
Bases:
deluge.ui.console.modes.basemode.BaseMode
,deluge.ui.console.cmdline.command.Commander
- 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
- on_resize(rows, cols)
- pause()
- 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.
- resume()
- 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, path_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.cmdline.commonprefix(m)
Returns the longest common leading component from list of pathnames.
- deluge.ui.console.modes.cmdline.complete_line(line, possible_matches)
Find the common prefix of possible matches.
Proritizing matching-case elements.
deluge.ui.console.modes.connectionmanager module
- class deluge.ui.console.modes.connectionmanager.ConnectionManager(stdscr, encoding=None)
Bases:
deluge.ui.console.modes.basemode.BaseMode
,deluge.ui.console.widgets.popup.PopupsHandler
- add_host(hostname, port, username, password)
- add_popup()
- delete_host(host_id)
- on_resize(rows, cols)
- pause()
- 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.
- resume()
- start()
- update()
- update_hosts_status()
- update_select_host_popup()
deluge.ui.console.modes.eventview module
deluge.ui.console.modes.torrentdetail module
- class deluge.ui.console.modes.torrentdetail.TorrentDetail(parent_mode, stdscr, console_config, encoding=None)
Bases:
deluge.ui.console.modes.basemode.BaseMode
,deluge.ui.console.widgets.popup.PopupsHandler
- back_to_overview()
- build_file_list(torrent_files, progress, priority)
Split file list from torrent state into a directory tree.
- Returns
Tuple –
- A list of lists in the form:
[file/dir_name, index, size, children, expanded, progress, priority]
- Dictionary:
Map of file index for fast updating of progress and priorities.
- build_prio_list(files, ret_list, parent_prio, selected_prio)
- do_priority(priority, 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(rows, cols)
- pause()
- read_input()
- refresh(lines=None)
Refreshes the screen. Updates the lines based on the`:attr:lines` based on the :attr:display_lines_offset attribute and the status bars.
- render_header(row)
- set_state(state)
- set_torrent_id(torrentid)
- show_priority_popup(was_empty)
- start()
- update(torrentid=None)