Skip to content

Commit 2c1729e

Browse files
committed
Merge pull request kivy#3894 from kivy/key_bindings
rename EmacsBehavior/CodeInput active_key_bindings to key_bindings
2 parents 5d795a6 + b760837 commit 2c1729e

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

examples/widgets/codeinput.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from kivy.core.text import LabelBase
1111
from pygments import lexers
1212
import codecs
13-
import glob
1413
import os
1514

1615
example_text = '''
@@ -111,7 +110,8 @@ def cancel(self):
111110

112111
class CodeInputWithBindings(EmacsBehavior, CodeInput):
113112
'''CodeInput with keybindings.
114-
To add more bindings, add behavior before CodeInput in class definition
113+
To add more bindings, add the behavior before CodeInput in the class
114+
definition.
115115
'''
116116
pass
117117

@@ -165,7 +165,7 @@ def build(self):
165165
lexer=KivyLexer(),
166166
font_size=12,
167167
text=example_text,
168-
active_key_bindings='default',
168+
key_bindings='default',
169169
)
170170

171171
b.add_widget(self.codeinput)
@@ -204,7 +204,7 @@ def _file_menu_selected(self, instance, value):
204204

205205
def _bindings_selected(self, instance, value):
206206
value = value.split(' ')[0]
207-
self.codeinput.active_key_bindings = value.lower()
207+
self.codeinput.key_bindings = value.lower()
208208

209209
def on_files(self, instance, values):
210210
if not values[0]:

kivy/uix/behaviors/emacs.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
This `mixin <https://en.wikipedia.org/wiki/Mixin>`_ allows you to add
99
`Emacs <https://www.gnu.org/software/emacs/>`_ keyboard shortcuts for basic
10-
movement and editing to the :class:`~kivy.uix.textinput.TextInput` widget.
10+
movement and editing to the :class:`~kivy.uix.codeinput.CodeInput` widget.
1111
The shortcuts currently available are listed below::
1212
1313
Emacs shortcuts
@@ -44,18 +44,18 @@
4444
class EmacsBehavior(object):
4545
'''
4646
A `mixin <https://en.wikipedia.org/wiki/Mixin>`_ that enables Emacs-style
47-
keyboard shortcuts for the :class:`~kivy.uix.textinput.TextInput` widget.
47+
keyboard shortcuts for the :class:`~kivy.uix.codeinput.CodeInput` widget.
4848
'''
4949

50-
active_key_bindings = StringProperty('emacs')
50+
key_bindings = StringProperty('emacs')
5151
'''String name which determines the type of key bindings to use with the
52-
:class:`~kivy.uix.textinput.TextInput`. This allows Emacs key bindings to
52+
:class:`~kivy.uix.codeinput.CodeInput`. This allows Emacs key bindings to
5353
be enabled/disabled programmatically for widgets that inherit from
54-
:class:`EmacsBehavior`. If the value is not ``'emacs'`` Emacs bindings will
55-
be disabled.
54+
:class:`EmacsBehavior`. If the value is not ``'emacs'``, Emacs bindings
55+
will be disabled.
5656
57-
:attr:`active_key_bindings` is a :class:`~kivy.properties.StringProperty`
58-
and defaults to ``'emacs'``
57+
:attr:`key_bindings` is a :class:`~kivy.properties.StringProperty`
58+
and defaults to ``'emacs'``.
5959
6060
.. versionadded:: 1.9.2
6161
'''
@@ -89,7 +89,7 @@ def keyboard_on_key_down(self, window, keycode, text, modifiers):
8989
mod = modifiers[0] if modifiers else None
9090
is_emacs_shortcut = False
9191

92-
if key in range(256) and self.active_key_bindings == 'emacs':
92+
if key in range(256) and self.key_bindings == 'emacs':
9393
is_emacs_shortcut = ((mod == 'ctrl' and
9494
chr(key) in self.bindings['ctrl'].keys()) or
9595
(mod == 'alt' and

kivy/uix/codeinput.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ class CodeInput(CodeNavigationBehavior, TextInput):
8585
8686
'''
8787

88-
active_key_bindings = StringProperty('default')
89-
'''String name which determines the type of key bindings to use.
88+
key_bindings = StringProperty('default')
89+
'''Determines the type of key bindings to use.
9090
91-
:attr:`active_key_bindings` is a :class:`~kivy.properties.StringProperty`
92-
and defaults to ``'default'``
91+
:attr:`key_bindings` is a :class:`~kivy.properties.StringProperty`
92+
and defaults to ``'default'``.
9393
9494
.. versionadded:: 1.9.2
9595
'''

kivy/uix/textinput.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ def _key_up(self, key, repeat=False):
22522252
self._alt_r = False
22532253

22542254
def keyboard_on_key_down(self, window, keycode, text, modifiers):
2255-
# Keycodes on OSX:
2255+
# Keycodes on OS X:
22562256
ctrl, cmd = 64, 1024
22572257
key, key_str = keycode
22582258
win = EventLoop.window

0 commit comments

Comments
 (0)