kenenet 1.2.5__py3-none-any.whl → 1.2.7__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 +21 -11
- {kenenet-1.2.5.dist-info → kenenet-1.2.7.dist-info}/METADATA +1 -1
- kenenet-1.2.7.dist-info/RECORD +5 -0
- kenenet-1.2.5.dist-info/RECORD +0 -5
- {kenenet-1.2.5.dist-info → kenenet-1.2.7.dist-info}/WHEEL +0 -0
- {kenenet-1.2.5.dist-info → kenenet-1.2.7.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,27 +23,35 @@ 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 = []
|
30
|
+
|
29
31
|
def _get_pos(key, kill=False):
|
30
32
|
while True:
|
31
|
-
keyboard.wait(key)
|
33
|
+
pressed_key = keyboard.wait(key)
|
34
|
+
if pressed_key == timed_key:
|
35
|
+
quick_print(f"Pausing for {timer} seconds...")
|
36
|
+
time.sleep(timer)
|
37
|
+
|
32
38
|
x, y = zhmiscellany.misc.get_mouse_xy()
|
39
|
+
if timer:
|
40
|
+
quick_print('')
|
33
41
|
with mss.mss() as sct:
|
34
42
|
region = {"left": x, "top": y, "width": 1, "height": 1}
|
35
43
|
screenshot = sct.grab(region)
|
36
44
|
rgb = screenshot.pixel(0, 0)
|
37
45
|
color = f"\033[38;2;{rgb[0]};{rgb[1]};{rgb[2]}m"
|
38
46
|
reset = "\033[38;2;0;255;26m"
|
39
|
-
coord_rgb.append({'coord': (x,y), 'RGB': rgb})
|
40
|
-
coords.append((x,y))
|
47
|
+
coord_rgb.append({'coord': (x, y), 'RGB': rgb})
|
48
|
+
coords.append((x, y))
|
41
49
|
pyperclip.copy(f'coords_rgb = {coord_rgb}\ncoords = {coords}')
|
42
50
|
quick_print(f"Added Coordinates: ({str(x).rjust(3)},{str(y).rjust(3)}), RGB: {str(rgb).ljust(15)} {color}████████{reset} to clipboard", lineno)
|
43
51
|
if kill:
|
44
52
|
quick_print('killing process')
|
45
53
|
zhmiscellany.misc.die()
|
46
|
-
quick_print(f'Press {key}
|
54
|
+
quick_print(f'Press {key} for cursor info (or {timed_key} for a {timer}s wait before), automatically copies coords/rgb to clipboard')
|
47
55
|
frame = inspect.currentframe().f_back
|
48
56
|
lineno = frame.f_lineno
|
49
57
|
_get_pos(key, kill)
|
@@ -536,7 +544,7 @@ def get_focused_process_name(mute=False):
|
|
536
544
|
except psutil.NoSuchProcess:
|
537
545
|
return None
|
538
546
|
|
539
|
-
def
|
547
|
+
def rgb_at_coord(coord=None):
|
540
548
|
if coord is not None:
|
541
549
|
with mss.mss() as sct:
|
542
550
|
region = {"left": coord[0], "top": coord[1], "width": 1, "height": 1}
|
@@ -545,9 +553,9 @@ def coord_rgb(coord=None):
|
|
545
553
|
return rgb
|
546
554
|
else: return None
|
547
555
|
|
548
|
-
cr =
|
556
|
+
cr = rgb_at_coord
|
549
557
|
|
550
|
-
def
|
558
|
+
def rgb_is_at_coord(coord=None, rgb=None, range=1):
|
551
559
|
if not coord or not rgb:
|
552
560
|
return False
|
553
561
|
with mss.mss() as sct:
|
@@ -555,7 +563,7 @@ def rgb_at_coord(coord=None, rgb=None, range=1):
|
|
555
563
|
rgb_ac = sct.grab(region).pixel(0, 0)
|
556
564
|
return all(abs(a - b) <= range for a, b in zip(rgb_ac, rgb))
|
557
565
|
|
558
|
-
|
566
|
+
irac = rgb_is_at_coord
|
559
567
|
|
560
568
|
def if_condition(s):
|
561
569
|
e = s.strip()[3:] if s.strip().startswith("if ") else s
|
@@ -568,7 +576,9 @@ def if_condition(s):
|
|
568
576
|
code = ast.unparse(p)
|
569
577
|
val = eval(compile(ast.Expression(p), "<ast>", "eval"), ctx)
|
570
578
|
out.append(f"'{code}': {val}")
|
571
|
-
|
579
|
+
frame = inspect.currentframe().f_back
|
580
|
+
lineno = frame.f_lineno
|
581
|
+
quick_print(f"Overall: {str(full).upper()}, " + ", ".join(out), lineno)
|
572
582
|
|
573
583
|
if_cond = if_condition
|
574
584
|
|
@@ -0,0 +1,5 @@
|
|
1
|
+
kenenet/__init__.py,sha256=z1g3XVeX5y1ycu0om4GZews1k0KyUM4y2afn4t_Zqdc,23292
|
2
|
+
kenenet-1.2.7.dist-info/METADATA,sha256=Wq6xceqJx7-OEI6Y0n9i3j8a8WArK4yeZ4ZmbTqy5wY,1693
|
3
|
+
kenenet-1.2.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
+
kenenet-1.2.7.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
+
kenenet-1.2.7.dist-info/RECORD,,
|
kenenet-1.2.5.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
kenenet/__init__.py,sha256=gojKDAkm-H7AFGGc8d4guZSM25oIHP-V5cLDMZYjOMo,22910
|
2
|
-
kenenet-1.2.5.dist-info/METADATA,sha256=_5pplHx9bNTlk36KJv2Ke4QXrTNPHAmOFmxNZpmdnA0,1693
|
3
|
-
kenenet-1.2.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
-
kenenet-1.2.5.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
-
kenenet-1.2.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|