fix(nks): workio on save_as if Untitled didnt do anything

This commit is contained in:
Jakub Jezek 2020-01-04 17:14:31 +01:00
parent c271c94bbe
commit cd4ad045e6

View file

@ -22,19 +22,16 @@ def has_unsaved_changes():
def save_file(filepath): def save_file(filepath):
file = os.path.basename(filepath)
project = hiero.core.projects()[-1] project = hiero.core.projects()[-1]
# close `Untitled` project if project:
if "Untitled" not in project.name(): log.info("Saving project: `{}` as '{}'".format(project.name(), file))
log.info("Saving project: `{}`".format(project.name()))
project.saveAs(filepath) project.saveAs(filepath)
elif not project: else:
log.info("Creating new project...") log.info("Creating new project...")
project = hiero.core.newProject() project = hiero.core.newProject()
project.saveAs(filepath) project.saveAs(filepath)
else:
log.info("Dropping `Untitled` project...")
return
def open_file(filepath): def open_file(filepath):