mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-07-08 11:40:25 +00:00
minetest: Use new setup mechanism
This commit is contained in:
parent
363e071bff
commit
6c67a50e11
@ -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 <a href="http://www.minetest.net/downloads/">Minetest client</a> '
|
||||
'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():
|
||||
|
||||
@ -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 %}
|
||||
|
||||
<h2>{% trans "Block Sandbox (Minetest)" %}</h2>
|
||||
|
||||
<p>
|
||||
{% 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
|
||||
<a href="http://www.minetest.net/downloads/">Minetest client</a>
|
||||
is needed.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% block configuration %}
|
||||
|
||||
<h3>{% trans "Status" %}</h3>
|
||||
|
||||
|
||||
@ -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})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user