Ejemplo n.º 1
0
    def addNewProject(self, event=None):

        projName = self.controller.input("Enter a project name...")

        if not projName:
            return

        print "creating folders and files for ", projName

        tgt = os.path.join(self.getProjectDir(), projName)

        if os.path.isdir(tgt):
            m = "A project with the name '" + projName + "' already exists ! "
            self.controller.errorMessage(m)
            return

        else:

            template = self.controller.showTemplateDialog()
            if not template:
                return

            src = os.path.join(self.getSystemPath(), "templates", template)

            self.controller.showProgress(limit=1, Message="Creating project...", title="Creating project...")
            copyFileTree(src, tgt, self.controller.updateProgressPulse, ("creating: " + projName))

            self.controller.addProjectIconToTree(projName)
            self.controller.killProgressBar()
Ejemplo n.º 2
0
 def addNewProject(self, templatePath, newProjectDir, newProjectName):
     
     """ 
         The actual project creation 
         The info.json file is ignored
     
     """
     copyFileTree(templatePath, newProjectDir,["info.json"], self.controller.updateProgressPulse, ("creating: " + newProjectName))
     if newProjectDir not in self.linkedProjectPaths:
         self.linkedProjectPaths.append(newProjectDir)
         self.updateLinkedProjects()
         
         # do the Sanbox stuff
         self.setSecurityScopedBookmark(newProjectDir)
Ejemplo n.º 3
0
    def importProject(self, event=None):
        """
        Imports a project and converts it to actual settings, 
        doing several checks at the same time. Returns a boolean 
        indicating outcome.
        """

        project = self.controller.importProjectDialog()
        if not project:
            return

        projectFolder = self.getProjectDir()

        # TO DO: Brinick is confused. Why do we bother calling the converter?
        # It seems the only thing that marks a folder as a makerProject
        # is the presence of a sub directory called 'parts'.
        # And commenting out the line below does not seem to prevent me from
        # successfully importing a project. So what's its purpose?

        # Gerald: We used to have a dist table for each language among other
        # odd things the newer project version avoids these

        # verify if project settings are up to date
        makerProjectConverter.Verify(project)

        if not os.path.isdir(os.path.join(project, "parts")):
            self.controller.errorMessage("%s is not a maker project !" % project)
            return

        print "%s is a maker project" % project
        print "importing: %s" % project
        print "Project: %s" % project
        print "ProjectFolder: %s" % projectFolder

        proj = os.path.basename(project)
        dest = os.path.join(projectFolder, proj)
        if os.path.isdir(dest):
            self.controller.errorMessage("A project named %s already exists!" % dest)
            return

        try:
            self.controller.showProgress(4, " ")
            self.controller.updateProgressPulse("importing: " + proj)

            copyFileTree(
                project, os.path.join(projectFolder, proj), self.controller.updateProgressPulse, ("importing: " + proj)
            )

            # m = "The project ' %s ' has been imported..." % proj

            self.controller.addProjectIconToTree(proj)
            self.controller.killProgressBar()

            return
        except Exception, e:
            self.controller.killProgressBar()
            m = "Unable to import project: %s\n" % project
            m += "Detailed Information:\n\n" + str(e)

            self.controller.errorMessage(m)
            return