deluge.ui.console.main

class deluge.ui.console.main.BaseCommand

Bases: object

complete(text, *args)
create_parser()
epilog
handle(*args, **options)
name
split(text)
class deluge.ui.console.main.Console

Bases: deluge.ui.ui._UI

start()
class deluge.ui.console.main.ConsoleUI(args=None)

Bases: deluge.component.Component

do_command(cmd)

Processes a command.

Parameter:cmd – str, the command string
get_torrent_name(torrent_id)

Gets a torrent name from the torrents list.

Parameter: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.

Parameter:string – str, the string to match on
Returns:list of matching torrent_ids. Will return an empty list if no matches are found.
on_client_disconnect()
on_torrent_added_event(torrent_id)
on_torrent_removed_event(torrent_id)
run(stdscr)

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

Parameter:stdscr – curses screen passed in from curses.wrapper
start()
tab_complete_torrent(line)

Completes torrent_ids or names.

Parameter:line – str, the string to complete
Returns:list of matches
tab_completer(line, cursor, second_hit)

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 depending on if we’re in interactive mode or not.

Parameter:line – str, the line to print
class deluge.ui.console.main.OptionParser(usage=None, option_list=None, option_class=<class optparse.Option at 0x801a120c>, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None, epilog=None)

Bases: optparse.OptionParser

subclass from optparse.OptionParser so exit() won’t exit.

error(msg)

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)
deluge.ui.console.main.load_commands(command_dir, exclude=[])
deluge.ui.console.main.start()

Previous topic

deluge.ui.console.eventlog

Next topic

deluge.ui.console.screen

This Page