mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 08:23:50 -04:00
g13gui: Make stick regions and stick modes enums
This simplifies quite a bit, and reduces coding errors by using symbols instead of "stringified" types.
This commit is contained in:
parent
91d88b3a83
commit
577865c69e
@ -1,5 +1,8 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import enum
|
||||||
|
|
||||||
|
|
||||||
G13D_TO_GDK_KEYBINDS = {
|
G13D_TO_GDK_KEYBINDS = {
|
||||||
'0': '0',
|
'0': '0',
|
||||||
'1': '1',
|
'1': '1',
|
||||||
@ -178,23 +181,41 @@ DEFAULT_KEY_BINDINGS = {
|
|||||||
'DOWN': ['M'],
|
'DOWN': ['M'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class StickRegion(enum.Enum):
|
||||||
|
UP = 'STICK_UP'
|
||||||
|
DOWN = 'STICK_DOWN'
|
||||||
|
LEFT = 'STICK_LEFT'
|
||||||
|
RIGHT = 'STICK_RIGHT'
|
||||||
|
|
||||||
|
|
||||||
|
ALL_STICK_REGIONS = frozenset({
|
||||||
|
StickRegion.UP,
|
||||||
|
StickRegion.DOWN,
|
||||||
|
StickRegion.LEFT,
|
||||||
|
StickRegion.RIGHT
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_STICK_REGION_BINDINGS = {
|
DEFAULT_STICK_REGION_BINDINGS = {
|
||||||
'STICK_UP': ['W'],
|
StickRegion.UP: ['W'],
|
||||||
'STICK_DOWN': ['S'],
|
StickRegion.DOWN: ['S'],
|
||||||
'STICK_LEFT': ['A'],
|
StickRegion.LEFT: ['A'],
|
||||||
'STICK_RIGHT': ['D']
|
StickRegion.RIGHT: ['D']
|
||||||
}
|
}
|
||||||
|
|
||||||
STICK_MODES = [
|
|
||||||
'ABSOLUTE',
|
class StickMode(enum.Enum):
|
||||||
'RELATIVE',
|
ABSOLUTE = 'ABSOLUTE'
|
||||||
'KEYS'
|
RELATIVE = 'RELATIVE'
|
||||||
]
|
KEYS = 'KEYS'
|
||||||
|
|
||||||
|
|
||||||
def GetStickModeNum(modeName):
|
ALL_STICK_MODES = frozenset({
|
||||||
return STICK_MODES.index(modeName.upper())
|
StickMode.ABSOLUTE,
|
||||||
|
StickMode.RELATIVE,
|
||||||
|
StickMode.KEYS
|
||||||
|
})
|
||||||
|
|
||||||
def G13DKeyIsModifier(key):
|
def G13DKeyIsModifier(key):
|
||||||
key = key.upper()
|
key = key.upper()
|
||||||
|
Loading…
Reference in New Issue
Block a user