From 03616e0bd857c84e5ea942860c85f5b3ef279cf2 Mon Sep 17 00:00:00 2001 From: qua-non Date: Thu, 12 Dec 2013 16:39:05 +0530 Subject: [PATCH] example:UnicodeTextinput fix font selection --- examples/widgets/unicode_textinput.py | 5 ++--- kivy/uix/textinput.py | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/widgets/unicode_textinput.py b/examples/widgets/unicode_textinput.py index 17f258872b..7dc1c43ab7 100644 --- a/examples/widgets/unicode_textinput.py +++ b/examples/widgets/unicode_textinput.py @@ -29,7 +29,7 @@ Spinner: id: fnt_spnr text: 'DroidSansMono' - fnt_name: font.match_font(self.text) + fnt_name: font.match_font(self.text) if font.match_font(self.text) else '' font_name: self.fnt_name if self.fnt_name else self.font_name values: sorted(font.get_fonts()) option_cls: Factory.FntSpinnerOption @@ -47,8 +47,7 @@ font_size: fntsz_spnr.text + 'sp' text: root.unicode_string size_hint: 1, None - height: 1494 - on_font_name: self.height = (self.line_height + self.padding_y) * (len(self._lines)-1) + height: self.minimum_height BoxLayout: size_hint: 1, .05 Label: diff --git a/kivy/uix/textinput.py b/kivy/uix/textinput.py index 68fcd339b8..177858f506 100644 --- a/kivy/uix/textinput.py +++ b/kivy/uix/textinput.py @@ -794,8 +794,9 @@ def _update_selection(self, finished=False): a, b = b, a self._selection_finished = finished _selection_text = self._get_text(encode=False)[a:b] - self.selection_text = (('*' * (b - a)) if self.password else - (_selection_text if self.allow_copy else '')) + self.selection_text = ("" if not self.allow_copy else + (('*' * (b - a)) if self.password else + _selection_text)) if not finished: self._selection = True else: @@ -1477,7 +1478,7 @@ def _update_graphics(self, *largs): size[1] = vh if viewport_pos: tcx, tcy = viewport_pos - tcx = tcx / tw * ow + tcx = tcx / tw * (ow) tcy = tcy / th * oh # cropping