3101 self.currentEditor.highlight() |
3101 self.currentEditor.highlight() |
3102 self.currentEditor = None |
3102 self.currentEditor = None |
3103 |
3103 |
3104 self.__setSbFile() |
3104 self.__setSbFile() |
3105 |
3105 |
3106 def openSourceFile(self, fn, lineno = None, filetype = "", selection = None): |
3106 def openSourceFile(self, fn, lineno = None, filetype = "", selStart = 0, selEnd = 0): |
3107 """ |
3107 """ |
3108 Public slot to display a file in an editor. |
3108 Public slot to display a file in an editor. |
3109 |
3109 |
3110 @param fn name of file to be opened |
3110 @param fn name of file to be opened (string) |
3111 @param lineno line number to place the cursor at |
3111 @param lineno line number to place the cursor at (integer) |
3112 @param filetype type of the source file (string) |
3112 @param filetype type of the source file (string) |
3113 @param selection tuple (start, end) of an area to be selected |
3113 @param selStart start of an area to be selected (integer) |
|
3114 @param selEnd end of an area to be selected (integer) |
3114 """ |
3115 """ |
3115 try: |
3116 try: |
3116 newWin, editor = self.getEditor(fn, filetype = filetype) |
3117 newWin, editor = self.getEditor(fn, filetype = filetype) |
3117 except (IOError, UnicodeDecodeError): |
3118 except (IOError, UnicodeDecodeError): |
3118 return |
3119 return |
3123 |
3124 |
3124 if lineno is not None and lineno >= 0: |
3125 if lineno is not None and lineno >= 0: |
3125 editor.ensureVisibleTop(lineno) |
3126 editor.ensureVisibleTop(lineno) |
3126 editor.gotoLine(lineno) |
3127 editor.gotoLine(lineno) |
3127 |
3128 |
3128 if selection is not None: |
3129 if selStart != selEnd: |
3129 editor.setSelection(lineno - 1, selection[0], lineno - 1, selection[1]) |
3130 editor.setSelection(lineno - 1, selStart, lineno - 1, selEnd) |
3130 |
3131 |
3131 # insert filename into list of recently opened files |
3132 # insert filename into list of recently opened files |
3132 self.addToRecentList(fn) |
3133 self.addToRecentList(fn) |
3133 |
3134 |
3134 def __connectEditor(self, editor): |
3135 def __connectEditor(self, editor): |