Ejemplo n.º 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
Ejemplo n.º 2
0
 def _tryServer(self):
     #Validate P4 Port
     if self.p4Port is None:
         success, port = guiUtils.getUserInput(msg='Please Enter P4 Server:')
         if not success :
             raise P4Exception('Unable to determine P4PORT')
         self.setP4Port(port)
         
     if self.p4Port == '' :
         self._tryWorkspace()
         return
     
     #Set the env's for next time
     if not os.environ.has_key('P4PORT'):
         apiUtils.setEnv('P4PORT', self.p4Port)
     
     self.p4Conn.port = self.p4Port
Ejemplo n.º 3
0
 def _tryWorkspace(self):
     #Validate Client Workspace
     if self.p4Client is None:
         success, client = guiUtils.getUserInput(msg='Please Enter Default Workspace:')
         if not success :
             raise P4Exception('Unable to determine P4CLIENT')
         self.setP4Client(client)
         
     if self.p4Client == '' :
         self._tryWorkspace()
         return
     
     #Set the env's for next time
     if not os.environ.has_key('P4CLIENT'):
         apiUtils.setEnv('P4CLIENT', self.p4Client)
     
     self.p4Conn.client = self.p4Client
Ejemplo n.º 4
0
    def _tryServer(self):
        #Validate P4 Port
        if self.p4Port is None:
            success, port = guiUtils.getUserInput(
                msg='Please Enter P4 Server:')
            if not success:
                raise P4Exception('Unable to determine P4PORT')
            self.setP4Port(port)

        if self.p4Port == '':
            self._tryWorkspace()
            return

        #Set the env's for next time
        if 'P4PORT' not in os.environ:
            apiUtils.setEnv('P4PORT', self.p4Port)

        self.p4Conn.port = self.p4Port
Ejemplo n.º 5
0
    def _tryWorkspace(self):
        #Validate Client Workspace
        if self.p4Client is None:
            success, client = guiUtils.getUserInput(
                msg='Please Enter Default Workspace:')
            if not success:
                raise P4Exception('Unable to determine P4CLIENT')
            self.setP4Client(client)

        if self.p4Client == '':
            self._tryWorkspace()
            return

        #Set the env's for next time
        if 'P4CLIENT' not in os.environ:
            apiUtils.setEnv('P4CLIENT', self.p4Client)

        self.p4Conn.client = self.p4Client
Ejemplo n.º 6
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