602 self.resize(sh) |
602 self.resize(sh) |
603 |
603 |
604 # Make sure tabbing through a QWorkspace works. |
604 # Make sure tabbing through a QWorkspace works. |
605 self.setFocusPolicy(Qt.FocusPolicy.StrongFocus) |
605 self.setFocusPolicy(Qt.FocusPolicy.StrongFocus) |
606 |
606 |
607 self.__updateReadOnly(True) |
607 self.updateReadOnly(True) |
608 |
608 |
609 self.setWhatsThis( |
609 self.setWhatsThis( |
610 self.tr( |
610 self.tr( |
611 """<b>A Source Editor Window</b>""" |
611 """<b>A Source Editor Window</b>""" |
612 """<p>This window is used to display and edit a source file.""" |
612 """<p>This window is used to display and edit a source file.""" |
3994 if self.lexer_ is None: |
3994 if self.lexer_ is None: |
3995 self.setLanguage(self.fileName) |
3995 self.setLanguage(self.fileName) |
3996 |
3996 |
3997 self.recordModificationTime() |
3997 self.recordModificationTime() |
3998 self.vm.setEditorName(self, self.fileName) |
3998 self.vm.setEditorName(self, self.fileName) |
3999 self.__updateReadOnly(True) |
3999 self.updateReadOnly(True) |
4000 |
4000 |
4001 @pyqtSlot(str) |
4001 @pyqtSlot(str) |
4002 def fileRenamed(self, fn): |
4002 def fileRenamed(self, fn): |
4003 """ |
4003 """ |
4004 Public slot to handle the editorRenamed signal. |
4004 Public slot to handle the editorRenamed signal. |
8156 self.vm.searchActGrp.setEnabled(True) |
8156 self.vm.searchActGrp.setEnabled(True) |
8157 |
8157 |
8158 with contextlib.suppress(AttributeError): |
8158 with contextlib.suppress(AttributeError): |
8159 self.setCaretWidth(self.caretWidth) |
8159 self.setCaretWidth(self.caretWidth) |
8160 if not self.dbs.isDebugging: |
8160 if not self.dbs.isDebugging: |
8161 self.__updateReadOnly(False) |
8161 self.updateReadOnly(False) |
8162 self.setCursorFlashTime(QApplication.cursorFlashTime()) |
8162 self.setCursorFlashTime(QApplication.cursorFlashTime()) |
8163 |
8163 |
8164 if ( |
8164 if ( |
8165 self.fileName |
8165 self.fileName |
8166 and FileSystemUtilities.isRemoteFileName(self.fileName) |
8166 and FileSystemUtilities.isRemoteFileName(self.fileName) |
8341 """ |
8341 """ |
8342 with contextlib.suppress(AttributeError): |
8342 with contextlib.suppress(AttributeError): |
8343 self.__markerMap.calculateGeometry() |
8343 self.__markerMap.calculateGeometry() |
8344 return super().viewportEvent(evt) |
8344 return super().viewportEvent(evt) |
8345 |
8345 |
8346 def __updateReadOnly(self, bForce=True): |
8346 def updateReadOnly(self, bForce=True): |
8347 """ |
8347 """ |
8348 Private method to update the readOnly information for this editor. |
8348 Public method to update the readOnly information for this editor. |
8349 |
8349 |
8350 If bForce is True, then updates everything regardless if |
8350 If bForce is True, then updates everything regardless if |
8351 the attributes have actually changed, such as during |
8351 the attributes have actually changed, such as during |
8352 initialization time. A signal is emitted after the |
8352 initialization time. A signal is emitted after the |
8353 caption change. |
8353 caption change. |
9348 @type bool |
9348 @type bool |
9349 """ |
9349 """ |
9350 if not connected: |
9350 if not connected: |
9351 self.__inRemoteSharedEdit = False |
9351 self.__inRemoteSharedEdit = False |
9352 self.setReadOnly(False) |
9352 self.setReadOnly(False) |
9353 self.__updateReadOnly() |
9353 self.updateReadOnly() |
9354 self.cancelSharedEdit(send=False) |
9354 self.cancelSharedEdit(send=False) |
9355 self.__isSyncing = False |
9355 self.__isSyncing = False |
9356 self.__receivedWhileSyncing = [] |
9356 self.__receivedWhileSyncing = [] |
9357 |
9357 |
9358 def shareEditor(self, share): |
9358 def shareEditor(self, share): |
9472 @type str |
9472 @type str |
9473 """ |
9473 """ |
9474 if not self.__inSharedEdit and not self.__inRemoteSharedEdit: |
9474 if not self.__inSharedEdit and not self.__inRemoteSharedEdit: |
9475 self.__inRemoteSharedEdit = True |
9475 self.__inRemoteSharedEdit = True |
9476 self.setReadOnly(True) |
9476 self.setReadOnly(True) |
9477 self.__updateReadOnly() |
9477 self.updateReadOnly() |
9478 hashStr = str( |
9478 hashStr = str( |
9479 QCryptographicHash.hash( |
9479 QCryptographicHash.hash( |
9480 Utilities.encode(self.text(), self.encoding)[0], |
9480 Utilities.encode(self.text(), self.encoding)[0], |
9481 QCryptographicHash.Algorithm.Sha1, |
9481 QCryptographicHash.Algorithm.Sha1, |
9482 ).toHex(), |
9482 ).toHex(), |
9551 self.removeSelectedText() |
9551 self.removeSelectedText() |
9552 txt = sep.join(commands[0:l2]) + sep |
9552 txt = sep.join(commands[0:l2]) + sep |
9553 self.insertAt(txt, pos, 0) |
9553 self.insertAt(txt, pos, 0) |
9554 del commands[0:l2] |
9554 del commands[0:l2] |
9555 self.endUndoAction() |
9555 self.endUndoAction() |
9556 self.__updateReadOnly() |
9556 self.updateReadOnly() |
9557 self.__inRemoteSharedEdit = False |
9557 self.__inRemoteSharedEdit = False |
9558 |
9558 |
9559 self.setCursorPosition(*cur) |
9559 self.setCursorPosition(*cur) |
9560 |
9560 |
9561 @pyqtSlot(str) |
9561 @pyqtSlot(str) |