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)
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