From: javiplx Date: Sat, 14 May 2011 20:25:21 +0000 (+0000) Subject: Incorporate hildongtk module developed on hildon-wrapping branch (at r125) plus a... X-Git-Tag: hildon-wrapped^0 X-Git-Url: https://vcs.maemo.org/git/?p=wifihood;a=commitdiff_plain;h=1f76ee2978ae4c8121821a0be58388bd628bb649 Incorporate hildongtk module developed on hildon-wrapping branch (at r125) plus a location wrapping module git-svn-id: file:///svnroot/wifihood/trunk@178 c51dfc6a-5949-4919-9c8e-f207a149c383 --- diff --git a/wifiscanner/MANIFEST b/wifiscanner/MANIFEST index 7375846..0f85e64 100644 --- a/wifiscanner/MANIFEST +++ b/wifiscanner/MANIFEST @@ -8,7 +8,6 @@ wifiview.desktop wifimap/__init__.py wifimap/gps.py wifimap/wifiscan.py -wifimap/osso_wrapper.py wifimap/db.py wifimap/config.py wifimap/view.py diff --git a/wifiscanner/hildongtk/hildon.py b/wifiscanner/hildongtk/hildon.py new file mode 100644 index 0000000..46b0ac6 --- /dev/null +++ b/wifiscanner/hildongtk/hildon.py @@ -0,0 +1,119 @@ + +import gtk + +__version__ = 1.0 + +gtk.HILDON_SIZE_FINGER_HEIGHT = -1 +gtk.HILDON_SIZE_AUTO = -1 +gtk.HILDON_SIZE_AUTO_WIDTH = -1 + +BUTTON_ARRANGEMENT_VERTICAL = -1 + + +class Program : + window = None + def get_instance() : + return Program() + get_instance = staticmethod( get_instance ) + def add_window ( self , window ) : + self.window = window + +class Window ( gtk.Window ) : + def __init__ ( self ) : + gtk.Window.__init__( self ) + def set_app_menu( self , menubar ) : + self.vbox.pack_start(menubar,True,True,5) + +class AppMenu ( gtk.MenuBar ) : + def append ( self , item ) : + item._menu_item = gtk.MenuItem( item.get_label() ) + item._menu_item.connect( "activate", lambda arg : item.clicked() ) + gtk.MenuBar.append( self , item._menu_item ) + +class StackableWindow ( Window ) : + def __init__ ( self ) : + Window.__init__( self ) + +class PannableArea ( gtk.ScrolledWindow ) : + def __init__ ( self ) : + gtk.ScrolledWindow.__init__( self ) + self.set_size_request(-1, 260) + self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) + +class Entry ( gtk.Entry ) : + def __init__ ( self , height ) : + gtk.Entry.__init__( self ) + +class TextView ( gtk.TextView ) : + def set_placeholder( self , text ) : + self.get_buffer().set_text( text ) + +class Button ( gtk.Button ) : + def __init__ ( self , height , arrangement , label=None , value=None ) : + self._menu_item = None + gtk.Button.__init__( self , label ) + def set_label ( self , label ) : + gtk.Button.set_label( self , label ) + if self._menu_item : + self._menu_item.set_label( self.get_label() ) + +class CheckButton ( gtk.CheckButton ) : + def __init__ ( self , height ) : + gtk.CheckButton.__init__( self ) + +# FIXME : Add value-changed signal, with the response signal from the Dialog +class PickerButton ( Button ) : + def __init__ ( self , height , arrangement ) : + Button.__init__( self , height , arrangement ) + self._title = None + self._selector = None + def _build_label ( self ) : + selected = None + if self._selector : + selected = " -- %s" % self._selector.get_current_text() + Button.set_label( self , "%s%s" % ( self._title , selected ) ) + def set_title ( self , title ) : + self._title = title + self._build_label() + def get_selector ( self ) : + return self._selector + def set_selector ( self , selector ) : + self._selector = selector + self.connect( "clicked", lambda arg : self._selector.show_all() ) + self._build_label() + +class TouchSelector ( gtk.Dialog ) : + + def __init__ ( self ) : + gtk.Dialog.__init__( self , "Select zoom level", + None, + gtk.DIALOG_MODAL, + ( gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, + gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT + ) + ) + self.combo = gtk.ComboBox() + + def append_text_column ( self , zooms , boolean ) : + self.combo.set_model( zooms ) + cell = gtk.CellRendererText() + self.combo.pack_start(cell, True) + self.combo.add_attribute(cell, 'text', 0) + + self.vbox.pack_start(self.combo , True, True, 0) + + def set_active ( self , unknown , active ) : + self.combo.set_active( active ) + + def get_current_text ( self ) : + item = self.combo.get_active_iter() + if item : + model = self.combo.get_model() + return model.get(item,0)[0] + + def response ( self , widget , response , config ) : + if response == gtk.RESPONSE_ACCEPT : + self.zoomdialog( widget , config ) + widget._build_label() + self.hide() + diff --git a/wifiscanner/hildongtk/location.py b/wifiscanner/hildongtk/location.py new file mode 100644 index 0000000..0c5122a --- /dev/null +++ b/wifiscanner/hildongtk/location.py @@ -0,0 +1,56 @@ + +METHOD_GNSS = 1 +METHOD_AGNSS = 2 + +INTERVAL_1S = 1 +INTERVAL_2S = 2 +INTERVAL_5S = 5 +INTERVAL_10S = 10 +INTERVAL_20S = 20 +INTERVAL_30S = 30 +INTERVAL_60S = 60 +INTERVAL_120S = 120 +INTERVAL_DEFAULT = INTERVAL_1S + +GPS_DEVICE_STATUS_NO_FIX = 1 +GPS_DEVICE_STATUS_FIX = 2 +GPS_DEVICE_STATUS_DGPS_FIX = 3 + + +class GPSDControl : + + def get_default () : + return GPSDControl() + + get_default = get_default.__call__ + + def __init__ ( self ) : + self.method = None + + def set_properties ( self , preferred_method , preferred_interval ) : + self.method = preferred_method + self.interval = preferred_interval + + def start ( self ) : + print "Starting",self + + def stop ( self ) : + print "Stop",self + + +class GPSDevice : + + def __init__ ( self ) : + self.status = GPS_DEVICE_STATUS_NO_FIX + self.satellites_in_use = 0 + self.satellites_in_view = 0 + self.fix = ( None , None , 0 , None , 0.0 , -0.0 , None , 0.0 , None , "NaN" , None , "NaN" , None , "NaN" , None ) + self.satellites = () + self.cell_info = () + + def connect_object ( self , signal , method , object ) : + print "Connecting object to",self + + def stop ( self ) : + print "Stopping",self + diff --git a/wifiscanner/hildongtk/osso.py b/wifiscanner/hildongtk/osso.py new file mode 100644 index 0000000..21bd5da --- /dev/null +++ b/wifiscanner/hildongtk/osso.py @@ -0,0 +1,36 @@ + +import dbus + +class Context : + + def __init__ ( self , name , version , flag ) : + self.connection = dbus.SessionBus() + self.name = name + self.version = version + + def get_connection ( self ) : + return self.connection + +class Rpc : + + def __init__ ( self , context ) : + self.context = context + + def rpc_run ( self , object_name , object_path , object_iface , method , wait_reply=False ) : + connection = self.context.get_connection() + proxy = connection.get_object( object_name , object_path ) + iface = dbus.Interface( proxy , object_iface ) + iface = dbus.Interface( proxy , dbus_interface=object_iface ) + callable = iface.get_dbus_method( method ) + return callable() + + +class Reporter : + def __init__ ( self , context ) : + self.context = context + def system_note_infoprint( self , message ) : + print "MESSAGE : %s" % message + +def SystemNote ( context ) : + return Reporter() + diff --git a/wifiscanner/wifimap/osso_wrapper.py b/wifiscanner/wifimap/osso_wrapper.py deleted file mode 100644 index fa4bbca..0000000 --- a/wifiscanner/wifimap/osso_wrapper.py +++ /dev/null @@ -1,26 +0,0 @@ - -import dbus - -class Context : - - def __init__ ( self , name , version , flag ) : - self.connection = dbus.SessionBus() - self.name = name - self.version = version - - def get_connection ( self ) : - return self.connection - -class Rpc : - - def __init__ ( self , context ) : - self.context = context - - def rpc_run ( self , object_name , object_path , object_iface , method , wait_reply=False ) : - connection = self.context.get_connection() - proxy = connection.get_object( object_name , object_path ) - iface = dbus.Interface( proxy , object_iface ) - iface = dbus.Interface( proxy , dbus_interface=object_iface ) - callable = iface.get_dbus_method( method ) - return callable() -