kenenet 1.2.6__py3-none-any.whl → 1.2.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kenenet/__init__.py +13 -84
- {kenenet-1.2.6.dist-info → kenenet-1.2.8.dist-info}/METADATA +1 -1
- kenenet-1.2.8.dist-info/RECORD +5 -0
- kenenet-1.2.6.dist-info/RECORD +0 -5
- {kenenet-1.2.6.dist-info → kenenet-1.2.8.dist-info}/WHEEL +0 -0
- {kenenet-1.2.6.dist-info → kenenet-1.2.8.dist-info}/top_level.txt +0 -0
kenenet/__init__.py
CHANGED
@@ -8,12 +8,12 @@ from pydub import AudioSegment
|
|
8
8
|
from zhmiscellany._processing_supportfuncs import _ray_init_thread
|
9
9
|
import zhmiscellany.processing
|
10
10
|
import math
|
11
|
+
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
|
11
12
|
import pygame
|
12
13
|
import win32gui
|
13
14
|
import win32process
|
14
15
|
import psutil
|
15
16
|
|
16
|
-
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
|
17
17
|
import io
|
18
18
|
global timings, ospid, debug_mode
|
19
19
|
ospid, debug_mode = None, False
|
@@ -23,12 +23,17 @@ def quick_print(message, l=None):
|
|
23
23
|
if l: sys.stdout.write(f"\033[38;2;0;255;26m{l} || {message}\033[0m\n")
|
24
24
|
else: sys.stdout.write(f"\033[38;2;0;255;26m {message}\033[0m\n")
|
25
25
|
|
26
|
-
|
26
|
+
|
27
|
+
def get_pos(timer=3.0, key='f7', timed_key='f8', kill=False):
|
27
28
|
coord_rgb = []
|
28
29
|
coords = []
|
29
|
-
|
30
|
+
|
31
|
+
def _get_pos(key, timed_key, kill=False):
|
30
32
|
while True:
|
31
|
-
keyboard.wait(key)
|
33
|
+
keyboard.wait([key, timed_key])
|
34
|
+
if keyboard.is_pressed(timed_key):
|
35
|
+
quick_print(f"Timed key pressed. Pausing for {timer} seconds...")
|
36
|
+
time.sleep(timer)
|
32
37
|
x, y = zhmiscellany.misc.get_mouse_xy()
|
33
38
|
with mss.mss() as sct:
|
34
39
|
region = {"left": x, "top": y, "width": 1, "height": 1}
|
@@ -36,17 +41,17 @@ def get_pos(key='f10', kill=False):
|
|
36
41
|
rgb = screenshot.pixel(0, 0)
|
37
42
|
color = f"\033[38;2;{rgb[0]};{rgb[1]};{rgb[2]}m"
|
38
43
|
reset = "\033[38;2;0;255;26m"
|
39
|
-
coord_rgb.append({'coord': (x,y), 'RGB': rgb})
|
40
|
-
coords.append((x,y))
|
44
|
+
coord_rgb.append({'coord': (x, y), 'RGB': rgb})
|
45
|
+
coords.append((x, y))
|
41
46
|
pyperclip.copy(f'coords_rgb = {coord_rgb}\ncoords = {coords}')
|
42
47
|
quick_print(f"Added Coordinates: ({str(x).rjust(3)},{str(y).rjust(3)}), RGB: {str(rgb).ljust(15)} {color}████████{reset} to clipboard", lineno)
|
43
48
|
if kill:
|
44
49
|
quick_print('killing process')
|
45
50
|
zhmiscellany.misc.die()
|
46
|
-
quick_print(f'Press {key}
|
51
|
+
quick_print(f'Press {key} for cursor info (or {timed_key} for a {timer}s wait before), automatically copies coords/rgb to clipboard')
|
47
52
|
frame = inspect.currentframe().f_back
|
48
53
|
lineno = frame.f_lineno
|
49
|
-
_get_pos(key, kill)
|
54
|
+
_get_pos(key, timed_key, kill)
|
50
55
|
|
51
56
|
def timer(clock=1):
|
52
57
|
if clock in timings:
|
@@ -574,82 +579,6 @@ def if_condition(s):
|
|
574
579
|
|
575
580
|
if_cond = if_condition
|
576
581
|
|
577
|
-
def translate_morse_from_cursor(color_figuring=2.0, listen_duration=10.0, sample_interval=0.05, color_threshhold=15, mute=False):
|
578
|
-
_TARGET = zhmiscellany.misc.get_mouse_xy()
|
579
|
-
time.sleep(3)
|
580
|
-
found = []
|
581
|
-
t0 = time.time()
|
582
|
-
while time.time() - t0 < color_figuring:
|
583
|
-
c = rgb_at_coord(_TARGET)
|
584
|
-
if not any(math.dist(c, f) < color_threshhold for f in found):
|
585
|
-
found.append(c)
|
586
|
-
if len(found) >= 2:
|
587
|
-
break
|
588
|
-
time.sleep(sample_interval)
|
589
|
-
if len(found) >= 2:
|
590
|
-
c0, c1 = sorted(found, key=lambda c: (0.299*c[0] + 0.587*c[1] + 0.114*c[2]) / 255)
|
591
|
-
else:
|
592
|
-
c0, c1 = (found[0] if found else (0,0,0)), None
|
593
|
-
if not mute: quick_print(f'started recording, 2 colors are {c0, c1}')
|
594
|
-
raw, state = [], None
|
595
|
-
start = time.time()
|
596
|
-
while time.time() - start < listen_duration:
|
597
|
-
p = rgb_at_coord(_TARGET)
|
598
|
-
if c1 is not None:
|
599
|
-
s = '1' if math.dist(p, c1) < math.dist(p, c0) else '0'
|
600
|
-
else:
|
601
|
-
s = '0' if math.dist(p, c0) < color_threshhold else '1'
|
602
|
-
now = time.time()
|
603
|
-
if state is None:
|
604
|
-
state, ts = s, now
|
605
|
-
elif s != state:
|
606
|
-
raw.append((state, now - ts))
|
607
|
-
state, ts = s, now
|
608
|
-
time.sleep(max(0, sample_interval - (time.time() - now)))
|
609
|
-
if state:
|
610
|
-
raw.append((state, time.time() - ts))
|
611
|
-
|
612
|
-
ones = [d for s,d in raw if s == '1']
|
613
|
-
unit = min(ones) if ones else 0.15
|
614
|
-
pattern, cur = [], ''
|
615
|
-
MORSE = {
|
616
|
-
'.-': 'A', '-...': 'B', '-.-.': 'C', '-..': 'D', '.': 'E',
|
617
|
-
'..-.': 'F', '--.': 'G', '....': 'H', '..': 'I', '.---': 'J',
|
618
|
-
'-.-': 'K', '.-..': 'L', '--': 'M', '-.': 'N', '---': 'O',
|
619
|
-
'.--.': 'P', '--.-': 'Q', '.-.': 'R', '...': 'S', '-': 'T',
|
620
|
-
'..-': 'U', '...-': 'V', '.--': 'W', '-..-': 'X', '-.--': 'Y',
|
621
|
-
'--..': 'Z',
|
622
|
-
'-----': '0', '.----': '1', '..---': '2', '...--': '3', '....-': '4',
|
623
|
-
'.....': '5', '-....': '6', '--...': '7', '---..': '8', '----.': '9',
|
624
|
-
'.-.-.-': '.', '--..--': ',', '---...': ':', '..--..': '?',
|
625
|
-
'.----.': "'", '-.-.--': '!', '-..-.': '/', '.-..-.': '"',
|
626
|
-
'-....-': '-', '.-...': '&', '-.-.-.': ';', '...-.-': '$',
|
627
|
-
'.-.-.': '+', '.-..-': '_', '...---...': 'SOS'
|
628
|
-
}
|
629
|
-
|
630
|
-
for s, d in raw:
|
631
|
-
if s == '1':
|
632
|
-
cur += '.' if abs(d - unit) < unit*0.5 else '-'
|
633
|
-
else:
|
634
|
-
if cur:
|
635
|
-
if abs(d - unit) < unit*0.5:
|
636
|
-
pass
|
637
|
-
elif abs(d - 3*unit) < unit*0.5:
|
638
|
-
pattern.append(cur); cur = ''
|
639
|
-
elif abs(d - 7*unit) < unit*0.5:
|
640
|
-
pattern.append(cur); pattern.append(' '); cur = ''
|
641
|
-
else:
|
642
|
-
pattern.append(cur); cur = ''
|
643
|
-
else:
|
644
|
-
if abs(d - 7*unit) < unit*0.5:
|
645
|
-
pattern.append(' ')
|
646
|
-
if cur:
|
647
|
-
pattern.append(cur)
|
648
|
-
|
649
|
-
result = ''.join(' ' if e == ' ' else MORSE.get(e, '[?]') for e in pattern).strip()
|
650
|
-
if not mute: quick_print(result)
|
651
|
-
return result
|
652
|
-
|
653
582
|
class k:
|
654
583
|
pass
|
655
584
|
|
@@ -0,0 +1,5 @@
|
|
1
|
+
kenenet/__init__.py,sha256=pC2aI-XC9xCejz5w010RveABpYSD552Orx6QKCsK7os,23268
|
2
|
+
kenenet-1.2.8.dist-info/METADATA,sha256=aUVGc29RSna8gfInlXRJdkIOwGg6Oq8gSMBvpGSjUMA,1693
|
3
|
+
kenenet-1.2.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
+
kenenet-1.2.8.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
+
kenenet-1.2.8.dist-info/RECORD,,
|
kenenet-1.2.6.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
kenenet/__init__.py,sha256=rMDdcWY15HR7bpuHkrVkebqatdc0grJRQbq_JnSZDQo,26143
|
2
|
-
kenenet-1.2.6.dist-info/METADATA,sha256=ZhC9uvIq-kWv-gJFlEBSlPndw91OspZHpR2m8o06iAs,1693
|
3
|
-
kenenet-1.2.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
-
kenenet-1.2.6.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
-
kenenet-1.2.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|