mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Merge remote-tracking branch 'fonfon/dev'
This commit is contained in:
commit
281b5cddec
@ -26,6 +26,7 @@ import os
|
|||||||
|
|
||||||
from plinth import cfg
|
from plinth import cfg
|
||||||
from plinth import urls
|
from plinth import urls
|
||||||
|
from plinth.signals import pre_module_loading, post_module_loading
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ def load_modules():
|
|||||||
Read names of enabled modules in modules/enabled directory and
|
Read names of enabled modules in modules/enabled directory and
|
||||||
import them from modules directory.
|
import them from modules directory.
|
||||||
"""
|
"""
|
||||||
|
pre_module_loading.send_robust(sender="module_loader")
|
||||||
module_names = []
|
module_names = []
|
||||||
modules = {}
|
modules = {}
|
||||||
directory = os.path.dirname(os.path.abspath(__file__))
|
directory = os.path.dirname(os.path.abspath(__file__))
|
||||||
@ -75,6 +77,8 @@ def load_modules():
|
|||||||
for module_name in ordered_modules:
|
for module_name in ordered_modules:
|
||||||
_initialize_module(modules[module_name])
|
_initialize_module(modules[module_name])
|
||||||
LOADED_MODULES.append(module_name)
|
LOADED_MODULES.append(module_name)
|
||||||
|
post_module_loading.send_robust(sender="module_loader")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _insert_modules(module_name, module, remaining_modules, ordered_modules):
|
def _insert_modules(module_name, module, remaining_modules, ordered_modules):
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import logging
|
|||||||
|
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth import cfg
|
from plinth import cfg
|
||||||
|
from plinth.signals import service_enabled
|
||||||
import plinth.service as service_module
|
import plinth.service as service_module
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ def init():
|
|||||||
menu = cfg.main_menu.get('system:index')
|
menu = cfg.main_menu.get('system:index')
|
||||||
menu.add_urlname(_('Firewall'), 'icon-flag', 'firewall:index', 50)
|
menu.add_urlname(_('Firewall'), 'icon-flag', 'firewall:index', 50)
|
||||||
|
|
||||||
service_module.ENABLED.connect(on_service_enabled)
|
service_enabled.connect(on_service_enabled)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|||||||
@ -23,7 +23,8 @@ from gettext import gettext as _
|
|||||||
|
|
||||||
import django.dispatch
|
import django.dispatch
|
||||||
|
|
||||||
ENABLED = django.dispatch.Signal(providing_args=['service_id', 'enabled'])
|
from plinth.signals import service_enabled
|
||||||
|
|
||||||
|
|
||||||
SERVICES = {}
|
SERVICES = {}
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ class Service(object):
|
|||||||
if not callable(self._enabled):
|
if not callable(self._enabled):
|
||||||
self._enabled = enabled
|
self._enabled = enabled
|
||||||
|
|
||||||
ENABLED.send_robust(sender=sender, service_id=self.service_id,
|
service_enabled.send_robust(sender=sender, service_id=self.service_id,
|
||||||
enabled=enabled)
|
enabled=enabled)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
27
plinth/signals.py
Normal file
27
plinth/signals.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#
|
||||||
|
# This file is part of Plinth.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
"""
|
||||||
|
Plinth signals
|
||||||
|
"""
|
||||||
|
|
||||||
|
from django.dispatch import Signal
|
||||||
|
|
||||||
|
|
||||||
|
service_enabled = Signal(providing_args=['service_id', 'enabled'])
|
||||||
|
pre_module_loading = Signal()
|
||||||
|
post_module_loading = Signal()
|
||||||
Loading…
x
Reference in New Issue
Block a user