+ if document.GetFilename() and os.path.normcase(document.GetFilename()) == os.path.normcase(path):
+ """ check for file modification outside of application """
+ if os.path.exists(path) and os.path.getmtime(path) != document.GetDocumentModificationDate():
+ msgTitle = wx.GetApp().GetAppName()
+ if not msgTitle:
+ msgTitle = _("Warning")
+ shortName = document.GetPrintableName()
+ res = wx.MessageBox(_("'%s' has been modified outside of %s. Reload '%s' from file system?") % (shortName, msgTitle, shortName),
+ msgTitle,
+ wx.YES_NO | wx.ICON_QUESTION,
+ self.FindSuitableParent())
+ if res == wx.YES:
+ if not self.CloseDocument(document, False):
+ wx.MessageBox(_("Couldn't reload '%s'. Unable to close current '%s'.") % (shortName, shortName))
+ return None
+ return self.CreateDocument(path, flags)
+ elif res == wx.NO: # don't ask again
+ document.SetDocumentModificationDate()
+