rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def ChangeStatusBar(self, oldValue, newValue): pass
def GetStatusBar(self, x): return self.control.GetStatusBar() def SetStatusBar(self, value): self.control.SetStatusBar(value) if value: self.control.SendSizeEvent()
def ChangeStatusBar(self, oldValue, newValue): pass # XXX Cannot refresh designer because statusbar not yet connected
'StatusBar', 'Icon']
'StatusBar', 'StatusBarPane']
def hideDesignTime(self): # Because the Designer is actually a wxFrame pretending to be a # wxDialog, introspection will pick up wxFrame spesific properties # which must be supressed return BaseFrameDTC.hideDesignTime(self) + ['ToolBar', 'MenuBar', 'StatusBar', 'Icon']
dialogLayout = true
def SetName(self, oldValue, newValue): self.name = newValue self.designer.renameFrame(oldValue, newValue)
'StatusBar', 'Icon', 'Title', 'Anchors']
'StatusBar', 'StatusBarPane', 'Icon', 'Title', 'Anchors']
def hideDesignTime(self): return BaseFrameDTC.hideDesignTime(self) + ['ToolBar', 'MenuBar', 'StatusBar', 'Icon', 'Title', 'Anchors']
for path in ctx.paths:
for path in ctx.brmctx.paths:
def checkUnsavedChanges(self): model = self.model ctx = model.editor.brm_context
except 'Cancelled':
except Editor.CancelClose:
def checkUnsavedChanges(self): model = self.model ctx = model.editor.brm_context
raise 'No text selected. Highlight the region you want to extract.'
raise CancelOperation, \ 'No text selected. Highlight the region you want to extract.'
def getExtractionInfo(self, xtype, caption): selection = self.view.GetSelectedText().strip() if not selection: raise 'No text selected. Highlight the region you want to extract.'
raise 'Empty names are invalid.'
raise CancelOperation, \ 'Empty names are invalid.'
def getExtractionInfo(self, xtype, caption): selection = self.view.GetSelectedText().strip() if not selection: raise 'No text selected. Highlight the region you want to extract.'
ctx.extractMethod(*self.getExtractionInfo('Method', 'Extract method')) self.saveAndRefresh()
try: ctx.extractMethod(*self.getExtractionInfo('Method', 'Extract method')) except CancelOperation, err: wxLogError(str(err)) else: self.view.SetSelectionEnd(self.view.GetSelectionStart()) self.saveAndRefresh()
def OnExtractMethod(self, event): if not self.checkUnsavedChanges(): return
filename, startline, startcol, endline, endcol, variablename = \ self.getExtractionInfo('Variable', 'Extract variable') ctx.extractLocalVariable(filename, startline, startcol, endline, endcol, variablename) self.saveAndRefresh()
try: filename, startline, startcol, endline, endcol, variablename = \ self.getExtractionInfo('Variable', 'Extract variable') except CancelOperation, err: wxLogError(str(err)) else: ctx.extractLocalVariable(filename, startline, startcol, endline, endcol, variablename) self.view.SetSelectionEnd(self.view.GetSelectionStar...
def OnExtractLocalVar(self, event): if not self.checkUnsavedChanges(): return ctx = self.model.editor.brm_context filename, startline, startcol, endline, endcol, variablename = \ self.getExtractionInfo('Variable', 'Extract variable') ctx.extractLocalVariable(filename, startline, startcol, endline, endcol, variablenam...
self.editor.explorer.tree)
self.editor.explorer.tree.recentFiles)
def OnOpenItems(self, event): if self.list.node: nodes = self.getNodesForSelection(self.list.getMultiSelection()) for node in nodes: if not node.isFolderish(): self.list.openNodeInEditor(node, self.editor, self.editor.explorer.tree) #node.open(self.editor)
self.list.EditLabel(self.list.selected)
def OnNewItem(self, event): if self.list.node: name = self.list.node.newItem() self.list.refreshCurrent() self.list.selectItemNamed(name) self.list.EditLabel(self.list.selected) self.OnInspectItem(event)
_x, _y, screenWidth, screenHeight = wxGetClientDisplayRect()
_x, _y, screenWidth, screenHeight = wx.GetClientDisplayRect()
def initScreenVars(): global screenWidth, screenHeight, wxDefaultFramePos, wxDefaultFrameSize global edWidth, inspWidth, paletteHeight, bottomHeight, underPalette global oglBoldFont, oglStdFont screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) if wx....
ec.SetPosition(ec.GetPosition().x, idx*Preferences.oiLineHeight -2)
ec.SetPosition( (ec.GetPosition().x, idx*Preferences.oiLineHeight -2) )
def setIdx(self, idx): """ Move the to the given index """ if self.editorCtrl: for ec in self.editorCtrl: ec.SetPosition(ec.GetPosition().x, idx*Preferences.oiLineHeight -2) BevelIEC.setIdx(self, idx)
import traceback traceback.print_exc()
if PRINT_TRACEBACKS: import traceback traceback.print_exc()
def clientThread(self): ''' Performs tasks. ''' exit_loop = 0 while not exit_loop: task = args = kw = None cond = self.cond cond.acquire() try: queue = self.queue if len(queue) < 1: if self.running_threads > self.target_threads: exit_loop = 1 self.running_threads = self.running_threads - 1 else: self.idle_threads = sel...
'size': size,
'size': self.getDefCtrlSize(),
def designTimeSource(self, position = 'wxDefaultPosition', size = 'wxDefaultSize'): return {'pos': position, 'size': size, 'style': '0', 'name': `self.name`}
'wxTB_VERTICAL', 'wxTB_3DBUTTONS'] + self.windowStyles
'wxTB_VERTICAL', 'wxTB_3DBUTTONS', 'wxTB_TEXT', 'wxTB_NOICONS', 'wxTB_NODIVIDER', 'wxTB_NOALIGN', ] + self.windowStyles
def __init__(self, name, designer, parent, ctrlClass): ContainerDTC.__init__(self, name, designer, parent, ctrlClass) self.editors.update({'Tools': CollectionPropEdit}) self.subCompanions['Tools'] = ToolBarToolsCDTC self.windowStyles = ['wxTB_FLAT', 'wxTB_DOCKABLE', 'wxTB_HORIZONTAL', 'wxTB_VERTICAL', 'wxTB_3DBUTTONS']...
displayProp = 'shortHelpString'
displayProp = 'shortHelp'
def defaultAction(self): self.designer.inspector.props.getNameValue('Tools').propEditor.edit(None)
insertionMethod = 'AddTool'
insertionMethod = 'DoAddTool'
def defaultAction(self): self.designer.inspector.props.getNameValue('Tools').propEditor.edit(None)
'AddControl': ('Add control', 'control', '(None)')}
'AddControl': ('Add control', 'control', '(None)'), 'AddTool': ('Old add tool', 'shortHelpString', '(None)') }
def defaultAction(self): self.designer.inspector.props.getNameValue('Tools').propEditor.edit(None)
'BitmapOn': BitmapConstrPropEdit,
'PushedBitmap': BitmapConstrPropEdit, 'BitmapDisabled': BitmapConstrPropEdit,
def __init__(self, name, designer, parentCompanion, ctrl): CollectionIddDTC.__init__(self, name, designer, parentCompanion, ctrl) self.editors.update({'Bitmap': BitmapConstrPropEdit, 'BitmapOn': BitmapConstrPropEdit, 'IsToggle': BoolConstrPropEdit, 'ShortHelpString': StrConstrPropEdit, 'LongHelpString': StrConstrPropEd...
if tcl.method == 'AddTool':
if tcl.method == 'DoAddTool': return {'ItemId': 'id', 'Label': 'label', 'Bitmap': 'bitmap', 'BitmapDisabled': 'bmpDisabled', 'Kind': 'kind', 'ShortHelp': 'shortHelp', 'LongHelp': 'longHelp'} elif tcl.method == 'AddTool':
def constructor(self): tcl = self.textConstrLst[self.index] if tcl.method == 'AddTool': return {'ItemId': 'id', 'Bitmap': 'bitmap', 'PushedBitmap': 'pushedBitmap', 'IsToggle': 'isToggle', 'ShortHelpString': 'shortHelpString', 'LongHelpString': 'longHelpString'} elif tcl.method == 'AddSeparator': return {} elif tcl.meth...
if method == 'AddTool':
if method == 'DoAddTool': return {'id': winId, 'label': `''`, 'bitmap': 'wxNullBitmap', 'bmpDisabled': 'wxNullBitmap', 'kind': 'wxITEM_NORMAL', 'shortHelp': `newItemName`, 'longHelp': `''`} elif method == 'AddTool':
def designTimeSource(self, wId, method=None): if method is None: method = self.insertionMethod newItemName, winId = self.newUnusedItemNames(wId)
kv = string.split(param, '=') if len(kv) == 2: result[string.strip(kv[0])] = string.strip(kv[1])
try: sidx = string.find(param, '=') except ValueError: result[`cnt`] = string.strip(param[sidx+1:])
def extractKVParams(self, paramsStr): params = safesplitfields(paramsStr, ',') result = {} cnt = 0 for param in params: kv = string.split(param, '=') if len(kv) == 2: result[string.strip(kv[0])] = string.strip(kv[1]) else: result[`cnt`] = string.strip(kv[0]) cnt = cnt + 1 return result
result[`cnt`] = string.strip(kv[0])
result[string.strip(param[:sidx])] = string.strip(param[sidx+1:])
def extractKVParams(self, paramsStr): params = safesplitfields(paramsStr, ',') result = {} cnt = 0 for param in params: kv = string.split(param, '=') if len(kv) == 2: result[string.strip(kv[0])] = string.strip(kv[1]) else: result[`cnt`] = string.strip(kv[0]) cnt = cnt + 1 return result
del self.editor
def updateNameFromTransport(self): if self.transport: self.filename = self.transport.getURI()
def destroy(self):
self.data = string.join(lines, '\012')
strlines = [] for line in lines: strlines.append(str(line)) self.data = string.join(strlines, '\012')
def setDataFromLines(self, lines): data = self.data self.data = string.join(lines, '\012') self.modified = self.modified or self.data != data
self.save()
try: self.save(overwriteNewer=true) except: self.filename = oldname raise
def saveAs(self, filename): """ Saves contents of data to file specified by filename. Override this to catch name changes. """ # Catch transport changes from Explorers.Explorer import splitURI, getTransport protO, catO, resO, uriO = splitURI(self.filename) protN, catN, resN, uriN = splitURI(filename)
self.data = ''
self.data = self.getDefaultData()
def new(self): self.data = '' self.savedAs = false self.modified = true self.update() self.notify()
self.addBreakpoint(**bkr)
self.addBreakpoint(**brk)
def setAllBreakpoints(self, brks): """brks is a list of mappings containing the keys: filename, lineno, temporary, enabled, and cond. Non-blocking.""" self.clear_all_breaks() if brks: for brk in brks: self.addBreakpoint(**bkr)
self.set_step()
def set_trace(self): """Start debugging from the caller's frame.
name, wId = self.newUnusedItemNames(0)
wId = Utils.windowIdentifier(self.designer.GetName(), self.name)
def addIds(self, lst): if self.id is not None: if self.id in EventCollections.reservedWxIds: name, wId = self.newUnusedItemNames(0) else: wId = self.id lst.append(wId)
('Compile', self.OnCompile, self.compileBmp, keyDefs['Compile']))
('Check source', self.OnCompile, self.compileBmp, keyDefs['CheckSource']))
def __init__(self, parent, model): if hasattr(model, 'app') and model.app: a2 = (('Run application', self.OnRunApp, self.runAppBmp, keyDefs['RunApp']),) else: a2 = () a1 = (('-', None, '', ()), ('Comment', self.OnComment, '-', keyDefs['Comment']), ('Uncomment', self.OnUnComment, '-', keyDefs['Uncomment']), ('Indent', s...
def getAttribs(self, cls, partial):
def getWxAttribs(self, cls, mems = None): if mems is None: mems = [] for base in cls.__bases__: self.getWxAttribs(base, mems) mems.extend(dir(cls)) return mems def getAttribs(self, cls):
def getAttribs(self, cls, partial): loopCls = cls list = [] while loopCls: list.extend(loopCls.methods.keys() + loopCls.attributes.keys()) if len(loopCls.super): prnt = loopCls.super[0] if type(prnt) == type(self): # :) loopCls = prnt else: loopCls = None else: loopCls = None
list = []
lst = []
def getAttribs(self, cls, partial): loopCls = cls list = [] while loopCls: list.extend(loopCls.methods.keys() + loopCls.attributes.keys()) if len(loopCls.super): prnt = loopCls.super[0] if type(prnt) == type(self): # :) loopCls = prnt else: loopCls = None else: loopCls = None
list.extend(loopCls.methods.keys() + loopCls.attributes.keys())
lst.extend(loopCls.methods.keys() + loopCls.attributes.keys())
def getAttribs(self, cls, partial): loopCls = cls list = [] while loopCls: list.extend(loopCls.methods.keys() + loopCls.attributes.keys()) if len(loopCls.super): prnt = loopCls.super[0] if type(prnt) == type(self): # :) loopCls = prnt else: loopCls = None else: loopCls = None
sel = '' if partial: for key in list: if key[:len(partial)] == partial: sel = key break uniqueDct = {} for attr in list: uniqueDct[attr] = None return uniqueDct.keys(), sel
return lst
def getAttribs(self, cls, partial): loopCls = cls list = [] while loopCls: list.extend(loopCls.methods.keys() + loopCls.attributes.keys()) if len(loopCls.super): prnt = loopCls.super[0] if type(prnt) == type(self): # :) loopCls = prnt else: loopCls = None else: loopCls = None
list, sel = self.getAttribs(cls, partial)
lst = self.getAttribs(cls) else: prevdot = string.rfind(line, '.', 0, dot) if prevdot != -1 and line[prevdot-4:prevdot] == 'self': partial = line[dot+1:piv] attrib = line[prevdot+1:dot] if cls.attributes.has_key(attrib): objtype = cls.attributes[attrib][0].signature if self.typeMap.has_key(objtype): lst = self.typeMa...
def checkCodeComp(self): pos = self.GetCurrentPos() lnNo = self.GetCurrentLine() lnStPs = self.GetLineStartPos(lnNo) line = self.GetCurrentLineText()[0] piv = pos - lnStPs start, length = idWord(line, piv, lnStPs) startLine = start-lnStPs word = line[startLine:startLine+length]
self.AutoCompShow(string.join(list, ' '))
self.AutoCompShow(string.join(lst, ' '))
def checkCodeComp(self): pos = self.GetCurrentPos() lnNo = self.GetCurrentLine() lnStPs = self.GetLineStartPos(lnNo) line = self.GetCurrentLineText()[0] piv = pos - lnStPs start, length = idWord(line, piv, lnStPs) startLine = start-lnStPs word = line[startLine:startLine+length]
self.AutoCompShow(len(partial), string.join(list, ' ')) if sel: if new_stc: print 'auto selecting', partial, sel
self.AutoCompShow(len(partial), string.join(lst, ' ')) if partial and new_stc:
def checkCodeComp(self): pos = self.GetCurrentPos() lnNo = self.GetCurrentLine() lnStPs = self.GetLineStartPos(lnNo) line = self.GetCurrentLineText()[0] piv = pos - lnStPs start, length = idWord(line, piv, lnStPs) startLine = start-lnStPs word = line[startLine:startLine+length]
self.AutoCompSelect(partial)
if partial and new_stc: self.AutoCompSelect(partial)
def checkCodeComp(self): pos = self.GetCurrentPos() lnNo = self.GetCurrentLine() lnStPs = self.GetLineStartPos(lnNo) line = self.GetCurrentLineText()[0] piv = pos - lnStPs start, length = idWord(line, piv, lnStPs) startLine = start-lnStPs word = line[startLine:startLine+length]
if line[start-5: start] == 'self.':
if self.model.editor.debugger: self.model.editor.debugger.add_watch(word, true) elif line[start-5: start] == 'self.':
def BrowseClick(self, word, line, lineNo, start, style): """ Overridden from BrowseStyledTextCtrlMix, jumps to declaration or opens module Currently only the open module is inspected, classes declared outside the scope of the active module are inaccessible. """ module = self.model.getModule() if line[start-5: start] =...
self.GotoLine(cls.attributes[word][0].start-1)
gotoLine = cls.attributes[word][0].start-1
def BrowseClick(self, word, line, lineNo, start, style): """ Overridden from BrowseStyledTextCtrlMix, jumps to declaration or opens module Currently only the open module is inspected, classes declared outside the scope of the active module are inaccessible. """ module = self.model.getModule() if line[start-5: start] =...
self.GotoLine(cls.methods[word].start-1)
gotoLine = cls.methods[word].start-1
def BrowseClick(self, word, line, lineNo, start, style): """ Overridden from BrowseStyledTextCtrlMix, jumps to declaration or opens module Currently only the open module is inspected, classes declared outside the scope of the active module are inaccessible. """ module = self.model.getModule() if line[start-5: start] =...
self.GotoLine(block[0].start-1)
gotoLine = block[0].start-1
def BrowseClick(self, word, line, lineNo, start, style): """ Overridden from BrowseStyledTextCtrlMix, jumps to declaration or opens module Currently only the open module is inspected, classes declared outside the scope of the active module are inaccessible. """ module = self.model.getModule() if line[start-5: start] =...
self.GotoLine(block.start-1)
gotoLine = block.start-1 if gotoLine != -1: self.model.editor.addBrowseMarker(lineNo) self.GotoLine(gotoLine)
def BrowseClick(self, word, line, lineNo, start, style): """ Overridden from BrowseStyledTextCtrlMix, jumps to declaration or opens module Currently only the open module is inspected, classes declared outside the scope of the active module are inaccessible. """ module = self.model.getModule() if line[start-5: start] =...
def goto(self, gotoLine): print 'jumping to line', gotoLine self.GotoLine(gotoLine) def underlineWord(self, start, length): start, length = BrowseStyledTextCtrlMix.underlineWord(self, start, length) if self.model.editor.debugger: word, line, lnNo, wordStart = self.getStyledWordElems(start, length) self.IndicatorSetCol...
def BrowseClick(self, word, line, lineNo, start, style): """ Overridden from BrowseStyledTextCtrlMix, jumps to declaration or opens module Currently only the open module is inspected, classes declared outside the scope of the active module are inaccessible. """ module = self.model.getModule() if line[start-5: start] =...
def underlineWord(self, start, length): start, length = BrowseStyledTextCtrlMix.underlineWord(self, start, length) if self.model.editor.debugger: word, line, lnNo, wordStart = self.getStyledWordElems(start, length) self.IndicatorSetColour(0, wxRED) try: val = self.model.editor.debugger.getVarValue(word) except Exceptio...
def underlineWord(self, start, length): start, length = BrowseStyledTextCtrlMix.underlineWord(self, start, length) if self.model.editor.debugger: word, line, lnNo, wordStart = self.getStyledWordElems(start, length) self.IndicatorSetColour(0, wxRED) try: val = self.model.editor.debugger.getVarValue(word) except Exceptio...
t, v = sys.exc_info()
t, v = sys.exc_info()[:2]
def notifyException(self): t, v = sys.exc_info() evt = DebuggerCommEvent(wxEVT_DEBUGGER_EXC, self.win_id) evt.SetExc(t, v) self.event_handler.AddPendingEvent(evt)
elif state in ('drag', 'end'):
elif state in ('drag', 'end') and self.circle:
def drawCircle(self, event, state, dc=None): if not dc: if state == 'start': self.circle = self.getImgPos(event) + (0,) elif state in ('drag', 'end'): x1, y1, x2, y2 = self.circle[:2] + self.getImgPos(event) rad = math.sqrt(pow(x2-x1, 2) + pow(y2-y1, 2)) + 0.5 self.circle = (x1, y1, rad) if state == 'end': self.snapsho...
self.mDC.DrawEllipse(x1-rad+0.5, y1-rad+0.5, rad*2, rad*2)
self.mDC.DrawEllipse(int(x1-rad+0.5), int(y1-rad+0.5), int(rad*2), int(rad*2))
def drawCircle(self, event, state, dc=None): if not dc: if state == 'start': self.circle = self.getImgPos(event) + (0,) elif state in ('drag', 'end'): x1, y1, x2, y2 = self.circle[:2] + self.getImgPos(event) rad = math.sqrt(pow(x2-x1, 2) + pow(y2-y1, 2)) + 0.5 self.circle = (x1, y1, rad) if state == 'end': self.snapsho...
dc.DrawEllipse(xoffset + (x-rad+0.5) * scale, yoffset + (y-rad+0.5) * scale, rad*scale*2, rad*scale*2)
dc.DrawEllipse(int(xoffset + (x-rad+0.5) * scale), int(yoffset + (y-rad+0.5) * scale), int(rad*scale*2), int(rad*scale*2))
def drawCircle(self, event, state, dc=None): if not dc: if state == 'start': self.circle = self.getImgPos(event) + (0,) elif state in ('drag', 'end'): x1, y1, x2, y2 = self.circle[:2] + self.getImgPos(event) rad = math.sqrt(pow(x2-x1, 2) + pow(y2-y1, 2)) + 0.5 self.circle = (x1, y1, rad) if state == 'end': self.snapsho...
pass
dlg.Destroy()
def OnFDEndLabelEdit(self, event): newText = event.GetText() event.Skip() if newText != self.oldLabelVal:# and isinstance(self.list.node, ZopeItemNode): self.node.renameItem(self.oldLabelVal, newText) self.refreshCurrent() self.selectItemNamed(newText) self.EnsureVisible(self.selected)
self.html.SetPage(credits_html % ( Utils.toPyPath('Images/Shared/PythonPowered.gif'), Utils.toPyPath('Images/Shared/wxPyButton.png'), Utils.toPyPath('Images/Shared/wxWinButton.png')))
self.html.SetPage(credits_html % ('memory:PythonPowered.png', 'memory:wxPyButton.png', 'memory:wxWinButton.png'))
def OnLinkClick(self, event): clicked = event.linkinfo[0] if clicked == 'Credits': self.html.SetPage(credits_html % ( Utils.toPyPath('Images/Shared/PythonPowered.gif'), Utils.toPyPath('Images/Shared/wxPyButton.png'), Utils.toPyPath('Images/Shared/wxWinButton.png'))) elif clicked == 'Back': self.setPage() #self.html.His...
Utils.toPyPath('Images/Shared/Boa.jpg'), __version__.version,
'memory:Boa.jpg', __version__.version,
def setPage(self): self.html.SetPage((about_html % ( Utils.toPyPath('Images/Shared/Boa.jpg'), __version__.version, '', about_text % (sys.version, wxPlatform, wxPython.__version__))))
self.html.SetPage(about_html % (Utils.toPyPath('Images/Shared/Boa.jpg'),
self.html.SetPage(about_html % ('memory:Boa.jpg',
def setPage(self): self.html.SetPage(about_html % (Utils.toPyPath('Images/Shared/Boa.jpg'), __version__.version, progress_text % (self.progressId, self.gaugePId), ''))
while self._live and sys and len(sys.modules) < self.moduleTotal:
while self and self._live and sys and len(sys.modules) < self.moduleTotal:
def monitorModuleCount(self): self._live = true lastCnt = 0 if sys and len(sys.modules) >= self.moduleTotal: wx.wxPostEvent(self, ModCntUpdateEvent(self.moduleTotal, 'importing')) else: while self._live and sys and len(sys.modules) < self.moduleTotal: mc = len(sys.modules) if mc > lastCnt: lastCnt = mc wx.wxPostEvent(s...
lines = StringIO(str(self.GetSelectedText())).readlines()
lines = StringIO(self.GetSelectedText()).readlines()
def processSelectionBlock(self, func): if self.GetUseTabs(): indtBlock = '\t' else: indtBlock = self.GetTabWidth()*' '
from ZopeLib import ZopeViews class ZopePTHTMLView(ZopeViews.ZopeHTMLView): viewName = 'Source.html' def generatePage(self): props = self.model.zopeObj.properties url = 'http://%s:%s@%s:%d/%s/source.html'%(props['username'], props['passwd'], props['host'], props['httpport'], self.model.zopeObj.whole_name()) import urll...
Controllers.modelControllerReg[ZopePageTemplateFSModel] = PageTemplateFSController
def OnSave(self, event): ZopeController.OnSave(self, event) # trigger a reload after saving so that errors saved as comments in the # source are displayed self.OnReload(event)
if root and root[0] != '/': root = '/'+root
def createChildNode(self, name, props): root = props['root'] if root and root[0] != '/': root = '/'+root itm = SSHItemNode(name, props, root, self.clipboard, true, EditorHelper.imgNetDrive, self) itm.category = name itm.bookmarks = self.bookmarks return itm
EditorHelper.imgNetDrive, self)
EditorHelper.imgNetDrive)
def createChildNode(self, name, props): root = props['root'] if root and root[0] != '/': root = '/'+root itm = SSHItemNode(name, props, root, self.clipboard, true, EditorHelper.imgNetDrive, self) itm.category = name itm.bookmarks = self.bookmarks return itm
def __init__(self, name, props, resourcepath, clipboard, isFolder, imgIdx, parent): ExplorerNodes.ExplorerNode.__init__(self, name, resourcepath, clipboard, imgIdx, parent, props)
def __init__(self, name, props, resourcepath, clipboard, isFolder, imgIdx): ExplorerNodes.ExplorerNode.__init__(self, name, resourcepath, clipboard, imgIdx, None, props)
def __init__(self, name, props, resourcepath, clipboard, isFolder, imgIdx, parent): ExplorerNodes.ExplorerNode.__init__(self, name, resourcepath, clipboard, imgIdx, parent, props) self.isFolder = isFolder
return ExplorerNodes.ExplorerNode.getURI(self) + (self.isFolder and '/' or '')
title = self.getTitle() if title and title[0] != '/': title = '/' + title if self.isFolder: title = title + '/' return '%s://%s%s'%(self.protocol, self.category, title)
def getURI(self): return ExplorerNodes.ExplorerNode.getURI(self) + (self.isFolder and '/' or '')
EditorHelper.imgTextModel, self)
EditorHelper.imgTextModel)
def createChildNode(self, name, isFolder, props, respath=''): if not respath: respath = self.resourcepath+'/'+name item = SSHItemNode(name, props, respath, self.clipboard, isFolder, isFolder and EditorHelper.imgFolder or \ EditorHelper.imgTextModel, self) if not isFolder: item.imgIdx = Controllers.identifyFile(name, lo...
cmd = 'scp %s %s' % (os.path.basename(fsNode.resourcepath),
cmd = 'scp "%s" "%s"' % (os.path.basename(fsNode.resourcepath),
def copyFromFS(self, fsNode, fn=''): if not fn: fn = os.path.basename(fsNode.resourcepath) cwd = os.getcwd() os.chdir(os.path.dirname(fsNode.resourcepath)) try: cmd = 'scp %s %s' % (os.path.basename(fsNode.resourcepath), self.remotePath(fn)) self.execSCP(cmd) finally: os.chdir(cwd)
cmd = 'scp %s %s' % (self.remotePath(''), fn)
cmd = 'scp "%s" "%s"' % (self.remotePath(''), fn)
def copyToFS(self, fsFolderNode, fn=''): if not fn: fn = os.path.basename(self.resourcepath) cwd = os.getcwd() os.chdir(fsFolderNode.resourcepath) try: cmd = 'scp %s %s' % (self.remotePath(''), fn) self.execSCP(cmd) finally: os.chdir(cwd)
try: return open(fn, mode).read() finally: os.remove(fn)
if os.path.exists(fn): try: return open(fn, mode).read() finally: os.remove(fn) else: raise ExplorerNodes.TransportLoadError( 'File was not downloaded locally.', self.resourcepath)
def load(self, mode='rb'): from FileExplorer import PyFileNode import tempfile fn = tempfile.mktemp() try: self.copyToFS(PyFileNode('', os.path.dirname(fn), None, -1, None, None), os.path.basename(fn)) try: return open(fn, mode).read() finally: os.remove(fn) except Exception, error: raise ExplorerNodes.TransportLoadErr...
if self.parent: self.parent.copyFromFS(PyFileNode('', fn, None, -1, None, None), name) else: raise 'No Parent!'
parentDir = os.path.dirname(self.resourcepath) parentName = os.path.basename(parentDir) parentSSHNode = self.createChildNode(parentName, 1, self.properties, parentDir) parentSSHNode.copyFromFS(PyFileNode('', fn, None, -1), name)
def save(self, filename, data, mode='wb'): from FileExplorer import PyFileNode import tempfile name = os.path.basename(self.resourcepath) fn = tempfile.mktemp() try: open(fn, mode).write(data) try: if self.parent: self.parent.copyFromFS(PyFileNode('', fn, None, -1, None, None), name) else: raise 'No Parent!' finally: o...
self.properties, '/'+respath)
self.properties, respath)
def getNodeFromPath(self, respath): if not respath: respath = '/'
key = event.KeyCode()
key = event.GetKeyCode()
def OnKeyPressed(self, event): key = event.KeyCode() if key == 13: if self.defaultActionIdx != -1: self.actions[self.defaultActionIdx][1](event) return event.Skip()
key = event.KeyCode()
key = event.GetKeyCode()
def OnKeyPressed(self, event): key = event.KeyCode() if key == 13: if self.defaultActionIdx != -1: self.actions[self.defaultActionIdx][1](event) event.Skip()
key = event.KeyCode()
key = event.GetKeyCode()
def OnKeyPressed(self, event): key = event.KeyCode() if key == 13: if self.defaultActionIdx != -1: self.actions[self.defaultActionIdx][1](event)
[''] + [' def %s(%s):' % (method_name, method_params)] + method_body
pre_blank + [' def %s(%s):' % (method_name, method_params)] + \ method_body + post_blank
[''] + [' def %s(%s):' % (method_name, method_params)] + method_body
shellEdit, dummy = Utils.wxProxyPanel(self.tabs, ShellEditor.ShellEditor, -1)
tabPage, shellEdit = \ Utils.wxProxyPanel(self.tabs, ShellEditor.ShellEditor, -1)
def addShellPage(self): """ Adds the interactive interpreter to the editor """ if wxPlatform == '__WXGTK__': # A panel between the STC and notebook reduces flicker shellEdit, dummy = Utils.wxProxyPanel(self.tabs, ShellEditor.ShellEditor, -1)
shellEdit = ShellEditor.ShellEditor(self.tabs, -1) self.tabs.AddPage(shellEdit, 'Shell')
shellEdit = tabPage = ShellEditor.ShellEditor(self.tabs, -1) self.tabs.AddPage(tabPage, 'Shell')
## def OnWinSize(evt, win=shellEdit):
modulePage.destroy()
def closeModule(self, modulePage): idx = modulePage.tIdx name = modulePage.model.filename if self.modules.has_key(name): if modulePage.model.views.has_key('Designer'): modulePage.model.views['Designer'].close() modulePage.model.refreshFromViews() if modulePage.model.modified: if Utils.yesNoDialog(self, 'Close module', ...
self.notebook.Refresh()
def refresh(self): pass self.notebook.Refresh()
if event.GetOldSelection() != event.GetSelection(): self.editor.setupToolBar(viewIdx = event.GetSelection())
viewIdx = event.GetSelection() if event.GetOldSelection() != viewIdx: self.editor.setupToolBar(viewIdx=viewIdx) view = self.getActiveView(viewIdx) if hasattr(view, 'OnPageActivated'): view.OnPageActivated(event)
def OnPageChange(self, event): if event.GetOldSelection() != event.GetSelection(): self.editor.setupToolBar(viewIdx = event.GetSelection()) event.Skip()
try: server.exit_debugger() except socket.error, err: pass server = None
def kill(self): server = self.server if server is not None: self.server = None try: server.exit_debugger() except socket.error, err: pass # server is already shut down server = None self.input_stream = None self.error_stream = None process = self.process self.process = None if process is not None: # process.Detach() if...
t, v, tb = sys.exc_info()
t, v = sys.exc_info()[:2]
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, sel...
Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/Up.png',
Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/up.png',
def __init__(self, parent, collEditView, additAdders = (), lvStyle = wxLC_REPORT): self._init_ctrls(parent)
Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/Down.png',
Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/down.png',
def __init__(self, parent, collEditView, additAdders = (), lvStyle = wxLC_REPORT): self._init_ctrls(parent)
def OnLoginCVS(self, event):
def OnLoginCVS(self, event, cvsroot=''):
def OnLoginCVS(self, event): cvsDir = self.list.node.resourcepath
if os.environ.has_key('CVSROOT'): cvsroot = os.environ['CVSROOT'] else: cvsroot = '' cvsroot = self.cvsCmdPrompt(cvsroot, cvsDir, help = 'Change the CVSROOT if necessary:') dlg = wxTextEntryDialog(self.list, 'Enter cvs password for '+cvsroot, 'CVS login', '', style = wxOK | wxCANCEL | wxCENTRE | wxTE_PASSWORD)
if not cvsroot: if os.environ.has_key('CVSROOT'): cvsroot = os.environ['CVSROOT'] else: cvsroot = '' cvsroot = self.cvsCmdPrompt(cvsroot, cvsDir, help='Change the CVSROOT if necessary:') dlg = wxTextEntryDialog(self.list, 'Enter cvs password for '+cvsroot, 'CVS login', '', style=wxOK|wxCANCEL|wxCENTRE|wxTE_PASSWORD)
def OnLoginCVS(self, event): cvsDir = self.list.node.resourcepath
if Utils.startswith(timestamp, 'Result of merge+'):
if timestamp.startswith('Result of merge+'):
def open(self, editor): tree = editor.explorer.tree node = editor.explorer.list.getSelection() timestamp = node.timestamp tree.SelectItem(tree.GetItemParent(tree.GetSelection())) editor.explorer.list.selectItemNamed(self.name) if self.conflict: node = editor.explorer.list.getSelection()
altDown = event.AltDown()
def OnKeyDown(self, event): #if Preferences.handleSpecialEuropeanKeys: # self.handleSpecialEuropeanKeys(event, Preferences.euroKeysCountry)
if kk == 13 and not (event.ShiftDown() or event.HasModifiers()):
if kk == 13 and not (shiftDown or event.HasModifiers()):
def OnKeyDown(self, event): #if Preferences.handleSpecialEuropeanKeys: # self.handleSpecialEuropeanKeys(event, Preferences.euroKeysCountry)
if shiftDown and self.sc.has_key((wxACCEL_CTRL|wxACCEL_SHIFT, kk)): self.sc[(wxACCEL_CTRL|wxACCEL_SHIFT, kk)](self) elif self.sc.has_key((wxACCEL_CTRL, kk)): self.sc[(wxACCEL_CTRL, kk)](self)
if shiftDown and self.sc.has_key((wxACCEL_CTRL|wxACCEL_SHIFT, kk)): self.sc[(wxACCEL_CTRL|wxACCEL_SHIFT, kk)](self) return elif self.sc.has_key((wxACCEL_CTRL, kk)): self.sc[(wxACCEL_CTRL, kk)](self) return
def OnKeyDown(self, event): #if Preferences.handleSpecialEuropeanKeys: # self.handleSpecialEuropeanKeys(event, Preferences.euroKeysCountry)
print 'Clip copy'
def OnCopyItems(self, event): print 'Clip copy' if self.list.node: nodes = self.getNodesForSelection(self.list.getMultiSelection()) self.list.node.clipCopy(nodes)
print 'Opening item', node
def OnOpenItems(self, event): if self.list.node: nodes = self.getNodesForSelection(self.list.getMultiSelection()) for node in nodes: if not node.isFolderish(): print 'Opening item', node node.open(self.editor)
args[paramKey] = PaletteMapping.evalCtrl(params[paramKey], evalDct)
try: args[paramKey] = PaletteMapping.evalCtrl(params[paramKey], evalDct) except AttributeError: args[paramKey] = PaletteMapping.evalCtrl(params[paramKey], {'self': self.controllerView.objectNamespace})
def setupArgs(self, ctrlName, params, dontEval, evalDct): """ Create a dictionary of parameters for the constructor of the control from a dictionary of string/source parameters. Catches design time parameter overrides. """
wxID_BREAKENABLED, wxID_BREAKREFRESH] = map(lambda x: NewId(), range(6))
wxID_BREAKENABLED, wxID_BREAKREFRESH, wxID_BREAKIGNORE] = Utils.wxNewIds(7)
def OnGotoSource(self, event): if self.selection != -1: entry = self.stack[self.selection] lineno = entry['lineno'] modname = entry['modname'] filename = entry['client_filename'] if not filename: return
self.menu.Append(wxID_BREAKEDIT, 'Edit')
self.menu.Append(wxID_BREAKIGNORE, 'Edit ignore count') self.menu.Append(wxID_BREAKEDIT, 'Edit condition')
def __init__(self, parent, debugger):#, flist, browser): wxListCtrl.__init__(self, parent, wxID_BREAKVIEW, style = wxLC_REPORT | wxLC_SINGLE_SEL ) self.InsertColumn(0, 'Module', wxLIST_FORMAT_LEFT, 90) self.InsertColumn(1, 'Line', wxLIST_FORMAT_CENTER, 40) self.InsertColumn(2, 'Ignore', wxLIST_FORMAT_CENTER, 45) self.I...
EVT_MENU(self, wxID_BREAKEDIT, self.OnEdit)
EVT_MENU(self, wxID_BREAKIGNORE, self.OnEditIgnore) EVT_MENU(self, wxID_BREAKEDIT, self.OnEditCondition)
def __init__(self, parent, debugger):#, flist, browser): wxListCtrl.__init__(self, parent, wxID_BREAKVIEW, style = wxLC_REPORT | wxLC_SINGLE_SEL ) self.InsertColumn(0, 'Module', wxLIST_FORMAT_LEFT, 90) self.InsertColumn(1, 'Line', wxLIST_FORMAT_CENTER, 40) self.InsertColumn(2, 'Ignore', wxLIST_FORMAT_CENTER, 45) self.I...
if bp['enabled']: self.SetStringItem(p, 3, '*')
def refreshList(self): self.rightsel = -1 self.DeleteAllItems() bps = bplist.getBreakpointList() # Sort by filename and lineno. bps.sort(lambda a, b: cmp((a['filename'], a['lineno']), (b['filename'], b['lineno']))) self.bps = bps for p in range(len(bps)): bp = bps[p] imgIdx = 0 if not bp['enabled']: imgIdx = 2 elif bp[...
self.SetStringItem(p, 4, bp['cond'] or '')
self.SetStringItem(p, 4, cond)
def refreshList(self): self.rightsel = -1 self.DeleteAllItems() bps = bplist.getBreakpointList() # Sort by filename and lineno. bps.sort(lambda a, b: cmp((a['filename'], a['lineno']), (b['filename'], b['lineno']))) self.bps = bps for p in range(len(bps)): bp = bps[p] imgIdx = 0 if not bp['enabled']: imgIdx = 2 elif bp[...
editor.openOrGotoModule(filename) sourceView = editor.getActiveModulePage().model.views['Source']
model, ctrlr = editor.openOrGotoModule(filename) sourceView = model.views['Source']
def gotoSourceForItem(self, sel): bp = self.bps[sel] filename = bp['filename'] if not filename: return editor = self.debugger.editor editor.SetFocus() editor.openOrGotoModule(filename) sourceView = editor.getActiveModulePage().model.views['Source'] sourceView.focus() #sourceView.SetFocus() #sourceView.selectLine(bp['li...
def OnEdit(self, event): pass
def gotoSourceForItem(self, sel): bp = self.bps[sel] filename = bp['filename'] if not filename: return editor = self.debugger.editor editor.SetFocus() editor.openOrGotoModule(filename) sourceView = editor.getActiveModulePage().model.views['Source'] sourceView.focus() #sourceView.SetFocus() #sourceView.selectLine(bp['li...
'enableBreakpoints', (filename, lineno, enabled))
'enableBreakpoints', (server_fn, lineno, enabled))
def OnToggleEnabled(self, event): sel = self.rightsel if sel != -1: bp = self.bps[sel] filename = bp['filename'] lineno = bp['lineno'] enabled = bp['enabled'] = not bp['enabled'] bplist.enableBreakpoints(filename, lineno, enabled) self.debugger.invokeInDebugger( 'enableBreakpoints', (filename, lineno, enabled)) self.re...
def compareColors(c1, c2): return (c1.Red() == c2.Red() and c1.Green() == c2.Green() and c1.Blue() == c2.Blue())
def simplifyPathList(data, SequenceTypes=(type(()), type([])), ExcludeTypes=(type(None),) ): # Takes a possibly nested structure and turns it into a flat tuple. if type(data) in SequenceTypes: newdata = [] for d in data: nd = simplifyPathList(d) if nd: newdata.extend(nd) return newdata elif type(data) in ExcludeTypes: ...