Compare commits

...

27 Commits

Author SHA1 Message Date
Tom Rothamel e31f1ac63f Mark one pylint spurious warning. 2010-01-10 15:42:11 -05:00
Tom Rothamel 33a6c97446 Finalize changelog. 2010-01-10 15:37:57 -05:00
Tom Rothamel 99e9e6e9ba Bump version to 6.10.2a. 2010-01-10 15:34:31 -05:00
Tom Rothamel 1d81cede71 Unpack ScaledSurfaces before using them as a sample for an alpha channel. 2010-01-10 01:52:00 -05:00
Tom Rothamel 54ab9e0f1b Add copyright information to files that have it missing. 2010-01-09 13:25:18 -05:00
Tom Rothamel f0df9a7a05 Bump copyright to 2010. 2010-01-09 13:14:42 -05:00
Tom Rothamel adc3bf820b Fixed a bug that caused the overlay to display twice in some cases. 2010-01-05 18:07:28 -05:00
Tom Rothamel d26ac890a5 Add the ability to pin images into the cache, using the renpy.cache_pin function. 2010-01-05 02:30:39 -05:00
Tom Rothamel d0397b2111 The new config.automatic_images_strip variable can strip out prefixes
when automatically defining images.
2010-01-03 16:32:21 -05:00
Tom Rothamel 0229de3f0d The new config.menu_clear_layers variable allows layers to be cleared
when entering the game menu. This makes it easier for a layer to have 
overlay-like things on it when in the game, but not when in the game
menu.
2010-01-03 16:25:20 -05:00
Tom Rothamel 176150be7f Add renpylint script, a wrapper around pylint that gets rid of some
false positives where pylint isn't able to fully analyze Ren'Py.

