Tue, 09 Apr 2024 14:27:03 +0200
Editor Outline, File Browser, Project Browser
- Improved the navigation capability by respecting the column offset when placing the cursor of the editor (see issue 554).
--- a/docs/changelog.md Mon Apr 08 17:02:11 2024 +0200 +++ b/docs/changelog.md Tue Apr 09 14:27:03 2024 +0200 @@ -5,6 +5,15 @@ - Editor - Added the capability to reload the current editor via its context menu or the main `File` menu (see issue 556). +- Editor Outline + - Improved the navigation capability by respecting the column offset when + placing the cursor of the editor (see issue 554). +- File Browser + - Improved the navigation capability by respecting the column offset when + placing the cursor of the editor (see issue 554). +- Project Browser + - Improved the navigation capability by respecting the column offset when + placing the cursor of the editor (see issue 554). - Symbols Viewer - Completed the list of selectable code blocks.
--- a/src/eric7/APIs/Python3/eric7.api Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/APIs/Python3/eric7.api Tue Apr 09 14:27:03 2024 +0200 @@ -10356,6 +10356,7 @@ eric7.UI.Browser.Browser.wantedItem?4(itm, filterList=None) eric7.UI.Browser.Browser?1(parent=None) eric7.UI.BrowserModel.BrowserClassAttributeItem.attributeObject?4() +eric7.UI.BrowserModel.BrowserClassAttributeItem.colOffset?4() eric7.UI.BrowserModel.BrowserClassAttributeItem.fileName?4() eric7.UI.BrowserModel.BrowserClassAttributeItem.isPublic?4() eric7.UI.BrowserModel.BrowserClassAttributeItem.lessThan?4(other, column, order) @@ -10369,6 +10370,7 @@ eric7.UI.BrowserModel.BrowserClassAttributesItem?1(parent, attributes, text, isClass=False) eric7.UI.BrowserModel.BrowserClassItem.boundaries?4() eric7.UI.BrowserModel.BrowserClassItem.classObject?4() +eric7.UI.BrowserModel.BrowserClassItem.colOffset?4() eric7.UI.BrowserModel.BrowserClassItem.fileName?4() eric7.UI.BrowserModel.BrowserClassItem.isPublic?4() eric7.UI.BrowserModel.BrowserClassItem.lessThan?4(other, column, order) @@ -10418,6 +10420,7 @@ eric7.UI.BrowserModel.BrowserItem.child?4(row) eric7.UI.BrowserModel.BrowserItem.childCount?4() eric7.UI.BrowserModel.BrowserItem.children?4() +eric7.UI.BrowserModel.BrowserItem.colOffset?4() eric7.UI.BrowserModel.BrowserItem.columnCount?4() eric7.UI.BrowserModel.BrowserItem.data?4(column) eric7.UI.BrowserModel.BrowserItem.getIcon?4() @@ -10426,6 +10429,7 @@ eric7.UI.BrowserModel.BrowserItem.isPublic?4() eric7.UI.BrowserModel.BrowserItem.isSymlink?4() eric7.UI.BrowserModel.BrowserItem.lessThan?4(other, column, order) +eric7.UI.BrowserModel.BrowserItem.lineno?4() eric7.UI.BrowserModel.BrowserItem.parent?4() eric7.UI.BrowserModel.BrowserItem.removeChild?4(child) eric7.UI.BrowserModel.BrowserItem.removeChildren?4() @@ -10448,6 +10452,7 @@ eric7.UI.BrowserModel.BrowserItemType.SimpleDirectory?7 eric7.UI.BrowserModel.BrowserItemType.SysPath?7 eric7.UI.BrowserModel.BrowserMethodItem.boundaries?4() +eric7.UI.BrowserModel.BrowserMethodItem.colOffset?4() eric7.UI.BrowserModel.BrowserMethodItem.fileName?4() eric7.UI.BrowserModel.BrowserMethodItem.functionObject?4() eric7.UI.BrowserModel.BrowserMethodItem.isPublic?4() @@ -10907,8 +10912,8 @@ eric7.Utilities.BackgroundService.BackgroundService?1(parent=None) eric7.Utilities.ClassBrowsers.ClassBrowserRegistry?7 eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Attribute.addAssignment?4(lineno) -eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Attribute?1(module, name, file, lineno) -eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Class?1(module, name, superClasses, file, lineno) +eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Attribute?1(module, name, file, lineno, col_offset=0) +eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Class?1(module, name, superClasses, file, lineno, col_offset=0) eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrBase._addattribute?5(attr) eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrBase._addclass?5(name, _class) eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrBase._addglobal?5(attr) @@ -10916,7 +10921,7 @@ eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrBase._getattribute?5(name) eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrBase._getglobal?5(name) eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrBase._getmethod?5(name) -eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrBase?1(module, name, file, lineno) +eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrBase?1(module, name, file, lineno, col_offset=0) eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrVisibilityMixinBase.isPrivate?4() eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrVisibilityMixinBase.isProtected?4() eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrVisibilityMixinBase.isPublic?4() @@ -10924,14 +10929,14 @@ eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrVisibilityMixinBase.setProtected?4() eric7.Utilities.ClassBrowsers.ClbrBaseClasses.ClbrVisibilityMixinBase.setPublic?4() eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Coding?1(module, file, lineno, coding) -eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Enum?1(module, name, file, lineno) +eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Enum?1(module, name, file, lineno, col_offset=0) eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Function.Class?7 eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Function.General?7 eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Function.Static?7 -eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Function?1(module, name, file, lineno, signature="", separator=", ", modifierType=General, annotation="", ) -eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Module?1(module, name, file, lineno) +eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Function?1(module, name, file, lineno, col_offset=0, signature="", separator=", ", modifierType=General, annotation="", ) +eric7.Utilities.ClassBrowsers.ClbrBaseClasses.Module?1(module, name, file, lineno, col_offset=0) eric7.Utilities.ClassBrowsers.ClbrBaseClasses._ClbrBase.setEndLine?4(endLineNo) -eric7.Utilities.ClassBrowsers.ClbrBaseClasses._ClbrBase?2(module, name, file, lineno) +eric7.Utilities.ClassBrowsers.ClbrBaseClasses._ClbrBase?2(module, name, file, lineno, col_offset=0) eric7.Utilities.ClassBrowsers.PTL_SOURCE?7 eric7.Utilities.ClassBrowsers.PY_SOURCE?7 eric7.Utilities.ClassBrowsers.RB_SOURCE?7 @@ -10940,9 +10945,9 @@ eric7.Utilities.ClassBrowsers.getClassBrowserModule?4(moduleType) eric7.Utilities.ClassBrowsers.getIcon?4(filename) eric7.Utilities.ClassBrowsers.isSupportedType?4(fileext) -eric7.Utilities.ClassBrowsers.pyclbr.Attribute?1(module, name, file, lineno) -eric7.Utilities.ClassBrowsers.pyclbr.Class?1(module, name, superClasses, file, lineno) -eric7.Utilities.ClassBrowsers.pyclbr.Function?1(module, name, file, lineno, signature="", separator=", ", modifierType=ClbrBaseClasses.Function.General, annotation="", ) +eric7.Utilities.ClassBrowsers.pyclbr.Attribute?1(module, name, file, lineno, col_offset=0) +eric7.Utilities.ClassBrowsers.pyclbr.Class?1(module, name, superClasses, file, lineno, col_offset=0) +eric7.Utilities.ClassBrowsers.pyclbr.Function?1(module, name, file, lineno, col_offset=0, signature="", separator=", ", modifierType=ClbrBaseClasses.Function.General, annotation="", ) eric7.Utilities.ClassBrowsers.pyclbr.ImportedModule.addImport?4(lineno, importedNames) eric7.Utilities.ClassBrowsers.pyclbr.ImportedModule?1(module, file, importedModule) eric7.Utilities.ClassBrowsers.pyclbr.Imports.addImport?4(moduleName, names, lineno) @@ -10963,10 +10968,10 @@ eric7.Utilities.ClassBrowsers.pyclbr.calculateEndline?4(lineno, lines, indent) eric7.Utilities.ClassBrowsers.pyclbr.readmodule_ex?4(module, path=None, isTypeFile=False) eric7.Utilities.ClassBrowsers.pyclbr.scan?4(src, file, module) -eric7.Utilities.ClassBrowsers.rbclbr.Attribute?1(module, name, file, lineno) -eric7.Utilities.ClassBrowsers.rbclbr.Class?1(module, name, superClasses, file, lineno) -eric7.Utilities.ClassBrowsers.rbclbr.Function?1(module, name, file, lineno, signature="", separator=", ") -eric7.Utilities.ClassBrowsers.rbclbr.Module?1(module, name, file, lineno) +eric7.Utilities.ClassBrowsers.rbclbr.Attribute?1(module, name, file, lineno, col_offset=0) +eric7.Utilities.ClassBrowsers.rbclbr.Class?1(module, name, superClasses, file, lineno, col_offset=0) +eric7.Utilities.ClassBrowsers.rbclbr.Function?1(module, name, file, lineno, col_offset=0, signature="", separator=", ") +eric7.Utilities.ClassBrowsers.rbclbr.Module?1(module, name, file, lineno, col_offset=0) eric7.Utilities.ClassBrowsers.rbclbr.SUPPORTED_TYPES?7 eric7.Utilities.ClassBrowsers.rbclbr.VisibilityMixin?1() eric7.Utilities.ClassBrowsers.rbclbr._commentsub?8 @@ -11388,6 +11393,7 @@ eric7.ViewManager.ViewManager.ViewManager.nextSplit?4() eric7.ViewManager.ViewManager.ViewManager.openFiles?4(prog) eric7.ViewManager.ViewManager.ViewManager.openSourceFile?4(fn, lineno=-1, filetype="", selStart=0, selEnd=0, pos=0, addNext=False, indexes=None, ) +eric7.ViewManager.ViewManager.ViewManager.openSourceFileLinePos?4(fn, lineno, pos) eric7.ViewManager.ViewManager.ViewManager.preferencesChanged?4() eric7.ViewManager.ViewManager.ViewManager.prevSplit?4() eric7.ViewManager.ViewManager.ViewManager.previewStateChanged?7
--- a/src/eric7/Documentation/Help/source.qhp Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Help/source.qhp Tue Apr 09 14:27:03 2024 +0200 @@ -2653,6 +2653,7 @@ <keyword name="BrowserClassAttributeItem" id="BrowserClassAttributeItem" ref="eric7.UI.BrowserModel.html#BrowserClassAttributeItem" /> <keyword name="BrowserClassAttributeItem (Constructor)" id="BrowserClassAttributeItem (Constructor)" ref="eric7.UI.BrowserModel.html#BrowserClassAttributeItem.__init__" /> <keyword name="BrowserClassAttributeItem.attributeObject" id="BrowserClassAttributeItem.attributeObject" ref="eric7.UI.BrowserModel.html#BrowserClassAttributeItem.attributeObject" /> + <keyword name="BrowserClassAttributeItem.colOffset" id="BrowserClassAttributeItem.colOffset" ref="eric7.UI.BrowserModel.html#BrowserClassAttributeItem.colOffset" /> <keyword name="BrowserClassAttributeItem.fileName" id="BrowserClassAttributeItem.fileName" ref="eric7.UI.BrowserModel.html#BrowserClassAttributeItem.fileName" /> <keyword name="BrowserClassAttributeItem.isPublic" id="BrowserClassAttributeItem.isPublic" ref="eric7.UI.BrowserModel.html#BrowserClassAttributeItem.isPublic" /> <keyword name="BrowserClassAttributeItem.lessThan" id="BrowserClassAttributeItem.lessThan" ref="eric7.UI.BrowserModel.html#BrowserClassAttributeItem.lessThan" /> @@ -2668,6 +2669,7 @@ <keyword name="BrowserClassItem (Constructor)" id="BrowserClassItem (Constructor)" ref="eric7.UI.BrowserModel.html#BrowserClassItem.__init__" /> <keyword name="BrowserClassItem.boundaries" id="BrowserClassItem.boundaries" ref="eric7.UI.BrowserModel.html#BrowserClassItem.boundaries" /> <keyword name="BrowserClassItem.classObject" id="BrowserClassItem.classObject" ref="eric7.UI.BrowserModel.html#BrowserClassItem.classObject" /> + <keyword name="BrowserClassItem.colOffset" id="BrowserClassItem.colOffset" ref="eric7.UI.BrowserModel.html#BrowserClassItem.colOffset" /> <keyword name="BrowserClassItem.fileName" id="BrowserClassItem.fileName" ref="eric7.UI.BrowserModel.html#BrowserClassItem.fileName" /> <keyword name="BrowserClassItem.isPublic" id="BrowserClassItem.isPublic" ref="eric7.UI.BrowserModel.html#BrowserClassItem.isPublic" /> <keyword name="BrowserClassItem.lessThan" id="BrowserClassItem.lessThan" ref="eric7.UI.BrowserModel.html#BrowserClassItem.lessThan" /> @@ -2724,6 +2726,7 @@ <keyword name="BrowserItem.child" id="BrowserItem.child" ref="eric7.UI.BrowserModel.html#BrowserItem.child" /> <keyword name="BrowserItem.childCount" id="BrowserItem.childCount" ref="eric7.UI.BrowserModel.html#BrowserItem.childCount" /> <keyword name="BrowserItem.children" id="BrowserItem.children" ref="eric7.UI.BrowserModel.html#BrowserItem.children" /> + <keyword name="BrowserItem.colOffset" id="BrowserItem.colOffset" ref="eric7.UI.BrowserModel.html#BrowserItem.colOffset" /> <keyword name="BrowserItem.columnCount" id="BrowserItem.columnCount" ref="eric7.UI.BrowserModel.html#BrowserItem.columnCount" /> <keyword name="BrowserItem.data" id="BrowserItem.data" ref="eric7.UI.BrowserModel.html#BrowserItem.data" /> <keyword name="BrowserItem.getIcon" id="BrowserItem.getIcon" ref="eric7.UI.BrowserModel.html#BrowserItem.getIcon" /> @@ -2732,6 +2735,7 @@ <keyword name="BrowserItem.isPublic" id="BrowserItem.isPublic" ref="eric7.UI.BrowserModel.html#BrowserItem.isPublic" /> <keyword name="BrowserItem.isSymlink" id="BrowserItem.isSymlink" ref="eric7.UI.BrowserModel.html#BrowserItem.isSymlink" /> <keyword name="BrowserItem.lessThan" id="BrowserItem.lessThan" ref="eric7.UI.BrowserModel.html#BrowserItem.lessThan" /> + <keyword name="BrowserItem.lineno" id="BrowserItem.lineno" ref="eric7.UI.BrowserModel.html#BrowserItem.lineno" /> <keyword name="BrowserItem.parent" id="BrowserItem.parent" ref="eric7.UI.BrowserModel.html#BrowserItem.parent" /> <keyword name="BrowserItem.removeChild" id="BrowserItem.removeChild" ref="eric7.UI.BrowserModel.html#BrowserItem.removeChild" /> <keyword name="BrowserItem.removeChildren" id="BrowserItem.removeChildren" ref="eric7.UI.BrowserModel.html#BrowserItem.removeChildren" /> @@ -2741,6 +2745,7 @@ <keyword name="BrowserMethodItem" id="BrowserMethodItem" ref="eric7.UI.BrowserModel.html#BrowserMethodItem" /> <keyword name="BrowserMethodItem (Constructor)" id="BrowserMethodItem (Constructor)" ref="eric7.UI.BrowserModel.html#BrowserMethodItem.__init__" /> <keyword name="BrowserMethodItem.boundaries" id="BrowserMethodItem.boundaries" ref="eric7.UI.BrowserModel.html#BrowserMethodItem.boundaries" /> + <keyword name="BrowserMethodItem.colOffset" id="BrowserMethodItem.colOffset" ref="eric7.UI.BrowserModel.html#BrowserMethodItem.colOffset" /> <keyword name="BrowserMethodItem.fileName" id="BrowserMethodItem.fileName" ref="eric7.UI.BrowserModel.html#BrowserMethodItem.fileName" /> <keyword name="BrowserMethodItem.functionObject" id="BrowserMethodItem.functionObject" ref="eric7.UI.BrowserModel.html#BrowserMethodItem.functionObject" /> <keyword name="BrowserMethodItem.isPublic" id="BrowserMethodItem.isPublic" ref="eric7.UI.BrowserModel.html#BrowserMethodItem.isPublic" /> @@ -18435,6 +18440,7 @@ <keyword name="ViewManager.nextSplit" id="ViewManager.nextSplit" ref="eric7.ViewManager.ViewManager.html#ViewManager.nextSplit" /> <keyword name="ViewManager.openFiles" id="ViewManager.openFiles" ref="eric7.ViewManager.ViewManager.html#ViewManager.openFiles" /> <keyword name="ViewManager.openSourceFile" id="ViewManager.openSourceFile" ref="eric7.ViewManager.ViewManager.html#ViewManager.openSourceFile" /> + <keyword name="ViewManager.openSourceFileLinePos" id="ViewManager.openSourceFileLinePos" ref="eric7.ViewManager.ViewManager.html#ViewManager.openSourceFileLinePos" /> <keyword name="ViewManager.preferencesChanged" id="ViewManager.preferencesChanged" ref="eric7.ViewManager.ViewManager.html#ViewManager.preferencesChanged" /> <keyword name="ViewManager.prevSplit" id="ViewManager.prevSplit" ref="eric7.ViewManager.ViewManager.html#ViewManager.prevSplit" /> <keyword name="ViewManager.printCurrentEditor" id="ViewManager.printCurrentEditor" ref="eric7.ViewManager.ViewManager.html#ViewManager.printCurrentEditor" />
--- a/src/eric7/Documentation/Source/eric7.Project.ProjectBrowser.html Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.Project.ProjectBrowser.html Tue Apr 09 14:27:03 2024 +0200 @@ -109,6 +109,11 @@ emitted to open a Python file at a line (str, int) </dd> +<dt>sourceFile(filename, lineno, col_offset)</dt> +<dd> +emitted to open a Python file at a + line and column (str, int, int) +</dd> <dt>sourceFile(filename, lineno, type)</dt> <dd> emitted to open a Python file
--- a/src/eric7/Documentation/Source/eric7.UI.Browser.html Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.UI.Browser.html Tue Apr 09 14:27:03 2024 +0200 @@ -88,6 +88,11 @@ emitted to open a Python file at a line (str, int) </dd> +<dt>sourceFile(filename, lineno, col_offset)</dt> +<dd> +emitted to open a Python file at a + line and column (str, int, int) +</dd> <dt>sourceFile(filename, lineno, type)</dt> <dd> emitted to open a Python file
--- a/src/eric7/Documentation/Source/eric7.UI.BrowserModel.html Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.UI.BrowserModel.html Tue Apr 09 14:27:03 2024 +0200 @@ -116,6 +116,10 @@ <td>Public method returning the class object.</td> </tr> <tr> +<td><a href="#BrowserClassAttributeItem.colOffset">colOffset</a></td> +<td>Public method to return the column offset of the item definition.</td> +</tr> +<tr> <td><a href="#BrowserClassAttributeItem.fileName">fileName</a></td> <td>Public method returning the filename.</td> </tr> @@ -184,6 +188,25 @@ Class </dd> </dl> +<a NAME="BrowserClassAttributeItem.colOffset" ID="BrowserClassAttributeItem.colOffset"></a> +<h4>BrowserClassAttributeItem.colOffset</h4> +<b>colOffset</b>(<i></i>) +<p> + Public method to return the column offset of the item definition. +</p> + +<dl> +<dt>Return:</dt> +<dd> +column offset defining the object +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> <a NAME="BrowserClassAttributeItem.fileName" ID="BrowserClassAttributeItem.fileName"></a> <h4>BrowserClassAttributeItem.fileName</h4> <b>fileName</b>(<i></i>) @@ -498,6 +521,10 @@ <td>Public method returning the class object.</td> </tr> <tr> +<td><a href="#BrowserClassItem.colOffset">colOffset</a></td> +<td>Public method to return the column offset of the item definition.</td> +</tr> +<tr> <td><a href="#BrowserClassItem.fileName">fileName</a></td> <td>Public method returning the filename.</td> </tr> @@ -585,6 +612,25 @@ Class </dd> </dl> +<a NAME="BrowserClassItem.colOffset" ID="BrowserClassItem.colOffset"></a> +<h4>BrowserClassItem.colOffset</h4> +<b>colOffset</b>(<i></i>) +<p> + Public method to return the column offset of the item definition. +</p> + +<dl> +<dt>Return:</dt> +<dd> +column offset defining the object +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> <a NAME="BrowserClassItem.fileName" ID="BrowserClassItem.fileName"></a> <h4>BrowserClassItem.fileName</h4> <b>fileName</b>(<i></i>) @@ -1922,6 +1968,10 @@ <td>Public method to get the ids of all child items.</td> </tr> <tr> +<td><a href="#BrowserItem.colOffset">colOffset</a></td> +<td>Public method to return the column offset of the item definition.</td> +</tr> +<tr> <td><a href="#BrowserItem.columnCount">columnCount</a></td> <td>Public method to get the number of available data items.</td> </tr> @@ -1954,6 +2004,10 @@ <td>Public method to check, if the item is less than the other one.</td> </tr> <tr> +<td><a href="#BrowserItem.lineno">lineno</a></td> +<td>Public method to return the line number of the item.</td> +</tr> +<tr> <td><a href="#BrowserItem.parent">parent</a></td> <td>Public method to get the reference to the parent item.</td> </tr> @@ -2077,6 +2131,25 @@ list of BrowserItem </dd> </dl> +<a NAME="BrowserItem.colOffset" ID="BrowserItem.colOffset"></a> +<h4>BrowserItem.colOffset</h4> +<b>colOffset</b>(<i></i>) +<p> + Public method to return the column offset of the item definition. +</p> + +<dl> +<dt>Return:</dt> +<dd> +column offset defining the object +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> <a NAME="BrowserItem.columnCount" ID="BrowserItem.columnCount"></a> <h4>BrowserItem.columnCount</h4> <b>columnCount</b>(<i></i>) @@ -2251,6 +2324,25 @@ bool </dd> </dl> +<a NAME="BrowserItem.lineno" ID="BrowserItem.lineno"></a> +<h4>BrowserItem.lineno</h4> +<b>lineno</b>(<i></i>) +<p> + Public method to return the line number of the item. +</p> + +<dl> +<dt>Return:</dt> +<dd> +line number defining the object +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> <a NAME="BrowserItem.parent" ID="BrowserItem.parent"></a> <h4>BrowserItem.parent</h4> <b>parent</b>(<i></i>) @@ -2407,6 +2499,10 @@ <td>Public method returning the boundaries of the method definition.</td> </tr> <tr> +<td><a href="#BrowserMethodItem.colOffset">colOffset</a></td> +<td>Public method to return the column offset of the item definition.</td> +</tr> +<tr> <td><a href="#BrowserMethodItem.fileName">fileName</a></td> <td>Public method returning the filename.</td> </tr> @@ -2479,6 +2575,25 @@ tuple of (int, int) </dd> </dl> +<a NAME="BrowserMethodItem.colOffset" ID="BrowserMethodItem.colOffset"></a> +<h4>BrowserMethodItem.colOffset</h4> +<b>colOffset</b>(<i></i>) +<p> + Public method to return the column offset of the item definition. +</p> + +<dl> +<dt>Return:</dt> +<dd> +column offset defining the object +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> <a NAME="BrowserMethodItem.fileName" ID="BrowserMethodItem.fileName"></a> <h4>BrowserMethodItem.fileName</h4> <b>fileName</b>(<i></i>)
--- a/src/eric7/Documentation/Source/eric7.UI.FindFileWidget.html Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.UI.FindFileWidget.html Tue Apr 09 14:27:03 2024 +0200 @@ -206,7 +206,7 @@ <dt>sourceFile(str, int, str, int, int)</dt> <dd> emitted to open a source file - at a specificline + at a specific line </dd> <dt>svgFile(str)</dt> <dd>
--- a/src/eric7/Documentation/Source/eric7.Utilities.ClassBrowsers.ClbrBaseClasses.html Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.Utilities.ClassBrowsers.ClbrBaseClasses.html Tue Apr 09 14:27:03 2024 +0200 @@ -101,7 +101,7 @@ <a NAME="Attribute.__init__" ID="Attribute.__init__"></a> <h4>Attribute (Constructor)</h4> -<b>Attribute</b>(<i>module, name, file, lineno</i>) +<b>Attribute</b>(<i>module, name, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -118,12 +118,16 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this attribute +file name containing this attribute </dd> <dt><i>lineno</i> (int)</dt> <dd> line number of the attribute definition </dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the attribute definition (defaults to 0) +</dd> </dl> <a NAME="Attribute.addAssignment" ID="Attribute.addAssignment"></a> <h4>Attribute.addAssignment</h4> @@ -176,7 +180,7 @@ <a NAME="Class.__init__" ID="Class.__init__"></a> <h4>Class (Constructor)</h4> -<b>Class</b>(<i>module, name, superClasses, file, lineno</i>) +<b>Class</b>(<i>module, name, superClasses, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -197,12 +201,16 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this class +file name containing this class </dd> <dt><i>lineno</i> (int)</dt> <dd> line number of the class definition </dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the class definition (defaults to 0) +</dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr /> @@ -269,7 +277,7 @@ <a NAME="ClbrBase.__init__" ID="ClbrBase.__init__"></a> <h4>ClbrBase (Constructor)</h4> -<b>ClbrBase</b>(<i>module, name, file, lineno</i>) +<b>ClbrBase</b>(<i>module, name, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -286,11 +294,15 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this object +file name containing this object </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the object definition +line number of the object definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the object definition (defaults to 0) </dd> </dl> <a NAME="ClbrBase._addattribute" ID="ClbrBase._addattribute"></a> @@ -618,7 +630,7 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this coding statement +file name containing this coding statement </dd> <dt><i>lineno</i> (int)</dt> <dd> @@ -666,7 +678,7 @@ <a NAME="Enum.__init__" ID="Enum.__init__"></a> <h4>Enum (Constructor)</h4> -<b>Enum</b>(<i>module, name, file, lineno</i>) +<b>Enum</b>(<i>module, name, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -683,12 +695,16 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this enum +file name containing this enum </dd> <dt><i>lineno</i> (int)</dt> <dd> line number of the enum definition </dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the enum definition (defaults to 0) +</dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr /> @@ -729,7 +745,7 @@ <a NAME="Function.__init__" ID="Function.__init__"></a> <h4>Function (Constructor)</h4> -<b>Function</b>(<i>module, name, file, lineno, signature="", separator=", ", modifierType=General, annotation="", </i>) +<b>Function</b>(<i>module, name, file, lineno, col_offset=0, signature="", separator=", ", modifierType=General, annotation="", </i>) <p> Constructor </p> @@ -746,12 +762,16 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this function +file name containing this function </dd> <dt><i>lineno</i> (int)</dt> <dd> line number of the function definition </dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the function definition (defaults to 0) +</dd> <dt><i>signature</i> (str)</dt> <dd> parameter list of the function @@ -806,7 +826,7 @@ <a NAME="Module.__init__" ID="Module.__init__"></a> <h4>Module (Constructor)</h4> -<b>Module</b>(<i>module, name, file, lineno</i>) +<b>Module</b>(<i>module, name, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -823,12 +843,16 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this module +file name containing this module </dd> <dt><i>lineno</i> (int)</dt> <dd> line number of the module definition </dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the module definition (defaults to 0) +</dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr /> @@ -871,7 +895,7 @@ <a NAME="_ClbrBase.__init__" ID="_ClbrBase.__init__"></a> <h4>_ClbrBase (Constructor)</h4> -<b>_ClbrBase</b>(<i>module, name, file, lineno</i>) +<b>_ClbrBase</b>(<i>module, name, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -888,11 +912,15 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this object +file name containing this object </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the object definition +line number of the object definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the object definition (defaults to 0) </dd> </dl> <a NAME="_ClbrBase.setEndLine" ID="_ClbrBase.setEndLine"></a>
--- a/src/eric7/Documentation/Source/eric7.Utilities.ClassBrowsers.pyclbr.html Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.Utilities.ClassBrowsers.pyclbr.html Tue Apr 09 14:27:03 2024 +0200 @@ -111,7 +111,7 @@ <a NAME="Attribute.__init__" ID="Attribute.__init__"></a> <h4>Attribute (Constructor)</h4> -<b>Attribute</b>(<i>module, name, file, lineno</i>) +<b>Attribute</b>(<i>module, name, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -128,11 +128,15 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this attribute +file name containing this attribute </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the class definition +line number of the attribute definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the attribute definition (defaults to 0) </dd> </dl> <div align="right"><a href="#top">Up</a></div> @@ -172,7 +176,7 @@ <a NAME="Class.__init__" ID="Class.__init__"></a> <h4>Class (Constructor)</h4> -<b>Class</b>(<i>module, name, superClasses, file, lineno</i>) +<b>Class</b>(<i>module, name, superClasses, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -193,11 +197,15 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this class +file name containing this class </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the class definition +line number of the class definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the class definition (defaults to 0) </dd> </dl> <div align="right"><a href="#top">Up</a></div> @@ -237,7 +245,7 @@ <a NAME="Function.__init__" ID="Function.__init__"></a> <h4>Function (Constructor)</h4> -<b>Function</b>(<i>module, name, file, lineno, signature="", separator=", ", modifierType=ClbrBaseClasses.Function.General, annotation="", </i>) +<b>Function</b>(<i>module, name, file, lineno, col_offset=0, signature="", separator=", ", modifierType=ClbrBaseClasses.Function.General, annotation="", </i>) <p> Constructor </p> @@ -254,15 +262,19 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this class +file name containing this function </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the class definition +line number of the function definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the function definition (defaults to 0) </dd> <dt><i>signature</i> (str)</dt> <dd> -parameterlist of the method +parameter list of the function </dd> <dt><i>separator</i> (str)</dt> <dd>
--- a/src/eric7/Documentation/Source/eric7.Utilities.ClassBrowsers.rbclbr.html Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.Utilities.ClassBrowsers.rbclbr.html Tue Apr 09 14:27:03 2024 +0200 @@ -97,7 +97,7 @@ <a NAME="Attribute.__init__" ID="Attribute.__init__"></a> <h4>Attribute (Constructor)</h4> -<b>Attribute</b>(<i>module, name, file, lineno</i>) +<b>Attribute</b>(<i>module, name, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -106,19 +106,23 @@ <dt><i>module</i> (str)</dt> <dd> -name of the module containing this class +name of the module containing this attribute </dd> <dt><i>name</i> (str)</dt> <dd> -name of this class +name of this attribute </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this attribute +file name containing this attribute </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the class definition +line number of the attribute definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the attribute definition (defaults to 0) </dd> </dl> <div align="right"><a href="#top">Up</a></div> @@ -158,7 +162,7 @@ <a NAME="Class.__init__" ID="Class.__init__"></a> <h4>Class (Constructor)</h4> -<b>Class</b>(<i>module, name, superClasses, file, lineno</i>) +<b>Class</b>(<i>module, name, superClasses, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -179,11 +183,15 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this class +file name containing this class </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the class definition +line number of the class definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the class definition (defaults to 0) </dd> </dl> <div align="right"><a href="#top">Up</a></div> @@ -223,7 +231,7 @@ <a NAME="Function.__init__" ID="Function.__init__"></a> <h4>Function (Constructor)</h4> -<b>Function</b>(<i>module, name, file, lineno, signature="", separator=", "</i>) +<b>Function</b>(<i>module, name, file, lineno, col_offset=0, signature="", separator=", "</i>) <p> Constructor </p> @@ -240,15 +248,19 @@ </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this class +file name containing this function </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the class definition +line number of the function definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the function definition (defaults to 0) </dd> <dt><i>signature</i> (str)</dt> <dd> -parameter list of the method +parameter list of the function </dd> <dt><i>separator</i> (str)</dt> <dd> @@ -292,7 +304,7 @@ <a NAME="Module.__init__" ID="Module.__init__"></a> <h4>Module (Constructor)</h4> -<b>Module</b>(<i>module, name, file, lineno</i>) +<b>Module</b>(<i>module, name, file, lineno, col_offset=0</i>) <p> Constructor </p> @@ -301,19 +313,23 @@ <dt><i>module</i> (str)</dt> <dd> -name of the module containing this class +name of the module containing this module </dd> <dt><i>name</i> (str)</dt> <dd> -name of this class +name of this module </dd> <dt><i>file</i> (str)</dt> <dd> -filename containing this class +file name containing this module </dd> <dt><i>lineno</i> (int)</dt> <dd> -linenumber of the class definition +linenumber of the module definition +</dd> +<dt><i>col_offset</i> (int (optional))</dt> +<dd> +column number of the module definition (defaults to 0) </dd> </dl> <div align="right"><a href="#top">Up</a></div>
--- a/src/eric7/Documentation/Source/eric7.ViewManager.ViewManager.html Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.ViewManager.ViewManager.html Tue Apr 09 14:27:03 2024 +0200 @@ -1052,6 +1052,10 @@ <td>Public slot to display a file in an editor.</td> </tr> <tr> +<td><a href="#ViewManager.openSourceFileLinePos">openSourceFileLinePos</a></td> +<td>Public slot to display a file in an editor at a given line and position.</td> +</tr> +<tr> <td><a href="#ViewManager.preferencesChanged">preferencesChanged</a></td> <td>Public slot to handle the preferencesChanged signal.</td> </tr> @@ -4213,6 +4217,28 @@ Editor </dd> </dl> +<a NAME="ViewManager.openSourceFileLinePos" ID="ViewManager.openSourceFileLinePos"></a> +<h4>ViewManager.openSourceFileLinePos</h4> +<b>openSourceFileLinePos</b>(<i>fn, lineno, pos</i>) +<p> + Public slot to display a file in an editor at a given line and position. +</p> + +<dl> + +<dt><i>fn</i> (str)</dt> +<dd> +name of file to be opened +</dd> +<dt><i>lineno</i> (int)</dt> +<dd> +line number to place the cursor at +</dd> +<dt><i>pos</i> (int)</dt> +<dd> +position within line to position cursor at +</dd> +</dl> <a NAME="ViewManager.preferencesChanged" ID="ViewManager.preferencesChanged"></a> <h4>ViewManager.preferencesChanged</h4> <b>preferencesChanged</b>(<i></i>)
--- a/src/eric7/Project/ProjectBrowser.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Project/ProjectBrowser.py Tue Apr 09 14:27:03 2024 +0200 @@ -61,6 +61,8 @@ at a line giving an explicit file type (str, int, str) @signal sourceFile(filename, linenos) emitted to open a Python file giving a list of lines(str, list) + @signal sourceFile(filename, lineno, col_offset) emitted to open a Python file at a + line and column (str, int, int) @signal svgFile(filename) emitted to open a SVG file (str) @signal testFile(filename) emitted to open a Python file for a unit test (str) @@ -85,7 +87,9 @@ pixmapEditFile = pyqtSignal(str) pixmapFile = pyqtSignal(str) preferencesChanged = pyqtSignal() - sourceFile = pyqtSignal((str,), (str, int), (str, list), (str, int, str)) + sourceFile = pyqtSignal( + (str,), (str, int), (str, int, int), (str, list), (str, int, str) + ) svgFile = pyqtSignal(str) testFile = pyqtSignal(str) trpreview = pyqtSignal((list,), (list, bool))
--- a/src/eric7/Project/ProjectBrowserModel.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Project/ProjectBrowserModel.py Tue Apr 09 14:27:03 2024 +0200 @@ -871,6 +871,8 @@ self.beginRemoveRows(index, 0, itm.childCount() - 1) itm.removeChildren() self.endRemoveRows() + + # reset the module parser cache ModuleParser.resetParsedModule(os.path.join(self.project.ppath, name)) self.populateItem(itm, True)
--- a/src/eric7/Project/ProjectSourcesBrowser.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Project/ProjectSourcesBrowser.py Tue Apr 09 14:27:03 2024 +0200 @@ -121,6 +121,7 @@ self.sourceFile[str, int].connect(projectBrowser.sourceFile[str, int]) self.sourceFile[str, list].connect(projectBrowser.sourceFile[str, list]) self.sourceFile[str, int, str].connect(projectBrowser.sourceFile[str, int, str]) + self.sourceFile[str, int, int].connect(projectBrowser.sourceFile[str, int, int]) self.closeSourceWindow.connect(projectBrowser.closeSourceWindow) self.testFile.connect(projectBrowser.testFile) @@ -1044,14 +1045,16 @@ else: self.sourceFile[str].emit(itm.fileName()) elif isinstance(itm, BrowserClassItem): - self.sourceFile[str, int].emit(itm.fileName(), itm.classObject().lineno) + self.sourceFile[str, int, int].emit( + itm.fileName(), itm.lineno(), itm.colOffset() + ) elif isinstance(itm, BrowserMethodItem): - self.sourceFile[str, int].emit( - itm.fileName(), itm.functionObject().lineno + self.sourceFile[str, int, int].emit( + itm.fileName(), itm.lineno(), itm.colOffset() ) elif isinstance(itm, BrowserClassAttributeItem): - self.sourceFile[str, int].emit( - itm.fileName(), itm.attributeObject().lineno + self.sourceFile[str, int, int].emit( + itm.fileName(), itm.lineno(), itm.colOffset() ) elif isinstance(itm, BrowserImportItem): self.sourceFile[str, list].emit(itm.fileName(), itm.linenos())
--- a/src/eric7/QScintilla/EditorOutline.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/QScintilla/EditorOutline.py Tue Apr 09 14:27:03 2024 +0200 @@ -190,8 +190,8 @@ itm = self.model().item(index) if itm: with contextlib.suppress(AttributeError): - lineno = itm.lineno() - self.__model.editor().gotoLine(lineno) + self.__model.editor().gotoLine(itm.lineno(), itm.colOffset() + 1) + self.__model.editor().setFocus() def mouseDoubleClickEvent(self, mouseEvent): """
--- a/src/eric7/UI/Browser.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/UI/Browser.py Tue Apr 09 14:27:03 2024 +0200 @@ -71,6 +71,8 @@ at a line giving an explicit file type (str, int, str) @signal sourceFile(filename, linenos) emitted to open a Python file giving a list of lines(str, list) + @signal sourceFile(filename, lineno, col_offset) emitted to open a Python file at a + line and column (str, int, int) @signal designerFile(filename) emitted to open a Qt-Designer file (str) @signal linguistFile(filename) emitted to open a Qt-Linguist (*.ts) file (str) @@ -92,7 +94,9 @@ @signal pdfFile(filename) emitted to open a PDF file (str) """ - sourceFile = pyqtSignal((str,), (str, int), (str, list), (str, int, str)) + sourceFile = pyqtSignal( + (str,), (str, int), (str, int, int), (str, list), (str, int, str) + ) designerFile = pyqtSignal(str) linguistFile = pyqtSignal(str) trpreview = pyqtSignal((list,), (list, bool)) @@ -573,16 +577,16 @@ else: QDesktopServices.openUrl(QUrl(itm.fileName())) elif isinstance(itm, BrowserClassItem): - self.sourceFile[str, int].emit( - itm.fileName(), itm.classObject().lineno + self.sourceFile[str, int, int].emit( + itm.fileName(), itm.lineno(), itm.colOffset() ) elif isinstance(itm, BrowserMethodItem): - self.sourceFile[str, int].emit( - itm.fileName(), itm.functionObject().lineno + self.sourceFile[str, int, int].emit( + itm.fileName(), itm.lineno(), itm.colOffset() ) elif isinstance(itm, BrowserClassAttributeItem): - self.sourceFile[str, int].emit( - itm.fileName(), itm.attributeObject().lineno + self.sourceFile[str, int, int].emit( + itm.fileName(), itm.lineno(), itm.colOffset() ) elif isinstance(itm, BrowserImportItem): self.sourceFile[str, list].emit(itm.fileName(), itm.linenos())
--- a/src/eric7/UI/BrowserModel.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/UI/BrowserModel.py Tue Apr 09 14:27:03 2024 +0200 @@ -1147,6 +1147,24 @@ """ return self.symlink + def lineno(self): + """ + Public method to return the line number of the item. + + @return line number defining the object + @rtype int + """ + return 0 # just a placeholder implementation + + def colOffset(self): + """ + Public method to return the column offset of the item definition. + + @return column offset defining the object + @rtype int + """ + return 0 # default value + class BrowserSimpleDirectoryItem(BrowserItem): """ @@ -1787,6 +1805,15 @@ """ return (self._classObject.lineno, self._classObject.endlineno) + def colOffset(self): + """ + Public method to return the column offset of the item definition. + + @return column offset defining the object + @rtype int + """ + return self._classObject.coloffset + def lessThan(self, other, column, order): """ Public method to check, if the item is less than the other one. @@ -1918,6 +1945,15 @@ """ return (self._functionObject.lineno, self._functionObject.endlineno) + def colOffset(self): + """ + Public method to return the column offset of the item definition. + + @return column offset defining the object + @rtype int + """ + return self._functionObject.coloffset + def lessThan(self, other, column, order): """ Public method to check, if the item is less than the other one. @@ -2110,6 +2146,15 @@ """ return self._attributeObject.linenos[:] + def colOffset(self): + """ + Public method to return the column offset of the item definition. + + @return column offset defining the object + @rtype int + """ + return self._attributeObject.coloffset + def lessThan(self, other, column, order): """ Public method to check, if the item is less than the other one.
--- a/src/eric7/UI/FindFileWidget.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/UI/FindFileWidget.py Tue Apr 09 14:27:03 2024 +0200 @@ -49,7 +49,7 @@ all ticked replacement operations. @signal sourceFile(str, int, str, int, int) emitted to open a source file - at a specificline + at a specific line @signal designerFile(str) emitted to open a Qt-Designer file @signal linguistFile(str) emitted to open a Qt-Linguist (*.ts) file @signal trpreview([str]) emitted to preview Qt-Linguist (*.qm) files
--- a/src/eric7/UI/UserInterface.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/UI/UserInterface.py Tue Apr 09 14:27:03 2024 +0200 @@ -426,6 +426,9 @@ self.projectBrowser.sourceFile[str, int, str].connect( self.viewmanager.openSourceFile ) + self.projectBrowser.sourceFile[str, int, int].connect( + self.viewmanager.openSourceFileLinePos + ) self.projectBrowser.closeSourceWindow.connect(self.viewmanager.closeWindow) self.projectBrowser.testFile.connect(self.__startTestScript) self.projectBrowser.designerFile.connect(self.__designer) @@ -514,6 +517,9 @@ self.browser.sourceFile[str, int, str].connect( self.viewmanager.openSourceFile ) + self.browser.sourceFile[str, int, int].connect( + self.viewmanager.openSourceFileLinePos + ) self.browser.designerFile.connect(self.__designer) self.browser.linguistFile.connect(self.__linguist) self.browser.projectFile.connect(self.project.openProject)
--- a/src/eric7/Utilities/ClassBrowsers/ClbrBaseClasses.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Utilities/ClassBrowsers/ClbrBaseClasses.py Tue Apr 09 14:27:03 2024 +0200 @@ -13,7 +13,7 @@ Class implementing the base of all class browser objects. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -21,15 +21,19 @@ @type str @param name name of this object @type str - @param file filename containing this object + @param file file name containing this object @type str - @param lineno linenumber of the object definition + @param lineno line number of the object definition @type int + @param col_offset column number of the object definition (defaults to 0) + @type int (optional) """ self.module = module self.name = name self.file = file self.lineno = lineno + self.coloffset = col_offset + self.endlineno = -1 # marker for "not set" def setEndLine(self, endLineNo): @@ -47,7 +51,7 @@ Class implementing the base of all complex class browser objects. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -55,12 +59,14 @@ @type str @param name name of this object @type str - @param file filename containing this object + @param file file name containing this object @type str - @param lineno linenumber of the object definition + @param lineno line number of the object definition @type int + @param col_offset column number of the object definition (defaults to 0) + @type int (optional) """ - _ClbrBase.__init__(self, module, name, file, lineno) + _ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) self.methods = {} self.attributes = {} self.classes = {} @@ -211,7 +217,7 @@ Class to represent an attribute. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -219,12 +225,14 @@ @type str @param name name of this attribute @type str - @param file filename containing this attribute + @param file file name containing this attribute @type str @param lineno line number of the attribute definition @type int + @param col_offset column number of the attribute definition (defaults to 0) + @type int (optional) """ - _ClbrBase.__init__(self, module, name, file, lineno) + _ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) self.linenos = [lineno] @@ -244,7 +252,7 @@ Class to represent a class. """ - def __init__(self, module, name, superClasses, file, lineno): + def __init__(self, module, name, superClasses, file, lineno, col_offset=0): """ Constructor @@ -254,12 +262,14 @@ @type str @param superClasses list of class names this class is inherited from @type list of str - @param file filename containing this class + @param file file name containing this class @type str @param lineno line number of the class definition @type int + @param col_offset column number of the class definition (defaults to 0) + @type int (optional) """ - ClbrBase.__init__(self, module, name, file, lineno) + ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) if superClasses is None: superClasses = [] self.super = superClasses @@ -270,7 +280,7 @@ Class to represent a module. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -278,12 +288,14 @@ @type str @param name name of this module @type str - @param file filename containing this module + @param file file name containing this module @type str @param lineno line number of the module definition @type int + @param col_offset column number of the module definition (defaults to 0) + @type int (optional) """ - ClbrBase.__init__(self, module, name, file, lineno) + ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) class Function(ClbrBase): @@ -301,6 +313,7 @@ name, file, lineno, + col_offset=0, signature="", separator=",", modifierType=General, @@ -313,10 +326,12 @@ @type str @param name name of this function @type str - @param file filename containing this function + @param file file name containing this function @type str @param lineno line number of the function definition @type int + @param col_offset column number of the function definition (defaults to 0) + @type int (optional) @param signature parameter list of the function @type str @param separator string separating the parameters of the function @@ -326,7 +341,7 @@ @param annotation function return annotation @type str """ - ClbrBase.__init__(self, module, name, file, lineno) + ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset) self.parameters = [e.strip() for e in signature.split(separator)] self.modifier = modifierType self.annotation = annotation @@ -343,7 +358,7 @@ @param module name of the module containing this coding statement @type str - @param file filename containing this coding statement + @param file file name containing this coding statement @type str @param lineno line number of the coding definition @type int @@ -360,7 +375,7 @@ Class to represent an enum definition. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -368,9 +383,11 @@ @type str @param name name of this enum @type str - @param file filename containing this enum + @param file file name containing this enum @type str @param lineno line number of the enum definition @type int + @param col_offset column number of the enum definition (defaults to 0) + @type int (optional) """ - ClbrBase.__init__(self, module, name, file, lineno) + ClbrBase.__init__(self, module, name, file, lineno, col_offset=col_offset)
--- a/src/eric7/Utilities/ClassBrowsers/pyclbr.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Utilities/ClassBrowsers/pyclbr.py Tue Apr 09 14:27:03 2024 +0200 @@ -185,7 +185,7 @@ Class to represent a Python class. """ - def __init__(self, module, name, superClasses, file, lineno): + def __init__(self, module, name, superClasses, file, lineno, col_offset=0): """ Constructor @@ -195,12 +195,16 @@ @type str @param superClasses list of class names this class is inherited from @type list of str - @param file filename containing this class + @param file file name containing this class @type str - @param lineno linenumber of the class definition + @param lineno line number of the class definition @type int + @param col_offset column number of the class definition (defaults to 0) + @type int (optional) """ - ClbrBaseClasses.Class.__init__(self, module, name, superClasses, file, lineno) + ClbrBaseClasses.Class.__init__( + self, module, name, superClasses, file, lineno, col_offset=col_offset + ) VisibilityMixin.__init__(self) @@ -215,6 +219,7 @@ name, file, lineno, + col_offset=0, signature="", separator=",", modifierType=ClbrBaseClasses.Function.General, @@ -227,11 +232,13 @@ @type str @param name name of this function @type str - @param file filename containing this class + @param file file name containing this function @type str - @param lineno linenumber of the class definition + @param lineno line number of the function definition @type int - @param signature parameterlist of the method + @param col_offset column number of the function definition (defaults to 0) + @type int (optional) + @param signature parameter list of the function @type str @param separator string separating the parameters @type str @@ -246,10 +253,11 @@ name, file, lineno, - signature, - separator, - modifierType, - annotation, + col_offset=col_offset, + signature=signature, + separator=separator, + modifierType=modifierType, + annotation=annotation, ) VisibilityMixin.__init__(self) @@ -259,7 +267,7 @@ Class to represent a class attribute. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor @@ -267,12 +275,16 @@ @type str @param name name of this class @type str - @param file filename containing this attribute + @param file file name containing this attribute @type str - @param lineno linenumber of the class definition + @param lineno line number of the attribute definition @type int + @param col_offset column number of the attribute definition (defaults to 0) + @type int (optional) """ - ClbrBaseClasses.Attribute.__init__(self, module, name, file, lineno) + ClbrBaseClasses.Attribute.__init__( + self, module, name, file, lineno, col_offset=col_offset + ) VisibilityMixin.__init__(self) @@ -517,6 +529,7 @@ meth_ret = _commentsub("", meth_ret) lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start + col_offset = m.capturedStart("MethodName") - m.capturedStart() if modifierType and modifierIndent == thisindent: if modifierType == "@staticmethod": modifier = ClbrBaseClasses.Function.Static @@ -553,7 +566,8 @@ meth_name, file, lineno, - meth_sig, + col_offset=col_offset, + signature=meth_sig, annotation=meth_ret, modifierType=modifier, ) @@ -567,7 +581,8 @@ meth_name, file, lineno, - meth_sig, + col_offset=col_offset, + signature=meth_sig, annotation=meth_ret, modifierType=modifier, ) @@ -597,6 +612,7 @@ classstack.pop() lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start + col_offset = m.capturedStart("ClassName") - m.capturedStart() class_name = m.captured("ClassName") inherit = m.captured("ClassSupers") if inherit: @@ -639,7 +655,9 @@ del deltastack[-1] deltaindentcalculated = False # remember this class - cur_class = Class(module, class_name, inherit, file, lineno) + cur_class = Class( + module, class_name, inherit, file, lineno, col_offset=col_offset + ) endlineno = calculateEndline(lineno, srcLines, thisindent) cur_class.setEndLine(endlineno) if not classstack: @@ -656,8 +674,10 @@ elif m.captured("Attribute") or m.captured("TypedAttribute"): if m.captured("Attribute"): attribute_name = m.captured("AttributeName") + col_offset = m.capturedStart("AttributeName") - m.capturedStart() else: attribute_name = m.captured("TypedAttributeName") + col_offset = m.capturedStart("TypedAttributeName") - m.capturedStart() lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start index = -1 @@ -665,7 +685,9 @@ if classstack[index][0] is not None and not isinstance( classstack[index][0], Function ): - attr = Attribute(module, attribute_name, file, lineno) + attr = Attribute( + module, attribute_name, file, lineno, col_offset=col_offset + ) classstack[index][0]._addattribute(attr) break else: @@ -681,12 +703,14 @@ if m.captured("Variable"): thisindent = _indent(m.captured("VariableIndent")) variable_name = m.captured("VariableName") + col_offset = m.capturedStart("VariableName") - m.capturedStart() else: thisindent = _indent(m.captured("TypedVariableIndent")) variable_name = m.captured("TypedVariableName") if keyword.iskeyword(variable_name): # only if the determined name is not a keyword (e.g. else, except) continue + col_offset = m.capturedStart("TypedVariableName") - m.capturedStart() lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start if thisindent == 0 or not classstack: @@ -698,7 +722,9 @@ module, "Globals", file, lineno ) dictionary["@@Globals@@"]._addglobal( - Attribute(module, variable_name, file, lineno) + Attribute( + module, variable_name, file, lineno, col_offset=col_offset + ) ) else: index = -1 @@ -708,11 +734,23 @@ else: if isinstance(classstack[index][0], Class): classstack[index][0]._addglobal( - Attribute(module, variable_name, file, lineno) + Attribute( + module, + variable_name, + file, + lineno, + col_offset=col_offset, + ) ) elif isinstance(classstack[index][0], Function): classstack[index][0]._addattribute( - Attribute(module, variable_name, file, lineno) + Attribute( + module, + variable_name, + file, + lineno, + col_offset=col_offset, + ) ) break
--- a/src/eric7/Utilities/ClassBrowsers/rbclbr.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/Utilities/ClassBrowsers/rbclbr.py Tue Apr 09 14:27:03 2024 +0200 @@ -185,7 +185,7 @@ Class to represent a Ruby class. """ - def __init__(self, module, name, superClasses, file, lineno): + def __init__(self, module, name, superClasses, file, lineno, col_offset=0): """ Constructor @@ -195,12 +195,16 @@ @type str @param superClasses list of class names this class is inherited from @type list of str - @param file filename containing this class + @param file file name containing this class @type str - @param lineno linenumber of the class definition + @param lineno line number of the class definition @type int + @param col_offset column number of the class definition (defaults to 0) + @type int (optional) """ - ClbrBaseClasses.Class.__init__(self, module, name, superClasses, file, lineno) + ClbrBaseClasses.Class.__init__( + self, module, name, superClasses, file, lineno, col_offset=col_offset + ) VisibilityMixin.__init__(self) @@ -209,20 +213,24 @@ Class to represent a Ruby module. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor - @param module name of the module containing this class + @param module name of the module containing this module @type str - @param name name of this class + @param name name of this module + @type str + @param file file name containing this module @type str - @param file filename containing this class - @type str - @param lineno linenumber of the class definition + @param lineno linenumber of the module definition @type int + @param col_offset column number of the module definition (defaults to 0) + @type int (optional) """ - ClbrBaseClasses.Module.__init__(self, module, name, file, lineno) + ClbrBaseClasses.Module.__init__( + self, module, name, file, lineno, col_offset=col_offset + ) VisibilityMixin.__init__(self) @@ -231,7 +239,9 @@ Class to represent a Ruby function. """ - def __init__(self, module, name, file, lineno, signature="", separator=","): + def __init__( + self, module, name, file, lineno, col_offset=0, signature="", separator="," + ): """ Constructor @@ -239,17 +249,26 @@ @type str @param name name of this function @type str - @param file filename containing this class + @param file file name containing this function @type str - @param lineno linenumber of the class definition + @param lineno line number of the function definition @type int - @param signature parameter list of the method + @param col_offset column number of the function definition (defaults to 0) + @type int (optional) + @param signature parameter list of the function @type str @param separator string separating the parameters @type str """ ClbrBaseClasses.Function.__init__( - self, module, name, file, lineno, signature, separator + self, + module, + name, + file, + lineno, + col_offset=col_offset, + signature=signature, + separator=separator, ) VisibilityMixin.__init__(self) @@ -259,20 +278,24 @@ Class to represent a class or module attribute. """ - def __init__(self, module, name, file, lineno): + def __init__(self, module, name, file, lineno, col_offset=0): """ Constructor - @param module name of the module containing this class + @param module name of the module containing this attribute @type str - @param name name of this class + @param name name of this attribute + @type str + @param file file name containing this attribute @type str - @param file filename containing this attribute - @type str - @param lineno linenumber of the class definition + @param lineno line number of the attribute definition @type int + @param col_offset column number of the attribute definition (defaults to 0) + @type int (optional) """ - ClbrBaseClasses.Attribute.__init__(self, module, name, file, lineno) + ClbrBaseClasses.Attribute.__init__( + self, module, name, file, lineno, col_offset=col_offset + ) VisibilityMixin.__init__(self) self.setPrivate() @@ -356,6 +379,12 @@ meth_sig = _commentsub("", meth_sig) lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start + if m.captured("MethodName"): + col_offset = m.capturedStart("MethodName") - m.capturedStart() + elif m.captured("MethodName2"): + col_offset = m.capturedStart("MethodName2") - m.capturedStart() + elif m.captured("MethodName3"): + col_offset = m.capturedStart("MethodName3") - m.capturedStart() if meth_name.startswith("self."): meth_name = meth_name[5:] elif meth_name.startswith("self::"): @@ -373,7 +402,14 @@ cur_class = classstack[-1][0] if isinstance(cur_class, (Class, Module)): # it's a method - f = Function(None, meth_name, file, lineno, meth_sig) + f = Function( + None, + meth_name, + file, + lineno, + col_offset=col_offset, + signature=meth_sig, + ) cur_class._addmethod(meth_name, f) else: f = cur_class @@ -389,7 +425,14 @@ # else it's a nested def else: # it's a function - f = Function(module, meth_name, file, lineno, meth_sig) + f = Function( + module, + meth_name, + file, + lineno, + col_offset=col_offset, + signature=meth_sig, + ) if meth_name in dict_counts: dict_counts[meth_name] += 1 meth_name = "{0}_{1:d}".format(meth_name, dict_counts[meth_name]) @@ -426,13 +469,16 @@ classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] class_name = m.captured("ClassName") or m.captured("ClassName2") + col_offset = m.capturedStart("ClassName") - m.capturedStart() inherit = m.captured("ClassSupers") if inherit: # the class inherits from other classes inherit = inherit[1:].strip() inherit = [_commentsub("", inherit)] # remember this class - cur_class = Class(module, class_name, inherit, file, lineno) + cur_class = Class( + module, class_name, inherit, file, lineno, col_offset=col_offset + ) if not classstack: if class_name in dictionary: cur_class = dictionary[class_name] @@ -470,8 +516,9 @@ classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] module_name = m.captured("ModuleName") + col_offset = m.capturedStart("ModuleName") - m.capturedStart() # remember this class - cur_class = Module(module, module_name, file, lineno) + cur_class = Module(module, module_name, file, lineno, col_offset=col_offset) if not classstack: if module_name in dictionary: cur_class = dictionary[module_name] @@ -542,6 +589,7 @@ elif m.captured("Attribute"): lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start + col_offset = m.capturedStart("AttributeName") - m.capturedStart() index = -1 while index >= -len(classstack): if ( @@ -549,7 +597,13 @@ and not isinstance(classstack[index][0], Function) and classstack[index][1] < indent ): - attr = Attribute(module, m.captured("AttributeName"), file, lineno) + attr = Attribute( + module, + m.captured("AttributeName"), + file, + lineno, + col_offset=col_offset, + ) classstack[index][0]._addattribute(attr) break else:
--- a/src/eric7/ViewManager/ViewManager.py Mon Apr 08 17:02:11 2024 +0200 +++ b/src/eric7/ViewManager/ViewManager.py Tue Apr 09 14:27:03 2024 +0200 @@ -5745,6 +5745,20 @@ return editor + @pyqtSlot(str, int, int) + def openSourceFileLinePos(self, fn, lineno, pos): + """ + Public slot to display a file in an editor at a given line and position. + + @param fn name of file to be opened + @type str + @param lineno line number to place the cursor at + @type int + @param pos position within line to position cursor at + @type int + """ + self.openSourceFile(fn, lineno=lineno, pos=pos + 1) + def __connectEditor(self, editor): """ Private method to establish all editor connections.