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 *.pyc
build/ build/
MANIFEST MANIFEST
*~

View File

@ -30,7 +30,7 @@ class Configuration(RawConfigParser):
new = "" new = ""
if path and path[0] == sep: if path and path[0] == sep:
new += 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): def set_defaults(self):
add_section = self.add_section add_section = self.add_section
@ -161,7 +161,9 @@ class Configuration(RawConfigParser):
types = self.type_declarations types = self.type_declarations
if type(value) == str: if type(value) == str:
if pair in types["bool"]: if pair in types["bool"]:
return True if value == "yes" else False if value == "yes":
return True
return False
elif pair in types["int"]: elif pair in types["int"]:
return int(value) return int(value)
elif pair in types["float"]: elif pair in types["float"]:

View File

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

View File

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

View File

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

View File

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