Exemple #1
0
    def _newFileWizard(self):
        """Wizard that prompts the user to get the path of a new file"""

        dialogs = Dialogs(self.view)

        #get category
        category = dialogs.radioButtonDialog('Pick a category:' , 
            self.model.project.config['NEW_FILE_CATEGORIES'])

        #get name of asset/shot (loop until valid input)
        name = dialogs.fileTextPrompt('Enter name:')

        #get task
        tasks = self.model.project.config['NEW_FILE_TASKS'][category][:]
        tasks.append('Other')

        task = dialogs.radioButtonDialog('Pick a task:' , tasks)

        if task == 'Other':
            task = dialogs.textPrompt('Enter task:')

        #get the path of the file we are creating
        category_dir = self.model.project.config['NEW_FILE_PATHS'][category]
        result = os.path.join(category_dir, name, '%s_%s.mb' % (name, task))

        #ask to overwrite
        print 'EXISTS:', result, os.path.exists(result)
        if os.path.exists(result):
            msg = 'The file "%s" already exists. Overwrite?' % result
            dialogs.confirmPrompt(msg)

        #confirm all settings
        msg = 'You have selected:'
        msg += '\n\n\tCategory: %s' % category
        msg += '\n\tName: %s' % name
        msg += '\n\tTask: %s' % task
        msg += '\n\nThis will create a file in this location: '
        msg += '\n%s' % result
        msg += '\n\nDoes this look okay?'
        dialogs.confirmPrompt(msg)

        return result
Exemple #2
0
    def _newButton(self):
        dialogs = Dialogs(self.view)

        #prompt for a file name
        filename = dialogs.fileTextPrompt('Enter name of the new maya file:')
        print 'Chosen name:', filename

        if not filename.endswith('.mb'):
            filename += '.mb'

        full_path = os.path.join(self.model.project.getCheckoutDir(), filename)
        print 'Full path:', full_path

        self.model.createFile(full_path)
        self.refreshGui()

        #report
        msg = 'The file "%s" was successfully created.' % filename
        msg += '\n\nTo edit it in maya, select it in your list and'
        msg += ' click "Open...".'

        dialogs.infoPrompt(msg)