Add annotations to Ren'Py to further supress false positives. The result
is that we can now run pylint and pick out regressions.
2010-01-02 02:38:07 -05:00
Tom Rothamel 04992fa431 Flag spurious pylint warnings, in the renpy/ directory. 2010-01-01 16:30:38 -05:00
Tom Rothamel b26725fd01 pylint done. 2010-01-01 15:09:36 -05:00
Tom Rothamel 601e7b1949 pylint: Initial pass through renpy directory. 2010-01-01 14:27:20 -05:00
Tom Rothamel 37c1571792 pylint: ast.py and atl.py 2010-01-01 13:30:39 -05:00
Tom Rothamel 812144bdf0 Fixed a bug that caused pixellate to crash. 2009-12-31 16:16:20 -05:00
Tom Rothamel 6e616fda4e When a music filename is unknown, remove it from the loop, so we don't keep
trying to access it.
2009-12-31 15:44:40 -05:00
Tom Rothamel 3f120ce658 Ren'Py now caches the individual words of text that are rendered. This
can lead to a speedup in text display when there are many words of
text on the screen, and that text is re-displayed, as is the case
where the text text speed is not the maximum. This is especially 
beneficial for eastasian languages, where every character is treated
as a word.
2009-12-30 16:24:18 -05:00
Tom Rothamel 5446da46dc Ren'Py now caches the individual words of text that are rendered. This
can lead to a speedup in text display when there are many words of
text on the screen, and that text is re-displayed, as is the case
where the text text speed is not the maximum. This is especially 
beneficial for eastasian languages, where every character is treated
as a word.
2009-12-30 15:41:29 -05:00
Tom Rothamel 172efcac94 Surface creation parameter was missing when creating a Frame with tile=True.
Fixes lp:501351.
2009-12-30 00:24:27 -05:00
Tom Rothamel c5ce6c0f4b Bump version. 2009-12-17 09:36:36 -05:00
Tom Rothamel 40f8644ac2 Export time from renpy.exports. 2009-12-17 09:35:34 -05:00
Tom Rothamel d45cf0d79a Bump version. 2009-12-16 19:17:18 -05:00
Tom Rothamel 68937a71b9 Add developer menu to string scanner. 2009-12-14 22:06:00 -05:00
Tom Rothamel db435f5a0a Bump version. 2009-12-14 19:06:43 -05:00
Tom Rothamel 40c469fa23 Add ctc_timedpause. 2009-12-14 19:04:10 -05:00
Tom Rothamel fe7c7e2299 Decode the tutorial properly, so international characters can be used. 2009-12-14 16:51:43 -05:00
100 changed files with 749 additions and 327 deletions
+41
View File
@@ -1,3 +1,44 @@
New in Ren'Py 6.10.2
--------------------
Ren'Py now caches the individual words of text that are rendered. This
can lead to a speedup in text display when there are many words of
text on the screen, and that text is re-displayed, as is the case
where the text text speed is not the maximum. This is especially
beneficial for eastasian languages, where every character is treated
as a word.
The new config.menu_clear_layers variable allows layers to be cleared
when entering the game menu. This makes it easier for a layer to have
overlay-like things on it when in the game, but not when in the game
menu.
The new renpy.cache_pin function pins images into memory, loading them
as soon as possible and keeping them loaded.
The new config.automatic_images_strip variable can strip out prefixes
when automatically defining images.
Ren'Py will now ignore music files that do not exist. Previously, it
could loop trying to play them. (This would increase CPU usage, rather
than causing a crash.)
The following numbered bugs were fixed:
* lp:501351 - Displaying a Frame() with tile=True crashes
In addition:
* Fixed a bug that caused pixellate to crash.
* Fixed a bug that caused the overlay to display twice in some cases.
New in Ren'Py 6.10.1
--------------------
+1
View File
@@ -40,6 +40,7 @@ if __name__ == "__main__":
files += glob.glob("launcher/*.rpy")
files += glob.glob("common/*.rpy")
files += glob.glob("common/*.rpym")
files += glob.glob("common/_layout/*.rpym")
files += glob.glob("common/_compat/*.rpym")
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# This file contains warpers that are used by ATL. They need to be defined
# early, so Ren'Py knows about them when parsing other files.
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init -1210 python:
# This is called when script_version is set, to immediately
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# This file contains a number of definitions of standard
# locations and transitions. We've moved them into the common
# directory so that it's easy for an updated version of all of these
+2 -4
View File
@@ -1,7 +1,5 @@
# Copyright 2004-2007 PyTom
#
# Please see the LICENSE.txt distributed with Ren'Py for permission to
# copy and modify.
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init -1105 python:
+20 -4
View File
@@ -1,7 +1,5 @@
# Copyright 2004-2007 PyTom
#
# Please see the LICENSE.txt distributed with Ren'Py for permission to
# copy and modify.
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# This file consists of renpy functions that aren't expected to be
# touched by the user too much. We reserve the _ prefix for names
@@ -52,8 +50,14 @@ init -1180 python:
# Should we automatically define images?
config.automatic_images = None
# Prefixes to strip from automatic images.
config.automatic_images_strip = [ ]
# A save to automatically load, if it exists.
config.auto_load = None
# Layers to clear when entering the menus.
config.menu_clear_layers = [ ]
# This is updated to give the user an idea of where a save is
# taking place.
@@ -528,6 +532,9 @@ label _enter_menu:
renpy.movie_stop(only_fullscreen=True)
renpy.take_screenshot((config.thumbnail_width, config.thumbnail_height))
for i in config.menu_clear_layers:
renpy.scene(layer=i)
renpy.context()._menu = True
# This may be changed, if we are already in the main menu.
@@ -783,6 +790,15 @@ init 1180 python hide:
name = ( shortfn, )
for sep in seps:
name = tuple(j for i in name for j in i.split(sep))
# Strip name components.
while name:
for i in config.automatic_images_strip:
if name[0] == i:
name.pop(0)
break
else:
break
# Only names of 2 components or more.
if len(name) < 2:
+2 -4
View File
@@ -1,7 +1,5 @@
# Copyright 2008 PyTom
#
# Please see the LICENSE.txt distributed with Ren'Py for permission to
# copy and modify.
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# Common stuff that's used by the various Ren'Py menus. This includes
# the default definitions of config.main_menu and config.game_menu, as
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# This file contains code that sets up the various mixers, based on how
# the user sets config.has_music, .has_sound, and .has_voice.
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# This is an implementation of NVL-mode, which can be used to show
# dialogue in a fullscreen way, like NVL-style games. Multiple lines
# of dialogue are shown on the screen at once, whenever a line of
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# This file contains code that creates a few new statements. We'll
# also describe here the API for defining your own statements.
#
+2 -4
View File
@@ -1,7 +1,5 @@
# Copyright 2004-2008 PyTom
#
# Please see the LICENSE.txt distributed with Ren'Py for permission to
# copy and modify.
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# This file is responsible for creating and defining the default styles
# used by the system.
+2 -4
View File
@@ -1,7 +1,5 @@
# Copyright 2004-2008 PyTom
#
# Please see the LICENSE.txt distributed with Ren'Py for permission to
# copy and modify.
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init -1110 python:
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# This extra contains a basic implementation of voice support. Right
# now, voice is given its own toggle, and can either be turned on or
# turned off. In the future, we'll probably provide some way of
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
######################################################################
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init:
python:
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init -1170 python hide:
config.old_names['Quit'] = 'Quit Game'
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# Copyright 2004-2006 PyTom
#
# Please see the LICENSE.txt distributed with Ren'Py for permission to
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python hide:
style.menu_button = Style(style.button, heavy=True, help='Buttons that are part of the main or game menus.')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
# Copyright 2004-2007 PyTom
#
# Please see the LICENSE.txt distributed with Ren'Py for permission to
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('joystick_preferences')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('load_save')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('main_menu')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('navigation')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('preferences')
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
# Styles
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python hide:
layout.provides('yesno_prompt')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('main_menu')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('navigation')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
class _ImageMapper(object):
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('load_save')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('main_menu')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('navigation')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('preferences')
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python hide:
layout.provides('yesno_prompt')
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('preferences')
+3
View File
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('load_save')
@@ -1,3 +1,6 @@
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
# See LICENSE.txt for license details.
init python:
layout.provides('preferences')
+1 -1
View File
@@ -1,3 +1,3 @@
init -999:
$ config.script_version = (6, 10, 1)
$ config.script_version = (6, 10, 2)
+9
View File
@@ -64,6 +64,15 @@ init python:
u"Joystick...",
u"Joystick Configuration",
u"Voice Volume",
u"Developer Menu",
u"Return to the developer menu",
u"Reload Game (Shift+R)",
u"Variable Viewer",
u"Theme Test",
u"Style Hierarchy",
u"FPS Meter",
u"Image Location Picker",
u"Done",
u"Auto",
u"Quick",
u"The patterns did not match any files, so no archive was created.",
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# Copyright 2004-2007 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -27,7 +27,7 @@
# ***** ***** ***** ***** ***** ***** **** ***** ***** ***** *****
# Be sure to change script_version in launcher/script_version.rpy, too!
# Also check to see if we have to update renpy.py.
version = "Ren'Py 6.10.1a"
version = "Ren'Py 6.10.2a"
script_version = 5003000
savegame_suffix = "-LT1.save"
+8 -7
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -92,7 +92,7 @@ class PyExpr(unicode):
return self
def __getnewargs__(self):
return (unicode(self), self.filename, self.linenumber)
return (unicode(self), self.filename, self.linenumber) # E1101
class PyCode(object):
@@ -186,6 +186,7 @@ class Node(object):
self.filename, self.linenumber = loc
self.name = None
self.next = None
def diff_info(self):
"""
@@ -266,7 +267,7 @@ class Node(object):
"""
rv = Scry()
rv._next = self.next
rv._next = self.next # W0201
return rv
def say_menu_with(expression, callback):
@@ -334,7 +335,7 @@ class Say(Node):
what = self.what
if renpy.config.say_menu_text_filter:
what = renpy.config.say_menu_text_filter(what)
what = renpy.config.say_menu_text_filter(what) # E1102
say_menu_with(self.with_, renpy.game.interface.set_transition)
renpy.exports.say(who, what, interact=getattr(self, 'interact', True))
@@ -372,11 +373,11 @@ class Say(Node):
def scry(self):
rv = Node.scry(self)
rv.interacts = True
rv.interacts = True # W0201
return rv
# Copy the descriptor.
setattr(Say, "with", Say.with_)
setattr(Say, "with", Say.with_) # E1101
class Init(Node):
@@ -1154,7 +1155,7 @@ class Menu(Node):
rv.interacts = True
return rv
setattr(Menu, "with", Menu.with_)
setattr(Menu, "with", Menu.with_) # E1101
# Goto is considered harmful. So we decided to name it "jump"
+56 -24
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -175,6 +175,8 @@ class ATLTransformBase(renpy.object.Object):
parameters = renpy.ast.ParameterInfo([ ], [ ], None, None)
def __init__(self, atl, context, parameters):
super(ATLTransformBase, self).__init__()
if parameters is None:
parameters = ATLTransformBase.parameters
@@ -366,6 +368,10 @@ class ATLTransformBase(renpy.object.Object):
# The base class for raw ATL statements.
class RawStatement(renpy.object.Object):
def __init__(self, loc):
super(RawStatement, self).__init__()
self.loc = loc
# Compiles this RawStatement into a Statement, by using ctx to
# evaluate expressions as necessary.
def compile(self, ctx):
@@ -379,6 +385,10 @@ class RawStatement(renpy.object.Object):
# The base class for compiled ATL Statements.
class Statement(renpy.object.Object):
def __init__(self, loc):
super(Statement, self).__init__()
self.loc = loc
# trans is the transform we're working on.
# st is the time since this statement started executing.
# state is the state stored by this statement, or None if
@@ -419,7 +429,7 @@ class RawBlock(RawStatement):
def __init__(self, loc, statements, animation):
self.loc = loc
super(RawBlock, self).__init__(loc)
# A list of RawStatements in this block.
self.statements = statements
@@ -442,7 +452,7 @@ class RawBlock(RawStatement):
class Block(Statement):
def __init__(self, loc, statements):
self.loc = loc
super(Block, self).__init__(loc)
# A list of statements in the block.
self.statements = statements
@@ -577,7 +587,7 @@ class RawMultipurpose(RawStatement):
def __init__(self, loc):
self.loc = loc
super(RawMultipurpose, self).__init__(loc)
self.warper = None
self.duration = None
@@ -716,7 +726,9 @@ class RawMultipurpose(RawStatement):
class RawContainsExpr(RawStatement):
def __init__(self, loc, expr):
self.loc = loc
super(RawContainsExpr, self).__init__(loc)
self.expression = expr
def compile(self, ctx):
@@ -729,7 +741,9 @@ class RawContainsExpr(RawStatement):
class RawChild(RawStatement):
def __init__(self, loc, child):
self.loc = loc
super(RawChild, self).__init__(loc)
self.children = [ child ]
def compile(self, ctx):
@@ -745,8 +759,9 @@ class RawChild(RawStatement):
class Child(Statement):
def __init__(self, loc, child, transition):
self.loc = loc
super(Child, self).__init__(loc)
self.child = renpy.easy.displayable(child)
self.transition = transition
@@ -775,7 +790,9 @@ class Child(Statement):
class Interpolation(Statement):
def __init__(self, loc, warper, duration, properties, revolution, circles, splines):
self.loc = loc
super(Interpolation, self).__init__(loc)
self.warper = warper
self.duration = duration
self.properties = properties
@@ -899,7 +916,9 @@ class Interpolation(Statement):
class RawRepeat(RawStatement):
def __init__(self, loc, repeats):
self.loc = loc
super(RawRepeat, self).__init__(loc)
self.repeats = repeats
def compile(self, ctx):
@@ -916,7 +935,9 @@ class RawRepeat(RawStatement):
class Repeat(Statement):
def __init__(self, loc, repeats):
self.loc = loc
super(Repeat, self).__init__(loc)
self.repeats = repeats
def execute(self, trans, st, state, event):
@@ -928,7 +949,8 @@ class Repeat(Statement):
class RawParallel(RawStatement):
def __init__(self, loc, block):
self.loc = loc
super(RawParallel, self).__init__(loc)
self.blocks = [ block ]
def compile(self, ctx):
@@ -940,9 +962,9 @@ class RawParallel(RawStatement):
class Parallel(Statement):
def __init__(self, loc, blocks):
self.loc = loc
super(Parallel, self).__init__(loc)
self.blocks = blocks
def execute(self, trans, st, state, event):
@@ -989,7 +1011,8 @@ class Parallel(Statement):
class RawChoice(RawStatement):
def __init__(self, loc, chance, block):
self.loc = loc
super(RawChoice, self).__init__(loc)
self.choices = [ (chance, block) ]
def compile(self, ctx):
@@ -1003,7 +1026,9 @@ class RawChoice(RawStatement):
class Choice(Statement):
def __init__(self, loc, choices):
self.loc = loc
super(Choice, self).__init__(loc)
self.choices = choices
def execute(self, trans, st, state, event):
@@ -1044,7 +1069,8 @@ class Choice(Statement):
class RawTime(RawStatement):
def __init__(self, loc, time):
self.loc = loc
super(RawTime, self).__init__(loc)
self.time = time
def compile(self, ctx):
@@ -1054,7 +1080,8 @@ class RawTime(RawStatement):
class Time(Statement):
def __init__(self, loc, time):
self.loc = loc
super(Time, self).__init__(loc)
self.time = time
def execute(self, trans, st, state, event):
@@ -1066,7 +1093,8 @@ class Time(Statement):
class RawOn(RawStatement):
def __init__(self, loc, name, block):
self.loc = loc
super(RawOn, self).__init__(loc)
self.handlers = { name : block }
def compile(self, ctx):
@@ -1087,13 +1115,13 @@ class RawOn(RawStatement):
class On(Statement):
def __init__(self, loc, handlers):
self.loc = loc
super(On, self).__init__(loc)
self.handlers = handlers
def execute(self, trans, st, state, event):
executing(self.loc)
# If it's our first time through, start in the start state.
if state is None:
@@ -1166,7 +1194,8 @@ class On(Statement):
class RawEvent(RawStatement):
def __init__(self, loc, name):
self.loc = loc
super(RawEvent, self).__init__(loc)
self.name = name
def compile(self, ctx):
@@ -1176,7 +1205,8 @@ class RawEvent(RawStatement):
class Event(Statement):
def __init__(self, loc, name):
self.loc = loc
super(Event, self).__init__(loc)
self.name = name
def execute(self, trans, st, state, event):
@@ -1186,7 +1216,8 @@ class Event(Statement):
class RawFunction(RawStatement):
def __init__(self, loc, expr):
self.loc = loc
super(RawFunction, self).__init__(loc)
self.expr = expr
def compile(self, ctx):
@@ -1196,7 +1227,8 @@ class RawFunction(RawStatement):
class Function(Statement):
def __init__(self, loc, function):
self.loc = loc
super(Function, self).__init__(loc)
self.function = function
def execute(self, trans, st, state, event):
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+13 -8
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -142,6 +142,8 @@ class MusicContext(renpy.python.RevertableObject):
def __init__(self):
super(MusicContext, self).__init__()
# The time this channel was last ordered panned.
self.pan_time = None
@@ -286,7 +288,7 @@ class Channel(object):
rv = mcd.get(self.name)
if rv is None:
rv = mcd[self.name] = MusicContext();
rv = mcd[self.name] = MusicContext()
return rv
@@ -371,6 +373,12 @@ class Channel(object):
self.playing = True
except:
# If playing failed, remove topq.filename from self.loop
# so we don't keep trying.
while topq.filename in self.loop:
self.loop.remove(topq.filename)
if renpy.config.debug_sound:
raise
else:
@@ -387,7 +395,7 @@ class Channel(object):
# Queue empty callback.
if do_callback and self.callback:
self.callback()
self.callback() # E1102
def dequeue(self, even_tight=False):
"""
@@ -427,11 +435,9 @@ class Channel(object):
pss.set_secondary_volume(self.number,
self.context.secondary_volume,
0)
self.pan_delay = 0
if not self.queue and self.callback:
self.callback()
self.callback() # E1102
def fadeout(self, secs):
@@ -594,7 +600,6 @@ def init():
def quit():
global pcm_ok
global midi_ok
global mix_ok
if not pcm_ok:
@@ -782,7 +787,7 @@ def event(ev):
if ev.type == REFRESH_EVENT:
if renpy.audio.music.get_playing("movie"):
pss.refresh_event()
# Return False, as a Movie should get this to know when to
# redraw itself.
return False
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+8 -8
View File
@@ -54,7 +54,7 @@ def extra_imports():
import pygame.locals
import pygame.color
import pygame.colordict; pygame.colordict
import posixpath; posixpath
import posixpath; posixpath # W0403
import ctypes
import ctypes.wintypes; ctypes.wintypes
import EasyDialogs; EasyDialogs
@@ -90,15 +90,15 @@ def popen_del(self, _deadstate=sys.maxint):
self.poll(_deadstate=_deadstate)
try:
import subprocess
if self.returncode is None and subprocess._active is not None:
subprocess._active.append(self)
import subprocess # W0403
if self.returncode is None and subprocess._active is not None: # E1101
subprocess._active.append(self) # E1101
except:
pass
def bootstrap(renpy_base):
global renpy
global renpy # W0602
os.environ["RENPY_BASE"] = os.path.abspath(renpy_base)
@@ -226,12 +226,12 @@ def bootstrap(renpy_base):
# Show the presplash.
if not options.lint and not options.compile and not options.version and not options.rmpersistent:
import renpy.display.presplash
import renpy.display.presplash # W0404
renpy.display.presplash.start(gamedir)
# Fix an exception thrown by garbage collection.
import subprocess
subprocess.Popen.__del__ = popen_del
import subprocess # W0403
subprocess.Popen.__del__ = popen_del # E1101
# If we're on a mac, install our own os.start.
if sys.platform == "darwin":
+12 -9
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -42,7 +42,8 @@ def predict_show_display_say(who, what, who_args, what_args, window_args, image=
rv.append(renpy.game.style.say_who_window.background)
if image:
rv.append(renpy.display.im.image(who, True))
if image != "<Dynamic>":
rv.append(renpy.display.im.image(who, True))
if side_image:
rv.append(renpy.display.im.image(side_image, True))
@@ -213,7 +214,8 @@ def display_say(show_function,
with_none,
callback,
type,
checkpoint=True):
checkpoint=True,
ctc_timedpause=None):
# If we're in fast skipping mode, don't bother with say
@@ -288,14 +290,17 @@ def display_say(show_function,
# Update the properties of the what_text widget.
if pause is not None and pause < what_text.pauses:
what_ctc = ctc_pause
if what_text.pause_lengths[pause] is not None:
what_ctc = ctc_timedpause or ctc_pause
else:
what_ctc = ctc_pause
else:
what_ctc = ctc
what_ctc = renpy.easy.displayable_or_none(what_ctc)
if what_ctc is not None:
what_ctc = ctc.parameterize(('ctc',), ())
what_ctc = what_ctc.parameterize(('ctc',), ())
# This object is called when the slow text is done.
slow_done = SlowDone(what_ctc, ctc_position, callback, interact, type, cb_args)
@@ -322,7 +327,7 @@ def display_say(show_function,
c("show_done", interact=interact, type=type, **cb_args)
if behavior and afm:
behavior.set_afm_length(what_text.get_simple_length() - slow_start)
behavior.set_afm_length(what_text.get_simple_length() - slow_start) # E1103
if interact:
@@ -430,6 +435,7 @@ class ADVCharacter(object):
afm = d('afm'),
ctc = renpy.easy.displayable_or_none(d('ctc')),
ctc_pause = renpy.easy.displayable_or_none(d('ctc_pause')),
ctc_timedpause = renpy.easy.displayable_or_none(d('ctc_timedpause')),
ctc_position = d('ctc_position'),
all_at_once = d('all_at_once'),
with_none = d('with_none'),
@@ -566,9 +572,6 @@ class ADVCharacter(object):
def predict(self, what):
if self.dynamic and self.image:
return [ ]
if self.dynamic:
who = "<Dynamic>"
else:
+14 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -401,9 +401,21 @@ rtl = False
# A callback for file opening.
file_open_callback = None
# The size of screenshot thumbnails. (Redefined in common/)
thumbnail_width = None
thumbnail_height = None
# The end game transition.
end_game_transition = None
# Various directories.
gamedir = None
basedir = None
renpy_base = None
del renpy
def init():
import renpy
import renpy # W0404
global style_properties
style_properties = renpy.style.style_properties
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -76,7 +76,7 @@ class State(object):
def motion_copy(self, child):
if self.image is not None:
child = self.mage
child = self.image
return State(self.name, child, *self.atlist)
+14 -6
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -556,7 +556,7 @@ class Input(renpy.display.text.Text):
self.content = content
if self.changed:
self.change(content)
self.changed(content)
self.editable = editable
@@ -616,6 +616,8 @@ adj_registered = { }
class Adjustment(renpy.object.Object):
def __init__(self, range=1, value=0, step=None, page=0, changed=None, adjustable=True, ranged=None):
super(Adjustment, self).__init__()
self._value = value
self._range = range
self._page = page
@@ -701,11 +703,11 @@ class Bar(renpy.display.core.Displayable):
def after_upgrade(self, version):
if version < 1:
self.adjustment = Adjustment(self.range, self.value, changed=self.changed)
self.adjustment = Adjustment(self.range, self.value, changed=self.changed) # E1101
self.adjustment.register(self)
del self.range
del self.value
del self.changed
del self.range # E1101
del self.value # E1101
del self.changed # E1101
def __init__(self,
range=None,
@@ -733,6 +735,12 @@ class Bar(renpy.display.core.Displayable):
self.adjustment = adjustment
self.focusable = adjustment.adjustable
# These are set when we are first rendered.
self.thumb_dim = 0
self.height = 0
self.width = 0
self.hidden = False
def visit(self):
return [ self.style.fore_bar, self.style.aft_bar, self.style.thumb, self.style.thumb_shadow ]
+15 -6
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -100,7 +100,7 @@ class Displayable(renpy.object.Object):
# Can we change our look in response to transform_events?
transform_event_responder = False
def __init__(self, focus=None, default=False, style='default', **properties):
def __init__(self, focus=None, default=False, style='default', **properties): # W0231
self.style = renpy.style.Style(style, properties, heavy=True)
self.focus_name = focus
self.default = default
@@ -393,6 +393,8 @@ class ImagePredictInfo(renpy.object.Object):
def __init__(self, ipi=None):
super(ImagePredictInfo, self).__init__()
# layer -> (tag -> image name)
self.images = { }
@@ -458,9 +460,10 @@ class SceneLists(renpy.object.Object):
def __init__(self, oldsl, ipi):
super(SceneLists, self).__init__()
# Has a window been shown as part of these scene lists?
self.shown_window = False
# A map from layer name -> list of
# (key, zorder, show time, animation time, displayable)
@@ -609,12 +612,11 @@ class SceneLists(renpy.object.Object):
# is a transform, and then take the transform state.
thing = self.transform_state(old_thing, thing)
thing.set_transform_event("replace")
thing.show()
if zorder == zo:
if zorder == zo: # W0631
l[index] = (key, zorder, st, at, thing)
return
else:
@@ -1335,7 +1337,10 @@ class Interface(object):
# for contexts outside the current one. This is used to restore those
# in the case where nothing has changed in the new context.
self.transition_info_stack = [ ]
# The time when the event was dispatched.
self.event_time = 0
def take_screenshot(self, scale):
"""
@@ -1411,6 +1416,10 @@ class Interface(object):
self.old_scene = self.compute_scene(scene_lists)
# Get rid of transient things.
for i in renpy.config.overlay_layers:
scene_lists.clear(i)
scene_lists.replace_transient()
scene_lists.shown_window = False
+3 -3
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -40,7 +40,7 @@ class ReportError(object):
# In the report method, Ren'Py may be in an ill-defined state.
def report(self, error_type):
import os.path
import pygame
import pygame # W0404
pygame.display.init()
msg = "Ren'Py has experienced " + error_type + ".\n"
@@ -56,7 +56,7 @@ class ReportError(object):
y += self.font.get_linesize()
pygame.display.flip()
pygame.display.flip() # E1120
pygame.time.set_timer(pygame.USEREVENT + 1, 50)
+1 -4
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -176,9 +176,6 @@ def before_interact(roots):
# This changes the focus to be the widget contained inside the new
# focus object.
def change_focus(newfocus, default=False):
global argument
rv = None
if grab:
+27 -21
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -123,6 +123,8 @@ class SFont(ImageFont):
kerns,
charset):
super(SFont, self).__init__()
self.filename = filename
self.spacewidth = spacewidth
self.default_kern = default_kern
@@ -131,18 +133,18 @@ class SFont(ImageFont):
def load(self):
self.chars = { }
self.width = { }
self.advance = { }
self.offsets = { }
self.chars = { } # W0201
self.width = { } # W0201
self.advance = { } # W0201
self.offsets = { } # W0201
# Load in the image.
surf = renpy.display.im.Image(self.filename).load(unscaled=True)
sw, sh = surf.get_size()
height = sh
self.height = height
self.baseline = height
self.height = height # W0201
self.baseline = height # W0201
# Create space characters.
self.chars[u' '] = renpy.display.pgrender.surface((self.spacewidth, height), True)
@@ -201,6 +203,8 @@ class MudgeFont(ImageFont):
default_kern,
kerns):
super(MudgeFont, self).__init__()
self.filename = filename
self.xml = xml
self.spacewidth = spacewidth
@@ -209,10 +213,10 @@ class MudgeFont(ImageFont):
def load(self):
self.chars = { }
self.width = { }
self.advance = { }
self.offsets = { }
self.chars = { } # W0201
self.width = { } # W0201
self.advance = { } # W0201
self.offsets = { } # W0201
# Load in the image.
surf = renpy.display.im.Image(self.filename).load(unscaled=True)
@@ -245,8 +249,8 @@ class MudgeFont(ImageFont):
height = max(height, h)
self.height = height
self.baseline = height
self.height = height # W0201
self.baseline = height # W0201
# Create space characters.
if u' ' not in self.chars:
@@ -293,16 +297,18 @@ def parse_bmfont_line(l):
class BMFont(ImageFont):
def __init__(self, filename):
super(BMFont, self).__init__()
self.filename = filename
def load(self):
self.chars = { }
self.width = { }
self.advance = { }
self.offsets = { }
self.kerns = { }
self.default_kern = 0
self.chars = { } # W0201
self.width = { } # W0201
self.advance = { } # W0201
self.offsets = { } # W0201
self.kerns = { } # W0201
self.default_kern = 0 # W0201
pages = { }
@@ -312,8 +318,8 @@ class BMFont(ImageFont):
kind, args = parse_bmfont_line(l)
if kind == "common":
self.height = int(args["lineHeight"])
self.baseline = int(args["base"])
self.height = int(args["lineHeight"]) # W0201
self.baseline = int(args["base"]) # W0201
elif kind == "page":
pages[int(args["id"])] = renpy.display.im.Image(args["file"]).load(unscaled=True)
elif kind == "char":
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+82 -21
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -80,6 +80,13 @@ class Cache(object):
# Is the preload_thread alive?
self.keep_preloading = True
# A list of images that want to be pinned into memory.
self.global_pins = [ ]
# A map from image object to surface, only for objects that have
# been pinned into memory.
self.pin_cache = { }
# The preload thread.
self.preload_thread = threading.Thread(target=self.preload_thread_main, name="preloader")
self.preload_thread.setDaemon(True)
@@ -106,6 +113,7 @@ class Cache(object):
def clear(self):
self.lock.acquire()
self.pin_cache = { }
self.cache = { }
self.preloads = [ ]
self.first_preload_in_tick = True
@@ -147,9 +155,21 @@ class Cache(object):
else:
return
self.lock.acquire()
self.preloads.append(image)
self.lock.release()
# Called to report that a given image would like to be pinned into memory.
def pin_image(self, image):
if renpy.config.debug_image_cache:
print "IC Request Pin", image
if not isinstance(image, ImageBase):
if renpy.config.debug_image_cache:
print "IC Can't pin non image: ", image
else:
return
if image not in self.global_pins:
self.global_pins.append(image)
# This returns the pygame surface corresponding to the provided
# image. It also takes care of updating the age of images in the
@@ -179,13 +199,17 @@ class Cache(object):
ce = self.cache.get(image, None)
if ce is not None:
self.cache.release()
self.lock.release()
# Otherwise, we keep the lock, and load the image ourselves.
if ce is None:
try:
surf = image.load()
if image in self.pin_cache:
surf = self.pin_cache[image]
else:
surf = image.load()
except:
self.lock.release()
raise
@@ -203,23 +227,29 @@ class Cache(object):
# RLE detection. (ce.size is used to check that we're not
# 0 pixels big.)
if id(ce.surf) not in rle_cache and ce.size:
rle = not renpy.game.less_memory
# rle = image.rle
surf = ce.surf
if rle:
# We must copy the surface, so we have a RLE-specific version.
rle_surf = renpy.display.pgrender.copy_surface(ce.surf)
rle_surf.set_alpha(255, pygame.RLEACCEL)
idsurf = id(ce.surf)
if idsurf in pin_rle_cache:
rle_surf = pin_rle_cache[idsurf]
else:
rle_surf = renpy.display.pgrender.copy_surface(ce.surf)
rle_surf.set_alpha(255, pygame.RLEACCEL)
renpy.display.render.mutated_surface(rle_surf)
rle_cache[id(ce.surf)] = rle_surf
rle_cache[idsurf] = rle_surf
if renpy.config.debug_image_cache:
print "Added to rle cache:", image
self.lock.release()
# Move it into the current generation. This isn't protected by
# a lock, so in certain circumstances we could have an
@@ -230,10 +260,11 @@ class Cache(object):
if ce.time != self.time:
ce.time = self.time
self.size_of_current_generation += ce.size
# Done... return the surface.
return ce.surf
# This kills off a given cache entry.
def kill(self, ce):
@@ -348,12 +379,41 @@ class Cache(object):
self.cleanout()
self.lock.release()
# If we have time, preload pinned images.
if self.keep_preloading and not renpy.game.less_memory:
# Compute the pin worklist.
pin_worklist = [ i for i in self.global_pins if i not in self.pin_cache ]
# For each image in the worklist...
for image in pin_worklist:
# If we have normal preloads, break out.
if self.preloads:
break
# Otherwise, pin preload the image.
if renpy.config.debug_image_cache:
print "IC Pin Preload", image
surf = image.load()
self.pin_cache[image] = surf
rle_surf = renpy.display.pgrender.copy_surface(surf)
rle_surf.set_alpha(255, pygame.RLEACCEL)
pin_rle_cache[id(surf)] = rle_surf
cache = Cache()
# A map from id(cached surface) to rle version of cached surface.
rle_cache = { }
# Same thing, for pinned surfaces.
pin_rle_cache = { }
def free_memory():
"""
Frees some memory.
@@ -361,7 +421,8 @@ def free_memory():
cache.clear()
rle_cache.clear()
pin_rle_cache.clear()
class ImageBase(renpy.display.core.Displayable):
"""
@@ -440,7 +501,7 @@ class Image(ImageBase):
super(Image, self).__init__(filename, **properties)
self.filename = filename
def load(self, unscaled=False):
def load(self, unscaled=False): # W0221
try:
if unscaled:
@@ -675,7 +736,7 @@ class FrameImage(ImageBase):
tilew, tileh = srcsize
dstw, dsth = dstsize
surf2 = renpy.display.pgrender.surface_unscaled(dstsize)
surf2 = renpy.display.pgrender.surface_unscaled(dstsize, surf)
for y in range(0, dsth, tileh):
for x in range(0, dstw, tilew):
@@ -1251,9 +1312,9 @@ im.matrix(%f, %f, %f, %f, %f.
h = h * math.pi / 180
cosVal = math.cos(h)
sinVal = math.sin(h)
lumR = 0.213;
lumG = 0.715;
lumB = 0.072;
lumR = 0.213
lumG = 0.715
lumB = 0.072
return matrix(
lumR+cosVal*(1-lumR)+sinVal*(-lumR),lumG+cosVal*(-lumG)+sinVal*(-lumG),lumB+cosVal*(-lumB)+sinVal*(1-lumB),0,0,
lumR+cosVal*(-lumR)+sinVal*(0.143),lumG+cosVal*(1-lumG)+sinVal*(0.140),lumB+cosVal*(-lumB)+sinVal*(-0.283),0,0,
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -46,7 +46,7 @@ class UncachedImage(renpy.display.core.Displayable):
super(UncachedImage, self).__init__(style=style, **properties)
self.surf = renpy.display.pgrender.image_load(file, hint)
self.surf = renpy.display.pgrender.load_image(file, hint)
if scale:
renpy.display.render.blit_lock.acquire()
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+19 -16
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -122,7 +122,7 @@ class Container(renpy.display.core.Displayable):
else:
return
self.children.pop(i)
self.children.pop(i) # W0631
self.offsets = self._list_type()
if self.children:
@@ -430,7 +430,7 @@ class MultiBox(Container):
# The scene list for this widget.
self.scene_list = None
def add(self, widget, start_time=None, anim_time=None):
def add(self, widget, start_time=None, anim_time=None): # W0221
super(MultiBox, self).add(widget)
self.start_times.append(start_time)
self.anim_times.append(anim_time)
@@ -476,7 +476,7 @@ class MultiBox(Container):
if layout is None:
layout = self.default_layout
self.layout = layout
self.layout = layout # W0201
else:
layout = self.layout
@@ -656,6 +656,9 @@ def Fixed(**properties):
class SizeGroup(renpy.object.Object):
def __init__(self):
super(SizeGroup, self).__init__()
self.members = [ ]
self._width = None
self.computing_width = False
@@ -803,7 +806,7 @@ class Window(Container):
self.offsets = [ offsets ]
self.window_size = width, height
self.window_size = width, height # W0201
return rv
@@ -1076,7 +1079,7 @@ class Viewport(Container):
self.xadjustment.change(self.xadjustment.value - dx)
self.yadjustment.change(self.yadjustment.value - dy)
self.drag_position = (x, y)
self.drag_position = (x, y) # W0201
if renpy.display.behavior.map_event(ev, 'viewport_drag_end'):
renpy.display.focus.set_grab(None)
@@ -1168,10 +1171,10 @@ class Side(Container):
else:
return 0, axis
self.left_space, width = spacer('tl', 'l', 'bl', width)
self.right_space, width = spacer('tr', 'r', 'br', width)
self.top_space, height = spacer('tl', 't', 'tr', height)
self.bottom_space, height = spacer('bl', 'b', 'br', height)
self.left_space, width = spacer('tl', 'l', 'bl', width) # W0201
self.right_space, width = spacer('tr', 'r', 'br', width) # W0201
self.top_space, height = spacer('tl', 't', 'tr', height) # W0201
self.bottom_space, height = spacer('bl', 'b', 'br', height) # W0201
# The sizes of the various borders.
left = 0
@@ -1201,13 +1204,13 @@ class Side(Container):
right, top = sizeit('tr', right, top, right, top)
right, bottom = sizeit('br', right, bottom, right, bottom)
self.cwidth = cwidth
self.cheight = cheight
self.cwidth = cwidth # W0201
self.cheight = cheight # W0201
self.top = top
self.bottom = bottom
self.left = left
self.right = right
self.top = top # W0201
self.bottom = bottom # W0201
self.left = left # W0201
self.right = right # W0201
else:
cwidth = self.cwidth
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -73,7 +73,7 @@ class Minigame(renpy.display.core.Displayable):
if rv is None:
font = renpy.display.text.get_font(font, size, bold=bold, italics=italics, underline=underline)
font = renpy.display.text.get_font(font, size, bold, italics, underline)
rv = font.render(text, antialias, color)
self.mutated_surface(rv)
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -56,7 +56,7 @@ def polar_to_cartesian(angle, radius, xaround, yaround):
class TransformState(renpy.object.Object):
def __init__(self):
def __init__(self): # W0231
self.alpha = 1
self.rotate = None
self.zoom = 1
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -124,7 +124,7 @@ class SnowBlossomFactory(object):
self.init()
def init(self):
self.starts = [ random.uniform(0, self.start) for i in range(0, self.count) ]
self.starts = [ random.uniform(0, self.start) for i in range(0, self.count) ] # W0201
self.starts.append(self.start)
self.starts.sort()
+5 -5
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -32,9 +32,9 @@ class ModuleProxy(object):
self.__dict__.update(module.__dict__)
opygame = ModuleProxy(pygame)
opygame.display = ModuleProxy(pygame.display)
opygame.transform = ModuleProxy(pygame.transform)
opygame.image = ModuleProxy(pygame.image)
opygame.display = ModuleProxy(pygame.display) # W0201
opygame.transform = ModuleProxy(pygame.transform) # W0201
opygame.image = ModuleProxy(pygame.image) # W0201
# Sample surfaces, with and without alpha.
@@ -98,7 +98,7 @@ def surface((width, height), alpha):
sample = opygame.Surface((2, 2), opygame.SRCALPHA, 32)
surf = Surface((width + 2, height + 2), 0, sample)
return surf.subsurface((1, 1, width, height))
return surf.subsurface((1, 1, width, height)) # E1101
surface_unscaled = surface
+4 -4
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -53,9 +53,9 @@ def start(gamedir):
import sys
if sys.argv[0].lower().endswith(".exe"):
proc = subprocess.Popen([sys.argv[0], "--presplash", fn], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
proc = subprocess.Popen([sys.argv[0], "--presplash", fn], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # W0631
else:
proc = subprocess.Popen([sys.executable, sys.argv[0], "--presplash", fn], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
proc = subprocess.Popen([sys.executable, sys.argv[0], "--presplash", fn], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # W0631
except:
pass
@@ -92,7 +92,7 @@ def show(fn):
pygame.display.init()
img = pygame.image.load(fn)
img = pygame.image.load(fn, fn)
screen = pygame.display.set_mode(img.get_size(), pygame.constants.NOFRAME)
screen.blit(img, (0, 0))
pygame.display.update()
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+4 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -292,6 +292,9 @@ def load_scaling():
w = int(w * factor)
h = int(h * factor)
if isinstance(alpha, ScaledSurface):
alpha = alpha.surface # E1103
self.surface = pgrender.surface_unscaled((w, h), alpha)
@@ -381,7 +384,6 @@ def load_scaling():
set_colorkey = proxy("set_colorkey")
get_alpha = proxy("get_alpha")
get_locked = proxy("get_locked")
get_locks = proxy("get_locks")
map_rgb = proxy("map_rgb")
unmap_rgb = proxy("unmap_rgb")
+80 -26
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -99,9 +99,25 @@ class TextStyle(object):
def __init__(self, source=None):
if source is not None:
vars(self).update(vars(source))
else:
self.font = ""
self.size = 0
self.bold = False
self.italic = False
self.underline = False
self.strikethrough = False
self.color = None
self.black_color = None
self.hyperlink = None
# The cached font.
self.f = None
# Width cache.
self.wcache = { }
# Surface cache.
self.scache = { }
def update(self):
self.f = get_font(self.font, self.size, self.bold, self.italic, self.underline, 0)
@@ -124,12 +140,17 @@ class TextStyle(object):
return self.get_width(text), self.f.get_ascent() - self.f.get_descent()
def render(self, text, antialias, color, black_color, use_colors, time, at, expand):
def render(self, text, antialias, color, black_color, use_colors, time, at, expand, use_cache):
if use_colors:
color = self.color or color
black_color = self.black_color or black_color
key = (text, antialias, color, black_color, expand)
if use_cache and key in self.scache:
return self.scache[key]
if expand:
font = get_font(self.font, self.size, self.bold, self.italic, self.underline, expand)
else:
@@ -159,7 +180,10 @@ class TextStyle(object):
renpy.display.module.linmap(rv, rv, 256, 256, 256, a + 1)
renpy.display.render.mutated_surface(rv)
if use_cache and not renpy.game.less_memory:
self.scache[key] = (rv, rv.get_size())
return rv, rv.get_size()
def length(self, text):
@@ -196,7 +220,7 @@ class WidgetStyle(object):
def sizes(self, widget):
return self.width, self.height
def render(self, widget, antialias, color, black_color, foreground, st, at, expand):
def render(self, widget, antialias, color, black_color, foreground, st, at, expand, use_cache):
# If in the foreground
if foreground:
@@ -656,7 +680,12 @@ class Text(renpy.display.core.Displayable):
self.tokens = None
# The duration of each pause, or None if the pause is infinite.
self.pause_lengths = [ ]
# The width we've been laid out for.
self.width = -1
self.update(redraw=False)
@@ -704,29 +733,49 @@ class Text(renpy.display.core.Displayable):
new_tokens = [ ]
fasts = 0
self.no_wait = False
self.no_wait_once = False
self.no_wait_done = False
self.pauses = 0
self.no_wait = False # W0201
self.no_wait_once = False # W0201
self.no_wait_done = False # W0201
self.pauses = 0 # W0201
self.pause_lengths = [ ] # W0201
for i in self.tokens[0]:
type, text = i
if type == "tag":
if text == "p" or text.startswith("p="):
new_tokens.append(("tag", 'w' + text[1:]))
if text == "p":
new_tokens.append(("tag", 'w'))
new_tokens.append(("newline", "\n"))
self.pauses += 1
self.pause_lengths.append(None)
continue
elif text.startswith("p="):
new_tokens.append(("tag", 'w=' + text[2:]))
new_tokens.append(("newline", "\n"))
self.pauses += 1
self.pause_lengths.append(float(text[2:]))
continue
elif text == "nw":
self.no_wait = True
elif text == "fast":
self.no_wait = False
fasts += 1
self.pauses = 0
elif text == "w" or text.startswith("w="):
self.pause_lengths = [ ]
elif text == "w":
self.pauses += 1
self.pause_lengths.append(None)
elif text.startswith("w="):
self.pauses += 1
self.pause_lengths.append(float(text[2:]))
new_tokens.append(i)
@@ -780,7 +829,7 @@ class Text(renpy.display.core.Displayable):
# Postprocess the tokens list to create widgets, as necessary.
self.children = [ ]
self.children = [ ] # W0201
newtokens = [ ]
for tl in self.tokens:
@@ -856,10 +905,10 @@ class Text(renpy.display.core.Displayable):
def visit(self):
if self.tokens is None:
if self.tokens is None:
self.update()
return self.children
return self.children
def layout(self, width, time):
@@ -897,7 +946,7 @@ class Text(renpy.display.core.Displayable):
tsl[-1].hyperlink = None
tsl[-1].update()
self.laidout_hyperlinks = [ ]
self.laidout_hyperlinks = [ ] # W0201
# if not self.text:
# text = " "
@@ -1109,14 +1158,14 @@ class Text(renpy.display.core.Displayable):
# Now, we need to go through these lines, to generate the data
# we need to render text.
self.laidout = [ ]
self.laidout_lineheights = [ ]
self.laidout_linewidths = [ ]
self.laidout_length = 0
self.laidout_start = 0
self.laidout_width = self.style.min_width
self.laidout_height = 0
self.laidout_lines_last = lines_last
self.laidout = [ ] # W0201
self.laidout_lineheights = [ ] # W0201
self.laidout_linewidths = [ ] # W0201
self.laidout_length = 0 # W0201
self.laidout_start = 0 # W0201
self.laidout_width = self.style.min_width # W0201
self.laidout_height = 0 # W0201
self.laidout_lines_last = lines_last # W0201
# Add something to empty lines.
for l in linetriples:
@@ -1292,13 +1341,18 @@ class Text(renpy.display.core.Displayable):
length -= ts.length(text)
# Should we cache the rendered text?
use_cache = True
if length < 0:
use_cache = False
if isinstance(text, (str, unicode)):
text = text[:length]
else:
return False
surf, (sw, sh) = ts.render(text, antialias, color, black_color, user_colors, time, at, expand)
surf, (sw, sh) = ts.render(text, antialias, color, black_color, user_colors, time, at, expand, use_cache)
if expand:
(sw, sh) = ts.sizes(text)
@@ -1401,7 +1455,7 @@ class Text(renpy.display.core.Displayable):
else:
length = sys.maxint
self.call_slow_done(st)
rv = renpy.display.render.Render(self.laidout_width - mindsx + maxdsx, self.laidout_height - mindsy + maxdsy)
for dsxo, dsyo in dslist:
+5 -16
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -53,12 +53,12 @@ class Transition(renpy.display.core.Displayable):
def event(self, ev, x, y, st):
if self.events or ev.type == renpy.display.core.TIMEEVENT:
return self.new_widget.event(ev, x, y, st)
return self.new_widget.event(ev, x, y, st) # E1101
else:
return None
def visit(self):
return [ self.new_widget, self.old_widget ]
return [ self.new_widget, self.old_widget ] # E1101
def null_render(d, width, height, st, at):
@@ -279,7 +279,7 @@ class Pixellate(Transition):
surf = rdr.pygame_surface(False)
size = surf.get_size()
newsurf = renpy.display.pgrender.surface(size, False)
newsurf = renpy.display.pgrender.surface(size, surf)
px = 2 ** step
@@ -491,17 +491,6 @@ class ImageDissolve(Transition):
ramp += '\xff' * 256
old = 0
for i in ramp:
i = ord(i)
if i < old:
self.can_fast = False
break
old = i
else:
self.can_fast = True
if reverse:
ramp = list(ramp)
ramp.reverse()
@@ -1090,7 +1079,7 @@ def MoveTransition(delay, old_widget=None, new_widget=None, factory=None, enter
# This calls merge_slide to actually do the merging.
rv = merge_slide(old_widget, new_widget)
rv.delay = delay
rv.delay = delay # W0201
return rv
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+7 -4
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -36,6 +36,8 @@ class PredictInfo(renpy.object.Object):
def __init__(self, pi=None):
super(PredictInfo, self).__init__()
if pi:
self.images = renpy.display.core.ImagePredictInfo(pi.images)
else:
@@ -82,6 +84,8 @@ class Context(renpy.object.Object):
def __init__(self, rollback, context=None):
super(Context, self).__init__()
self.current = None
self.call_location_stack = [ ]
self.return_stack = [ ]
@@ -253,7 +257,7 @@ class Context(renpy.object.Object):
"""
if not self.current:
raise "Context not capable of executing Ren'Py code."
raise Exception("Context not capable of executing Ren'Py code.")
if return_site is None:
return_site = self.current
@@ -345,8 +349,7 @@ class Context(renpy.object.Object):
print "While predicting images."
# We accept that sometimes prediction won't work.
pass
self.predict_info = old_predict_info
+26 -15
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -46,6 +46,8 @@ from renpy.character import show_display_say, predict_show_display_say, display_
import renpy.audio.sound as sound
import renpy.audio.music as music
import time
def public_api():
"""
@@ -66,7 +68,8 @@ def public_api():
show_display_say, predict_show_display_say, display_say
sound
music
time
del public_api
@@ -505,7 +508,7 @@ def predict_say(who, what):
"""
if who is None:
who = renpy.store.narrator
who = renpy.store.narrator # E1101
if isinstance(who, (str, unicode)):
return renpy.store.predict_say(who, what)
@@ -528,7 +531,7 @@ def say(who, what, interact=True):
what = what % tag_quoting_dict
if who is None:
who = renpy.store.narrator
who = renpy.store.narrator # E1101
if isinstance(who, (str, unicode)):
renpy.store.say(who, what, interact=interact)
@@ -1030,7 +1033,7 @@ def launch_editor(filenames, line=1, transient=0):
cmd = cmd.replace('""', '')
try:
subprocess.Popen(split_args(cmd))
subprocess.Popen(split_args(cmd)) # E1101
return True
except:
if renpy.config.debug:
@@ -1241,19 +1244,22 @@ def game_menu(screen=None):
def shown_window():
renpy.game.context().scene_lists.shown_window = True
class placement(renpy.python.RevertableObject):
def __init__(self, p):
super(placement, self).__init__()
self.xpos = p[0]
self.ypos = p[1]
self.xanchor = p[2]
self.yanchor = p[3]
self.xoffset = p[4]
self.yoffset = p[5]
self.subpixel = p[6]
def get_placement(d):
o = renpy.store.object()
p = d.get_placement()
o.xpos = p[0]
o.ypos = p[1]
o.xanchor = p[2]
o.yanchor = p[3]
o.xoffset = p[4]
o.yoffset = p[5]
o.subpixel = p[6]
return o
return placement(p)
# User-Defined Displayable stuff.
@@ -1271,6 +1277,11 @@ class Container(renpy.display.core.Displayable, renpy.python.RevertableObject):
def get_roll_forward():
return renpy.game.interface.shown_window
def cache_pin(*args):
for i in args:
renpy.display.im.cache.pin_image(renpy.easy.displayable(i))
# This is a map from a definition to the place where it was
# defined.
definitions = collections.defaultdict(list)
+18 -15
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -42,6 +42,9 @@ searchpath = [ ]
# The options that were read off the command line.
options = None
# The game's script.
script = None
# A shallow copy of the store dictionary made at the end of the init
# phase. If a key in here points to the same value here as it does in
# the store, it is not saved.
@@ -113,31 +116,31 @@ class Preferences(object):
Stores preferences that will one day be persisted.
"""
def reinit(self):
self.fullscreen = False
self.skip_unseen = False
self.text_cps = 0
self.afm_time = 0
self.afm_enable = True
self.fullscreen = False # W0201
self.skip_unseen = False # W0201
self.text_cps = 0 # W0201
self.afm_time = 0 # W0201
self.afm_enable = True # W0201
# These will be going away soon.
self.sound = True
self.music = True
self.sound = True # W0201
self.music = True # W0201
# 2 - All transitions.
# 1 - Only non-default transitions.
# 0 - No transitions.
self.transitions = 2
self.transitions = 2 # W0201
self.skip_after_choices = False
self.skip_after_choices = False # W0201
# Mixer channel info.
self.volumes = { }
self.mute = { }
self.volumes = { } # W0201
self.mute = { } # W0201
# Joystick mappings.
self.joymap = dict(
self.joymap = dict( # W0201
joy_left="Axis 0.0 Negative",
joy_right="Axis 0.0 Positive",
joy_up="Axis 0.1 Negative",
@@ -171,7 +174,7 @@ class RestartException(Exception):
been changed, and therefore execution needs to be restarted.
"""
def __init__(self, contexts, label):
def __init__(self, contexts, label): # W0231
self.contexts = contexts
self.label = label
@@ -181,7 +184,7 @@ class FullRestartException(Exception):
destroying the store and config and so on.
"""
def __init__(self, reason="end_game"):
def __init__(self, reason="end_game"): # W0231
self.reason = reason
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -126,7 +126,7 @@ def check_file(what, fn):
check_file_cache[fn] = True
try:
renpy.loader.transfn(fn)
renpy.loader.transfn(fn)
except:
return
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+4 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -407,6 +407,8 @@ def MultiPersistent(name):
except:
pass
fn = "" # prevent a warning from happening.
# Find the first file that actually exists. Otherwise, use the last
# file.
for fn in files:
@@ -419,7 +421,7 @@ def MultiPersistent(name):
except:
rv = _MultiPersistent()
rv._filename = fn
rv._filename = fn # W0201
return rv
+3 -3
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -131,7 +131,7 @@ def main():
renpy.config.searchpath = [ renpy.config.gamedir ]
# Find the common directory.
commondir = __main__.path_to_common(renpy.config.renpy_base)
commondir = __main__.path_to_common(renpy.config.renpy_base) # E1101
if os.path.isdir(commondir):
renpy.config.searchpath.append(commondir)
@@ -179,7 +179,7 @@ def main():
# Find the save directory.
if renpy.config.savedir is None:
renpy.config.savedir = __main__.path_to_saves(renpy.config.gamedir)
renpy.config.savedir = __main__.path_to_saves(renpy.config.gamedir) # E1101
if renpy.game.options.savedir:
renpy.config.savedir = renpy.game.options.savedir
+3 -3
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -51,10 +51,10 @@ class Object(object):
self.__dict__.update(new_dict)
if version != self.__version__:
self.after_upgrade(version)
self.after_upgrade(version) # E1101
if self.after_setstate:
self.after_setstate()
self.after_setstate() # E1102
# We don't handle slots with this mechanism, since the call to vars should
# throw an error.
+27 -12
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -81,6 +81,15 @@ class ParseError(Exception):
def __unicode__(self):
return self.message
# Something to hold the expected line number.
class LineNumberHolder(object):
"""
Holds the expected line number.
"""
def __init__(self):
self.line = 0
def unicode_filename(fn):
"""
Converts the supplied filename to unicode.
@@ -377,7 +386,16 @@ class Lexer(object):
self.eob = False
self.line = -1
# These are set by advance.
self.filename = ""
self.text = ""
self.number = 0
self.subblock = [ ]
self.pos = 0
self.word_cache_pos = -1
self.word_cache_newpos = -1
self.word_cache = ""
def advance(self):
"""
@@ -716,12 +734,12 @@ class Lexer(object):
extending to a colon.
"""
rv = self.delimited_python(':')
pe = self.delimited_python(':')
if not rv:
if not pe:
self.error("expected python_expression")
rv = renpy.ast.PyExpr(rv.strip(), rv.filename, rv.linenumber)
rv = renpy.ast.PyExpr(pe.strip(), pe.filename, pe.linenumber) # E1101
return rv
@@ -867,10 +885,7 @@ class Lexer(object):
rv = [ ]
# Something to hold the expected line number.
class Object(object):
pass
o = Object()
o = LineNumberHolder()
o.line = self.number
def process(block, indent):
@@ -1211,7 +1226,7 @@ def parse_parameters(l):
parameters.append((name, default))
if add_positional:
positional.append(name)
positional.append(name)
if l.match(r'\)'):
break
@@ -1534,7 +1549,7 @@ def parse_statement(l):
rv = ast.Define(loc, name, expr)
if not l.init:
rv = ast.Init(loc, [ rv ], priority)
rv = ast.Init(loc, [ rv ], priority)
l.advance()
@@ -1810,7 +1825,7 @@ def report_parse_errors():
if renpy.config.editor:
renpy.exports.launch_editor([ 'errors.txt' ], 1, transient=1)
else:
os.startfile('errors.txt')
os.startfile('errors.txt') # E1101
except:
pass
+22 -13
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -299,9 +299,9 @@ class RevertableList(list):
reverse = mutator(list.reverse)
sort = mutator(list.sort)
def wrapper(method):
def newmethod(*args, **kwargs):
return RevertableList(method(*args, **kwargs))
def wrapper(method): # E0213
def newmethod(*args, **kwargs):
return RevertableList(method(*args, **kwargs)) # E1102
return newmethod
@@ -309,6 +309,8 @@ class RevertableList(list):
__getslice__ = wrapper(list.__getslice__)
__mul__ = wrapper(list.__mul__)
del wrapper
def get_rollback(self):
return self[:]
@@ -330,9 +332,9 @@ class RevertableDict(dict):
popitem = mutator(dict.popitem)
setdefault = mutator(dict.setdefault)
def list_wrapper(method):
def list_wrapper(method): # E0213
def newmethod(*args, **kwargs):
return RevertableList(method(*args, **kwargs))
return RevertableList(method(*args, **kwargs)) # E1102
return newmethod
@@ -340,6 +342,8 @@ class RevertableDict(dict):
values = list_wrapper(dict.values)
items = list_wrapper(dict.items)
del list_wrapper
def copy(self):
rv = RevertableDict()
rv.update(self)
@@ -371,11 +375,9 @@ class RevertableSet(sets.Set):
union_update = mutator(sets.Set.union_update)
update = mutator(sets.Set.update)
# TODO: Wrap all of the methods that can return normal sets.
def wrapper(method):
def wrapper(method): # E0213
def newmethod(*args, **kwargs):
rv = method(*args, **kwargs)
rv = method(*args, **kwargs) # E1102
if isinstance(rv, sets.Set):
return RevertableSet(rv)
else:
@@ -494,6 +496,9 @@ class Rollback(renpy.object.Object):
"""
def __init__(self):
super(Rollback, self).__init__()
self.context = renpy.game.contexts[0].rollback_copy()
self.objects = [ ]
self.store = [ ]
@@ -542,7 +547,8 @@ class Rollback(renpy.object.Object):
else:
if renpy.config.debug:
print "Removing unreachable:", o
pass
pass
self.objects = new_objects
@@ -598,16 +604,19 @@ class RollbackLog(renpy.object.Object):
nosave = [ 'old_store', 'mutated' ]
def __init__(self):
super(RollbackLog, self).__init__()
self.log = [ ]
self.current = None
self.mutated = { }
self.ever_been_changed = { }
self.rollback_limit = 0
self.forward = [ ]
self.old_store = { }
# Did we just do a roll forward?
self.rolled_forward = False
# Reset the RNG on the creation of a new game.
rng.reset()
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+7 -7
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -106,6 +106,11 @@ class Script(object):
self.all_stmts = [ ]
self.all_pycode = [ ]
# Bytecode caches.
self.bytecode_oldcache = { }
self.bytecode_newcache = { }
self.bytecode_dirty = False
# Init the bytecode compiler.
self.init_bytecode()
@@ -261,8 +266,7 @@ class Script(object):
data, stmts = loads(f.read().decode('zlib'))
except:
raise
return None, None
if not isinstance(data, dict):
return None, None
@@ -388,10 +392,6 @@ class Script(object):
Init/Loads the bytecode cache.
"""
self.bytecode_oldcache = { }
self.bytecode_newcache = { }
self.bytecode_dirty = False
# Load the oldcache.
try:
version, cache = loads(renpy.loader.load("bytecode.rpyb").read().decode("zlib"))
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+11 -3
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -74,7 +74,7 @@ class _Config(object):
raise Exception('config.%s is not a known configuration variable.' % (name))
if name == "script_version":
renpy.store._set_script_version(value)
renpy.store._set_script_version(value) # E1101
cvars[name] = value
@@ -83,7 +83,10 @@ class _Config(object):
raise Exception('Deleting configuration variables is not supported.')
else:
delattr(renpy.config, name)
# The styles object.
style = None
config = _Config()
library = config
@@ -267,6 +270,7 @@ adv = ADVCharacter(None,
afm=True,
ctc=None,
ctc_pause=None,
ctc_timedpause=None,
ctc_position="nestled",
all_at_once=False,
with_none=None,
@@ -290,7 +294,11 @@ def say(who, what, interact=True):
who = Character(who, kind=name_only)
who(what, interact=interact)
# Used by renpy.reshow_say.
_last_say_who = None
_last_say_what = None
__name__ = 'store'
import sys
+3 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -629,7 +629,7 @@ class Style(object):
if isinstance(parent, basestring):
parent = ( parent, )
if isinstance(parent, Style):
parent = parent.name
parent = parent.name # E1103
if parent is None:
raise Exception("The parent of a style must be a named style.")
@@ -647,6 +647,7 @@ class Style(object):
else:
self.name = ( name, )
self.parent = None
self.set_parent(parent)
self.indexed = None
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+3 -3
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -26,7 +26,7 @@
# but are probably better than nothing.
import sys
import encodings.zlib_codec; encodings.zlib_codec
import encodings.zlib_codec; encodings.zlib_codec # E0601
import random
import glob
@@ -60,7 +60,7 @@ def archive(prefix, files):
key = random.randint(0, 0x7ffffffe)
padding = "RPA-3.0 XXXXXXXXXXXXXXXX XXXXXXXX\n"
padding = "RPA-3.0 XXXXXXXXXXXXXXXX XXXXXXXX\n" # W0511
archivef.write(padding)
offset = len(padding)
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -102,7 +102,7 @@ def add(w, make_current=False, once=False):
elif current is None:
pass
else:
current.add(atw)
current.add(atw) # E1103
add_tag = None
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
Executable
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python
import sys
import pylint.lint
import pylint.reporters.text
import linecache
class MyReporter(pylint.reporters.text.TextReporter):
def add_message(self, msg_id, location, msg):
if msg_id == "E1103" and "Instance of 'Style'" in msg:
return
if msg_id == "E1101" and "Instance of 'Style'" in msg:
return
if msg_id == "E1101" and "Instance of 'ModuleProxy'" in msg:
return
if msg_id == "E1101" and "Instance of 'ImageFont'" in msg:
return
if msg_id == "E1102" and "renpy.config" in msg:
return
fn, module, obj, line = location
text = linecache.getline(fn, line)
if msg_id.lower() in text.lower():
return
pylint.reporters.text.TextReporter.add_message(self, msg_id, location, msg)
pylint.lint.Run(sys.argv[1:], reporter=MyReporter())
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# Copyright 2004-2007 PyTom <pytom@bishoujo.us>
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
+1
View File
@@ -180,6 +180,7 @@ init python hide:
for l in f:
l = l.decode("utf-8")
l = l.rstrip()
m = re.match("\s*#begin (\w+)", l)
+1 -1
View File
@@ -275,7 +275,7 @@ image main_menu:
size (800, 509)
contains:
Text("Ren'Py 6.10.1 \"I Can See Clearly Now\"", size=18)
Text("Ren'Py 6.10.2 \"Fixing a Hole\"", size=18)
yalign .98
xalign .02