#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 Dropdowns and spin buttons'
    tags = 'GTK3', 'Python', 'window', 'dropdown', 'select', 'spin'
    intro = 'GTK example of  some combo / slecet drop down boxesfor user interaction.'
    date = '2014-01-15'
    path = os.path.abspath('./')
    image = web.template.path_image + '/gtk/tut04-text-dropdown-spin.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(
            """This example demonstrates using some drop down boxes and adding new items and retrieving the selected values.
            This snippet also demonstrates the use of spin buttons for selecting a value from a range.""")
        web.page.section(web.paragraph.render())

        web.paragraph.create(
            """When creating a combobbox in glade make sure you add a liststore to the widget, and also edit the combobox properties in a seperate window so you can access and the hierarchy menu and assign a cell render to the column in your listview.""")
        web.page.section(web.paragraph.render())

        web.paragraph.create(web.images.create(web.template.path_image + 'gtk/tut04/add-list-store.png', 'Windows 8.1 partition screenshot').render())
        web.paragraph.append(web.images.create(web.template.path_image + 'gtk/tut04/attach-cell-renderer-set-text-column.png', 'Windows 8.1 partition screenshot').render())
        web.paragraph.append(web.images.create(web.template.path_image + 'gtk/tut04/attach-liststore-model.png', 'Windows 8.1 partition screenshot').render())
        web.paragraph.append(web.images.create(web.template.path_image + 'gtk/tut04/edit-combobox-liststore.png', 'Windows 8.1 partition screenshot').render())
        web.page.section(web.paragraph.render())

        web.pre.create(load(os.path.abspath('./content/gtk3/tut04/tut04-text-dropdown-spin.py')))
        web.page.section(web.pre.render())

