def _show_program_in_output_window(robot, processor, program): """ Display program in the output window. :param robot: :param processor: :param program: :return: """ # Update the output-text viewer in the Mimic UI details = 'Type of robot : {} {} ({})\n' \ 'Type of processor : {} {} ({})\n' \ 'Path to template : {}\n' \ 'Path to output : {}\n' \ '\n' target_ctrl_path = mimic_utils.get_target_ctrl_path(robot) filled_details = details.format( mimic_utils.get_robot_type(robot), mimic_utils.get_robot_subtype(robot), robot, processor.type_robot, processor.type_processor, processor.__class__.__name__, postproc.confirm_path_exists(processor.get_program_template_path()), postproc.confirm_path_exists(processor.get_program_output_path())) pm.scrollField(OUTPUT_WINDOW_NAME, insertText=filled_details, edit=True) pm.scrollField(OUTPUT_WINDOW_NAME, insertText=program + '\n', edit=True)
def _print_violations(violation_dicts, limits, limit_type): """ Format and print limit violations. :param violation_dicts: A list of dicts of axis violations :param limits: A list of robot robot axes limits :param limit_type: Name string of the limit type :return: """ warning = '' warning_template = ' {0:>{time_padding}}{1:>{frame_padding}}{2:>{limit_padding}}{3:>{val_padding}}\n' padding = {'val_padding' : 13, 'limit_padding' : 10, 'time_padding' : 10, 'frame_padding' : 10} for axis_name in sorted(violation_dicts): warning += axis_name + " {} Warnings:\n".format(limit_type) axis_num = int(axis_name.split(' ')[-1]) - 1 # This is super hacky... should fix. warning += warning_template.format('Time', 'Frame', 'Limit', 'Actual', **padding) for violation in violation_dicts[axis_name]: if limits[axis_name]['Max Limit']: axis_limit = general_utils.num_to_str(limits[axis_name]['Max Limit'], precision=3) else: return warning += warning_template.format( general_utils.num_to_str(violation['Time Index'], precision=3), general_utils.num_to_str(violation['Frame'], precision=3), axis_limit, general_utils.num_to_str(violation[postproc.AXES][axis_num], precision=3), **padding) pm.scrollField(OUTPUT_WINDOW_NAME, insertText=warning, edit=True)
def save_program(*args): """ Save the program. :return: """ # Do this first upon button click! _clear_output_window() _initialize_export_progress_bar() # Check program, commands, raise exception on failure program_settings = _get_settings() animation_settings = program_settings[1] start_frame = animation_settings['Start Frame'] pm.currentTime(start_frame) # Force evaluation of reconcile rotation to ensure proper export mimic_utils.reconcile_rotation(force_eval=True) command_dicts = _get_command_dicts(*program_settings) violation_exception, violation_warning = _check_command_dicts(command_dicts, *program_settings) # If we're sampling keyframes only, we assume it's for a post-processor # that's not time-dependent, and, therefore, we shouldn't raise exceptions # for limit violations postproc_settings = program_settings[2] using_keyframes_only = postproc_settings['Using Keyframes Only'] if not using_keyframes_only: if violation_exception: _initialize_export_progress_bar(is_on=False) pm.scrollField(OUTPUT_WINDOW_NAME, insertText='\n\nNO PROGRAM EXPORTED!', edit=True) pm.headsUpMessage('WARNINGS: No Program Exported; ' \ 'See Mimic output window for details') raise mimic_utils.MimicError('Limit violations found. ' \ 'No Program Exported. ' \ 'See Mimic output window for details.') # Continue to save program: _process_program(command_dicts, *program_settings) if violation_warning: if not using_keyframes_only: pm.headsUpMessage('Program exported with warnings; ' \ 'See Mimic output window for details') else: pm.headsUpMessage('Program exported successfuly; ' \ 'See Mimic output window for details') else: pm.headsUpMessage('Program exported successfuly; ' \ 'See Mimic output window for details') _initialize_export_progress_bar(is_on=False)
def NewTab(): pm.scrollField('Notes', p='Tabs', bgc=[(.2), (.2), (.2)], hlc=[(.9), (.2), (.2)], en=1) Tab = tabLayout('Tabs', e=1, snt=0)
def em2pConvMel2Py(): u'''translate MEL to Python''' melCmd = pm.scrollField('em2pTextEditMEL', q=1, tx=1) pyCmd = mel2py.mel2pyStr(melCmd, pymelNamespace='pm') pyFixed = pyCmd.replace("pymel.all", "pymel.core") pm.scrollField('em2pTextEditPy', e=1, tx=pyFixed)
def UI_controlModuleSelected(self, *args): moduleNameInfo = pm.textScrollList(self.UIElements["controlModule_textScrollList"], query = True, selectItem = True) if len(moduleNameInfo) == 0: pm.text(self.UIElements["nameText"], edit = True, label = 'No Animation Modules to Install') pm.scrollField(self.UIElements["descriptionScrollField"], edit = True, text = '') pm.button(self.UIElements["installButton"], edit = True, enable = False) return else: moduleName = moduleNameInfo[0] mod = None for controlModule in self.controlModuleCompatability: if controlModule[1] == moduleName: mod = controlModule[0] if mod != None: moduleTitle = mod.TITLE moduleDescription = mod.DESCRIPTION pm.text(self.UIElements["nameText"], edit = True, label = moduleTitle) pm.scrollField(self.UIElements["descriptionScrollField"], edit = True, text = moduleDescription) pm.button(self.UIElements["installButton"], edit = True, enable = True, command = partial(self.InstallModule, mod, moduleName))
def initialize_scrollField(self): self.UIwidgets["module_information_scrollField"] = pm.scrollField( editable=False, wordWrap=True, height=100, parent=self.UIwidgets["ui_main_layout"] ) pm.scrollField(self.UIwidgets["module_information_scrollField"], edit=True, text="TEST")
def _gatherEvents(self, instance): """event collector called once after the first Idle Event""" message = "Gathered events by '%s':\n" % instance # get the Id for the key inverseID=dict(zip(self.eventID.values(),self.eventID.keys())) # prompt Result for Id in self.eventRecord: token = str(" ID %4d Event: %s \n" % (Id, inverseID.get(Id,0))) message = message + token # --------------create new UI entry--------------- objUI = self._UIobject.createTextfieldObj(message, "eventID: %s" % inverseID.get(self.eventRecord[0],0),True) mel.setParent(objUI) mel.frameLayout(mw=self._optionMarginWidth,l = 'Command Inspect', collapse = True, collapsable = True) mel.columnLayout('subCol',adj=True) mel.separator(h=self._optionMarginWidth,style="none") mel.scrollField(numberOfLines=3, editable=False, wordWrap=False, h = self._optionInspectHeight, w = self._optionInspectWidth, text = "place Holder" ) mel.separator(h=self._optionMarginWidth,style="none") # reset Event Collection self.eventRecord = [] self.eventID["idle"] = 0
def createModuleInstallButton(self, module): mod = __import__("Blueprint." + module, {}, {}, [module]) reload(mod) title = mod.TITLE description = mod.DESCRIPTION icon = mod.ICON buttonSize = 64 pm.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, buttonSize)]) #Create UI #distinguish between buttons with partial functions self.UIElements["module_button_" + module] = pm.symbolButton( width=buttonSize, height=buttonSize, image=icon, command=partial(self.installModule, module)) textColumn = pm.columnLayout(columnAlign="center") pm.text(align="left", width=self.windowWidth - 30, label=title) pm.scrollField(text=description, editable=False, width=self.windowWidth - 30, height=50, wordWrap=True) pm.setParent(self.UIElements["moduleList_row"])
def _assignParent(self, *args): """ Assign the parent control in class and show it in the GUI. """ self.parent_control = pm.selected()[0] pm.scrollField(self.parent_scroll_field, e=True, tx=self.parent_control)
def insert_cmd_ui(self, *arg): si = pmc.textScrollList(self.infos_ui, q=True, sii=1) if si: tmp = self.spp_.order_obj[si[0] - 1].str_ + "\n" if tmp != "\n": pmc.scrollField(self.cmd_ui, e=True, it=tmp) self.cmds[0] = self.user_cmd self.set_options()
def _check_command_dicts(command_dicts, robot, animation_settings, postproc_settings, user_options): """ Check command dictionary for warnings. :param command_dicts: :return: True if warning, False otherwise """ # Check to see if the user has elected to ignore warnings ignore_warnings = postproc_settings['Ignore Warnings'] warning = '' # Temporary holder # TODO: write vel, acc, jerk algorithm for warnings, min/max, average, ... # Check if limits have been exceeded (i.e. velocity, acceleration) if user_options.Include_axes and not user_options.Ignore_motion: command_dicts = _check_command_rotations(robot, animation_settings, command_dicts) # TODO: max_velocities is awkwardly implemented... warning, max_velocities = _check_velocity_of_axes( robot, command_dicts, animation_settings['Framerate']) if warning != '': # Print this one always warning += '\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=warning, edit=True) pm.headsUpMessage('WARNINGS: See Mimic output window for details') if not ignore_warnings: raise Exception(warning) if user_options.Include_external_axes and not user_options.Ignore_motion: # TODO: Implement velocity check for external axes # warning = _check_velocity_of_external_axes(robot, command_dicts, animation_settings['Framerate']) # if warning != '': # # Print this one always # warning += '\n' # pm.scrollField(OUTPUT_WINDOW_NAME, insertText=warning, edit=True) # if not ignore_warnings: # raise Exception(warning) pass if user_options.Include_pose and not user_options.Ignore_motion: # TODO: Implement velocity check for poses # warning = _check_velocity_of_pose(robot, command_dicts, animation_settings['Framerate']) # if warning != '': # # Print this one always # warning += '\n' # pm.scrollField(OUTPUT_WINDOW_NAME, insertText=warning, edit=True) # if not ignore_warnings: # raise Exception(warning) pass # If all checks passed then we don't have any warnings... if warning == '': no_warning = 'All checks passed!\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=no_warning, edit=True) pm.headsUpMessage('All Checks Passed!') return False else: return True
def build(self): """ Creates the GUI. """ # if window exists, delete it if pm.window(self.window_name, exists=True): pm.deleteUI(self.window_name) with pm.window(self.window_name, rtf=True, menuBar=True, menuBarVisible=True, title='HairTool') as hairTool_window: with pm.verticalLayout(): with pm.frameLayout(label='Make Hair Curve', collapsable=True): # assign controls field pm.text(label='Control List:', align='left') self.control_scroll_field = pm.scrollField( w=300, h=35, wordWrap=1, ed=0, en=0, tx= "Select control chain in order then press Assign Controls." ) pm.button(l='Assign Controls', c=self._assignControls) # Assign parent field pm.separator(h=15, w=300, style="in") pm.text(l='Parent', al='left') self.parent_scroll_field = pm.scrollField( w=300, h=35, wordWrap=1, ed=0, en=0, tx= 'Select the parent control and then press Assign Parent' ) pm.button(l='Assign Parent', c=self._assignParent) pm.separator(h=15, w=300, style="in") pm.button(l='Create Hair Curve', c=pm.Callback(self._makeHair)) pm.separator(h=15, w=300, style="in") with pm.frameLayout(label='Bake Curve Motion', collapsable=True, h=20): with pm.horizontalLayout(): pm.button(l='Bake Motion', c=pm.Callback(self._bakeClean, clean=True), h=10) pm.button(l='Bake and keep nodes', c=pm.Callback(self._bakeClean, clean=False), h=10)
def update_field(self, pinIndexList, paramList) : text1 = u" pins |" text2 = u" params |" for i in pinIndexList : text1 += "{:>6}".format(i) for i in paramList : text2 += "{:>6}".format("{:.2f}".format(i)) pm.scrollField( self.pins_field, e=1, text = text1 ) pm.scrollField( self.param_field, e=1, text = text2 )
def _commentAdded(self): if self._currentSelected == None: raise RuntimeError('Must select a version to add comment.') newComment = _pmCore.scrollField(self._uiWidget['comment'], query=True, text=True) userName = _os.environ.get('AM_USERNAME') _Database.addComment(self._fileID, self._currentSelected, newComment, userName) _pmCore.setParent(self._uiWidget['commentLayout']) _pmCore.text(label="{0} @ {1}:".format(userName, _datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')), align='left') _pmCore.text(label=newComment, wordWrap=True, align='left') _pmCore.scrollField(self._uiWidget['comment'], edit=True, text='')
def update_ui(self): self.clear_script_reporter() pmc.scrollField(self.cmd_ui, e=True, clear=True) self.user_cmd = self.py_cmd if self.py_path: pmc.button(self.run_but, e=True, l="Run : %s" % self.py_path) self.order_by_ui() else: pmc.button(self.run_but, e=True, l="please select")
def _print_axis_stats(axis_stats, limit_type): """ Format and print axis statistics. :param axis_stats: A dict of axis statistics :param limit_type: Name string of the limit type :return: """ # TODO: This function is a mess. Should definitely be cleaned up, # but since this is all getting graphed anyway... # TODO: stop hardcoding num_axes num_axes = 6 axis_template = '>>> {0:>{axis_padding}} ' axis_padding = {'axis_padding' : 2} res = [None] * (num_axes + 1) # Header res[0] = axis_template.format('A', **axis_padding) for axis_index in range(num_axes): res[axis_index + 1] = axis_template.format(axis_index + 1, **axis_padding) # Min min_max_template = '{0:>{time_padding}}{1:>{frame_padding}}{2:>{val_padding}} |' min_max_padding = {'val_padding' : 13, 'time_padding' : 10, 'frame_padding' : 10} if axis_stats['min']: res[0] += min_max_template.format('Time', 'Frame', 'Min', **min_max_padding) for axis_index, command in enumerate(axis_stats['min']): res[axis_index+1] += min_max_template.format( general_utils.num_to_str(command['Time Index'], precision=3), general_utils.num_to_str(command['Frame'], precision=3), general_utils.num_to_str(command[postproc.AXES][axis_index], precision=3), **min_max_padding) # Max if axis_stats['max']: res[0] += min_max_template.format('Time', 'Frame', 'Max', **min_max_padding) for axis_index, command in enumerate(axis_stats['max']): res[axis_index+1] += min_max_template.format( general_utils.num_to_str(command['Time Index'], precision=3), general_utils.num_to_str(command['Frame'], precision=3), general_utils.num_to_str(command[postproc.AXES][axis_index], precision=3), **min_max_padding) # Avg avg_template = '{0:>{avg_padding}}' avg_padding = {'avg_padding' : 10} if axis_stats['avg']: res[0] += avg_template.format('Avg', **avg_padding) for axis_index, axis_avg in enumerate(axis_stats['avg']): res[axis_index+1] += avg_template.format( general_utils.num_to_str(axis_avg, precision=3), **avg_padding) # Formatting stats_str = '{} Stats:\n'.format(limit_type) + '\n'.join(res) + '\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=stats_str, edit=True)
def _assignControls(self, *args): """ Assign controls in class and show them in the GUI. """ control_name = '' self.controls = pm.selected() for i, control in enumerate(self.controls): if self.controls[i] != self.controls[-1]: control_name = control_name + str(control) + ', ' else: control_name = control_name + str(control) pm.scrollField(self.control_scroll_field, e=True, tx=control_name)
def create(self): ''' # creates the actual ui ''' self.layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1, 150],[2, 100], [3, 300])) self.checkbox = pm.checkBox(label='Apply Transforms') pm.button(label= 'Create Light', height=100, command= pm.Callback(self.create_light)) pm.scrollField(width= 300, height= 100, wordWrap= True, enable= True, text= 'Preset Name: %s\n' % (self.data[0]) + 'Light Type: %s\n' % (self.data[1]) + 'Description: %s' % (self.data[2])) pm.separator() pm.separator() pm.separator()
def __init__(self, info, parent): self.radio_objects = [] self.question = info[0] self.radio_buttons = info[1:5] random.shuffle(self.radio_buttons) pm.setParent(parent) self.layout = pm.columnLayout(adjustableColumn=True) pm.scrollField(wordWrap=True, width=400, text=self.question, height=75) #pm.text(label= self.question, align= 'left') self.radioCollection = pm.radioCollection() for radio_button in self.radio_buttons: obj = Radio_Button(radio_button) self.radio_objects.append(obj)
def _buildupWindow(self): if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()): _pmCore.deleteUI(self._window, window=True) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout(adjustableColumn=True) _pmCore.scrollLayout(width=300, height=250, childResizable=True) _pmCore.gridLayout(numberOfColumns=2, cellHeight = self._iconSize, cellWidth=self._iconSize) for versionNum in _Database.getVersionList(self._fileID): versionInfo = _Database.getVersionInfo(self._fileID, versionNum) print versionInfo thumbnailPath = versionInfo[3] if not _os.path.exists(versionInfo[3]): thumbnailPath = "cube.png" button = _pmCore.iconTextButton(self._versionBtnName(versionNum), style='iconAndTextVertical', image1=thumbnailPath, label=self._versionBtnName(versionNum), command=_pmCore.Callback(self._versionSelected, versionNum)) self._uiWidget[self._versionBtnName(versionNum)] = button _pmCore.setParent('..') _pmCore.setParent('..') _pmCore.separator(style='none', height=10) _pmCore.text(label="Comments: ", align='left') self._uiWidget['commentLayout'] = _pmCore.scrollLayout(width=300, height=120, childResizable=True) _pmCore.setParent('..') _pmCore.separator(style='none', height=10) self._uiWidget['comment'] = _pmCore.scrollField(width=300, height=80) _pmCore.button(label='Add Comment', command=_pmCore.Callback(self._commentAdded))
def __init__(self, info, parent): self.radio_objects = [] self.question = info[0] self.radio_buttons = info[1:5] random.shuffle(self.radio_buttons) pm.setParent(parent) self.layout = pm.columnLayout(adjustableColumn= True) pm.scrollField(wordWrap= True, width= 400, text= self.question, height= 75) #pm.text(label= self.question, align= 'left') self.radioCollection = pm.radioCollection() for radio_button in self.radio_buttons: obj = Radio_Button(radio_button) self.radio_objects.append(obj)
def __init__(self, questions_file): self.file = open(questions_file, 'r') self.questions = self.file.readlines() self.file.close() self.main_layout = pm.columnLayout() self.name_field = pm.textFieldGrp(label='Quiz Name') self.layout = pm.rowColumnLayout(numberOfColumns=2, columnWidth=([1, 75], [2, 475])) pm.columnLayout() pm.text(label='Questions') self.question_scroll_list = pm.textScrollList( width=60, height=400, selectCommand=pm.Callback(self.read_questions), allowMultiSelection=True) pm.setParent(self.layout) pm.columnLayout() pm.text(label='Questions Info') self.question_scroll_field = pm.scrollField(wordWrap=True, height=400, width=475) pm.setParent(self.main_layout) pm.button(label='Create Quiz', command=pm.Callback(self.create_quiz), width=550, height=50) self.list_questions()
def __init__(self): ''' # class to sort and give info on shaders ''' self.layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth=([1, 150], [2, 150], [3, 250])) pm.columnLayout() pm.text(label= 'Shaders') self.shader_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(self.update_connections_list)) pm.button(label= 'Refresh', width= 150, command= pm.Callback(self.update_shader_list)) pm.setParent(self.layout) pm.columnLayout() pm.text(label='Connections') self.connections_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(self.write_info)) self.check_box = pm.checkBox(label= 'Select Node') pm.setParent(self.layout) pm.columnLayout() pm.text(label='Node Info') self.info_field = pm.scrollField(wordWrap= True, width= 250, height= 200) self.attr_check_box = pm.checkBox(label= 'Show All') self.update_shader_list()
def __init__(self, path): self.path = path # the path to save the presets preset_win = 'preset_win' if pm.window(preset_win, exists= True): pm.deleteUI(preset_win) if pm.windowPref(preset_win, exists= True): pm.windowPref(preset_win, remove= True) temp_win = pm.window(preset_win, title= 'presets', width= 300,sizeable= False) pm.columnLayout(adjustableColumn= True) pm.text(label= '') pm.text(label= 'Preset Name') self.field = pm.textField() pm.text(label= '') pm.text(label= 'Description') pm.text(label= '') self.scroll = pm.scrollField(width= 300, wordWrap= True) pm.text(label= '') pm.button(label= 'Create Preset', command= pm.Callback(self.create_preset)) pm.text(label= '') temp_win.show()
def __init__(self, path): self.path = path # the path to save the presets preset_win = 'preset_win' if pm.window(preset_win, exists=True): pm.deleteUI(preset_win) if pm.windowPref(preset_win, exists=True): pm.windowPref(preset_win, remove=True) temp_win = pm.window(preset_win, title='presets', width=300, sizeable=False) pm.columnLayout(adjustableColumn=True) pm.text(label='') pm.text(label='Preset Name') self.field = pm.textField() pm.text(label='') pm.text(label='Description') pm.text(label='') self.scroll = pm.scrollField(width=300, wordWrap=True) pm.text(label='') pm.button(label='Create Preset', command=pm.Callback(self.create_preset)) pm.text(label='') temp_win.show()
def __init__(self, questions_file): self.file = open(questions_file, 'r') self.questions = self.file.readlines() self.file.close() self.main_layout = pm.columnLayout() self.name_field = pm.textFieldGrp(label= 'Quiz Name') self.layout = pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 75], [2, 475])) pm.columnLayout() pm.text(label= 'Questions') self.question_scroll_list = pm.textScrollList(width= 60, height= 400, selectCommand= pm.Callback(self.read_questions), allowMultiSelection= True) pm.setParent(self.layout) pm.columnLayout() pm.text(label= 'Questions Info') self.question_scroll_field = pm.scrollField(wordWrap= True, height= 400, width= 475) pm.setParent(self.main_layout) pm.button(label= 'Create Quiz', command= pm.Callback(self.create_quiz), width= 550, height= 50) self.list_questions()
def create(self): self.scrollField = pm.scrollField(wordWrap=True, width=self.width, height=self.height, backgroundColor=[1, 0, 0]) self.menus() return self.scrollField
def gui(): global melText, pythonCollected guiWidth = 300 guiHeight = 300 spacer = 10 conversionWindow = pm.window(title="Converter Window", width=guiWidth, height=guiHeight) pm.columnLayout(columnAlign="center") pm.text(label="MEL Script To Convert:") melText = pm.scrollField(wordWrap=True, width=guiWidth) pm.separator(style="doubleDash") pm.text(label="Converted text:") pythonCollected = pm.scrollField(wordWrap=True, width=guiWidth) pm.button(label="Convert", command=processSyntax) pm.showWindow(conversionWindow)
def createTextfieldObj( self , content, label, _collapsed): """ creates a TextBox Element """ if mel.scrollLayout(self._scrollField, ex=True): mel.setParent( self._ActionCol) mel.separator(h=self._optionMarginWidth,style="none") ObjUIpath = mel.frameLayout(mw=self._optionMarginWidth,l = label, collapse = bool(_collapsed), collapsable = bool(_collapsed)) mel.columnLayout('subCol',adj=True) mel.separator(h=self._optionMarginWidth,style="none") mel.scrollField(numberOfLines=3, editable=False, wordWrap=False, h = self._optionTextFieldsize, text = content ) mel.separator(h=self._optionMarginWidth,style="none") return ObjUIpath
def editButtonNew(self, attr): pmAttr = pm.Attribute(attr) self.thisNode = pmAttr.node() parent = pm.setParent(query=True) text = self.thisNode.islData.get() self.textField = pm.scrollField(wordWrap=True, text=text, editable=True, changeCommand=self.textChangeCommand, keyPressCommand=self.textChangeCommand) #self.addControl("islData", label="Data") pm.button(label="Edit Shader", c=self.editTextButtonCommand) pm.button(label="Load Shader", c=self.loadShaderCommand) pm.button(label="Save Shader", c=self.saveShaderCommand)
def _assetSelected(self, fileID): # Update background color for buttons. if self._currentSelectedAsset != None: _pmCore.iconTextButton(self._uiWidget[_UiWidgetEnum.assetBtnList][self._assetBtnName(self._currentSelectedAsset)], edit=True, backgroundColor=self._defaultColor) btnName = self._assetBtnName(fileID) button = self._uiWidget[_UiWidgetEnum.assetBtnList].get(btnName) _pmCore.iconTextButton(button, edit=True, backgroundColor=self._highlightColor) # Get file info from database. fileInfo = _Database.getFileInfo(fileID) _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.sceneNameTextField], edit=True, text=fileInfo[1]) _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.filePathTextField], edit=True, text=fileInfo[2]) _pmCore.scrollField(self._uiWidget[_UiWidgetEnum.descriptionTextField], edit=True, text=fileInfo[4]) _pmCore.optionMenuGrp(self._uiWidget[_UiWidgetEnum.categoryCombox], edit=True, value=fileInfo[5]) # Update version text. versionNum = _Database.getCurrentVersion(fileID) _pmCore.text(self._uiWidget[_UiWidgetEnum.versionNumText], edit=True, label=str(versionNum)) self._currentSelectedAsset = fileID
def createTextfieldObj( self , content): """ creates a TextBox Element """ if mel.scrollLayout(self._scrollField, ex=True): mel.setParent( self._ActionCol) mel.separator(h=10,style="none") ObjUIpath = mel.frameLayout(mw=10,l="TextField") mel.columnLayout('sampleCol',adj=True) mel.separator(h=10,style="none") mel.scrollField(numberOfLines=3, editable=False, wordWrap=False, h=100, text = content ) mel.separator(h=10,style="none") return ObjUIpath
def _newAssetInfoConfirmed(self, args): sceneName = _pmCore.textFieldGrp(self._sceneName, query=True, text=True) directory = _pmCore.textFieldGrp(self._filePath, query=True, text=True) description = _pmCore.scrollField(self._description, query=True, text=True) category = _pmCore.optionMenuGrp(self._category, value=True, query=True) if not sceneName or not directory or not description: _pmCore.confirmDialog(title='Invalid Asset Info', message='Asset info for "Scene Name", "Directory" and "Description" can not be empty.', button='OK') return self._newAssetInfoClose() fileID = _MayaFunctions.saveScene(sceneName, directory, description, category) if self._addedCallback: self._addedCallback(fileID, category)
def bug_report_window(self): ''' ''' windowName = 'bugWindow' w = 400 h = 330 if pm.control(windowName, exists=True): pm.deleteUI(windowName) bug_window = pm.window(windowName, t="Bug Report / Contact", widthHeight=[w, h], rtf=False, mnb=False, mxb=False, s=False, toolbox=True) pm.columnLayout(w=w, cw=w, cal='center') wM = (w - 30) pm.rowColumnLayout(nc=3, cw=([1, 15], [2, wM], [3, 15])) pm.text(l='', w=15) pm.columnLayout(w=wM, cw=wM, cal='center') pm.text(l='Message or Bug:', w=wM, h=30, al='left', font='boldLabelFont') message_text = pm.scrollField(w=wM, wordWrap=True) pm.text(l='Email Address (Optional, if you want a reply):', w=wM, h=30, al='left', font='boldLabelFont') email_address = pm.textField(w=wM) pm.setParent('..') pm.text(l='', w=15) pm.setParent('..') pm.separator(style='none', h=12, w=wM) cwA = 10 cwB = (w / 2) - (1.5 * cwA) pm.rowColumnLayout(nc=5, cw=([1, cwA], [2, cwB], [3, cwA], [4, cwB], [5, cwA])) pm.text(l='', w=cwA) pm.button('bug_send', l='Send', w=cwB, h=25, command=lambda *args: self.bug_report_send(windowName, pm.textField( email_address, query=True, text=True), pm.scrollField( message_text, query=True, text=True))) pm.text(l='', w=cwA) pm.button('bug_cancel', l='Cancel', w=cwB, h=25, command=lambda *args: pm.deleteUI(windowName)) pm.text(l='', w=cwA) bug_window.show() pm.window(bug_window, edit=True, h=h, w=(w + 2))
def create(self): ''' # creates the actual ui ''' self.layout = pm.rowColumnLayout(numberOfColumns=3, columnWidth=([1, 150], [2, 100], [3, 300])) self.checkbox = pm.checkBox(label='Apply Transforms') pm.button(label='Create Light', height=100, command=pm.Callback(self.create_light)) pm.scrollField(width=300, height=100, wordWrap=True, enable=True, text='Preset Name: %s\n' % (self.data[0]) + 'Light Type: %s\n' % (self.data[1]) + 'Description: %s' % (self.data[2])) pm.separator() pm.separator() pm.separator()
def build_mimic_ui(): """ Builds main mimic UI and defines relationships between UI buttons/features and back-end functions :return: """ mimic_win = create_mimic_window('mimic_win') # Create Main UI column pm.columnLayout(width=244, adj=True) # Add UI Header Image. robotImage = pm.image(image='mimic_logo.png', width=244, height=60) mimic_tab_layout = create_mimic_tabs() animate_tab_layout = build_animate_tab(mimic_tab_layout) program_tab_layout = build_program_tab(mimic_tab_layout) setup_tab_layout = build_setup_tab(mimic_tab_layout) external_tab_layout = build_external_tab(mimic_tab_layout) prefs_tab_layout = build_prefs_tab(mimic_win) tabs = [(animate_tab_layout, "Animate"), (program_tab_layout, "Program"), (setup_tab_layout, "Setup"), (external_tab_layout, "External"), (prefs_tab_layout, "Prefs")] assign_tabs(tabs, mimic_tab_layout) # Create output column outputColumn = pm.columnLayout('outputColumn', width=7, adj=True) outputForm = pm.formLayout() outputScrollField = pm.scrollField('programOutputScrollField', width=3, height=610) pm.formLayout(outputForm, edit=True, attachForm=[(outputScrollField, "top", 3), (outputScrollField, "bottom", 3), (outputScrollField, "left", 3), (outputScrollField, "right", 3)]) pm.setParent(mimic_win) pm.columnLayout('outputBarColumn', width=7) pm.separator(height=1, style='none') bullets = '\n'.join([unichr(0x2022) for _ in range(3)]) pm.text(bullets, align='left', annotation='Drag edge to view Output Window!') # Launch UI window pm.window('mimic_win', height=560, width=245, edit=True) mimic_win.show()
def _add_output_field(self, parent_layout): """ """ output_field_formLayout = pm.formLayout() output_field_scrollField = pm.scrollField('output_field_scrollField', height=5) pm.formLayout(output_field_formLayout, edit=True, attachForm=[(output_field_scrollField, "top", 0), (output_field_scrollField, "bottom", 5), (output_field_scrollField, "left", 3), (output_field_scrollField, "right", 3)]) pm.setParent(parent_layout)
def gui(): dir_name = os.path.dirname(__file__) file_path = os.path.join(dir_name, 'Startup', 'grade.path') f = open(file_path, 'r') pickle_data = pickle.load(f) f.close() win = 'quiz_grading' if pm.window(win, exists=True): pm.deleteUI(win) if pm.windowPref(win, exists=True): pm.windowPref(win, remove=True) global scroll_field, scroll_list, path_field, open_check_box my_win = pm.window(win, title='Quiz Grading', toolbox=True, width=600, height=400) god_layout = pm.columnLayout() pm.text(label='') path_field = pm.textFieldButtonGrp(label='Ouput Path', buttonCommand=pm.Callback(get_path), buttonLabel='<<<', text=pickle_data, columnWidth3=[100, 400, 100]) main_layout = pm.rowColumnLayout(numberOfColumns=2, columnWidth=([1, 200], [2, 400])) pm.columnLayout() pm.text(label='Quizzes') scroll_list = pm.textScrollList(width=200, height=400, selectCommand=pm.Callback(read_quiz)) pm.setParent(main_layout) pm.columnLayout() pm.text(label='Result') scroll_field = pm.scrollField(wordWrap=True, height=400, width=400) pm.setParent(god_layout) pm.rowColumnLayout(numberOfColumns=2, columnWidth=([1, 200], [2, 400])) open_check_box = pm.checkBox(label='Open File When Done', value=1) pm.button(label='Ouput To Text File', command=pm.Callback(ouput_to_text), height=35) list_quizzes() my_win.show()
def _updateAssetClicked(self): if self._currentSelectedAsset == None: raise RuntimeError('Nothing selected.') sceneName = _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.sceneNameTextField], query=True, text=True) filePath = _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.filePathTextField], query=True, text=True) category = _pmCore.optionMenuGrp(self._uiWidget[_UiWidgetEnum.categoryCombox], query=True, value=True) description = _pmCore.scrollField(self._uiWidget[_UiWidgetEnum.descriptionTextField], query=True, text=True) _Database.setFileCategory(self._currentSelectedAsset, category) _Database.setFileDescription(self._currentSelectedAsset, description) _Database.setFilename(self._currentSelectedAsset, sceneName) _Database.setFilePath(self._currentSelectedAsset, filePath) _pmCore.iconTextButton(self._uiWidget[_UiWidgetEnum.assetBtnList][self._assetBtnName(self._currentSelectedAsset)], edit=True, label=sceneName) self._refreshAssetButtonView()
def CreateUserInterface(self, _blueprintModule): self.currentBlueprintModule = _blueprintModule # Collect character namespace info characterNamespaceInfo = utils.StripLeadingNamespace(_blueprintModule) characterNamespace = characterNamespaceInfo[0] blueprintModuleNamespace = characterNamespaceInfo[1] characterName = characterNamespace.partition("__")[2] # Collect blueprint namespace info blueprintModuleInfo = blueprintModuleNamespace.partition("__") blueprintModuleName = blueprintModuleInfo[0] blueprintModuleUserSpecifiedName = blueprintModuleInfo[2] # Create UI windowWidth = 600 windowHeight = 200 self.UIElements["window"] = pm.window("modMaintenance_UI_window", width = windowWidth, height = windowHeight, title = 'Module Maintenance for %s:%s' %(characterName, blueprintModuleUserSpecifiedName), sizeable = False) self.UIElements["topRowLayout"] = pm.rowLayout(numberOfColumns = 2, columnWidth2 = (296, 296), columnAttach2 = ("both", "both"), columnOffset2 = (10, 10), rowAttach = ([1, "both", 5], [2, "both", 5]), parent = self.UIElements["window"]) self.UIElements["controlModule_textScrollList"] = pm.textScrollList(selectCommand = self.UI_controlModuleSelected, parent = self.UIElements["topRowLayout"]) # Add compatable control modules to text scroll list for controlModule in self.controlModuleCompatability: if blueprintModuleName in controlModule[2]: # Add control module if it hasn't already been installed if not self.IsModuleInstalled(controlModule[1]): pm.textScrollList(self.UIElements["controlModule_textScrollList"], edit = True, append = controlModule[1]) self.UIElements["right_columnLayout"] = pm.columnLayout(adjustableColumn = True, rowSpacing = 3, parent = self.UIElements["topRowLayout"]) self.UIElements["nameText"] = pm.text(label = 'No Animation Modules to Install', parent = self.UIElements["right_columnLayout"]) self.UIElements["descriptionScrollField"] = pm.scrollField(wordWrap = True, height = 110, editable = False, text = '', parent = self.UIElements["right_columnLayout"]) pm.separator(style = 'in', parent = self.UIElements["right_columnLayout"]) self.UIElements["installButton"] = pm.button(enable = False, label = "Install", parent = self.UIElements["right_columnLayout"]) if pm.textScrollList(self.UIElements["controlModule_textScrollList"], query = True, numberOfItems = True) != 0: pm.textScrollList(self.UIElements["controlModule_textScrollList"], edit = True, selectIndexedItem = 1) self.UI_controlModuleSelected() pm.showWindow(self.UIElements["window"])
def gui(): dir_name = os.path.dirname(__file__) file_path = os.path.join(dir_name, 'Startup', 'grade.path') f = open(file_path, 'r') pickle_data = pickle.load(f) f.close() win = 'quiz_grading' if pm.window(win, exists= True): pm.deleteUI(win) if pm.windowPref(win, exists= True): pm.windowPref(win, remove= True) global scroll_field, scroll_list, path_field, open_check_box my_win = pm.window(win, title= 'Quiz Grading', toolbox= True, width= 600, height= 400) god_layout = pm.columnLayout() pm.text(label= '') path_field = pm.textFieldButtonGrp(label= 'Ouput Path', buttonCommand= pm.Callback(get_path), buttonLabel= '<<<', text= pickle_data, columnWidth3= [100, 400, 100]) main_layout = pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 200], [2, 400])) pm.columnLayout() pm.text(label= 'Quizzes') scroll_list = pm.textScrollList(width= 200, height= 400, selectCommand= pm.Callback(read_quiz)) pm.setParent(main_layout) pm.columnLayout() pm.text(label= 'Result') scroll_field = pm.scrollField(wordWrap= True, height= 400, width= 400) pm.setParent(god_layout) pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 200], [2, 400])) open_check_box = pm.checkBox(label= 'Open File When Done', value= 1) pm.button(label= 'Ouput To Text File', command= pm.Callback(ouput_to_text), height= 35) list_quizzes() my_win.show()
def _buildupWindow(self): if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()): _pmCore.deleteUI(self._window, window=True) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout() self._sceneName = _pmCore.textFieldGrp(label='Scene Name: ', columnAlign2=('left', 'left'), columnWidth2=(80, 200)) _pmCore.rowLayout(numberOfColumns=2) self._filePath = _pmCore.textFieldGrp(label='Directory: ', columnAlign2 = ('left', 'left'), columnWidth2=(80, 180)) _pmCore.button(label='...', width=20, command=_functools.partial(self._directorySelection, self._filePath)) _pmCore.setParent('..') self._category = _pmCore.optionMenuGrp(label='Category: ', columnAlign2=('left', 'left'), columnWidth2=(80, 200)) for category in _Database.getCategoryList(): _pmCore.menuItem(label=category) _pmCore.text(label='Description: ') self._description = _pmCore.scrollField(width = 300, height=100) _pmCore.rowLayout(numberOfColumns=2) _pmCore.button(label='OK', width=150, align='left', command=self._newAssetInfoConfirmed) _pmCore.button(label='Cancel', width=150, align='left', command=self._newAssetInfoClose)
def custom(self): self.customWin = 'customWindow' if (pm.window(self.customWin, ex=True)): pm.deleteUI(self.customWin) if (pm.windowPref(self.customWin, ex=True)): pm.windowPref(self.customWin, remove = True) myWin = pm.window(self.customWin, title = 'CUSTOM', width = 200, height = 150) pm.columnLayout(adjustableColumn=True) pm.text(l='Enter label') self.customLabel = pm.textField(editable = True) pm.text(l='Enter custom comment') self.customComment = pm.scrollField(width = 200, height= 150) self.customFeedback = pm.text(label = '') pm.rowColumnLayout(nc = 2) # nc = number of rows pm.button(label='create', command=pm.Callback(self.addCustom)) pm.button(label='add' , command=pm.Callback(self.saveComment)) myWin.show()
def _buildupWindow(self): if self._dockControl and self._dockControl.exists(self._winTitle): _pmCore.deleteUI(self._dockControl) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout() self._dockControl = _pmCore.dockControl(area='right', content=self._window, label=self._winTitle) tabLayout = _pmCore.tabLayout() self._uiWidget[_UiWidgetEnum.categoryTabLayout] = tabLayout for category in _Database.getCategoryList(): childLayout = _pmCore.scrollLayout(width=300, height=300, childResizable=True) self._uiWidget[category] = _pmCore.gridLayout(numberOfColumns=3, cellHeight = self._iconSize, cellWidth=self._iconSize) for assetInfo in _Database.getAssetUnderCategory(category): id, sceneName, _, versionID, _, _, _ = assetInfo self._addAssetButton(id, sceneName, versionID) _pmCore.tabLayout(tabLayout, tabLabel=((childLayout, category),), edit=True) _pmCore.setParent('..') _pmCore.setParent('..') _pmCore.setParent('..') self._uiWidget[_UiWidgetEnum.sceneNameTextField] = _pmCore.textFieldGrp(label='Scene Name: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) self._uiWidget[_UiWidgetEnum.filePathTextField] = _pmCore.textFieldGrp(label='File Path: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) _pmCore.rowLayout(numberOfColumns=2) _pmCore.text(label="Current Version:", width=100, align='left') self._uiWidget[_UiWidgetEnum.versionNumText] = _pmCore.text(label="") _pmCore.setParent('..') self._uiWidget[_UiWidgetEnum.categoryCombox] = _pmCore.optionMenuGrp(label='Category: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) for category in _Database.getCategoryList(): self._uiWidget.setdefault(_UiWidgetEnum.categoryMenuList, []).append(_pmCore.menuItem(label=category)) _pmCore.text(label='Description:') self._uiWidget[_UiWidgetEnum.descriptionTextField] = _pmCore.scrollField(width=300, height=50) _pmCore.separator(style='single', horizontal=True) _pmCore.gridLayout(numberOfColumns=2, cellWidth=150) self._uiWidget[_UiWidgetEnum.updateAssetBtn] = _pmCore.button(label='Update Asset Info', command=_pmCore.Callback(self._updateAssetClicked)) self._uiWidget[_UiWidgetEnum.addCommentBtn] = _pmCore.button(label='View Version & Comment', command=_pmCore.Callback(self._viewVersionListClicked)) self._uiWidget[_UiWidgetEnum.addAssetBtn] = _pmCore.button(label='Add New Asset', command=_pmCore.Callback(self._addAssetClicked)) self._uiWidget[_UiWidgetEnum.deleteAssetBtn] = _pmCore.button(label='Delete Asset', command=_pmCore.Callback(self._deleteAssetClicked)) self._uiWidget[_UiWidgetEnum.addVersionBtn] = _pmCore.button(label='Add Version', command=_pmCore.Callback(self._addVersionClicked)) self._uiWidget[_UiWidgetEnum.manageCategoryBtn] = _pmCore.button(label='Manage Category', command=self._manageCategoryClicked) _pmCore.setParent('..')
def outputscrollField(text, window_title, width, height): window_width = width * 300 window_height = height * 600 scroll_width = width * 294 scroll_height = height * 590 window = str(pm.window( widthHeight=(window_width, window_height), topLeftCorner=(45, 0), maximizeButton=False, sizeable=False, title=window_title )) scrollLayout = str(pm.scrollLayout(verticalScrollBarThickness=16, horizontalScrollBarThickness=16)) pm.columnLayout(adjustableColumn=True) text_field = str(pm.scrollField(text=(text), width=scroll_width, height=scroll_height,)) print window pm.setParent('..') pm.showWindow(window) return
def custom(self): self.customWin = 'customWindow' if (pm.window(self.customWin, ex=True)): pm.deleteUI(self.customWin) if (pm.windowPref(self.customWin, ex=True)): pm.windowPref(self.customWin, remove=True) myWin = pm.window(self.customWin, title='CUSTOM', width=200, height=150) pm.columnLayout(adjustableColumn=True) pm.text(l='Enter label') self.customLabel = pm.textField(editable=True) pm.text(l='Enter custom comment') self.customComment = pm.scrollField(width=200, height=150) self.customFeedback = pm.text(label='') pm.rowColumnLayout(nc=2) # nc = number of rows pm.button(label='create', command=pm.Callback(self.addCustom)) pm.button(label='add', command=pm.Callback(self.saveComment)) myWin.show()
def initialiseLayout(self): #Layout self.widgets['top_horizontal'] = pm.horizontalLayout() pm.setParent(self.widgets['top_horizontal']) self.widgets['result_vertical'] = pm.verticalLayout() self.widgets['result_textScrollList'] = pm.textScrollList(allowMultiSelection=True, sc=self.select_result_callback) pm.setParent(self.widgets['top_horizontal']) self.widgets['main_vertical'] = pm.verticalLayout() pm.setParent(self.widgets['main_vertical']) self.widgets['main_horizontal'] = pm.horizontalLayout() pm.setParent(self.widgets['main_horizontal']) self.widgets['check_vertical'] = pm.verticalLayout() self.widgets['checks_column'] = pm.columnLayout(adj=True) pm.text(label='Checks', bgc=[0,0,0]) pm.separator() pm.setParent(self.widgets['main_horizontal']) self.widgets['options_vertical'] = pm.verticalLayout() pm.setParent(self.widgets['main_vertical']) self.widgets['log_vertical'] = pm.verticalLayout() self.widgets['log_scrollField'] = pm.scrollField(font = 'smallFixedWidthFont') self.widgets['top_horizontal'].redistribute(1,3) self.widgets['main_horizontal'].redistribute(2,1) self.widgets['main_vertical'].redistribute(6,4) self.widgets['log_vertical'].redistribute() self.widgets['result_vertical'].redistribute() self.widgets['check_vertical'].redistribute() self.widgets['options_vertical'].redistribute() self.propagate_check_buttons()
def __init__(self): ''' # class to sort and give info on shaders ''' self.layout = pm.rowColumnLayout(numberOfColumns=3, columnWidth=([1, 150], [2, 150], [3, 250])) pm.columnLayout() pm.text(label='Shaders') self.shader_list = pm.textScrollList(width=150, height=200, selectCommand=pm.Callback( self.update_connections_list)) pm.button(label='Refresh', width=150, command=pm.Callback(self.update_shader_list)) pm.setParent(self.layout) pm.columnLayout() pm.text(label='Connections') self.connections_list = pm.textScrollList(width=150, height=200, selectCommand=pm.Callback( self.write_info)) self.check_box = pm.checkBox(label='Select Node') pm.setParent(self.layout) pm.columnLayout() pm.text(label='Node Info') self.info_field = pm.scrollField(wordWrap=True, width=250, height=200) self.attr_check_box = pm.checkBox(label='Show All') self.update_shader_list()
def _get_settings_for_postproc(robot): """ Get program settings from the Mimic UI. :return program_settings: dictionary """ # Get all important settings using_time_interval = pm.radioCollection('sample_rate_radio_collection', query=True, select=True) == 'rb_timeInterval' using_keyframes_only = not using_time_interval # TODO: Clever, but not expandable time_interval_value = pm.textField('t_timeBetweenSamples', query=True, text=True) time_interval_units = 'seconds' \ if pm.radioButtonGrp('time_unit_radio_group', query=True, sl=True) == 1 \ else 'frames' ignore_warnings = pm.checkBox('cb_ignoreWarnings', value=True, query=True) processor_type = pm.optionMenu('postProcessorList', query=True, value=True) output_directory = pm.textField('t_programDirectoryText', text=True, query=True) output_filename = pm.textField('t_outputFileName', text=True, query=True) template_filename = pm.textField('t_templateFileName', text=True, query=True) overwrite_option = pm.checkBox('cb_overwriteFile', value=True, query=True) # Get time interval in seconds animation_settings = _get_settings_for_animation(robot) framerate = animation_settings['Framerate'] if time_interval_units == 'seconds': sample_rate_sec = float(time_interval_value) else: # time_interval_units == 'frames' sample_rate_sec = float(time_interval_value) / float(framerate) time_interval_in_seconds = sample_rate_sec # Check for warnings if using_time_interval: # Confirm that the time interval is valid try: time_interval_value = float(time_interval_value) assert time_interval_value > 0 except ValueError: if time_interval_units == 'seconds': warning = 'Time interval must be a float' raise Exception(warning) else: # time_interval_units == 'frames' warning = 'Time interval must be a float' raise Exception(warning) except AssertionError: if time_interval_units == 'seconds': warning = 'Time interval must be greater than zero' raise Exception(warning) else: # time_interval_units = 'frames' warning = 'Time interval must be greater than zero' raise Exception(warning) # Check if the robot-postproc compatibility warning was triggered processor = postproc_setup.POST_PROCESSORS[processor_type]() warning = _check_robot_postproc_compatibility(robot, processor) if warning != '': if not ignore_warnings: raise Exception(warning) else: warning += '\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=warning, edit=True) # Assign values to output dict postproc_settings = { 'Using Time Interval': using_time_interval, 'Using Keyframes Only': using_keyframes_only, 'Time Interval Value': time_interval_value, 'Time Interval Units': time_interval_units, 'Time Interval in Seconds': time_interval_in_seconds, 'Ignore Warnings': ignore_warnings, 'Processor Type': processor_type, 'Output Directory': output_directory, 'Output Filename': output_filename, 'Template Filename': template_filename, 'Overwrite Option': overwrite_option } return postproc_settings
def save_program(*args): """ Save the program. :return: """ # Do this first upon button click! _clear_output_window() _initialize_export_progress_bar() # Check program, commands, raise exception on failure program_settings = _get_settings() animation_settings = program_settings[1] start_frame = animation_settings['Start Frame'] pm.currentTime(start_frame) command_dicts = _get_command_dicts(*program_settings) violation_exception, violation_warning = _check_command_dicts( command_dicts, *program_settings) # If we're sampling keyframes only, we assume it's for a post-processor # that's not time-dependent, and, therefore, we shouldn't raise exceptions # for limit violations postproc_settings = program_settings[2] using_keyframes_only = postproc_settings['Using Keyframes Only'] if not using_keyframes_only: if violation_exception: _initialize_export_progress_bar(is_on=False) pm.scrollField(OUTPUT_WINDOW_NAME, insertText='\n\nNO PROGRAM EXPORTED!', edit=True) pm.headsUpMessage('WARNINGS: No Program Exported; ' \ 'See Mimic output window for details') raise mimic_utils.MimicError('Limit violations found. ' \ 'No Program Exported. ' \ 'See Mimic output window for details.') # If axis 2 and 3 are coupled (as they are with FANUC, for example), # Modify A3 accordingly before post-processing # Note: we need to do this after limit checking to get accurate derivatives robot_name = program_settings[0] robot = pm.ls(robot_name)[0] if mimic_utils.axes_coupled(robot): command_dicts = _couple_axes(command_dicts) # Continue to save program: _process_program(command_dicts, *program_settings) if violation_warning: if not using_keyframes_only: pm.headsUpMessage('Program exported with warnings; ' \ 'See Mimic output window for details') else: pm.headsUpMessage('Program exported successfuly; ' \ 'See Mimic output window for details') else: pm.headsUpMessage('Program exported successfuly; ' \ 'See Mimic output window for details') _initialize_export_progress_bar(is_on=False)
def _clear_output_window(): """ Clear the output window :return: """ pm.scrollField(OUTPUT_WINDOW_NAME, clear=True, edit=True)
def user_cmd(self): return unicode(pmc.scrollField(self.cmd_ui, q=True, text=1))
def _check_command_dicts(command_dicts, robot, animation_settings, postproc_settings, user_options): """ Check command dictionary for warnings. :param command_dicts: A list of list of robot axes :param robot_name: Name of the robot :param animation_settings: User-defined animation settings. :param postproc_settings: User-defined program settings. :param user_options: User-defined postproc options. :return: True if warning, False otherwise """ # Check to see if the user has elected to ignore warnings ignore_warnings = postproc_settings['Ignore Warnings'] warning = '' # Temporary holder # Check if limits have been exceeded (i.e. velocity, acceleration) if user_options.Include_axes and not user_options.Ignore_motion: # TODO: Add UI options to select which violations, max/min/avg user wants to check # Check position limits position_limits = mimic_utils.get_axis_limits(robot) if position_limits['Axis 1']['Min Limit'] is None: position_warning = 'Unable to check position limits. Robot rig does not contain position data.\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=position_warning, edit=True) position_violations, position_stats = _check_command_dicts_limits( command_dicts, limits=position_limits, get_min=True, get_max=True, get_average=True) # Check velocity limits velocity_limits = mimic_utils.get_velocity_limits(robot) velocity_dicts = analysis_utils._generate_derivative_dicts( command_dicts, 1) if velocity_limits['Axis 1']['Min Limit'] is None: velocity_warning = 'Unable to check velocity limits. Robot rig does not contain velocity data.\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=velocity_warning, edit=True) velocity_violations, velocity_stats = _check_command_dicts_limits( velocity_dicts, limits=velocity_limits, get_min=True, get_max=True, get_average=True) # Check acceleration limits acceleration_limits = mimic_utils.get_acceleration_limits(robot) acceleration_dicts = analysis_utils._generate_derivative_dicts( velocity_dicts, 2) if acceleration_limits['Axis 1']['Min Limit'] is None: acceleration_warning = 'Unable to check acceleration limits. Robot rig does not contain acceleration data.\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=acceleration_warning, edit=True) acceleration_violations, acceleration_stats = _check_command_dicts_limits( acceleration_dicts, limits=acceleration_limits, get_min=True, get_max=True, get_average=True) # Check jerk limits jerk_limits = mimic_utils.get_jerk_limits(robot) jerk_dicts = analysis_utils._generate_derivative_dicts( acceleration_dicts, 3) if jerk_limits['Axis 1']['Min Limit'] is None: jerk_warning = 'Unable to check jerk limits. Robot rig does not contain jerk data.\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=jerk_warning, edit=True) jerk_violations, jerk_stats = _check_command_dicts_limits( jerk_dicts, limits=jerk_limits, get_min=True, get_max=True, get_average=True) # Format and print axis statistics _print_axis_stats(position_stats, "Position") _print_axis_stats(velocity_stats, "Velocity") _print_axis_stats(acceleration_stats, "Acceleration") _print_axis_stats(jerk_stats, "Jerk") if user_options.Include_external_axes and not user_options.Ignore_motion: # TODO: Implement velocity check for external axes # warning = _check_velocity_of_external_axes(robot, command_dicts, animation_settings['Framerate']) # if warning != '': # # Print this one always # warning += '\n' # pm.scrollField(OUTPUT_WINDOW_NAME, insertText=warning, edit=True) # if not ignore_warnings: # raise mimic_utils.MimicError(warning) pass if user_options.Include_pose and not user_options.Ignore_motion: # TODO: Implement velocity check for poses # warning = _check_velocity_of_pose(robot, command_dicts, animation_settings['Framerate']) # if warning != '': # # Print this one always # warning += '\n' # pm.scrollField(OUTPUT_WINDOW_NAME, insertText=warning, edit=True) # if not ignore_warnings: # raise mimic_utils.MimicError(warning) pass # If all checks passed then we don't have any warnings... # Format and print warnings violation_exception = False violation_warning = False if position_violations or velocity_violations or acceleration_violations or jerk_violations: # Print this one always pm.headsUpMessage('WARNINGS: See Mimic output window for details') if position_violations: _print_violations(position_violations, position_limits, "Position") if velocity_violations: _print_violations(velocity_violations, velocity_limits, "Velocity") if acceleration_violations: _print_violations(acceleration_violations, acceleration_limits, "Acceleration") if jerk_violations: _print_violations(jerk_violations, jerk_limits, "Jerk") if not ignore_warnings: violation_exception = True violation_warning = True else: no_warning = 'All checks passed!\n' pm.scrollField(OUTPUT_WINDOW_NAME, insertText=no_warning, edit=True) pm.headsUpMessage('All Checks Passed!') violation_warning = False return violation_exception, violation_warning
def user_cmd(self, text): pmc.scrollField(self.cmd_ui, e=True, text=text)
def ui(self): marge = 2 self.win = None if pmc.window(self.__class__.__name__, q=True, exists=True): pmc.deleteUI(self.__class__.__name__) with pmc.window(self.__class__.__name__, title=self.ui_name, menuBar=True) as self.win: #=================================================================== # Menus #=================================================================== pmc.menu(label="File", tearOff=False) pmc.menuItem(label="Open", c=self.select_py_ui) pmc.menuItem(label="Refresh", c=self.read_py) self.recents_menu_ui = pmc.menuItem(subMenu=True, label="Recents") pmc.setParent("..", menu=True) pmc.setParent("..", menu=True) pmc.menu(label="Options", tearOff=False) pmc.menuItem(label="Insert ScriptEditor", c=self.insert_script_editor_ui) self.reset_menu_ui = pmc.menuItem(label="Run Reset History", checkBox=self.reset, c=self.set_reset_his_ui) if self.maya_version >= 2011: self.dock_ui_item = pmc.menuItem(label="In Dock", checkBox=self.dock[0], c=self.set_in_dock_ui) pmc.menuItem(divider=True) pmc.menuItem(subMenu=True, label="Recents") self.max_recents_ui = pmc.menuItem(l="Set length (%s)" % self.max_recents, c=self.set_recents_ui) pmc.menuItem(l="Reset", c=self.reset_recents_ui) pmc.setParent("..", menu=True) pmc.menuItem(subMenu=True, label="Settings") pmc.menuItem(l="Reset", c=self.reset_options_ui) pmc.menuItem(l="Save", c=self.save_options) pmc.setParent("..", menu=True) pmc.menu(label='Help', helpMenu=True) pmc.menuItem(label='About', c=self.help_ui) #=================================================================== # Layout and Contents #=================================================================== main_form = pmc.formLayout(nd=100) self.run_but = pmc.button(l="Run", c=self.run_cmd_ui) self.main_layout = pmc.paneLayout(configuration="top3") form = pmc.formLayout(nd=100) self.cmd_ui = pmc.scrollField(ed=1, ww=0) pmc.setParent("..") form_infos = pmc.formLayout(nd=100) self.infos_ui = pmc.textScrollList(ams=0, fn="fixedWidthFont", sc=self.doc_cmd_ui, dcc=self.insert_cmd_ui) infos_layout = pmc.frameLayout(label="Filter / Sort / Doc", collapse=True, collapsable=True) pmc.columnLayout(adj=1) pmc.rowLayout(numberOfColumns=2, adj=1) self.filter_ui = pmc.textFieldGrp(label="Filter", text="", cw=[1, 40], adj=2, fcc=True, cc=self.order_by_ui) self.filter_test_ui = pmc.optionMenuGrp(cc=self.set_filter_test_ui) pmc.menuItem(label="in") pmc.menuItem(label="startswith") pmc.menuItem(label="endswith") pmc.setParent("..") self.order_ui = pmc.checkBoxGrp(numberOfCheckBoxes=2, label="Sort", label1="Alphabetical", label2="Show doc", cw=[1, 40], cc1=self.order_by_ui, cc2=self.set_show_doc_ui, ) pmc.setParent("..") pmc.setParent("..") pmc.setParent("..") self.form_scriptEditor = pmc.formLayout(nd=100) # self.form_scriptEditor = pmc.paneLayout(configuration="single") pmc.setParent("..") pmc.setParent("..") #=================================================================== # Layout settings #=================================================================== pmc.formLayout(main_form, edit=True, attachNone=[ (self.run_but, "bottom") ], attachForm=[ (self.run_but, "top", marge), (self.run_but, "left", marge), (self.run_but, "right", marge), (self.main_layout, "top", marge), (self.main_layout, "left", marge), (self.main_layout, "right", marge), (self.main_layout, "bottom", marge), ], attachControl=[ (self.main_layout, "top", marge, self.run_but), ] ) pmc.formLayout(form, edit=True, attachForm=[ (self.cmd_ui, "top", marge), (self.cmd_ui, "left", marge), (self.cmd_ui, "right", marge), (self.cmd_ui, "bottom", marge), ], ) pmc.formLayout(form_infos, edit=True, attachForm=[ (self.infos_ui, "top", marge), (self.infos_ui, "left", marge), (self.infos_ui, "right", marge), (infos_layout, "left", marge), (infos_layout, "right", marge), (infos_layout, "bottom", marge), ], attachControl=[ (self.infos_ui, "bottom", marge, infos_layout) ] ) self.insert_script_editor_ui() self.dock_it()
def create(self): self.scrollField = pm.scrollField( wordWrap = True , width = self.width , height = self.height , backgroundColor = [ 1 , 0 , 0 ]) self.menus() return self.scrollField
def make_ui(self,) : # ストロークプレビュー用のカメラを作成 try : temp = pm.PyNode("pin_edit_cam") pm.delete(temp) except : pass self.subCam = cmds.duplicate( 'persp', n= "pin_edit_cam" ) pm.mel.viewFit( "pin_edit_cam" , self.cur) # windowが開かれていたら更新する if pm.window('pinEditUI', ex=1) == True: pm.deleteUI('pinEditUI') with pm.window("pinEditUI", title="Pin Editor", widthHeight=(470,400) ) as pinEditUI: with pm.formLayout() as form : # ビュー用UI view = cmds.modelEditor(camera="pin_edit_cam") cmds.modelEditor( view, edit=True, displayAppearance='wireframe', polymeshes=False) # 左側UI with pm.columnLayout( adjustableColumn=True, rowSpacing=8) as column: pm.button ( label = "次のピンへ", c = self.next_pin, # ()をつけた関数は置けない。 # →引数が欲しいときはpartialを使う。また、関数には*argsが必要 h = 20 ) pm.button ( label = "前のピンへ", c = self.previous_pin, # ()をつけた関数は置けない。 # →引数が欲しいときはpartialを使う。また、関数には*argsが必要 h = 20 ) pm.button ( label = "ピンとして追加", c = self.add_pin, # ()をつけた関数は置けない。 # →引数が欲しいときはpartialを使う。また、関数には*argsが必要 h = 20 ) pm.button ( label = "初期化", c = self.initialization, h = 20 ) pm.button ( label = "SHOW", c = self.show_pin, h = 20 ) self.dmp_synchronize = pm.checkBox( label = "BSを同期" ) # 下側UI with pm.columnLayout( adjustableColumn=True, rowSpacing=0) as bottom_column : self.pins_field = pm.scrollField( text = "temp", editable = False, h = 24 ) self.param_field = pm.scrollField( text = "temp", editable = False, h = 24 ) cmds.formLayout( form, edit=True, attachForm=[ (column, 'top', 5), (column, 'left', 0), (view, 'top', 5), (view, 'right', 0), (bottom_column, 'left', 0), (bottom_column, 'bottom', 0), (bottom_column, 'right', 0)], attachNone=[ (column, 'bottom'), (column, 'right'), (bottom_column, 'top')], attachControl=[ (view, 'left', 0, column), (view, 'bottom', 0, bottom_column)] ) # ウィンドウ位置を指定 gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow') # メインを取得 mainwindow_top = cmds.window( gMainWindow, q=True, topEdge = True) mainwindow_left = cmds.window( gMainWindow, q=True, leftEdge = True) pm.window( pinEditUI, e = 1, topEdge = mainwindow_top + 150 , leftEdge = mainwindow_left + 500 ) # 位置を移動
def uiCreate(self): self.onCloseClicked() self.window = pm.window( WIN_NAME, title='PyMel Window', maximizeButton=False ) with self.window: with pm.formLayout() as uiLAY_mainForm: with pm.scrollLayout('uiLAY_mainScroll', childResizable=True) as self.uiLAY_mainScroll: with pm.columnLayout(adjustableColumn=True): with self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') as self.uiLAY_frameCheckBoxes: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiCHK_test1 = pm.checkBox('uiCHK_test1', label='test1') self.uiCHK_test2 = pm.checkBox('uiCHK_test2', label='test2') with self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') as self.uiLAY_frameCheckBoxGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiCHKGRP_test1 = pm.checkBoxGrp( 'uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1' ) self.uiCHKGRP_test2 = pm.checkBoxGrp( 'uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2') ) self.uiCHKGRP_test3 = pm.checkBoxGrp( 'uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiCHKGRP_test4 = pm.checkBoxGrp( 'uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) with self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') as self.uiLAY_frameColorSliders: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiCLRGRP_test1 = pm.colorSliderGrp( 'uiCLRGRP_test1', label='test1' ) self.uiCLRGRP_test2 = pm.colorSliderGrp( 'uiCLRGRP_test2', label='test2' ) with self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') as self.uiLAY_frameFloatFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiFLF_test1 = pm.floatField('uiFLF_test1') self.uiFLF_test2 = pm.floatField('uiFLF_test2') with self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') as self.uiLAY_frameFloatFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiFLFGRP_test1 = pm.floatFieldGrp( 'uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1' ) self.uiFLFGRP_test2 = pm.floatFieldGrp( 'uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2' ) self.uiFLFGRP_test3 = pm.floatFieldGrp( 'uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3' ) self.uiFLFGRP_test4 = pm.floatFieldGrp( 'uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4' ) with self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') as self.uiLAY_frameFloatScrollBars: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiFLSCRL_test1 = pm.floatScrollBar('uiFLSCRL_test1') self.uiFLSCRL_test2 = pm.floatScrollBar('uiFLSCRL_test2') with self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') as self.uiLAY_frameFloatSliders: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiFLTSLD_test1 = pm.floatSlider('uiFLTSLD_test1') self.uiFLTSLD_test2 = pm.floatSlider('uiFLTSLD_test2') with self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') as self.uiLAY_frameFloatSliderGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiFLSGRP_test1 = pm.floatSliderGrp( 'uiFLSGRP_test1', label='test1', field=True ) self.uiFLSGRP_test2 = pm.floatSliderGrp( 'uiFLSGRP_test2', label='test2', field=True ) with self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') as self.uiLAY_frameIconTextCheckBoxes: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiITCHK_test1 = pm.iconTextCheckBox( 'uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITCHK_test2 = pm.iconTextCheckBox( 'uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) with self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') as self.uiLAY_frameIconTextRadioButtons: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=4): pm.separator(style='none', width=140) pm.iconTextRadioCollection() self.uiITRAD_test1 = pm.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITRAD_test2 = pm.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) self.uiITRAD_test3 = pm.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus' ) with self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') as self.uiLAY_frameIconTextScrollLists: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiITSLST_test1 = pm.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiITSLST_test2 = pm.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) with self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') as self.uiLAY_frameIntFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiINF_test1 = pm.intField('uiINF_test1') self.uiINF_test2 = pm.intField('uiINF_test2') with self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') as self.uiLAY_frameIntFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiINFGRP_test1 = pm.intFieldGrp( 'uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1' ) self.uiINFGRP_test2 = pm.intFieldGrp( 'uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2' ) self.uiINFGRP_test3 = pm.intFieldGrp( 'uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3' ) self.uiINFGRP_test4 = pm.intFieldGrp( 'uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4' ) with self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') as self.uiLAY_frameIntScrollBars: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiINSCRL_test1 = pm.intScrollBar('uiINSCRL_test1') self.uiINSCRL_test2 = pm.intScrollBar('uiINSCRL_test2') with self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') as self.uiLAY_frameIntSliders: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiINTSLD_test1 = pm.intSlider('uiINTSLD_test1') self.uiINTSLD_test2 = pm.intSlider('uiINTSLD_test2') with self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') as self.uiLAY_frameIntSliderGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiINSGRP_test1 = pm.intSliderGrp( 'uiINSGRP_test1', label='test1', field=True ) self.uiINSGRP_test2 = pm.intSliderGrp( 'uiINSGRP_test2', label='test2', field=True ) with self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') as self.uiLAY_frameOptionMenus: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=110, style='none') self.uiOPTMNU_test1 = pm.optionMenu('uiOPTMNU_test1', label='test1') pm.menuItem(label='one') pm.menuItem(label='two') pm.menuItem(label='three') self.uiOPTMNU_test2 = pm.optionMenu('uiOPTMNU_test2', label='test2') pm.menuItem(label='four') pm.menuItem(label='five') pm.menuItem(label='six') with self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') as self.uiLAY_frameOptionMenuGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiOPMGRP_test1 = pm.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel') pm.menuItem(label='one') pm.menuItem(label='two') pm.menuItem(label='three') self.uiOPMGRP_test2 = pm.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel') pm.menuItem(label='four') pm.menuItem(label='five') pm.menuItem(label='six') with self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') as self.uiLAY_frameRadioButtons: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=4): pm.separator(style='none', width=140) pm.radioCollection() self.uiRAD_test1 = pm.radioButton('uiRAD_test1', label='test1') self.uiRAD_test2 = pm.radioButton('uiRAD_test2', label='test2') self.uiRAD_test3 = pm.radioButton('uiRAD_test3', label='test3') with self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') as self.uiLAY_frameRadioButtonGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiRADGRP_test1 = pm.radioButtonGrp( 'uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1' ) self.uiRADGRP_test2 = pm.radioButtonGrp( 'uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2') ) self.uiRADGRP_test3 = pm.radioButtonGrp( 'uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiRADGRP_test4 = pm.radioButtonGrp( 'uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) with self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') as self.uiLAY_frameSymbolCheckBoxes: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSYMCHK_test1 = pm.symbolCheckBox( 'uiSYMCHK_test1', image='polyCube' ) self.uiSYMCHK_test2 = pm.symbolCheckBox( 'uiSYMCHK_test2', image='polyCone' ) with self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') as self.uiLAY_frameScriptTables: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSCRTBL_test1 = pm.scriptTable( 'uiSCRTBL_test1', selectionMode=3, rows=4, columns=2 ) self.uiSCRTBL_test2 = pm.scriptTable( 'uiSCRTBL_test2', selectionMode=3, rows=4, columns=2 ) with self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') as self.uiLAY_frameScrollField: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSCRFLD_test1 = pm.scrollField( 'uiSCRFLD_test1', wordWrap=True ) self.uiSCRFLD_test2 = pm.scrollField( 'uiSCRFLD_test2', wordWrap=True ) with self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') as self.uiLAY_frameShelfTabLayout: with pm.columnLayout(adjustableColumn=True): with pm.shelfTabLayout('uiSHLTAB_test1') as self.uiSHLTAB_test1: with pm.shelfLayout('test1'): pass with pm.shelfLayout('test2'): pass with pm.shelfLayout('test3'): pass with pm.shelfTabLayout('uiSHLTAB_test2') as self.uiSHLTAB_test2: with pm.shelfLayout('test4'): pass with pm.shelfLayout('test5'): pass with pm.shelfLayout('test6'): pass with self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') as self.uiLAY_frameTabLayout: with pm.columnLayout(adjustableColumn=True): with pm.tabLayout('uiTAB_test1') as self.uiTAB_test1: with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow1: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow2: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow3: pass pm.tabLayout( self.uiTAB_test1, edit=True, tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),) ) with pm.tabLayout('uiTAB_test2') as self.uiTAB_test2: with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow4: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow5: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow6: pass pm.tabLayout( self.uiTAB_test2, edit=True, tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),) ) with self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') as self.uiLAY_frameTextFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiTXT_test1 = pm.textField('uiTXT_test1') self.uiTXT_test2 = pm.textField('uiTXT_test2') with self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') as self.uiLAY_frameTextFieldButtonGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiTXBTGR_test1 = pm.textFieldButtonGrp( 'uiTXBTGR_test1', label='test1', buttonLabel='button1' ) self.uiTXBTGR_test2 = pm.textFieldButtonGrp( 'uiTXBTGR_test2', label='test2', buttonLabel='button2' ) with self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') as self.uiLAY_frameTextFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiTXTGRP_test1 = pm.textFieldGrp( 'uiTXTGRP_test1', label='test1' ) self.uiTXTGRP_test2 = pm.textFieldGrp( 'uiTXTGRP_test2', label='test2' ) with self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') as self.uiLAY_frameTextScrollLists: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiTXTLST_test1 = pm.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiTXTLST_test2 = pm.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiBTN_savePrefs = pm.button( label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked ) self.uiBTN_loadPrefs = pm.button( label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked ) self.uiBTN_resetPrefs = pm.button( label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked ) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'top', 2) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'left', 2) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'right', 2) uiLAY_mainForm.attachControl(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs) uiLAY_mainForm.attachNone(self.uiBTN_savePrefs, 'top') uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'left', 2) uiLAY_mainForm.attachPosition(self.uiBTN_savePrefs, 'right', 2, 33) uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'bottom', 2) uiLAY_mainForm.attachNone(self.uiBTN_loadPrefs, 'top') uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'left', 2, 33) uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'right', 2, 66) uiLAY_mainForm.attachForm(self.uiBTN_loadPrefs, 'bottom', 2) uiLAY_mainForm.attachNone(self.uiBTN_resetPrefs, 'top') uiLAY_mainForm.attachPosition(self.uiBTN_resetPrefs, 'left', 2, 66) uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'right', 2) uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'bottom', 2) self.window.setTitle(self.window.__class__)