2006-09-21 16:09:23 +02:00
|
|
|
import gobject
|
2006-06-01 00:01:24 +02:00
|
|
|
import gtk
|
|
|
|
|
2006-10-12 15:49:11 +02:00
|
|
|
from _sugar import AddressEntry
|
|
|
|
|
2006-09-21 16:09:23 +02:00
|
|
|
class AddressItem(gtk.ToolItem):
|
|
|
|
__gsignals__ = {
|
|
|
|
'open-address': (gobject.SIGNAL_RUN_FIRST,
|
|
|
|
gobject.TYPE_NONE, ([str])),
|
|
|
|
}
|
2006-06-01 00:01:24 +02:00
|
|
|
|
2006-09-21 16:09:23 +02:00
|
|
|
def __init__(self):
|
|
|
|
gtk.ToolItem.__init__(self)
|
2006-06-01 00:01:24 +02:00
|
|
|
|
2006-10-12 15:49:11 +02:00
|
|
|
entry = AddressEntry()
|
2006-10-12 03:10:14 +02:00
|
|
|
width = int(gtk.gdk.screen_width() / 3 * 2)
|
2006-09-21 16:09:23 +02:00
|
|
|
entry.set_size_request(width, -1)
|
|
|
|
entry.connect("activate", self.__activate_cb)
|
|
|
|
self.add(entry)
|
|
|
|
entry.show()
|
2006-06-01 00:01:24 +02:00
|
|
|
|
2006-10-12 15:49:11 +02:00
|
|
|
self._entry = entry
|
|
|
|
|
2006-06-01 00:01:24 +02:00
|
|
|
def __activate_cb(self, entry):
|
2006-09-21 16:09:23 +02:00
|
|
|
self.emit('open-address', entry.get_text())
|
2006-10-12 15:49:11 +02:00
|
|
|
|
|
|
|
def set_progress(self, progress):
|
|
|
|
self._entry.set_property('progress', progress)
|
2006-10-12 16:05:53 +02:00
|
|
|
|
|
|
|
def set_address(self, address):
|
|
|
|
self._entry.set_text(address)
|