diff --git a/examples/demo/kivycatalog/kivycatalog.kv b/examples/demo/kivycatalog/kivycatalog.kv index c2784fdc5..2655e177e 100644 --- a/examples/demo/kivycatalog/kivycatalog.kv +++ b/examples/demo/kivycatalog/kivycatalog.kv @@ -137,7 +137,7 @@ TextInput: id:info_lbl readonly: True - font_size: '11sp' + font_size: '14sp' background_color: (0, 0, 0, 1) foreground_color: (1, 1, 1, 1) opacity:0 diff --git a/examples/demo/kivycatalog/main.py b/examples/demo/kivycatalog/main.py index 5d64cafa6..8e6691edb 100644 --- a/examples/demo/kivycatalog/main.py +++ b/examples/demo/kivycatalog/main.py @@ -118,6 +118,8 @@ class Catalog(BoxLayout): with open(self.screen_manager.current_screen.content.children[ 0].kv_file) as file: self.language_box.text = file.read() + # reset undo/redo history + self.language_box.reset_undo() def schedule_reload(self): if self.auto_reload: diff --git a/examples/demo/shadereditor/shadereditor.kv b/examples/demo/shadereditor/shadereditor.kv index 1ce0446e5..072987d81 100644 --- a/examples/demo/shadereditor/shadereditor.kv +++ b/examples/demo/shadereditor/shadereditor.kv @@ -1,4 +1,5 @@ #:kivy 1.0 +#: import GLShaderLexer pygments.lexers.GLShaderLexer : viewer: viewer @@ -13,16 +14,18 @@ text: 'Fragment Shader' size_hint_y: None height: self.texture_size[1] + 10 - TextInput: + CodeInput: text: root.fs + lexer: GLShaderLexer() on_text: root.fs = args[1] Label: text: 'Vertex Shader' size_hint_y: None height: self.texture_size[1] + 10 - TextInput: + CodeInput: text: root.vs + lexer: GLShaderLexer() on_text: root.vs = args[1] ShaderViewer: diff --git a/examples/kv/builder_template.py b/examples/kv/builder_template.py index 9aa8a3b04..86a456abd 100644 --- a/examples/kv/builder_template.py +++ b/examples/kv/builder_template.py @@ -17,7 +17,7 @@ class BlehApp(App): def build(self): root = BoxLayout() for idx, word in enumerate(('Hello', 'World')): - wid = Builder.template('BlehItem', { + wid = Builder.template('BlehItem', **{ 'idx': idx, 'word': word, }) root.add_widget(wid) diff --git a/examples/widgets/unicode_textinput.py b/examples/widgets/unicode_textinput.py index 9f8458cb5..c2ce664d5 100644 --- a/examples/widgets/unicode_textinput.py +++ b/examples/widgets/unicode_textinput.py @@ -5,25 +5,50 @@ 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 + + fnt_name: font.match_font(self.text) + font_name: self.fnt_name if self.fnt_name else self.font_name + 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: [.5, .5, .5, 1] - foreground_color: .5, 1, .5, 1 + 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: 1364 + height: 1494 + on_font_name: self.height = (self.line_height + self.padding_y) * (len(self._lines)-1) BoxLayout: size_hint: 1, .05 Label: @@ -86,6 +111,8 @@ if _platform == 'linux' else '/system/fonts' if _platform == 'android' else os.p (filechooser.path, filechooser.selection) ''') +class FntSpinnerOption(SpinnerOption): + pass class LoadDialog(FloatLayout): load = ObjectProperty(None) @@ -172,6 +199,9 @@ Yiddish: דער גיך ברוין פוקס דזשאַמפּס איבער 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): diff --git a/kivy/data/style.kv b/kivy/data/style.kv index 1fe843cb9..007578c25 100644 --- a/kivy/data/style.kv +++ b/kivy/data/style.kv @@ -523,7 +523,7 @@ size_hint_x: .66 id: labellayout markup: True - text: '{0}\n[size=13sp][color=999999]{1}[/color][/size]{2}'.format(root.title or '', root.desc or '', self.font_size) + text: '{0}\n[size=13sp][color=999999]{1}[/color][/size]'.format(root.title or '', root.desc or '') font_size: '15sp' text_size: self.width - 32, None