File tree 2 files changed +15
-6
lines changed
2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 3
3
from kivy .uix .spinner import Spinner , SpinnerOption
4
4
from kivy .uix .boxlayout import BoxLayout
5
5
from kivy .uix .codeinput import CodeInput
6
+ from kivy .uix .behaviors import EmacsBehavior
6
7
from kivy .uix .popup import Popup
7
8
from kivy .properties import ListProperty
8
9
from kivy .core .window import Window
9
10
from kivy .core .text import LabelBase
10
11
from pygments import lexers
11
-
12
+ from pygame import font as fonts
12
13
import codecs
13
14
import glob
14
15
import os
@@ -109,6 +110,13 @@ def cancel(self):
109
110
self .dismiss ()
110
111
111
112
113
+ class CodeInputWithBindings (EmacsBehavior , CodeInput ):
114
+ '''CodeInput with keybindings.
115
+ To add more bindings, add behavior before CodeInput in class definition
116
+ '''
117
+ pass
118
+
119
+
112
120
class CodeInputTest (App ):
113
121
114
122
files = ListProperty ([None , ])
@@ -154,11 +162,12 @@ def build(self):
154
162
menu .add_widget (key_bindings )
155
163
b .add_widget (menu )
156
164
157
- self .codeinput = CodeInput (
158
-
165
+ self .codeinput = CodeInputWithBindings (
159
166
lexer = KivyLexer (),
160
167
font_size = 12 ,
161
- text = example_text )
168
+ text = example_text ,
169
+ active_key_bindings = 'default' ,
170
+ )
162
171
163
172
b .add_widget (self .codeinput )
164
173
Original file line number Diff line number Diff line change 44
44
from kivy .cache import Cache
45
45
from kivy .properties import ObjectProperty , OptionProperty , StringProperty
46
46
from kivy .utils import get_hex_from_color , get_color_from_hex
47
- from kivy .uix .behaviors import CodeNavigationBehavior , EmacsBehavior
47
+ from kivy .uix .behaviors import CodeNavigationBehavior
48
48
49
49
Cache_get = Cache .get
50
50
Cache_append = Cache .append
51
51
52
52
# TODO: color chooser for keywords/strings/...
53
53
54
54
55
- class CodeInput (CodeNavigationBehavior , EmacsBehavior , TextInput ):
55
+ class CodeInput (CodeNavigationBehavior , TextInput ):
56
56
'''CodeInput class, used for displaying highlighted code.
57
57
'''
58
58
You can’t perform that action at this time.
0 commit comments