Skip to content

Commit f66256b

Browse files
committed
fixed bugs and added hotkeys support for MacOS (just for one hotkey =/ )
1 parent f05dda2 commit f66256b

File tree

11 files changed

+319
-253
lines changed

11 files changed

+319
-253
lines changed

README.md

Lines changed: 77 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,110 +4,113 @@
44
This is just a little low level library for fetching keyboard input. <br>
55
This is a porting of the Numworks module, and add other methods created by others OS (like Omega or Upsilon).
66

7+
78
### Installation
8-
You can download it on [pypi.org](https://pypi.org/project/ion-numworks), download files of the [latest release](https://github.com/ZetaMap/Ion-numworks/releases/latest). <br>
9-
Or simply run this command to install library: ``pip install ion-numworks``
9+
You can download it on [pypi.org](https://pypi.org/project/ion-numworks), download files of the [latest release](https://github.com/ZetaMap/Ion-numworks/releases/latest), or simply run this command to install library: ``pip install ion-numworks``. <br>
10+
To install from local folder, use: ``pip install .``
1011

11-
Also if you want to do it yourself, use this command to build and install the library automatically: ``python -m build && pip install .``
1212

1313
### More
14-
Also i created the [Kandinsky module of Numworks](https://github.com/ZetaMap/Kandinsky-Numworks)
14+
I also created the porting of the [Numworks' Kandinsky module](https://github.com/ZetaMap/Kandinsky-Numworks)
15+
1516

16-
### Usable content
17-
#### ***Numworks and Omega methods***
17+
### API methods
18+
*Numworks and Omega methods*
1819

19-
**keydown():**
20+
#### keydown():
2021
* Parameters: ``k``
2122
* Description: Return True if the ``k`` key is pressed (not release)
2223

23-
#### ***Upsilon methods (previous are also added)***
24+
<br>
2425

25-
**get_keys():**
26+
*Upsilon-specific methods (previous are also added)*
27+
28+
#### get_keys():
2629
* Parameters: **No parameters**
2730
* Description: Get name of pressed keys
2831

29-
**battery():**
32+
#### battery():
3033
* Parameters: **No parameters**
3134
* Description: Return battery voltage
3235

33-
**battery_level():**
36+
#### battery_level():
3437
* Parameters: **No parameters**
3538
* Description: Return battery level
3639

37-
**battery_ischarging():**
40+
#### battery_ischarging():
3841
* Parameters: **No parameters**
3942
* Description: Return True if the battery is charging
4043

41-
**set_brightness():**
44+
#### set_brightness():
4245
* Parameters: ``level``
4346
* Description: Set brightness level of screen
4447

45-
**get_brightness():**
48+
#### get_brightness():
4649
* Parameters: **No parameters**
4750
* Description: Get brightness level of screen
4851

49-
#### ***Associated keyboard keys***
50-
51-
| Numworks key | Computer key | Field name | Field value
52-
|:-------------|:-------------|:---------------------|:------------
53-
| left | Left | KEY_LEFT | 0
54-
| up | Up | KEY_UP | 1
55-
| down | Down | KEY_DOWN | 2
56-
| right | Right | KEY_RIGHT | 3
57-
| OK | Return | KEY_OK | 4
58-
| back | Delete | KEY_BACK | 5
59-
| home | Escape | KEY_HOME | 6
60-
| onOff | End | KEY_ONOFF | 7
61-
| shift | Shift | KEY_SHIFT | 12
62-
| alpha | CTRL | KEY_ALPHA | 13
63-
| xnt | X | KEY_XNT | 14
64-
| var | V | KEY_VAR | 15
65-
| toolbox | " | KEY_TOOLBOX | 16
66-
| backspace | Backspace | KEY_BACKSPACE | 17
67-
| exp | E | KEY_EXP | 18
68-
| ln | N | KEY_LN | 19
69-
| log | L | KEY_LOG | 20
70-
| imaginary | I | KEY_IMAGINARY | 21
71-
| comma | , | KEY_COMMA | 22
72-
| power | ^ | KEY_POWER | 23
73-
| sin | S | KEY_SINE | 24
74-
| cos | C | KEY_COSINE | 25
75-
| tan | T | KEY_TANGENT | 26
76-
| pi | P | KEY_PI | 27
77-
| sqrt | R | KEY_SQRT | 28
78-
| square | > | KEY_SQUARE | 29
79-
| 7 | 7 | KEY_SEVEN | 30
80-
| 8 | 8 | KEY_EIGHT | 31
81-
| 9 | 9 | KEY_NINE | 32
82-
| ( | ( | KEY_LEFTPARENTHESIS | 33
83-
| ) | ) | KEY_RIGHTPARENTHESIS | 34
84-
| 4 | 4 | KEY_FOUR | 36
85-
| 5 | 5 | KEY_FIVE | 37
86-
| 6 | 6 | KEY_SIX | 38
87-
| * | * | KEY_MULTIPLICATION | 39
88-
| / | / | KEY_DIVISION | 40
89-
| 1 | 1 | KEY_ONE | 42
90-
| 2 | 2 | KEY_TWO | 43
91-
| 3 | 3 | KEY_THREE | 44
92-
| + | + | KEY_PLUS | 45
93-
| - | - | KEY_MINUS | 46
94-
| 0 | 0 | KEY_ZERO | 48
95-
| . | . | KEY_DOT | 49
96-
| EE | ! | KEY_EE | 50
97-
| Ans | A | KEY_ANS | 51
98-
| EXE | Insert | KEY_EXE | 52
99-
100-
### Additional features
101-
#### Environ options
102-
**/!\\ You must make its additions *before* importing ion otherwise the changes will not take effect! /!\\**
103-
104-
You can also change some default option of library.<br>
105-
To do this, first import os module and add a compatibility check, like this:
52+
53+
### Numworks keyboard association
54+
| Numworks key | Computer key | Field name | Field value
55+
|:-------------|:------------------|:---------------------|:------------
56+
| left | ⯇ (Left) | KEY_LEFT | 0
57+
| up | ⯅ (Up) | KEY_UP | 1
58+
| down | ⯆ (Down) | KEY_DOWN | 2
59+
| right | ⯈ (Right) | KEY_RIGHT | 3
60+
| OK | **** (Return) | KEY_OK | 4
61+
| back | Delete | KEY_BACK | 5
62+
| home | Escape | KEY_HOME | 6
63+
| onOff | End | KEY_ONOFF | 7
64+
| shift | **** (Shift) | KEY_SHIFT | 12
65+
| alpha | CTRL | KEY_ALPHA | 13
66+
| xnt | X | KEY_XNT | 14
67+
| var | V | KEY_VAR | 15
68+
| toolbox | " | KEY_TOOLBOX | 16
69+
| backspace | **🠄** (Backspace) | KEY_BACKSPACE | 17
70+
| exp | E | KEY_EXP | 18
71+
| ln | N | KEY_LN | 19
72+
| log | L | KEY_LOG | 20
73+
| imaginary | I | KEY_IMAGINARY | 21
74+
| comma | , | KEY_COMMA | 22
75+
| power | ^ | KEY_POWER | 23
76+
| sin | S | KEY_SINE | 24
77+
| cos | C | KEY_COSINE | 25
78+
| tan | T | KEY_TANGENT | 26
79+
| pi | P | KEY_PI | 27
80+
| sqrt | R | KEY_SQRT | 28
81+
| square | > | KEY_SQUARE | 29
82+
| 7 | 7 | KEY_SEVEN | 30
83+
| 8 | 8 | KEY_EIGHT | 31
84+
| 9 | 9 | KEY_NINE | 32
85+
| ( | ( | KEY_LEFTPARENTHESIS | 33
86+
| ) | ) | KEY_RIGHTPARENTHESIS | 34
87+
| 4 | 4 | KEY_FOUR | 36
88+
| 5 | 5 | KEY_FIVE | 37
89+
| 6 | 6 | KEY_SIX | 38
90+
| * | * | KEY_MULTIPLICATION | 39
91+
| / | / | KEY_DIVISION | 40
92+
| 1 | 1 | KEY_ONE | 42
93+
| 2 | 2 | KEY_TWO | 43
94+
| 3 | 3 | KEY_THREE | 44
95+
| + | + | KEY_PLUS | 45
96+
| - | - | KEY_MINUS | 46
97+
| 0 | 0 | KEY_ZERO | 48
98+
| . | . | KEY_DOT | 49
99+
| EE | ! | KEY_EE | 50
100+
| Ans | A | KEY_ANS | 51
101+
| EXE | Insert *(For MacOS: CTRL+Return)* | KEY_EXE | 52
102+
103+
104+
### Environ variables
105+
> [!IMPORTANT]
106+
> You must make these additions before importing ion module, otherwise the changes will not take effect.
107+
108+
Some options can be modified by environ variables.<br>
109+
To do this, first add a compatibility check:
106110
```python
107111
try:
108112
import os
109-
if hasattr(os, "environ"):
110-
"<environ options here>"
113+
"<environ variables here>"
111114
except: pass
112115
```
113116

@@ -121,7 +124,7 @@ except: pass
121124
os.environ['KANDINSKY_OS_MODE'] = '<number>'
122125
```
123126

124-
* Or if you want to not synchronize the library with kandinsky, use this environ name:
127+
* Or if you don't want to synchronize the library with kandinsky, use this environ name:
125128
```python
126129
os.environ['ION_OS_MODE'] = '<number>'
127130
```

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def clean_pycache(path="."):
2020
clean_pycache(__file__[:__file__.rfind("\\")+1 or __file__.rfind("/")+1])
2121
setup(
2222
name="ion-numworks",
23-
version="2.0",
23+
version="2.1",
2424
author="ZetaMap",
2525
description="The porting of 'Ion module, from Numworks, for PC.",
2626
license='MIT',
@@ -32,7 +32,6 @@ def clean_pycache(path="."):
3232
},
3333
classifiers=[
3434
'Programming Language :: Python :: 3',
35-
'License :: OSI Approved :: MIT License',
3635
'Operating System :: Microsoft :: Windows',
3736
'Operating System :: Unix',
3837
'Operating System :: MacOS :: MacOS X', # not fully compatible

0 commit comments

Comments
 (0)