This commit is a rewrite of larger parts of the console code. The
motivation behind the rewrite is to cleanup the code and reduce code
duplication to make it easier to understand and modify, and allow any
form of code reuse. Most changes are to the interactive console, but
also to how the different modes (BaseMode subclasses) are used and set
up.
* Address [#2097] - Improve match_torrent search match:
Instead of matching e.g. torrent name with name.startswith(pattern)
now check for asterix at beginning and end of pattern and search
with startswith, endswith or __contains__ according to the pattern.
Various smaller fixes:
* Add errback handler to connection failed
* Fix cmd line console mixing str and unicode input
* Fix handling delete backwards with ALT+Backspace
* Fix handling resizing of message popups
* Fix docs generation warnings
* Lets not stop the reactor on exception in basemode..
* Markup for translation arg help strings
* Main functionality improvements:
- Add support for indentation in formatting code in popup messages (like help)
- Add filter sidebar
- Add ComboBox and UI language selection
- Add columnsview to allow rearranging the torrentlist columns
and changing column widths.
- Removed Columns pane in preferences as columnsview.py is sufficient
- Remove torrent info panel (short cut 'i') as the torrent detail view
is sufficient
* Cleanups and code restructuring
- Made BaseModes subclass of Component
- Rewrite of most of basic window/panel to allow easier code reuse
- Implemented better handling of multple popups by stacking popups. This
makes it easier to return to previous popup when opening multiple popups.
* Refactured console code:
- modes/ for the different modes
- Renamed Legacy mode to CmdLine
- Renamed alltorrent.py to torrentlist.py and split the code into
- torrentlist/columnsview.py
- torrentlist/torrentsview.py
- torrentlist/search_mode.py (minor mode)
- torrentlist/queue_mode.py (minor mode)
- cmdline/ for cmd line commands
- utils/ for utility files
- widgets/ for reusable GUI widgets
- fields.py: Base widgets like TextInput, SelectInput, ComboInput
- popup.py: Popup windows
- inputpane.py: The BaseInputPane used to manage multiple base widgets in a panel
- window.py: The BaseWindow used by all panels needing a curses screen
- sidebar.py: The Sidebar panel
- statusbars.py: The statusbars
- Moved option parsing code from main.py to parser.py
The env variable ESCDELAY specifies the time in ms which ncurses waits
for a character sequence. With a default value of 1000, it produces a
1 second delay when pressing the ESC key to close dialogs.
Set this variable to 0 to get instant respons when pressing ESC.
Add wrapper around the stream passed to the loggers streamhandler
when no log file is specified. Console in interactive mode now
ignores the log output with no logfile specified.
* Testing the torrent with other bencode libs doesn't raise exceptions
so just revert the 'small fix' applied in b193d87499.
* Add BTFailure exception so bdecode issue can be caught in deluge code.
* Move Private label to Trackers Tab.
* Move Owner to Options Tab with a future plan for a dropdown box
to change ownership.
* Put the torrent status message into the progress bar.
* Remove duplicate Shared label in Details Tab.
* Details Tab allow more horizontal room for long folder paths
and fix horizontal scrolling.
* Use print function
* Fix except as statements
* Remove old twisted 8 code
* Remove empty docstring
* Refactor try statement to only contain the relevant import and
disable pylint import msgs.
* Use flake8 noqa and pylint comment and drop pyflakes workarounds.
The builtin cmp() and the __cmp__() special method is no longer used in Python 3, instead we use functools.total_ordering decorator and the __lt__/__eq__ special methods to get the same effect.
* Replace the uses of long with int.
* Replace im_func with __func__ as it has been provided for Python 3 forward-compatibility.
* Fix next/__next__ for Python 3 compatibility.
* Remove the long number literal
* Ensure freespace() returns int
To make the code more Python 3 compatible, I've made a few changes to how we handle keys() or iterkeys() calls on dictionaries. All functionality should remain the same.
* Remove the use of .keys() or .iterkeys() when iterating through a dictionary.
* Remove the use of .keys() when checking if key exists in dictionary.
* Replace dict.keys() with list(dict) to obtain a list of dictionary keys. In Python 3 dict.keys() returns a dict_keys object, not a list.
* Use markup in gtkui to reduce font size of displayed units.
* Reduced statusbar item sizes using markup and <small> tag. Provides an
interim solution to #1326 and has reduced width from 930px to ~600px.
* Integer value for Progress bar value in Peers and Files Tabs.
* Remove trailing zeros for Pieces size in Details Tab.
* Change position of Share Ratio in Status Tab.
* Increase minimum width of column from 10px to 20px for listview.
* Use shortform units e.g. Columns, Title speed, Status tab, Status bar.
* Use less precision displaying values in columns.
* libtorrent >= 1.1 dropped support for GeoIP so this adds support
again using MaxMind GeoIP Legacy Python Extension API.
For reference it is known by the following package names:
* Maxmind: geoip-api-python
* Linux: python-geoip
* PyPi: GeoIP
* #2133 Add flags for port reuse and disable binding to system port.
* #2122 For random port, use single port and store it for reuse.
* #2343 Fix 'Invalid Arg' from listen_on, likely due to whitespace as interface value.
* Consolidate listen_on and outgoing_port into single '__set...' methods.
* Copy-pasting from web page can include extra space at end of string.
* Also make minor change to populate the magnet name with infohash
for nicer UI display.