File: programmer.py

package info (click to toggle)
termsaver 0.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 284 kB
  • sloc: python: 1,446; makefile: 4
file content (92 lines) | stat: -rw-r--r-- 3,206 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
###############################################################################
#
# file:     programmer.py
#
# Purpose:  refer to module documentation for details
#
# Note:     This file is part of Termsaver application, and should not be used
#           or executed separately.
#
###############################################################################
#
# Copyright 2012 Termsaver
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
###############################################################################
"""
A screen to read source code files (or any other) in a  typing writer animation
See additional information in the class itself.

The helper class available here is:

    * `ProgrammerScreen`
"""
from termsaverlib.screen.base.filereader import FileReaderBase
from termsaverlib import constants
from termsaverlib.i18n import _


class ProgrammerScreen(FileReaderBase):
    """
    A simple screen that will display any text (hei programmer, source code!),
    on screen in a typing writer animation.

    From options available in `FileReaderBase`, this will use:

        * `FileReaderBase.cleanup_per_cycle` as True

        * `FileReaderBase.cleanup_per_file` as True
    """

    def __init__(self):
        """
        Creates a new instance of this class (used by termsaver script)

        From its base classes, the functionality provided here bases on the
        settings defined below:

            * clean up each cycle: True
              this will force the screen to be cleaned (cleared) before
              each new cycle is displayed

            * clean up each file: True
              this will force the screen to be cleaned (cleared) before
              each new file is displayed
        """
        FileReaderBase.__init__(self,
            "programmer",
            _("displays source code in typing animation"))
        self.cleanup_per_cycle = True
        self.cleanup_per_file = True

    def _message_no_path(self):
        """
        The specific helper message in case there is no path informed in the
        command-line arguments.
        """
        return _("""
You just need to provide the path to the location from where %(app_title)s will
read and display on screen.

If you do not have any code in your local machine, just get some interesting
project from the Internet, such as Django (http://www.djangoproject.com):

    If you have access to subversion, you may download it at:
        svn co https://code.djangoproject.com/svn/django/trunk/ django-trunk

    Or, just download the zipped source and unpack it on your local machine:
        https://www.djangoproject.com/download/
""") % {
       'app_title': constants.App.TITLE,
    }