예제 #1
0
    def goRepack(self):
        TMPoriginalPakFilename = ""
        TMProotFolderWithExtractedFiles = ""
        TMPoriginalPakFilename = self.ui.origPakFileNameTxtBx.text().strip()
        TMProotFolderWithExtractedFiles = self.ui.extractedFolderNameTxtBx.text().strip()
        selParseMode = 0 # TODO: Select 1 or 2, based on combobox
        selParseModeStr = self.ui.selGameCmBx.itemText(self.ui.selGameCmBx.currentIndex())
        if selParseModeStr == self.MI1GameStr:
            selParseMode = self.MI1GameID
        elif selParseModeStr == self.MI2GameStr:
            selParseMode = self.MI2GameID
        #print "parsMode %d" % (selParseMode,)

        if TMPoriginalPakFilename == '' or TMProotFolderWithExtractedFiles == '' or selParseMode <= 0 or selParseMode >2:
            msgBoxesStub.qMsgBoxWarning(self.ui, "Warning", "Arguments for process are invalid.")
        else:
            myOriginalPakInstance = pakFile(TMPoriginalPakFilename)

            if(myOriginalPakInstance._pakHeader != None):
                errorFound = myOriginalPakInstance.produceModdedPak(TMProotFolderWithExtractedFiles, selParseMode)
                #errorFound = True
                if errorFound:
                    msgBoxesStub.qMsgBoxWarning(self.ui, "Warning", "Process was halted by unexpected errors during the re-packing! Failed to produce a valid pak.")
                else:
                    msgBoxesStub.qMsgBoxInformation(self.ui, "Process completed", "Process completed with no errors!")
            else:
                msgBoxesStub.qMsgBoxWarning(self.ui, "Warning", "Process was halted by unexpected errors while attempting to read from the original pak file! Process Failed.")
        return
예제 #2
0
    def showDefaultText(self):
        lettersToPrintLst = []
        del lettersToPrintLst[:]

        if self.listOfCharPngProperties is None or len(
                self.listOfCharPngProperties) <= 0:
            #print("No items detected as drawn characters!")
            msgBoxesStub.qMsgBoxInformation(
                self.ui, "Info", "No items detected as drawn characters!")
            return
        #print("Active Encoding: %s. Game mode %d" % (self.activeEnc,self.selGameID))

        stringsList = []
        del stringsList[:]
        stringsList.append(self.englishPangramStr)
        if self.activeEnc == self.greekEncoding:
            stringsList.append(self.targetLangPangramStr)
        if self.ui.customTextEdt.toPlainText().strip() != '':
            stringsList.append(self.ui.customTextEdt.toPlainText().strip())

        for tokenString in stringsList:
            myASCIIString = unicode.encode("%s" % tokenString, self.activeEnc)
            myLstChars = self.makeStringIntoModifiedAsciiCharlistToBeWritten(
                myASCIIString, self.localGrabInstance)

            for asciiChar in myLstChars:
                if asciiChar == '\x00' or asciiChar == '\x0a':
                    #print("EOS")
                    lettersToPrintLst.append(
                        (-1, -1, -1, -1, -1, -1, -1, '\x00')
                    )  ## should be used as special case to print(new line in the preview screen!)
                else:
                    if (self.pngIndexOfCharCode(asciiChar) < len(
                            self.listOfCharPngProperties)):
                        #print((asciiChar, ord(asciiChar), self.pngIndexOfCharCode(asciiChar), self.listOfCharPngProperties[self.pngIndexOfCharCode(asciiChar)] ))
                        lettersToPrintLst.append(self.listOfCharPngProperties[
                            self.pngIndexOfCharCode(asciiChar)])
                    else:
                        #print((asciiChar, ord(asciiChar), 0, self.listOfCharPngProperties[0] ))
                        lettersToPrintLst.append(
                            self.listOfCharPngProperties[0])

        self.printInPreviewScreen(lettersToPrintLst)
        return
