UIX: textinput reset width cache on font_size/name/padding_x/...

This commit is contained in:
Qua-non 2012-09-04 03:47:27 +05:30
parent 254cd36bd9
commit 903609946c
1 changed files with 10 additions and 7 deletions

View File

@ -240,12 +240,12 @@ class TextInput(Widget):
self.bind(font_size=self._trigger_refresh_line_options, self.bind(font_size=self._trigger_refresh_line_options,
font_name=self._trigger_refresh_line_options) font_name=self._trigger_refresh_line_options)
self.bind(padding_x=self._trigger_refresh_text, self.bind(padding_x=self._update_text_options,
padding_y=self._trigger_refresh_text, padding_y=self._update_text_options,
tab_width=self._trigger_refresh_text, tab_width=self._update_text_options,
font_size=self._trigger_refresh_text, font_size=self._update_text_options,
font_name=self._trigger_refresh_text, font_name=self._update_text_options,
size=self._trigger_refresh_text) size=self._update_text_options)
self.bind(pos=self._trigger_update_graphics) self.bind(pos=self._trigger_update_graphics)
@ -902,6 +902,10 @@ class TextInput(Widget):
Clock.schedule_once( Clock.schedule_once(
lambda *args: self._refresh_text_from_property(*largs)) lambda *args: self._refresh_text_from_property(*largs))
def _update_text_options(self, *largs):
Cache_remove('textinput.width')
self._trigger_refresh_text()
def _refresh_text_from_property(self, *largs): def _refresh_text_from_property(self, *largs):
self._refresh_text(self.text, *largs) self._refresh_text(self.text, *largs)
@ -1096,7 +1100,6 @@ class TextInput(Widget):
miny = self.y + _padding_y miny = self.y + _padding_y
maxy = _top - _padding_y maxy = _top - _padding_y
draw_selection = self._draw_selection draw_selection = self._draw_selection
#scroll_y = self.scroll_y
a, b = self._selection_from, self._selection_to a, b = self._selection_from, self._selection_to
if a > b: if a > b:
a, b = b, a a, b = b, a