#append this to module path so we can load from the parent directory
import sys, os
from scaffold import web
from scaffold.loaders import load, load_partial


class page:
    name=__name__
    title = 'GTK3 Touchscreen events'
    tags = 'GTK3', 'Python', 'listbox', 'drawingarea', 'touch'
    intro = 'Example of catching touch screen events and filtering device type, helpful for making touch friendly gtk apps.'
    date = '2014-05-20'
    path = os.path.abspath('./')
    image = web.template.path_image + '/gtk/tut14-touchscreen-events.png'

    def create_content(self):
        web.images.create(self.image, title='GTK Window')
        web.page.section(
            web.div.create(
                web.images.render()
            ).set_classes('sources').render()
        )

        web.paragraph.create(
            """The example below demonstrates filtering events for a specific device, in this case a touch screen we then capture touch begin update and end events. 
            To my knowledge gestures are not supports so you will need to count the begins to determine the number of fingers and handle the updates to determine whats happening""")

        web.page.section(web.paragraph.render())

        web.pre.create(load(os.path.abspath('./content/gtk3/tut14/tut14-touchscreen-events.py')))
        web.page.section(web.pre.render())

