kenenet 1.2.6__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 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
- def get_pos(key='f10', kill=False):
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} when ever you want the location, automatically copies coords/rgb to clipboard')
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)
@@ -574,82 +582,6 @@ def if_condition(s):
574
582
 
575
583
  if_cond = if_condition
576
584
 
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
585
  class k:
654
586
  pass
655
587
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kenenet
3
- Version: 1.2.6
3
+ Version: 1.2.7
4
4
  Summary: dude what the fuck even is this package
5
5
  Home-page: https://www.youtube.com/@KiddyKene
6
6
  Author: kiddykene
@@ -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,,
@@ -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,,