src/eric7/QScintilla/Editor.py

branch
eric7-maintenance
changeset 10892
409d010d7cae
parent 10873
4e8e63df7893
parent 10878
c9f329692cf0
child 10941
07cad049002c
equal deleted inserted replaced
10874:8f58c95bc6a8 10892:409d010d7cae
8397 Public slot to check, if the file needs to be re-read, and refresh it if 8397 Public slot to check, if the file needs to be re-read, and refresh it if
8398 needed. 8398 needed.
8399 """ 8399 """
8400 if self.__checkExternalModification and self.checkModificationTime(): 8400 if self.__checkExternalModification and self.checkModificationTime():
8401 if Preferences.getEditor("AutoReopen") and not self.isModified(): 8401 if Preferences.getEditor("AutoReopen") and not self.isModified():
8402 self.__refresh() 8402 self.refresh()
8403 else: 8403 else:
8404 msg = self.tr( 8404 msg = self.tr(
8405 """<p>The file <b>{0}</b> has been changed while it""" 8405 """<p>The file <b>{0}</b> has been changed while it"""
8406 """ was opened in eric. Reread it?</p>""" 8406 """ was opened in eric. Reread it?</p>"""
8407 ).format(self.fileName) 8407 ).format(self.fileName)
8418 msg, 8418 msg,
8419 icon=EricMessageBox.Warning, 8419 icon=EricMessageBox.Warning,
8420 yesDefault=yesDefault, 8420 yesDefault=yesDefault,
8421 ) 8421 )
8422 if res: 8422 if res:
8423 self.__refresh() 8423 self.refresh()
8424 else: 8424 else:
8425 # do not prompt for this change again... 8425 # do not prompt for this change again...
8426 self.recordModificationTime() 8426 self.recordModificationTime()
8427 8427
8428 def getModificationTime(self): 8428 def getModificationTime(self):
8497 return pathlib.Path(filename).stat().st_mtime != self.lastModified 8497 return pathlib.Path(filename).stat().st_mtime != self.lastModified
8498 8498
8499 return False 8499 return False
8500 8500
8501 @pyqtSlot() 8501 @pyqtSlot()
8502 def __refresh(self): 8502 def refresh(self):
8503 """ 8503 """
8504 Private slot to refresh the editor contents. 8504 Public slot to refresh the editor contents.
8505 """ 8505 """
8506 # save cursor position 8506 # save cursor position
8507 cline, cindex = self.getCursorPosition() 8507 cline, cindex = self.getCursorPosition()
8508 8508
8509 # save bookmarks and breakpoints and clear them 8509 # save bookmarks and breakpoints and clear them
8568 ) 8568 )
8569 if self.isModified() 8569 if self.isModified()
8570 else True 8570 else True
8571 ) 8571 )
8572 if ok: 8572 if ok:
8573 self.__refresh() 8573 self.refresh()
8574 8574
8575 def setMonospaced(self, on): 8575 def setMonospaced(self, on):
8576 """ 8576 """
8577 Public method to set/reset a monospaced font. 8577 Public method to set/reset a monospaced font.
8578 8578

eric ide

mercurial