diff --git a/plinth/modules/minetest/__init__.py b/plinth/modules/minetest/__init__.py index 202581b53..cf386bcb8 100644 --- a/plinth/modules/minetest/__init__.py +++ b/plinth/modules/minetest/__init__.py @@ -24,22 +24,41 @@ 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 -depends = ['plinth.modules.apps'] + +version = 1 + +depends = ['apps'] + +title = _('Block Sandbox (Minetest)') + +description = [ + format_lazy( + _('Minetest is a multiplayer infinite-world block sandbox. This ' + 'module enables the Minetest server to be run on this ' + '{box_name}, on the default port (30000). To connect to the server, ' + 'a Minetest client ' + 'is needed.'), box_name=_(cfg.box_name)), +] service = None def init(): - """Initialize the minetest module.""" + """Initialize the module.""" menu = cfg.main_menu.get('apps:index') - menu.add_urlname(_('Block Sandbox (Minetest)'), 'glyphicon-th-large', - 'minetest:index', 325) + menu.add_urlname(title, 'glyphicon-th-large', 'minetest:index', 325) global service service = service_module.Service( - 'minetest-plinth', _('Minetest Server'), - is_external=True, enabled=is_enabled()) + 'minetest-plinth', title, is_external=True, enabled=is_enabled()) + + +def setup(helper, old_version=None): + """Install and configure the module.""" + helper.install(['minetest-server']) + helper.call('post', service.notify_enabled, None, True) def is_enabled(): diff --git a/plinth/modules/minetest/templates/minetest.html b/plinth/modules/minetest/templates/minetest.html index d4669149c..327a91434 100644 --- a/plinth/modules/minetest/templates/minetest.html +++ b/plinth/modules/minetest/templates/minetest.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "app.html" %} {% comment %} # # This file is part of Plinth. @@ -21,19 +21,7 @@ {% load bootstrap %} {% load i18n %} -{% block content %} - -

{% trans "Block Sandbox (Minetest)" %}

- -

- {% blocktrans trimmed %} - Minetest is a multiplayer infinite-world block sandbox. This module - enables the Minetest server to be run on this {{ box_name }}, on the - default port (30000). To connect to the server, a - Minetest client - is needed. - {% endblocktrans %} -

+{% block configuration %}

{% trans "Status" %}

diff --git a/plinth/modules/minetest/views.py b/plinth/modules/minetest/views.py index 27ae00da7..5d5f5a3d3 100644 --- a/plinth/modules/minetest/views.py +++ b/plinth/modules/minetest/views.py @@ -25,16 +25,9 @@ from django.utils.translation import ugettext as _ from .forms import MinetestForm from plinth import actions -from plinth import package from plinth.modules import minetest -def on_install(): - """Notify that the service is now enabled.""" - minetest.service.notify_enabled(None, True) - - -@package.required(['minetest-server'], on_install=on_install) def index(request): """Serve configuration page.""" status = get_status() @@ -51,7 +44,8 @@ def index(request): form = MinetestForm(initial=status, prefix='minetest') return TemplateResponse(request, 'minetest.html', - {'title': _('Block Sandbox (Minetest)'), + {'title': minetest.title, + 'description': minetest.description, 'status': status, 'form': form})