Reorganize python sources into 'plinth' package

This commit is contained in:
Sunil Mohan Adapa committed 2014-08-29 12:57:27 +05:30
1 parent eaacd3864b
commit 65fa648d9f
109 files changed
+63 -61

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#
# 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 module for help pages
"""
from . import help # pylint: disable-msg=W0622
from .help import init
__all__ = ['help', 'init']
+47
View File
@@ -0,0 +1,47 @@
import os
from gettext import gettext as _
from django.http import Http404
from django.template.response import TemplateResponse
from plinth import cfg
def init():
"""Initialize the Help module"""
menu = cfg.main_menu.add_urlname(_('Documentation'), 'icon-book',
'help:index', 101)
menu.add_urlname(_('Where to Get Help'), 'icon-search',
'help:index_explicit', 5)
menu.add_urlname(_('Developer\'s Manual'), 'icon-info-sign',
'help:helppage', 10, url_args=('plinth',))
menu.add_urlname(_('FAQ'), 'icon-question-sign', 'help:helppage', 20,
url_args=('faq',))
menu.add_item(_('%s Wiki' % cfg.box_name), 'icon-pencil',
'http://wiki.debian.org/FreedomBox', 30)
menu.add_urlname(_('About'), 'icon-star', 'help:about', 100)
def index(request):
"""Serve the index page"""
return TemplateResponse(request, 'help.html',
{'title': _('Documentation and FAQ')})
def about(request):
"""Serve the about page"""
title = _('About the {box_name}').format(box_name=cfg.box_name)
return TemplateResponse(request, 'about.html', {'title': title})
def helppage(request, page):
"""Serve a help page from the 'doc' directory"""
try:
with open(os.path.join('doc', '%s.part.html' % page), 'r') \
as input_file:
main = input_file.read()
except IOError:
raise Http404
title = _('%s Documentation') % cfg.product_name
return TemplateResponse(request, 'base.html',
{'title': title, 'main': main})
+62
View File
@@ -0,0 +1,62 @@
{% extends 'base.html' %}
{% load static %}
{% comment %}
#
# 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/>.
#
{% endcomment %}
{% block main_block %}
<img src="{% static 'theme/img/freedombox-logo-250px.png' %}"
class="main-graphic" />
<p>We live in a world where our use of the network is mediated by
those who often do not have our best interests at heart. By building
software that does not rely on a central service, we can regain
control and privacy. By keeping our data in our homes, we gain useful
legal protections over it. By giving back power to the users over
their networks and machines, we are returning the Internet to its
intended peer-to-peer architecture.</p>
<p>In order to bring about the new network order, it is
paramount that it is easy to convert to it. The hardware it
runs on must be cheap. The software it runs on must be easy to
install and administrate by anybody. It must be easy to
transition from existing services.</p>
<p><a class="btn btn-primary btn-large"
href="http://wiki.debian.org/FreedomBox" target="_blank">Learn more
&raquo;</a></p>
{% endblock %}
{% block sidebar_right_block %}
<div class="well sidebar-nav">
<h3>Our Goal</h3>
<p>There are a number of projects working to realize a future of
distributed services; we aim to bring them all together in a
convenient package.</p>
<p>For more information about the FreedomBox project, see the
<a href="http://wiki.debian.org/FreedomBox">Debian Wiki</a>.</p>
</div>
{% endblock %}
+45
View File
@@ -0,0 +1,45 @@
{% extends 'base.html' %}
{% comment %}
#
# 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/>.
#
{% endcomment %}
{% block main_block %}
<p>There are a variety of places to go for help with
{{ cfg.product_name }} and the box it runs on.</p>
<p>This front end has a <a href="{% url 'help:helppage' 'plinth' %}">
developer's manual</a>. It isn't complete, but it is the first place
to look. Feel free to offer suggestions, edits, and screenshots for
completing it!</p>
<p><a href="http://wiki.debian.org/FreedomBox" target="_blank">A
section of the Debian wiki</a> is devoted to the {{ cfg.box_name }}.
At some point the documentation in the wiki and the documentation in
the manual should dovetail.</p>
<p>There are Debian gurus in the #debian channels of both
irc.freenode.net and irc.oftc.net. They probably don't know much
about the {{ cfg.box_name }} and almost surely know nothing of this
front end, but they are an incredible resource for general Debian
issues.</p>
<p>There is no <a href="{% url 'help:helppage' 'faq' %}">FAQ</a> because
the question frequency is currently zero for all questions.</p>
{% endblock %}
+34
View File
@@ -0,0 +1,34 @@
#
# 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/>.
#
"""
URLs for the Help module
"""
from django.conf.urls import patterns, url
urlpatterns = patterns( # pylint: disable-msg=C0103
'plinth.modules.help.help',
# having two urls for one page is a hack to help the current url/menu
# system highlight the correct menu item. Every submenu-item with the same
# url prefix as the main-menu is highlighted automatically.
url(r'^help/$', 'index', name='index'),
url(r'^help/index/$', 'index', name='index_explicit'),
url(r'^help/about/$', 'about', name='about'),
url(r'^help/page/(plinth|hacking|faq)/$', 'helppage', name='helppage'),
)