Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activities/browser/AddressItem.py
blob: ec47330da71cab3f2ec8515bf01340783b1e2bc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gobject
import gtk

from _sugar import AddressEntry

class AddressItem(gtk.ToolItem):
	__gsignals__ = {
		'open-address':  (gobject.SIGNAL_RUN_FIRST,
						  gobject.TYPE_NONE, ([str])),
	}

	def __init__(self):
		gtk.ToolItem.__init__(self)
	
		entry = AddressEntry()
		width = int(gtk.gdk.screen_width() / 3 * 2)
		entry.set_size_request(width, -1)
		entry.connect("activate", self.__activate_cb)
		self.add(entry)
		entry.show()

		self._entry = entry

	def __activate_cb(self, entry):
		self.emit('open-address', entry.get_text())

	def set_progress(self, progress):
		self._entry.set_property('progress', progress)