Formatting, Indent to space
This commit is contained in:
parent
4f3282099f
commit
43e9044ef7
1 changed files with 245 additions and 277 deletions
|
@ -5,8 +5,6 @@
|
||||||
import ctypes
|
import ctypes
|
||||||
import ctypes.wintypes
|
import ctypes.wintypes
|
||||||
import os
|
import os
|
||||||
#import threading
|
|
||||||
#import Queue
|
|
||||||
import uuid
|
import uuid
|
||||||
import time
|
import time
|
||||||
import gevent
|
import gevent
|
||||||
|
@ -47,28 +45,6 @@ SetMenuDefaultItem = ctypes.windll.user32.SetMenuDefaultItem
|
||||||
SetMenuDefaultItem.restype = ctypes.wintypes.BOOL
|
SetMenuDefaultItem.restype = ctypes.wintypes.BOOL
|
||||||
SetMenuDefaultItem.argtypes = [ctypes.wintypes.HMENU, ctypes.wintypes.UINT, ctypes.wintypes.UINT]
|
SetMenuDefaultItem.argtypes = [ctypes.wintypes.HMENU, ctypes.wintypes.UINT, ctypes.wintypes.UINT]
|
||||||
|
|
||||||
#class MENUITEMINFO(ctypes.Structure):
|
|
||||||
# UINT cbSize;
|
|
||||||
# UINT fMask;
|
|
||||||
# UINT fType;
|
|
||||||
# UINT fState;
|
|
||||||
# UINT wID;
|
|
||||||
# HMENU hSubMenu;
|
|
||||||
# HBITMAP hbmpChecked;
|
|
||||||
# HBITMAP hbmpUnchecked;
|
|
||||||
# ULONG_PTR dwItemData;
|
|
||||||
# LPTSTR dwTypeData;
|
|
||||||
# UINT cch;
|
|
||||||
# HBITMAP hbmpItem;
|
|
||||||
#
|
|
||||||
#BOOL WINAPI InsertMenuItem(
|
|
||||||
# __in HMENU hMenu,
|
|
||||||
# __in UINT uItem,
|
|
||||||
# __in BOOL fByPosition,
|
|
||||||
# __in LPCMENUITEMINFO lpmii
|
|
||||||
#);
|
|
||||||
#
|
|
||||||
|
|
||||||
class POINT(ctypes.Structure):
|
class POINT(ctypes.Structure):
|
||||||
_fields_ = [ ('x', ctypes.wintypes.LONG),
|
_fields_ = [ ('x', ctypes.wintypes.LONG),
|
||||||
('y', ctypes.wintypes.LONG)]
|
('y', ctypes.wintypes.LONG)]
|
||||||
|
@ -471,8 +447,6 @@ def GenerateDummyWindow(callback, uid):
|
||||||
newclass.lpfnWndProc = callback
|
newclass.lpfnWndProc = callback
|
||||||
newclass.lpszClassName = uid.replace("-", "")
|
newclass.lpszClassName = uid.replace("-", "")
|
||||||
ATOM = ctypes.windll.user32.RegisterClassExW(ctypes.byref(newclass))
|
ATOM = ctypes.windll.user32.RegisterClassExW(ctypes.byref(newclass))
|
||||||
#print "ATOM", ATOM
|
|
||||||
#print "CLASS", newclass.lpszClassName
|
|
||||||
hwnd = ctypes.windll.user32.CreateWindowExW(0, newclass.lpszClassName, None, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0)
|
hwnd = ctypes.windll.user32.CreateWindowExW(0, newclass.lpszClassName, None, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
return hwnd
|
return hwnd
|
||||||
|
|
||||||
|
@ -568,21 +542,13 @@ class NotificationIcon(object):
|
||||||
iconinfo.uCallbackMessage = WM_MENUCOMMAND
|
iconinfo.uCallbackMessage = WM_MENUCOMMAND
|
||||||
iconinfo.hIcon = self._hicon
|
iconinfo.hIcon = self._hicon
|
||||||
iconinfo.szTip = self._tooltip
|
iconinfo.szTip = self._tooltip
|
||||||
#iconinfo.dwState = NIS_SHAREDICON
|
|
||||||
#iconinfo.dwInfoFlags = NIIF_INFO
|
|
||||||
#iconinfo.dwStateMask = NIS_SHAREDICON
|
|
||||||
#iconinfo.szInfo = "Application Title"
|
|
||||||
#iconinfo.union.uTimeout = 5000
|
|
||||||
|
|
||||||
Shell_NotifyIcon(NIM_ADD, ctypes.pointer(iconinfo))
|
Shell_NotifyIcon(NIM_ADD, ctypes.pointer(iconinfo))
|
||||||
|
|
||||||
#iconinfo.union.uVersion = NOTIFYICON_VERSION
|
|
||||||
#Shell_NotifyIcon(NIM_SETVERSION, ctypes.pointer(iconinfo))
|
|
||||||
self.iconinfo = iconinfo
|
self.iconinfo = iconinfo
|
||||||
|
|
||||||
PostMessage(self._hwnd, WM_NULL, 0, 0)
|
PostMessage(self._hwnd, WM_NULL, 0, 0)
|
||||||
|
|
||||||
#self._timerid = SetTimer(self._hwnd, self._timerid, 25, TIMERCALLBACK())
|
|
||||||
message = MSG()
|
message = MSG()
|
||||||
last_time = -1
|
last_time = -1
|
||||||
ret = None
|
ret = None
|
||||||
|
@ -596,7 +562,6 @@ class NotificationIcon(object):
|
||||||
message = MSG()
|
message = MSG()
|
||||||
time.sleep(0.125)
|
time.sleep(0.125)
|
||||||
print "Icon thread stopped, removing icon..."
|
print "Icon thread stopped, removing icon..."
|
||||||
#KillTimer(self._hwnd, self._timerid)
|
|
||||||
|
|
||||||
Shell_NotifyIcon(NIM_DELETE, ctypes.cast(ctypes.pointer(iconinfo), ctypes.POINTER(NOTIFYICONDATA)))
|
Shell_NotifyIcon(NIM_DELETE, ctypes.cast(ctypes.pointer(iconinfo), ctypes.POINTER(NOTIFYICONDATA)))
|
||||||
ctypes.windll.user32.DestroyWindow(self._hwnd)
|
ctypes.windll.user32.DestroyWindow(self._hwnd)
|
||||||
|
@ -717,12 +682,14 @@ def showConsole():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import time
|
import time
|
||||||
|
|
||||||
def greet():
|
def greet():
|
||||||
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
|
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
|
||||||
print "Hello"
|
print "Hello"
|
||||||
|
|
||||||
def quit():
|
def quit():
|
||||||
ni._die = True
|
ni._die = True
|
||||||
#sys.exit()
|
|
||||||
def announce():
|
def announce():
|
||||||
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 1)
|
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 1)
|
||||||
ni.announce("Hello there")
|
ni.announce("Hello there")
|
||||||
|
@ -746,6 +713,7 @@ if __name__ == "__main__":
|
||||||
]
|
]
|
||||||
ni.clicked = clicked
|
ni.clicked = clicked
|
||||||
import atexit
|
import atexit
|
||||||
|
|
||||||
@atexit.register
|
@atexit.register
|
||||||
def goodbye():
|
def goodbye():
|
||||||
print "You are now leaving the Python sector."
|
print "You are now leaving the Python sector."
|
||||||
|
|
Loading…
Reference in a new issue