
try:
	from sexy import SpellEntry as _SpellEntry
except ImportError:
	from gtk import Entry as _SpellEntry

class SpellEntry(_SpellEntry):

	__gtype_name__ = "SpellEntry"

	pass

@@ -1,8 +1,79 @@
+import gtk%0Afrom ..helper import color%0Afrom gettext import gettext as _%0A
 %0Atry:%0A%09f
@@ -242,9 +242,1693 @@
 %22%0A%0A%09
-pass
+def __init__(self, *args,  **kwargs):%0A%09%09super(SpellEntry, self).__init__(*args, **kwargs)%0A%0A%09%09self._ranges = %7B%7D%0A%0A%09%09self.connect(%22populate-popup%22,  self._determine_popup_menu)%0A%0A%09%09self.connect(%22activate%22,  lambda s, x, *u: s._apply_color_tags())%0A%0A%0A%09def _determine_popup_menu(self,  widget,  menu,  *user):%0A%09%09self._popup_menu_handler(menu)%0A%0A%0A%09# TODO:%0A%09# nothing marked: set color for whole text:  %7B (0,n) : %7B%22fg%22:x,%22bg%22:y%7D %7D%0A%09# text marked: set color for specific text: %7B ..., (n,m) : %7B%22fg%22:x,%22bg%22:y%7D %7D%0A%09# nothing marked & dict !empty: clear dict & goto %22nothing marked%22%0A%09# text marked & dict !empty: goto %22text marked%22%0A%0A%09# TODO: mark color setting visually via the pango Layout (set_markup)%0A%0A%09# TODO: determine what happens if the user edits the text...%0A%0A%09def _apply_color_tags(self):%0A%09%09pass%0A%0A%09def _fg_item_activate(self,  value):%0A%09%09pass%0A%0A%09def _bg_item_activate(self,  value):%0A%09%09pass%0A%0A%09def _popup_menu_handler(self,  menu):%0A%0A%09%09fg_item = gtk.MenuItem(label=_(%22Foreground Color%22))%0A%09%09fg_submenu = gtk.Menu()%0A%0A%09%09for (value, name) in color.COLOR_NAMES.items():%0A%09%09%09item = gtk.MenuItem(label=%22 %22.join(%5Bn.capitalize() for n in name.split(%22 %22)%5D))%0A%09%09%09item.connect(%22activate%22, self._fg_item_activate,  value)%0A%09%09%09fg_submenu.append(item)%0A%0A%09%09fg_item.set_submenu(fg_submenu)%0A%09%09fg_item.show_all()%0A%09%09menu.insert(fg_item,  0)%0A%0A%09%09bg_item = gtk.MenuItem(label=_(%22Background Color%22))%0A%09%09bg_submenu = gtk.Menu()%0A%0A%09%09for (value, name) in color.COLOR_NAMES.items():%0A%09%09%09item = gtk.MenuItem(label=%22 %22.join(%5Bn.capitalize() for n in name.split(%22 %22)%5D))%0A%09%09%09item.connect(%22activate%22, self._bg_item_activate,  value)%0A%09%09%09bg_submenu.append(item)%0A%0A%09%09bg_item.set_submenu(bg_submenu)%0A%09%09bg_item.show_all()%0A%09%09menu.insert(bg_item,  1)
 %0A

Add dummy foreground/background color menu