def detect_slides(self):
        progress = ui.ProgressController('Analyzing Video: ',
                                         self.sequence.len)
        progress.start()
        frames = []
        name_getter = mediaoutput.TimestampImageWriter(self.sequence.fps)
        for i, frame in self.check_transition():
            progress.update(i)
            if frame is not None:
                frames.append(Slide(name_getter.next_name([i]), frame))

        progress.finish()

        self.sequence.release_stream()
        return frames
Example #2
0
def processDocTitle(node):
    global toc
    for c in node.children:
        if isinstance(c, docutils.nodes.title):
            titles['Name'] = str(c.children[0])  # Assume a single Text node.
        elif isinstance(c, docutils.nodes.field_list):
            for f in c.children:
                assert isinstance(f.children[0], docutils.nodes.field_name)  and  \
                       isinstance(f.children[1], docutils.nodes.field_body)
                name = "".join([str(x) for x in f.children[0].children])
                titles[name] = Slide.renderText(f.children[1].children[0])

        elif isinstance(c, docutils.nodes.table):
            toc = c
        elif isinstance(c, docutils.nodes.section):
            processSlide(c)
        else:
            print "Unexpected %s under document title:" % type(c)
            print c
Example #3
0
# title graphic: PB peanut butter jar, "Twist(ed)" on lid
lecture = Lecture(
    "Perspective Broker: Translucent RPC in Twisted",
    # intro
    Raw(
        "Title",
        """
    <h1>Perspective Broker: Translucent RPC in Twisted</h1>
    <h2>PyCon 2003</h2>
    <h2>Brian Warner &lt; warner @ lothar . com &gt; </h2>
    """,
    ),
    Slide(
        "Introduction",
        Bullet("Overview/definition of RPC"),
        Bullet("What is Perspective Broker?"),
        Bullet("How do I use it?"),
        Bullet("Security Issues"),
        Bullet("Future Directions"),
    ),
    Slide(
        "Remote Procedure Calls",
        Bullet(
            "Action at a distance: separate processes, safely telling each other what to do",
            SubBullet("Separate memory spaces"),
            SubBullet("Usually on different machines"),
        ),
        Bullet("Frequently called RMI these days: Remote Method Invocation"),
        Bullet("Three basic parts: Addressing, Serialization, Waiting"),
    ),
    Slide(
        "Addressing",
Example #4
0
        self.title = title
        self.html = html

    def toHTML(self):
        return self.html


class HTML(Raw):
    def __init__(self, html):
        self.html = html

lecture = Lecture(
    "BuildBot: Build/Test Automation",
    Slide("The BuildBot: Build/Test Automation",
          Bullet("Home page: ",
                 URL("http://buildbot.sourceforge.net/"),
                 ),
          Bullet("Brian Warner  < warner-buildbot @ lothar . com >"),
          ),

    # quick description of what it does
    # motivation: what is the problem it is trying to solve
    # architecture: master+slaves
    # design
    #  starting the build: changes, tree-stable timers
    #  doing the build: builders, processes
    #  describing the build: status
    #  status clients
    # configuration: examples of Step, setup script
    # demos: glib, show twisted status page
    # future directions
    # current status, availability, more info
$ kill `cat twistd.pid`
"""

GUI_CODE = """\
from twisted.internet import gtkreactor
gtkreactor.install()
import gtk
w = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL)
w.show_all()
from twisted.internet import reactor
reactor.run()
"""

lecture = Lecture(
    "The twisted.internet Tutorial of Doom",
    Slide("Part 1 - Introduction"),
    # there are different ways to do networking
    # mention processes are not cross-platform
    Slide(
        "Choosing a networking paradigm for the enterprise",
        Bullet("Event driven"),
        Bullet(Bad("Threads")),
        Bullet("Others which we will ignore (processes, SEDA, ...)"),
    ),
    # it's a metaphor!
    Slide(
        "Applied Bistromathics 101",
        Bullet("Consider a restaurant as a network application"),
        Bullet("Clients come in, make requests to the waiters"),
        Bullet("Waiters act on clients' choices"),
    ),
Example #6
0
from slides import Slide
a_text = '''some text with *ordinary* _markup_
spanning multiple lines spanning multiple lines spanning multiple lines spanning multiple lines spanning multiple lines spanning multiple 

and with paragraphs'''
a = Slide('A header', a_text)

print(a)
Example #7
0
#!/usr/bin/python2.2

from slides import Lecture, NumSlide, Slide, Bullet, SubBullet, PRE, URL

lecture = Lecture(
    "High-Level Database Interaction with SQLObject",
    Slide(
        "What is SQLObject?",
        Bullet("YAORM -- Yet Another Object-Relational Mapper"),
        Bullet(
            "Allows you to map your Python classes to your database schema"),
        Bullet("Takes the 'SQL' out of 'Database Programming'"),
        Bullet("No special XML files to create, just normal Python classes")),
    Slide(
        "Why Do I Care?",
        Bullet(
            "Storing things in databases is fairly common in day-to-day programming"
        ),
        Bullet(
            "SQL is the standard language used to manipulate data in a database"
        ), Bullet("Writing SQL is boring, repetitive and depressing"),
        Bullet("SQLObject relieves you of the burden of writing SQL"),
        Bullet("...but still lets you write SQL when you need to")),
    Slide(
        "How does SQLObject differ from other ORM's?",
        Bullet(
            "Simple is better than complex; SQLObject is very simple to use"),
        Bullet("Mappings are defined using normal Python classes"),
        Bullet(
            "Uses properties instead of wordy get/set methods for column attributes"
        ),
 def analyze(self):
     for i, frame in self.check_transition():
         time = mediaoutput.TimestampImageWriter(
             self.sequence.fps).next_name([i])
         yield Slide(time, frame)
Example #9
0
def processSlide(slide):
    global counter
    if not isinstance(slide, docutils.nodes.section):
        print "Unexpected node under root:", type(slide), slide
        return
    if not isinstance(slide.children[0], docutils.nodes.title):
        print "No title node under section node?!"
        print slide.children
        return
    titleNode = slide.children[0]
    if not isinstance(titleNode.children[0], docutils.nodes.Text):
        print "No text in the title node!"
        return
    title = titleNode.children[0]

    # Check for a hashtag template name.
    template = 'Single'
    for t in Slide.templates:
        hashT = '#' + t
        if hashT in title:
            title = title.replace(hashT, '')
            template = t

    current = Slide(title='%d. %s' % (counter, title), template=template)
    counter += 1

    if args.debug:
        print "Slide.children"
        print "\n".join(['  ' + str(x) for x in slide.children])

    for node in slide.children[1:]:
        if isinstance(node, docutils.nodes.bullet_list)  or \
           isinstance(node, docutils.nodes.enumerated_list) :
            for subnode in node.children:
                if isinstance(subnode, docutils.nodes.list_item):
                    current.addText(subnode, parent=node)

        elif isinstance(node, docutils.nodes.definition_list):
            for subnode in node.children:
                current.addText(subnode, parent=node)

        elif isinstance(node, docutils.nodes.paragraph):
            current.addText(node)

        elif isinstance(node, docutils.nodes.image):
            #path = os.path.join(args.inputFolder, node.get('uri'))
            # Temporarily removed the image-magick calls so it is not a dependency at
            # install time as we do not currently use the aspect ratio for layout.
            #width, height = subprocess.Popen(['identify', '-format', '%w %h', path],
            #                                 stdout=subprocess.PIPE).communicate()[0].split(' ')
            #current.addImage(node, aratio=float(width)/float(height))
            current.addImage(node, aratio=1.0)

        elif isinstance(node, docutils.nodes.topic):
            if isinstance(node.children[0], docutils.nodes.title) and len(
                    node.children) == 2:
                current.addText(node)
            else:
                print "Unrecognised topic structure", node, node.children

        elif isinstance(node, docutils.nodes.literal_block):
            current.addText(node, parent=node)

        elif isinstance(node, docutils.nodes.block_quote):
            current.addText(node, parent=node)

        elif isinstance(node, docutils.nodes.table):
            current.addText(node, parent=node)

        elif isinstance(node, docutils.nodes.raw):
            if node['slidepos'] == 'video':
                current.addRaw(node['rawtext'])
            elif node['slidepos'] == 'text':
                current.addText(node, parent=None)
            else:
                assert False, "Unknown slidepos in raw node! %s" % node[
                    'slidepos']

        else:
            print "Other!", node

    presentation.append(current)