Send commitlog mailing list submissions to
commitlog@lists.openmoko.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
commitlog-requ...@lists.openmoko.org
You can reach the person managing the list at
commitlog-ow...@lists.openmoko.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r4871 - developers/erin_yueh/bt (erin_y...@docs.openmoko.org)
2. r4872 - in developers/charlie/Tests/Python: . import
(char...@docs.openmoko.org)
3. r4873 - developers/charlie/Tests (char...@docs.openmoko.org)
4. r4874 - developers/erin_yueh/bt (erin_y...@docs.openmoko.org)
--- Begin Message ---
Author: erin_yueh
Date: 2008-12-15 20:54:13 +0100 (Mon, 15 Dec 2008)
New Revision: 4871
Modified:
developers/erin_yueh/bt/browse_device.py
developers/erin_yueh/bt/bt_adapter.py
developers/erin_yueh/bt/bt_main.py
developers/erin_yueh/bt/send_file.py
Log:
add bonding property, use dbus only in bt_adapter... etc.
Modified: developers/erin_yueh/bt/browse_device.py
===================================================================
--- developers/erin_yueh/bt/browse_device.py 2008-12-14 11:10:55 UTC (rev
4870)
+++ developers/erin_yueh/bt/browse_device.py 2008-12-15 19:54:13 UTC (rev
4871)
@@ -10,11 +10,7 @@
raise SystemExit
import lightblue
-import bluetooth
-
import bt_adapter
-DEVICE_TYPE = ('Miscellaneous','Computer','Phone','LAN/Network Access
point','Audio/Video',
- 'Peripheral','Imaging','Wearable','Toy','Uncategorized')
class BrowseDevice:
@@ -23,11 +19,10 @@
def delete_event(self, widget, event, data=None):
print 'delete_event:', widget,event
self.w.destroy()
- #gtk.main_quit()
return False
- def add_row(self, b):
-
+ def start_searching(self, b):
+
dev_list = lightblue.finddevices()
print dev_list
i0 = None
@@ -37,6 +32,8 @@
name = self.adapter.getRemoteName(addr)
dev_type = self.adapter.getRemoteMajorClass(addr)
pincode = self.adapter.getPinCodeLength(addr)
+ if self.adapter.hasBonding(addr) == True:
+ dev_type = dev_type + " connected"
row = (addr,name,dev_type,pincode)
i0 = self.w.sm.get_model().append(row)
# select the new row in each view
@@ -44,8 +41,38 @@
sel = self.w.tv.get_selection()
i1 = self.w.sm.convert_child_iter_to_iter(None, i0)
sel.select_iter(i1)
-
-
+
+
+ def search(rows, func, data):
+ if not rows: return None
+ for row in rows:
+ if func(row, data):
+ return row
+ result = search(row.iterchildren(), func, data)
+ if result: return result
+ return None
+
+ def search_device_inTree(self, address):
+ addr_list = [ r[0] for r in self.liststore ]
+ if addr_list.__contains__(address):
+ return addr_list.index(address)
+ else:
+ return None
+
+ def bonding_created_cb(self, address):
+ print 'bonding_created_cb', address
+ index = self.search_device_inTree(address)
+ if index != None:
+ dev_type = self.adapter.getRemoteMajorClass(address)
+ self.liststore[index][2] = dev_type + " connected"
+
+ def bonding_removed_cb(self, address):
+ print 'bonding_removed_cb', address
+ index = self.search_device_inTree(address)
+ if index != None:
+ dev_type = self.adapter.getRemoteMajorClass(address)
+ self.liststore[index][2] = dev_type + " disconnected"
+
def get_BT_adapter(self):
self.bt_addr = self.adapter.getAddress()
@@ -65,18 +92,19 @@
def connect_to_dv(self,addr):
print 'connecting....', addr
- self.adapter.createBonding(addr)
+ if self.adapter.hasBonding(addr):
+ self.adapter.removeBonding(addr)
+ else:
+ self.adapter.createBonding(addr)
- def __init__(self):
+ def __init__(self, bt):
# retrieve BT adapter info
- self.adapter = bt_adapter.BluetoothAdapter()
+ self.adapter = bt.bluetooth_adapter
self.get_BT_adapter()
- #print self.lastseen_name,self.lastseen_class
# create a liststore with 2 columns
- #self.liststore =
gtk.ListStore(gtk.gdk.Pixbuf,str,str,str,gtk.gdk.Pixbuf)
# addr,name,type,security
self.liststore = gtk.ListStore(str,str,str,int)
# Create new windows
@@ -98,7 +126,7 @@
win.vbox.pack_start(win.sw)
win.b = gtk.Button('Start Searching...')
- win.b.connect('clicked', self.add_row)
+ win.b.connect('clicked', self.start_searching)
win.vbox.pack_start(win.b, False)
win.sw.add(win.tv)
@@ -124,12 +152,13 @@
win.tv.column[1].set_attributes(win.tv.cell[1], stock_id=1)
win.tv.append_column(win.tv.column[1])
-
# display last seen devices
for addr in self.lastseen:
name = self.adapter.getRemoteName(addr)
dev_type = self.adapter.getRemoteMajorClass(addr)
pincode = self.adapter.getPinCodeLength(addr)
+ if self.adapter.hasBonding(addr) == True:
+ dev_type = dev_type + " connected"
row = (addr,name,dev_type,pincode)
self.w.sm.get_model().append(row)
Modified: developers/erin_yueh/bt/bt_adapter.py
===================================================================
--- developers/erin_yueh/bt/bt_adapter.py 2008-12-14 11:10:55 UTC (rev
4870)
+++ developers/erin_yueh/bt/bt_adapter.py 2008-12-15 19:54:13 UTC (rev
4871)
@@ -1,18 +1,24 @@
#!/usr/bin/env python
import gtk, gobject
+import browse_device
+
import dbus
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
+
class BluetoothAdapter(object):
- def __init__(self):
+ def __init__(self,bt):
- #self.btObj = bus.get_object( "org.freesmartphone.odeviced",
"/org/freesmartphone/Device/PowerControl/Bluetooth")
- #self.btInf = dbus.Interface( self.btObj,
"org.freesmartphone.Device.PowerControl" )
+ self.bt_main = bt
+ self.btObj = bus.get_object( "org.freesmartphone.odeviced",
"/org/freesmartphone/Device/PowerControl/Bluetooth")
+ self.btInf = dbus.Interface( self.btObj,
"org.freesmartphone.Device.PowerControl" )
+ if self.btInf.GetPower() == 0:
+ self.btInf.SetPower(True)
self.managerObj = bus.get_object('org.bluez', '/org/bluez')
self.managerInf = dbus.Interface(self.managerObj, 'org.bluez.Manager')
# /org/bluez/hci0
@@ -55,9 +61,13 @@
return self.lastseen
def bonding_created_signal(self,address):
+ # send a callback to browse device
+ self.bt_main.browse.bonding_created_cb(address)
print 'Signal: BondingCreated(%s)' % address
def bonding_removed_signal(self,address):
+ # send a callback to browse device
+ self.bt_main.browse.bonding_removed_cb(address)
print 'Signal: BondingRemoved(%s)' % address
def disc_started_signal(self,):
@@ -190,8 +200,8 @@
def hasBonding(self,addr):
try:
- self.hasBonding = self.adapterInf.HasBonding(addr)
- return self.hasBonding
+ self.bond = self.adapterInf.HasBonding(addr)
+ return self.bond
except dbus.exceptions.DBusException,e:
print 'hasBonding error: ',addr,e
return None
@@ -290,7 +300,7 @@
def getRemoteServiceHandles(self,addr,match):
try:
- print addr,match
+ print 'getRemoteServiceHandles',addr,match
self.RemoteServiceHandles =
self.adapterInf.GetRemoteServiceHandles(addr,match)
return self.RemoteServiceHandles
except dbus.exceptions.DBusException,e:
Modified: developers/erin_yueh/bt/bt_main.py
===================================================================
--- developers/erin_yueh/bt/bt_main.py 2008-12-14 11:10:55 UTC (rev 4870)
+++ developers/erin_yueh/bt/bt_main.py 2008-12-15 19:54:13 UTC (rev 4871)
@@ -1,90 +1,81 @@
#!/usr/bin/env python
import gtk, gobject
-import dbus
-import browse_device, pin, send_file, bt_adapter
+import browse_device, pin, send_file
+import bt_adapter
POWER_STATE = ('OFF', 'ON')
-
-
class bt_main(object):
-
+
def power_status_cb(self,widget):
print 'power_status_cb', widget
- '''
- curr_status = bluetooth_adapter.getPower()
- if curr_status == 1:
- bluetooth_adapter.setPower(False)
- button.set_label("OFF")
+
+ self.curr_status = self.bluetooth_adapter.getPower()
+ if self.curr_status == 1:
+ self.bluetooth_adapter.setPower(False)
+ self.power_button.set_label("Power Status: OFF")
print 'set Power OFF'
- elif curr_status == 0:
- bluetooth_adapter.setPower(True)
- button.set_label("ON")
+ elif self.curr_status == 0:
+ self.bluetooth_adapter.setPower(True)
+ self.power_button.set_label("Power Status: ON")
print 'set Power ON'
- '''
-
+
+
def browse_device_cb(self,widget):
print 'browse_device_cb', widget
- browse = browse_device.BrowseDevice()
+ self.browse = browse_device.BrowseDevice(self)
+
def send_file_cb(self,widget):
print 'send_file_cb', widget
- send_file.FileSelectionExample()
+ send_file.FileSelectionExample(self)
+
def preferences_cb(self,widget):
print 'send_preferences_cb', widget
-
+
def __init__(self):
# build bluetooth adapter
- self.bluetooth_adapter = bt_adapter.BluetoothAdapter()
+ self.bluetooth_adapter = bt_adapter.BluetoothAdapter(self)
# Create the user interface
- win = gtk.Window()
- win.connect('delete-event', gtk.main_quit)
+ self.win = gtk.Window()
+ self.win.connect('delete-event', gtk.main_quit)
- vbox = gtk.VBox()
- win.add (vbox)
- hbox = gtk.HBox()
- vbox.pack_start (hbox)
+ self.vbox = gtk.VBox()
+ self.win.add (self.vbox)
+ self.hbox = gtk.HBox()
+ self.vbox.pack_start (self.hbox)
# Bluetooth Power
#status = bt_iface.GetPower()
status = 1
- power_button = gtk.Button()
- power_button.set_label('Power Status: '+ POWER_STATE[status])
- power_button.connect ("clicked", self.power_status_cb)
- vbox.pack_start (power_button)
+ self.power_button = gtk.Button()
+ self.power_button.set_label('Power Status: '+ POWER_STATE[status])
+ self.power_button.connect ("clicked", self.power_status_cb)
+ self.vbox.pack_start (self.power_button)
# Browse Devices
- device_button = gtk.Button()
- device_button.set_label('Browse Devices')
- device_button.connect ("clicked", self.browse_device_cb)
- vbox.pack_start (device_button)
-
+ self.device_button = gtk.Button()
+ self.device_button.set_label('Browse Devices')
+ self.device_button.connect ("clicked", self.browse_device_cb)
+ self.vbox.pack_start (self.device_button)
+
# Send File
- file_button = gtk.Button()
- file_button.set_label('Send File')
- file_button.connect ("clicked", self.send_file_cb)
- vbox.pack_start (file_button)
+ self.file_button = gtk.Button()
+ self.file_button.set_label('Send File')
+ self.file_button.connect ("clicked", self.send_file_cb)
+ self.vbox.pack_start (self.file_button)
# preferences
- pref_button = gtk.Button()
- pref_button.set_label('Perferences')
- pref_button.connect ("clicked", self.preferences_cb)
- vbox.pack_start (pref_button)
-
- '''
- # PassKeyEvent
+ self.pref_button = gtk.Button()
+ self.pref_button.set_label('Perferences')
+ self.pref_button.connect ("clicked", self.preferences_cb)
+ self.vbox.pack_start (self.pref_button)
- PATH = '/my/PasskeyAgent'
- handler = pin.PasskeyAgent(PATH)
- adapter = bus.get_object('org.bluez', '/org/bluez/hci0')
- secuirty = dbus.Interface(adapter, 'org.bluez.Security')
- secuirty.RegisterDefaultPasskeyAgent(PATH)
- '''
# Show all widgets and start the main loop
- win.show_all()
+ self.win.show_all()
def main():
gtk.main()
Modified: developers/erin_yueh/bt/send_file.py
===================================================================
--- developers/erin_yueh/bt/send_file.py 2008-12-14 11:10:55 UTC (rev
4870)
+++ developers/erin_yueh/bt/send_file.py 2008-12-15 19:54:13 UTC (rev
4871)
@@ -10,22 +10,20 @@
raise SystemExit
from xml.dom.minidom import parseString
-
import lightblue
-import bt_adapter
class FileSelectionExample:
# Get the selected filename and print it to the console
def file_ok_sel(self, w):
print "%s" % self.filew.get_filename()
- dev = SelectDevice(self.filew.get_filename())
+ dev = SelectDevice(self.bt,self.filew.get_filename())
self.filew.destroy()
def destroy(self, widget):
self.filew.destroy()
- def __init__(self):
-
+ def __init__(self,bt):
+ self.bt = bt
# Create a new file selection widget
self.filew = gtk.FileSelection("File selection")
@@ -67,12 +65,14 @@
if node.nodeType == node.ELEMENT_NODE and node.getAttribute('id')
== '0x0004':
val = node.getElementsByTagName('uint8')
return int(val[0].getAttribute('value'), 16)
-
+
def resolveService(self, addr, service='FTP' ):
- service_handle = self.adapter.getRemoteServiceHandles(addr,'FTP')
+ #service_handle = self.adapter.GetRemoteServiceHandles(addr,'')
+ service_handle =
self.bt.bluetooth_adapter.getRemoteServiceHandles(addr,'FTP')
+ print 'service_handle: ',service_handle
if service_handle:
- xml=
self.adapter.getRemoteServiceRecordAsXML(addr,service_handle[0])
+ xml=
self.bt.bluetooth_adapter.getRemoteServiceRecordAsXML(addr,service_handle[0])
doc=parseString(xml)
return self.__browsexml(doc)
else:
@@ -94,10 +94,10 @@
def start_sending(self, widget):
print 'starting_sending'
- def __init__(self,name):
+ def __init__(self,bt,name):
print 'SelectDevice: dev_list'
self.sendfname = name
-
+ self.bt = bt
# create a liststore with 2 columns
self.liststore = gtk.ListStore(str, str)
@@ -137,16 +137,13 @@
win.tv.column[i].set_attributes(win.tv.cell[i], text=i)
# display ListBondings
- #self.obj = bus.get_object('org.bluez', '/org/bluez/hci0')
- #self.adapter = dbus.Interface(self.obj, 'org.bluez.Adapter')
- self.adapter = bt_adapter.BluetoothAdapter()
- list_bonding = self.adapter.listBondings()
+ list_bonding = self.bt.bluetooth_adapter.listBondings()
print list_bonding
self.dev_list = {}
for addr in list_bonding:
- name = self.adapter.getRemoteName(addr)
- dtype = self.adapter.getRemoteMajorClass(addr)
+ name = self.bt.bluetooth_adapter.getRemoteName(addr)
+ dtype = self.bt.bluetooth_adapter.getRemoteMajorClass(addr)
self.w.sm.get_model().append([name,dtype])
self.dev_list[name] = addr
--- End Message ---
--- Begin Message ---
Author: charlie
Date: 2008-12-16 07:41:54 +0100 (Tue, 16 Dec 2008)
New Revision: 4872
Added:
developers/charlie/Tests/Python/import/
developers/charlie/Tests/Python/import/module1.py
developers/charlie/Tests/Python/import/module2.py
developers/charlie/Tests/Python/import/test.py
Log:
Add python import tests scripts
Added: developers/charlie/Tests/Python/import/module1.py
===================================================================
--- developers/charlie/Tests/Python/import/module1.py
(rev 0)
+++ developers/charlie/Tests/Python/import/module1.py 2008-12-16 06:41:54 UTC
(rev 4872)
@@ -0,0 +1,5 @@
+
+import time
+print "wait 5 sec from module2"
+time.sleep(5)
+print "module2 finished importing"
Added: developers/charlie/Tests/Python/import/module2.py
===================================================================
--- developers/charlie/Tests/Python/import/module2.py
(rev 0)
+++ developers/charlie/Tests/Python/import/module2.py 2008-12-16 06:41:54 UTC
(rev 4872)
@@ -0,0 +1,5 @@
+
+import time
+print "wait 5 sec from module1"
+time.sleep(5)
+print "module1 finished importing"
Added: developers/charlie/Tests/Python/import/test.py
===================================================================
--- developers/charlie/Tests/Python/import/test.py
(rev 0)
+++ developers/charlie/Tests/Python/import/test.py 2008-12-16 06:41:54 UTC
(rev 4872)
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+from threading import Thread
+import time
+
+def load1():
+ import module1
+
+def load2():
+ import module2
+
+t1 = Thread(target=load1)
+t2 = Thread(target=load2)
+
+t1.start()
+t2.start()
Property changes on: developers/charlie/Tests/Python/import/test.py
___________________________________________________________________
Name: svn:executable
+ *
--- End Message ---
--- Begin Message ---
Author: charlie
Date: 2008-12-16 07:59:37 +0100 (Tue, 16 Dec 2008)
New Revision: 4873
Added:
developers/charlie/Tests/paroli_report.txt
Log:
Add paroli_report.text
Added: developers/charlie/Tests/paroli_report.txt
===================================================================
--- developers/charlie/Tests/paroli_report.txt (rev 0)
+++ developers/charlie/Tests/paroli_report.txt 2008-12-16 06:59:37 UTC (rev
4873)
@@ -0,0 +1,34 @@
+
+Tichy version 205cfb075f493eea91992de8c284a30bcd5aa4ec bug report
+
+
+1) When we send an sms to a wrong number, the app crash (even
+ tichy-launcher !!)
+
+2) In the SMS app, we should replace 'add' by '+'.
+
+3) !! When we start a call from I/O, everything crashes badly !!
+
+4) In IO there is no distinction between incoming, outgoing, missed calls.
+
+5) When unable to dial a number the caller app shows a black screen
+ and there is no way to go back, in the log file :
+
+ GSM INFO initiate call to None <--- that is wrong !
+ org.freesmartphone.GSM.InvalidParameter: invalid number
+ digit. Valid number digits are: 1234567890*+#
+
+6) Contact should be sorted alphabeticaly.
+
+7) No feed back of connection status (how is it specified in the specs
+ ?)
+
+8) When we slide a list, very often we will click a button as
+ well. Can't we specify that as soon as we start scrolling, we
+ cancel all previous mouse down events ? This basically prevent the
+ gui from being usable.
+
+9) No way to remove a contact.
+
+10) etk text entry box is black on white, it should be white on black
+ (is it possible ?)
--- End Message ---
--- Begin Message ---
Author: erin_yueh
Date: 2008-12-16 10:35:03 +0100 (Tue, 16 Dec 2008)
New Revision: 4874
Modified:
developers/erin_yueh/bt/browse_device.py
developers/erin_yueh/bt/bt_adapter.py
developers/erin_yueh/bt/bt_main.py
developers/erin_yueh/bt/pin.py
developers/erin_yueh/bt/preferences.py
developers/erin_yueh/bt/send_file.py
Log:
add GPL2 license, still testing version 0.1
Modified: developers/erin_yueh/bt/browse_device.py
===================================================================
--- developers/erin_yueh/bt/browse_device.py 2008-12-16 06:59:37 UTC (rev
4873)
+++ developers/erin_yueh/bt/browse_device.py 2008-12-16 09:35:03 UTC (rev
4874)
@@ -1,5 +1,23 @@
#!/usr/bin/env python
+# browse_device.py - A pygtk2 application to demonstrate bluetooth functions
+#
+# Version 0.1
+#
+# Authors: Erin Yueh <eriny...@gmail.com>
+#
+# Copyright (c) 2008 Erin Yueh
+#
+# browse_device.py is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# browse_device.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
import pygtk
pygtk.require('2.0')
Modified: developers/erin_yueh/bt/bt_adapter.py
===================================================================
--- developers/erin_yueh/bt/bt_adapter.py 2008-12-16 06:59:37 UTC (rev
4873)
+++ developers/erin_yueh/bt/bt_adapter.py 2008-12-16 09:35:03 UTC (rev
4874)
@@ -1,5 +1,23 @@
#!/usr/bin/env python
+# bt_adapter.py - A pygtk2 application to demonstrate bluetooth functions
+#
+# Version 0.1
+#
+# Authors: Erin Yueh <eriny...@gmail.com>
+#
+# Copyright (c) 2008 Erin Yueh
+#
+# bt_adapter.py is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# browse_device.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
import gtk, gobject
import browse_device
Modified: developers/erin_yueh/bt/bt_main.py
===================================================================
--- developers/erin_yueh/bt/bt_main.py 2008-12-16 06:59:37 UTC (rev 4873)
+++ developers/erin_yueh/bt/bt_main.py 2008-12-16 09:35:03 UTC (rev 4874)
@@ -1,5 +1,24 @@
#!/usr/bin/env python
+# bt_main.py - A pygtk2 application to demonstrate bluetooth functions
+#
+# Version 0.1
+#
+# Authors: Erin Yueh <eriny...@gmail.com>
+#
+# Copyright (c) 2008 Erin Yueh
+#
+# bt_main.py is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# browse_device.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
import gtk, gobject
import browse_device, pin, send_file
import bt_adapter
Modified: developers/erin_yueh/bt/pin.py
===================================================================
--- developers/erin_yueh/bt/pin.py 2008-12-16 06:59:37 UTC (rev 4873)
+++ developers/erin_yueh/bt/pin.py 2008-12-16 09:35:03 UTC (rev 4874)
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+
+# pin.py - A pygtk2 application to demonstrate bluetooth functions
+#
+# Version 0.1
+#
+# Authors: Erin Yueh <eriny...@gmail.com>
+#
+# Copyright (c) 2008 Erin Yueh
+#
+# pin.py is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# browse_device.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
import dbus
import dbus.glib
import dbus.service
Modified: developers/erin_yueh/bt/preferences.py
===================================================================
--- developers/erin_yueh/bt/preferences.py 2008-12-16 06:59:37 UTC (rev
4873)
+++ developers/erin_yueh/bt/preferences.py 2008-12-16 09:35:03 UTC (rev
4874)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+# preferences.py - A pygtk2 application to demonstrate bluetooth functions
+#
+# Version 0.1
+#
+# Authors: Erin Yueh <eriny...@gmail.com>
+#
+# Copyright (c) 2008 Erin Yueh
+#
+# preferences.py is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# browse_device.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
Modified: developers/erin_yueh/bt/send_file.py
===================================================================
--- developers/erin_yueh/bt/send_file.py 2008-12-16 06:59:37 UTC (rev
4873)
+++ developers/erin_yueh/bt/send_file.py 2008-12-16 09:35:03 UTC (rev
4874)
@@ -1,5 +1,24 @@
#!/usr/bin/env python
+# send_file.py - A pygtk2 application to demonstrate bluetooth functions
+#
+# Version 0.1
+#
+# Authors: Erin Yueh <eriny...@gmail.com>
+#
+# Copyright (c) 2008 Erin Yueh
+#
+# send_file.py is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# browse_device.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
import pygtk
pygtk.require('2.0')
@@ -30,15 +49,15 @@
self.filew.connect("destroy", self.destroy)
# Connect the ok_button to file_ok_sel method
self.filew.ok_button.connect("clicked", self.file_ok_sel)
-
+
# Connect the cancel_button to destroy the widget
self.filew.cancel_button.connect("clicked",
lambda w: self.filew.destroy())
-
+
# Lets set the filename, as if this were a save dialog,
# and we are giving a default filename
self.filew.set_filename("penguin.png")
-
+
self.filew.show()
class SelectDevice:
@@ -59,21 +78,18 @@
self.prepare_to_send(addr)
def __browsexml(self, doc):
- record=doc.documentElement
-
+ record = doc.documentElement
for node in record.childNodes:
if node.nodeType == node.ELEMENT_NODE and node.getAttribute('id')
== '0x0004':
val = node.getElementsByTagName('uint8')
return int(val[0].getAttribute('value'), 16)
- def resolveService(self, addr, service='FTP' ):
-
- #service_handle = self.adapter.GetRemoteServiceHandles(addr,'')
+ def resolveService(self, addr, service='FTP' ):
+
service_handle =
self.bt.bluetooth_adapter.getRemoteServiceHandles(addr,'FTP')
- print 'service_handle: ',service_handle
if service_handle:
- xml=
self.bt.bluetooth_adapter.getRemoteServiceRecordAsXML(addr,service_handle[0])
- doc=parseString(xml)
+ xml =
self.bt.bluetooth_adapter.getRemoteServiceRecordAsXML(addr,service_handle[0])
+ doc = parseString(xml)
return self.__browsexml(doc)
else:
return None
@@ -89,11 +105,7 @@
print 'sendfile ERROR',e
else:
print 'No FTP service'
-
-
- def start_sending(self, widget):
- print 'starting_sending'
-
+
def __init__(self,bt,name):
print 'SelectDevice: dev_list'
self.sendfname = name
@@ -114,15 +126,11 @@
win.sm = gtk.TreeModelSort(self.liststore)
# Set sort column
win.sm.set_sort_column_id(1, gtk.SORT_ASCENDING)
-
+
win.tv = gtk.TreeView(win.sm)
win.tv.connect("row-activated", self.col1_toggled_cb)
win.vbox.pack_start(win.sw)
-
- win.b = gtk.Button('Send File...')
- win.b.connect('clicked', self.start_sending)
- win.vbox.pack_start(win.b, False)
-
+
win.sw.add(win.tv)
win.tv.column = [None]*2
win.tv.column[0] = gtk.TreeViewColumn('Name')
--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog