Пример #1
0
def SaveProjectAS(mainwindow, filehistory):
    kernel.System.fire_event("SaveProject")
    if "PROJECT" in kernel.GlobalObjects and (kernel.GlobalObjects["PROJECT"] is not None):
        project = kernel.GlobalObjects["PROJECT"]
        defaultpath = (os.path.join(wx.StandardPaths.Get().GetDocumentsDir(),
                                    "ARC"))
        dlg = wx.DirDialog(mainwindow, "Choose a Location:",
                           defaultPath=defaultpath,
                           style=wx.DD_DEFAULT_STYLE
                           | wx.DD_NEW_DIR_BUTTON)
        if dlg.ShowModal() == wx.ID_OK:
            location = dlg.GetPath()
            path = os.path.join(location, "Project.arcproj")
            filehistory.AddFileToHistory(path)
            projectsaver = ARCProjectSaver()
            # this might take a while lets say we busy
            kernel.StatusBar.BeginTask(1, "Saving Project")
            projectsaver.save(path)
            # ok done saving, that was the longest part of it
            kernel.StatusBar.updateTask(1, "Finished Saving")
            # set the current project directory
            if "CurrentProjectDir" in kernel.GlobalObjects:
                kernel.GlobalObjects[
                    "CurrentProjectDir"] = os.path.dirname(path)
            else:
                kernel.GlobalObjects.newKey("CurrentProjectDir", "CORE", os.path.dirname(path))
            kernel.StatusBar.EndTask()
    else:
        kernel.Log(
            "No current project, project not saved", "[Save AS Project Handeler]")
Пример #2
0
def SaveProject():
    kernel.System.fire_event("SaveProject")
    if "PROJECT" in kernel.GlobalObjects and (kernel.GlobalObjects["PROJECT"] is not None):
        project = kernel.GlobalObjects["PROJECT"]
        if "CurrentProjectDir" in kernel.GlobalObjects and not (kernel.GlobalObjects["CurrentProjectDir"] == ""):
            path = kernel.GlobalObjects["CurrentProjectDir"]
        else:
            path = os.path.join(
                wx.StandardPaths.Get().GetDocumentsDir(), "ARC", "TEMP_No_project_dirrectory_save")
        projectsaver = ARCProjectSaver(project)
        # this might take a while lets say we busy
        kernel.StatusBar.BeginTask(1, "Saving Project")
        projectsaver.save(path)
        kernel.StatusBar.updateTask(1, "Finished Saving")
        # ok done saving, that was the longest part of it
        kernel.System.fire_event("RefreshProject")
        kernel.StatusBar.EndTask()
    else:
        kernel.Log(
            "No current project, project not saved", "[Save Project Handeler]")