def SetStepMarker(self, fileName, lineNo): self.editor = PyStudioUtils.GetEditorOrOpenFile(self.mainwindow, fileName) if not self.editor: util.Log("[PyStudio][err] Unable to get editor for file: %s" % fileName) return self.editorlineno = lineNo - 1 self.editor.GotoLine(self.editorlineno) self.editor.ShowStepMarker(self.editorlineno, show=True)
def DoItemActivated(self, item): """Override to handle item activation @param item: TreeItem """ path = self.GetPyData(item) if path and os.path.exists(path): if not os.path.isdir(path): PyStudioUtils.GetEditorOrOpenFile(self.Parent.MainWindow, path)
def OnItemActivated(self, evt): """Go to the file""" idx = evt.GetIndex() fileName = self.GetItem(idx, BreakPointsList.COL_FILE).GetText() if not fileName: return editor = PyStudioUtils.GetEditorOrOpenFile(self._mainw, fileName) if editor: try: lineno = int( self.GetItem(idx, BreakPointsList.COL_LINE).GetText()) editor.GotoLine(lineno - 1) except ValueError: pass
def LoadData(self, data, fname=None): """Load data into the cache and display it in the list @param fname: filename @param data: Lint data [(errorType, errorText, errorLine),] """ if fname is None: if not self.editor: return # TODO: Log fname = self.editor.GetFileName() else: self.editor = PyStudioUtils.GetEditorOrOpenFile(self._mw, fname) CheckResultsList._cache[fname] = LintData(data) self._PopulateRows(CheckResultsList._cache[fname])
def OnContextMenu(self, evt): """Handle context menu events""" e_id = evt.Id path = self._menu.GetUserData('path') dname = path if not os.path.isdir(path): dname = os.path.dirname(path) if e_id == ProjectTree.ID_EDIT_FILE: PyStudioUtils.GetEditorOrOpenFile(self.Parent.MainWindow, path) elif e_id in (ProjectTree.ID_OPEN_FILE, ProjectTree.ID_REVEL_FILE): self.OpenPathWithFM(path, revel=(e_id == ProjectTree.ID_REVEL_FILE)) elif e_id == ProjectTree.ID_NEW_FILE: self.CreateNewFile(dname) elif e_id in (ProjectTree.ID_NEW_FOLDER, ProjectTree.ID_NEW_PACKAGE): self.CreateNewFolder(dname, e_id == ProjectTree.ID_NEW_PACKAGE) elif e_id == ed_glob.ID_DELETE: # TODO need error handling? if dname == path: cmsg = _( "Are you sure you want to delete '%s' and all of its contents?" ) else: cmsg = _("Are you sure you want to delete '%s'?") name = os.path.basename(path) result = wx.MessageBox(cmsg % name, _("Delete?"), style=wx.YES_NO | wx.CENTER | wx.ICON_QUESTION) if result == wx.YES: self.FileController.MoveToTrash(path) elif e_id == ProjectTree.ID_RENAME_FILE: item = self._menu.GetUserData('itemId') if item: self.EditLabel(item) elif e_id == ProjectTree.ID_PROPERTIES: pass # TODO: project properties dialog else: # Handle Custom Menu options handler = self._menu.GetHandler(e_id) if handler: handler(path)
def OnFrameSelected(self, evt): index = evt.GetIndex() if self.previndex == index: return filename = self.GetItem(index, StackFrameList.COL_FILE).GetText() if index > self.GetItemCount() - 4: if filename and os.path.basename(filename) == "rpdb2.py": return self.previndex = index RpdbDebugger().set_frameindex(index) if not filename: return editor = PyStudioUtils.GetEditorOrOpenFile(self._mainw, filename) if editor: try: lineno = int( self.GetItem(index, StackFrameList.COL_LINE).GetText()) editor.GotoLine(lineno - 1) except ValueError: util.Log("[PyStudio][err] StackFrame: failed to jump to file")
def OnItemActivate(self, evt): """Go to the file""" idx = evt.GetIndex() fname = self.GetItem(idx, 0).GetText() if os.path.exists(fname): PyStudioUtils.GetEditorOrOpenFile(self._mainw, fname)