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
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. <a href="http://mumble.info">Clients</a> 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():

View File

@ -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 %}
<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>
{% block configuration %}
<h3>{% trans "Status" %}</h3>

View File

@ -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})