Esempio n. 1
0
    def manage_data_dialogs(self):
        """ This flow of dialogs does the following:
         - Checks if LevelContainer has all the files pointed to the pykurin directory
         - If not, asks for a possible copy of data (if the user wants it)
         - Tries to copy all the data and presents the user with the copy
            information

            Success returns True (the level is on a pykurin directory)
            False -> The level can't be run, as it is not a pykurin directory

        """
        isalldata, outsidedata = self.DC.isAllDataInPykurinDirectory()
        if not isalldata:
            if self.copy_data_dialog(outsidedata):
                # Get ready to copy files
                try:
                    cplist = self.DC.copyOutsidersToPykurinDirectory()
                except Exception as e:
                    error_message("ERROR", e)
                    return False

                tkTextViewer(self.master, title="COPY LOG", textdata="COPIED\n%s" % "\n".join(cplist), islog=True)
                return True
            else:
                return False
        else:
            return True
Esempio n. 2
0
    def f_deploy_to_pykurin(self):
        # Check for errors before attempting a save
        if self._save_level_errcheck():
            return

        if not ask_dialog("DEPLOY", "Save the level an all its files to pykurin directory"):
            return

        # if not self.manage_data_dialogs():
        #    return

        fname = self.DC.get_deploy_filename()
        log = self.manage_level_data()
        ret, msg = self.DC.save_to_file(fname)

        data = log

        if ret:
            data += ["DEPLOYED TO %s" % fname]
        else:
            data += ["ERROR SAVING %s: %s" % (fname, msg)]

        tkTextViewer(self.master, title="DEPLOY LOG", textdata="\n".join(data), islog=True)