example:UnicodeTextinput fix font selection

This commit is contained in:
qua-non 2013-12-12 16:39:05 +05:30
parent 89cc504a3d
commit 03616e0bd8
2 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,7 @@ Builder.load_string(
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 @@ Builder.load_string(
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:

View File

@ -794,8 +794,9 @@ class TextInput(Widget):
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 @@ class TextInput(Widget):
size[1] = vh
if viewport_pos:
tcx, tcy = viewport_pos
tcx = tcx / tw * ow
tcx = tcx / tw * (ow)
tcy = tcy / th * oh
# cropping