summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.travis.sh11
-rw-r--r--Makefile20
m---------Modernizr0
-rw-r--r--README.rst2
-rwxr-xr-xunrpyc/find-gzip.sh2
-rw-r--r--unrpyc/renpy/ast.py338
6 files changed, 196 insertions, 177 deletions
diff --git a/.travis.sh b/.travis.sh
index ce6a912..1947589 100755
--- a/.travis.sh
+++ b/.travis.sh
@@ -9,6 +9,7 @@ case "$1" in
sudo apt-get update -qq
curl -L http://ftpmirror.gnu.org/make/make-4.0.tar.bz2 | tar -xj
+ #curl http://nodejs.org/dist/node-latest.tar.gz | tar -xz
curl https://webp.googlecode.com/files/libwebp-0.4.0.tar.gz | tar -xz
curl -L http://downloads.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.3.tar.gz | tar -xz
curl http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz | tar -xz
@@ -45,6 +46,13 @@ case "$1" in
cd ..
rm -rf libwebp-0.4.0
+ #cd node-v*
+ #./configure --openssl-use-sys --shared-zlib
+ #make $MAKEOPTS >/dev/null
+ #sudo python tools/install.py install >/dev/null
+ #cd ..
+ #rm -rf node-v*
+
cd fdk-aac-0.1.3
./configure --disable-shared --disable-dependency-tracking --quiet
make $MAKEOPTS >/dev/null
@@ -66,6 +74,9 @@ case "$1" in
cd ..
rm -rf libvpx-v1.3.0
+ cd apngasm-2.8
+
+
cd ffmpeg
./configure --disable-everything --disable-logging --disable-programs --disable-runtime-cpudetect --enable-decoder=mpeg4 --enable-decoder=pcm_s16le --enable-decoder=vorbis --enable-decoder=rawvideo --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=wav --enable-demuxer=yuv4mpegpipe --enable-encoder=libfdk_aac --enable-encoder=libopus --enable-encoder=libtheora --enable-encoder=libvpx_vp8 --enable-encoder=libvpx_vp9 --enable-encoder=libx264 --enable-encoder=pcm_s16le --enable-encoder=rawvideo --enable-ffmpeg --enable-filter=aresample --enable-gpl --enable-hardcoded-tables --enable-libfdk_aac --enable-libopus --enable-libtheora --enable-libvpx --enable-libx264 --enable-muxer=ipod --enable-muxer=mp4 --enable-muxer=ogg --enable-muxer=wav --enable-muxer=webm --enable-muxer=yuv4mpegpipe --enable-nonfree --enable-protocol=file
make $MAKEOPTS >/dev/null
diff --git a/Makefile b/Makefile
index 1222453..48d7503 100644
--- a/Makefile
+++ b/Makefile
@@ -2,24 +2,32 @@ null :=
SPACE := $(null) $(null)
FFMPEG ?= ffmpeg
-FFMPEG += -v warning -y
+FFMPEG := $(FFMPEG) -v warning -y $(FFMPEGFLAGS)
CWEBP ?= cwebp
-CWEBP += -quiet -alpha_cleanup -m 6
+CWEBP := $(CWEBP) -quiet -alpha_cleanup -m 6 $(CWEBPFLAGS)
WEBPMUX ?= webpmux
+WEBPMUX := $(WEBPMUX) $(WEBPMUXFLAGS)
CONVERT ?= convert
+CONVERT := $(CONVERT) $(CONVERTFLAGS)
APNGASM ?= apngasm
+APNGASM := $(APNGASM) $(APNGASMFLAGS)
NPM ?= npm
-NPM += --quiet
+NPM := $(NPM) --quiet $(NPMFLAGS)
JS_COMPRESSOR ?= uglifyjs
LOCAL_UGLIFYJS := node_modules/.bin/uglifyjs
UGLIFYJS ?= $(LOCAL_UGLIFYJS)
+UGLIFYJS := $(UGLIFYJS) $(UGLIFYJSFLAGS)
PACKR ?= packr
CLOSURE_COMPILER ?= java -jar compiler.jar
ifndef MINIMAL
ZOPFLIPNG ?= zopflipng
+ZOPFLIPNG := $(ZOPFLIPNG) $(ZOPFLIPNGFLAGS)
#DEFLOPT ?= wine DeflOpt
+#DEFLOPT := $(DEFLOPT) $(DEFLOPTFLAGS)
DEFLUFF ?= defluff
+DEFLUFF := $(DEFLUFF) $(DEFLUFFFLAGS)
PNGQUANT ?= pngquant
+PNGQUANT := $(PNGQUANT) $(PNGQUANTFLAGS)
endif
GZIP := $(shell unrpyc/find-gzip.sh)
@@ -226,8 +234,8 @@ define png2webp =
$(CWEBP) -q 99 "$<" -o "$@"
$(if $(PNGQUANT), $(PNGQUANT) --force --speed 1 --ext .png "$<")
$(if $(ZOPFLIPNG), $(ZOPFLIPNG) -m -y "$<" "$<")
- $(if $(DEFLOPT), $(DEFLOPT) "$<")
- $(if $(DEFLUFF), $(DEFLUFF) < "$<" > "$<".tmp
+ $(if $(DEFLOPT), $(DEFLOPT) "$<")
+ $(if $(DEFLUFF), $(DEFLUFF) < "$<" > "$<".tmp
mv -f "$<".tmp "$<")
endef
@@ -278,7 +286,7 @@ dev:
# disable implicit rules, increases `make` speed by 3 seconds
# also check symlink targets (for js)
-MAKEFLAGS=-r -L
+MAKEFLAGS=-LRr
.SUFFIXES:
.PRECIOUS: $(WAV)
diff --git a/Modernizr b/Modernizr
-Subproject bcbd353025e680b9a87df9e358ae1cf4e898728
+Subproject 0b9b9037ff53d4bed778d96cebe79c81c28c123
diff --git a/README.rst b/README.rst
index 71601fc..53b131b 100644
--- a/README.rst
+++ b/README.rst
@@ -19,7 +19,7 @@ Requirements
- Katawa Shoujo (obviously)
- Firefox/Chrome/a sensible browser (i.e. not IE)
- a shell (Bash, dash, zsh, etc)
-- GNU make
+- GNU make 3.82 or greater
- ffmpeg with fdk-aac, libopus, libtheora, libvpx-vp9, libx264 (preferably git HEAD)
- cwebp and webpmux from libwebp
- convert from ImageMagick
diff --git a/unrpyc/find-gzip.sh b/unrpyc/find-gzip.sh
index c9e8e00..c70b75a 100755
--- a/unrpyc/find-gzip.sh
+++ b/unrpyc/find-gzip.sh
@@ -1,7 +1,7 @@
#!/bin/sh
if command -v zopfli; then
:
-elif G=$(command -v gzip); [[ "$G" ]]; then
+elif G=$(command -v gzip); [ -n "$G" ]; then
echo >&2 "Consider obtaining zopfli (https://github.com/Hello71/zopfli) for higher"
echo >&2 "compression ratios (about 5% decrease in size of script.json.gz)."
echo "$G" -9
diff --git a/unrpyc/renpy/ast.py b/unrpyc/renpy/ast.py
index 5bfdb25..2f714ce 100644
--- a/unrpyc/renpy/ast.py
+++ b/unrpyc/renpy/ast.py
@@ -35,7 +35,7 @@ import collections
def next_node(n):
"""
- Indicates the next node that should be executed. When a statement
+ Indicates the next node that should be executed. When a statement
can crash, this should be set as early as possible, so that ignore
can bring us there.
"""
@@ -82,12 +82,12 @@ class ArgumentInfo(object):
def __newobj__(cls, *args):
- return cls.__new__(cls, *args)
+ return cls.__new__(cls, *args)
# This represents a string containing python code.
class PyExpr(str):
- __slots__ = [
+ __slots__ = [
'filename',
'linenumber',
]
@@ -100,7 +100,7 @@ class PyExpr(str):
def __getnewargs__(self):
return (str(self), self.filename, self.linenumber) # E1101
-
+
class PyCode(object):
__slots__ = [
@@ -152,11 +152,11 @@ class PyCode(object):
code = self.source
if isinstance(code, renpy.python.ast.AST): #@UndefinedVariable
code = renpy.python.ast.dump(code) #@UndefinedVariable
-
+
self.hash = chr(renpy.bytecode_version) + hashlib.md5(repr(self.location) + code.encode("utf-8")).digest()
return self.hash
-
-
+
+
def chain_block(block, next): #@ReservedAssignment
"""
This is called to chain together all of the nodes in a block. Node
@@ -189,7 +189,7 @@ class Scry(object):
else:
return self._next.scry()
-
+
class Node(object):
"""
A node in the abstract syntax tree of the program.
@@ -199,7 +199,7 @@ class Node(object):
@ivar filename: The filename where this node comes from.
@ivar linenumber: The line number of the line on which this node is defined.
"""
-
+
__slots__ = [
'name',
'filename',
@@ -214,12 +214,12 @@ class Node(object):
# Called to set the state of a Node, when necessary.
def __setstate__(self, state):
for k, v in state[1].items():
- try:
+ try:
setattr(self, k, v)
except AttributeError:
pass
-
-
+
+
def __init__(self, loc):
"""
Initializes this Node object.
@@ -231,7 +231,7 @@ class Node(object):
self.filename, self.linenumber = loc
self.name = None
self.next = None
-
+
def diff_info(self):
"""
Returns a tuple of diff info about ourself. This is used to
@@ -260,14 +260,14 @@ class Node(object):
"""
return None
-
+
def chain(self, next): #@ReservedAssignment
"""
This is called with the Node node that should be followed after
executing this node, and all nodes that this node
executes. (For example, if this node is a block label, the
next is the node that should be executed after all nodes in
- the block.)
+ the block.)
"""
self.next = next
@@ -275,7 +275,7 @@ class Node(object):
def execute(self):
"""
Causes this node to execute, and any action it entails to be
- performed. The node should call next_node with the node to
+ performed. The node should call next_node with the node to
be executed after this one.
"""
@@ -312,11 +312,11 @@ class Node(object):
"""
Called to restructure the AST.
- When this method is called, callback is called once for each child
+ When this method is called, callback is called once for each child
block of the node. The block, a list, can be updated by the callback
using slice assignment to the list.
"""
-
+
# Does nothing for nodes that do not contain child blocks.
return
@@ -324,7 +324,7 @@ class Node(object):
"""
Returns the canonical form of the code corresponding to this statement.
This only needs to be defined if the statement is translatable.
-
+
`filter`
If present, a filter that should be applied to human-readable
text in the statement.
@@ -350,7 +350,7 @@ def say_menu_with(expression, callback):
if renpy.game.preferences.transitions:
# renpy.game.interface.set_transition(what)
callback(what)
-
+
class Say(Node):
__slots__ = [
@@ -382,9 +382,9 @@ class Say(Node):
else:
self.who_fast = False
else:
- self.who = None
+ self.who = None
self.who_fast = False
-
+
self.what = what
self.with_ = with_
self.interact = interact
@@ -395,36 +395,36 @@ class Say(Node):
def get_code(self, dialogue_filter=None):
rv = [ ]
-
+
if self.who:
rv.append(self.who)
-
+
if self.attributes is not None:
rv.extend(self.attributes)
-
+
what = self.what
if dialogue_filter is not None:
what = dialogue_filter(what)
-
+
rv.append(renpy.translation.encode_say_string(what))
if not self.interact:
rv.append("nointeract")
- if self.with_:
+ if self.with_:
rv.append("with")
rv.append(self.with_)
return " ".join(rv)
def execute(self):
-
+
next_node(self.__next__)
try:
renpy.exports.say_attributes = self.attributes
-
+
if self.who is not None:
if self.who_fast:
who = getattr(renpy.store, self.who, None)
@@ -434,37 +434,37 @@ class Say(Node):
who = renpy.python.py_eval(self.who)
else:
who = None
-
+
if not (
(who is None) or
isinstance(who, collections.Callable) or
isinstance(who, str) ):
-
+
raise Exception("Sayer %s is not a function or string." % self.who.encode("utf-8"))
-
+
what = self.what
if renpy.config.say_menu_text_filter:
what = renpy.config.say_menu_text_filter(what) # E1102
-
+
if getattr(who, "record_say", True):
renpy.store._last_say_who = self.who
renpy.store._last_say_what = what
-
+
say_menu_with(self.with_, renpy.game.interface.set_transition)
renpy.exports.say(who, what, interact=self.interact)
finally:
renpy.exports.say_attributes = None
-
-
+
+
def predict(self):
old_attributes = renpy.exports.say_attributes
try:
-
+
renpy.exports.say_attributes = self.attributes
-
+
if self.who is not None:
if self.who_fast:
who = getattr(renpy.store, self.who)
@@ -472,21 +472,21 @@ class Say(Node):
who = renpy.python.py_eval(self.who)
else:
who = None
-
+
def predict_with(trans):
renpy.display.predict.displayable(trans(old_widget=None, new_widget=None))
-
+
say_menu_with(self.with_, predict_with)
-
+
what = self.what
if renpy.config.say_menu_text_filter:
what = renpy.config.say_menu_text_filter(what)
-
+
renpy.exports.predict_say(who, what)
finally:
renpy.exports.say_attributes = old_attributes
-
+
return [ self.__next__ ]
def scry(self):
@@ -500,13 +500,13 @@ class Say(Node):
else:
who = None
- if self.interact:
+ if self.interact:
renpy.exports.scry_say(who, rv)
else:
rv.interacts = False
-
+
return rv
-
+
# Copy the descriptor.
setattr(Say, "with", Say.with_) # E1101
@@ -540,27 +540,27 @@ class Init(Node):
def execute(self):
next_node(self.__next__)
-
+
def restructure(self, callback):
callback(self.block)
-
+
def apply_arguments(params, args, kwargs):
"""
Applies arguments to parameters to update scope.
-
+
`scope`
A dict.
-
+
`params`
The parameters object.
-
+
`args`, `kwargs`
Positional and keyword arguments.
"""
-
+
values = { }
rv = { }
-
+
if args is None:
args = ()
@@ -572,7 +572,7 @@ def apply_arguments(params, args, kwargs):
raise Exception("Arguments supplied, but parameter list not present")
else:
return rv
-
+
for name, value in zip(params.positional, args):
if name in values:
raise Exception("Parameter %s has two values." % name)
@@ -594,11 +594,11 @@ def apply_arguments(params, args, kwargs):
raise Exception("Required parameter %s has no value." % name)
else:
rv[name] = renpy.python.py_eval(default)
-
+
else:
rv[name] = values[name]
del values[name]
-
+
# Now, values has the left-over keyword arguments, and extrapos
# has the left-over positional arguments.
@@ -614,7 +614,7 @@ def apply_arguments(params, args, kwargs):
raise Exception("Unknown keyword arguments: %s" % ( ", ".join(list(values.keys()))))
return rv
-
+
class Label(Node):
__slots__ = [
@@ -628,7 +628,7 @@ class Label(Node):
self.parameters = None
self.hide = False
Node.__setstate__(self, state)
-
+
def __init__(self, loc, name, block, parameters, hide=False):
"""
Constructs a new Label node.
@@ -649,7 +649,7 @@ class Label(Node):
return (Label, self.name)
def get_children(self):
- return self.block
+ return self.block
def chain(self, next): #@ReservedAssignment
@@ -658,12 +658,12 @@ class Label(Node):
chain_block(self.block, next)
else:
self.next = next
-
+
def execute(self):
next_node(self.__next__)
renpy.game.context().mark_seen()
-
+
values = apply_arguments(self.parameters, renpy.store._args, renpy.store._kwargs)
for k, v in values.items():
@@ -699,7 +699,7 @@ class Python(Node):
@param hide: If True, the code will be executed with its
own local dictionary.
"""
-
+
super(Python, self).__init__(loc)
self.hide = hide
@@ -714,11 +714,11 @@ class Python(Node):
def execute(self):
next_node(self.__next__)
-
- try:
+
+ try:
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
finally:
-
+
if not renpy.game.context().init_phase:
for i in renpy.config.python_callbacks:
i()
@@ -747,7 +747,7 @@ class EarlyPython(Node):
@param hide: If True, the code will be executed with its
own local dictionary.
"""
-
+
super(EarlyPython, self).__init__(loc)
self.hide = hide
@@ -762,7 +762,7 @@ class EarlyPython(Node):
def early_execute(self):
renpy.python.create_store(self.store)
-
+
if self.code.bytecode:
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
@@ -783,7 +783,7 @@ class Image(Node):
"""
super(Image, self).__init__(loc)
-
+
self.imgname = name
if expr:
@@ -792,8 +792,8 @@ class Image(Node):
else:
self.code = None
self.atl = atl
-
- def diff_info(self):
+
+ def diff_info(self):
return (Image, tuple(self.imgname))
def execute(self):
@@ -811,7 +811,7 @@ class Image(Node):
renpy.exports.image(self.imgname, img)
-
+
class Transform(Node):
__slots__ = [
@@ -823,20 +823,20 @@ class Transform(Node):
'atl',
# The parameters associated with the transform, if any.
- 'parameters',
+ 'parameters',
]
default_parameters = ParameterInfo([ ], [ ], None, None)
-
+
def __init__(self, loc, name, atl=None, parameters=default_parameters):
super(Transform, self).__init__(loc)
-
+
self.varname = name
self.atl = atl
self.parameters = parameters
-
- def diff_info(self):
+
+ def diff_info(self):
return (Transform, self.varname)
def execute(self):
@@ -852,7 +852,7 @@ class Transform(Node):
renpy.dump.transforms.append((self.varname, self.filename, self.linenumber))
setattr(renpy.store, self.varname, trans)
-
+
def predict_imspec(imspec, scene=False, atl=None):
"""
Call this to use the given callback to predict the image named
@@ -867,8 +867,8 @@ def predict_imspec(imspec, scene=False, atl=None):
elif len(imspec) == 3:
name, _at_list, layer = imspec
-
-
+
+
if expression:
try:
img = renpy.python.py_eval(expression)
@@ -887,36 +887,36 @@ def predict_imspec(imspec, scene=False, atl=None):
if scene:
renpy.game.context().images.predict_scene(layer)
-
+
renpy.game.context().images.predict_show(tag or name, layer)
-
+
if atl is not None:
try:
img = renpy.display.motion.ATLTransform(atl, child=img)
except:
import traceback
traceback.print_exc()
-
+
renpy.display.predict.displayable(img)
-
+
def show_imspec(imspec, atl=None):
if len(imspec) == 7:
name, expression, tag, at_list, layer, zorder, behind = imspec
-
+
elif len(imspec) == 6:
name, expression, tag, at_list, layer, zorder = imspec
behind = [ ]
-
+
elif len(imspec) == 3:
name, at_list, layer = imspec
expression = None
tag = None
zorder = None
behind = [ ]
-
+
if zorder is not None:
zorder = renpy.python.py_eval(zorder)
else:
@@ -954,19 +954,19 @@ class Show(Node):
self.imspec = imspec
self.atl = atl
-
- def diff_info(self):
+
+ def diff_info(self):
return (Show, tuple(self.imspec[0]))
def execute(self):
next_node(self.__next__)
-
+
show_imspec(self.imspec, atl=getattr(self, "atl", None))
def predict(self):
predict_imspec(self.imspec, atl=getattr(self, "atl", None))
return [ self.__next__ ]
-
+
class Scene(Node):
@@ -989,7 +989,7 @@ class Scene(Node):
self.layer = layer
self.atl = atl
- def diff_info(self):
+ def diff_info(self):
if self.imspec:
data = tuple(self.imspec[0])
@@ -1006,15 +1006,15 @@ class Scene(Node):
if self.imspec:
show_imspec(self.imspec, atl=getattr(self, "atl", None))
-
+
def predict(self):
-
+
if self.imspec:
predict_imspec(self.imspec, atl=getattr(self, "atl", None), scene=True)
return [ self.__next__ ]
-
+
class Hide(Node):
__slots__ = [
@@ -1032,7 +1032,7 @@ class Hide(Node):
self.imspec = imgspec
- def diff_info(self):
+ def diff_info(self):
return (Hide, tuple(self.imspec[0]))
def predict(self):
@@ -1052,11 +1052,11 @@ class Hide(Node):
if tag is None:
tag = name[0]
-
+
renpy.game.context().images.predict_hide(tag, layer)
return [ self.__next__ ]
-
+
def execute(self):
next_node(self.__next__)
@@ -1070,10 +1070,10 @@ class Hide(Node):
name, _expression, tag, _at_list, layer, _zorder = self.imspec
elif len(self.imspec) == 7:
name, _expression, tag, _at_list, layer, _zorder, _behind = self.imspec
-
+
renpy.config.hide(tag or name, layer)
-
+
class With(Node):
__slots__ = [
@@ -1084,7 +1084,7 @@ class With(Node):
def __setstate__(self, state):
self.paired = None
Node.__setstate__(self, state)
-
+
def __init__(self, loc, expr, paired=None):
"""
@param expr: An expression giving a transition or None.
@@ -1096,7 +1096,7 @@ class With(Node):
def diff_info(self):
return (With, self.expr)
-
+
def execute(self):
next_node(self.__next__)
@@ -1106,7 +1106,7 @@ class With(Node):
if self.paired is not None:
paired = renpy.python.py_eval(self.paired)
else:
- paired = None
+ paired = None
renpy.exports.with_statement(trans, paired)
@@ -1121,10 +1121,10 @@ class With(Node):
except:
pass
-
+
return [ self.__next__ ]
-
-
+
+
class Call(Node):
__slots__ = [
@@ -1136,7 +1136,7 @@ class Call(Node):
def __setstate__(self, state):
self.arguments = None
Node.__setstate__(self, state)
-
+
def __init__(self, loc, label, expression, arguments):
super(Call, self).__init__(loc)
@@ -1187,7 +1187,7 @@ class Call(Node):
renpy.store._args = tuple(args)
renpy.store._kwargs = kwargs
-
+
def predict(self):
if self.expression:
return [ ]
@@ -1207,11 +1207,11 @@ class Return(Node):
def __setstate__(self, state):
self.expression = None
Node.__setstate__(self, state)
-
+
def __init__(self, loc, expression):
super(Return, self).__init__(loc)
self.expression = expression
-
+
def diff_info(self):
return (Return, )
@@ -1228,7 +1228,7 @@ class Return(Node):
renpy.store._return = None
renpy.game.context().pop_dynamic()
-
+
next_node(renpy.game.context().lookup_return(pop=True))
def predict(self):
@@ -1243,7 +1243,7 @@ class Return(Node):
rv._next = None
return rv
-
+
class Menu(Node):
__slots__ = [
@@ -1285,8 +1285,8 @@ class Menu(Node):
next_node(self.__next__)
choices = [ ]
- narration = [ ]
-
+ narration = [ ]
+
for i, (label, condition, block) in enumerate(self.items):
if renpy.config.say_menu_text_filter:
@@ -1303,7 +1303,7 @@ class Menu(Node):
if narration:
renpy.exports.say(None, "\n".join(narration), interact=False)
-
+
say_menu_with(self.with_, renpy.game.interface.set_transition)
choice = renpy.exports.menu(choices, self.set)
@@ -1311,7 +1311,7 @@ class Menu(Node):
next_node(self.items[choice][2][0])
else:
next_node(self.__next__)
-
+
def predict(self):
rv = [ ]
@@ -1322,7 +1322,7 @@ class Menu(Node):
say_menu_with(self.with_, predict_with)
renpy.store.predict_menu()
-
+
for _label, _condition, block in self.items:
if block:
rv.append(block[0])
@@ -1334,17 +1334,17 @@ class Menu(Node):
rv._next = None
rv.interacts = True
return rv
-
+
def restructure(self, callback):
for _label, _condition, block in self.items:
if block is not None:
callback(block)
-
+
setattr(Menu, "with", Menu.with_) # E1101
# Goto is considered harmful. So we decided to name it "jump"
-# instead.
+# instead.
class Jump(Node):
__slots__ = [
@@ -1390,7 +1390,7 @@ class Jump(Node):
rv._next = None
else:
rv._next = renpy.game.script.lookup(self.target)
-
+
return rv
@@ -1438,7 +1438,7 @@ class While(Node):
def predict(self):
return [ self.block[0], self.__next__ ]
-
+
def scry(self):
rv = Node.scry(self)
rv._next = None
@@ -1502,17 +1502,17 @@ class If(Node):
class UserStatement(Node):
- __slots__ = [
- 'line',
- 'parsed',
- 'block',
+ __slots__ = [
+ 'line',
+ 'parsed',
+ 'block',
'translatable' ]
def __setstate__(self, state):
self.block = [ ]
self.translatable = False
Node.__setstate__(self, state)
-
+
def __init__(self, loc, line, block):
super(UserStatement, self).__init__(loc)
@@ -1522,22 +1522,22 @@ class UserStatement(Node):
# Do not store the parse quite yet.
_parse_info = renpy.statements.parse(self, self.line, self.block)
-
+
def diff_info(self):
return (UserStatement, self.line)
def execute(self):
next_node(self.get_next())
-
+
self.call("execute")
def predict(self):
- self.call("predict")
+ self.call("predict")
return [ self.get_next() ]
-
+
def call(self, method, *args, **kwargs):
-
- parsed = self.parsed
+
+ parsed = self.parsed
if parsed is None:
parsed = renpy.statements.parse(self, self.line, self.block)
self.parsed = parsed
@@ -1550,17 +1550,17 @@ class UserStatement(Node):
return renpy.game.script.lookup(rv)
else:
return self.__next__
-
+
def scry(self):
rv = Node.scry(self)
rv._next = self.get_next()
self.call("scry", rv)
return rv
-
+
def get_code(self, dialogue_filter=None):
return self.line
-
-
+
+
class Define(Node):
__slots__ = [
@@ -1577,11 +1577,11 @@ class Define(Node):
"""
super(Define, self).__init__(loc)
-
+
self.varname = name
self.code = PyCode(expr, loc=loc, mode='eval')
-
- def diff_info(self):
+
+ def diff_info(self):
return (Define, tuple(self.varname))
def execute(self):
@@ -1590,7 +1590,7 @@ class Define(Node):
value = renpy.python.py_eval_bytecode(self.code.bytecode)
renpy.dump.definitions.append((self.varname, self.filename, self.linenumber))
- setattr(renpy.store, self.varname, value)
+ setattr(renpy.store, self.varname, value)
class Screen(Node):
@@ -1608,10 +1608,10 @@ class Screen(Node):
"""
super(Screen, self).__init__(loc)
-
+
self.screen = screen
-
- def diff_info(self):
+
+ def diff_info(self):
return (Screen, self.screen.name)
def execute(self):
@@ -1626,31 +1626,31 @@ class Screen(Node):
class Translate(Node):
"""
- A translation block, produced either by explicit translation statements
+ A translation block, produced either by explicit translation statements
or implicit translation blocs.
-
- If language is None, when executed this transfers control to the translate
+
+ If language is None, when executed this transfers control to the translate
statement in the current language, if any, and otherwise runs the block.
- If language is not None, causes an error to occur if control reaches this
+ If language is not None, causes an error to occur if control reaches this
statement.
- When control normally leaves a translate statement, in any language, it
+ When control normally leaves a translate statement, in any language, it
goes to the end of the translate statement in the None language.
"""
-
+
__slots__ = [
"identifier",
"language",
"block",
]
-
+
def __init__(self, loc, identifier, language, block):
super(Translate, self).__init__(loc)
-
+
self.identifier = identifier
self.language = language
self.block = block
-
+
def diff_info(self):
return (Translate, self.identifier, self.language)
@@ -1663,63 +1663,63 @@ class Translate(Node):
if self.language is not None:
next_node(self.__next__)
raise Exception("Translation nodes cannot be run directly.")
-
+
next_node(renpy.game.script.translator.lookup_translate(self.identifier))
renpy.game.context().translate_identifier = self.identifier
def predict(self):
node = renpy.game.script.translator.lookup_translate(self.identifier)
return [ node ]
-
+
def scry(self):
rv = Scry()
rv._next = renpy.game.script.translator.lookup_translate(self.identifier)
return rv
-
+
def get_children(self):
return self.block
-
+
def restructure(self, callback):
return callback(self.block)
-
-
+
+
class EndTranslate(Node):
"""
A node added implicitly after each translate block. It's responsible for
resetting the translation identifier.
"""
-
+
def __init__(self, loc):
super(EndTranslate, self).__init__(loc)
-
+
def diff_info(self):
return (EndTranslate,)
-
+
def execute(self):
next_node(self.__next__)
renpy.game.context().translate_identifier = None
-
+
class TranslateString(Node):
"""
A node used for translated strings.
"""
-
- __slots__ = [
+
+ __slots__ = [
"language",
"old",
"new"
]
-
+
def __init__(self, loc, language, old, new):
super(TranslateString, self).__init__(loc)
self.language = language
self.old = old
self.new = new
-
+
def diff_info(self):
return (TranslateString,)
-
+
def execute(self):
next_node(self.__next__)
renpy.translation.add_string_translation(self.language, self.old, self.new)
@@ -1738,7 +1738,7 @@ class TranslatePython(Node):
@param hide: If True, the code will be executed with its
own local dictionary.
"""
-
+
super(TranslatePython, self).__init__(loc)
self.language = language
@@ -1754,4 +1754,4 @@ class TranslatePython(Node):
# renpy.python.create_store(self.store)
# renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
-
+