quassel: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa 2016-02-12 17:02:06 +05:30
parent a33f68f051
commit 528fe47c16
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971
3 changed files with 35 additions and 39 deletions

View File

@ -16,7 +16,7 @@
#
"""
Plinth module for quassel.
Plinth module for Quassel.
"""
from django.utils.translation import ugettext_lazy as _
@ -24,22 +24,48 @@ from django.utils.translation import ugettext_lazy as _
from plinth import action_utils
from plinth import cfg
from plinth import service as service_module
from plinth.utils import format_lazy
version = 1
depends = ['apps']
title = _('IRC Client (Quassel)')
description = [
format_lazy(
_('Quassel is an IRC application that is split into two parts, a '
'"core" and a "client". This allows the core to remain connected '
'to IRC servers, and to continue receiving messages, even when '
'the client is disconnected. {box_name} can run the Quassel '
'core service keeping you always online and one or more Quassel '
'clients from a desktop or a mobile can be used to connect and '
'disconnect from it.'), box_name=_(cfg.box_name)),
_('You can connect to your Quassel core on the default Quassel port '
'4242. Clients to connect to Quassel from your '
'<a href="http://quassel-irc.org/downloads">desktop</a> and '
'<a href="http://quasseldroid.iskrembilen.com/">mobile</a> devices '
'are available.')
]
service = None
def init():
"""Initialize the quassel module."""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(_('IRC Client (Quassel)'), 'glyphicon-retweet',
'quassel:index', 730)
menu.add_urlname(title, 'glyphicon-retweet', 'quassel:index', 730)
global service
service = service_module.Service(
'quassel-plinth', _('Quassel IRC Client'),
is_external=True, enabled=is_enabled())
'quassel-plinth', title, is_external=True, enabled=is_enabled())
def setup(helper, old_version=None):
"""Install and configure the module."""
helper.install(['quassel-core'])
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,31 +21,7 @@
{% load bootstrap %}
{% load i18n %}
{% block content %}
<h2>{% trans "IRC Client (Quassel)" %}</h2>
<p>
{% blocktrans trimmed %}
Quassel is an IRC application that is split into two parts, a
"core" and a "client". This allows the core to remain connected
to IRC servers, and to continue receiving messages, even when
the client is disconnected. {{ box_name }} can run the Quassel
core service keeping you always online and one or more Quassel
clients from a desktop or a mobile can be used to connect and
disconnect from it.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
You can connect to your Quassel core on the default Quassel port
4242. Clients to connect to Quassel from your
<a href="http://quassel-irc.org/downloads">desktop</a> and
<a href="http://quasseldroid.iskrembilen.com/">mobile</a> devices
are available.
{% endblocktrans %}
</p>
{% block configuration %}
<h3>{% trans "Status" %}</h3>

View File

@ -25,16 +25,9 @@ from django.utils.translation import ugettext as _
from .forms import QuasselForm
from plinth import actions
from plinth import package
from plinth.modules import quassel
def on_install():
"""Notify that the service is now enabled."""
quassel.service.notify_enabled(None, True)
@package.required(['quassel-core'], on_install=on_install)
def index(request):
"""Serve configuration page."""
status = get_status()
@ -51,7 +44,8 @@ def index(request):
form = QuasselForm(initial=status, prefix='quassel')
return TemplateResponse(request, 'quassel.html',
{'title': _('IRC Client (Quassel)'),
{'title': quassel.title,
'description': quassel.description,
'status': status,
'form': form})