示例#1
0
def save_database_backup(origin):
    defpath = time.strftime('{}_%Y%m%d%H%M%S{}'.format(
                                                    *os.path.splitext(origin)))
    destination = create_database(defpath=defpath)

    if destination:
        try:
            core_api.save_database_copy(origin, destination)
        except OutsplineError as err:
            # This will leave the new created file empty, see bug #322
            warn_aborted_save(err)
示例#2
0
def save_database_backup(origin):
    defpath = time.strftime(
        '{}_%Y%m%d%H%M%S{}'.format(*os.path.splitext(origin)))
    destination = create_database(defpath=defpath)

    if destination:
        try:
            core_api.save_database_copy(origin, destination)
        except OutsplineError as err:
            # This will leave the new created file empty, see bug #322
            warn_aborted_save(err)
示例#3
0
def save_database_as(origin):
    for tab in tuple(editor.tabs.copy()):
        if editor.tabs[tab].get_filename() == origin and \
                                                  not editor.tabs[tab].close():
            break
    else:
        defpath = '{}_copy{}'.format(*os.path.splitext(origin))
        destination = create_database(defpath=defpath)

        if destination:
            try:
                core_api.save_database_copy(origin, destination)
            except OutsplineError as err:
                # This will leave the new created file empty, see bug #322
                warn_aborted_save(err)
            else:
                close_database(origin, no_confirm=True)
                open_database(destination)
示例#4
0
def save_database_as(origin):
    for tab in tuple(editor.tabs.copy()):
        if editor.tabs[tab].get_filename() == origin and \
                                                  not editor.tabs[tab].close():
            break
    else:
        defpath = '{}_copy{}'.format(*os.path.splitext(origin))
        destination = create_database(defpath=defpath)

        if destination:
            try:
                core_api.save_database_copy(origin, destination)
            except OutsplineError as err:
                # This will leave the new created file empty, see bug #322
                warn_aborted_save(err)
            else:
                close_database(origin, no_confirm=True)
                open_database(destination)