예제 #1
0
    def updateWorkspace(self, mappings, root=[]):
        if guiUtils.getConfirmDialog(
                'Would you like to use your default workspace?\n{0}'.format(
                    self.p4Client())):
            workspace_name = self.p4Client
        else:
            sample = str(
                os.getenv('USERNAME') + '_' + os.getenv('COMPUTERNAME') +
                '_dev')
            workspace_success, workspace_name = guiUtils.getUserInput(
                'Please specify a name for the P4 workspace to update.\n EXAMPLE:  {0}'
                .format(os.getenv('P4CLIENT', sample)))
            if not workspace_success:
                return
            workspace_name = workspace_name.replace(" ", "_")

        client_spec = self.p4Conn.fetch_client(workspace_name)
        if 'Update' not in client_spec or 'Access' not in client_spec:  #NEW WORKSPACE
            drives = apiUtils.getDrives()
            success, choice = ChoiceWidget.getChoice(
                msg='Please specify a drive location for this P4 workspace.',
                choices=drives)
            if not success:
                return False
            client_spec['Root'] = str(Path(drives[choice] + ':\\').join(*root))

        client_spec['View'] = [x.format(workspace_name) for x in mappings]
        self.p4Conn.save_client(client_spec)
        return True
예제 #2
0
def checkSave(self,filePath=''):
    '''Returns bool based on the save state of the maya scene'''
    if filePath == '' :
        filePath = cmds.file(q=True,sn=True)
    saved = cmds.file(q=True,mf=True)
    if saved :
        saved = guiUtils.getConfirmDialog("Your current file contains unsaved changes. Please save the file first.")
    return saved
예제 #3
0
def checkSave(self, filePath=''):
    '''Returns bool based on the save state of the maya scene'''
    if filePath == '':
        filePath = cmds.file(q=True, sn=True)
    saved = cmds.file(q=True, mf=True)
    if saved:
        saved = guiUtils.getConfirmDialog(
            "Your current file contains unsaved changes. Please save the file first."
        )
    return saved
예제 #4
0
 def updateWorkspace(self, mappings, root=[]):
     if guiUtils.getConfirmDialog('Would you like to use your default workspace?\n{0}'.format(self.p4Client())) :
         workspace_name = self.p4Client
     else:
         sample = str(os.getenv('USERNAME') + '_' + os.getenv('COMPUTERNAME') + '_dev')
         workspace_success, workspace_name = guiUtils.getUserInput('Please specify a name for the P4 workspace to update.\n EXAMPLE:  {0}'.format(os.getenv('P4CLIENT',sample)))
         if not workspace_success:
             return
         workspace_name = workspace_name.replace(" ","_")
     
     client_spec = self.p4Conn.fetch_client(workspace_name)
     if not client_spec.has_key('Update') or not client_spec.has_key('Access') : #NEW WORKSPACE
         drives = apiUtils.getDrives()
         success, choice = ChoiceWidget.getChoice(msg='Please specify a drive location for this P4 workspace.', choices=drives)
         if not success:
             return False
         client_spec['Root'] = str(Path(drives[choice] + ':\\').join(*root))
     
     client_spec['View'] = [x.format(workspace_name) for x in mappings]
     self.p4Conn.save_client(client_spec)
     return True