3141 @param filetype type of the source file (string) |
3141 @param filetype type of the source file (string) |
3142 @param fn filename of this view |
3142 @param fn filename of this view |
3143 @return reference to the new editor object (Editor.Editor) |
3143 @return reference to the new editor object (Editor.Editor) |
3144 """ |
3144 """ |
3145 editor = Editor(self.dbs, fn, self, filetype = filetype, editor = caller, |
3145 editor = Editor(self.dbs, fn, self, filetype = filetype, editor = caller, |
3146 tv = e4App().getObject("TaskViewer")) |
3146 tv = e5App().getObject("TaskViewer")) |
3147 self.editors.append(editor) |
3147 self.editors.append(editor) |
3148 self.__connectEditor(editor) |
3148 self.__connectEditor(editor) |
3149 self.__editorOpened() |
3149 self.__editorOpened() |
3150 self.emit(SIGNAL('editorOpened'), fn) |
3150 self.emit(SIGNAL('editorOpened'), fn) |
3151 self.emit(SIGNAL('editorOpenedEd'), editor) |
3151 self.emit(SIGNAL('editorOpenedEd'), editor) |
3293 for editor in self.editors: |
3293 for editor in self.editors: |
3294 if Utilities.samepath(fn, editor.getFileName()): |
3294 if Utilities.samepath(fn, editor.getFileName()): |
3295 break |
3295 break |
3296 else: |
3296 else: |
3297 editor = Editor(self.dbs, fn, self, filetype = filetype, |
3297 editor = Editor(self.dbs, fn, self, filetype = filetype, |
3298 tv = e4App().getObject("TaskViewer")) |
3298 tv = e5App().getObject("TaskViewer")) |
3299 self.editors.append(editor) |
3299 self.editors.append(editor) |
3300 self.__connectEditor(editor) |
3300 self.__connectEditor(editor) |
3301 self.__editorOpened() |
3301 self.__editorOpened() |
3302 self.emit(SIGNAL('editorOpened'), fn) |
3302 self.emit(SIGNAL('editorOpened'), fn) |
3303 self.emit(SIGNAL('editorOpenedEd'), editor) |
3303 self.emit(SIGNAL('editorOpenedEd'), editor) |
3490 |
3490 |
3491 def newEditor(self): |
3491 def newEditor(self): |
3492 """ |
3492 """ |
3493 Public slot to generate a new empty editor. |
3493 Public slot to generate a new empty editor. |
3494 """ |
3494 """ |
3495 editor = Editor(self.dbs, None, self, tv = e4App().getObject("TaskViewer")) |
3495 editor = Editor(self.dbs, None, self, tv = e5App().getObject("TaskViewer")) |
3496 self.editors.append(editor) |
3496 self.editors.append(editor) |
3497 self.__connectEditor(editor) |
3497 self.__connectEditor(editor) |
3498 self._addView(editor, None) |
3498 self._addView(editor, None) |
3499 self.__editorOpened() |
3499 self.__editorOpened() |
3500 self._checkActions(editor) |
3500 self._checkActions(editor) |
3704 |
3704 |
3705 def __editCut(self): |
3705 def __editCut(self): |
3706 """ |
3706 """ |
3707 Private method to handle the cut action. |
3707 Private method to handle the cut action. |
3708 """ |
3708 """ |
3709 if QApplication.focusWidget() == e4App().getObject("Shell"): |
3709 if QApplication.focusWidget() == e5App().getObject("Shell"): |
3710 e4App().getObject("Shell").cut() |
3710 e5App().getObject("Shell").cut() |
3711 elif QApplication.focusWidget() == e4App().getObject("Terminal"): |
3711 elif QApplication.focusWidget() == e5App().getObject("Terminal"): |
3712 e4App().getObject("Terminal").cut() |
3712 e5App().getObject("Terminal").cut() |
3713 else: |
3713 else: |
3714 self.activeWindow().cut() |
3714 self.activeWindow().cut() |
3715 |
3715 |
3716 def __editCopy(self): |
3716 def __editCopy(self): |
3717 """ |
3717 """ |
3718 Private method to handle the copy action. |
3718 Private method to handle the copy action. |
3719 """ |
3719 """ |
3720 if QApplication.focusWidget() == e4App().getObject("Shell"): |
3720 if QApplication.focusWidget() == e5App().getObject("Shell"): |
3721 e4App().getObject("Shell").copy() |
3721 e5App().getObject("Shell").copy() |
3722 elif QApplication.focusWidget() == e4App().getObject("Terminal"): |
3722 elif QApplication.focusWidget() == e5App().getObject("Terminal"): |
3723 e4App().getObject("Terminal").copy() |
3723 e5App().getObject("Terminal").copy() |
3724 else: |
3724 else: |
3725 self.activeWindow().copy() |
3725 self.activeWindow().copy() |
3726 |
3726 |
3727 def __editPaste(self): |
3727 def __editPaste(self): |
3728 """ |
3728 """ |
3729 Private method to handle the paste action. |
3729 Private method to handle the paste action. |
3730 """ |
3730 """ |
3731 if QApplication.focusWidget() == e4App().getObject("Shell"): |
3731 if QApplication.focusWidget() == e5App().getObject("Shell"): |
3732 e4App().getObject("Shell").paste() |
3732 e5App().getObject("Shell").paste() |
3733 elif QApplication.focusWidget() == e4App().getObject("Terminal"): |
3733 elif QApplication.focusWidget() == e5App().getObject("Terminal"): |
3734 e4App().getObject("Terminal").paste() |
3734 e5App().getObject("Terminal").paste() |
3735 else: |
3735 else: |
3736 self.activeWindow().paste() |
3736 self.activeWindow().paste() |
3737 |
3737 |
3738 def __editDelete(self): |
3738 def __editDelete(self): |
3739 """ |
3739 """ |
3740 Private method to handle the delete action. |
3740 Private method to handle the delete action. |
3741 """ |
3741 """ |
3742 if QApplication.focusWidget() == e4App().getObject("Shell"): |
3742 if QApplication.focusWidget() == e5App().getObject("Shell"): |
3743 e4App().getObject("Shell").clear() |
3743 e5App().getObject("Shell").clear() |
3744 elif QApplication.focusWidget() == e4App().getObject("Terminal"): |
3744 elif QApplication.focusWidget() == e5App().getObject("Terminal"): |
3745 e4App().getObject("Terminal").clear() |
3745 e5App().getObject("Terminal").clear() |
3746 else: |
3746 else: |
3747 self.activeWindow().clear() |
3747 self.activeWindow().clear() |
3748 |
3748 |
3749 def __editIndent(self): |
3749 def __editIndent(self): |
3750 """ |
3750 """ |
4101 |
4101 |
4102 def __zoomIn(self): |
4102 def __zoomIn(self): |
4103 """ |
4103 """ |
4104 Private method to handle the zoom in action. |
4104 Private method to handle the zoom in action. |
4105 """ |
4105 """ |
4106 if QApplication.focusWidget() == e4App().getObject("Shell"): |
4106 if QApplication.focusWidget() == e5App().getObject("Shell"): |
4107 e4App().getObject("Shell").zoomIn() |
4107 e5App().getObject("Shell").zoomIn() |
4108 elif QApplication.focusWidget() == e4App().getObject("Terminal"): |
4108 elif QApplication.focusWidget() == e5App().getObject("Terminal"): |
4109 e4App().getObject("Terminal").zoomIn() |
4109 e5App().getObject("Terminal").zoomIn() |
4110 else: |
4110 else: |
4111 aw = self.activeWindow() |
4111 aw = self.activeWindow() |
4112 if aw: |
4112 if aw: |
4113 aw.zoomIn() |
4113 aw.zoomIn() |
4114 |
4114 |
4115 def __zoomOut(self): |
4115 def __zoomOut(self): |
4116 """ |
4116 """ |
4117 Private method to handle the zoom out action. |
4117 Private method to handle the zoom out action. |
4118 """ |
4118 """ |
4119 if QApplication.focusWidget() == e4App().getObject("Shell"): |
4119 if QApplication.focusWidget() == e5App().getObject("Shell"): |
4120 e4App().getObject("Shell").zoomOut() |
4120 e5App().getObject("Shell").zoomOut() |
4121 elif QApplication.focusWidget() == e4App().getObject("Terminal"): |
4121 elif QApplication.focusWidget() == e5App().getObject("Terminal"): |
4122 e4App().getObject("Terminal").zoomOut() |
4122 e5App().getObject("Terminal").zoomOut() |
4123 else: |
4123 else: |
4124 aw = self.activeWindow() |
4124 aw = self.activeWindow() |
4125 if aw: |
4125 if aw: |
4126 aw.zoomOut() |
4126 aw.zoomOut() |
4127 |
4127 |
4128 def __zoom(self): |
4128 def __zoom(self): |
4129 """ |
4129 """ |
4130 Private method to handle the zoom action. |
4130 Private method to handle the zoom action. |
4131 """ |
4131 """ |
4132 if QApplication.focusWidget() == e4App().getObject("Shell"): |
4132 if QApplication.focusWidget() == e5App().getObject("Shell"): |
4133 aw = e4App().getObject("Shell") |
4133 aw = e5App().getObject("Shell") |
4134 elif QApplication.focusWidget() == e4App().getObject("Terminal"): |
4134 elif QApplication.focusWidget() == e5App().getObject("Terminal"): |
4135 aw = e4App().getObject("Terminal") |
4135 aw = e5App().getObject("Terminal") |
4136 else: |
4136 else: |
4137 aw = self.activeWindow() |
4137 aw = self.activeWindow() |
4138 if aw: |
4138 if aw: |
4139 dlg = ZoomDialog(aw.getZoom(), self.ui, None, True) |
4139 dlg = ZoomDialog(aw.getZoom(), self.ui, None, True) |
4140 if dlg.exec_() == QDialog.Accepted: |
4140 if dlg.exec_() == QDialog.Accepted: |
4707 Private method to send an editor command to the active window. |
4707 Private method to send an editor command to the active window. |
4708 |
4708 |
4709 @param cmd the scintilla command to be sent |
4709 @param cmd the scintilla command to be sent |
4710 """ |
4710 """ |
4711 focusWidget = QApplication.focusWidget() |
4711 focusWidget = QApplication.focusWidget() |
4712 if focusWidget == e4App().getObject("Shell"): |
4712 if focusWidget == e5App().getObject("Shell"): |
4713 e4App().getObject("Shell").editorCommand(cmd) |
4713 e5App().getObject("Shell").editorCommand(cmd) |
4714 elif focusWidget == e4App().getObject("Terminal"): |
4714 elif focusWidget == e5App().getObject("Terminal"): |
4715 e4App().getObject("Terminal").editorCommand(cmd) |
4715 e5App().getObject("Terminal").editorCommand(cmd) |
4716 elif focusWidget == self.quickFindtextCombo: |
4716 elif focusWidget == self.quickFindtextCombo: |
4717 self.quickFindtextCombo._editor.editorCommand(cmd) |
4717 self.quickFindtextCombo._editor.editorCommand(cmd) |
4718 else: |
4718 else: |
4719 aw = self.activeWindow() |
4719 aw = self.activeWindow() |
4720 if aw: |
4720 if aw: |
4724 """ |
4724 """ |
4725 Private method to insert a new line below the current one even if |
4725 Private method to insert a new line below the current one even if |
4726 cursor is not at the end of the line. |
4726 cursor is not at the end of the line. |
4727 """ |
4727 """ |
4728 focusWidget = QApplication.focusWidget() |
4728 focusWidget = QApplication.focusWidget() |
4729 if focusWidget == e4App().getObject("Shell") or \ |
4729 if focusWidget == e5App().getObject("Shell") or \ |
4730 focusWidget == e4App().getObject("Terminal") or \ |
4730 focusWidget == e5App().getObject("Terminal") or \ |
4731 focusWidget == self.quickFindtextCombo: |
4731 focusWidget == self.quickFindtextCombo: |
4732 return |
4732 return |
4733 else: |
4733 else: |
4734 aw = self.activeWindow() |
4734 aw = self.activeWindow() |
4735 if aw: |
4735 if aw: |
4767 if self.activeWindow() is not None and \ |
4767 if self.activeWindow() is not None and \ |
4768 self.activeWindow().getFileName(): |
4768 self.activeWindow().getFileName(): |
4769 return os.path.dirname(self.activeWindow().getFileName()) |
4769 return os.path.dirname(self.activeWindow().getFileName()) |
4770 |
4770 |
4771 # check, if there is an active project and return its path |
4771 # check, if there is an active project and return its path |
4772 elif e4App().getObject("Project").isOpen(): |
4772 elif e5App().getObject("Project").isOpen(): |
4773 return e4App().getObject("Project").ppath |
4773 return e5App().getObject("Project").ppath |
4774 |
4774 |
4775 else: |
4775 else: |
4776 # None will cause open dialog to start with cwd |
4776 # None will cause open dialog to start with cwd |
4777 return "" |
4777 return "" |
4778 |
4778 |