def OnHelp(self,id, code): try: if id==win32ui.ID_HELP_GUI_REF: helpFile = regutil.GetRegisteredHelpFile("Pythonwin Reference") helpCmd = win32con.HELP_CONTENTS else: helpFile = regutil.GetRegisteredHelpFile("Main Python Documentation") helpCmd = win32con.HELP_FINDER if helpFile is None: win32ui.MessageBox("The help file is not registered!") else: import help help.OpenHelpFile(helpFile, helpCmd) except: t, v, tb = sys.exc_info() win32ui.MessageBox("Internal error in help file processing\r\n%s: %s" % (t,v)) tb = None # Prevent a cycle
def HandleSpecialLine(self): import scriptutils line = self.GetLine() if line[:11]=="com_error: ": # An OLE Exception - pull apart the exception # and try and locate a help file. try: import win32api, win32con det = eval(line[line.find(":")+1:].strip()) win32ui.SetStatusText("Opening help file on OLE error..."); import help help.OpenHelpFile(det[2][3],win32con.HELP_CONTEXT, det[2][4]) return 1 except win32api.error, details: win32ui.SetStatusText("The help file could not be opened - %s" % details.strerror) return 1 except: