deluge.ui.console package

Subpackages

Submodules

deluge.ui.console.console module

class deluge.ui.console.console.Console(*args, **kwargs)

Bases: deluge.ui.ui.UI

cmd_description = 'Console or command-line user interface'
start()
class deluge.ui.console.console.LogStream

Bases: object

flush()
out = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
write(data)
deluge.ui.console.console.load_commands(command_dir)

deluge.ui.console.main module

class deluge.ui.console.main.ConsoleUI(options, cmds, log_stream)

Bases: deluge.component.Component, deluge.ui.console.modes.basemode.TermResizeHandler

exec_args(options)

Execute console commands from command line.

get_torrent_name(torrent_id)
is_active_mode(mode)
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.

match_torrents(strings)
on_client_disconnect()
on_terminal_size(*args)
on_torrent_added_event(event, from_state=False)
on_torrent_removed_event(event)
quit()
register_mode(mode, set_mode=False)
run(stdscr)

This method is called by the curses.wrapper to start the mainloop and screen.

Parameters

stdscr (_curses.curses window) – curses screen passed in from curses.wrapper.

set_batch_write(batch)
set_mode(mode_name, refresh=False)
start()
start_components()
start_console()
start_ui()

Start the console UI.

Note: When running console UI reactor.run() will be called which

effectively blocks this function making the return value insignificant. However, when running unit tests, the reacor is replaced by a mock object, leaving the return deferred object necessary for the tests to run properly.

Returns

Deferred

If valid commands are provided, a deferred that fires when

all commands are executed. Else None is returned.

switch_mode(func, error_smg)
tab_complete_path(line, path_type='file', ext='', sort='name', dirs_first=True)
tab_complete_torrent(line)
write(s)
write_event(s)
class deluge.ui.console.main.EventLog

Bases: deluge.component.Component

Prints out certain events as they are received from the core.

on_config_value_changed_event(key, value)
on_new_version_available_event(version)
on_plugin_disabled_event(name)
on_plugin_enabled_event(name)
on_session_paused_event()
on_session_resumed_event()
on_torrent_added_event(torrent_id, from_state)
on_torrent_finished_event(torrent_id)
on_torrent_removed_event(torrent_id)
on_torrent_state_changed_event(torrent_id, state)
write(s)

deluge.ui.console.parser module

class deluge.ui.console.parser.ConsoleBaseParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True)

Bases: argparse.ArgumentParser

format_help()

Differs from ArgumentParser.format_help by adding the raw epilog as formatted in the string. Default bahavior mangles the formatting.

class deluge.ui.console.parser.ConsoleCommandParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True)

Bases: deluge.ui.console.parser.ConsoleBaseParser

parse_args(args=None)

Parse known UI args and handle common and process group options.

Notes

If started by deluge entry script this has already been done.

Parameters

args (list, optional) – The arguments to parse.

Returns

argparse.Namespace – The parsed arguments.

class deluge.ui.console.parser.OptionParser(**kwargs)

Bases: deluge.ui.console.parser.ConsoleBaseParser

error(msg : string)

Print a usage message incorporating ‘msg’ to stderr and exit. If you override this in a subclass, it should not return – it should either exit or raise an exception.

exit(status=0, msg=None)
format_help()

Return help formatted with colors.

print_help(_file=None)
print_usage(_file=None)
exception deluge.ui.console.parser.OptionParserError

Bases: Exception

Module contents

deluge.ui.console.start()