Ejemplo n.º 1
0
    def _newFileMenuItem(self):
        """Prompts and then creates a new file"""

        dialogs = Dialogs(self.view)

        path = self._newFileWizard()

        #see if we want to make a blank scene or not
        msg = 'How should the new file be created?'
        BLANK = 'Make a blank maya scene'
        EXISTING = 'Use a copy of an existing file'

        choice = dialogs.radioButtonDialog(msg, [BLANK, EXISTING])

        if choice == BLANK:
            msg = 'Final confirmation:'
            msg += '\n\nCreate blank maya file at "%s"?' % path
            dialogs.confirmPrompt(msg)
            self.model.createFile(path)

        elif choice == EXISTING:
            src_path = dialogs.fileDialog(
                self.model.project.getScenesDir(),
                self.model.project.getDialogFilters())

            msg = 'Please confirm:'
            msg += '\n\nCopy "%s" to new file "%s"?' % (src_path, path)
            dialogs.confirmPrompt(msg)
            self.model.copyFile(src_path, path)

        msg = 'New file successfully created!'
        msg += '\n\nLocation: %s' % path
        msg += '\n\nPlease check out your new file to begin work on it.'
        dialogs.infoPrompt(msg)
Ejemplo n.º 2
0
    def _checkoutButton(self):
        dialogs = Dialogs(self.view)

        #open a file dialog
        start_dir = self.model.project.getScenesDir()
        filters = self.model.project.getDialogFilters()

        selected = dialogs.fileDialog(start_dir, filters)

        #prompt to overwrite
        dest_file = os.path.join(self.model.project.getCheckoutDir(), 
            os.path.basename(selected))

        if os.path.exists(dest_file):
            msg = 'The file "%s" already exists in your checkout folder.' \
                % os.path.basename(dest_file)
            msg += '\n\nAre you sure you want to overwrite it?'
            dialogs.confirmPrompt(msg)

        #checkout the file
        self.model.checkout(selected, dest_file)
        self.refreshGui()

        #report
        msg = 'The file was successfully checked out.'
        msg += '\n\nTo open it in maya, select it in your list and'
        msg += ' click "Open...".'

        dialogs.infoPrompt(msg)
Ejemplo n.º 3
0
    def _aboutMenuItem(self):
        #TODO make this a more spiffy "About..." dialog
        msg = 'Pmaya version: %s\n\n' % VERSION
        msg += 'Written by: James Jackson\n'
        msg += 'Email: [email protected]'

        dialogs = Dialogs(self.view)
        dialogs.infoPrompt(msg)
Ejemplo n.º 4
0
    def _checkinButton(self):
        dialogs = Dialogs(self.view)

        src_file = self.view.list.getSelected()

        if not src_file:
            #nothing selected so do nothing
            return

        print 'Checking in file: %s' % src_file

        #get the destination location
        start_dir = self.model.project.getScenesDir()
        filters = self.model.project.getDialogFilters()

        dest_file = dialogs.fileDialog(start_dir, filters, 
            doSaveButton=True)

        print 'DEST IS:', dest_file

        #confirm if it does not yet exist
        if not os.path.exists(dest_file):
            msg = 'The file "%s" does not yet exist.' % dest_file
            msg += '\n\nAre you sure you want to check in to a new location?'

            dialogs.confirmPrompt(msg)

        #prompt for a log message
        log_msg = dialogs.textPrompt('Enter a log message:')

        #confirm
        msg = 'Please confirm:\n\n'
        msg += 'Checking in:\n%s\n\n' % src_file
        msg += 'To: \n%s\n\n' % dest_file
        msg += 'Log message:\n%s\n\n' % log_msg
        msg += 'Does this look okay?\n'
        dialogs.confirmPrompt(msg)

        #check in
        self.model.checkin(src_file, dest_file, log_msg)
        self.refreshGui()

        #report
        msg = 'The file was successfully checked in.'
        msg += '\n\nTo continue working on it, you will have to check'
        msg += ' it out again.'

        dialogs.infoPrompt(msg)
Ejemplo n.º 5
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)