rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
self.setModelData(str(self.GetText()))
|
self.setModelData(Utils.stringFromControl(self.GetText()))
|
def refreshModel(self): if self.isModified(): self.model.modified = True self.nonUserModification = False
|
self.notebook1.SetSelection(selIdx)
|
if selIdx >= 0: self.notebook1.SetSelection(selIdx)
|
def updateCtrls(self, errorList, outputList=None, rootName='Error', runningDir='', errRaw=None): self.runningDir = runningDir self.tracebackType = rootName tree = self.errorStackTC tree.DeleteAllItems() rtTI = tree.AddRoot(rootName+'s') parsedTracebacks = 0 for err in errorList: if err.error and err.stack: errTI = tree.AppendItem(rtTI, string.strip(string.join(err.error, ' : '))) for si in err.stack: siTI = tree.AppendItem(errTI, '%d: %s: %s' % (si.lineNo, os.path.basename(si.file), string.strip(si.line))) tree.SetPyData(siTI, si) if err.stack: tree.SetItemHasChildren(errTI, true) tree.SetPyData(errTI, err.stack[-1]) parsedTracebacks = parsedTracebacks + 1 tree.SetItemHasChildren(rtTI, true) tree.Expand(rtTI) cookie = 0; firstErr, cookie = tree.GetFirstChild(rtTI, cookie) if firstErr.IsOk(): tree.Expand(firstErr)
|
self.notebook1.AddPage(strText='Diffs', bSelect=true,
|
self.notebook1.AddPage(strText='Diffs', bSelect=not not diffResult,
|
def displayDiff(self, diffResult): if not self.diffPage: self.diffPage = wxStyledTextCtrl(self.notebook1, -1) self.diffPage.SetMarginWidth(1, 0) self.diffPage.SetLexer(wxSTC_LEX_DIFF) self.diffPage.StyleClearAll() for num, style in ( (2, 'fore:#FFFFCC,back:#000000,bold'), #diff (3, 'back:#FFFFCC'), #"--- ","+++ ", (4, 'back:#CCCCFF,bold'),#'@' (5, 'back:#FFCCCC'),#'-' (6, 'back:#CCFFCC') ): #'+' self.diffPage.StyleSetSpec(num, style) self.diffPage.SetText(diffResult) self.notebook1.AddPage(strText='Diffs', bSelect=true, pPage=self.diffPage, imageId=self.diffImgIdx) else: self.diffPage.SetText(diffResult) self.notebook1.SetSelection(3)
|
self.notebook1.SetSelection(3)
|
if diffResult: self.notebook1.SetSelection(3)
|
def displayDiff(self, diffResult): if not self.diffPage: self.diffPage = wxStyledTextCtrl(self.notebook1, -1) self.diffPage.SetMarginWidth(1, 0) self.diffPage.SetLexer(wxSTC_LEX_DIFF) self.diffPage.StyleClearAll() for num, style in ( (2, 'fore:#FFFFCC,back:#000000,bold'), #diff (3, 'back:#FFFFCC'), #"--- ","+++ ", (4, 'back:#CCCCFF,bold'),#'@' (5, 'back:#FFCCCC'),#'-' (6, 'back:#CCFFCC') ): #'+' self.diffPage.StyleSetSpec(num, style) self.diffPage.SetText(diffResult) self.notebook1.AddPage(strText='Diffs', bSelect=true, pPage=self.diffPage, imageId=self.diffImgIdx) else: self.diffPage.SetText(diffResult) self.notebook1.SetSelection(3)
|
string.split(Utils.readTextFromClipboard(), os.linesep))
|
string.split(str(Utils.readTextFromClipboard()), os.linesep))
|
def OnPasteSelected(self, event): """ Paste current clipboard contents into the current selection """ if self.selection: # If the selection is not a container, select it's parent (a container) if not self.selection.selCompn.container: self.selectParent(self.selection.selection)
|
wxDocs = 'wx104.htm'
|
wxDocs = HelpCompanions.wxFrameDocs
|
def dependentProps(self): return ContainerDTC.dependentProps(self) + \ ['ToolBar', 'MenuBar', 'StatusBar']
|
if self.palette.IsShown():
|
if self.palette.IsShown() and self.palette.IsIconized():
|
def openOrGotoModule(self, name, app=None, transport=None, notebook=None): """ Main entrypoint to open a file in the editor.
|
else:
|
elif self.IsIconized():
|
def openOrGotoModule(self, name, app=None, transport=None, notebook=None): """ Main entrypoint to open a file in the editor.
|
Preferences.toPyPath('Images/Shared/PythonPowered.gif'), Preferences.toPyPath('Images/Shared/wxPyButton.png'), Preferences.toPyPath('Images/Shared/wxWinButton.png')))
|
Utils.toPyPath('Images/Shared/PythonPowered.gif'), Utils.toPyPath('Images/Shared/wxPyButton.png'), Utils.toPyPath('Images/Shared/wxWinButton.png')))
|
def OnLinkClick(self, event): clicked = event.linkinfo[0] if clicked == 'Credits': self.html.SetPage(credits_html % ( Preferences.toPyPath('Images/Shared/PythonPowered.gif'), Preferences.toPyPath('Images/Shared/wxPyButton.png'), Preferences.toPyPath('Images/Shared/wxWinButton.png'))) elif clicked == 'Back': self.html.HistoryBack() elif clicked == 'Python': self.gotoInternetUrl('http://www.python.org') elif clicked == 'wxPython': self.gotoInternetUrl('http://wxpython.org') elif clicked == 'wxWindows': self.gotoInternetUrl('http://www.wxwindows.org') elif clicked == 'Boa': self.gotoInternetUrl('http://boa-constructor.sourceforge.net') elif clicked == 'TBS': self.gotoInternetUrl('http://www.tbs.co.za') elif clicked == 'MailMe': self.gotoInternetUrl('mailto:[email protected]')
|
self.html.HistoryBack()
|
self.setPage()
|
def OnLinkClick(self, event): clicked = event.linkinfo[0] if clicked == 'Credits': self.html.SetPage(credits_html % ( Preferences.toPyPath('Images/Shared/PythonPowered.gif'), Preferences.toPyPath('Images/Shared/wxPyButton.png'), Preferences.toPyPath('Images/Shared/wxWinButton.png'))) elif clicked == 'Back': self.html.HistoryBack() elif clicked == 'Python': self.gotoInternetUrl('http://www.python.org') elif clicked == 'wxPython': self.gotoInternetUrl('http://wxpython.org') elif clicked == 'wxWindows': self.gotoInternetUrl('http://www.wxwindows.org') elif clicked == 'Boa': self.gotoInternetUrl('http://boa-constructor.sourceforge.net') elif clicked == 'TBS': self.gotoInternetUrl('http://www.tbs.co.za') elif clicked == 'MailMe': self.gotoInternetUrl('mailto:[email protected]')
|
wxDialog.__init__(self, size=wxSize(400,530), pos=(-1, -1),
|
wxDialog.__init__(self, size=wxSize(410, 545), pos=(-1, -1),
|
def _init_ctrls(self, prnt): wxDialog.__init__(self, size=wxSize(400,530), pos=(-1, -1), id=wxID_ABOUTBOX, title='About Boa Constructor', parent=prnt, name='AboutBox', style=wxDEFAULT_DIALOG_STYLE)
|
Preferences.toPyPath('Images/Shared/Boa.jpg'), __version__.version,
|
Utils.toPyPath('Images/Shared/Boa.jpg'), __version__.version,
|
def setPage(self): self.html.SetPage((about_html % ( Preferences.toPyPath('Images/Shared/Boa.jpg'), __version__.version, '', about_text % (sys.version, wxPlatform, wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER))))
|
wxFrame.__init__(self, size=wxSize(400, 315), pos=(-1, -1),
|
wxFrame.__init__(self, size=wxSize(410, 315), pos=(-1, -1),
|
def _init_ctrls(self, prnt): wxFrame.__init__(self, size=wxSize(400, 315), pos=(-1, -1), id=wxID_ABOUTBOX, title='Boa Constructor', parent=prnt, name='AboutBoxSplash', style=wxSIMPLE_BORDER) self.progressId = wxNewId() self.gaugePId = wxNewId() self.SetBackgroundColour(wxColour(0x99, 0xcc, 0xff))
|
self.html.SetPage(about_html % (Preferences.toPyPath('Images/Shared/Boa.jpg'),
|
self.html.SetPage(about_html % (Utils.toPyPath('Images/Shared/Boa.jpg'),
|
def setPage(self): self.html.SetPage(about_html % (Preferences.toPyPath('Images/Shared/Boa.jpg'), __version__.version, progress_text % (self.progressId, self.gaugePId), ''))
|
def canReadStream(stream): try: return stream.CanRead() except AttributeError: return not stream.eof()
|
def canReadStream(stream): try: return stream.CanRead() except AttributeError: return not stream.eof()
|
|
if pyIntpPath == sys.executable: os.environ['PYTHONPATH'] = os.pathsep.join(sys.path) else: os.environ['PYTHONPATH'] = Preferences.pyPath
|
def spawnChild(monitor, process, args=''): """Returns an xmlrpclib.Server, a connection to an xml-rpc server, and the input and error streams. """ # Start ChildProcessServerStart.py in a new process. # XXX Using PYTHONPATH is wrong # XXX ExternalLib.xmlrpclib and script dir should end up in sys.path script_fn = os.path.join(os.path.dirname(__file__), 'ChildProcessServerStart.py') pyIntpPath = Preferences.getPythonInterpreterPath() if pyIntpPath == sys.executable: os.environ['PYTHONPATH'] = os.pathsep.join(sys.path) else: os.environ['PYTHONPATH'] = Preferences.pyPath cmd = '%s "%s" %s' % (pyIntpPath, script_fn, args) try: if wx.wxVERSION > (2, 3, 2): flags = wx.wxEXEC_NOHIDE else: flags = 0 pid = wx.wxExecute(cmd, flags, process) line = '' if monitor.isAlive(): istream = process.GetInputStream() estream = process.GetErrorStream() err = '' # read in the port and auth hash while monitor.isAlive() and line.find('\n') < 0: # don't take more time than the process we wait for ;) time.sleep(0.00001) if canReadStream(istream): line = line + istream.read(1) # test for tracebacks on stderr if canReadStream(estream): err = estream.read() if LOG_TRACEBACKS: fn = os.path.join(os.path.dirname(__file__), 'DebugTracebacks.txt') open(fn, 'a').write(err) errlines = err.split('\n') while not errlines[-1].strip(): del errlines[-1] exctype, excvalue = errlines[-1].split(':') while errlines and errlines[-1][:7] != ' File ': del errlines[-1] if errlines: errfile = ' (%s)' % errlines[-1].strip() else: errfile = '' try: Error, val = __builtins__[exctype.strip()], (excvalue.strip()+errfile) except KeyError: Error, val = UnknownError, (exctype.strip()+':'+excvalue.strip()+errfile) raise Error, val if not KEEP_STREAMS_OPEN: process.CloseOutput() if monitor.isAlive(): line = line.strip() if not line: raise RuntimeError, ( 'The debug server address could not be read') port, auth = line.strip().split() if USE_TCPWATCH: # Start TCPWatch as a connection forwarder. from thread import start_new_thread new_port = 20202 # Hopefully free def run_tcpwatch(port1, port2): os.system("tcpwatch -L %d:127.0.0.1:%d" % ( int(port1), int(port2))) start_new_thread(run_tcpwatch, (new_port, port)) time.sleep(3) port = new_port trans = TransportWithAuth(auth) server = xmlrpclib.Server( 'http://127.0.0.1:%d' % int(port), trans) return server, istream, estream, pid else: raise RuntimeError, 'The debug server failed to start' except: if monitor.isAlive(): process.CloseOutput() monitor.kill() raise
|
|
if wx.wxVERSION > (2, 3, 2): flags = wx.wxEXEC_NOHIDE else: flags = 0 pid = wx.wxExecute(cmd, flags, process)
|
pid = wx.wxExecute(cmd, wx.wxEXEC_NOHIDE, process)
|
def spawnChild(monitor, process, args=''): """Returns an xmlrpclib.Server, a connection to an xml-rpc server, and the input and error streams. """ # Start ChildProcessServerStart.py in a new process. # XXX Using PYTHONPATH is wrong # XXX ExternalLib.xmlrpclib and script dir should end up in sys.path script_fn = os.path.join(os.path.dirname(__file__), 'ChildProcessServerStart.py') pyIntpPath = Preferences.getPythonInterpreterPath() if pyIntpPath == sys.executable: os.environ['PYTHONPATH'] = os.pathsep.join(sys.path) else: os.environ['PYTHONPATH'] = Preferences.pyPath cmd = '%s "%s" %s' % (pyIntpPath, script_fn, args) try: if wx.wxVERSION > (2, 3, 2): flags = wx.wxEXEC_NOHIDE else: flags = 0 pid = wx.wxExecute(cmd, flags, process) line = '' if monitor.isAlive(): istream = process.GetInputStream() estream = process.GetErrorStream() err = '' # read in the port and auth hash while monitor.isAlive() and line.find('\n') < 0: # don't take more time than the process we wait for ;) time.sleep(0.00001) if canReadStream(istream): line = line + istream.read(1) # test for tracebacks on stderr if canReadStream(estream): err = estream.read() if LOG_TRACEBACKS: fn = os.path.join(os.path.dirname(__file__), 'DebugTracebacks.txt') open(fn, 'a').write(err) errlines = err.split('\n') while not errlines[-1].strip(): del errlines[-1] exctype, excvalue = errlines[-1].split(':') while errlines and errlines[-1][:7] != ' File ': del errlines[-1] if errlines: errfile = ' (%s)' % errlines[-1].strip() else: errfile = '' try: Error, val = __builtins__[exctype.strip()], (excvalue.strip()+errfile) except KeyError: Error, val = UnknownError, (exctype.strip()+':'+excvalue.strip()+errfile) raise Error, val if not KEEP_STREAMS_OPEN: process.CloseOutput() if monitor.isAlive(): line = line.strip() if not line: raise RuntimeError, ( 'The debug server address could not be read') port, auth = line.strip().split() if USE_TCPWATCH: # Start TCPWatch as a connection forwarder. from thread import start_new_thread new_port = 20202 # Hopefully free def run_tcpwatch(port1, port2): os.system("tcpwatch -L %d:127.0.0.1:%d" % ( int(port1), int(port2))) start_new_thread(run_tcpwatch, (new_port, port)) time.sleep(3) port = new_port trans = TransportWithAuth(auth) server = xmlrpclib.Server( 'http://127.0.0.1:%d' % int(port), trans) return server, istream, estream, pid else: raise RuntimeError, 'The debug server failed to start' except: if monitor.isAlive(): process.CloseOutput() monitor.kill() raise
|
if canReadStream(istream):
|
if istream.CanRead():
|
def spawnChild(monitor, process, args=''): """Returns an xmlrpclib.Server, a connection to an xml-rpc server, and the input and error streams. """ # Start ChildProcessServerStart.py in a new process. # XXX Using PYTHONPATH is wrong # XXX ExternalLib.xmlrpclib and script dir should end up in sys.path script_fn = os.path.join(os.path.dirname(__file__), 'ChildProcessServerStart.py') pyIntpPath = Preferences.getPythonInterpreterPath() if pyIntpPath == sys.executable: os.environ['PYTHONPATH'] = os.pathsep.join(sys.path) else: os.environ['PYTHONPATH'] = Preferences.pyPath cmd = '%s "%s" %s' % (pyIntpPath, script_fn, args) try: if wx.wxVERSION > (2, 3, 2): flags = wx.wxEXEC_NOHIDE else: flags = 0 pid = wx.wxExecute(cmd, flags, process) line = '' if monitor.isAlive(): istream = process.GetInputStream() estream = process.GetErrorStream() err = '' # read in the port and auth hash while monitor.isAlive() and line.find('\n') < 0: # don't take more time than the process we wait for ;) time.sleep(0.00001) if canReadStream(istream): line = line + istream.read(1) # test for tracebacks on stderr if canReadStream(estream): err = estream.read() if LOG_TRACEBACKS: fn = os.path.join(os.path.dirname(__file__), 'DebugTracebacks.txt') open(fn, 'a').write(err) errlines = err.split('\n') while not errlines[-1].strip(): del errlines[-1] exctype, excvalue = errlines[-1].split(':') while errlines and errlines[-1][:7] != ' File ': del errlines[-1] if errlines: errfile = ' (%s)' % errlines[-1].strip() else: errfile = '' try: Error, val = __builtins__[exctype.strip()], (excvalue.strip()+errfile) except KeyError: Error, val = UnknownError, (exctype.strip()+':'+excvalue.strip()+errfile) raise Error, val if not KEEP_STREAMS_OPEN: process.CloseOutput() if monitor.isAlive(): line = line.strip() if not line: raise RuntimeError, ( 'The debug server address could not be read') port, auth = line.strip().split() if USE_TCPWATCH: # Start TCPWatch as a connection forwarder. from thread import start_new_thread new_port = 20202 # Hopefully free def run_tcpwatch(port1, port2): os.system("tcpwatch -L %d:127.0.0.1:%d" % ( int(port1), int(port2))) start_new_thread(run_tcpwatch, (new_port, port)) time.sleep(3) port = new_port trans = TransportWithAuth(auth) server = xmlrpclib.Server( 'http://127.0.0.1:%d' % int(port), trans) return server, istream, estream, pid else: raise RuntimeError, 'The debug server failed to start' except: if monitor.isAlive(): process.CloseOutput() monitor.kill() raise
|
if canReadStream(estream):
|
if estream.CanRead():
|
def spawnChild(monitor, process, args=''): """Returns an xmlrpclib.Server, a connection to an xml-rpc server, and the input and error streams. """ # Start ChildProcessServerStart.py in a new process. # XXX Using PYTHONPATH is wrong # XXX ExternalLib.xmlrpclib and script dir should end up in sys.path script_fn = os.path.join(os.path.dirname(__file__), 'ChildProcessServerStart.py') pyIntpPath = Preferences.getPythonInterpreterPath() if pyIntpPath == sys.executable: os.environ['PYTHONPATH'] = os.pathsep.join(sys.path) else: os.environ['PYTHONPATH'] = Preferences.pyPath cmd = '%s "%s" %s' % (pyIntpPath, script_fn, args) try: if wx.wxVERSION > (2, 3, 2): flags = wx.wxEXEC_NOHIDE else: flags = 0 pid = wx.wxExecute(cmd, flags, process) line = '' if monitor.isAlive(): istream = process.GetInputStream() estream = process.GetErrorStream() err = '' # read in the port and auth hash while monitor.isAlive() and line.find('\n') < 0: # don't take more time than the process we wait for ;) time.sleep(0.00001) if canReadStream(istream): line = line + istream.read(1) # test for tracebacks on stderr if canReadStream(estream): err = estream.read() if LOG_TRACEBACKS: fn = os.path.join(os.path.dirname(__file__), 'DebugTracebacks.txt') open(fn, 'a').write(err) errlines = err.split('\n') while not errlines[-1].strip(): del errlines[-1] exctype, excvalue = errlines[-1].split(':') while errlines and errlines[-1][:7] != ' File ': del errlines[-1] if errlines: errfile = ' (%s)' % errlines[-1].strip() else: errfile = '' try: Error, val = __builtins__[exctype.strip()], (excvalue.strip()+errfile) except KeyError: Error, val = UnknownError, (exctype.strip()+':'+excvalue.strip()+errfile) raise Error, val if not KEEP_STREAMS_OPEN: process.CloseOutput() if monitor.isAlive(): line = line.strip() if not line: raise RuntimeError, ( 'The debug server address could not be read') port, auth = line.strip().split() if USE_TCPWATCH: # Start TCPWatch as a connection forwarder. from thread import start_new_thread new_port = 20202 # Hopefully free def run_tcpwatch(port1, port2): os.system("tcpwatch -L %d:127.0.0.1:%d" % ( int(port1), int(port2))) start_new_thread(run_tcpwatch, (new_port, port)) time.sleep(3) port = new_port trans = TransportWithAuth(auth) server = xmlrpclib.Server( 'http://127.0.0.1:%d' % int(port), trans) return server, istream, estream, pid else: raise RuntimeError, 'The debug server failed to start' except: if monitor.isAlive(): process.CloseOutput() monitor.kill() raise
|
return server, istream, estream, pid
|
return server, istream, estream, pid, pyIntpPath
|
def run_tcpwatch(port1, port2): os.system("tcpwatch -L %d:127.0.0.1:%d" % ( int(port1), int(port2)))
|
pyIntpPath = None
|
def run_tcpwatch(port1, port2): os.system("tcpwatch -L %d:127.0.0.1:%d" % ( int(port1), int(port2)))
|
|
def __del__(self): pass
|
def __del__(self): pass#self.kill()
|
|
stderr_text = ''
|
def pollStreams(self): stdin_text = '' stderr_text = '' stream = self.input_stream if stream is not None and canReadStream(stream): stdin_text = stream.read() stream = self.error_stream if stream is not None and not canReadStream(stream): stderr_text = stream.read() return (stdin_text, stderr_text)
|
|
if stream is not None and canReadStream(stream):
|
if stream is not None and stream.CanRead():
|
def pollStreams(self): stdin_text = '' stderr_text = '' stream = self.input_stream if stream is not None and canReadStream(stream): stdin_text = stream.read() stream = self.error_stream if stream is not None and not canReadStream(stream): stderr_text = stream.read() return (stdin_text, stderr_text)
|
stream = self.error_stream if stream is not None and not canReadStream(stream): stderr_text = stream.read()
|
def pollStreams(self): stdin_text = '' stderr_text = '' stream = self.input_stream if stream is not None and canReadStream(stream): stdin_text = stream.read() stream = self.error_stream if stream is not None and not canReadStream(stream): stderr_text = stream.read() return (stdin_text, stderr_text)
|
|
self.processId) = spawnChild(
|
self.processId, self.pyIntpPath) = spawnChild(
|
def OnDebuggerStart(self, evt): try: wx.wxBeginBusyCursor() try: if self.server is None: # Start the subprocess. process = wx.wxProcess(self.event_handler, self.win_id) process.Redirect() self.process = process wx.EVT_END_PROCESS(self.event_handler, self.win_id, self.OnProcessEnded) (self.server, self.input_stream, self.error_stream, self.processId) = spawnChild( self, process, self.process_args) self.taskHandler.addTask(evt.GetTask()) except: t, v, tb = sys.exc_info() evt = self.createEvent(wxEVT_DEBUGGER_EXC) evt.SetExc(t, v) self.postEvent(evt) if LOG_TRACEBACKS: import traceback fn = os.path.join(os.path.dirname(__file__), 'DebugTracebacks.txt') open(fn, 'a').write(''.join(traceback.format_exception(t, v, tb))) del tb finally: wx.wxEndBusyCursor()
|
t1 = time()
|
def OnColClick(self, event):
|
|
t2 = time()
|
def OnColClick(self, event):
|
|
if winIdIdx == -1: if lst:
|
if winIdIdx == -1:
|
def writeWindowIds(self, colMeth, companions): """ Write a method's corresponding window ids to the source code """ # To integrate efficiently with Designer.SaveCtrls this method # modifies module.source but doesn't refresh anything
|
anchor = not event.Checked() if wxPlatform == '__WXGTK__': anchor = not anchor self.updateCtrlAnchors(anchor)
|
self.updateCtrlAnchors(Utils.getEventChecked(event))
|
def OnAnchorToggle(self, event): anchor = not event.Checked()
|
Utils.ListCtrlLabelEditFixEH(self)
|
def __init__(self, parent, filepath, pos=wxDefaultPosition, size=wxDefaultSize, updateNotify=None, style=0, menuFunc=None): wxListCtrl.__init__(self, parent, wxID_PFL, pos=pos, size=size, style=wxLC_LIST | wxLC_EDIT_LABELS | wxCLIP_CHILDREN | style) Utils.ListCtrlSelectionManagerMix.__init__(self)
|
|
if not dont_pop: self.PopEventHandler(true)
|
def destroy(self, dont_pop=0): if self._destr: return
|
|
del self.controllers del self.list del self.editor
|
self.controllers = None self.list = None self.editor = None
|
def destroy(self): self.modimages = None self.list.Enable(false) self.list.destroy() self.tree.Enable(false) self.tree.destroy() unqDct = {} for contr in self.controllers.values(): unqDct[contr] = None for contr in unqDct.keys(): contr.destroy() del self.controllers del self.list del self.editor
|
combo.SetAcceleratorTable(wxAcceleratorTable([(0, WXK_RETURN, wId)]))
|
def bindComboEvts(self, combo, returnEvtMeth, comboEvtMeth, rdclickEvtMeth): wId = wxNewId() EVT_MENU(self, wId, returnEvtMeth) EVT_COMBOBOX(combo, combo.GetId(), comboEvtMeth) combo.SetAcceleratorTable(wxAcceleratorTable([(0, WXK_RETURN, wId)])) EVT_RIGHT_DCLICK(combo, rdclickEvtMeth) combo.SetToolTipString('Select or press Enter to change, right double-click \n'\ 'the drop down button to select Common definition (if applicable)')
|
|
if val is not None:
|
if val is None:
|
def editColTCProp(self, colCb, colBtn, prop, val=None): if val is not None: colStr = colCb.GetValue() else: colStr = val if colStr: col = strToCol(colStr%self.commonDefs) if self.editProp(colStr!='', prop, colStr): if colStr: colBtn.SetForegroundColour(wxColour(0, 0, 0)) colBtn.SetBackgroundColour(col) else: colBtn.SetForegroundColour(wxColour(255, 255, 255)) colBtn.SetBackgroundColour(\ wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE))
|
newButton.SetBitmapLabel(bmp, false)
|
try: newButton.SetBitmapLabel(bmp, false) except TypeError: newButton.SetBitmapLabel(bmp)
|
def addButton(self, widgetName, wxClass, constrClass, clickEvt, hintFunc, hintLeaveFunc, btnType): mID = wxNewId()
|
return {'Value': 'vange', 'MinValue': 'minValue', 'MaxValue': 'maxValue',
|
return {'Value': 'value', 'MinValue': 'minValue', 'MaxValue': 'maxValue',
|
def constructor(self): return {'Value': 'vange', 'MinValue': 'minValue', 'MaxValue': 'maxValue', 'Position': 'point', 'Size': 'size', 'Style': 'style', 'Validator': 'validator', 'Name': 'name'}
|
'IsToggle': 'toggle',
|
'IsToggle': 'isToggle',
|
def constructor(self): return {'Id': 'id', 'Bitmap': 'bitmap', 'PushedBitmap': 'pushedBitmap', 'IsToggle': 'toggle',
|
def __init__(self, parent, message = 'Choose a file', defaultDir = '.', defaultFile = '', style = wxOPEN, wildcard = '*.py; *.txt', pos = wxDefaultPosition):
|
def __init__(self, parent, message = 'Choose a file', defaultDir = '.', defaultFile = '', wildcard = '*.py; *.txt', style = wxOPEN, pos = wxDefaultPosition):
|
def __init__(self, parent, message = 'Choose a file', defaultDir = '.', defaultFile = '', style = wxOPEN, wildcard = '*.py; *.txt', pos = wxDefaultPosition): self._init_ctrls(parent) self.SetStyle(style) self.SetWildcard(wildcard)
|
[wxID_PROCESSPROGRESSDLGERRORTCTRL, wxID_PROCESSPROGRESSDLGSPLITTERWINDOW1, wxID_PROCESSPROGRESSDLGSTATUSSTXT, wxID_PROCESSPROGRESSDLGCMDSTXT, wxID_PROCESSPROGRESSDLGOUTPUTTCTRL, wxID_PROCESSPROGRESSDLGSTATUSGGE, wxID_PROCESSPROGRESSDLGCANCELBTN, wxID_PROCESSPROGRESSDLG] = map(lambda _init_ctrls: wxNewId(), range(8))
|
[wxID_PROCESSPROGRESSDLG, wxID_PROCESSPROGRESSDLGCANCELBTN, wxID_PROCESSPROGRESSDLGCMDSTXT, wxID_PROCESSPROGRESSDLGERRORTCTRL, wxID_PROCESSPROGRESSDLGOUTPUTTCTRL, wxID_PROCESSPROGRESSDLGSPLITTERWINDOW1, wxID_PROCESSPROGRESSDLGSTATUSGGE, wxID_PROCESSPROGRESSDLGSTATUSSTXT, ] = map(lambda _init_ctrls: wxNewId(), range(8))
|
def __init__(self): wxEvtHandler.__init__(self) ProcessRunnerMix.__init__(self)
|
wxDialog.__init__(self, size = wxSize(384, 363), id = wxID_PROCESSPROGRESSDLG, title = self.dlg_caption, parent = prnt, name = 'ProcessProgressDlg', style = wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE, pos = wxPoint(313, 215))
|
wxDialog.__init__(self, id=wxID_PROCESSPROGRESSDLG, name='ProcessProgressDlg', parent=prnt, pos=wxPoint(313, 215), size=wxSize(384, 363), style=wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE, title=self.dlg_caption)
|
def _init_ctrls(self, prnt): wxDialog.__init__(self, size = wxSize(384, 363), id = wxID_PROCESSPROGRESSDLG, title = self.dlg_caption, parent = prnt, name = 'ProcessProgressDlg', style = wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE, pos = wxPoint(313, 215)) self._init_utils() self.SetAutoLayout(true) EVT_CLOSE(self, self.OnProcessprogressdlgClose)
|
self.cancelBtn = wxButton(label = 'Cancel', id = wxID_PROCESSPROGRESSDLGCANCELBTN, parent = self, name = 'cancelBtn', size = wxSize(80, 24), style = 0, pos = wxPoint(288, 304)) self.cancelBtn.SetConstraints(LayoutAnchors(self.cancelBtn, false, false, true, true)) EVT_BUTTON(self.cancelBtn, wxID_PROCESSPROGRESSDLGCANCELBTN, self.OnCancelbtnButton) self.cmdStxt = wxStaticText(label = 'staticText1', id = wxID_PROCESSPROGRESSDLGCMDSTXT, parent = self, name = 'cmdStxt', size = wxSize(360, 64), style = wxST_NO_AUTORESIZE, pos = wxPoint(8, 8)) self.cmdStxt.SetConstraints(LayoutAnchors(self.cmdStxt, true, true, true, false)) self.splitterWindow1 = wxSplitterWindow(size = wxSize(360, 192), parent = self, id = wxID_PROCESSPROGRESSDLGSPLITTERWINDOW1, name = 'splitterWindow1', style = wxSP_3DSASH | wxSP_FULLSASH, point = wxPoint(8, 80)) self.splitterWindow1.SetConstraints(LayoutAnchors(self.splitterWindow1, true, true, true, true)) self.errorTctrl = wxTextCtrl(size = wxSize(356, 78), value = '', pos = wxPoint(2, 2), parent = self.splitterWindow1, name = 'errorTctrl', style = wxTE_MULTILINE | wxTE_RICH, id = wxID_PROCESSPROGRESSDLGERRORTCTRL)
|
self.cancelBtn = wxButton(id=wxID_PROCESSPROGRESSDLGCANCELBTN, label='Cancel', name='cancelBtn', parent=self, pos=wxPoint(288, 304), size=wxSize(80, 24), style=0) self.cancelBtn.SetConstraints(LayoutAnchors(self.cancelBtn, false, false, true, true)) EVT_BUTTON(self.cancelBtn, wxID_PROCESSPROGRESSDLGCANCELBTN, self.OnCancelbtnButton) self.cmdStxt = wxStaticText(id=wxID_PROCESSPROGRESSDLGCMDSTXT, label='staticText1', name='cmdStxt', parent=self, pos=wxPoint(8, 8), size=wxSize(360, 64), style=wxST_NO_AUTORESIZE) self.cmdStxt.SetConstraints(LayoutAnchors(self.cmdStxt, true, true, true, false)) self.splitterWindow1 = wxSplitterWindow(id=wxID_PROCESSPROGRESSDLGSPLITTERWINDOW1, name='splitterWindow1', parent=self, point=wxPoint(8, 80), size=wxSize(360, 192), style=wxSP_3DSASH | wxSP_FULLSASH) self.splitterWindow1.SetConstraints(LayoutAnchors(self.splitterWindow1, true, true, true, true)) self.errorTctrl = wxTextCtrl(id=wxID_PROCESSPROGRESSDLGERRORTCTRL, name='errorTctrl', parent=self.splitterWindow1, pos=wxPoint(0, 0), size=wxSize(360, 80), style=wxTE_MULTILINE | wxTE_RICH, value='')
|
def _init_ctrls(self, prnt): wxDialog.__init__(self, size = wxSize(384, 363), id = wxID_PROCESSPROGRESSDLG, title = self.dlg_caption, parent = prnt, name = 'ProcessProgressDlg', style = wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE, pos = wxPoint(313, 215)) self._init_utils() self.SetAutoLayout(true) EVT_CLOSE(self, self.OnProcessprogressdlgClose)
|
self.outputTctrl = wxTextCtrl(size = wxSize(356, 103), value = '', pos = wxPoint(2, 87), parent = self.splitterWindow1, name = 'outputTctrl', style = wxTE_MULTILINE | wxTE_RICH, id = wxID_PROCESSPROGRESSDLGOUTPUTTCTRL) self.splitterWindow1.SplitHorizontally(self.errorTctrl, self.outputTctrl, 80) self.statusStxt = wxStaticText(label = 'staticText1', id = wxID_PROCESSPROGRESSDLGSTATUSSTXT, parent = self, name = 'statusStxt', size = wxSize(248, 16), style = 0, pos = wxPoint(8, 288)) self.statusStxt.SetConstraints(LayoutAnchors(self.statusStxt, true, false, true, true)) self.statusGge = wxGauge(size = wxSize(184, 16), id = wxID_PROCESSPROGRESSDLGSTATUSGGE, style = wxGA_HORIZONTAL, parent = self, name = 'statusGge', validator = wxDefaultValidator, range = 100, pos = wxPoint(8, 312)) self.statusGge.SetConstraints(LayoutAnchors(self.statusGge, true, false, true, true))
|
self.outputTctrl = wxTextCtrl(id=wxID_PROCESSPROGRESSDLGOUTPUTTCTRL, name='outputTctrl', parent=self.splitterWindow1, pos=wxPoint(0, 87), size=wxSize(360, 105), style=wxTE_MULTILINE | wxTE_RICH, value='') self.splitterWindow1.SplitHorizontally(self.errorTctrl, self.outputTctrl, 80) self.statusStxt = wxStaticText(id=wxID_PROCESSPROGRESSDLGSTATUSSTXT, label='staticText1', name='statusStxt', parent=self, pos=wxPoint(8, 288), size=wxSize(248, 16), style=0) self.statusStxt.SetConstraints(LayoutAnchors(self.statusStxt, true, false, true, true)) self.statusGge = wxGauge(id=wxID_PROCESSPROGRESSDLGSTATUSGGE, name='statusGge', parent=self, pos=wxPoint(8, 312), range=100, size=wxSize(184, 16), style=wxGA_HORIZONTAL, validator=wxDefaultValidator) self.statusGge.SetConstraints(LayoutAnchors(self.statusGge, true, false, true, true))
|
def _init_ctrls(self, prnt): wxDialog.__init__(self, size = wxSize(384, 363), id = wxID_PROCESSPROGRESSDLG, title = self.dlg_caption, parent = prnt, name = 'ProcessProgressDlg', style = wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE, pos = wxPoint(313, 215)) self._init_utils() self.SetAutoLayout(true) EVT_CLOSE(self, self.OnProcessprogressdlgClose)
|
if v > 100:
|
if v >= 100:
|
def OnIdle(self, event=None): # step the gauge to indicate activity if not self.finished: v = self.statusGge.GetValue() if v > 100: v = 0 else: v = v + 1 self.statusGge.SetValue(v)
|
dlg = ProcessProgressDlg(None, 'cvs status Boa.py', 'Test', modal, autoClose=false)
|
dlg = ProcessProgressDlg(None, 'cvs -H status', 'Test', modal, autoClose=false)
|
def OnCancelbtnButton(self, event): if not self.finished: self.detach() self.prepareResult() if self.modally: self.EndModal(wxCANCEL) else: self.EndModal(wxOK)
|
print dlg.errors, dlg.output
|
def OnCancelbtnButton(self, event): if not self.finished: self.detach() self.prepareResult() if self.modally: self.EndModal(wxCANCEL) else: self.EndModal(wxOK)
|
|
'"%s" setup.py %s'%(`Preferences.pythonInterpreterPath`[1:-1], cmd),
|
'"%s" setup.py %s'%(`Preferences.getPythonInterpreterPath()`[1:-1], cmd),
|
def runDistUtilsCmd(self, cmd): model = self.getModel() if not model.savedAs: wxLogError('Cannot run distutils on an unsaved module') return
|
from Explorers import FileExplorer
|
from Explorers import ExplorerNodes, FileExplorer
|
def OnSetupPy2Exe(self, event): self.runDistUtilsCmd('py2exe')
|
EditorHelper.editorToolsReg.append( ('Attach to debugger', ToolsOnAttachToDebugger) )
|
class SysPathNode(ExplorerNodes.ExplorerNode): protocol = 'sys.path' def __init__(self, clipboard, parent, bookmarks): ExplorerNodes.ExplorerNode.__init__(self, 'sys.path', '', clipboard, EditorHelper.imgPathFolder, parent) self.bookmarks = bookmarks self.bold = true self.vetoSort = true def isFolderish(self): return true def createChildNode(self, shpth, pth): return FileExplorer.FileSysNode(shpth, pth, self.clipboard, EditorHelper.imgPathFolder, self, self.bookmarks) def refresh(self): self.entries = [] pythonDir = os.path.dirname(sys.executable) for pth in sys.path: pth = os.path.abspath(pth) shortPath = pth if pth: if pth[0:len(pythonDir)] == pythonDir: shortPath = pth[len(pythonDir):] if not shortPath: shortPath = '<Python root>' self.entries.append( (shortPath, pth) ) def openList(self): self.refresh() res = [] for short, entry in self.entries: res.append(self.createChildNode(short, entry)) return res ExplorerNodes.register(SysPathNode, clipboard='file', controller='file', root=True) EditorHelper.editorToolsReg.append( ('Attach to debugger', ToolsOnAttachToDebugger, 'Images/Shared/Debugger.png') )
|
def isPackage(filename): return os.path.exists(os.path.join(filename, PythonEditorModels.PackageModel.pckgIdnt))
|
raise Exception, 'Unable to decode unicode string, please change '\
|
raise Exception, 'Unable to encode unicode string, please change '\
|
def stringFromControl(u): try: wxUSE_UNICODE, UnicodeError except NameError: return u if wxUSE_UNICODE: try: return str(u) except UnicodeError, err: raise Exception, 'Unable to decode unicode string, please change '\ 'the defaultencoding in sitecustomize.py to handle this '\ 'encoding.\nError message %s'%str(err) else: return u
|
raise Exception, 'Unable to encode unicode string, please change '\
|
raise Exception, 'Unable to decode unicode string, please change '\
|
def stringToControl(s): try: wxUSE_UNICODE, UnicodeError except NameError: return s if wxUSE_UNICODE: try: return unicode(s) except UnicodeError, err: raise Exception, 'Unable to encode unicode string, please change '\ 'the defaultencoding in sitecustomize.py to handle this '\ 'encoding.\n Error message %s'%str(err) else: return s
|
self.value = (value != 0)
|
self.value = operator.truth(value)
|
def __init__(self, value = 0): self.value = (value != 0)
|
def boolean(value, truefalse=(False, True)): """Convert any Python value to XML-RPC 'boolean'.""" return truefalse[operator.truth(value)]
|
def __nonzero__(self): return self.value
|
|
def __init__(self, value = 0): t = type(value) if t is not StringType: if t is not TupleType:
|
def __init__(self, value=0): if not isinstance(value, StringType): if not isinstance(value, TupleType): if value == 0: value = time.time()
|
def __nonzero__(self): return self.value
|
self.parser = None
|
self.parser = self.feed = None def handle_proc(self, tag, attr): import re m = re.search("encoding\s*=\s*['\"]([^\"']+)[\"']", attr) if m: self.handle_xml(m.group(1), 1)
|
def close(self): try: self.parser.close() finally: self.parser = None # nuke circular reference
|
xmllib.XMLParser.__init__(self)
|
try: xmllib.XMLParser.__init__(self, accept_utf8=1) except TypeError: xmllib.XMLParser.__init__(self)
|
def __init__(self, target): self.unknown_starttag = target.start self.handle_data = target.data self.unknown_endtag = target.end xmllib.XMLParser.__init__(self)
|
def __init__(self):
|
def __init__(self, encoding=None):
|
def __init__(self): self.memo = {} self.data = None
|
def container(self, value):
|
if unicode: def dump_unicode(self, value, escape=escape): value = value.encode(self.encoding) self.write("<value><string>%s</string></value>\n" % escape(value)) dispatch[UnicodeType] = dump_unicode def opencontainer(self, value):
|
def container(self, value): if value: i = id(value) if self.memo.has_key(i): raise TypeError, "cannot marshal recursive data structures" self.memo[i] = None
|
def end_string(self, join=string.join): self.append(join(self._data, ""))
|
def end_string(self, data): if self._encoding: data = _decode(data, self._encoding) self.append(_stringify(data))
|
def end_string(self, join=string.join): self.append(join(self._data, "")) self._value = 0
|
def end_methodName(self, join=string.join): self._methodname = join(self._data, "")
|
def end_methodName(self, data): if self._encoding: data = _decode(data, self._encoding) self._methodname = data self._type = "methodName"
|
def end_methodName(self, join=string.join): self._methodname = join(self._data, "")
|
target = Unmarshaller() if FastParser: return FastParser(target), target return SlowParser(target), target def dumps(params, methodname=None, methodresponse=None): assert type(params) == TupleType or isinstance(params, Fault),\
|
if FastParser and FastUnmarshaller: target = FastUnmarshaller(True, False, binary, datetime) parser = FastParser(target) else: target = Unmarshaller() if FastParser: parser = FastParser(target) elif SgmlopParser: parser = SgmlopParser(target) elif ExpatParser: parser = ExpatParser(target) else: parser = SlowParser(target) return parser, target def dumps(params, methodname=None, methodresponse=None, encoding=None): """data [,options] -> marshalled data Convert an argument tuple or a Fault instance to an XML-RPC request (or response, if the methodresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet. If this option is used with a tuple, the tuple must be a singleton (i.e. it can contain only one element). encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, where necessary. """ assert isinstance(params, TupleType) or isinstance(params, Fault),\
|
def getparser(): # get the fastest available parser, and attach it to an # unmarshalling object. return both objects. target = Unmarshaller() if FastParser: return FastParser(target), target return SlowParser(target), target
|
m = Marshaller()
|
if isinstance(params, Fault): methodresponse = 1 elif methodresponse and isinstance(params, TupleType): assert len(params) == 1, "response tuple must be a singleton" if not encoding: encoding = "utf-8" m = Marshaller(encoding)
|
def dumps(params, methodname=None, methodresponse=None): # convert a tuple or a fault object to an XML-RPC packet assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" m = Marshaller() data = m.dumps(params) # standard XML-RPC wrappings if methodname: # a method call data = ( "<?xml version='1.0'?>\n" "<methodCall>\n" "<methodName>%s</methodName>\n" "%s\n" "</methodCall>\n" % (methodname, data) ) elif methodresponse or isinstance(params, Fault): # a method response data = ( "<?xml version='1.0'?>\n" "<methodResponse>\n" "%s\n" "</methodResponse>\n" % data ) return data
|
"<?xml version='1.0'?>\n"
|
xmlheader,
|
def dumps(params, methodname=None, methodresponse=None): # convert a tuple or a fault object to an XML-RPC packet assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" m = Marshaller() data = m.dumps(params) # standard XML-RPC wrappings if methodname: # a method call data = ( "<?xml version='1.0'?>\n" "<methodCall>\n" "<methodName>%s</methodName>\n" "%s\n" "</methodCall>\n" % (methodname, data) ) elif methodresponse or isinstance(params, Fault): # a method response data = ( "<?xml version='1.0'?>\n" "<methodResponse>\n" "%s\n" "</methodResponse>\n" % data ) return data
|
"<methodName>%s</methodName>\n" "%s\n" "</methodCall>\n" % (methodname, data)
|
"<methodName>", methodname, "</methodName>\n", data, "</methodCall>\n"
|
def dumps(params, methodname=None, methodresponse=None): # convert a tuple or a fault object to an XML-RPC packet assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" m = Marshaller() data = m.dumps(params) # standard XML-RPC wrappings if methodname: # a method call data = ( "<?xml version='1.0'?>\n" "<methodCall>\n" "<methodName>%s</methodName>\n" "%s\n" "</methodCall>\n" % (methodname, data) ) elif methodresponse or isinstance(params, Fault): # a method response data = ( "<?xml version='1.0'?>\n" "<methodResponse>\n" "%s\n" "</methodResponse>\n" % data ) return data
|
elif methodresponse or isinstance(params, Fault):
|
elif methodresponse:
|
def dumps(params, methodname=None, methodresponse=None): # convert a tuple or a fault object to an XML-RPC packet assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" m = Marshaller() data = m.dumps(params) # standard XML-RPC wrappings if methodname: # a method call data = ( "<?xml version='1.0'?>\n" "<methodCall>\n" "<methodName>%s</methodName>\n" "%s\n" "</methodCall>\n" % (methodname, data) ) elif methodresponse or isinstance(params, Fault): # a method response data = ( "<?xml version='1.0'?>\n" "<methodResponse>\n" "%s\n" "</methodResponse>\n" % data ) return data
|
"<?xml version='1.0'?>\n" "<methodResponse>\n" "%s\n" "</methodResponse>\n" % data
|
xmlheader, "<methodResponse>\n", data, "</methodResponse>\n"
|
def dumps(params, methodname=None, methodresponse=None): # convert a tuple or a fault object to an XML-RPC packet assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" m = Marshaller() data = m.dumps(params) # standard XML-RPC wrappings if methodname: # a method call data = ( "<?xml version='1.0'?>\n" "<methodCall>\n" "<methodName>%s</methodName>\n" "%s\n" "</methodCall>\n" % (methodname, data) ) elif methodresponse or isinstance(params, Fault): # a method response data = ( "<?xml version='1.0'?>\n" "<methodResponse>\n" "%s\n" "</methodResponse>\n" % data ) return data
|
return data
|
else: return data return string.join(data, "")
|
def dumps(params, methodname=None, methodresponse=None): # convert a tuple or a fault object to an XML-RPC packet assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" m = Marshaller() data = m.dumps(params) # standard XML-RPC wrappings if methodname: # a method call data = ( "<?xml version='1.0'?>\n" "<methodCall>\n" "<methodName>%s</methodName>\n" "%s\n" "</methodCall>\n" % (methodname, data) ) elif methodresponse or isinstance(params, Fault): # a method response data = ( "<?xml version='1.0'?>\n" "<methodResponse>\n" "%s\n" "</methodResponse>\n" % data ) return data
|
def request(self, host, handler, request_body):
|
verbose = 0 def request(self, host, handler, request_body, verbose=0):
|
def __call__(self, *args): return self.__send(self.__name, args)
|
import httplib h = httplib.HTTP(host) h.putrequest("POST", handler) h.putheader("Host", host) h.putheader("User-Agent", self.user_agent) h.putheader("Content-Type", "text/xml") h.putheader("Content-Length", str(len(request_body))) h.endheaders() if request_body: h.send(request_body)
|
h = self.make_connection(host) if verbose: h.set_debuglevel(1) self.send_request(h, handler, request_body) self.send_host(h, host) self.send_user_agent(h) self.send_content(h, request_body)
|
def request(self, host, handler, request_body): # issue XML-RPC request
|
return self.parse_response(h.getfile()) def parse_response(self, f):
|
self.verbose = verbose return self.parse_response(h.getfile(), h._conn.sock) def getparser(self): return getparser() def make_connection(self, host): import httplib return httplib.HTTP(host) def send_request(self, connection, handler, request_body): connection.putrequest("POST", handler) def send_host(self, connection, host): connection.putheader("Host", host) def send_user_agent(self, connection): connection.putheader("User-Agent", self.user_agent) def send_content(self, connection, request_body): connection.putheader("Content-Type", "text/xml") connection.putheader("Content-Length", str(len(request_body))) connection.endheaders() if request_body: connection.send(request_body) def parse_response(self, f, sock=None):
|
def request(self, host, handler, request_body): # issue XML-RPC request
|
response = f.read(1024)
|
if sock: response = sock.recv(1024) else: response = f.read(1024)
|
def parse_response(self, f): # read response from input file, and parse it
|
class Server: """Represents a connection to an XML-RPC server""" def __init__(self, uri, transport=None):
|
class SafeTransport(Transport): """Handles an HTTPS transaction to an XML-RPC server.""" def make_connection(self, host): import httplib if isinstance(host, TupleType): host, x509 = host else: x509 = {} try: HTTPS = httplib.HTTPS except AttributeError: raise NotImplementedError,\ "your version of httplib doesn't support HTTPS" else: return apply(HTTPS, (host, None), x509) def send_host(self, connection, host): if isinstance(host, TupleType): host, x509 = host connection.putheader("Host", host) class ServerProxy: """uri [,options] -> a logical connection to an XML-RPC server uri is the connection point on the server, given as scheme://host/target. The standard implementation always supports the "http" scheme. If SSL socket support is available (Python 2.0), it also supports "https". If the target part and the slash preceding it are both omitted, "/RPC2" is assumed. The following options can be given as keyword arguments: transport: a transport factory encoding: the request encoding (default is UTF-8) All 8-bit strings passed to the server proxy are assumed to use the given encoding. """ def __init__(self, uri, transport=None, encoding=None, verbose=0):
|
def parse_response(self, f): # read response from input file, and parse it
|
if type != "http":
|
if type not in ("http", "https"):
|
def __init__(self, uri, transport=None): # establish a "logical" server connection
|
transport = Transport()
|
if type == "https": transport = SafeTransport() else: transport = Transport()
|
def __init__(self, uri, transport=None): # establish a "logical" server connection
|
request = dumps(params, methodname)
|
request = dumps(params, methodname, encoding=self.__encoding)
|
def __request(self, methodname, params): # call a method on the remote server
|
return response[0]
|
response = response[0]
|
def __request(self, methodname, params): # call a method on the remote server
|
namedGrpVals = {} for name, val in mo.groupdict().items(): namedGrpVals[val] = name grps = [] for idx, grp in zip(range(1, len(mo.groups())+1), mo.groups()): name = namedGrpVals.get(grp, '')
|
namedGroups = [] for name, idx in ro.groupindex.items(): namedGroups += [(idx, name, mo.group(name))] namedGroups.sort() for idx, name, group in namedGroups:
|
def OnUpdate(self, event): string = self.txtString.GetValue() regex = self.txtRegex.GetValue()
|
self.lcGroups.SetStringItem(idx-1, 2, str(grp))
|
self.lcGroups.SetStringItem(idx-1, 2, group)
|
def OnUpdate(self, event): string = self.txtString.GetValue() regex = self.txtRegex.GetValue()
|
except: pass
|
except Exception, message: print str(message)
|
def parseMixedBody(parseClasses, lines): """ Return a dictionary with keys representing classes that 'understood' the line and values a list of found instances of the found class """ cat = {} for parseClass in parseClasses: cat[parseClass] = [] for line in lines: ln = string.strip(line) if (ln == 'pass') or (ln == ''): continue for parseClass in parseClasses: try: res = parseClass(ln).value() except: pass else: if res: cat[parseClass].append(res)
|
param = self.params[idx] if Utils.startswith(param, 'self.'+coll_init): nameEnd = string.rfind(param, '_') name = param[16:nameEnd] if name == old_value: self.params[idx] = 'self.'+coll_init+new_value+param[nameEnd:]
|
def renameCompName2(self, old_value, new_value): # XXX This is ugly but has to do until a better # XXX strategy is conceived. # Rename references to ctrl in string of property param oldCtrlSrcRef = Utils.srcRefFromCtrlName(old_value) newCtrlSrcRef = Utils.srcRefFromCtrlName(new_value) for idx in range(len(self.params)): segs = string.split(self.params[idx], oldCtrlSrcRef) #lst = () if len(segs) > 1: lst = [segs[0]] for s in segs[1:]: if s and s[0] in string.letters+string.digits+'_': lst[-1] = lst[-1] + s else: lst.append(s) self.params[idx] = string.join(lst, newCtrlSrcRef)
|
|
coll_init = '_init_coll_'
|
def asText(self): return '%s.%s(%s)' %(Utils.srcRefFromCtrlName(self.comp_name), self.prop_setter, string.join(self.params, ', '))
|
|
print 'CollectionItemInitParse.rename', old_value, new_value
|
def renameCompName2(self, old_value, new_value):
|
|
print 'renamed ref'
|
def renameCompName2(self, old_value, new_value):
|
|
if hasattr(s, '_sub_sizer'):
|
if s in sizerParents or \ hasattr(s, '_sub_sizer') or hasattr(s, '_has_control'):
|
def getObjects(self): sizers = self.companion.designer.getObjectsOfClass(wxSizerPtr) for n, s in sizers.items(): if hasattr(s, '_sub_sizer'): del sizers[n] sizerNames = sizers.keys() sizerNames.sort()
|
'Height': IntConstrPropEdit
|
'Height': IntConstrPropEdit,
|
def __init__(self, name, designer, parentCompanion, ctrl): CollectionDTC.__init__(self, name, designer, parentCompanion, ctrl) self.editors = {'Window': SizerWinEnumConstrPropEdit, 'Sizer': SizerEnumConstrPropEdit, 'Proportion': IntConstrPropEdit, 'Flag': SizerFlagsConstrPropEdit, 'Border': IntConstrPropEdit, 'Width': IntConstrPropEdit, 'Height': IntConstrPropEdit } self.windowStyles = ['wxLEFT', 'wxRIGHT', 'wxTOP', 'wxBOTTOM', 'wxALL', 'wxSHRINK', 'wxGROW', 'wxEXPAND', 'wxSHAPED', 'wxALIGN_LEFT', 'wxALIGN_CENTER_HORIZONTAL', 'wxALIGN_RIGHT', 'wxALIGN_BOTTOM', 'wxALIGN_CENTER_VERTICAL', 'wxALIGN_TOP', 'wxALIGN_CENTER', 'wxADJUST_MINSIZE']
|
def defaultAction(self): constr = self.textConstrLst[self.index] if constr.method == 'AddWindow': if constr.params[0] != 'None': name = Utils.ctrlNameFromSrcRef(constr.params[0]) designer = self.designer.controllerView compn, ctrl = designer.objects[name][:2] designer.inspector.selectObject(compn, true) designer.Raise() designer.selection.selectCtrl(ctrl, compn) wxCallAfter(designer.SetFocus) return true elif constr.method == 'AddSizer': if constr.params[0] != 'None': name = Utils.ctrlNameFromSrcRef(constr.params[0]) compn = self.designer.objects[name][0] self.designer.inspector.selectObject(compn, true) self.designer.selectCtrls([name]) wxCallAfter(self.designer.SetFocus) return true
|
## def defaultAction(self):
|
|
wxCallAfter(self.designer.collEditors[colEdKey].refreshCtrl, 1)
|
collEditView = self.designer.collEditors[colEdKey] wxCallAfter(self.setWindowRefresh, collEditView) def setWindowRefresh(self, collEditView): collEditView.refreshCtrl(1) collEditView.selectObject(self.index) if collEditView.frame: collEditView.frame.selectObject(self.index)
|
def SetWindow(self, value): self.setParamAndUpdate(0, value) colEdKey = (self.parentCompanion.name, 'Items') if self.designer.collEditors.has_key(colEdKey): wxCallAfter(self.designer.collEditors[colEdKey].refreshCtrl, 1)
|
def getSizerRefreshProps(self): return ('Width', 'Height', 'Flag', 'Border', 'Proportion')
|
def getSizerRefreshProps(self): return ('Width', 'Height', 'Flag', 'Border', 'Proportion')
|
|
if name in self.getSizerRefreshProps():
|
if name in ('Width', 'Height'):
|
def persistProp(self, name, setterName, value): CollectionDTC.persistProp(self, name, setterName, value) if name in self.getSizerRefreshProps(): self.recreateSizers()
|
'The generated source will be invalid outside the Designer' ' and should be fixed before executing.')
|
'The generated source will be invalid outside the ' 'Designer and should be fixed before executing.')
|
def writeCollectionItems(self, output, stripFrmId=''): CollectionDTC.writeCollectionItems(self, output, stripFrmId) warn = 0 for constr in self.textConstrLst: if constr.params[0] == 'None': wxLogWarning('No control/sizer for sizer item of %s'%( self.parentCompanion.name)) warn = 1 if warn: wxLogWarning('None values are only valid in the Designer.\n' 'The generated source will be invalid outside the Designer' ' and should be fixed before executing.')
|
return {'rows': '0', 'cols': '0', 'vgap': '0', 'hgap': '0'}
|
return {'rows': '1', 'cols': '0', 'vgap': '0', 'hgap': '0'}
|
def designTimeSource(self): return {'rows': '0', 'cols': '0', 'vgap': '0', 'hgap': '0'}
|
if not numRows and not numCols: wxLogError('Rows and Cols may not both be 0') return if not numRows or not numCols: numItems = len(self.companion.designer.showCollectionEditor( self.companion.name, 'Items', false).companion.textConstrLst) else: numItems = -1
|
def edit(self, event): ce = self.companion.designer.showCollectionEditor(self.companion.name, self.name, false) growableRows, growableCols = ce.companion.getGrowables() fgsCompn = ce.companion.parentCompanion numRows = self.companion.eval(fgsCompn.textConstr.params['rows']) numCols = self.companion.eval(fgsCompn.textConstr.params['cols'])
|
|
self.editors['StaticBox'] = ReadOnlyConstrPropEdit
|
def __init__(self, name, designer, objClass): ControlLinkedSizerDTC.__init__(self, name, designer, objClass) self.editors['Orientation'] = EnumPropEdit self.names['Orientation'] = {'wxVERTICAL': wxVERTICAL, 'wxHORIZONTAL': wxHORIZONTAL} self.options['Orientation'] = [wxVERTICAL, wxHORIZONTAL] #self.editors['BoxSizer'] = WinEnumConstrPropEdit
|
|
self.editors['Notebook'] = ReadOnlyConstrPropEdit
|
def __init__(self, name, designer, objClass): ControlLinkedSizerDTC.__init__(self, name, designer, objClass) #self.editors['Notebook'] = WinEnumConstrPropEdit
|
|
key = event.KeyCode()
|
key = event.GetKeyCode()
|
def OnKeyPressed(self, event): key = event.KeyCode() if key == 13: self.OnOpen(event) else: event.Skip()
|
self.SetKeywords(0, 'and assert break class continue def del elif else except ' 'exec finally for from global if import in is lambda None ' 'not or pass print raise return try while true false') self.SetViewWhitespace(false)
|
if old_stc: self.SetKeywords(0, 'and assert break class continue def del elif else except ' 'exec finally for from global if import in is lambda None ' 'not or pass print raise return try while true false') self.SetViewWhitespace(false) else: self.SetKeyWords(0, 'and assert break class continue def del elif else except ' 'exec finally for from global if import in is lambda None ' 'not or pass print raise return try while true false') self.SetViewWhiteSpace(false)
|
def __init__(self, wId, margin): self.SetEdgeMode(wxSTC_EDGE_LINE) self.SetEdgeColumn(80)
|
charBefore = self.GetCharAt(caretPos - 1) styleBefore = self.GetStyleAt(caretPos - 1)
|
if old_stc: charBefore = self.GetCharAt(caretPos - 1) styleBefore = ord(self.GetStyleAt(caretPos - 1)) else: charBefore = chr(self.GetCharAt(caretPos - 1)) styleBefore = self.GetStyleAt(caretPos - 1)
|
def OnUpdateUI(self, evt):
|
if charBefore and charBefore in "[]{}()" and ord(styleBefore) == 10:
|
if charBefore and charBefore in "[]{}()" and styleBefore == 10:
|
def OnUpdateUI(self, evt):
|
charAfter = self.GetCharAt(caretPos) styleAfter = self.GetStyleAt(caretPos) if charAfter and charAfter in "[]{}()" and ord(styleAfter) == 10:
|
if old_stc: charAfter = self.GetCharAt(caretPos) styleAfter = ord(self.GetStyleAt(caretPos)) else: charAfter = chr(self.GetCharAt(caretPos)) styleAfter = self.GetStyleAt(caretPos) if charAfter and charAfter in "[]{}()" and styleAfter == 10:
|
def OnUpdateUI(self, evt):
|
self.styleStart = self.styleLength = 0
|
self.styleStart = 0 self.styleLength = 0
|
def __init__(self): self.handCrs = wxStockCursor(wxCURSOR_HAND) self.stndCrs = wxStockCursor(wxCURSOR_ARROW) self.IndicatorSetStyle(0, wxSTC_INDIC_PLAIN) self.IndicatorSetColour(0, wxBLUE) self.styleStart = self.styleLength = 0 self.ctrlDown = false EVT_MOTION(self, self.OnBrowseMotion) EVT_LEFT_DOWN(self, self.OnBrowseClick) EVT_KEY_DOWN(self, self.OnKeyDown) EVT_KEY_UP(self, self.OnKeyUp)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.