Sat, 28 Mar 2015 11:49:02 +0100
Improved the 'import' change to move the cursor to the next occurence for each double-click on an import item in the project source browser and the file browser.
--- a/Documentation/Source/eric6.Project.ProjectSourcesBrowser.html Thu Mar 26 22:20:47 2015 +0100 +++ b/Documentation/Source/eric6.Project.ProjectSourcesBrowser.html Sat Mar 28 11:49:02 2015 +0100 @@ -64,6 +64,10 @@ <dd> emitted to open the given file as the given type at the given line. +</dd><dt>sourceFile(str, list)</dt> +<dd> +emitted to open a Python file giving a list + of lines </dd> </dl> <h3>Derived from</h3>
--- a/Documentation/Source/eric6.UI.Browser.html Thu Mar 26 22:20:47 2015 +0100 +++ b/Documentation/Source/eric6.UI.Browser.html Sat Mar 28 11:49:02 2015 +0100 @@ -71,6 +71,10 @@ <dd> emitted to open a Python file at a line +</dd><dt>sourceFile(str, list)</dt> +<dd> +emitted to open a Python file giving a list + of lines </dd><dt>svgFile(str)</dt> <dd> emitted to open a SVG file
--- a/Documentation/Source/eric6.ViewManager.ViewManager.html Thu Mar 26 22:20:47 2015 +0100 +++ b/Documentation/Source/eric6.ViewManager.ViewManager.html Sat Mar 28 11:49:02 2015 +0100 @@ -2691,7 +2691,9 @@ name of file to be opened (string) </dd><dt><i>lineno</i></dt> <dd> -line number to place the cursor at (integer) +line number to place the cursor at (integer) or + list of line numbers (list of integers) (cursor will be + placed at the next line greater than the current one) </dd><dt><i>filetype</i></dt> <dd> type of the source file (string)
--- a/Project/ProjectSourcesBrowser.py Thu Mar 26 22:20:47 2015 +0100 +++ b/Project/ProjectSourcesBrowser.py Sat Mar 28 11:49:02 2015 +0100 @@ -41,6 +41,8 @@ line. @signal sourceFile(str, int, str) emitted to open the given file as the given type at the given line. + @signal sourceFile(str, list) emitted to open a Python file giving a list + of lines """ showMenu = pyqtSignal(str, QMenu) @@ -784,8 +786,8 @@ self.sourceFile[str, int].emit( itm.fileName(), itm.attributeObject().lineno) elif isinstance(itm, BrowserImportItem): - self.sourceFile[str, int].emit( - itm.fileName(), itm.lineno()) + self.sourceFile[str, list].emit( + itm.fileName(), itm.linenos()) def __addNewPackage(self): """
--- a/UI/Browser.py Thu Mar 26 22:20:47 2015 +0100 +++ b/UI/Browser.py Sat Mar 28 11:49:02 2015 +0100 @@ -40,6 +40,8 @@ @signal sourceFile(str, int = 0, str = "") emitted to open a Python file at a line + @signal sourceFile(str, list) emitted to open a Python file giving a list + of lines @signal designerFile(str) emitted to open a Qt-Designer file @signal linguistFile(str) emitted to open a Qt-Linguist (*.ts) file @signal trpreview(list of str, bool = False) emitted to preview a @@ -51,7 +53,7 @@ @signal svgFile(str) emitted to open a SVG file @signal unittestOpen(str) emitted to open a Python file for a unittest """ - sourceFile = pyqtSignal((str, ), (str, int), (str, int, str)) + sourceFile = pyqtSignal((str, ), (str, int), (str, list), (str, int, str)) designerFile = pyqtSignal(str) linguistFile = pyqtSignal(str) trpreview = pyqtSignal((list, ), (list, bool)) @@ -450,8 +452,8 @@ self.sourceFile[str, int].emit( itm.fileName(), itm.attributeObject().lineno) elif isinstance(itm, BrowserImportItem): - self.sourceFile[str, int].emit( - itm.fileName(), itm.lineno()) + self.sourceFile[str, list].emit( + itm.fileName(), itm.linenos()) self._activating = False def __showMimeType(self):
--- a/UI/UserInterface.py Thu Mar 26 22:20:47 2015 +0100 +++ b/UI/UserInterface.py Sat Mar 28 11:49:02 2015 +0100 @@ -257,6 +257,8 @@ self.viewmanager.openSourceFile) self.browser.sourceFile[str, int].connect( self.viewmanager.openSourceFile) + self.browser.sourceFile[str, list].connect( + self.viewmanager.openSourceFile) self.browser.sourceFile[str, int, str].connect( self.viewmanager.openSourceFile) self.browser.designerFile.connect(self.__designer) @@ -281,6 +283,8 @@ self.viewmanager.openSourceFile) self.projectBrowser.psBrowser.sourceFile[str, int].connect( self.viewmanager.openSourceFile) + self.projectBrowser.psBrowser.sourceFile[str, list].connect( + self.viewmanager.openSourceFile) self.projectBrowser.psBrowser.sourceFile[str, int, str].connect( self.viewmanager.openSourceFile) self.projectBrowser.psBrowser.closeSourceWindow.connect(
--- a/ViewManager/ViewManager.py Thu Mar 26 22:20:47 2015 +0100 +++ b/ViewManager/ViewManager.py Sat Mar 28 11:49:02 2015 +0100 @@ -4411,7 +4411,9 @@ Public slot to display a file in an editor. @param fn name of file to be opened (string) - @param lineno line number to place the cursor at (integer) + @param lineno line number to place the cursor at (integer) or + list of line numbers (list of integers) (cursor will be + placed at the next line greater than the current one) @param filetype type of the source file (string) @param selStart start of an area to be selected (integer) @param selEnd end of an area to be selected (integer) @@ -4426,12 +4428,28 @@ self._modificationStatusChanged(editor.isModified(), editor) self._checkActions(editor) - if lineno >= 0: - editor.ensureVisibleTop(lineno) - editor.gotoLine(lineno, pos) + cline, cindex = editor.getCursorPosition() + cline += 1 + if isinstance(lineno, list): + if len(lineno) > 1: + for line in lineno: + if line > cline: + break + else: + line = lineno[0] + elif len(lineno) == 1: + line = lineno[0] + else: + line = -1 + else: + line = lineno + + if line >= 0 and line != cline: + editor.ensureVisibleTop(line) + editor.gotoLine(line, pos) if selStart != selEnd: - editor.setSelection(lineno - 1, selStart, lineno - 1, selEnd) + editor.setSelection(line - 1, selStart, line - 1, selEnd) # insert filename into list of recently opened files self.addToRecentList(fn)