kenenet 1.2.1__py3-none-any.whl → 1.2.2__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
@@ -9,6 +9,10 @@ from zhmiscellany._processing_supportfuncs import _ray_init_thread
9
9
  import zhmiscellany.processing
10
10
  import math
11
11
  import pygame
12
+ import win32gui
13
+ import win32process
14
+ import psutil
15
+
12
16
  os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
13
17
  import io
14
18
  global timings, ospid, debug_mode
@@ -194,18 +198,9 @@ def save_img(img, name=' ', reset=True, file='temp_screenshots', mute=False):
194
198
  frame = inspect.currentframe().f_back
195
199
  lineno = frame.f_lineno
196
200
  if isinstance(img, np.ndarray):
197
- if ((img.ndim == 2 or (img.ndim == 3 and img.shape[-1] == 1)) and img.dtype.kind == "f" and img.min() >= 0.0 and img.max() <= 1.0):
198
- img = Image.fromarray((img * 255).astype(np.uint8))
199
- img.save(path)
200
- elif ((img.ndim == 2 or (img.ndim == 3 and img.shape[-1] == 1)) and (img.min() < 0.0 or img.max() > 1.0)):
201
- mask_normalized = np.clip(img / img.max(), 0.0, 1.0)
202
- # Convert to uint8 and save as an image
203
- img = Image.fromarray((mask_normalized * 255).astype(np.uint8))
204
- img.save("normalized_mask_view.png")
205
- else:
206
- save_name = name + f'{time.time()}'
207
- img = Image.fromarray(img)
208
- img.save(fr'{file}\{save_name}.png')
201
+ save_name = name + f'{time.time()}'
202
+ img = Image.fromarray(img)
203
+ img.save(fr'{file}\{save_name}.png')
209
204
  if not mute: quick_print(f'Saved image as {save_name}', lineno)
210
205
  else:
211
206
  quick_print(f"Your img is not a fucking numpy array you twat, couldn't save {name}", lineno)
@@ -525,7 +520,20 @@ def time_loop(iterable, cutoff_time=0.1):
525
520
  yield item
526
521
  if time.time() > end_time:
527
522
  break
528
-
523
+
524
+ def get_focused_process_name(mute=False):
525
+ hwnd = win32gui.GetForegroundWindow()
526
+ if hwnd == 0:
527
+ return None
528
+ _, pid = win32process.GetWindowThreadProcessId(hwnd)
529
+ try:
530
+ pname = psutil.Process(pid).name()
531
+ if not mute:
532
+ quick_print(pname)
533
+ return pname
534
+ except psutil.NoSuchProcess:
535
+ return None
536
+
529
537
  ct = time_loop
530
538
 
531
539
  class k:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kenenet
3
- Version: 1.2.1
3
+ Version: 1.2.2
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=2tr73Q3mzdlD2GR0uU8GZgLuXAEy7PmTvGqCJcSmMz8,21557
2
+ kenenet-1.2.2.dist-info/METADATA,sha256=UM_pLlbJwXmWQMmuudR9xu5fB-v5XOzLqCI-YhPkBZ8,1693
3
+ kenenet-1.2.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
4
+ kenenet-1.2.2.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
5
+ kenenet-1.2.2.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- kenenet/__init__.py,sha256=hZ_x82R-w-URXbdtOJH6MJgFX1yqhiw4KVjEwCmUbdA,21766
2
- kenenet-1.2.1.dist-info/METADATA,sha256=agCvlIg2Ru7Rl1jXaIcCKViglla8aEt9HtmeWzztrVs,1693
3
- kenenet-1.2.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
4
- kenenet-1.2.1.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
5
- kenenet-1.2.1.dist-info/RECORD,,