Esempio n. 1
0
 def onSave(*args):
     dir = CFL.getFile("Directory")
     if len(dir) < 1:
         directoryMain.makeDirectoryWidgetMain()
     currentLocation = cmds.file(q=True, loc=True)
     currentSceneName = cmds.file(file, q=True, shn=True, sn=True)
     if CFL.checkSaveLocation(currentLocation, currentSceneName) is True:
         # print("hey, we're doing it!")
         # get the current name, trimming the file location data
         currentName = cmds.file(file, q=True, sn=True, shn=True)
         # make sure it's a string, and give it to the validation
         stringName = str(currentName)
         # ask it to validate the name
         validateResult = FV.validateFileName(stringName)
         if type(validateResult) is not NoneType:
             # if things weren't right then we need to open the UI to tell the user that
             cmds.file(rename='TEMP.ma')
             if popWantBool is False:
                 errorMessage = "This name has one or more formatting errors, they are as follows: " + str(
                     validateResult)
                 om.MGlobal.displayError(errorMessage)
                 cmds.evalDeferred(
                     'om.MGlobal.displayError("This name has one or more formatting errors, check log! Click on semicolon to the right of this line.")'
                 )
             else:
                 IM.makeInterruptSaveWidgetMain(desiredName=stringName)
         if type(validateResult) is NoneType:
             print("This name passed all the rules!")
     if CFL.checkSaveLocation(currentLocation, currentSceneName) is False:
         print("We don't need to check file names in this location")
Esempio n. 2
0
        def clickedOkay():
            #they clicked okay so we should check the new name in the line edit
            #if the name was okay, rename the file and let it finish saving, close the window
            #if it was not, update the text field
            newName = self.ui.lineEdit.text()
            print(newName)

            validateResult = FV.validateFileName(newName)
            if LPS.popWantBool is True:
                if self.ui.DoNotShow.isChecked():
                    IM.makePopInterruptWidget(desiredName=newName)
            if type(validateResult) is not NoneType:
                #if it's a test, jump out to load test UI?
                if self.ui.Testing.isChecked():
                    boolList = [
                        self.ui.Testing.isChecked(),
                        self.ui.DoNotShow.isChecked()
                    ]
                    IM.makeTestInterruptWidget(desiredName=newName)
                    self.parent().close()
                # if things weren't right then we need to update the UI to tell the user that
                self.ui.resultsTextBrowser.clear()
                self.ui.resultsTextBrowser.setText('\n\n'.join(
                    str(result) for result in validateResult))
                # here also we need to stop the save by retuning some sort of value I'd imagine.
                print(
                    "This name has one or more formatting errors, they are as follows: "
                    + str(validateResult))

            if type(validateResult) is NoneType:
                print("This name passed all the rules!")
                cmds.file(rename=str(newName))
                cmds.file(save=True, f=True)
                self.parent().close()
Esempio n. 3
0
    def __init__(self, parent=None, currentName=None):
        #call the widget constructor
        super(interruptWidget, self).__init__(parent=parent)

        #create widget object from ui file
        self.ui = interruptFront.Ui_Form()
        self.ui.setupUi(self)

        #get the current scene file name and trim the file extension
        if currentName is NoneType:
            currentName = cmds.file(file, q=True, sn=True, shn=True)
        name = str(currentName).split(".")
        #set the text in the line edit to be that to start.
        self.ui.lineEdit.setText(str(name[0]))
        #set name to a temp name so the save can go through without harming anything

        #get list of results from the original check? or just check it again
        showResults = FV.validateFileName(currentName)
        self.ui.resultsTextBrowser.setText('\n\n'.join(
            str(result) for result in showResults))

        #making slot for button
        @QtCore.Slot(name='clickedOkay')
        def clickedOkay():
            #they clicked okay so we should check the new name in the line edit
            #if the name was okay, rename the file and let it finish saving, close the window
            #if it was not, update the text field
            newName = self.ui.lineEdit.text()
            print(newName)

            validateResult = FV.validateFileName(newName)
            if LPS.popWantBool is True:
                if self.ui.DoNotShow.isChecked():
                    IM.makePopInterruptWidget(desiredName=newName)
            if type(validateResult) is not NoneType:
                #if it's a test, jump out to load test UI?
                if self.ui.Testing.isChecked():
                    boolList = [
                        self.ui.Testing.isChecked(),
                        self.ui.DoNotShow.isChecked()
                    ]
                    IM.makeTestInterruptWidget(desiredName=newName)
                    self.parent().close()
                # if things weren't right then we need to update the UI to tell the user that
                self.ui.resultsTextBrowser.clear()
                self.ui.resultsTextBrowser.setText('\n\n'.join(
                    str(result) for result in validateResult))
                # here also we need to stop the save by retuning some sort of value I'd imagine.
                print(
                    "This name has one or more formatting errors, they are as follows: "
                    + str(validateResult))

            if type(validateResult) is NoneType:
                print("This name passed all the rules!")
                cmds.file(rename=str(newName))
                cmds.file(save=True, f=True)
                self.parent().close()

        #connecting slots
        self.ui.okayButton.clicked.connect(clickedOkay)
Esempio n. 4
0
def testLoop(fileNameList):
    #print (str(fileNameList));
    for fileName in fileNameList:
        #print(str(fileName));
        validateResult = V.validateFileName(fileName)
        #print("result of validation before none check is: " + str(type(validateResult)));
        if type(validateResult) is not NoneType:
            print(
                "This name has one or more formatting errors, they are as follows: "
                + str(validateResult))
        if type(validateResult) is NoneType:
            print("These names passed all the rules!")
Esempio n. 5
0
        def clickedOkay():
            #they clicked okay so we should check the new name in the line edit
            #if the name was okay, rename the file and let it finish saving, close the window
            #if it was not, update the text field
            newName = self.ui.lineEdit.text()
            print(newName)

            validateResult = FV.validateFileName(newName)
            if type(validateResult) is not NoneType:
                #if it's not a test, doesn't matter
                # if things weren't right then we need to update the UI to tell the user that
                self.ui.resultsTextBrowser.clear()
                self.ui.resultsTextBrowser.setText('\n\n'.join(
                    str(result) for result in validateResult))
                # here also we need to stop the save by retuning some sort of value I'd imagine.
                print(
                    "This name has one or more formatting errors, they are as follows: "
                    + str(validateResult))

            if type(validateResult) is NoneType:
                print("This name passed all the rules!")
                cmds.file(rename=str(newName))
                cmds.file(save=True, f=True)
                self.parent().close()