(self, wnd, filename=None, saved=None, document=None,
                  encoding=None, newline=None)
Save document
Save document
Save document
def file_save(self, wnd, filename=None, saved=None, document=None,
                  encoding=None, newline=None):
        "Save document"
        try:
            if not document:
                document = wnd.document
            if not filename:
                filename = document.get_filename()

            if filename:
                kaa.app.storage.save_document(
                    document, filename, encoding, newline)
                # notify file saved
                if saved:
                    saved(canceled=False)
            else:
                # no file name. Show save_as dialog.
                self.file_saveas(wnd, saved=saved, document=document)

        except Exception as e:
            kaa.log.exception('File write error:')
            self._show_msgbox(
                'File write error: ' + str(e), ['&Ok'],
                lambda c: saved(canceled=True) if saved else None,
                keys=['\r', '\n'])
def file_save ( self , wnd , filename = None , saved = None , document = None , encoding = None , newline = None ) : try : if not document : document = wnd . document if not filename : filename = document . get_filename ( ) if filename : kaa . app . storage . save_document ( document , filename , encoding , newline ) # notify file saved if saved : saved ( canceled = False ) else : # no file name. Show save_as dialog. self . file_saveas ( wnd , saved = saved , document = document ) except Exception as e : kaa . log . exception ( 'File write error:' ) self . _show_msgbox ( 'File write error: ' + str ( e ) , [ '&Ok' ] , lambda c : saved ( canceled = True ) if saved else None , keys = [ '\r' , '\n' ] )