pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Python pastebin - collaborative debugging tool View Help


Posted by Roberto Alsina on Wed 3 Jun 18:28
report abuse | download | new post

  1. class DelayedParagraph(IndexingFlowable):
  2.     """A flowable that inserts a paragraph, but will only do so and be satisfied
  3.    when it has some required data, such as page numbers"""
  4.     def __init__(self, text, style,
  5.         bulletText = None, frags=None, caseSensitive=1, encoding='utf8'):
  6.         self.text=text
  7.         self.style=style
  8.         self.bulletText=bulletText
  9.         self.frags=frags
  10.         self.caseSensitive=caseSensitive
  11.         self.encoding=encoding
  12.         self._satisfied=False
  13.         self.refs={}
  14.        
  15.     def isSatisfied(self):
  16.         print 'satisfied',self._satisfied
  17.         return self._satisfied
  18.        
  19.     def wrap(self, w, h):
  20.         print 'wrap'
  21.         self.para=Paragraph(self.text,self.style,self.bulletText,self.frags,self.
  22.         caseSensitive,self.encoding)
  23.         return self.para.wrap(w,h)
  24.  
  25.     def split(self, w, h):
  26.         print 'split'
  27.         return self.para.split(w, h)
  28.  
  29.     def drawOn(self, canvas, x, y, _sW=0):
  30.         print 'drawOn'
  31.         self.para.drawOn(canvas, x, y, _sW)
  32.        
  33.     def notify(self,kind,stuff):
  34.         if kind=='Reference':
  35.             print "Stuff",stuff
  36.             refid,page=stuff
  37.             self.refs[refid]=page
  38.             # Try to resolve page references
  39.             try:
  40.                 # Text wil be something like
  41.                 #'Go see A title (Page %(a-title)s)'
  42.                 # and self.refs would be
  43.                 # {'a-title': 2}
  44.                 self.text=self.text%self.refs
  45.                 print self.text,self.refs
  46.                 self._satisfied=True
  47.             except:
  48.                 pass

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post