rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if self.selection:
if self.selection or self.multiSelection:
def OnControlSelect(self, event): """ Control is clicked. Either select it or add control from palette """ ctrl = self.senderMapper.getObject(event)
if companion.container: parent = ctrl
selCtrl, selCompn, selPos = \ self.checkChildCtrlClick(ctrlName, ctrl, companion, evtPos) if event.ShiftDown(): if self.selection: if ctrl.GetParent().this != self.selection.selection.GetParent().this: return elif self.multiSelection: if ctrl.GetParent().this != self.multiSelection[0].selection.GetParent().this: return if not self.multiSelection: if ctrl == self.selection.selection: return newSelection = MultiSelectionGroup(self, self.senderMapper, self.inspector, self) newSelection.assign(self.selection) self.selection.destroy() self.selection = None self.multiSelection = [newSelection] if len(self.multiSelection) > 1: for selIdx in range(len(self.multiSelection)): if self.multiSelection[selIdx].selection == ctrl: self.multiSelection[selIdx].destroy() del self.multiSelection[selIdx] if len(self.multiSelection) == 1: self.selection = SingleSelectionGroup(self, self.senderMapper, self.inspector, self) self.selection.assign(self.multiSelection[0]) self.selection.selectCtrl(self.multiSelection[0].selection, self.multiSelection[0].selCompn) self.clearMultiSelection() return newSelection = MultiSelectionGroup(self, self.senderMapper, self.inspector, self) newSelection.selectCtrl(selCtrl, selCompn) self.multiSelection.append(newSelection)
def OnControlSelect(self, event): """ Control is clicked. Either select it or add control from palette """ ctrl = self.senderMapper.getObject(event)
parent = ctrl.GetParent() tbOffset = 0 if parent == self: tb = self.GetToolBar() if tb: tbOffset = tb.GetSize().y * -1 parRel, parRef = self.buildParentRelationship() if ctrl == self: children = parRef[''] else: children = parRef[ctrlName] for childName in children.keys(): childCompn, childCtrl = self.objects[childName][:2] try: pos = childCtrl.GetPosition() sze = childCtrl.GetSize() except: print 'could not get child ctrl size', childCtrl else: if wxIntersectRect((evtPos.x, evtPos.y + tbOffset, 1, 1), (pos.x, pos.y, sze.x, sze.y)) is not None: self.selection.selectCtrl(childCtrl, childCompn) self.selection.moveCapture(childCtrl, childCompn, wxPoint(evtPos.x - pos.x, evtPos.y + tbOffset - pos.y)) return self.selection.selectCtrl(ctrl, companion) self.selection.moveCapture(ctrl, companion, evtPos)
if self.multiSelection: for sel in self.multiSelection: if selCtrl == sel.selection: sel.moveCapture(selCtrl, selCompn, selPos) self.mainMultiDrag = selCtrl others = self.multiSelection[:] others.remove(sel) for capSel in others: capSel.moveCapture(capSel.selection, capSel.selCompn, selPos) return self.clearMultiSelection() self.assureSingleSelection() self.selection.selectCtrl(selCtrl, selCompn) self.selection.moveCapture(selCtrl, selCompn, selPos)
def OnControlSelect(self, event): """ Control is clicked. Either select it or add control from palette """ ctrl = self.senderMapper.getObject(event)
self.selection = None
self.selection = None elif self.multiSelection: for sel in self.multiSelection: sel.destroy() self.multiSelection = None
def OnCloseWindow(self, event): self.destroying = true if self.selection: self.selection.destroy() self.selection = None
def OnAlignSelected(self, event): dlg = CtrlAlign.create(self) try: dlg.ShowModal() finally: dlg.Destroy() def OnSizeSelected(self, event): dlg = CtrlSize.create(self) try: dlg.ShowModal() finally: dlg.Destroy() def OnSelectParent(self, event): if self.selection: self.selectParent(self.selection.selection) elif self.multiSelection: self.selectParent(self.multiSelection[0].selection) def OnCutSelected(self, event): if self.selection: ctrls = [self.selection.name] elif self.multiSelection: ctrls = map(lambda sel: sel.name, self.multiSelection) output = [] self.cutCtrls(ctrls, [], output) clip = wxTheClipboard clip.Open() try: clip.SetData(wxTextDataObject(string.join(output, os.linesep))) finally: clip.Close() self.refreshContainment() def OnCopySelected(self, event): if self.selection: ctrls = [self.selection.name] elif self.multiSelection: ctrls = map(lambda sel: sel.name, self.multiSelection) output = [] self.copyCtrls(ctrls, [], output) clip = wxTheClipboard clip.Open() try: clip.SetData(wxTextDataObject(string.join(output, os.linesep))) finally: clip.Close() def OnPasteSelected(self, event): if self.selection: clip = wxTheClipboard clip.Open() try: data = wxTextDataObject() clip.GetData(data) finally: clip.Close() pasted = self.pasteCtrls(self.selection.name, string.split(data.GetText(), os.linesep)) if len(pasted): self.refreshContainment() self.selection.selectCtrl(self.objects[pasted[0]][1], self.objects[pasted[0]][0])
def OnCtrlHelp(self, event): if self.inspector.selCmp: Help.showHelp(self, Help.wxWinHelpFrame, self.inspector.selCmp.wxDocs, None)
return '<%s %s>' % (`self.__class__`, self.whole_name())
return '<%s %s, %s>' % (`self.__class__`, self.whole_name(), self.date)
def __repr__(self): return '<%s %s>' % (`self.__class__`, self.whole_name())
entries = filter(None, string.split(line[10:41], ' '))
entries = filter(None, string.split(line[10:42], ' '))
def read(self, line): try: self.perms = line[:10] entries = filter(None, string.split(line[10:41], ' ')) self.size = int(entries[3]) self.date = line[42:54] self.name = string.strip(line[55:]) except: print 'Could not read:', line
self.date = line[42:54]
self.date = line[43:55]
def read(self, line): try: self.perms = line[:10] entries = filter(None, string.split(line[10:41], ' ')) self.size = int(entries[3]) self.date = line[42:54] self.name = string.strip(line[55:]) except: print 'Could not read:', line
except: print 'Could not read:', line
except Exception, message: print 'Could not read:', line, message
def read(self, line): try: self.perms = line[:10] entries = filter(None, string.split(line[10:41], ' ')) self.size = int(entries[3]) self.date = line[42:54] self.name = string.strip(line[55:]) except: print 'Could not read:', line
print self.path
def whole_name(self): print self.path if self.path == '/': return '/%s' % self.name else: return '%s/%s' % (self.path, self.name)
def destroy(self): self.faceDnClr = self.shadowPen = self.highlightPen = self.focusIndPen = None
def SetBestSize(self, size=None): """ Given the current font and bezel width settings, calculate and set a good size. """ if size is None: size = wxSize(-1,-1) if type(size) == type(()): size = wxSize(size[0], size[1])
if no_sys_col: faceClr = wxColour(192, 192, 192) textClr = wxColour(0, 0, 0) else: faceClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE) textClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNTEXT)
faceClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE) textClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNTEXT)
def InitColours(self):
if no_sys_col: shadowClr = wxColour(128, 128, 128) highlightClr = wxColour(228, 228, 228) else: shadowClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNSHADOW) highlightClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNHIGHLIGHT)
shadowClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNSHADOW) highlightClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNHIGHLIGHT)
def InitColours(self):
wxWindow.SetBackgroundColour(self, colour)
wxControl.SetBackgroundColour(self, colour)
def SetBackgroundColour(self, colour): wxWindow.SetBackgroundColour(self, colour)
self.ReleaseMouse()
def OnLeftUp(self, event): if not self.IsEnabled(): return if not self.up: # if the button was down when the mouse was released... self.Notify() self.up = true self.ReleaseMouse() self.Refresh() event.Skip()
def destroy(self): wxGenButton.destroy(self) self.bmpLabel = None self.bmpDisabled = None self.bmpFocus = None self.bmpSelected = None
def destroy(self): wxGenButton.destroy(self) self.bmpLabel = None self.bmpDisabled = None self.bmpFocus = None self.bmpSelected = None
class wxGenBitmapTextToggleButton(__ToggleMixin, wxGenBitmapTextButton): pass
def OnKeyUp(self, event): if self.hasFocus and event.KeyCode() == ord(" "): self.up = not self.up self.Notify() self.Refresh() event.Skip()
if conflict and len(ismerge) ==1:
if conflict and len(ismerge) == 1 or ismerge[0] == 'dummy timestamp':
def cvsFileLocallyModified(filename, timestamp): """ cvsFileLocallyModified -> modified, conflict """ ismerge = string.split(timestamp, '+') conflict = ismerge[0] == 'Result of merge' filets = time.asctime(time.gmtime(os.stat(filename)[stat.ST_MTIME])) if conflict and len(ismerge) ==1: filesegs, cvssegs = 1, 0 # convert day to int to avoid zero padded differences else: if conflict: filesegs, cvssegs = string.split(filets), string.split(ismerge[1]) else: filesegs, cvssegs = string.split(filets), string.split(timestamp) filesegs[2], cvssegs[2] = int(filesegs[2]), int(cvssegs[2]) return ( filesegs != cvssegs, conflict)
size=wxSize(561, 288), style=wxTRANSPARENT_WINDOW | wxCLIP_CHILDREN | wxSUNKEN_BORDER)
size=wxSize(561, 288), style=wxSUNKEN_BORDER)
def _init_ctrls(self, prnt): # generated method, don't edit wxPanel.__init__(self, id=wxID_IMAGEEDITORPANEL, name='ImageEditorPanel', parent=prnt, pos=wxPoint(466, 318), size=wxSize(586, 356), style=wxSUNKEN_BORDER | wxTAB_TRAVERSAL) self._init_utils() self.SetAutoLayout(true) self.SetClientSize(wxSize(578, 329))
EVT_SCROLL(self.editWindow, self.OnEditWindowScroll)
EVT_SCROLLWIN(self.editWindow, self.OnEditWindowScroll)
def _init_ctrls(self, prnt): # generated method, don't edit wxPanel.__init__(self, id=wxID_IMAGEEDITORPANEL, name='ImageEditorPanel', parent=prnt, pos=wxPoint(466, 318), size=wxSize(586, 356), style=wxSUNKEN_BORDER | wxTAB_TRAVERSAL) self._init_utils() self.SetAutoLayout(true) self.SetClientSize(wxSize(578, 329))
self.selDesgn.saveOnClose = true self.selDesgn.Close()
self.selDesgn.controllerView.saveOnClose = true self.selDesgn.controllerView.Close()
def OnPost(self, event): if self.selDesgn: self.selDesgn.saveOnClose = true self.selDesgn.Close()
self.selDesgn.saveOnClose = false self.selDesgn.Close()
self.selDesgn.controllerView.saveOnClose = false self.selDesgn.controllerView.Close()
def OnCancel(self, event): if self.selDesgn: self.selDesgn.saveOnClose = false self.selDesgn.Close()
if self.value == v:
if value == v:
def valueToIECValue(self): for k, v in self.defaults.items(): if self.value == v: return k objs = self.companion.designer.getObjectsOfClass(self.linkClass) for objName in objs.keys(): if objs[objName] and self.value and objs[objName].this == self.value.this: return objName return `None`
objs = self.companion.designer.getObjectsOfClass(self.linkClass)
objs = self.companion.designer.getObjectsOfClass(LinkClass)
def valueToIECValue(self): for k, v in self.defaults.items(): if self.value == v: return k objs = self.companion.designer.getObjectsOfClass(self.linkClass) for objName in objs.keys(): if objs[objName] and self.value and objs[objName].this == self.value.this: return objName return `None`
if objs[objName] and self.value and objs[objName].this == self.value.this:
if objs[objName] and value and objs[objName].this == value.this:
def valueToIECValue(self): for k, v in self.defaults.items(): if self.value == v: return k objs = self.companion.designer.getObjectsOfClass(self.linkClass) for objName in objs.keys(): if objs[objName] and self.value and objs[objName].this == self.value.this: return objName return `None`
self.companion.designer, value)
self.companion.designer, self.value)
def getObjects(self): return getValidSizers(self.companion.parentCompanion.control, self.companion.designer, value)
value = sizer.GetName()
value = self.getNameForValue(self.value, self.linkClass)
def getValues(self): if self.value is None: value = 'None' else: value = sizer.GetName() return getValidSizers(self.companion.control, self.companion.designer, value)
else: return `propVal` == `ctrlVal`
elif isinstance(propVal, (types.StringType, types.UnicodeType)) and \ isinstance(ctrlVal, (types.StringType, types.UnicodeType)): return propVal == ctrlVal else: return propVal == ctrlVal
def isValuesEqual(self, propVal, ctrlVal): if isinstance(propVal, wxFontPtr) and isinstance(ctrlVal, wxFontPtr): return fontAsExpr(propVal) == fontAsExpr(ctrlVal) else: return `propVal` == `ctrlVal`
class StringEnumPropEdit(EnumPropEdit): def getDisplayValue(self): return `self.value`
def getValue(self): if self.editorCtrl: strVal = self.editorCtrl.getValue() try: self.value = self.names[strVal] except KeyError: self.value = self.companion.eval(strVal)
wxFrame.__init__(self, size = (-1, -1), id = wxID_INSPECTORFRAME, title = 'Inspector', parent = prnt, name = '', style = wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS | wxCLIP_CHILDREN, pos = (-1, -1))
wxFrame.__init__(self, size = (-1, -1), id = wxID_INSPECTORFRAME, title = 'Inspector', parent = prnt, name = '', style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN, pos = (-1, -1))
def _init_ctrls(self, prnt): wxFrame.__init__(self, size = (-1, -1), id = wxID_INSPECTORFRAME, title = 'Inspector', parent = prnt, name = '', style = wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS | wxCLIP_CHILDREN, pos = (-1, -1)) self._init_utils()
self.SetIcon(wxIcon(Preferences.toPyPath('Images/Icons/Inspector.ico'), wxBITMAP_TYPE_ICO))
self.SetIcon(IS.load('Images/Icons/Inspector.ico'))
def __init__(self, parent): self._init_ctrls(parent)
if (self.selCmp == compn) or self.vetoSelect:
if self.selCmp == compn or self.vetoSelect:
def selectObject(self, compn, selectInContainment = true): """ Select an object in the inspector by populating the property pages. This method is called from the InspectableObjectCollection derived classes """
nv = page.getNameValue(name) if nv: nv.initFromComponent()
nv = page.getNameValue(name) if nv: page.initFromComponent(name)
def pageUpdate(self, page, name):
print 'directPositionUpdate', comp.name
def directPositionUpdate(self, comp): print 'directPositionUpdate', comp.name comp.persistProp('Position', 'SetPosition', `comp.control.GetPosition()`)
c = self.selCmp self.selCmp.updateZopeProps()
cmpn = self.selCmp cmpn.updateZopeProps()
def refreshZopeProps(self): c = self.selCmp self.selCmp.updateZopeProps() self.selCmp = None self.selectObject(c)
self.selectObject(c)
self.selectObject(cmpn) def OnRevertItem(self, event): if self.selCmp and self.props.prevSel and self.props.prevSel.propEditor: propEdit = self.props.prevSel.propEditor propEdit.companion.propRevertToDefault(propEdit.name, propEdit.propWrapper.getSetterName()) self.props.prevSel.showPropNameModified()
def refreshZopeProps(self): c = self.selCmp self.selCmp.updateZopeProps() self.selCmp = None self.selectObject(c)
editor = None, options = None, names = None): self.destr = false
editor = None, options = None, names = None, ownerPropEdit = None): self.destr = false
def __init__(self, inspector, nameParent, valueParent, companion, rootCompanion, name, propWrapper, idx, indent, editor = None, options = None, names = None):
valueParent.GetSize().x+IECWidthFudge) self.expander = None if self.propEditor: self.propValue = self.propEditor.getValue() displayVal = self.propEditor.getDisplayValue() if self.propEditor.getStyle().count(PropertyEditors.esExpandable): mID = NewId() self.expander = wxCheckBox(nameParent, mID, '', wxPoint(8 * self.indent, self.idx * oiLineHeight +2), wxSize(12, 14)) self.expander.SetValue(true) EVT_CHECKBOX(self.expander, mID, self.OnExpand) else: self.propValue = '' displayVal = ''
valueParent.GetSize().x + IECWidthFudge) self.expander = None if self.propEditor: self.propEditor.ownerPropEdit = ownerPropEdit self.updatePropValue() displayVal = self.propEditor.getDisplayValue() if PropertyEditors.esExpandable in self.propEditor.getStyle(): mID = NewId() self.expander = wxCheckBox(nameParent, mID, '', wxPoint(8 * self.indent, self.idx * oiLineHeight +2), wxSize(12, 14)) self.expander.SetValue(true) EVT_CHECKBOX(self.expander, mID, self.OnExpand) else: self.propValue = '' displayVal = ''
def __init__(self, inspector, nameParent, valueParent, companion, rootCompanion, name, propWrapper, idx, indent, editor = None, options = None, names = None):
style = wxCLIP_CHILDREN)
style = wxCLIP_CHILDREN | wxST_NO_AUTORESIZE) self.nameCtrl.SetToolTipString(name)
def __init__(self, inspector, nameParent, valueParent, companion, rootCompanion, name, propWrapper, idx, indent, editor = None, options = None, names = None):
oiLineHeight -3), style = wxCLIP_CHILDREN)
oiLineHeight -3), style = wxCLIP_CHILDREN | wxST_NO_AUTORESIZE)
def __init__(self, inspector, nameParent, valueParent, companion, rootCompanion, name, propWrapper, idx, indent, editor = None, options = None, names = None):
self.idx * oiLineHeight))
self.idx * oiLineHeight + 2))
def setPos(self, idx): self.idx = idx if self.expander: self.expander.SetPosition(wxPoint(8 * self.indent, self.idx * oiLineHeight)) self.nameCtrl.SetPosition(wxPoint(8 * self.indent + 16, idx * oiLineHeight +2)) self.value.SetPosition(wxPoint(2, idx * oiLineHeight +2)) self.separatorN.SetPosition(wxPoint(0, (idx +1) * oiLineHeight)) self.separatorV.SetPosition(wxPoint(0, (idx +1) * oiLineHeight)) if self.nameBevelTop: self.nameBevelTop.SetPosition(wxPoint(0, idx*oiLineHeight -1)) self.nameBevelBottom.SetPosition(wxPoint(0, (idx + 1)*oiLineHeight -1)) if self.propEditor: self.propEditor.setIdx(idx) elif self.valueBevelTop: self.valueBevelTop.SetPosition(wxPoint(0, idx*oiLineHeight -1)) self.valueBevelBottom.SetPosition(wxPoint(0, (idx + 1)*oiLineHeight -1))
if (not cancel) and self.propEditor: self.propEditor.inspectorPost() self.value.SetLabel(self.propEditor.getDisplayValue()) self.value.SetSize(wxSize(self.separatorV.GetSize().x, self.value.GetSize().y))
if self.propEditor: if cancel: self.propEditor.inspectorCancel() else: self.propEditor.inspectorPost() self.updateDisplayValue() self.value.SetSize(wxSize(self.separatorV.GetSize().x, oiLineHeight-3))
def hideEditor(self, cancel = false): if (not cancel) and self.propEditor:# and (not self.destr): self.propEditor.inspectorPost() self.value.SetLabel(self.propEditor.getDisplayValue()) self.value.SetSize(wxSize(self.separatorV.GetSize().x, self.value.GetSize().y))
self.value.SetLabel(self.propEditor.getDisplayValue())
self.updateDisplayValue()
def initFromComponent(self): """ Update Inspector after possible change to underlying control """ if self.propEditor: self.propEditor.initFromComponent() if not self.propEditor.editorCtrl: self.value.SetLabel(self.propEditor.getDisplayValue()) self.propEditor.persistValue(self.propEditor.valueAsExpr())
pass
def initFromComponent(self): """ Update Inspector after possible change to underlying control """ if self.propEditor: self.propEditor.initFromComponent() if not self.propEditor.editorCtrl: self.updateDisplayValue() def showPropNameModified(self): pass
def initFromComponent(self): """ Update Inspector after possible change to underlying control """ if self.propEditor: self.propEditor.initFromComponent() if not self.propEditor.editorCtrl: self.value.SetLabel(self.propEditor.getDisplayValue()) self.propEditor.persistValue(self.propEditor.valueAsExpr())
self.value.SetLabel(self.propEditor.getDisplayValue())
self.updateDisplayValue()
def initFromComponent(self): if self.propEditor: self.propEditor.initFromComponent() if not self.propEditor.editorCtrl: self.value.SetLabel(self.propEditor.getDisplayValue())
style = wxSP_NOBORDER|wxSP_LIVE_UPDATE)
style = wxSP_NOBORDER|wxNO_3D|wxSP_LIVE_UPDATE)
def __init__(self, parent, inspector): wxSplitterWindow.__init__(self, parent, -1, style = wxSP_NOBORDER|wxSP_LIVE_UPDATE)#wxNO_3D|wxSP_3D) self.inspector = inspector self.categories = wxSplitterWindow(self, -1, style = wxNO_3D|wxSP_3D|wxSP_LIVE_UPDATE)#style = wxSP_NOBORDER) self.definitions = InspectorEventScrollWin(self, inspector) self.SetMinimumPaneSize(20) self.SplitHorizontally(self.categories, self.definitions) self.SetSashPosition(100) self.categoryClasses = wxListCtrl(self.categories, 100, style = wxLC_LIST) self.selCatClass = -1 EVT_LIST_ITEM_SELECTED(self.categoryClasses, 100, self.OnCatClassSelect) EVT_LIST_ITEM_DESELECTED(self.categoryClasses, 100, self.OnCatClassDeselect)
companion = self.inspector.selCmp
catClassName = self.categoryClasses.GetItemText(self.selCatClass)
def OnMacroSelect(self, event): if self.selMacClass > -1: companion = self.inspector.selCmp macName = self.categoryMacros.GetItemText(self.selMacClass) methName = self.macroNameToEvtName(macName) catClassName = self.categoryClasses.GetItemText(self.selCatClass) frameName = companion.designer.GetName() if catClassName in commandCategories:
methName = self.macroNameToEvtName(macName) catClassName = self.categoryClasses.GetItemText(self.selCatClass) frameName = companion.designer.GetName() if catClassName in commandCategories: wid = companion.getWinId() else: wid = None nv = self.getEvent(macName[4:]) if nv: self.addEvent(macName[4:], methName, wid) nv.initFromComponent() nv.OnSelect(None) else: self.addEvent(macName[4:], methName, wid)
self.doAddEvent(catClassName, macName)
def OnMacroSelect(self, event): if self.selMacClass > -1: companion = self.inspector.selCmp macName = self.categoryMacros.GetItemText(self.selMacClass) methName = self.macroNameToEvtName(macName) catClassName = self.categoryClasses.GetItemText(self.selCatClass) frameName = companion.designer.GetName() if catClassName in commandCategories:
wxScrolledWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER)
wxScrolledWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL)
def __init__(self, parent): wxScrolledWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER)
wxDefaultPosition, wxSize(100, 1))
wxDefaultPosition, wxSize(100, 1), style = wxTAB_TRAVERSAL)
def __init__(self, parent): wxScrolledWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER)
self.panelValues = wxPanel(self.splitter, -1)
self.panelValues = wxPanel(self.splitter, -1, style = wxTAB_TRAVERSAL)
def __init__(self, parent): wxScrolledWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER)
i.destroy()
i.destroy(true)
def cleanup(self): # XXX Does this always have to be inited here? self.prevSel = None #clean up for i in self.nameValues: i.destroy() self.nameValues = [] self.refreshSplitter()
self.splitter.SetDimensions(0, 0, s.x, s.y)
wOffset, hOffset = self.GetViewStart() puw, puh = self.GetScrollPixelsPerUnit() if hOffset and len(self.nameValues) < s.y /hOffset: hOffset = 0 self.splitter.SetDimensions(wOffset * puw, hOffset * puh * -1, s.x, s.y) self.updateScrollbars(wOffset, hOffset) def updateScrollbars(self, wOffset, hOffset): height = len(self.nameValues) self.SetScrollbars(oiLineHeight, oiLineHeight, 0, height + 1, wOffset, hOffset)
def refreshSplitter(self):
self.nameValues[idx].destroy(cancel) del self.nameValues[idx] deleted = deleted + 1 if idx + 1 < len(self.nameValues):
self.nameValues[idx].destroy(cancel) del self.nameValues[idx] deleted = deleted + 1
def deleteNameValues(self, idx, count, cancel = false): # delete sub properties deleted = 0 if idx < len(self.nameValues): while (idx < len(self.nameValues)) and (deleted < count): if self.nameValues[idx] == self.prevSel: self.prevSel = None self.nameValues[idx].destroy(cancel) del self.nameValues[idx] deleted = deleted + 1
def OnEnter(self, event): for nv in self.nameValues: if nv.editing: nv.propEditor.inspectorPost(false) def OnUndo(self, event): pass def OnCrsUp(self, event): if len(self.nameValues) > 1: for idx in range(1, len(self.nameValues)): if self.nameValues[idx].editing: self.propertySelected(self.nameValues[idx-1]) break else: self.propertySelected(self.nameValues[0]) def OnCrsDown(self, event): if len(self.nameValues) > 1: for idx in range(len(self.nameValues)-1): if self.nameValues[idx].editing: self.propertySelected(self.nameValues[idx+1]) break else: self.propertySelected(self.nameValues[0]) class InspectorPropScrollWin(InspectorScrollWin): """ Specialised InspectorScrollWin that understands properties """ def setNameValues(self, compn, rootCompn, nameValues, insIdx, indent): top = insIdx for nameValue in nameValues: if compn: self.nameValues.insert(top, PropNameValue(self, self.panelNames, self.panelValues, compn, rootCompn, nameValue.name, nameValue, top, indent, compn.getPropEditor(nameValue.name), compn.getPropOptions(nameValue.name), compn.getPropNames(nameValue.name))) top = top + 1 self.refreshSplitter() def extendHelpUrl(self, url): if self.prevSel: suburl = 'get'+string.lower(self.prevSel.name) return url + ' def readObject(self, propList): self.setNameValues(self.inspector.selCmp, self.inspector.selCmp, propList, 0, 0) height = len(self.nameValues) self.SetScrollbars(oiLineHeight, oiLineHeight, 0, height + 1) def expand(self, nameValue): obj = self.nameValues[nameValue.idx].propValue if PaletteMapping.helperClasses.has_key(obj.__class__.__name__): compn = PaletteMapping.helperClasses[obj.__class__.__name__]\ (nameValue.propName, None, self.inspector.selObj, obj) propLst = RTTI.getPropList(obj, compn)['properties'] sze = len(propLst) indt = self.nameValues[nameValue.idx].indent + 1 startIdx = nameValue.idx + 1 for idx in range(startIdx, len(self.nameValues)): self.nameValues[idx].setPos(idx +sze) self.setNameValues(compn, self.inspector.selCmp, propLst, startIdx, indt)
def OnEnter(self, event): for nv in self.nameValues: if nv.editing: nv.propEditor.inspectorPost(false)
self.refreshSplitter() nameValue.propEditor.expanded = false def OnEnter(self, event): for nv in self.nameValues: if nv.editing: nv.propEditor.inspectorPost(false) def OnUndo(self, event): pass def OnCrsUp(self, event): if len(self.nameValues) > 1: for idx in range(1, len(self.nameValues)): if self.nameValues[idx].editing: self.propertySelected(self.nameValues[idx-1]) break else: self.propertySelected(self.nameValues[0]) x, y = self.GetViewStart() if y >= idx: self.Scroll(x, y-1) def OnCrsDown(self, event): if len(self.nameValues) > 1: for idx in range(len(self.nameValues)-1): if self.nameValues[idx].editing: self.propertySelected(self.nameValues[idx+1]) break else: self.propertySelected(self.nameValues[-1]) dx, dy = self.GetScrollPixelsPerUnit() cs = self.GetClientSize() x, y = self.GetViewStart() if y <= idx + 1 - cs.y / dy: self.Scroll(x, y+1) class InspectorPropScrollWin(InspectorScrollWin): """ Specialised InspectorScrollWin that understands properties """ def setNameValues(self, compn, rootCompn, nameValues, insIdx, indent, ownerPropEdit = None): top = insIdx for nameValue in nameValues: if compn: self.nameValues.insert(top, PropNameValue(self, self.panelNames, self.panelValues, compn, rootCompn, nameValue.name, nameValue, top, indent, compn.getPropEditor(nameValue.name), compn.getPropOptions(nameValue.name), compn.getPropNames(nameValue.name), ownerPropEdit)) top = top + 1 self.refreshSplitter() def extendHelpUrl(self, url): if self.prevSel: suburl = 'get'+string.lower(self.prevSel.name) return url + ' def readObject(self, propList): self.setNameValues(self.inspector.selCmp, self.inspector.selCmp, propList, 0, 0) def expand(self, nameValue): nv = self.nameValues[nameValue.idx] obj = nv.propValue compn = nv.propEditor.getSubCompanion()\ (nameValue.propName, self.inspector.selCmp.designer, self.inspector.selCmp, obj, nv.propEditor.propWrapper) compn.updateObjFromOwner() propLst = compn.getPropList()['properties'] sze = len(propLst) indt = self.nameValues[nameValue.idx].indent + 1 startIdx = nameValue.idx + 1 for idx in range(startIdx, len(self.nameValues)): self.nameValues[idx].setPos(idx +sze) self.setNameValues(compn, self.inspector.selCmp, propLst, startIdx, indt, nv.propEditor) nv.propEditor.expanded = true nv.updateDisplayValue()
def collapse(self, nameValue): # delete all NameValues until the same indent, count them startIndent = nameValue.indent idx = nameValue.idx + 1 # Move deletion into method and use in removeEvent of EventWindow i = idx if i < len(self.nameValues): while (i < len(self.nameValues)) and \ (self.nameValues[i].indent > startIndent): i = i + 1 count = i - idx self.deleteNameValues(idx, count)
def readObject(self, constrList):
def readObject(self, constrList): params = self.inspector.selCmp.constructor() paramNames = params.keys() paramNames.sort() compn = self.inspector.selCmp self.addParams(constrList, paramNames, compn, compn) self.refreshSplitter() def addParams(self, constrList, paramNames, compn, rootCompn, indent = 0, insIdx = -1):
def readObject(self, constrList): def findInConstrLst(name, constrList): for constr in constrList: if constr.name == name: return constr return None
params = self.inspector.selCmp.constructor() paramNames = params.keys() paramNames.sort()
def findInConstrLst(name, constrList): for constr in constrList: if constr.name == name: return constr return None
self.addProp(param, propWrap)
self.addProp(param, compn, rootCompn, propWrap, indent)
def findInConstrLst(name, constrList): for constr in constrList: if constr.name == name: return constr return None
self.addConstr(param) self.refreshSplitter() def addConstr(self, name): compn = self.inspector.selCmp
self.addConstr(param, compn, rootCompn, indent) def expand(self, nameValue): nv = self.nameValues[nameValue.idx] obj = nv.propValue compn = nv.propEditor.getSubCompanion()\ (nameValue.propName, self.inspector.selCmp.designer, self.inspector.selCmp, obj, nv.propEditor.propWrapper) propLst = compn.getPropList()['properties'] sze = len(propLst) indt = self.nameValues[nameValue.idx].indent + 1 startIdx = nameValue.idx + 1 for idx in range(startIdx, len(self.nameValues)): self.nameValues[idx].setPos(idx +sze) for propWrap in propLst: if propWrap: self.addProp(propWrap.name, compn, self.inspector.selCmp, propWrap, indt, startIdx, nv.propEditor) startIdx = startIdx + 1 nv.propEditor.expanded = true nv.updateDisplayValue() self.refreshSplitter() def addConstr(self, name, compn, rootCompn, indent = 0, insIdx = -1):
def findInConstrLst(name, constrList): for constr in constrList: if constr.name == name: return constr return None
self.nameValues.insert(len(self.nameValues), ConstrNameValue(self, self.panelNames, self.panelValues, self.inspector.selCmp, self.inspector.selCmp, name, propWrap, len(self.nameValues), 0,
if insIdx == -1: insIdx = len(self.nameValues) self.nameValues.insert(insIdx, ConstrNameValue(self, self.panelNames, self.panelValues, compn, rootCompn, name, propWrap, insIdx, indent,
def addConstr(self, name): compn = self.inspector.selCmp props = compn.properties() if props.has_key(name): rType, getter, setter = props[name] propWrap = RTTI.PropertyWrapper(name, rType, getter, setter) else: propWrap = RTTI.PropertyWrapper(name, 'NoneRoute', None, None) self.nameValues.insert(len(self.nameValues), ConstrNameValue(self, self.panelNames, self.panelValues, self.inspector.selCmp, self.inspector.selCmp, name, propWrap, len(self.nameValues), 0, compn.getPropEditor(name), compn.getPropOptions(name), compn.getPropNames(name)))
def addProp(self, name, propWrap): compn = self.inspector.selCmp self.nameValues.insert(len(self.nameValues),
def addProp(self, name, compn, rootCompn, propWrap, indent = 0, insIdx = -1, ownerPropEdit = None): if insIdx == -1: insIdx = len(self.nameValues) self.nameValues.insert(insIdx,
def addProp(self, name, propWrap): compn = self.inspector.selCmp self.nameValues.insert(len(self.nameValues), PropNameValue(self, self.panelNames, self.panelValues, compn, compn, name, propWrap, len(self.nameValues), 0, compn.getPropEditor(name), compn.getPropOptions(name), compn.getPropNames(name)))
compn, compn, name, propWrap, len(self.nameValues), 0,
compn, rootCompn, name, propWrap, insIdx, indent,
def addProp(self, name, propWrap): compn = self.inspector.selCmp self.nameValues.insert(len(self.nameValues), PropNameValue(self, self.panelNames, self.panelValues, compn, compn, name, propWrap, len(self.nameValues), 0, compn.getPropEditor(name), compn.getPropOptions(name), compn.getPropNames(name)))
compn.getPropNames(name)))
compn.getPropNames(name), ownerPropEdit))
def addProp(self, name, propWrap): compn = self.inspector.selCmp self.nameValues.insert(len(self.nameValues), PropNameValue(self, self.panelNames, self.panelValues, compn, compn, name, propWrap, len(self.nameValues), 0, compn.getPropEditor(name), compn.getPropOptions(name), compn.getPropNames(name)))
self.SetScrollbars(oiLineHeight, oiLineHeight, 0, height + 1) self.refreshSplitter()
self.refreshSplitter()
def readObject(self):
sys.stdout = ShellEditor.PseudoFileOutStore()
sys.stdout = Utils.PseudoFileOutStore()
def getModelData(self): try: code = compile(self.model.data, self.model.filename, 'exec') except: oldOut = sys.stdout sys.stdout = ShellEditor.PseudoFileOutStore() try: print "''' Code does not compile\n\n Disassembly of Traceback:\n'''" try: dis.distb(sys.exc_info()[2]) except: print "''' Could not disassemble traceback '''\n" return sys.stdout.read() finally: sys.stdout = oldOut
def defaultAction(self): self.designer.inspector.props.getNameValue('Images').propEditor.edit(None)
def designTimeSource(self): return {'width': '16', 'height': '16'}
self.editors.update({'Bitmap': BitmapConstrPropEdit, 'Mask': BitmapConstrPropEdit})
self.editors = {'Bitmap': BitmapConstrPropEdit, 'Mask': BitmapConstrPropEdit}
def __init__(self, name, designer, parentCompanion, ctrl): CollectionDTC.__init__(self, name, designer, parentCompanion, ctrl) self.editors.update({'Bitmap': BitmapConstrPropEdit, 'Mask': BitmapConstrPropEdit}) from Views.CollectionEdit import ImageListCollectionEditor self.CollEditorFrame = ImageListCollectionEditor
class AcceleratorTableDTC(ChoicesConstr, UtilityDTC):
class AcceleratorTableDTC(ChoicesConstr, NYIDTC):
def designTimeSource(self): return {}
print 'ATCollectionDTC'
def SetName(self, oldName, newName): print 'ATCollectionDTC' CollectionDTC.SetName(self, oldName, newName)
class ImageListImagesCDTC(ImageListImagesConstr, CollectionDTC): wxDocs = HelpCompanions.wxImageListDocs propName = 'Images' displayProp = 'bitmap' indexProp = '(None)' insertionMethod = 'Add' deletionMethod = 'Remove' def __init__(self, name, designer, parentCompanion, ctrl): CollectionDTC.__init__(self, name, designer, parentCompanion, ctrl) self.editors = {'Bitmap': BitmapConstrPropEdit, 'Mask': BitmapConstrPropEdit} from Views.CollectionEdit import ImageListCollectionEditor self.CollEditorFrame = ImageListCollectionEditor def properties(self): props = CollectionDTC.properties(self) props.update({'Bitmap': ('CompnRoute', None, self.setBitmap), 'Mask': ('NoneRoute', None, None)}) return props def designTimeSource(self, wId): return {'bitmap': 'wxNullBitmap', 'mask': 'wxNullBitmap'} def getDisplayProp(self): value = self.textConstrLst[self.index].params[self.displayProp] if value != 'wxNullBitmap': value = os.path.basename(value[10:-21]) return value def setBitmap(self, value): if value != wxNullBitmap: self.control.Replace(self.index, value) self.designer.collEditors[(self.name, self.propName)].refreshCtrl(true)
def applyDesignTimeDefaults(self, params): return
print name, name[:4]
def designTimeDefaults(self, vals): dtd = {} for param in vals.keys(): if param == 'menu': name = vals[param] if name[:4] == 'self': dtd[param] = self.designer.objects[name[5:]][1] elif name == 'wxMenu()': dtd[param] = wxMenu() else: print name, name[:4] raise 'Invalid menu reference' else: try: dtd[param] = eval(vals[param]) except Exception, message: print 'could not eval 4', vals[param], message return dtd
print 'MenuBarMenusCDTC.GetMenu'
def GetMenu(self): print 'MenuBarMenusCDTC.GetMenu' return self.textConstrLst[self.index].params['menu']
print 'MenuBarMenusCDTC.SetMenu'
def SetMenu(self, value): print 'MenuBarMenusCDTC.SetMenu' self.textConstrLst[self.index].params['menu'] = value
print 'OwnedCollectionDTC'
def SetName(self, oldName, newName): print 'OwnedCollectionDTC' CollectionDTC.SetName(self, oldName, newName)
print 'redefined OwnedColl'
def SetName(self, oldName, newName): print 'OwnedCollectionDTC' CollectionDTC.SetName(self, oldName, newName)
print 'apply constraints', self.parentCompanion.control
def applyConstraints(self): nullConstr = ['wxUnconstrained'] print 'apply constraints', self.parentCompanion.control if self.inited and len(self.textConstrLst) >= 4: constraints = wxLayoutConstraints() validConstr = 0 for constrt in self.textConstrLst: if constrt.params['rel'] not in nullConstr: validConstr = validConstr + 1 if validConstr == 4: print 'appling constraints' for constrt in self.textConstrLst: params = copy.copy(constrt.params) otherWin = params['otherWin'][5:] print 'adtd', otherWin if params['otherWin'] == 'None': params = self.designTimeDefaults(params) elif self.designer.objects.has_key(otherWin): del params['otherWin'] params = self.designTimeDefaults(params) if otherWin == 'self': params['otherWin'] = self.designer.objects[''][1] else: params['otherWin'] = self.designer.objects[otherWin][1] print 'setting attr', params attr = getattr(constraints, string.split(constrt.comp_name, '.')[1]) apply(attr.Set, [], params) self.parentCompanion.control.SetConstraints(constraints) print 'applied constraints'
print 'appling constraints'
def applyConstraints(self): nullConstr = ['wxUnconstrained'] print 'apply constraints', self.parentCompanion.control if self.inited and len(self.textConstrLst) >= 4: constraints = wxLayoutConstraints() validConstr = 0 for constrt in self.textConstrLst: if constrt.params['rel'] not in nullConstr: validConstr = validConstr + 1 if validConstr == 4: print 'appling constraints' for constrt in self.textConstrLst: params = copy.copy(constrt.params) otherWin = params['otherWin'][5:] print 'adtd', otherWin if params['otherWin'] == 'None': params = self.designTimeDefaults(params) elif self.designer.objects.has_key(otherWin): del params['otherWin'] params = self.designTimeDefaults(params) if otherWin == 'self': params['otherWin'] = self.designer.objects[''][1] else: params['otherWin'] = self.designer.objects[otherWin][1] print 'setting attr', params attr = getattr(constraints, string.split(constrt.comp_name, '.')[1]) apply(attr.Set, [], params) self.parentCompanion.control.SetConstraints(constraints) print 'applied constraints'
print 'adtd', otherWin
def applyConstraints(self): nullConstr = ['wxUnconstrained'] print 'apply constraints', self.parentCompanion.control if self.inited and len(self.textConstrLst) >= 4: constraints = wxLayoutConstraints() validConstr = 0 for constrt in self.textConstrLst: if constrt.params['rel'] not in nullConstr: validConstr = validConstr + 1 if validConstr == 4: print 'appling constraints' for constrt in self.textConstrLst: params = copy.copy(constrt.params) otherWin = params['otherWin'][5:] print 'adtd', otherWin if params['otherWin'] == 'None': params = self.designTimeDefaults(params) elif self.designer.objects.has_key(otherWin): del params['otherWin'] params = self.designTimeDefaults(params) if otherWin == 'self': params['otherWin'] = self.designer.objects[''][1] else: params['otherWin'] = self.designer.objects[otherWin][1] print 'setting attr', params attr = getattr(constraints, string.split(constrt.comp_name, '.')[1]) apply(attr.Set, [], params) self.parentCompanion.control.SetConstraints(constraints) print 'applied constraints'
print 'setting attr', params
def applyConstraints(self): nullConstr = ['wxUnconstrained'] print 'apply constraints', self.parentCompanion.control if self.inited and len(self.textConstrLst) >= 4: constraints = wxLayoutConstraints() validConstr = 0 for constrt in self.textConstrLst: if constrt.params['rel'] not in nullConstr: validConstr = validConstr + 1 if validConstr == 4: print 'appling constraints' for constrt in self.textConstrLst: params = copy.copy(constrt.params) otherWin = params['otherWin'][5:] print 'adtd', otherWin if params['otherWin'] == 'None': params = self.designTimeDefaults(params) elif self.designer.objects.has_key(otherWin): del params['otherWin'] params = self.designTimeDefaults(params) if otherWin == 'self': params['otherWin'] = self.designer.objects[''][1] else: params['otherWin'] = self.designer.objects[otherWin][1] print 'setting attr', params attr = getattr(constraints, string.split(constrt.comp_name, '.')[1]) apply(attr.Set, [], params) self.parentCompanion.control.SetConstraints(constraints) print 'applied constraints'
print 'applied constraints'
def applyConstraints(self): nullConstr = ['wxUnconstrained'] print 'apply constraints', self.parentCompanion.control if self.inited and len(self.textConstrLst) >= 4: constraints = wxLayoutConstraints() validConstr = 0 for constrt in self.textConstrLst: if constrt.params['rel'] not in nullConstr: validConstr = validConstr + 1 if validConstr == 4: print 'appling constraints' for constrt in self.textConstrLst: params = copy.copy(constrt.params) otherWin = params['otherWin'][5:] print 'adtd', otherWin if params['otherWin'] == 'None': params = self.designTimeDefaults(params) elif self.designer.objects.has_key(otherWin): del params['otherWin'] params = self.designTimeDefaults(params) if otherWin == 'self': params['otherWin'] = self.designer.objects[''][1] else: params['otherWin'] = self.designer.objects[otherWin][1] print 'setting attr', params attr = getattr(constraints, string.split(constrt.comp_name, '.')[1]) apply(attr.Set, [], params) self.parentCompanion.control.SetConstraints(constraints) print 'applied constraints'
print 'append item'
def appendItem(self): print 'append item' if len(self.textConstrLst) == 4: raise 'Only 4 constraints allowed' ai = self.availableItems() if not ai: raise 'All constraints set' self.sourceObjName = '%s.%s'%(self.__class__.sourceObjName, ai[0]) OwnedCollectionDTC.appendItem(self) self.applyConstraints()
print 'applying', f, self.control
def deleteItem(self, idx): # remove from ctrl if self.deletionMethod != '(None)': f = RTTI.getFunction(self.control, self.deletionMethod) print 'applying', f, self.control apply(f, [self.control, idx]) del self.textConstrLst[idx] # renumber items following deleted one if self.indexProp != '(None)': for constr in self.textConstrLst[idx:]: constr.params[self.indexProp] = `int(constr.params[self.indexProp]) -1`
print 'adtd', otherWin
def applyDesignTimeDefaults(self, params): return attr = getattr(self.constraints, string.split(self.textConstrLst[self.index].comp_name, '.')[1]) params = copy.copy(params) otherWin = params['otherWin'][5:] print 'adtd', otherWin if params['otherWin'] == 'None': params = self.designTimeDefaults(params) elif self.designer.objects.has_key(otherWin): del params['otherWin'] params = self.designTimeDefaults(params) if otherWin == 'self': params['otherWin'] = self.designer.objects[''][1] else: params['otherWin'] = self.designer.objects[otherWin][1] print 'setting attr', params apply(attr.Set, [], params)
print 'setting attr', params
def applyDesignTimeDefaults(self, params): return attr = getattr(self.constraints, string.split(self.textConstrLst[self.index].comp_name, '.')[1]) params = copy.copy(params) otherWin = params['otherWin'][5:] print 'adtd', otherWin if params['otherWin'] == 'None': params = self.designTimeDefaults(params) elif self.designer.objects.has_key(otherWin): del params['otherWin'] params = self.designTimeDefaults(params) if otherWin == 'self': params['otherWin'] = self.designer.objects[''][1] else: params['otherWin'] = self.designer.objects[otherWin][1] print 'setting attr', params apply(attr.Set, [], params)
print 'GetEdge', self.index, self.textConstrLst
def GetEdge(self): print 'GetEdge', self.index, self.textConstrLst return self.textConstrLst[self.index].comp_name
print 'INITCOLLECTION'
def initCollection(self): print 'INITCOLLECTION' self.inited = true self.applyConstraints()
otherApp = AppModel('', self.compareTo, '', self.model.editor, true)
otherApp = AppModel('', self.compareTo, '', self.model.editor, true, {})
def refreshCtrl(self): ListCtrlView.refreshCtrl(self) from EditorModels import AppModel otherApp = AppModel('', self.compareTo, '', self.model.editor, true) otherApp.load() otherApp.readModules() i = 0
if not cmp(self.model.moduleFilename(module), otherFile): i = self.addReportItems(i, module, otherFile, 'changed')
try: if not cmp(self.model.moduleFilename(module), otherFile): i = self.addReportItems(i, module, otherFile, 'changed') except OSError: pass
def refreshCtrl(self): ListCtrlView.refreshCtrl(self) from EditorModels import AppModel otherApp = AppModel('', self.compareTo, '', self.model.editor, true) otherApp.load() otherApp.readModules() i = 0
'wxWidht', 'wxCentreX', 'wxCentreY']
'wxWidth', 'wxCentreX', 'wxCentreY']
def reverseDict(dict): rev = {} for k in dict.keys(): rev[dict[k]] = k return rev
('Attach to debugger', self.OnAttachToDebugger, '-', ''),
def actions(self, model): actions = [ ('-', None, '', ''), ('Import module into Shell', self.OnImportInShell, '-', ''), ('Reload module in Shell', self.OnReloadInShell, '-', ''), ('-', None, '', ''), ('Set command-line parameters', self.OnSetRunParams, '-', ''), ('Run application', self.OnRunApp, self.runAppBmp, 'RunApp'), ('Run module', self.OnRun, self.runBmp, 'RunMod'), ('Debug application', self.OnDebugApp, self.debugBmp, 'Debug'), ('Debug module', self.OnDebug, '-', ''), ('Attach to debugger', self.OnAttachToDebugger, '-', ''), ('Step in', self.OnDebugStepIn, '-', 'DebugStep'), ('Step over', self.OnDebugStepOver, '-', 'DebugOver'), ('Step out', self.OnDebugStepOut, '-', 'DebugOut'), ('-', None, '-', ''), ('Profile', self.OnProfile, self.profileBmp, ''), ('Check source', self.OnCheckSource, self.compileBmp, 'CheckSource'), ('Cyclops', self.OnCyclops, '-', ''), ('-', None, '', ''), ('Reindent whole file', self.OnReindent, '-', ''), ('-', None, '', '')]
actions.extend([ ('NDiff modules...', self.OnDiffModules, '-', ''), ('Run PyChecker', self.OnRunPyChecker, '-', ''), ('Configure PyChecker', self.OnConfigPyChecker, '-', '')])
try: imp.find_module('pychecker') except ImportError: pass else: actions.extend([ ('Run PyChecker', self.OnRunPyChecker, '-', ''), ('Configure PyChecker', self.OnConfigPyChecker, '-', '')])
def actions(self, model): actions = [ ('-', None, '', ''), ('Import module into Shell', self.OnImportInShell, '-', ''), ('Reload module in Shell', self.OnReloadInShell, '-', ''), ('-', None, '', ''), ('Set command-line parameters', self.OnSetRunParams, '-', ''), ('Run application', self.OnRunApp, self.runAppBmp, 'RunApp'), ('Run module', self.OnRun, self.runBmp, 'RunMod'), ('Debug application', self.OnDebugApp, self.debugBmp, 'Debug'), ('Debug module', self.OnDebug, '-', ''), ('Attach to debugger', self.OnAttachToDebugger, '-', ''), ('Step in', self.OnDebugStepIn, '-', 'DebugStep'), ('Step over', self.OnDebugStepOver, '-', 'DebugOver'), ('Step out', self.OnDebugStepOut, '-', 'DebugOut'), ('-', None, '-', ''), ('Profile', self.OnProfile, self.profileBmp, ''), ('Check source', self.OnCheckSource, self.compileBmp, 'CheckSource'), ('Cyclops', self.OnCyclops, '-', ''), ('-', None, '', ''), ('Reindent whole file', self.OnReindent, '-', ''), ('-', None, '', '')]
wxMessageBox('Stats file date unchanged!')
wxLogError('Stats file date unchanged, check for errors in script.')
def OnProfile(self, event): model = self.getModel() if self.checkUnsaved(model): return
wxMessageBox('Stats file not found')
wxLogError('Stats file not found, check for errors in script.')
def OnProfile(self, event): model = self.getModel() if self.checkUnsaved(model): return
def OnDiffModules(self, event=None, filename=''): model = self.getModel() if model: if self.checkUnsaved(model): return if not filename: filename = self.editor.openFileDlg() if filename: filename = model.assertLocalFile(filename) tbName = 'Diff with : '+filename if not model.views.has_key(tbName): from Views.DiffView import PythonSourceDiffView resultView = self.editor.addNewView(tbName, PythonSourceDiffView) else: resultView = model.views[tbName] resultView.tabName = tbName resultView.diffWith = filename resultView.refresh() resultView.focus()
def OnSwitchApp(self, event): model = self.getModel() if model and isinstance(model, PythonEditorModels.ModuleModel) and model.app: # does this ensure correct app is reconnected? appmodel, controller = self.editor.openOrGotoModule(model.app.filename)
import shutil shutil.copyfile(os.path.join(Preferences.pyPath, 'ExternalLib', 'PyChecker', 'pycheckrc'), appConfig)
from pychecker import Config open(appConfig, 'w').write(Config.outputRc(Config.Config()))
def OnConfigPyChecker(self, event): model = self.getModel() if model: home = os.environ.get('HOME') if home: appDir = home appConfig = home+'/.pycheckrc' else: filename = model.assertLocalFile() appDir = os.path.dirname(filename) appConfig = appDir+'/.pycheckrc' if not os.path.exists(appConfig): dlg = wxMessageDialog(self.editor, 'The PyChecker configuration file ' 'can not be found. Copy the default file here?', 'Config file not found', wxYES_NO | wxICON_QUESTION) try: if dlg.ShowModal() == wxID_YES: import shutil shutil.copyfile(os.path.join(Preferences.pyPath, 'ExternalLib', 'PyChecker', 'pycheckrc'), appConfig) else: return finally: dlg.Destroy()
def OnAttachToDebugger(self, event): from Debugger.RemoteDialog import create rmtDlg = create(self.editor) rmtDlg.ShowModal() rmtDlg.Destroy()
def OnTabNanny(self, event): model = self.getModel() if model: model.tabnanny()
Controllers.DefaultController = ModuleController Controllers.DefaultModel = PythonEditorModels.ModuleModel Controllers.defaultExt = PythonEditorModels.ModuleModel.ext
def OnSetupPy2Exe(self, event): self.runDistUtilsCmd('py2exe')
FileExplorer.PyFileNode.subExplorerReg['folder'].append( (FileExplorer.PyFileNode, isPackage, PythonEditorModels.PackageModel.imgIdx),
FileExplorer.FileSysNode.subExplorerReg['folder'].append( (FileExplorer.FileSysNode, isPackage, PythonEditorModels.PackageModel.imgIdx),
def isPackage(filename): return os.path.exists(os.path.join(filename, PythonEditorModels.PackageModel.pckgIdnt))
return FileExplorer.PyFileNode(os.path.basename(defaultDir), defaultDir,
return FileExplorer.FileSysNode(os.path.basename(defaultDir), defaultDir,
def newFileNode(self, defaultDir): return FileExplorer.PyFileNode(os.path.basename(defaultDir), defaultDir, None, EditorHelper.imgFolder, None, None)