diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-10-11 23:35:51 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-10-11 23:35:51 +0200 |
commit | bf619ffa24a5b3323f53f8eaeb56ce3b4475d7d2 (patch) | |
tree | 305db0683af1a99ca2fc1019dda8833af77cca72 | |
parent | f214a9f59bc397cfd1db6626b9491c3ec9dc5762 (diff) | |
download | ponysay-bf619ffa24a5b3323f53f8eaeb56ce3b4475d7d2.tar.gz ponysay-bf619ffa24a5b3323f53f8eaeb56ce3b4475d7d2.tar.bz2 ponysay-bf619ffa24a5b3323f53f8eaeb56ce3b4475d7d2.zip |
printing just the pony
-rwxr-xr-x | ponysay.py | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -703,7 +703,7 @@ class Ponysay(): messagewrap = int(args.opts['-W'][0]) if args.opts['-W'] is not None else None ## Get balloon object - balloon = self.__getballoon(self.__getballoonpath(args.opts['-b'])) + balloon = self.__getballoon(self.__getballoonpath(args.opts['-b'])) if args.opts['-o'] is None else None ## Run cowsay replacement backend = Backend(message = msg, ponyfile = pony, wrapcolumn = messagewrap if messagewrap is not None else 40, width = widthtruncation, balloon = balloon) @@ -1214,7 +1214,8 @@ Replacement for cowsay class Backend(): ''' Constructor - Takes message [string], ponyfile [filename string], wrapcolumn [None or an int], width [None or an int] and balloon [Balloon object] + Takes message [string], ponyfile [filename string], wrapcolumn [None or an int], + width [None or an int] and balloon [None or Balloon object] ''' def __init__(self, message, ponyfile, wrapcolumn, width, balloon): self.message = message @@ -1223,7 +1224,10 @@ class Backend(): self.width = width self.balloon = balloon - self.link = {'\\' : self.balloon.link, '/' : self.balloon.linkmirror} + if self.balloon is not None: + self.link = {'\\' : self.balloon.link, '/' : self.balloon.linkmirror} + else: + self.link = {} self.output = '' self.pony = None @@ -1347,7 +1351,7 @@ class Backend(): else: n += len(data) self.pony = self.pony[:i] + data + self.pony[i:] - else: + elif self.balloon is not None: (w, h) = (0, 0) props = dollar[7:] if len(props) > 0: |