rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
print
print >> stream
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...
oldOut = sys.stdout sys.stdout = file try: self.do_generate() finally: sys.stdout = oldOut self.file = None self.progress.Finished()
self.do_generate() self.file = None self.progress.Finished()
def generate(self, file, is_for_demand = 0): if is_for_demand: self.generate_type = GEN_DEMAND_BASE else: self.generate_type = GEN_FULL self.file = file oldOut = sys.stdout sys.stdout = file try: self.do_generate() finally: sys.stdout = oldOut self.file = None self.progress.Finished()
print "class constants:"
print >> stream, "class constants:"
def do_generate(self): moduleDoc = self.typelib.GetDocumentation(-1) docDesc = "" if moduleDoc[1]: docDesc = moduleDoc[1] self.progress.Starting(docDesc) self.progress.SetDescription("Building definitions from type library...")
oleitem.WriteEnumerationItems()
oleitem.WriteEnumerationItems(stream)
def do_generate(self): moduleDoc = self.typelib.GetDocumentation(-1) docDesc = "" if moduleDoc[1]: docDesc = moduleDoc[1] self.progress.Starting(docDesc) self.progress.SetDescription("Building definitions from type library...")
print
print >> stream
def do_generate(self): moduleDoc = self.typelib.GetDocumentation(-1) docDesc = "" if moduleDoc[1]: docDesc = moduleDoc[1] self.progress.Starting(docDesc) self.progress.SetDescription("Building definitions from type library...")
print 'RecordMap = {'
print >> stream, 'RecordMap = {'
def do_generate(self): moduleDoc = self.typelib.GetDocumentation(-1) docDesc = "" if moduleDoc[1]: docDesc = moduleDoc[1] self.progress.Starting(docDesc) self.progress.SetDescription("Building definitions from type library...")
print "\t
print >> stream, "\t
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print "\t%s: %s," % (`record.doc[0]`, `str(record.clsid)`) print "}" print
print >> stream, "\t%s: %s," % (`record.doc[0]`, `str(record.clsid)`) print >> stream, "}" print >> stream
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print 'CLSIDToClassMap = {'
print >> stream, 'CLSIDToClassMap = {'
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print "\t'%s' : %s," % (str(item.clsid), item.python_name) print '}' print 'CLSIDToPackageMap = {}' print 'win32com.client.CLSIDToClass.RegisterCLSIDsFromDict( CLSIDToClassMap )' print "VTablesToPackageMap = {}" print "VTablesToClassMap = {"
print >> stream, "\t'%s' : %s," % (str(item.clsid), item.python_name) print >> stream, '}' print >> stream, 'CLSIDToPackageMap = {}' print >> stream, 'win32com.client.CLSIDToClass.RegisterCLSIDsFromDict( CLSIDToClassMap )' print >> stream, "VTablesToPackageMap = {}" print >> stream, "VTablesToClassMap = {"
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print "\t'%s' : '%s'," % (item.clsid,item.python_name) print '}' print
print >> stream, "\t'%s' : '%s'," % (item.clsid,item.python_name) print >> stream, '}' print >> stream
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print 'CLSIDToClassMap = {}' print 'CLSIDToPackageMap = {'
print >> stream, 'CLSIDToClassMap = {}' print >> stream, 'CLSIDToPackageMap = {'
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print "\t'%s' : %s," % (str(item.clsid), `item.python_name`) print '}' print "VTablesToClassMap = {}" print "VTablesToPackageMap = {"
print >> stream, "\t'%s' : %s," % (str(item.clsid), `item.python_name`) print >> stream, '}' print >> stream, "VTablesToClassMap = {}" print >> stream, "VTablesToPackageMap = {"
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print "\t'%s' : '%s'," % (item.clsid,item.python_name) print '}' print print
print >> stream, "\t'%s' : '%s'," % (item.clsid,item.python_name) print >> stream, '}' print >> stream print >> stream
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print "NamesToIIDMap = {"
print >> stream, "NamesToIIDMap = {"
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print "\t'%s' : '%s'," % (name, iid) print '}' print
print >> stream, "\t'%s' : '%s'," % (name, iid) print >> stream, '}' print >> stream
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print 'win32com.client.constants.__dicts__.append(constants.__dict__)' print
print >> stream, 'win32com.client.constants.__dicts__.append(constants.__dict__)' print >> stream
print "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`)
print 'win32com.client.CLSIDToClass.RegisterCLSID( "%s", %s )' % (oleitem.clsid, oleitem.python_name)
print >> self.file, 'win32com.client.CLSIDToClass.RegisterCLSID( "%s", %s )' % (oleitem.clsid, oleitem.python_name)
def do_gen_child_item(self, oleitem): moduleDoc = self.typelib.GetDocumentation(-1) docDesc = "" if moduleDoc[1]: docDesc = moduleDoc[1] self.progress.Starting(docDesc) self.progress.SetDescription("Building definitions from type library...") self.do_gen_file_header() oleitem.WriteClass(self) if oleitem.bIsDispatch: pr...
print "from win32com.client import DispatchBaseClass"
print >> self.file, "from win32com.client import DispatchBaseClass"
def checkWriteDispatchBaseClass(self): if not self.bHaveWrittenDispatchBaseClass: print "from win32com.client import DispatchBaseClass" self.bHaveWrittenDispatchBaseClass = 1
print "from win32com.client import CoClassBaseClass"
print >> self.file, "from win32com.client import CoClassBaseClass"
def checkWriteCoClassBaseClass(self): if not self.bHaveWrittenCoClassBaseClass: print "from win32com.client import CoClassBaseClass" self.bHaveWrittenCoClassBaseClass = 1
if ct in _addDefaults: self.style |= _addDefaults[ct]
def createDialogTemplate(self): ct = self.controlType if "CONTROL"==ct: ct = self.subType if ct in _addDefaults: self.style |= _addDefaults[ct] if ct in _controlMap: ct = _controlMap[ct] t = [ct, self.label, self.idNum, (self.x, self.y, self.w, self.h), self.style] #print t return t
t = [ct, self.label, self.idNum, (self.x, self.y, self.w, self.h), self.style]
t = [ct, self.label, self.idNum, (self.x, self.y, self.w, self.h), self.style, self.styleEx]
def createDialogTemplate(self): ct = self.controlType if "CONTROL"==ct: ct = self.subType if ct in _addDefaults: self.style |= _addDefaults[ct] if ct in _controlMap: ct = _controlMap[ct] t = [ct, self.label, self.idNum, (self.x, self.y, self.w, self.h), self.style] #print t return t
if not n.startswith("_APS_"): print "Duplicate id",i,"for",n,"is", self.names[i]
def parseH(self, file): lex = shlex.shlex(file) lex.commenters = "//" token = " " while token is not None: token = lex.get_token() if token == "" or token is None: token = None else: if token=='define': n = lex.get_token() i = int(lex.get_token()) self.ids[n] = i if self.names.has_key(i): # ignore AppStudio special one...
if id_name == "IDOK": self.ids[id_name] = win32con.IDOK return win32con.IDOK if id_name == "IDCANCEL": self.ids[id_name] = win32con.IDCANCEL return win32con.IDCANCEL
for n in ["IDOK","IDCANCEL","IDYES","IDNO", "IDABORT"]: if id_name == n: v = getattr(win32con, n) self.ids[n] = v self.names[v] = n return v
def addId(self, id_name): if id_name in self.ids: id = self.ids[id_name] else: # IDOK and IDCANCEL are special - if a real resource has a value # of OK or CANCEL (1 or 2), we still want the user's name. if id_name == "IDOK": self.ids[id_name] = win32con.IDOK return win32con.IDOK if id_name == "IDCANCEL": self.ids[id_na...
self.getToken()
def parse_stringtable(self): while self.getToken() != "BEGIN": pass self.getToken() while 1: if self.token == "END": break sid = self.token # Handle quoted strings - pity shlex doesn't handle it. bits = [self.getToken()] while 1: tok = self.getToken() if not tok.startswith('"'): break bits.append(tok) sval = "".join(bi...
bits = [self.getToken()] while 1: tok = self.getToken() if not tok.startswith('"'): break bits.append(tok) sval = "".join(bits)[1:-1] sval = sval.replace('""', '"') sd = StringDef(sid, self.addId(sid), sval)
self.getToken() sd = StringDef(sid, self.addId(sid), self.currentQuotedString())
def parse_stringtable(self): while self.getToken() != "BEGIN": pass self.getToken() while 1: if self.token == "END": break sid = self.token # Handle quoted strings - pity shlex doesn't handle it. bits = [self.getToken()] while 1: tok = self.getToken() if not tok.startswith('"'): break bits.append(tok) sval = "".join(bi...
if self.token=="DISCARDABLE": self.getToken() if self.token=="MOVEABLE": self.getToken() self.getToken()
while not self.token.startswith('"'): self.getToken()
def parse_bitmap_or_icon(self, name, dic): self.getToken() if self.token=="DISCARDABLE": self.getToken() if self.token=="MOVEABLE": self.getToken() # PURE self.getToken() # bmpname bmf = self.token[1:-1] # quotes dic[name] = bmf
self.getToken() if self.token[0:1]=='"': control.label = self.token[1:-1]
self.getToken() if control.controlType not in without_text: if self.token[0:1]=='"': control.label = self.currentQuotedString() elif self.token=="-" or self.token.isdigit(): control.label = str(self.currentNumberToken()) else: control.label = str(self.addId(self.token))
def controls(self, dlg): if self.token=="BEGIN": self.getToken() while self.token!="END": control = ControlDef() control.controlType = self.token; #print self.token self.getToken() if self.token[0:1]=='"': control.label = self.token[1:-1] self.getCommaToken() self.getToken() elif self.token.isdigit(): control.label = s...
elif self.token.isdigit(): control.label = self.token self.getCommaToken() self.getToken() if self.token=='-': if self.getToken() != '1': raise RuntimeError, \ "Negative literal in rc script (other than -1) - don't know what to do" self.token = "IDC_STATIC" control.id = self.token control.idNum = self.addId(control.id...
if self.token=="-" or self.token.isdigit(): control.id = self.currentNumberToken() control.idNum = control.id else: control.id = self.token control.idNum = self.addId(control.id)
def controls(self, dlg): if self.token=="BEGIN": self.getToken() while self.token!="END": control = ControlDef() control.controlType = self.token; #print self.token self.getToken() if self.token[0:1]=='"': control.label = self.token[1:-1] self.getCommaToken() self.getToken() elif self.token.isdigit(): control.label = s...
control.style, control.styles = self.styles([], defaultControlStyle)
control.style, control.styles = self.styles([], thisDefaultStyle) else: thisDefaultStyle = defaultControlStyle | \ _addDefaults.get(control.controlType, 0) control.style = thisDefaultStyle
def controls(self, dlg): if self.token=="BEGIN": self.getToken() while self.token!="END": control = ControlDef() control.controlType = self.token; #print self.token self.getToken() if self.token[0:1]=='"': control.label = self.token[1:-1] self.getCommaToken() self.getToken() elif self.token.isdigit(): control.label = s...
control.style, control.styles = self.styles([], defaultControlStyle)
control.style, control.styles = self.styles([], thisDefaultStyle) if self.token==",": self.getToken() control.styleEx, control.stylesEx = self.styles([], defaultControlStyleEx)
def controls(self, dlg): if self.token=="BEGIN": self.getToken() while self.token!="END": control = ControlDef() control.controlType = self.token; #print self.token self.getToken() if self.token[0:1]=='"': control.label = self.token[1:-1] self.getCommaToken() self.getToken() elif self.token.isdigit(): control.label = s...
gencache.EnsureModule("{4AFFC9A0-5F99-101B-AF4E-00AA003F0F07}", 0, 8, 0)
gencache.EnsureDispatch("Access.Application")
def GenerateSupport(): # dao gencache.EnsureModule("{00025E01-0000-0000-C000-000000000046}", 0, 4, 0) # Access gencache.EnsureModule("{4AFFC9A0-5F99-101B-AF4E-00AA003F0F07}", 0, 8, 0)
_doexec(cmd, globals, locals)
if sys.version_info > (2,2): exec cmd in globals, locals else: _doexec(cmd, globals, locals)
def run(self, cmd,globals=None, locals=None, start_stepping = 1): if type(cmd) not in [types.StringType, types.CodeType]: raise TypeError, "Only strings can be run" self.last_cmd_debugged = cmd try: if globals is None: import __main__ globals = __main__.__dict__ if locals is None: locals = globals self.reset() self.pre...
return bdb.Bdb.canonic(fname)
return bdb.Bdb.canonic(self, fname)
def canonic(self, fname): if fname[0]=='<': return fname return bdb.Bdb.canonic(fname)
rc = abd.Adb.break_anywhere(self, frame)
rc = bdb.Bdb.break_anywhere(self, frame)
def break_anywhere(self, frame): traceenter("break_anywhere", _dumpf(frame)) if self.breakFlags==axdebug.APPBREAKFLAG_DEBUGGER_HALT: self.breakReason = axdebug.BREAKREASON_DEBUGGER_HALT return 1 rc = abd.Adb.break_anywhere(self, frame) tracev("break_anywhere",_dumpf(frame),"returning",rc) return rc
def GetRValue(rgb): return ((rgb)) def GetGValue(rgb): return ((((rgb)) >> 8)) def GetBValue(rgb): return (((rgb)>>16))
def GetRValue(rgb): return rgb & 0xff def GetGValue(rgb): return (rgb >> 8) & 0xff def GetBValue(rgb): return (rgb >> 16) & 0xff
def GetRValue(rgb): return ((rgb))
def LoadFontPreferences(): global formatTitle, formatInput, formatOutput, formatOutputError try: fmt = win32ui.GetProfileVal( sectionProfile, valueFormatTitle, "" ) if len(fmt): formatTitle = eval(fmt) fmt = win32ui.GetProfileVal( sectionProfile, valueFormatInput, "" ) if len(fmt): formatInput = eval(fmt) fmt = win32ui...
def LoadFontPreferences(): global formatTitle, formatInput, formatOutput, formatOutputError try: fmt = win32ui.GetProfileVal( sectionProfile, valueFormatTitle, "" ) if len(fmt): formatTitle = eval(fmt) fmt = win32ui.GetProfileVal( sectionProfile, valueFormatInput, "" ) if len(fmt): formatInput = eval(fmt) fmt = win32ui...
def SaveFontPreferences(): win32ui.WriteProfileVal( sectionProfile, valueFormatTitle, str(formatTitle) ) win32ui.WriteProfileVal( sectionProfile, valueFormatInput, str(formatInput) ) win32ui.WriteProfileVal( sectionProfile, valueFormatOutput, str(formatOutput) ) win32ui.WriteProfileVal( sectionProfile, valueFormatOutpu...
def SavePreference( prefName, prefValue ): win32ui.WriteProfileVal( sectionProfile, prefName, prefValue )
LoadFontPreferences()
def Init(self): self.oldStdOut = self.oldStdErr = None LoadFontPreferences()
self.IsFinalDestroy = 0
def __init__(self, makeDoc = None, makeFrame = None): winout.WindowOutput.__init__(self, sectionProfile, sectionProfile, \ winout.flags.WQ_NONE, 1, None, makeDoc, makeFrame, InteractiveView ) self.Create() self.IsFinalDestroy = 0
cb = win32ui.GetMainFrame().GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR)
frame = win32ui.GetMainFrame() except win32ui.error: return 0 try: cb = frame.GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR)
def NeedRecreateWindow(self): if self.bCreating: return 0 try: cb = win32ui.GetMainFrame().GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR) return not cb.IsWindowVisible() except win32ui.error: return 0 # We are dieing!
return 0
return 1
def NeedRecreateWindow(self): if self.bCreating: return 0 try: cb = win32ui.GetMainFrame().GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR) return not cb.IsWindowVisible() except win32ui.error: return 0 # We are dieing!
dockbar = win32ui.GetMainFrame().GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR) win32ui.GetMainFrame().ShowControlBar(dockbar, 1, 1)
try: dockbar = win32ui.GetMainFrame().GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR) win32ui.GetMainFrame().ShowControlBar(dockbar, 1, 1) except win32ui.error: CreateDockedInteractiveWindow()
def RecreateWindow(self): dockbar = win32ui.GetMainFrame().GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR) win32ui.GetMainFrame().ShowControlBar(dockbar, 1, 1)
def canonic(self, fname): if fname[0]=='<': return fname return bdb.Bdb.canonic(fname)
def __init__(self): self.debugApplication = None self.debuggingThread = None self.stackSnifferCookie = self.stackSniffer = None self.codeContainerProvider = None self.debuggingThread = None self.breakFlags = None self.breakReason = None self.appDebugger = None self.appEventConnection = None self.logicalbotframe = None ...
sys.settrace(None)
def dispatch_call(self, frame, arg): traceenter("dispatch_call",_dumpf(frame)) frame.f_locals['__axstack_address__'] = axdebug.GetStackAddress() if frame is self.botframe: trace("dispatch_call is self.botframe - returning tracer") return self.trace_dispatch # Not our bottom frame. If we have a document for it, # then ...
self.logbotframe, self.stopframe, self.currentframe = self.recursiveData[0]
self.logbotframe, self.stopframe, self.currentframe, self.debuggingThreadStateHandle = self.recursiveData[0]
def ResetAXDebugging(self): traceenter("ResetAXDebugging", self, "with refcount", len(self.recursiveData)) if win32api.GetCurrentThreadId()!=self.debuggingThread: trace("ResetAXDebugging called on other thread") return
self.recursiveData.insert(0, (self.logicalbotframe,self.stopframe, self.currentframe))
self.recursiveData.insert(0, (self.logicalbotframe,self.stopframe, self.currentframe,self.debuggingThreadStateHandle))
def SetupAXDebugging(self, baseFrame = None, userFrame = None): """Get ready for potential debugging. Must be called on the thread that is being debugged. """ # userFrame is for non AXScript debugging. This is the first frame of the # users code. if userFrame is None: userFrame = baseFrame else: # We have missed the ...
trace("BreakFlagsChanged, but no logical bot frame!")
trace("BreakFlagsChanged, but no bottom frame")
def _BreakFlagsChanged(self): traceenter("_BreakFlagsChanged to %s with our thread = %s, and debugging thread = %s" % (self.breakFlags, self.debuggingThread, win32api.GetCurrentThreadId())) # If a request comes on our debugging thread, then do it now!
if self.debuggingThreadStateHandle is not None and \ self.breakFlags and \ self.debuggingThread != win32api.GetCurrentThreadId(): axdebug.SetThreadStateTrace(self.debuggingThreadStateHandle, self.trace_dispatch)
def _BreakFlagsChanged(self): traceenter("_BreakFlagsChanged to %s with our thread = %s, and debugging thread = %s" % (self.breakFlags, self.debuggingThread, win32api.GetCurrentThreadId())) # If a request comes on our debugging thread, then do it now!
self.set_break(key, lineNo)
problem = self.set_break(key, lineNo) if problem: print "*** set_break failed -", problem trace("_OnSetBreakPoint just set BP and has breaks", self.breaks)
def _OnSetBreakPoint(self, key, codeContext, bps, lineNo): traceenter("_OnSetBreakPoint", self, key, codeContext, bps, lineNo) if bps==axdebug.BREAKPOINT_ENABLED: self.set_break(key, lineNo) else: self.clear_break(key, lineNo) self._BreakFlagsChanged()
return "<win32com.gen_py.%s.%s>" % (__doc__, self.__class__.__name__)
try: mod_doc = sys.modules[self.__class__.__module__].__doc__ except KeyError: mod_doc = "<no module found>" return "<win32com.gen_py.%s.%s>" % (mod_doc, self.__class__.__name__) def __cmp__(self, other): return cmp(self._oleobj_, other._oleobj_)
def __repr__(self): return "<win32com.gen_py.%s.%s>" % (__doc__, self.__class__.__name__)
if key == 46:
if key in [46,8]:
def OnKeyDown(self, msg): key = msg[2] if key in [13, 27, 32]: return 1 if key == 46: # delete key self.DeleteSelected() return 0 view = scriptutils.GetActiveView() try: firer = view.bindings.fire_key_event except AttributeError: firer = None if firer is not None: return firer(msg) else: return 1
doc.MarkerAdd(lineNo, marker)
if not doc.MarkerCheck(lineNo, marker): doc.MarkerAdd(lineNo, marker)
def SetLineState(self, fileName, lineNo, lineState): # Set the state of a line if the document is open. doc = editor.editorTemplate.FindOpenDocument(fileName) if doc is not None: marker = _LineStateToMarker(lineState) doc.MarkerAdd(lineNo, marker)
doc.MarkerAdd(self.shownLineCurrent[1], MARKER_CURRENT) if self.shownLineCallstack and fname == self.shownLineCallstack[0]: doc.MarkerAdd(self.shownLineCallstack[1], MARKER_CURRENT)
lineNo = self.shownLineCurrent[1] if not doc.MarkerCheck(lineNo, MARKER_CURRENT): doc.MarkerAdd(lineNo, MARKER_CURRENT)
def UpdateDocumentLineStates(self, doc): # Show all lines in their special status color. If the doc is open # all line states are reset. doc.MarkerDeleteAll( MARKER_BREAKPOINT ) doc.MarkerDeleteAll( MARKER_CURRENT ) fname = self.canonic(doc.GetPathName()) # Now loop over all break-points for line in self.breaks.get(fn...
self["Marker Margin Width"] = GetEditorOption("Marker Margin Width", 14)
self["Marker Margin Width"] = GetEditorOption("Marker Margin Width", 16)
def __init__(self): dialog.PropertyPage.__init__(self, win32ui.IDD_PP_EDITOR) self.autooptions = [] self._AddEditorOption(win32ui.IDC_AUTO_RELOAD, "i", "Auto Reload", 1) self._AddEditorOption(win32ui.IDC_COMBO1, "i", "Backup Type", document.BAK_DOT_BAK_BAK_DIR) self._AddEditorOption(win32ui.IDC_AUTOCOMPLETE, "i", "Auto...
self["Marker Margin Width"] = 14
self["Marker Margin Width"] = 16
def UpdateUIForState(self): folding = self.GetDlgItem(win32ui.IDC_FOLD_ENABLE).GetCheck() self.GetDlgItem(win32ui.IDC_FOLD_ON_OPEN).EnableWindow(folding) self.GetDlgItem(win32ui.IDC_FOLD_SHOW_LINES).EnableWindow(folding)
if self['MarkersInMargin']:
if self['MarkersInMargin'] == 0:
def OnOK(self): for name, defVal in self.autooptions: SetEditorOption(name, self[name]) # Margin width gets handled differently. if self['MarkersInMargin']: SetEditorOption("Marker Margin Width", self["Marker Margin Width"]) else: SetEditorOption("Marker Margin Width", 0) if self.edgeColor != self.initialEdgeColor: Set...
print attr
def DllRegisterServer(): import _winreg key = _winreg.CreateKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" \ "Explorer\\Desktop\\Namespace\\" + \ ShellFolder._reg_clsid_) _winreg.SetValueEx(key, None, 0, _winreg.REG_SZ, ShellFolder._reg_desc_) # And special shell keys under our CLSID k...
return "win32com/" + self.name
return "win32comext/" + self.name
def get_pywin32_dir(self): return "win32com/" + self.name
pch_header = "stdafx.h"), WinExt_pythonwin("win32uiole"),
pch_header="stdafx.h"), WinExt_pythonwin("win32uiole", pch_header="stdafxole.h"),
def swig_sources (self, sources): new_sources = [] swig_sources = [] swig_targets = {} # XXX this drops generated C/C++ files into the source tree, which # is fine for developers who want to distribute the generated # source -- but there should be an option to put SWIG output in # the temp dir. target_ext = '.cpp' for ...
package_dir = {"win32": "win32/lib",
package_dir = {"win32": "win32",
def swig_sources (self, sources): new_sources = [] swig_sources = [] swig_targets = {} # XXX this drops generated C/C++ files into the source tree, which # is fine for developers who want to distribute the generated # source -- but there should be an option to put SWIG output in # the temp dir. target_ext = '.cpp' for ...
"Pythonwin": "Pythonwin/pywin"},
"Pythonwin": "Pythonwin"},
def swig_sources (self, sources): new_sources = [] swig_sources = [] swig_targets = {} # XXX this drops generated C/C++ files into the source tree, which # is fine for developers who want to distribute the generated # source -- but there should be an option to put SWIG output in # the temp dir. target_ext = '.cpp' for ...
'Pythonwin.debugger', 'Pythonwin.dialogs', 'Pythonwin.docking', 'Pythonwin.framework', 'Pythonwin.framework.editor', 'Pythonwin.framework.editor.color', 'Pythonwin.idle', 'Pythonwin.mfc', 'Pythonwin.scintilla', 'Pythonwin.tools',
'Pythonwin.pywin', 'Pythonwin.pywin.debugger', 'Pythonwin.pywin.dialogs', 'Pythonwin.pywin.docking', 'Pythonwin.pywin.framework', 'Pythonwin.pywin.framework.editor', 'Pythonwin.pywin.framework.editor.color', 'Pythonwin.pywin.idle', 'Pythonwin.pywin.mfc', 'Pythonwin.pywin.scintilla', 'Pythonwin.pywin.tools',
def swig_sources (self, sources): new_sources = [] swig_sources = [] swig_targets = {} # XXX this drops generated C/C++ files into the source tree, which # is fine for developers who want to distribute the generated # source -- but there should be an option to put SWIG output in # the temp dir. target_ext = '.cpp' for ...
try: testExchange.test() capture.release() print "testExchange test generated %d lines of output" % capture.get_num_lines_captured() finally: capture.release()
testExchange.test() capture.release() print "testExchange test generated %d lines of output" % capture.get_num_lines_captured()
def Prepare(): import win32com, shutil print "Deleting files from %s" % (win32com.__gen_path__) shutil.rmtree(win32com.__gen_path__) import win32com.client.gencache win32com.client.gencache.__init__() # Reset
else: ext = ".pyc" pyfile = os.path.join(path, baseName + ".py")
pyfile = os.path.join(path, baseName + ext)
def _find_localserver_module(): import win32com.server path = win32com.server.__path__[0] baseName = "localserver" pyfile = os.path.join(path, baseName + ".py") try: os.stat(pyfile) except os.error: # See if we have a compiled extension if __debug__: ext = ".pyo" else: ext = ".pyc" pyfile = os.path.join(path, baseName ...
raise RuntimeError, "Can not locate the Python file '%s'" % baseName
raise RuntimeError, "Can not locate the Python module 'win32com.server.%s'" % baseName
def _find_localserver_module(): import win32com.server path = win32com.server.__path__[0] baseName = "localserver" pyfile = os.path.join(path, baseName + ".py") try: os.stat(pyfile) except os.error: # See if we have a compiled extension if __debug__: ext = ".pyo" else: ext = ".pyc" pyfile = os.path.join(path, baseName ...
ret.append(verProgID, win32con.HKEY_CLASSES_ROOT)
ret.append((verProgID, win32con.HKEY_CLASSES_ROOT))
def GetUnregisterServerKeys(clsid, progID=None, verProgID=None, customKeys = None): """Given a server, return a list of of ("key", root), which are keys recursively and uncondtionally deleted at unregister or uninstall time. """ # remove the main CLSID registration ret = [("CLSID\\%s" % str(clsid), win32con.HKEY_CLASSE...
ret.append(progID, win32con.HKEY_CLASSES_ROOT)
ret.append((progID, win32con.HKEY_CLASSES_ROOT))
def GetUnregisterServerKeys(clsid, progID=None, verProgID=None, customKeys = None): """Given a server, return a list of of ("key", root), which are keys recursively and uncondtionally deleted at unregister or uninstall time. """ # remove the main CLSID registration ret = [("CLSID\\%s" % str(clsid), win32con.HKEY_CLASSE...
libraries="axscript msdbg",
libraries="axscript ad1",
def finalize_options(self): if self.install_dir is None: installobj = self.distribution.get_command_obj('install') self.install_dir = installobj.install_lib print 'Installing data files to %s' % self.install_dir install_data.finalize_options(self)
win32ui.GetMainFrame().EnableWindow(self.oldFrameEnableState) self.oldForeground.EnableWindow(1)
try: win32ui.GetMainFrame().EnableWindow(self.oldFrameEnableState) self.oldForeground.EnableWindow(1) except win32ui.error: pass
def GUIAboutToFinishInteract(self): """Called as the GUI is about to finish any interaction with the user Returns non zero if we are allowed to stop interacting""" if self.oldForeground is not None: win32ui.GetMainFrame().EnableWindow(self.oldFrameEnableState) self.oldForeground.EnableWindow(1)
if useDispatcher is None:
if useDispatcher == 1: import win32com.server.dispatcher useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher if useDispatcher is None or useDispatcher==0:
def wrap(ob, iid=None, usePolicy=None, useDispatcher=None): """Wraps an object in a PyGDispatch gateway. Returns a client side PyI{iid} interface. Interface and gateway support must exist for the specified IID, as the QueryInterface() method is used. """ if usePolicy is None: usePolicy = policy.DefaultPolicy if useD...
dispid = self._allocnextdispid(999)
next_dispid = self._allocnextdispid(999)
def _wrap_(self, ob): # If we have nominated universal interfaces to support, load them now tlb_guid = getattr(ob, '_typelib_guid_', None) if tlb_guid is not None: tlb_major, tlb_minor = getattr(ob, '_typelib_version_', (1,0)) tlb_lcid = getattr(ob, '_typelib_lcid_', 0) from win32com import universal # XXX - what if th...
self._name_to_dispid_[string.lower(name)] = dispid
dispid = self._name_to_dispid_.get(name.lower()) if dispid is None: dispid = next_dispid self._name_to_dispid_[name.lower()] = dispid next_dispid = self._allocnextdispid(next_dispid)
def _wrap_(self, ob): # If we have nominated universal interfaces to support, load them now tlb_guid = getattr(ob, '_typelib_guid_', None) if tlb_guid is not None: tlb_major, tlb_minor = getattr(ob, '_typelib_version_', (1,0)) tlb_lcid = getattr(ob, '_typelib_lcid_', 0) from win32com import universal # XXX - what if th...
dispid = self._allocnextdispid(dispid)
def _wrap_(self, ob): # If we have nominated universal interfaces to support, load them now tlb_guid = getattr(ob, '_typelib_guid_', None) if tlb_guid is not None: tlb_major, tlb_minor = getattr(ob, '_typelib_version_', (1,0)) tlb_lcid = getattr(ob, '_typelib_lcid_', 0) from win32com import universal # XXX - what if th...
if not self._name_to_dispid_.has_key(string.lower(name)): self._name_to_dispid_[string.lower(name)] = dispid self._dispid_to_func_[dispid] = name dispid = self._allocnextdispid(dispid)
dispid = self._name_to_dispid_.get(name.lower()) if dispid is None: dispid = next_dispid self._name_to_dispid_[name.lower()] = dispid next_dispid = self._allocnextdispid(next_dispid) self._dispid_to_func_[dispid] = name
def _wrap_(self, ob): # If we have nominated universal interfaces to support, load them now tlb_guid = getattr(ob, '_typelib_guid_', None) if tlb_guid is not None: tlb_major, tlb_minor = getattr(ob, '_typelib_version_', (1,0)) tlb_lcid = getattr(ob, '_typelib_lcid_', 0) from win32com import universal # XXX - what if th...
self.name = name
self.name = getattr(name, "name", name)
def __init__(self, name, file, lineno, suffix = ""): self.name = name self.file = file self.lineno = lineno self.suffix = suffix
self.hinst = win32api.GetModuleHandle(None)
self.hinst = win32gui.dllhandle
def __init__(self): win32gui.InitCommonControls() self.hinst = win32api.GetModuleHandle(None) self.list_data = {}
self.hinst = wc.hInstance = win32api.GetModuleHandle(None)
wc.hInstance = self.hinst
def _RegisterWndClass(self): className = "PythonDocSearch" global g_registeredClass if not g_registeredClass: message_map = {} wc = win32gui.WNDCLASS() wc.SetDialogProc() # Make it a dialog class. self.hinst = wc.hInstance = win32api.GetModuleHandle(None) wc.lpszClassName = className wc.style = win32con.CS_VREDRAW | wi...
self.patErrorMessage=re.compile('.*File "(.*)", line ([0-9]+)')
self.patErrorMessage=re.compile('\W*File "(.*)", line ([0-9]+)')
def __init__(self): self.patErrorMessage=re.compile('.*File "(.*)", line ([0-9]+)') self.template = self.GetDocument().GetDocTemplate()
return NULL
return NULL;
def _write_enumifc_cpp(f, interface): enumtype = interface.name[5:] if is_interface_enum(enumtype): # Assume an interface. enum_interface = "I" + enumtype[:-1] converter = "PyObject *ob = PyCom_PyObjectFromIUnknown(rgVar[i], IID_%(enum_interface)s, FALSE);" % locals() arraydeclare = "%(enum_interface)s **rgVar = new %(...
return PyCom_SetCOMErrorFromSimple(E_FAIL, "Next() did not return a sequence of objects", IID_IEnum%(enumtype)s);
return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnum%(enumtype)s, "Next() did not return a sequence of objects");
def _write_enumgw_cpp(f, interface): enumtype = interface.name[5:] if is_interface_enum(enumtype): # Assume an interface. enum_interface = "I" + enumtype[:-1] converter = "if ( !PyCom_InterfaceFromPyObject(ob, IID_%(enum_interface)s, (void **)&rgVar[i], FALSE) )" % locals() argdeclare="%(enum_interface)s __RPC_FAR * __...
win32ui.GetMainFrame().EnableWindow(0)
win32ui.GetMainFrame().EnableWindow(self.oldFrameEnableState)
def GUIAboutToFinishInteract(self): """Called as the GUI is about to finish any interaction with the user Returns non zero if we are allowed to stop interacting""" if self.oldForeground is not None: win32ui.GetMainFrame().EnableWindow(0) self.oldForeground.EnableWindow(1)
i = 0
def _LazyAddAttr_(self,attr): if self._lazydata_ is None: return 0 res = 0 i = 0 typeinfo, typecomp = self._lazydata_ olerepr = self._olerepr_ try: x,t = typecomp.Bind(attr,i) if x==1: #it's a FUNCDESC r = olerepr._AddFunc_(typeinfo,t,0) elif x==2: #it's a VARDESC r = olerepr._AddVar_(typeinfo,t,0) else: #not found or...
try: x,t = typecomp.Bind(attr,i) if x==1: r = olerepr._AddFunc_(typeinfo,t,0) elif x==2: r = olerepr._AddVar_(typeinfo,t,0) else: r=None if not r is None: key, map = r[0],r[1] item = map[key] if map==olerepr.propMapPut: olerepr._propMapPutCheck_(key,item) elif map==olerepr.propMapGet: olerepr._propMapGetCheck_(key,ite...
for i in ALL_INVOKE_TYPES: try: x,t = typecomp.Bind(attr,i) if x==1: r = olerepr._AddFunc_(typeinfo,t,0) elif x==2: r = olerepr._AddVar_(typeinfo,t,0) else: r=None if not r is None: key, map = r[0],r[1] item = map[key] if map==olerepr.propMapPut: olerepr._propMapPutCheck_(key,item) elif map==olerepr.propMapGet: olerepr...
def _LazyAddAttr_(self,attr): if self._lazydata_ is None: return 0 res = 0 i = 0 typeinfo, typecomp = self._lazydata_ olerepr = self._olerepr_ try: x,t = typecomp.Bind(attr,i) if x==1: #it's a FUNCDESC r = olerepr._AddFunc_(typeinfo,t,0) elif x==2: #it's a VARDESC r = olerepr._AddVar_(typeinfo,t,0) else: #not found or...
if self._olerepr_.propMap.has_key(attr): retEntry = self._olerepr_.propMap[attr] if retEntry is None and self._olerepr_.propMapGet.has_key(attr): retEntry = self._olerepr_.propMapGet[attr]
retEntry = self._olerepr_.propMap.get(attr) if retEntry is None: retEntry = self._olerepr_.propMapGet.get(attr)
def __call__(self): import win32com.client.util return win32com.client.util.Iterator(self.ob)
ret = self._oleobj_.Invoke(retEntry.dispid,0,pythoncom.DISPATCH_PROPERTYGET,1)
ret = self._oleobj_.Invoke(retEntry.dispid,0,invoke_type,1)
def __call__(self): import win32com.client.util return win32com.client.util.Iterator(self.ob)
self._olerepr_.propMap[attr] = retEntry
def __call__(self): import win32com.client.util return win32com.client.util.Iterator(self.ob)
self._oleobj_.Invoke(self._olerepr_.propMap[attr].dispid, 0, pythoncom.DISPATCH_PROPERTYPUT, 0, value)
entry = self._olerepr_.propMap[attr] invoke_type = _GetDescInvokeType(entry, pythoncom.INVOKE_PROPERTYPUT) self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value)
def __setattr__(self, attr, value): if self.__dict__.has_key(attr): # Fast-track - if already in our dict, just make the assignment. # XXX - should maybe check method map - if someone assigns to a method, # it could mean something special (not sure what, tho!) self.__dict__[attr] = value return # Allow property assignm...
self._oleobj_.Invoke(self._olerepr_.propMapPut[attr].dispid, 0, pythoncom.DISPATCH_PROPERTYPUT, 0, value)
entry = self._olerepr_.propMapPut[attr] invoke_type = _GetDescInvokeType(entry, pythoncom.INVOKE_PROPERTYPUT) self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value)
def __setattr__(self, attr, value): if self.__dict__.has_key(attr): # Fast-track - if already in our dict, just make the assignment. # XXX - should maybe check method map - if someone assigns to a method, # it could mean something special (not sure what, tho!) self.__dict__[attr] = value return # Allow property assignm...
self._oleobj_.Invoke(entry.dispid, 0, pythoncom.DISPATCH_PROPERTYPUT, 0, value)
invoke_type = _GetDescInvokeType(entry, pythoncom.INVOKE_PROPERTYPUT) self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value)
def __setattr__(self, attr, value): if self.__dict__.has_key(attr): # Fast-track - if already in our dict, just make the assignment. # XXX - should maybe check method map - if someone assigns to a method, # it could mean something special (not sure what, tho!) self.__dict__[attr] = value return # Allow property assignm...
sm = text if sm: sma = array.array('c', sm) (a,l) = sma.buffer_info() view.SendScintilla(SCI_CLEARALL) view.SendScintilla(SCI_ADDTEXT, l, a) sma = None
view.SendScintilla(SCI_CLEARALL) view.SendMessage(SCI_ADDTEXT, buffer(text))
def _SetLoadedText(self, text): view = self.GetFirstView() if view.IsWindow(): # Turn off undo collection while loading view.SendScintilla(SCI_SETUNDOCOLLECTION, 0, 0) # Make sure the control isnt read-only view.SetReadOnly(0)
parent.HookNotify(self.OnSavePointReached, SCN_SAVEPOINTREACHED) parent.HookNotify(self.OnSavePointLeft, SCN_SAVEPOINTLEFT) parent.HookNotify(self.OnModifyAttemptRO, SCN_MODIFYATTEMPTRO)
def HookViewNotifications(self, view): parent = view.GetParentFrame() parent.HookNotify(self.OnSavePointReached, SCN_SAVEPOINTREACHED) parent.HookNotify(self.OnSavePointLeft, SCN_SAVEPOINTLEFT) parent.HookNotify(self.OnModifyAttemptRO, SCN_MODIFYATTEMPTRO) parent.HookNotify(ViewNotifyDelegate(self, "OnBraceMatch"), SCN...
if view == self.GetFirstView(): pass else:
if view != self.GetFirstView():
def HookViewNotifications(self, view): parent = view.GetParentFrame() parent.HookNotify(self.OnSavePointReached, SCN_SAVEPOINTREACHED) parent.HookNotify(self.OnSavePointLeft, SCN_SAVEPOINTLEFT) parent.HookNotify(self.OnModifyAttemptRO, SCN_MODIFYATTEMPTRO) parent.HookNotify(ViewNotifyDelegate(self, "OnBraceMatch"), SCN...
v.SCIMarkerDelete(lineNo, marker)
v.SCIMarkerDelete(lineNo-1, marker)
def MarkerToggle( self, lineNo, marker ): v = self.GetEditorView() if self.MarkerCheck(lineNo, marker): v.SCIMarkerDelete(lineNo, marker) else: v.SCIMarkerAdd(lineNo, marker)
v.SCIMarkerAdd(lineNo, marker)
v.SCIMarkerAdd(lineNo-1, marker)
def MarkerToggle( self, lineNo, marker ): v = self.GetEditorView() if self.MarkerCheck(lineNo, marker): v.SCIMarkerDelete(lineNo, marker) else: v.SCIMarkerAdd(lineNo, marker)
frame = self.GetFirstView().GetParentFrame() return frame.GetEditorView()
try: frame_gev = self.GetFirstView().GetParentFrame().GetEditorView except AttributeError: return self.GetFirstView() return frame_gev()
def GetEditorView(self): # Find the first frame with a view, # then ask it to give the editor view # as it knows which one is "active" frame = self.GetFirstView().GetParentFrame() return frame.GetEditorView()
stylePyStart = strstyle.name
if strstyle.name == pywin.scintilla.formatter.STYLE_TQSSTRING: quote_char = "'" elif strstyle.name == pywin.scintilla.formatter.STYLE_TQDSTRING: quote_char = '"' if quote_char is not None: if look > 2: look_str = self.scintilla.SCIGetCharAt(look-2) + self.scintilla.SCIGetCharAt(look-1) + self.scintilla.SCIGetCharAt(l...
def Colorize(self, start=0, end=-1): stringVal = self.scintilla.GetTextRange(start, end) styleStart = None stylePyStart = None if start > 1: # Likely we are being asked to color from the start of the line. # The character before should be '\n', and formatted EOL # The character before is the continued Python style # (o...
return self._ProcessEnterEvent(event) def ProcessEnterEvent(self, event ):
def ProcessEnterEvent(self, event ): return self._ProcessEnterEvent(event)
self.watcherThread.start()
self.watcherThread.CreateThread()
def __init__(self, template): self.bAutoReload = GetEditorOption("Auto Reload", 1) self.bDeclinedReload = 0 # Has the user declined to reload. self.fileStat = None self.bReportedFileNotFound = 0
self.watcherThread.stop()
self.watcherThread.SignalStop()
def OnCloseDocument(self ): self.watcherThread.stop() return self._obj_.OnCloseDocument()