mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-09 15:40:17 +01:00
tools/per-slot-delta: use dataclasses and enums
Slight modernization of the code Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
This commit is contained in:
parent
530ca423a7
commit
01f133fbc4
1 changed files with 13 additions and 11 deletions
|
|
@ -29,6 +29,9 @@
|
|||
#
|
||||
# Input is a libinput record yaml file
|
||||
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
import argparse
|
||||
import math
|
||||
import sys
|
||||
|
|
@ -122,24 +125,23 @@ class SlotFormatter:
|
|||
self.slots.append(string.ljust(self.width + len(color) + len(reset)))
|
||||
|
||||
|
||||
class SlotState:
|
||||
class SlotState(Enum):
|
||||
NONE = 0
|
||||
BEGIN = 1
|
||||
UPDATE = 2
|
||||
END = 3
|
||||
|
||||
|
||||
@dataclass
|
||||
class Slot:
|
||||
state = SlotState.NONE
|
||||
x = 0
|
||||
y = 0
|
||||
dx = 0
|
||||
dy = 0
|
||||
used = False
|
||||
dirty = False
|
||||
|
||||
def __init__(self, index):
|
||||
self.index = index
|
||||
index: int
|
||||
state: SlotState = SlotState.NONE
|
||||
x: float = 0
|
||||
y: float = 0
|
||||
dx: float = 0
|
||||
dy: float = 0
|
||||
used: bool = False
|
||||
dirty: bool = False
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue