/usr/share/kivi-examples/widgets/unicode_textinput.py is in python-kivy-examples 1.7.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | # -*- coding: utf-8 -*-
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import StringProperty, ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.spinner import SpinnerOption
from kivy.uix.popup import Popup
import os
Builder.load_string(
'''
#: import utils kivy
#: import os os
#: import font pygame.font
#: import Factory kivy.factory.Factory
<FntSpinnerOption>
fnt_name: font.match_font(self.text)
font_name: self.fnt_name if self.fnt_name else self.font_name
<Unicode_TextInput>
orientation: 'vertical'
txt_input: unicode_txt
spnr_fnt: fnt_spnr
BoxLayout:
size_hint: 1, .05
Spinner:
id: fnt_spnr
text: 'DroidSansMono'
fnt_name: font.match_font(self.text)
font_name: self.fnt_name if self.fnt_name else self.font_name
values: sorted(font.get_fonts())
option_cls: Factory.FntSpinnerOption
Spinner:
id: fntsz_spnr
text: '15'
values: map(str, map(sp, range(5,39)))
ScrollView:
size_hint: 1, .9
TextInput:
id: unicode_txt
background_color: .8811, .8811, .8811, 1
foreground_color: 0, 0, 0, 1
font_name: fnt_spnr.font_name
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)
BoxLayout:
size_hint: 1, .05
Label:
text: 'current font: ' + unicode_txt.font_name
Button:
size_hint: .15, 1
text: 'change Font ...'
valign: 'middle'
halign: 'center'
text_size: self.size
on_release: root.show_load()
<LoadDialog>:
platform: utils.platform()
BoxLayout:
size: root.size
pos: root.pos
BoxLayout:
orientation: "vertical"
size_hint: .2, 1
Button:
size_hint: 1, .2
text: 'User font directory\\n'
valign: 'middle'
halign: 'center'
text_size: self.size
on_release:
_platform = root.platform
filechooser.path = os.path.expanduser('~/.fonts')\
if _platform == 'linux' else '/system/fonts' if _platform == 'android' else os.path.expanduser('~/Library/Fonts')\
if _platform == 'macosx' else os.environ['WINDIR'] + '\Fonts\'
Button:
size_hint: 1, .2
text: 'System Font directory'
valign: 'middle'
halign: 'center'
text_size: self.size
on_release:
_platform = root.platform
filechooser.path = '/usr/share/fonts' \
if _platform == 'linux' else '/system/fonts' if _platform == 'android' else os.path.expanduser\
('/System/Library/Fonts') if _platform == 'macosx' else os.environ['WINDIR']\
+ "\Fonts\"
Label:
text: 'BookMarks'
BoxLayout:
orientation: "vertical"
FileChooserListView:
id: filechooser
filters: ['*.ttf']
BoxLayout:
size_hint_y: None
height: 30
Button:
text: "cancel"
on_release: root.cancel()
Button:
text: "load"
on_release: filechooser.selection != [] and root.load\
(filechooser.path, filechooser.selection)
''')
class FntSpinnerOption(SpinnerOption):
pass
class LoadDialog(FloatLayout):
load = ObjectProperty(None)
cancel = ObjectProperty(None)
class Unicode_TextInput(BoxLayout):
txt_input = ObjectProperty(None)
unicode_string = StringProperty(u'''Latin-1 suppliment: éé çç ßß
List of major languages taken from Google Translate
____________________________________________________
Try changing the font to see if the font can render the glyphs you need in your application.
Scroll to see all languages in list
Basic Latin: The quick brown fox jumps over the lazy old dog.
Albanian: Kafe të shpejtë dhelpra hedhje mbi qen lazy vjetër.
الثعلب البني السريع يقفز فوق الكلب القديمة البطيئة. :Arabic
Africans: Die vinnige bruin jakkals spring oor die lui hond.
Armenian: Արագ Brown Fox jumps ավելի ծույլ հին շունը.
Azerbaijani: Tez qonur tülkü də tənbəl yaşlı it üzərində atlamalar.
Basque: Azkar marroia fox alferrak txakur zaharra baino gehiago jauzi.
Belarusian: Хуткі карычневы ліс пераскоквае праз гультаяваты стары сабака.
Bengali: দ্রুত বাদামী শিয়াল অলস পুরানো কুকুর বেশি
Bulgarian: Бързата кафява лисица скача над мързелив куче.
Chinese Simpl: 敏捷的棕色狐狸跳过懒惰的老狗。
Catalan: La cigonya tocava el saxofon en el vell gos mandrós.
Croation: Brzo smeđa lisica skoči preko lijen stari pas.
Czech: Rychlá hnědá liška skáče přes líného starého psa.
Danish: Den hurtige brune ræv hopper over den dovne gamle hund.
Dutch: De snelle bruine vos springt over de luie oude hond.
Estonian: Kiire pruun rebane hüppab üle laisa vana koer.
Filipino: Ang mabilis na brown soro jumps sa ang tamad lumang aso.
Finnish: Nopea ruskea kettu hyppää yli laiska vanha koira.
French: Le renard brun rapide saute par dessus le chien paresseux vieux.
Galician: A lixeira raposo marrón ataca o can preguiceiro de idade.
Gregorian: სწრაფი ყავისფერი მელა jumps გამო ზარმაცი წლის ძაღლი.
German: Der schnelle braune Fuchs springt über den faulen alten Hund.
Greek: Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο γέρικο σκυλί.
Gujrati: આ ઝડપી ભુરો શિયાળ તે બેકાર જૂના કૂતરા પર કૂદકા.
Gurmukhi: ਤੇਜ ਭੂਰੇ ਰੰਗ ਦੀ ਲੂੰਬੜੀ ਆਲਸੀ ਬੁੱਢੇ ਕੁੱਤੇ ਦੇ ਉਤੋਂ ਦੀ ਟੱਪਦੀ ਹੈ ।
Hiation Creole: Rapid mawon Rena a so sou chen an parese fin vye granmoun.
Hebrew: השועל החום הזריז קופץ על הכלב הישן עצלן.
Hindi: तेज भूरे रंग की लोमड़ी आलसी बूढ़े कुत्ते के उपर से कूदती है ॥
Hungarian: A gyors barna róka átugorja a lusta vén kutya.
Icelandic: The fljótur Brown refur stökk yfir latur gamall hundur.
Indonesian Cepat rubah cokelat melompat atas anjing tua malas.
Irish: An sionnach donn tapaidh jumps thar an madra leisciúil d\'aois.
Italian: The quick brown fox salta sul cane pigro vecchio.
Japanese: 速い茶色のキツネは、のろまな古いイヌに飛びかかった。
Kannada: ತ್ವರಿತ ಕಂದು ನರಿ ಆಲೂಗಡ್ಡೆ ಹಳೆಯ ಶ್ವಾನ ಮೇಲೆ ಜಿಗಿತಗಳು.
Korean: 무궁화 게으른 옛 피었습니다.
Latin: Vivamus adipiscing orci et rutrum tincidunt super vetus canis.
Latvian: Ātra brūna lapsa lec pāri slinkam vecs suns.
Lithuanian: Greita ruda lapė šokinėja per tingus senas šuo.
Macedonian: Брзата кафена лисица скокови над мрзливи стариот пес.
Malay: Fox coklat cepat melompat atas anjing lama malas.
Maltese: Il-volpi kannella malajr jumps fuq il-kelb qodma għażżien.
Norweigian: Den raske brune reven hopper over den late gamle hunden.
Persian: روباه قهوه ای سریع روی سگ تنبل قدیمی میپرد.
Polish: Szybki brązowy lis przeskoczył nad leniwym psem życia.
Portugese: A ligeira raposa marrom ataca o cão preguiçoso de idade.
Romanian: Rapidă maro vulpea sare peste cainele lenes vechi.
Russioan: Быстрый коричневый лис перепрыгивает через ленивый старый пес.
Serniam: Брза смеђа лисица прескаче лењог пса старог.
Slovak: Rýchla hnedá líška skáče cez lenivého starého psa.
Slovenian: Kožuščku hudobnega nad leni starega psa.
Spanish: La cigüeña tocaba el saxofón en el viejo perro perezoso.
Swahili: Haraka brown fox anaruka juu ya mbwa wavivu zamani.
Swedish: Den snabba bruna räven hoppar över den lata gammal hund.
Tamil: விரைவான பிரவுன் ஃபாக்ஸ் சோம்பேறி பழைய நாய் மீது தொடரப்படுகிறது
Telugu: శీఘ్ర బ్రౌన్ ఫాక్స్ సోమరితనం పాత కుక్క కంటే హెచ్చుతగ్గుల.
Thai: สีน้ำตาลอย่างรวดเร็วจิ้งจอกกระโดดมากกว่าสุนัขเก่าที่ขี้เกียจ
Turkish: Hızlı kahverengi tilki tembel köpeğin üstünden atlar.
Ukranian: Швидкий коричневий лис перестрибує через лінивий старий пес.
Urdu: فوری بھوری لومڑی سست بوڑھے کتے پر کودتا.
Vietnamese: Các con cáo nâu nhanh chóng nhảy qua con chó lười biếng cũ.
Welsh: Mae\'r cyflym frown llwynog neidio dros y ci hen ddiog.
Yiddish: דער גיך ברוין פוקס דזשאַמפּס איבער די פויל אַלט הונט.''')
def dismiss_popup(self):
self._popup.dismiss()
def load(self, _path, _fname):
self.txt_input.font_name = _fname[0]
_f_name = _fname[0][_fname[0].rfind(os.sep) + 1:]
self.spnr_fnt.text = _f_name[:_f_name.rfind('.')]
self._popup.dismiss()
def show_load(self):
content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
self._popup = Popup(title="load file", content=content, \
size_hint=(0.9, 0.9))
self._popup.open()
class unicode_app(App):
def build(self):
return Unicode_TextInput()
if __name__ == '__main__':
unicode_app().run()
|