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

web = html()


class page:
    name = __name__
    title = 'Python GTK examples.'
    intro = 'Various examples of using gtk widgets in python to build applications.'
    date = '2013-01-01'
    path = os.path.abspath('./')
    tags = 'python', 'gtk3', 'index'

    def create_content(self):
        web.page.section(web.list.render())

        web.page.section(
            web.paragraph.create(
                """Index of various code snippets demonstrating using the different gtk3 widgets, they should all run in both python 2 and 3. 
                I plan to update and add to these examples, if you would like to see any specific examples let me know."""
            ).render()
        )

        web.pre.create('bzr branch lp:~oly/python-examples/trunk').render()
        web.link.create('Launchpad','View Code here','http://bazaar.launchpad.net/~oly/python-examples/trunk/files/head:/python-examples/gtk3/')

        web.page.section(
            web.paragraph.create(
                """You can checkout all examples and the glade files to run by using the commad below in a linke terminal or view it directly on """
            ).append(
                web.link.render()
            ).append(
                web.pre.render()
            ).render()
        )

        pages = (
            ('GTK3 Display a window'),
            ('GTK3 Buttons and switches'),
            ('GTK3 Radio Buttons and switches'),
            ('GTK3 Dropdowns and spin buttons'),
            ('GTK3 progress bar and spinner'),
            ('GTK3 Dialog boxes'),
            ('GTK3 App Chooser and scale buttons'),
            ('GTK3 Calendars and menus'),
            ('GTK3 Treeview in liststore mode'),
            ('GTK3 Treeview in treestore mode'),
            ('GTK3 Textview interaction'),
            ('GTK3 Displaying OpenGL inside a drawing area'),
            ('GTK3 Listbox downloader'),
            ('GTK3 Touch screen events'),
            ('GTK3 Simple Opengl application with gtk and Touch screen events'),
            ('GTK3 Creating and connecting to custom signals'),
            )

        count = 1
        web.list.create('')
        for item in pages:
            web.link.create(item, item ,'./tutorial' + str(count) + '.htm')
            web.list.append(web.link.render())
            count += 1
        web.page.section(web.list.render())

