Source

tw2.jqplugins.fg / tw2 / jqplugins / fg / samples.py

"""
Here you can create samples of your widgets by providing default parameters,
inserting them in a container widget, mixing them with other widgets, etc...
These samples will appear in the WidgetBrowser

See http://toscawidgets.org/documentation/WidgetBrowser for more information
"""

import tw2.jqplugins.ui
from widgets import MenuWidget
import tw2.core as twc

some_items = [
    {'name' : "Breaking News",
        'children' : [ 
            {'name' : "Entertainment",},
            {'name' : "Politics",},
            {'name' : "A&E",},
            {'name' : "Sports", 
                'children' : [ 
                    {'name' : "Baseball",},
                    {'name' : "Basketball",},
                    {'name' : "A really long label would wrap nicely as you can see",},
                    {'name' : "Swimming", 
                        'children' : [ 
                            {'name' : "High School",},
                            {'name' : "College",},
                            {'name' : "Professional", 
                                'children' : [ 
                                    {'name' : "Mens Swimming", 
                                        'children' : [ 
                                            {'name' : "News",},
                                            {'name' : "Events",},
                                            {'name' : "Awards",},
                                            {'name' : "Schedule",},
                                            {'name' : "Team Members",},
                                            {'name' : "Fan Site",},
                                        ]
                                    }, 
                                    {'name' : "Womens Swimming", 
                                        'children' : [ 
                                            {'name' : "News",},
                                            {'name' : "Events",},
                                            {'name' : "Awards",},
                                            {'name' : "Schedule",},
                                            {'name' : "Team Members",},
                                            {'name' : "Fan Site",},
                                        ]
                                    }, 
                                ]
                            }, 
                            {'name' : "Adult Recreational",},
                            {'name' : "Youth Recreational",},
                            {'name' : "Senior Recreational",},
                        ]
                    }, 
                    {'name' : "Tennis",},
                    {'name' : "Ice Skating",},
                    {'name' : "Javascript Programming",},
                    {'name' : "Running",},
                    {'name' : "Walking",},
                ]
            }, 
            {'name' : "Local",},
            {'name' : "Health",},
        ],
    }, 
    {'name' : "Entertainment", 
    'children' : [ 
        {'name' : "Celebrity news",},
        {'name' : "Gossip",},
        {'name' : "Movies",},
        {'name' : "Music", 
        'children' : [ 
            {'name' : "Alternative",},
            {'name' : "Country",},
            {'name' : "Dance",},
            {'name' : "Electronica",},
            {'name' : "Metal",},
            {'name' : "Pop",},
            {'name' : "Rock", 
                'children' : [ 
                    {'name' : "Bands", 
                        'children' : [ 
                            {'name' : "Dokken",},
                        ],
                    }, 
                    {'name' : "Fan Clubs",},
                    {'name' : "Songs",},
                ],
            }, 
        ],
        }, 
        {'name' : "Slide shows",},
        {'name' : "Red carpet",},
    ],
    }, 
    {'name' : "Finance", 
    'children' : [ 
        {'name' : "Personal", 
        'children' : [ 
            {'name' : "Loans",},
            {'name' : "Savings",},
            {'name' : "Mortgage",},
            {'name' : "Debt",},
        ],
        }, 
        {'name' : "Business",},
    ],
    }, 
    {'name' : "Food & Cooking", 
    'children' : [ 
        {'name' : "Breakfast",},
        {'name' : "Lunch",},
        {'name' : "Dinner",},
        {'name' : "Dessert", 
            'children' : [ 
                {'name' : "Dump Cake",},
                {'name' : "Doritos",},
                {'name' : "Both please.",},
            ],
        }, 
    ],
    }, 
    {'name' : "Lifestyle",},
    {'name' : "News",},
    {'name' : "Politics",},
    {'name' : "Sports", 
        'children' : [ 
            {'name' : "Baseball",},
            {'name' : "Basketball",},
            {'name' : "Swimming", 
            'children' : [ 
                {'name' : "High School",},
                {'name' : "College",},
                {'name' : "Professional", 
                'children' : [ 
                    {'name' : "Mens Swimming", 
                    'children' : [ 
                            {'name' : "News",},
                            {'name' : "Events",},
                            {'name' : "Awards",},
                            {'name' : "Schedule",},
                            {'name' : "Team Members",},
                            {'name' : "Fan Site",},
                    ],
                    }, 
                    {'name' : "Womens Swimming", 
                    'children' : [ 
                        {'name' : "News",},
                        {'name' : "Events",},
                        {'name' : "Awards",},
                        {'name' : "Schedule",},
                        {'name' : "Team Members",},
                        {'name' : "Fan Site",},
                    ],
                    },
                ],
                }, 
                {'name' : "Adult Recreational",},
                {'name' : "Youth Recreational",},
                {'name' : "Senior Recreational",},
            ],
            }, 
            {'name' : "Tennis",},
            {'name' : "Ice Skating",},
            {'name' : "Javascript Programming",},
            {'name' : "Running",},
            {'name' : "Walking",},
        ],
        }, 
    ]

class DemoMenuWidget(MenuWidget):
    items = some_items
    options = {
        'backLink' : False,
        'maxHeight' : 300,
        'width' : 250,
        'onClick' : twc.JSSymbol("""
            function() {
                alert("You selected: " + $(this).text());
            }
        """)
    }
    child = tw2.jqplugins.ui.ButtonWidget(
        options={
            'label' : 'A Menu',
            'icons' : {
                'primary' : 'ui-icon-triangle-1-s'
            }
        }
    )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.