def getSaveFile(parent, title, dir_description, key, ext, fname=None):
 config_key = (dir_description + 'Directory')
 base = aqt.mw.pm.profile.get(config_key, aqt.mw.pm.base)
 path = os.path.join(base, fname)
 file = QFileDialog.getSaveFileName(parent, title, path, '{0} (*{1})'.format(key, ext), options=QFileDialog.DontConfirmOverwrite)[0]
 if file:
  if (not file.lower().endswith(ext)):
   file += ext
  dir = os.path.dirname(file)
  aqt.mw.pm.profile[config_key] = dir
  if os.path.exists(file):
   if (not askUser(_('This file exists. Are you sure you want to overwrite it?'), parent)):
    return None
 return file

def getSaveFile ( parent , title , dir_description , key , ext , fname = None ) : config_key = ( dir_description + 'Directory' ) base = aqt . mw . pm . profile . get ( config_key , aqt . mw . pm . base ) path = os . path . join ( base , fname ) file = QFileDialog . getSaveFileName ( parent , title , path , '{0} (*{1})' . format ( key , ext ) , options = QFileDialog . DontConfirmOverwrite ) [ 0 ] if file : if ( not file . lower ( ) . endswith ( ext ) ) : file += ext dir = os . path . dirname ( file ) aqt . mw . pm . profile [ config_key ] = dir if os . path . exists ( file ) : if ( not askUser ( _ ( 'This file exists. Are you sure you want to overwrite it?' ) , parent ) ) : return None return file
ask the user for a file to save .