예제 #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 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
예제 #3
0
        for choice in choices :
            self.ui_choices.addItem(choice)
        self.center()
        
    #------------------------------------------------------------
    def emitChoiceSubmitted(self):
        if not self.signalsBlocked():
            choice = self.ui_choices.currentIndex()
            self.choiceSubmitted.emit(choice)
            self.setSubmitted(True)
            self.close()
            
    #------------------------------------------------------------
    @staticmethod
    def getChoice(*args, **kwds):
        success, choice = False, None
        widget = ChoiceWidget(*args, **kwds)
        if not widget.submitted :
            widget.exec_()
        success = widget.submitted
        if success :
            choice = widget.ui_choices.currentIndex()
        
        return success, choice
    

if __name__ == "__main__":
    print ChoiceWidget.getChoice(msg='Choose a drive', choices=apiUtils.getDrives())
    
    
예제 #4
0
        for choice in choices:
            self.ui_choices.addItem(choice)
        self.center()

    #------------------------------------------------------------
    def emitChoiceSubmitted(self):
        if not self.signalsBlocked():
            choice = self.ui_choices.currentIndex()
            self.choiceSubmitted.emit(choice)
            self.setSubmitted(True)
            self.close()

    #------------------------------------------------------------
    @staticmethod
    def getChoice(*args, **kwds):
        success, choice = False, None
        widget = ChoiceWidget(*args, **kwds)
        if not widget.submitted:
            widget.exec_()
        success = widget.submitted
        if success:
            choice = widget.ui_choices.currentIndex()

        return success, choice


if __name__ == "__main__":
    print(
        ChoiceWidget.getChoice(msg='Choose a drive',
                               choices=apiUtils.getDrives()))