Changes

Added Entry and OptionMenu examples.
Line 12: Line 12:  
  from sugar.graphics.toolbar import Toolbar
 
  from sugar.graphics.toolbar import Toolbar
 
  from sugar.graphics.iconbutton import IconButton
 
  from sugar.graphics.iconbutton import IconButton
 +
from sugar.graphics.entry import Entry
 +
from sugar.graphics.optionmenu import OptionMenu
 +
from sugar.graphics.menu import MenuItem
 
   
 
   
 
  class FooActivity(activity.Activity):
 
  class FooActivity(activity.Activity):
 +
 +
    _ACTION_ANYTHING = 1
 +
    _ACTION_APPLES = 2
 +
    _ACTION_ORANGES = 3
 +
 
     def __init__(self, handle):
 
     def __init__(self, handle):
 
         activity.Activity.__init__(self, handle)
 
         activity.Activity.__init__(self, handle)
Line 30: Line 38:  
         button.connect("activated", self._button_activated_cb)
 
         button.connect("activated", self._button_activated_cb)
 
         toolbar.append(button)
 
         toolbar.append(button)
 +
 +
        entry = Entry()
 +
        button.connect("activated", self._entry_activated_cb)
 +
        toolbar.append(entry)
 +
 +
        option_menu = OptionMenu()
 +
        option_menu.add_item(MenuItem(self._ACTION_ANYTHING, _('Anything')))
 +
        option_menu.add_item(MenuItem(self._ACTION_APPLES, _('Apples'),
 +
                                      'theme:stock-close'))
 +
        option_menu.add_item(MenuItem(self._ACTION_ORANGES, _('Oranges')))
 +
        option_menu.add_separator()
 +
        toolbar.append(option_menu)
 
   
 
   
 
         textViewWidget = hippo.CanvasWidget()
 
         textViewWidget = hippo.CanvasWidget()
Anonymous user