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.wintypes
|
||||
import os
|
||||
#import threading
|
||||
#import Queue
|
||||
import uuid
|
||||
import time
|
||||
import gevent
|
||||
|
@ -47,28 +45,6 @@ SetMenuDefaultItem = ctypes.windll.user32.SetMenuDefaultItem
|
|||
SetMenuDefaultItem.restype = ctypes.wintypes.BOOL
|
||||
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):
|
||||
_fields_ = [ ('x', ctypes.wintypes.LONG),
|
||||
('y', ctypes.wintypes.LONG)]
|
||||
|
@ -471,8 +447,6 @@ def GenerateDummyWindow(callback, uid):
|
|||
newclass.lpfnWndProc = callback
|
||||
newclass.lpszClassName = uid.replace("-", "")
|
||||
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)
|
||||
return hwnd
|
||||
|
||||
|
@ -568,21 +542,13 @@ class NotificationIcon(object):
|
|||
iconinfo.uCallbackMessage = WM_MENUCOMMAND
|
||||
iconinfo.hIcon = self._hicon
|
||||
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))
|
||||
|
||||
#iconinfo.union.uVersion = NOTIFYICON_VERSION
|
||||
#Shell_NotifyIcon(NIM_SETVERSION, ctypes.pointer(iconinfo))
|
||||
self.iconinfo = iconinfo
|
||||
|
||||
PostMessage(self._hwnd, WM_NULL, 0, 0)
|
||||
|
||||
#self._timerid = SetTimer(self._hwnd, self._timerid, 25, TIMERCALLBACK())
|
||||
message = MSG()
|
||||
last_time = -1
|
||||
ret = None
|
||||
|
@ -596,7 +562,6 @@ class NotificationIcon(object):
|
|||
message = MSG()
|
||||
time.sleep(0.125)
|
||||
print "Icon thread stopped, removing icon..."
|
||||
#KillTimer(self._hwnd, self._timerid)
|
||||
|
||||
Shell_NotifyIcon(NIM_DELETE, ctypes.cast(ctypes.pointer(iconinfo), ctypes.POINTER(NOTIFYICONDATA)))
|
||||
ctypes.windll.user32.DestroyWindow(self._hwnd)
|
||||
|
@ -717,12 +682,14 @@ def showConsole():
|
|||
|
||||
if __name__ == "__main__":
|
||||
import time
|
||||
|
||||
def greet():
|
||||
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
|
||||
print "Hello"
|
||||
|
||||
def quit():
|
||||
ni._die = True
|
||||
#sys.exit()
|
||||
|
||||
def announce():
|
||||
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 1)
|
||||
ni.announce("Hello there")
|
||||
|
@ -746,6 +713,7 @@ if __name__ == "__main__":
|
|||
]
|
||||
ni.clicked = clicked
|
||||
import atexit
|
||||
|
||||
@atexit.register
|
||||
def goodbye():
|
||||
print "You are now leaving the Python sector."
|
||||
|
|
Loading…
Reference in a new issue