예제 #3
0
    def goRepack(self):
        TMPoriginalPakFilename = ""
        TMProotFolderWithExtractedFiles = ""
        TMPoriginalPakFilename = self.ui.origPakFileNameTxtBx.text().strip()
        TMProotFolderWithExtractedFiles = self.ui.extractedFolderNameTxtBx.text(
        ).strip()
        selParseMode = 0  # TODO: Select 1 or 2, based on combobox
        selParseModeStr = self.ui.selGameCmBx.itemText(
            self.ui.selGameCmBx.currentIndex())
        if selParseModeStr == self.MI1GameStr:
            selParseMode = self.MI1GameID
        elif selParseModeStr == self.MI2GameStr:
            selParseMode = self.MI2GameID
        #print("parsMode %d" % (selParseMode,))

        if TMPoriginalPakFilename == '' or TMProotFolderWithExtractedFiles == '' or selParseMode <= 0 or selParseMode > 2:
            msgBoxesStub.qMsgBoxWarning(self.ui, "Warning",
                                        "Arguments for process are invalid.")
        else:
            myOriginalPakInstance = pakFile(TMPoriginalPakFilename)

            if (myOriginalPakInstance._pakHeader != None):
                errorFound = myOriginalPakInstance.produceModdedPak(
                    TMProotFolderWithExtractedFiles, selParseMode)
                #errorFound = True
                if errorFound:
                    msgBoxesStub.qMsgBoxWarning(
                        self.ui, "Warning",
                        "Process was halted by unexpected errors during the re-packing! Failed to produce a valid pak."
                    )
                else:
                    msgBoxesStub.qMsgBoxInformation(
                        self.ui, "Process completed",
                        "Process completed with no errors!")
            else:
                msgBoxesStub.qMsgBoxWarning(
                    self.ui, "Warning",
                    "Process was halted by unexpected errors while attempting to read from the original pak file! Process Failed."
                )
        return
    def showDefaultText(self):
        lettersToPrintLst = []
        del lettersToPrintLst[:]

        if self.listOfCharPngProperties is None or len(self.listOfCharPngProperties) <=0:
            #print "No items detected as drawn characters!"
            msgBoxesStub.qMsgBoxInformation(self.ui, "Info", "No items detected as drawn characters!")
            return
        #print "Active Encoding: %s. Game mode %d" % (self.activeEnc,self.selGameID)

        stringsList = []
        del stringsList [:]
        stringsList.append(self.englishPangramStr)
        if self.activeEnc == self.greekEncoding:
            stringsList.append(self.targetLangPangramStr)
        if self.ui.customTextEdt.toPlainText().strip() != '':
            stringsList.append(self.ui.customTextEdt.toPlainText().strip() )

        for tokenString in stringsList:
            myASCIIString = unicode.encode("%s" % tokenString, self.activeEnc)
            myLstChars = self.makeStringIntoModifiedAsciiCharlistToBeWritten(myASCIIString, self.localGrabInstance)

            for asciiChar in myLstChars:
                if asciiChar == '\x00' or asciiChar == '\x0a':
                    #print "EOS"
                    lettersToPrintLst.append((-1,-1,-1,-1,-1,-1,-1, '\x00')) ## should be used as special case to print new line in the preview screen!
                else:
                    if(self.pngIndexOfCharCode(asciiChar) < len(self.listOfCharPngProperties)):
                        #print (asciiChar, ord(asciiChar), self.pngIndexOfCharCode(asciiChar), self.listOfCharPngProperties[self.pngIndexOfCharCode(asciiChar)] )
                        lettersToPrintLst.append(self.listOfCharPngProperties[self.pngIndexOfCharCode(asciiChar)])
                    else:
                        #print (asciiChar, ord(asciiChar), 0, self.listOfCharPngProperties[0] )
                        lettersToPrintLst.append(self.listOfCharPngProperties[0] )

        self.printInPreviewScreen(lettersToPrintLst)
        return