From c8f7d7785f4aa2cba3ab7b04110da83ee5226610 Mon Sep 17 00:00:00 2001 From: Frank Demarco Date: Sun, 23 Dec 2012 19:20:36 +0900 Subject: [PATCH] old print formatted --- .gitignore | 1 + pgfw/Configuration.py | 6 ++++-- pgfw/EventDelegate.py | 8 ++++---- pgfw/Input.py | 6 +++--- pgfw/ScreenGrabber.py | 6 +++--- pgfw/Setup.py | 6 +++--- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 7a1412d..5b3f7b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc build/ MANIFEST +*~ diff --git a/pgfw/Configuration.py b/pgfw/Configuration.py index 5227bfd..475e086 100644 --- a/pgfw/Configuration.py +++ b/pgfw/Configuration.py @@ -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"]: diff --git a/pgfw/EventDelegate.py b/pgfw/EventDelegate.py index aba2279..10ded43 100644 --- a/pgfw/EventDelegate.py +++ b/pgfw/EventDelegate.py @@ -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() diff --git a/pgfw/Input.py b/pgfw/Input.py index 8f6b6b6..edf3d74 100644 --- a/pgfw/Input.py +++ b/pgfw/Input.py @@ -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)) diff --git a/pgfw/ScreenGrabber.py b/pgfw/ScreenGrabber.py index e06e980..7d8a6b0 100644 --- a/pgfw/ScreenGrabber.py +++ b/pgfw/ScreenGrabber.py @@ -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") diff --git a/pgfw/Setup.py b/pgfw/Setup.py index 9e60268..be9e778 100644 --- a/pgfw/Setup.py +++ b/pgfw/Setup.py @@ -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):