Example #1
0
def onCloseFile(event):
    """close an open file"""
    logging.debug("Starting")
    richEditor = remgr.RichEditorManager().getFocusedRichEditor()
    if richEditor is not None:
        canClose = True
        if richEditor.styledText.GetModify():
            choice = self.askYesNoCancelQuestion("This file has been modified. Save changes?")
            if choice == wx.ID_YES:
                richEditor.saveFile()
            elif choice == wx.ID_CANCEL:
                canClose = False
        if canClose:
            fullname = richEditor.getFilename()
            util.closeFile(fullname)
    else:
        logging.warn("No rich editor is open")
Example #2
0
def onCloseFile(event):
    """close an open file"""
    logging.debug("Starting")
    richEditor = remgr.RichEditorManager().getFocusedRichEditor()
    if richEditor is not None:
        canClose = True
        if richEditor.styledText.GetModify():
            choice = self.askYesNoCancelQuestion(
                "This file has been modified. Save changes?")
            if choice == wx.ID_YES:
                richEditor.saveFile()
            elif choice == wx.ID_CANCEL:
                canClose = False
        if canClose:
            fullname = richEditor.getFilename()
            util.closeFile(fullname)
    else:
        logging.warn("No rich editor is open")
Example #3
0
 def handleCloseFileRequest(self, fullname):
     """called to close an open file"""
     if self.ensureFilesAreSavedToPoceed((fullname,)):
         util.closeFile(fullname)