button.show()
maps.attach(button, 0, 1, 0, 1, gtk.EXPAND|gtk.FILL, 0, 0, 5)
- zoomlevel = self.Button( "Zoom level" , config.zoom )
- zoomlevel.connect_object( "clicked", self.zoomdialog, zoomlevel , config , handler )
+ zoomlevel = self.ZoomButton( "Zoom level" , config , handler )
zoomlevel.show()
maps.attach(zoomlevel, 1, 2, 0, 1, gtk.EXPAND|gtk.FILL, 0, 0, 5)
self.show()
- def zoomdialog ( self , widget , config , extra=None ) :
- dialog = ZoomDialog( config , widget.set_value , extra )
- dialog.show_all()
-
if hildon :
class ZoomDialog ( hildon.TouchSelector ) :
hildon.StackableWindow.__init__( self )
AbstractSettingsWindow.__init__( self , config , handler )
+ def zoomdialog ( self , widget , conf , extra=None ) :
+ conf.zoom = int( widget.get_selector().get_current_text() )
+
+ def ZoomButton ( self , text , config , handler ) :
+ selector = ZoomDialog( config )
+ button = hildon.PickerButton( gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL)
+ button.set_title( text )
+ button.set_selector( selector )
+ button.connect_object( "value-changed", self.zoomdialog , button , config , handler )
+ return button
+
def MainArea ( self ) :
return hildon.PannableArea()
def Entry ( self ) :
return gtk.Entry()
- def Button ( self , text , value ) :
+ def Button ( self , label=None ) :
+ return gtk.Button( label )
+
+ def zoomdialog ( self , widget , config , extra ) :
+ dialog = ZoomDialog( config , widget.set_value , extra )
+ dialog.show_all()
+
+ def ZoomButton ( self , text , config , handler ) :
class _button ( gtk.Button ) :
def __init__ ( self , text , value ) :
gtk.Button.__init__( self )
def set_value ( self , value ) :
self._value = value
self.set_label( "%s -- %s" % ( self._text , self._value ) )
- return _button( text , value )
+ button = _button( text , config.zoom )
+ button.connect_object( "clicked", self.zoomdialog , button , config , handler )
+ return button
def CheckButton ( self ) :
return gtk.CheckButton()