pyappify 0.0.3__tar.gz → 0.0.5__tar.gz
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.
- {pyappify-0.0.3 → pyappify-0.0.5}/PKG-INFO +1 -1
- {pyappify-0.0.3 → pyappify-0.0.5}/pyappify/__init__.py +48 -3
- {pyappify-0.0.3 → pyappify-0.0.5}/pyappify.egg-info/PKG-INFO +1 -1
- {pyappify-0.0.3 → pyappify-0.0.5}/pyproject.toml +1 -1
- {pyappify-0.0.3 → pyappify-0.0.5}/pyappify/main.py +0 -0
- {pyappify-0.0.3 → pyappify-0.0.5}/pyappify.egg-info/SOURCES.txt +0 -0
- {pyappify-0.0.3 → pyappify-0.0.5}/pyappify.egg-info/dependency_links.txt +0 -0
- {pyappify-0.0.3 → pyappify-0.0.5}/pyappify.egg-info/entry_points.txt +0 -0
- {pyappify-0.0.3 → pyappify-0.0.5}/pyappify.egg-info/requires.txt +0 -0
- {pyappify-0.0.3 → pyappify-0.0.5}/pyappify.egg-info/top_level.txt +0 -0
- {pyappify-0.0.3 → pyappify-0.0.5}/setup.cfg +0 -0
|
@@ -13,23 +13,68 @@ pyappify_version = os.environ.get("PYAPPIFY_VERSION")
|
|
|
13
13
|
pyappify_executable = os.environ.get("PYAPPIFY_EXECUTABLE")
|
|
14
14
|
|
|
15
15
|
pyappify_upgradeable = os.environ.get("PYAPPIFY_UPGRADEABLE") == '1'
|
|
16
|
+
logger = None
|
|
16
17
|
|
|
17
18
|
try:
|
|
18
19
|
pid = int(os.environ.get("PYAPPIFY_PID"))
|
|
19
20
|
except (ValueError, TypeError):
|
|
20
21
|
pid = None
|
|
21
22
|
|
|
23
|
+
import sys
|
|
24
|
+
|
|
25
|
+
try:
|
|
26
|
+
import ctypes
|
|
27
|
+
except ImportError:
|
|
28
|
+
ctypes = None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def minimize_window_by_pid(pid):
|
|
32
|
+
if not ctypes or sys.platform != "win32":
|
|
33
|
+
return False
|
|
34
|
+
|
|
35
|
+
found_hwnd = []
|
|
36
|
+
EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
|
|
37
|
+
|
|
38
|
+
def enum_windows_callback(hwnd, lParam):
|
|
39
|
+
owner_pid = ctypes.c_ulong()
|
|
40
|
+
ctypes.windll.user32.GetWindowThreadProcessId(hwnd, ctypes.byref(owner_pid))
|
|
41
|
+
if owner_pid.value == pid and ctypes.windll.user32.IsWindowVisible(hwnd):
|
|
42
|
+
found_hwnd.append(hwnd)
|
|
43
|
+
return False
|
|
44
|
+
return True
|
|
45
|
+
|
|
46
|
+
ctypes.windll.user32.EnumWindows(EnumWindowsProc(enum_windows_callback), 0)
|
|
47
|
+
|
|
48
|
+
if found_hwnd:
|
|
49
|
+
ctypes.windll.user32.ShowWindow(found_hwnd[0], 6)
|
|
50
|
+
return True
|
|
51
|
+
|
|
52
|
+
return False
|
|
22
53
|
|
|
23
54
|
def kill_pyappify():
|
|
24
55
|
if pid:
|
|
56
|
+
if logger:
|
|
57
|
+
logger.info(f"Attempting to terminate process with PID: {pid}")
|
|
25
58
|
try:
|
|
26
59
|
os.kill(pid, signal.SIGTERM)
|
|
27
|
-
except
|
|
60
|
+
except Exception as e:
|
|
61
|
+
if logger:
|
|
62
|
+
logger.error(f"Failed to terminate process with PID {pid}: {e}")
|
|
28
63
|
pass
|
|
29
64
|
|
|
65
|
+
def hide_pyappify():
|
|
66
|
+
if pid:
|
|
67
|
+
if logger:
|
|
68
|
+
logger.info(f"Attempting to minimize window for process with PID: {pid}")
|
|
69
|
+
try:
|
|
70
|
+
minimize_window_by_pid(pid)
|
|
71
|
+
except Exception as e:
|
|
72
|
+
if logger:
|
|
73
|
+
logger.error(f"Failed to minimize window for process with PID {pid}: {e}")
|
|
74
|
+
pass
|
|
30
75
|
|
|
31
|
-
def upgrade(to_version, executable_sha256, executable_zip_urls,
|
|
32
|
-
if not pyappify_upgradeable or to_version == pyappify_version:
|
|
76
|
+
def upgrade(to_version, executable_sha256, executable_zip_urls, stop_event=None):
|
|
77
|
+
if not pyappify_upgradeable or (to_version and to_version.lstrip('v') == pyappify_version.lstrip('v')):
|
|
33
78
|
return
|
|
34
79
|
|
|
35
80
|
def _do_upgrade():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|