Fix by leaving shutdown procedure to gtkui.py:
* Daemon no longer calls component.shutdown() in GTKUI classic mode
* Mainwindow no longer calls reactor.stop but instead fires a
'gtkui_close' signal.
* gtkui.py installs custom SIGINT handler to initiate shutdown before
stopping reactor.
This should fix problems with errors occuring when failing to
enable plugins. Errors in plugin handling are handled better
and properly logged.
WebUI plugin in particular had issues when being enabled and disabled
multiple times because it was trying to create DelugeWeb component
each time it was enabled. If deluge-web is already listening on
the same port, enabling the WebUI plugin will fail, and the checkbox
will not be checked.
There are still some issues when enabling/disabling plugins by
clicking fast multiple times on the checkbox.
Add --profile to commonoptions making the option now available for
daemon and all UIs. --profile option now prints to stdout unless an
optional filename is specified.
Add entry points into setup for each of the UIs and then use this
information to determine which client UI to run.
This ensures that custom UIs may be written and run without
the need to modifify deluge source code.
Handle child args and -a args in a common way so that all children
accept the same input format. Modify UIs to pass through setup
arguments to the base class.
Instead of launching the UI directly launch the UI via the _UI
subclasses in the same way that the scripts launch the clients.
The only use of the ui.UI class is a base for Web which never calls
__init__ and at the beginning when choosing which UI to launch,
however that doesn't need to be an object.
* pylintrc is now compatible with pylint 1.6.
* Add to ignore wrong-import-position and wrong-import-order as
we use isort and pylint is raising too many incorrect messages.
* Replace Popen with reactor.spawnProcess and read process
output with twisted.internet.protocol.ProcessProtocol
* Implement support for running custom script code
* Now logs to stdout instead of stderr when not logging to file
Exceptions raised by calls performed by a JSON request would
not always be handled properly resulting in no reply to be sent
leading to browser timeouts.
Fix this by including the raised error in the JSON data of a
regular (successful) HTTP response.
For some reason, the time.sleep calls in the tests in
test_sessionproxy did not sleep for the expected amount
of time causing the results to differ from the expected.
Fixed by replacing time.time function with twisted's
task.clock.seconds and advancing the clock manually.
Also minor changes to test_client.py
Add __str__ to WrappedException so that the stacktrace is printed when a
unit test raises a WrappedException.
Change the log output from error to warning in DelugeRPCProtocol.dispatch
when sending back a raised exception on an RPC request.
With large amounts of torrents, saving the state file becomes
a performance bottleneck, mainly due to the required processing
in pickle.dump. When run in the main thread, the server will
hang and be unresponsive for a significant time.
Solve this issue by running the save state job in a separate thread.