deluge: Minor fixes and styling

- Updated comments

- Start the daemon before enabling Apache configuration.

- Warn the user about editing the Apache configuration for Deluge.

- Other minor updates.
This commit is contained in:
Sunil Mohan Adapa 2015-05-10 13:44:33 +05:30
parent 6a57dc78f3
commit a6fa7abbad
5 changed files with 17 additions and 11 deletions

View File

@ -18,7 +18,7 @@
#
"""
Configuration helper for BitTorrent web client
Configuration helper for BitTorrent web client.
"""
import argparse
@ -30,6 +30,12 @@ SITE_CONF = '/etc/apache2/conf-available/deluge-web.conf'
SITE_ENABLED = '/etc/apache2/conf-enabled/deluge-web.conf'
APACHE_CONF = '''
##
## On all sites, provide Deluge on a default path: /deluge
##
## This file is managed and overwritten by Plinth. If you wish to edit
## it, disable Deluge in Plinth, remove this file and manage it manually.
##
<Location /deluge>
ProxyPass http://localhost:8112
</Location>
@ -77,11 +83,11 @@ def subcommand_enable(_):
if not os.path.isfile(SITE_CONF):
setup()
subcommand_start(_)
subprocess.check_call(['a2enconf', 'deluge-web'])
subprocess.check_call(['service', 'apache2', 'reload'])
subcommand_start(_)
def subcommand_disable(_):
"""Disable deluge-web site and stop deluge-web."""

View File

@ -16,7 +16,7 @@
#
"""
Plinth module to configure a Deluge web client
Plinth module to configure a Deluge web client.
"""
from gettext import gettext as _
@ -28,7 +28,7 @@ depends = ['plinth.modules.apps']
def init():
"""Initialize the BitTorrent module."""
"""Initialize the Deluge module."""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(_('BitTorrent (Deluge)'), 'glyphicon-magnet',
'deluge:index', 60)

View File

@ -26,5 +26,5 @@ from gettext import gettext as _
class DelugeForm(forms.Form):
"""Deluge configuration form."""
enabled = forms.BooleanField(
label=_('Enable Deluge web client'),
label=_('Enable Deluge'),
required=False)

View File

@ -49,19 +49,19 @@
<p>
{% if status.is_running %}
<span class="running-status active"></span> deluge-web is running
<form class="form" method="post" action="{% url 'deluge:stop' %}">
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="Stop deluge-web &raquo;"/>
<input type="submit" class="btn btn-primary" value="Stop deluge-web"/>
</form>
{% else %}
<span class="running-status inactive"></span> deluge-web is not running
<form class="form" method="post" action="{% url 'deluge:start' %}">
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="Start deluge-web &raquo;"/>
<input type="submit" class="btn btn-primary" value="Start deluge-web"/>
</form>
{% endif %}

View File

@ -78,7 +78,7 @@ def get_status():
enabled = (output.strip() == 'yes')
output = actions.run('deluge', ['is-running'])
is_running = ('yes' in output.strip())
is_running = (output.strip() == 'yes')
status = {'enabled': enabled,
'is_running': is_running}