xenoslib 0.1.29.6__tar.gz → 0.1.29.8__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.
- {xenoslib-0.1.29.6/xenoslib.egg-info → xenoslib-0.1.29.8}/PKG-INFO +1 -1
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/__init__.py +2 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/about.py +1 -1
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/win_trayicon.py +20 -4
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8/xenoslib.egg-info}/PKG-INFO +1 -1
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/LICENSE +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/README.md +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/setup.cfg +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/setup.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/__main__.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/base.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/dev.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/extend.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/linux.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/mail.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/mock.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/onedrive.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib/windows.py +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib.egg-info/SOURCES.txt +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib.egg-info/dependency_links.txt +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib.egg-info/requires.txt +0 -0
- {xenoslib-0.1.29.6 → xenoslib-0.1.29.8}/xenoslib.egg-info/top_level.txt +0 -0
|
@@ -83,15 +83,26 @@ class MenuItemConsole(MenuItem):
|
|
|
83
83
|
super().__init__(*args, **kwargs)
|
|
84
84
|
self.hconsole = win32console.GetConsoleWindow()
|
|
85
85
|
|
|
86
|
+
def is_window_visible_not_minimized(self):
|
|
87
|
+
"""返回窗口是否可见且不处于最小化状态"""
|
|
88
|
+
visible = win32gui.IsWindowVisible(self.hconsole)
|
|
89
|
+
minimized = win32gui.IsIconic(self.hconsole)
|
|
90
|
+
logger.debug(f"window visible: {visible}, window minimized: {minimized}")
|
|
91
|
+
return visible and not minimized
|
|
92
|
+
|
|
86
93
|
def action(self, show=None):
|
|
87
94
|
if show is None:
|
|
88
|
-
super().action()
|
|
95
|
+
# super().action()
|
|
96
|
+
self.checked = not self.is_window_visible_not_minimized()
|
|
97
|
+
# logger.info(self.checked)
|
|
89
98
|
else:
|
|
90
99
|
self.checked = show
|
|
91
100
|
win32gui.ShowWindow(self.hconsole, self.checked)
|
|
92
101
|
if self.checked:
|
|
93
102
|
try:
|
|
103
|
+
# win32gui.BringWindowToTop(self.hconsole)
|
|
94
104
|
win32gui.SetForegroundWindow(self.hconsole)
|
|
105
|
+
# ctypes.windll.user32.SetForegroundWindow(self.hconsole)
|
|
95
106
|
except Exception as exc:
|
|
96
107
|
logger.debug(exc, exc_info=True)
|
|
97
108
|
|
|
@@ -111,6 +122,7 @@ class SysTrayIcon:
|
|
|
111
122
|
if not iconpath:
|
|
112
123
|
python_path = os.path.dirname(os.path.abspath(sys.executable))
|
|
113
124
|
iconpath = os.path.join(python_path, "DLLs", "pyd.ico")
|
|
125
|
+
logger.debug(f"Load icon from path: {iconpath}")
|
|
114
126
|
if os.path.isfile(iconpath):
|
|
115
127
|
hinst = win32gui.GetModuleHandle(None)
|
|
116
128
|
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
|
|
@@ -174,6 +186,11 @@ class SysTrayIcon:
|
|
|
174
186
|
pos = win32gui.GetCursorPos()
|
|
175
187
|
# See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp
|
|
176
188
|
try:
|
|
189
|
+
# 获取窗口当前状态
|
|
190
|
+
placement = win32gui.GetWindowPlacement(self.hwnd)
|
|
191
|
+
# 如果窗口当前是最小化状态,则还原窗口
|
|
192
|
+
if placement[1] == win32con.SW_SHOWMINIMIZED:
|
|
193
|
+
win32gui.ShowWindow(self.hwnd, win32con.SW_RESTORE)
|
|
177
194
|
win32gui.SetForegroundWindow(self.hwnd)
|
|
178
195
|
except Exception as exc:
|
|
179
196
|
logger.debug(exc, exc_info=True)
|
|
@@ -242,12 +259,11 @@ class SysTrayIcon:
|
|
|
242
259
|
def on_notify_icon(self, hwnd, msg, wparam, lparam):
|
|
243
260
|
"""callback on catch tray icon events"""
|
|
244
261
|
if lparam == win32con.WM_LBUTTONDBLCLK:
|
|
245
|
-
|
|
246
|
-
pass
|
|
262
|
+
self.execute_menu_option(self.FIRST_ID)
|
|
247
263
|
elif lparam == win32con.WM_RBUTTONUP:
|
|
248
264
|
self.draw_notify_icon()
|
|
249
265
|
self.show_menu()
|
|
250
|
-
elif lparam == win32con.
|
|
266
|
+
elif lparam == win32con.WM_LBUTTONDOWN:
|
|
251
267
|
self.draw_notify_icon()
|
|
252
268
|
if callable(self.left_click_action):
|
|
253
269
|
self.left_click_action()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|