Ejemplo n.º 1
0
Archivo: ui.py Proyecto: oke-ya/ninja
    def run(self):
        """Create cocos project.
        custom message rules to notify ui
        As follow:
            begin@%d@%d@%s  --- create before
            doing@%d@%d@%s  --- creating
            end@%d@%d@%s    --- create after
        """
        #delete exist project.
        if os.path.exists(os.path.join(self.projectPath, self.projectName)):
            print ("###begin remove:  " + self.projectName)
            try:
                shutil.rmtree(os.path.join(self.projectPath, self.projectName))
                print ("###remove finish:  " + self.projectName)
            except:
                print ("###remove folder failure %s" %self.projectName)
                putMsg = "end@%d@%d@%s" %(100, 100, "create failure")
                self.queue.put(putMsg)
        putMsg = "begin@%d@%d@%s" %(0, 100, "begin create")
        self.queue.put(putMsg)

        project = CocosProject()
        breturn = project.createPlatformProjects(
            self.projectName,
            self.packageName,
            self.language,
            self.projectPath,
            self.newProjectCallBack
        )
        if breturn:
            putMsg = "end@%d@%d@%s" %(100, 100, "create successful")
        else:
            putMsg = "end@%d@%d@%s" %(100, 100, "create failure")
        self.queue.put(putMsg)
Ejemplo n.º 2
0
 def commandCreate(self, argv):
     name, package, language, directory = self.parse_args(argv);
     from core import CocosProject
     project = CocosProject()
     project.createPlatformProjects(name, package, language, directory)