##// END OF EJS Templates
pep8, third pass
Barry Wark -
Show More
@@ -227,19 +227,19 b' class IPythonCocoaController(NSObject, FrontEndBase):'
227 227 NSMakeRange(self.textView.textStorage().length(),
228 228 0))
229 229
230 def currentBlock(self):
230 def current_block(self):
231 231 """The current block's text"""
232 232
233 return self.textForRange(self.current_block_range())
233 return self.text_for_range(self.current_block_range())
234 234
235 def textForRange(self, textRange):
236 """textForRange"""
235 def text_for_range(self, textRange):
236 """text_for_range"""
237 237
238 238 ts = self.textView.textStorage()
239 239 return ts.string().substringWithRange_(textRange)
240 240
241 def currentLine(self):
242 block = self.textForRange(self.current_block_range())
241 def current_line(self):
242 block = self.text_for_range(self.current_block_range())
243 243 block = block.split('\n')
244 244 return block[-1]
245 245
@@ -288,8 +288,8 b' class IPythonCocoaController(NSObject, FrontEndBase):'
288 288 def current_indent_string(self):
289 289 """returns string for indent or None if no indent"""
290 290
291 if(len(self.currentBlock()) > 0):
292 lines = self.currentBlock().split('\n')
291 if(len(self.current_block()) > 0):
292 lines = self.current_block().split('\n')
293 293 currentIndent = len(lines[-1]) - len(lines[-1])
294 294 if(currentIndent == 0):
295 295 currentIndent = self.tabSpaces
@@ -313,12 +313,12 b' class IPythonCocoaController(NSObject, FrontEndBase):'
313 313 if(selector == 'insertNewline:'):
314 314 indent = self.current_indent_string()
315 315 if(indent):
316 line = indent + self.currentLine()
316 line = indent + self.current_line()
317 317 else:
318 line = self.currentLine()
318 line = self.current_line()
319 319
320 if(self.is_complete(self.currentBlock())):
321 self.execute(self.currentBlock(),
320 if(self.is_complete(self.current_block())):
321 self.execute(self.current_block(),
322 322 blockID=self.currentBlockID)
323 323 self.start_new_block()
324 324
@@ -327,7 +327,7 b' class IPythonCocoaController(NSObject, FrontEndBase):'
327 327 return False
328 328
329 329 elif(selector == 'moveUp:'):
330 prevBlock = self.get_history_previous(self.currentBlock())
330 prevBlock = self.get_history_previous(self.current_block())
331 331 if(prevBlock != None):
332 332 self.replace_current_block_with_string(textView, prevBlock)
333 333 else:
@@ -368,7 +368,7 b' class IPythonCocoaController(NSObject, FrontEndBase):'
368 368 return False # don't actually handle the delete
369 369
370 370 elif(selector == 'insertTab:'):
371 if(len(self.currentLine().strip()) == 0): #only white space
371 if(len(self.current_line().strip()) == 0): #only white space
372 372 return False
373 373 else:
374 374 self.textView.complete_(self)
@@ -70,7 +70,15 b' class IFrontEnd(zi.Interface):'
70 70 """Subclass may override to update the input prompt for a block.
71 71 Since this method will be called as a
72 72 twisted.internet.defer.Deferred's callback,
73 implementations should return result when finished."""
73 implementations should return result when finished.
74
75 NB: result is a failure if the execute returned a failre.
76 To get the blockID, you should do something like::
77 if(isinstance(result, twisted.python.failure.Failure)):
78 blockID = result.blockID
79 else:
80 blockID = result['blockID']
81 """
74 82
75 83 pass
76 84
@@ -311,7 +319,7 b' class FrontEndBase(object):'
311 319 twisted.internet.defer.Deferred's callback, implementations should
312 320 return result when finished.
313 321
314 NP: result is a failure if the execute returned a failre.
322 NB: result is a failure if the execute returned a failre.
315 323 To get the blockID, you should do something like::
316 324 if(isinstance(result, twisted.python.failure.Failure)):
317 325 blockID = result.blockID
General Comments 0
You need to be logged in to leave comments. Login now