Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
# Creates a task-bar icon. Run from Python.exe to see the# messages printed.fromwin32apiimport*fromwin32guiimport*importwin32uiimportwin32pipeimportwin32conimport pywintypes
import sys, os
+from mercurial import demandimport ; demandimport.enable()from thgutil import thread2
from win32 import rpcserver
APP_TITLE="TortoiseHg RPC server"classMainWindow:def__init__(self):msg_TaskbarRestart=RegisterWindowMessage("TaskbarCreated");message_map={msg_TaskbarRestart:self.OnRestart,win32con.WM_DESTROY:self.OnDestroy,win32con.WM_COMMAND:self.OnCommand,win32con.WM_USER+20:self.OnTaskbarNotify,}# Register the Window class.wc=WNDCLASS()hinst=wc.hInstance=GetModuleHandle(None)wc.lpszClassName="THgRpcServer"wc.style=win32con.CS_VREDRAW|win32con.CS_HREDRAW;wc.hCursor=LoadCursor(0,win32con.IDC_ARROW)wc.hbrBackground=win32con.COLOR_WINDOWwc.lpfnWndProc=message_map# could also specify a wndproc.classAtom=RegisterClass(wc)# Create the Window.style=win32con.WS_OVERLAPPED|win32con.WS_SYSMENUself.hwnd=CreateWindow(classAtom,APP_TITLE,style, \
0,0,win32con.CW_USEDEFAULT,win32con.CW_USEDEFAULT, \
0,0,hinst,None)UpdateWindow(self.hwnd)self._DoCreateIcons()def_DoCreateIcons(self):# Try and find a custom iconhinst=GetModuleHandle(None)fromthgutil.pathsimportget_tortoise_iconiconPathName=get_tortoise_icon("hg.ico")ifos.path.isfile(iconPathName):icon_flags=win32con.LR_LOADFROMFILE|win32con.LR_DEFAULTSIZEhicon=LoadImage(hinst,iconPathName,win32con.IMAGE_ICON,0,0,icon_flags)else:print"Can't find a Python icon file - using default"hicon=LoadIcon(0,win32con.IDI_APPLICATION)flags=NIF_ICON|NIF_MESSAGE|NIF_TIPnid=(self.hwnd,0,flags,win32con.WM_USER+20,hicon,APP_TITLE)try:Shell_NotifyIcon(NIM_ADD,nid)excepterror:# This is common when windows is starting, and this code is hit# before the taskbar has been created.print"Failed to add the taskbar icon - is explorer running?"# but keep running anyway - when explorer starts, we get the# TaskbarCreated message.# start namepipe server for hg statusself.start_pipe_server()defOnRestart(self,hwnd,msg,wparam,lparam):self._DoCreateIcons()defOnDestroy(self,hwnd,msg,wparam,lparam):nid=(self.hwnd,0)Shell_NotifyIcon(NIM_DELETE,nid)PostQuitMessage(0)# Terminate the app.defOnTaskbarNotify(self,hwnd,msg,wparam,lparam):iflparam==win32con.WM_RBUTTONUPorlparam==win32con.WM_LBUTTONUP:menu=CreatePopupMenu()AppendMenu(menu,win32con.MF_STRING,1023,'Options...')AppendMenu(menu,win32con.MF_SEPARATOR,0,'')AppendMenu(menu,win32con.MF_STRING,1025,'Exit')pos=GetCursorPos()# See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.aspSetForegroundWindow(self.hwnd)TrackPopupMenu(menu,win32con.TPM_LEFTALIGN,pos[0],pos[1],0,self.hwnd,None)PostMessage(self.hwnd,win32con.WM_NULL,0,0)return1defOnCommand(self,hwnd,msg,wparam,lparam):id=LOWORD(wparam)ifid==1023:# place holder for options dialogmsg="TortoiseHG options dialog in construction"win32ui.MessageBox(msg,'TortoiseHG options...',win32con.MB_OK)elifid==1025:self.exit_application()else:print"Unknown command -",iddefexit_application(self):ifself.stop_pipe_server():DestroyWindow(self.hwnd)print"Goodbye"defstop_pipe_server(self):print"Stopping pipe server..."ifnotself.pipethread.isAlive():returnTrue# Try the nice way firstself.svc.SvcStop()max_try=10cnt=1whilecnt<=max_tryandself.pipethread.isAlive():print"testing pipe [try %d] ..."%cnttry:self.pipethread.terminate()win32pipe.CallNamedPipe(rpcserver.PIPENAME,'',rpcserver.PIPEBUFSIZE,0)except:passcnt+=1ifself.pipethread.isAlive():print"WARNING: unable to stop server after %d trys."%max_tryreturnFalseelse:returnTruedefstart_pipe_server(self):defservepipe():self.svc=rpcserver.PipeServer()self.svc.SvcDoRun()self.pipethread=thread2.Thread(target=servepipe)self.pipethread.start()defmain():w=MainWindow()PumpMessages()if__name__=='__main__':main()
Attach a Trello Card
Add a tag
Your session has expired
You are no longer logged in. Please log in and try your request again.
Filter RSS Feed
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.