mumble: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa 2016-02-12 16:01:40 +05:30
parent 1f8ccb6c93
commit 41e730d7ac
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971
3 changed files with 25 additions and 32 deletions

View File

@ -26,21 +26,38 @@ from plinth import cfg
from plinth import service as service_module from plinth import service as service_module
version = 1
depends = ['apps'] 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. <a href="http://mumble.info">Clients</a> to connect to Mumble '
'from your desktop and Android devices are available.')
]
service = None service = None
def init(): def init():
"""Intialize the Mumble module.""" """Intialize the Mumble module."""
menu = cfg.main_menu.get('apps:index') menu = cfg.main_menu.get('apps:index')
menu.add_urlname(_('Voice Chat (Mumble)'), 'glyphicon-headphones', menu.add_urlname(title, 'glyphicon-headphones', 'mumble:index', 900)
'mumble:index', 900)
global service global service
service = service_module.Service( service = service_module.Service(
'mumble-plinth', _('Mumble Voice Chat Server'), 'mumble-plinth', title, is_external=True, enabled=is_enabled())
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(): def is_enabled():

View File

@ -1,4 +1,4 @@
{% extends "base.html" %} {% extends "app.html" %}
{% comment %} {% comment %}
# #
# This file is part of Plinth. # This file is part of Plinth.
@ -21,25 +21,7 @@
{% load bootstrap %} {% load bootstrap %}
{% load i18n %} {% load i18n %}
{% block content %} {% block configuration %}
<h2>{% trans "Voice Chat (Mumble)" %}</h2>
<p>
{% blocktrans trimmed %}
Mumble is an open source, low-latency, encrypted, high quality
voice chat software.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
You can connect to your Mumble server on the regular Mumble port 64738.
<a href="http://mumble.info">Clients</a> to connect to Mumble
from your desktop and Android devices are available.
{% endblocktrans %}
</p>
<h3>{% trans "Status" %}</h3> <h3>{% trans "Status" %}</h3>

View File

@ -26,18 +26,11 @@ import logging
from .forms import MumbleForm from .forms import MumbleForm
from plinth import actions from plinth import actions
from plinth import package
from plinth.modules import mumble from plinth.modules import mumble
logger = logging.getLogger(__name__) 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): def index(request):
"""Serve configuration page.""" """Serve configuration page."""
status = get_status() status = get_status()
@ -55,7 +48,8 @@ def index(request):
form = MumbleForm(initial=status, prefix='mumble') form = MumbleForm(initial=status, prefix='mumble')
return TemplateResponse(request, 'mumble.html', return TemplateResponse(request, 'mumble.html',
{'title': _('Voice Chat (Mumble)'), {'title': mumble.title,
'description': mumble.description,
'status': status, 'status': status,
'form': form}) 'form': form})