##// END OF EJS Templates
fix again() bug in demo
fperez -
Show More
@@ -87,6 +87,7 b' class Demo:'
87 87 def again(self):
88 88 """Repeat the last block"""
89 89 self.block_index -= 1
90 self.finished = False
90 91 self()
91 92
92 93 def _validate_index(self,index):
@@ -108,8 +109,8 b' class Demo:'
108 109 index = self.block_index
109 110 else:
110 111 self._validate_index(index)
111 print marquee('<%s> block # %s (%s/%s)' %
112 (self.fname,index,index+1,self.nblocks))
112 print marquee('<%s> block # %s (%s remaining)' %
113 (self.fname,index,self.nblocks-index-1))
113 114 print self.src_blocks_colored[index],
114 115
115 116 def show(self):
@@ -120,11 +121,11 b' class Demo:'
120 121 silent = self.silent
121 122 for index,block in enumerate(self.src_blocks_colored):
122 123 if silent[index]:
123 print marquee('<%s> SILENT block # %s (%s/%s)' %
124 (fname,index,index+1,nblocks))
124 print marquee('<%s> SILENT block # %s (%s remaining)' %
125 (fname,index,nblocks-index-1))
125 126 else:
126 print marquee('<%s> block # %s (%s/%s)' %
127 (fname,index,index+1,nblocks))
127 print marquee('<%s> block # %s (%s remaining)' %
128 (fname,index,nblocks-index-1))
128 129 print block,
129 130
130 131 def __call__(self,index=None):
@@ -146,11 +147,13 b' class Demo:'
146 147 next_block = self.src_blocks[index]
147 148 self.block_index += 1
148 149 if self.silent[index]:
149 print marquee('Executing silent block # %s (%s/%s)' %
150 (index,index+1,self.nblocks))
150 print marquee('Executing silent block # %s (%s remaining)' %
151 (index,self.nblocks-index-1))
151 152 else:
152 153 self.show_block(index)
153 if not self.auto:
154 if self.auto:
155 print marquee('output')
156 else:
154 157 print marquee('Press <q> to quit, <Enter> to execute...'),
155 158 ans = raw_input().strip()
156 159 if ans:
@@ -1,5 +1,8 b''
1 1 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2 2
3 * IPython/demo.py (Demo.again): fix bug where again() blocks after
4 finishing.
5
3 6 * IPython/genutils.py (shlex_split): moved from Magic to here,
4 7 where all 2.2 compatibility stuff lives. I needed it for demo.py.
5 8
General Comments 0
You need to be logged in to leave comments. Login now