2007-02-19 Zsolt Foldvari <zfoldvar@users.sourceforge.net>

* src/GrampsWidgets.py (IconEntry): apply latest fixes from kiwi r5889



svn: r8169
This commit is contained in:
Zsolt Foldvari 2007-02-19 15:49:35 +00:00
parent fe38792094
commit a5e91c6cf4
2 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,6 @@
2007-02-19 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/GrampsWidgets.py (IconEntry): apply latest fixes from kiwi r5889
2007-02-18 Don Allingham <don@gramps-project.org> 2007-02-18 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_GedcomUtils.py: Add IdMapper class * src/GrampsDbUtils/_GedcomUtils.py: Add IdMapper class
* src/GrampsDbUtils/_GedcomParser.py: refactoring * src/GrampsDbUtils/_GedcomParser.py: refactoring

View File

@ -941,6 +941,7 @@ class IconEntry(object):
self._icon_win = None self._icon_win = None
self._entry = entry self._entry = entry
self._tooltip = Tooltip(self) self._tooltip = Tooltip(self)
self._locked = False
entry.connect('enter-notify-event', entry.connect('enter-notify-event',
self._on_entry__enter_notify_event) self._on_entry__enter_notify_event)
entry.connect('leave-notify-event', entry.connect('leave-notify-event',
@ -1012,8 +1013,7 @@ class IconEntry(object):
else: else:
win.show() win.show()
# Hack: This triggers a .recompute() which is private self._recompute()
entry.set_visibility(entry.get_visibility())
entry.queue_draw() entry.queue_draw()
def construct(self): def construct(self):
@ -1057,6 +1057,8 @@ class IconEntry(object):
self._icon_win = None self._icon_win = None
def update_background(self, color): def update_background(self, color):
if self._locked:
return
if not self._icon_win: if not self._icon_win:
return return
@ -1086,6 +1088,7 @@ class IconEntry(object):
# The text jumps without this # The text jumps without this
textw -= 2 textw -= 2
self._text_area.move_resize(textx, texty, textw, texth) self._text_area.move_resize(textx, texty, textw, texth)
self._recompute()
elif self._pos == gtk.POS_RIGHT: elif self._pos == gtk.POS_RIGHT:
self._text_area.resize(textw, texth) self._text_area.resize(textw, texth)
iconx += textw iconx += textw
@ -1128,6 +1131,25 @@ class IconEntry(object):
else: else:
self._pos = gtk.POS_RIGHT self._pos = gtk.POS_RIGHT
def _recompute(self):
# Protect against re-entrancy when inserting text, happens in DateEntry
if self._locked:
return
self._locked = True
# Hack: This triggers a .recompute() which is private
visibility = self._entry.get_visibility()
self._entry.set_visibility(not visibility)
self._entry.set_visibility(visibility)
# Another option would be to call insert_text, however it
# emits the signal ::changed which is not desirable.
#self._entry.insert_text('')
self._locked = False
HAVE_2_6 = gtk.pygtk_version[:2] == (2, 6) HAVE_2_6 = gtk.pygtk_version[:2] == (2, 6)
(DIRECTION_LEFT, DIRECTION_RIGHT) = (1, -1) (DIRECTION_LEFT, DIRECTION_RIGHT) = (1, -1)