382 @param win editor window to be removed |
382 @param win editor window to be removed |
383 @exception RuntimeError Not implemented |
383 @exception RuntimeError Not implemented |
384 """ |
384 """ |
385 raise RuntimeError('Not implemented') |
385 raise RuntimeError('Not implemented') |
386 |
386 |
387 def _addView(self, win, fn=None, noName=""): |
387 def _addView(self, win, fn=None, noName="", next=False): |
388 """ |
388 """ |
389 Protected method to add a view (i.e. window). |
389 Protected method to add a view (i.e. window). |
390 |
390 |
391 @param win editor assembly to be added |
391 @param win editor assembly to be added |
392 @param fn filename of this editor |
392 @param fn filename of this editor |
393 @param noName name to be used for an unnamed editor (string) |
393 @param noName name to be used for an unnamed editor (string) |
|
394 @param next flag indicating to add the view next to the current |
|
395 view (bool) |
394 @exception RuntimeError Not implemented |
396 @exception RuntimeError Not implemented |
395 """ |
397 """ |
396 raise RuntimeError('Not implemented') |
398 raise RuntimeError('Not implemented') |
397 |
399 |
398 def _showView(self, win, fn=None): |
400 def _showView(self, win, fn=None): |
4404 editor.refreshCoverageAnnotations() |
4406 editor.refreshCoverageAnnotations() |
4405 |
4407 |
4406 self.__setSbFile() |
4408 self.__setSbFile() |
4407 |
4409 |
4408 def openSourceFile(self, fn, lineno=-1, filetype="", |
4410 def openSourceFile(self, fn, lineno=-1, filetype="", |
4409 selStart=0, selEnd=0, pos=0): |
4411 selStart=0, selEnd=0, pos=0, next=False): |
4410 """ |
4412 """ |
4411 Public slot to display a file in an editor. |
4413 Public slot to display a file in an editor. |
4412 |
4414 |
4413 @param fn name of file to be opened (string) |
4415 @param fn name of file to be opened (string) |
4414 @param lineno line number to place the cursor at (integer) or |
4416 @param lineno line number to place the cursor at (integer) or |
4416 placed at the next line greater than the current one) |
4418 placed at the next line greater than the current one) |
4417 @param filetype type of the source file (string) |
4419 @param filetype type of the source file (string) |
4418 @param selStart start of an area to be selected (integer) |
4420 @param selStart start of an area to be selected (integer) |
4419 @param selEnd end of an area to be selected (integer) |
4421 @param selEnd end of an area to be selected (integer) |
4420 @param pos position within the line to place the cursor at (integer) |
4422 @param pos position within the line to place the cursor at (integer) |
|
4423 @param next flag indicating to add the file next to the current |
|
4424 editor (bool) |
4421 """ |
4425 """ |
4422 try: |
4426 try: |
4423 newWin, editor = self.getEditor(fn, filetype=filetype) |
4427 newWin, editor = self.getEditor(fn, filetype=filetype, next=next) |
4424 except (IOError, UnicodeDecodeError): |
4428 except (IOError, UnicodeDecodeError): |
4425 return |
4429 return |
4426 |
4430 |
4427 if newWin: |
4431 if newWin: |
4428 self._modificationStatusChanged(editor.isModified(), editor) |
4432 self._modificationStatusChanged(editor.isModified(), editor) |
4702 # only return names of existing files |
4706 # only return names of existing files |
4703 filenames.append(fn) |
4707 filenames.append(fn) |
4704 |
4708 |
4705 return filenames |
4709 return filenames |
4706 |
4710 |
4707 def getEditor(self, fn, filetype=""): |
4711 def getEditor(self, fn, filetype="", next=False): |
4708 """ |
4712 """ |
4709 Public method to return the editor displaying the given file. |
4713 Public method to return the editor displaying the given file. |
4710 |
4714 |
4711 If there is no editor with the given file, a new editor window is |
4715 If there is no editor with the given file, a new editor window is |
4712 created. |
4716 created. |
4713 |
4717 |
4714 @param fn filename to look for |
4718 @param fn filename to look for |
4715 @param filetype type of the source file (string) |
4719 @param filetype type of the source file (string) |
|
4720 @param next flag indicating that if a new editor needs to be created, |
|
4721 it should be added next to the current editor (bool) |
4716 @return tuple of two values giving a flag indicating a new window |
4722 @return tuple of two values giving a flag indicating a new window |
4717 creation and a reference to the editor displaying this file |
4723 creation and a reference to the editor displaying this file |
4718 """ |
4724 """ |
4719 newWin = False |
4725 newWin = False |
4720 editor = self.activeWindow() |
4726 editor = self.activeWindow() |
4734 self.editorOpened.emit(fn) |
4740 self.editorOpened.emit(fn) |
4735 self.editorOpenedEd.emit(editor) |
4741 self.editorOpenedEd.emit(editor) |
4736 newWin = True |
4742 newWin = True |
4737 |
4743 |
4738 if newWin: |
4744 if newWin: |
4739 self._addView(assembly, fn) |
4745 self._addView(assembly, fn, next=next) |
4740 else: |
4746 else: |
4741 self._showView(editor.parent(), fn) |
4747 self._showView(editor.parent(), fn) |
4742 |
4748 |
4743 return (newWin, editor) |
4749 return (newWin, editor) |
4744 |
4750 |