Changeset 356
- Timestamp:
- 06/21/08 23:07:54 (4 years ago)
- Files:
-
- 1 modified
-
hodgestar/Talks/PythonObjects/pyobjects.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hodgestar/Talks/PythonObjects/pyobjects.py
r349 r356 1 from slides import Lecture, Slide, Bullet, PRE, Image, SubBullet, CODE, PYCODE, PYCON, cgi 1 # pyobjects.py 2 # -*- coding: utf8 -*- 3 # Copyright 2008 Simon Cross <hodgestar@gmail.com> 4 # GPL - see COPYING for details 2 5 3 6 """ … … 6 9 depths of Object/object.c. 7 10 8 TO INCLUDE: 9 10 Proxy with new vs old classes: 11 http://bugs.python.org/issue643841 12 13 Slots and __unicode__: 14 http://bugs.python.org/issue2517 15 16 Caching of floats and ints 17 18 - screenshot of highlighted tabs in object.c 11 Talk given to the Cape Town Python Users Group on 21 June 2008. 19 12 """ 20 13 14 from slides import Lecture, Slide, Bullet, PRE, Image, SubBullet, CODE, PYCODE, PYCON, cgi 15 16 # 17 # Customisation of Python slides for this talk 18 # 19 21 20 class MyLecture(Lecture): 21 """Allow list of CSS files for pygments rendering. 22 """ 22 23 def getHeader(self): 23 24 """Return the header for HTML pages.""" … … 28 29 return result + '</head>\n<body>\n' 29 30 30 class MySlide(Slide):31 _Slide = Slide31 class CenteredSlide(Slide): 32 """Centered slides.""" 32 33 def toHTML(self): 33 html = s elf._Slide.toHTML(self)34 html = super(CenteredSlide, self).toHTML() 34 35 return "<div style='margin: auto; width: 50%;'>" + html + "</div>" 35 36 36 Slide = MySlide37 Slide = CenteredSlide 37 38 38 39 class TitleSlide(Slide): 40 """Centered title slides.""" 39 41 def toHTML(self): 40 42 title = '<h1>%s</h1>' % cgi.escape(self.title) … … 45 47 46 48 class BulletlessSlide(Slide): 49 """Slide without bullets.""" 47 50 start = "<ul style='list-style-type: none;'>\n" 48 51 end = "</ul>\n" 49 52 50 53 class BulletlessTitleSlide(TitleSlide): 54 """Title slide without bullets.""" 51 55 start = "<ul style='list-style-type: none;'>\n" 52 56 end = "</ul>\n" 53 57 54 58 class URL(object): 55 """A URL ."""59 """A URL with both description and link.""" 56 60 def __init__(self, desc, url): 57 61 self.url = url … … 60 64 def toHTML(self): 61 65 return '<a href="%s">%s</a>' % (self.url, self.desc) 66 67 # 68 # PyObjects Talk 69 # 62 70 63 71 l = MyLecture(
