old print formatted

This commit is contained in:
Frank Demarco 2012-12-23 19:20:36 +09:00
parent 51f5ebd57f
commit c8f7d7785f
6 changed files with 18 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.pyc
build/
MANIFEST
*~

View File

@ -30,7 +30,7 @@ class Configuration(RawConfigParser):
new = ""
if path and path[0] == sep:
new += sep
return expanduser("{0}{1}".format(new, join(*path.split(sep))))
return expanduser("%s%s" % (new, join(*path.split(sep))))
def set_defaults(self):
add_section = self.add_section
@ -161,7 +161,9 @@ class Configuration(RawConfigParser):
types = self.type_declarations
if type(value) == str:
if pair in types["bool"]:
return True if value == "yes" else False
if value == "yes":
return True
return False
elif pair in types["int"]:
return int(value)
elif pair in types["float"]:

View File

@ -23,15 +23,15 @@ class EventDelegate(GameChild):
kind = evt.type
if kind in subscribers:
for subscriber in subscribers[kind]:
self.print_debug("Passing {0} to {1}".\
format(evt, subscriber))
self.print_debug("Passing %s to %s" %\
(evt, subscriber))
subscriber(evt)
else:
event.pump()
def add_subscriber(self, kind, callback):
self.print_debug("Subscribing {0} to {1}".\
format(callback, kind))
self.print_debug("Subscribing %s to %s" %\
(callback, kind))
subscribers = self.subscribers
if kind not in subscribers:
subscribers[kind] = list()

View File

@ -39,8 +39,8 @@ class Input(GameChild):
self.key_map = key_map
def translate_key_press(self, evt):
self.print_debug("You pressed {0}, suppressed => {1}".\
format(evt.key, self.suppressed))
self.print_debug("You pressed %s, suppressed => %s" %\
(evt.key, self.suppressed))
if not self.suppressed:
key = evt.key
for cmd, keys in self.key_map.iteritems():
@ -50,7 +50,7 @@ class Input(GameChild):
def post_command(self, cmd, **kwargs):
config = self.get_configuration().get_section("event")
eid = self.get_custom_event_id()
self.print_debug("Posting {0} command with id {1}".format(cmd, eid))
self.print_debug("Posting %s command with id %s" % (cmd, eid))
name = config["command-event-name"]
event.post(event.Event(eid, name=name, command=cmd, **kwargs))

View File

@ -23,10 +23,10 @@ class ScreenGrabber(GameChild):
name = self.build_name()
path = join(directory, name)
capture = image.save(self.get_screen(), path)
self.print_debug("Saved screen capture to {0}".format(path))
self.print_debug("Saved screen capture to %s" % (path))
except:
self.print_debug("Couldn't save screen capture to {0}, {1}".\
format(directory, exc_info()[1]))
self.print_debug("Couldn't save screen capture to %s, %s" %\
(directory, exc_info()[1]))
def build_name(self):
config = self.get_configuration().get_section("screen-captures")

View File

@ -63,9 +63,9 @@ class Setup:
description = ""
path = self.config.get("setup", "description-file")
if exists(path):
description = "\n{0}\n{1}\n{2}".format(file(path).read(),
"Changelog\n=========",
self.translate_changelog())
description = "\n%s\n%s\n%s" % (file(path).read(),
"Changelog\n=========",
self.translate_changelog())
return description
def translate_changelog(self):