# HG changeset patch # User Thibaut Girka # Date 1314126110 -7200 # Node ID 3da4de9decd0058f027330caf06c08dc44662685 # Parent 694f25881d0f642af8908d6810de9a40aaa788d4 Use logging module diff --git a/eclviewer.py b/eclviewer.py --- a/eclviewer.py +++ b/eclviewer.py @@ -125,7 +125,6 @@ def main(path, stage_num): # This is so that objects on the (O, x, y) plane use pixel coordinates gluLookAt(192., 224., - 835.979370 * dz, 192. + dx, 224. - dy, 0., 0., -1., 0.) - #print(glGetFloat(GL_MODELVIEW_MATRIX)) glTranslatef(-x, -y, -z) glEnable(GL_DEPTH_TEST) diff --git a/pytouhou/formats/ecl.py b/pytouhou/formats/ecl.py --- a/pytouhou/formats/ecl.py +++ b/pytouhou/formats/ecl.py @@ -16,8 +16,9 @@ from struct import pack, unpack from pytouhou.utils.helpers import read_string -from collections import namedtuple +from pytouhou.utils.helpers import get_logger +logger = get_logger(__name__) class ECL(object): _instructions = {0: ('', 'noop?'), @@ -167,7 +168,7 @@ class ECL(object): args = unpack('<%s' % cls._instructions[opcode][0], data) else: args = (data, ) - print('Warning: unknown opcode %d' % opcode) #TODO + logger.warn('unknown opcode %d', opcode) ecl.subs[-1].append((time, opcode, rank_mask, param_mask, args)) @@ -195,7 +196,7 @@ class ECL(object): if instr_type in (0, 2, 4, 6): # Enemy spawn args = unpack(' @@ -16,6 +12,14 @@ import pytouhou.utils.lzss as lzss ## GNU General Public License for more details. ## +from pytouhou.utils.bitstream import BitStream +import pytouhou.utils.lzss as lzss + +from pytouhou.utils.helpers import get_logger + +logger = get_logger(__name__) + + class PBG3BitStream(BitStream): def read_int(self): size = self.read(2) @@ -80,6 +84,6 @@ class PBG3(object): value += ord(c) value &= 0xFFFFFFFF if value != checksum: - print('Warning: corrupted data') #TODO + logger.warn('corrupted data!') return data diff --git a/pytouhou/formats/std.py b/pytouhou/formats/std.py --- a/pytouhou/formats/std.py +++ b/pytouhou/formats/std.py @@ -14,8 +14,9 @@ from struct import pack, unpack -from pytouhou.utils.helpers import read_string +from pytouhou.utils.helpers import read_string, get_logger +logger = get_logger(__name__) class Object(object): @@ -108,7 +109,7 @@ class Stage(object): args = tuple(unpack('