Skip to content

Commit 7339a36

Browse files
Use term keycode instead of just plain code.
1 parent 673734e commit 7339a36

3 files changed

Lines changed: 37 additions & 37 deletions

File tree

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
libraries=['suinput'],
1111
)
1212

13-
codes_module = Extension('uinput.codes',
14-
sources=['src/codes.c'])
13+
keycodes_module = Extension('uinput.keycodes',
14+
sources=['src/keycodes.c'])
1515

1616
setup(name='python-uinput',
1717
version='0.2',
@@ -22,7 +22,7 @@
2222
download_url='http://codegrove.org/python-uinput/0.2/python-uinput-0.2.tar.gz',
2323
package_dir={'uinput': 'src'},
2424
packages=['uinput'],
25-
ext_modules=[pysuinput_module, codes_module],
25+
ext_modules=[pysuinput_module, keycodes_module],
2626
license='LGPLv3+',
2727
platforms=['Linux'],
2828
classifiers=[

src/__init__.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
>>> import uinput
2525
>>> driver = uinput.Driver()
2626
>>> driver.move_pointer(100, 100)
27-
>>> driver.click(uinput.codes.BTN_LEFT)
27+
>>> driver.click(uinput.keycodes.BTN_LEFT)
2828
"""
2929

3030
import _suinput
@@ -47,7 +47,7 @@
4747
from _suinput import BUS_GSC
4848
from _suinput import BUS_ATARI
4949

50-
import codes
50+
import keycodes
5151

5252
__all__ = [
5353
"Driver",
@@ -102,69 +102,69 @@ def move_pointer(self, x, y):
102102
"""
103103
_suinput.move_pointer(self._context, x, y)
104104

105-
def press(self, code):
105+
def press(self, keycode):
106106
"""Sends a press event to the event device. Event is repeated after
107107
a short delay until a release event is sent.
108108
109-
code must be one of the constant values defined in
110-
uinput.codes -module.
109+
keycode must be one of the constant values defined in
110+
uinput.keycodes -module.
111111
"""
112-
_suinput.press(self._context, code)
112+
_suinput.press(self._context, keycode)
113113

114-
def release(self, code):
114+
def release(self, keycode):
115115
"""Sends a release event to the event device.
116116
117-
code must be one of the constant values defined in
118-
uinput.codes -module.
117+
keycode must be one of the constant values defined in
118+
uinput.keycodes -module.
119119
"""
120-
_suinput.release(self._context, code)
120+
_suinput.release(self._context, keycode)
121121

122-
def click(self, code):
122+
def click(self, keycode):
123123
"""Sends a press and release events to the event device.
124124
125-
code must be one of the constant values defined in
126-
uinput.codes -module.
125+
keycode must be one of the constant values defined in
126+
uinput.keycodes -module.
127127
128128
This method is provided as a convenience and has effectively the
129129
same result as calling press() and release() sequentially.
130130
"""
131-
_suinput.click(self._context, code)
131+
_suinput.click(self._context, keycode)
132132

133-
def press_release(self, signed_code):
133+
def press_release(self, signed_keycode):
134134
"""Sends a press or a release event to the event device.
135-
The sign of the signed_code determines which type of event is sent.
136-
Positive signed_code means press and negative means release.
135+
The sign of the signed_keycode determines which type of event is sent.
136+
Positive signed_keycode means press and negative means release.
137137
138-
Absolute value of signed_code must be one of the constant
139-
values defined in uinput.codes module.
138+
Absolute value of signed_keycode must be one of the constant
139+
values defined in uinput.keycodes module.
140140
141141
This method is provided as a convenience and has effectively the
142-
same result as calling press() when the value of signed_code
142+
same result as calling press() when the value of signed_keycode
143143
is positive and release() when negative.
144144
"""
145-
_suinput.press_release(self._context, signed_code)
145+
_suinput.press_release(self._context, signed_keycode)
146146

147-
def toggle(self, code):
147+
def toggle(self, keycode):
148148
"""Press button if it is not pressed currently, release it otherwise.
149149
150-
code must be one of the constant values defined in
151-
uinput.codes -module.
150+
keycode must be one of the constant values defined in
151+
uinput.keycodes -module.
152152
153153
This method is provided as a convenience and has effectively the
154154
same result as calling press() if is_pressed() returns False
155155
and release() otherwise.
156156
"""
157-
_suinput.toggle(self._context, code)
157+
_suinput.toggle(self._context, keycode)
158158

159-
def is_pressed(self, code):
159+
def is_pressed(self, keycode):
160160
"""Return True if button is pressed, False otherwise.
161161
162-
code must be one of the constant values defined in
163-
uinput.codes -module.
162+
keycode must be one of the constant values defined in
163+
uinput.keycodes -module.
164164
"""
165-
return _suinput.is_pressed(self._context, code)
165+
return _suinput.is_pressed(self._context, keycode)
166166

167167
def __del__(self):
168168
_suinput.close(self._context)
169169

170-
is_valid_code = _suinput.is_valid_code
170+
is_valid_keycode = _suinput.is_valid_code

src/codes.c renamed to src/keycodes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
codes.c - Button and key codes used in Linux input system
2+
keycodes.c - Button and key codes used in Linux input system
33
Copyright (C) 2009 Tuomas Räsänen <tuos@codegrove.org>
44
55
This library is free software; you can redistribute it and/or
@@ -21,14 +21,14 @@
2121

2222
#include "linux/uinput.h"
2323

24-
static PyMethodDef codesMethods[] = {
24+
static PyMethodDef keycodesMethods[] = {
2525
{NULL, NULL, 0, NULL}
2626
};
2727

28-
PyMODINIT_FUNC initcodes(void)
28+
PyMODINIT_FUNC initkeycodes(void)
2929
{
3030
PyObject *module;
31-
module = Py_InitModule3("codes", codesMethods,
31+
module = Py_InitModule3("keycodes", keycodesMethods,
3232
"Button and key codes used in Linux input system");
3333
PyModule_AddIntMacro(module, KEY_ESC);
3434
PyModule_AddIntMacro(module, KEY_1);

0 commit comments

Comments
 (0)