/usr/share/GvRng/Text.py is in gvrng 4.4-3~deb9u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | ## This module holds the different help text used by gvr in the menu
DEBUG = 0
import os
from utils import get_rootdir
import logging
module_logger = logging.getLogger("gvr.Text")
OnRefText = ''# this will be set to some text in set_summary()
InfoFooter = "For more info, http://gvr.sf.net"
OnRefTitle = "Guido van Robot Programming Summary"
OnWBText = ''# this will be set to some text in set_summary()
OnIntroText = ''
# Builtin summary text, we use it in case of IO trouble.
BuiltinOnRefText = \
"""Guido van Robot Programming Summary
The Five Primitive Guido van Robot Instructions:
1. move
2. turnleft
3. pickbeeper
4. putbeeper
5. turnoff
Block Structuring
Each Guido van Robot instruction must be on a separate line.
A sequence of Guido van Robot instructions can be treated as a single
instruction by indenting the same number of spaces.
<instruction> refers to any of the five primitive instructions above,
the conditional branching or iteration instructions below, or a user
defined instruction.
<instruction>
<instruction>
...
<instruction>
Conditionals
GvR has eighteen built-in tests that are divided into three groups:
the first six are wall tests, the next four are beeper tests, and the last
eight are compass tests:
1. front_is_clear
2. front_is_blocked
3. left_is_clear
4. left_is_blocked
5. right_is_clear
6. right_is_blocked
7. next_to_a_beeper
8. not_next_to_a_beeper
9. any_beepers_in_beeper_bag
10. no_beepers_in_beeper_bag
11. facing_north
12. not_facing_north
13. facing_south
14. not_facing_south
15. facing_east
16. not_facing_east
17. facing_west
18. not_facing_west
Conditional Branching
Conditional branching refers to the ability of a program to alter it's flow
of execution based on the result of the evaluation of a conditional.
The three types of conditional branching instructions in Guido van Robot are
if and if/else and if/elif/else.
<test> refers to one of the eighteen conditionals above.
if <test>:
<instruction>
if <test>:
<instruction>
else:
<instruction>
if <test>:
<instruction>
elif <test>:
<instruction>
...
elif <test>:
<instruction>
else:
<instruction>
Iteration
Iteration refers to the ability of a program to repeate an instruction
(or block of instructions) over and over until some condition is met.
The two types of iteration instructions are the do and while instructions.
<positive_number> must be an integer greater than 0.
do <positive_number>:
<instruction>
while <test>:
<instruction>
Defining a New Instruction:
New instructions can be created for Guido van Robot using the define statement.
<new_name> can be any sequence of letters or digits as long as it begins with
a letter and is not already used as an instruction.
Letters for Guido van Robot are A..Z, a..z, and the underscore (_) character.
Guido van Robot is case sensitive, so TurnRight, turnright, and turnRight are
all different names.
define <new_name>:
<instruction>
"""
BuiltinOnWBText = \
"""Guido van Robot Worldbuilder Summary
Editing world:
Left mouse button : Add or remove walls
Middle mouse button: Set arguments for the robot statement
Right mouse button: Set arguments for the beeper statement
It's possible to alter the number of beepers by clicking
the right mouse button when the mouse pointer is at a
beepers location.
Give another number of beepers in the beeper dialog.
When you give 0 (zero) the beeper is removed from the world.
Buttons:
Reload : Reload the world from the editor window
into the worldbuilder.
Abort : Quit the worldbuilder, *not* GvRng.
"""
BuiltinOnIntroText=\
"""Welcome to the Guido van Robot world.
Guido van Robot, or GvR for short, is a programming language
and free software application designed to introduce beginners
to the fundamentals of programming.
GvR runs on GNU/Linux, XO, Windows, and Macintosh, in a variety
of languages!
It's great in both the classroom and the home as a way of
introducing people to the basic concepts of programming.
At this point, you are probably asking yourself,
What is GvR, specifically?
The gist of it is that it is a robot represented by a triangle
on the screen that moves around in a world made up of streets
and avenues, walls and beepers, which Guido can collect or set.
His actions are completely guided by a program written by the
user.
GvR comes with 18 lessons and assignments and a language
reference.
See the "Lessons" tab and start with lesson 1.
Use the "Language reference" tab to get a overview of the GvR
language.
Additional help and information:
OLPC: http://wiki.laptop.org/go/Guido_van_Robot
GvR web page: http://gvr.sourceforge.net/index.php
GvR contact: http://gvr.sourceforge.net/contact/
GvR project page: http://sourceforge.net/projects/gvr/
"""
def set_summary(olang):
"""Get the proper summary file for the current locale"""
global OnRefText
# Quick hack to fix the loading of Summary.txt, should be done trying all
# components of the locale, probably removing the -LANG suffix, as the
# language is already on the locale dir and putting it in two places makes
# things harder; is best to use the directory to choose the language or
# put all the Summaries on the same dir.
try:
lang = olang.split('@')[0].split('.')[0].split('_')[0]
except Exception,info:
print info
print "Can't load Summary for language '%s'" % lang
print "Using default English file"
lang = 'en'
sumfile = "Summary-%s.txt" % lang
if lang == 'en':
path = os.path.join(get_rootdir(),'po',sumfile)
else:
path = os.path.join(get_rootdir(),'po',lang,sumfile)
if DEBUG: print "trying to read",path
try:
lines = open(path,'r').read()
except IOError,info:
print info
print "Can't load Summary for language '%s'" % lang
print "Using default English file"
OnRefText = BuiltinOnRefText
else:
OnRefText = lines
def set_WBsummary(olang):
"""Get the proper Worldbuilder summary file for the current locale"""
global OnWBText
# Quick hack to fix the loading of Summary.txt, should be done trying all
# components of the locale, probably removing the -LANG suffix, as the
# language is already on the locale dir and putting it in two places makes
# things harder; is best to use the directory to choose the language or
# put all the Summaries on the same dir.
try:
lang = olang.split('@')[0].split('.')[0].split('_')[0]
except Exception,info:
print info
print "Can't load Worldbuilder Summary for language '%s'" % lang
print "Using default English file"
lang = 'en'
sumfile = "WBSummary-%s.txt" % lang
if lang == 'en':
path = os.path.join(get_rootdir(),'po',sumfile)
else:
path = os.path.join(get_rootdir(),'po',lang,sumfile)
if DEBUG: print "trying to read",path
try:
lines = open(path,'r').read()
except IOError,info:
print info
print "Can't load Worldbuilder Summary for language '%s'" % lang
print "Using default English file"
OnWBText = BuiltinOnWBText
else:
OnWBText = lines
def set_Intro(olang):
"""Get the proper intro text file for the current locale"""
global OnIntroText
# Quick hack to fix the loading of Summary.txt, should be done trying all
# components of the locale, probably removing the -LANG suffix, as the
# language is already on the locale dir and putting it in two places makes
# things harder; is best to use the directory to choose the language or
# put all the Summaries on the same dir.
try:
lang = olang.split('@')[0].split('.')[0].split('_')[0]
except Exception,info:
print info
print "Can't load Intro text for language '%s'" % lang
print "Using default English file"
lang = 'en'
sumfile = "Intro-%s.txt" % lang
if lang == 'en':
path = os.path.join(get_rootdir(),'po',sumfile)
else:
path = os.path.join(get_rootdir(),'po',lang,sumfile)
if DEBUG: print "trying to read",path
try:
lines = open(path,'r').read()
except IOError,info:
print info
print "Can't load intro for language '%s'" % lang
print "Using default English file"
OnIntroText = BuiltinOnIntroText
else:
OnIntroText = lines
|