From 41e730d7acae2c06c0b0150ef4019e3b6846110a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 12 Feb 2016 16:01:40 +0530 Subject: [PATCH] mumble: Use new setup mechanism --- plinth/modules/mumble/__init__.py | 25 +++++++++++++++++---- plinth/modules/mumble/templates/mumble.html | 22 ++---------------- plinth/modules/mumble/views.py | 10 ++------- 3 files changed, 25 insertions(+), 32 deletions(-) diff --git a/plinth/modules/mumble/__init__.py b/plinth/modules/mumble/__init__.py index 846681b29..b7f772494 100644 --- a/plinth/modules/mumble/__init__.py +++ b/plinth/modules/mumble/__init__.py @@ -26,21 +26,38 @@ from plinth import cfg from plinth import service as service_module +version = 1 + depends = ['apps'] +title = _('Voice Chat (Mumble)') + +description = [ + _('Mumble is an open source, low-latency, encrypted, high quality ' + 'voice chat software.'), + + _('You can connect to your Mumble server on the regular Mumble port ' + '64738. Clients to connect to Mumble ' + 'from your desktop and Android devices are available.') +] + service = None def init(): """Intialize the Mumble module.""" menu = cfg.main_menu.get('apps:index') - menu.add_urlname(_('Voice Chat (Mumble)'), 'glyphicon-headphones', - 'mumble:index', 900) + menu.add_urlname(title, 'glyphicon-headphones', 'mumble:index', 900) global service service = service_module.Service( - 'mumble-plinth', _('Mumble Voice Chat Server'), - is_external=True, enabled=is_enabled()) + 'mumble-plinth', title, is_external=True, enabled=is_enabled()) + + +def setup(helper, old_version=None): + """Install and configure the module.""" + helper.install(['mumble-server']) + helper.call('post', service.notify_enabled, None, True) def is_enabled(): diff --git a/plinth/modules/mumble/templates/mumble.html b/plinth/modules/mumble/templates/mumble.html index 8f9d1d725..96745dfd8 100644 --- a/plinth/modules/mumble/templates/mumble.html +++ b/plinth/modules/mumble/templates/mumble.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "app.html" %} {% comment %} # # This file is part of Plinth. @@ -21,25 +21,7 @@ {% load bootstrap %} {% load i18n %} -{% block content %} - -

{% trans "Voice Chat (Mumble)" %}

- -

- {% blocktrans trimmed %} - Mumble is an open source, low-latency, encrypted, high quality - voice chat software. - {% endblocktrans %} -

- -

- {% blocktrans trimmed %} - You can connect to your Mumble server on the regular Mumble port 64738. - Clients to connect to Mumble - from your desktop and Android devices are available. - {% endblocktrans %} -

- +{% block configuration %}

{% trans "Status" %}

diff --git a/plinth/modules/mumble/views.py b/plinth/modules/mumble/views.py index 3ecadd7cc..4d67f6458 100644 --- a/plinth/modules/mumble/views.py +++ b/plinth/modules/mumble/views.py @@ -26,18 +26,11 @@ import logging from .forms import MumbleForm from plinth import actions -from plinth import package from plinth.modules import mumble logger = logging.getLogger(__name__) -def on_install(): - """Notify that the service is now enabled.""" - mumble.service.notify_enabled(None, True) - - -@package.required(['mumble-server'], on_install=on_install) def index(request): """Serve configuration page.""" status = get_status() @@ -55,7 +48,8 @@ def index(request): form = MumbleForm(initial=status, prefix='mumble') return TemplateResponse(request, 'mumble.html', - {'title': _('Voice Chat (Mumble)'), + {'title': mumble.title, + 'description': mumble.description, 'status': status, 'form': form})