Example #1
0
File: plot.py Project: cerha/lcg
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from __future__ import division

import datetime
import io
import lcg
from matplotlib import pyplot
import matplotlib.ticker
import matplotlib.dates
import os
import pandas

_ = lcg.TranslatableTextFactory('lcg')


class Line(object):
    """Representation of a plot line parameters for 'grid' and 'lines' arguments of 'LinePlot'.

    Constructor arguments:

      x: Line position for a vertical line in 'lines' argument of a 'LinePlot'.
        A value compatible with other x axis values of the plot (e.g. a
        datetime instance when x values are datetimes).  Irrelevant for 'grid'
        lines.
      y: Line position for a horizontal line in 'lines' argument of a
        'LinePlot'.  Analogical to 'x'.
      color: Line color given by 'lcg.Color' instance, hexadecimal RGB or RGBA
        representation or a X11/CSS4 color name (such as '#fa046e' or 'red').
Example #2
0
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import re

import lcg
import pytis
import wiking

_ = lcg.TranslatableTextFactory('wiking')
Part = lcg.Html5Exporter.Part


class MinimalExporter(lcg.Html5Exporter):
    _PAGE_STRUCTURE = (
        Part('main'),
        Part('bottom-bar'),
    )

    def _head(self, context):
        g = context.generator()
        try:
            uri = context.req().module_uri('Resources')
        except Exception:
            uri = '_resources'
Example #3
0
the way its tasks are represented on the output.

This module originally comes from the Eurochance project.  It was modified to
allow using interactive exercises within any LCG content.  Some functionality
present in the code may still not be fully supported.

"""

from __future__ import unicode_literals
from builtins import map

import sys
import lcg
import re

_ = lcg.TranslatableTextFactory('lcg-exercises')

unistr = type(u'')  # Python 2/3 transition hack.
if sys.version_info[0] > 2:
    basestring = str

################################################################################
################################     Tasks     #################################
################################################################################


class Task(object):
    """Abstract base class of all task types.

    Tasks are not the 'Content' instances.  They are not able to render
    themselves.  They just hold the data.