Revert "Delete .venv directory"

This reverts commit 5a2693bd9f.
This commit is contained in:
Untriex Programming
2021-08-31 22:26:50 +02:00
parent fd493a708d
commit 6544d16770
5105 changed files with 1440072 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
import mouse
import fileinput
import json
import sys
class_by_name = {
'ButtonEvent': mouse.ButtonEvent,
'WheelEvent': mouse.WheelEvent,
'MoveEvent': mouse.MoveEvent,
}
def print_event_json(event):
# Could use json.dumps(event.__dict__()), but this way we guarantee semantic order.
d = event._asdict()
d['event_class'] = event.__class__.__name__
print(json.dumps(d))
sys.stdout.flush()
mouse.hook(print_event_json)
def load(line):
d = json.loads(line)
class_ = class_by_name[d['event_class']]
del d['event_class']
return class_(**d)
mouse.play(load(line) for line in fileinput.input())