aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-10-11 23:35:51 +0200
committerMattias Andrée <maandree@operamail.com>2012-10-11 23:35:51 +0200
commitbf619ffa24a5b3323f53f8eaeb56ce3b4475d7d2 (patch)
tree305db0683af1a99ca2fc1019dda8833af77cca72
parentf214a9f59bc397cfd1db6626b9491c3ec9dc5762 (diff)
downloadponysay-bf619ffa24a5b3323f53f8eaeb56ce3b4475d7d2.tar.gz
ponysay-bf619ffa24a5b3323f53f8eaeb56ce3b4475d7d2.tar.bz2
ponysay-bf619ffa24a5b3323f53f8eaeb56ce3b4475d7d2.zip
printing just the pony
-rwxr-xr-xponysay.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/ponysay.py b/ponysay.py
index 3534e5e..1649402 100755
--- a/ponysay.py
+++ b/ponysay.py
@@ -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: