def _createGroups(self, definitions): """Create AOVGroups based on definitions.""" for name, group_data in definitions.iteritems(): # Create a new AOVGroup. group = AOVGroup(name) # Process its list of AOVs to include. if "include" in group_data: group.includes.extend(group_data["include"]) # Set any comment. if "comment" in group_data: group.comment = group_data["comment"] if "priority" in group_data: group.priority = group_data["priority"] # Set any icon. if "icon" in group_data: group.icon = os.path.expandvars(group_data["icon"]) # Set the path to this file. group.path = self.path # Add the group to the list. self.groups.append(group)
def _create_groups(self, definitions): """Create AOVGroups based on definitions. :param definitions: AOVGroup definition data. :type definitions: dict :return: """ for name, group_data in definitions.iteritems(): # Create a new AOVGroup. group = AOVGroup(name) # Process its list of AOVs to include. if consts.GROUP_INCLUDE_KEY in group_data: group.includes.extend(group_data[consts.GROUP_INCLUDE_KEY]) # Set any comment. if consts.COMMENT_KEY in group_data: group.comment = group_data[consts.COMMENT_KEY] if consts.PRIORITY_KEY in group_data: group.priority = group_data[consts.PRIORITY_KEY] # Set any icon. if consts.GROUP_ICON_KEY in group_data: group.icon = os.path.expandvars(group_data[consts.GROUP_ICON_KEY]) # Set the path to this file. group.path = self.path # Add the group to the list. self.groups.append(group)
def accept(self): """Accept the operation.""" group_name = str(self.group_name.text()) group = AOVGroup(group_name) group.path = os.path.expandvars(self.file_widget.getPath()) self.buildGroupFromUI(group) aov_file = manager.AOVFile(group.path) aov_file.addGroup(group) aov_file.writeToFile() self.newAOVGroupSignal.emit(group) return super(NewGroupDialog, self).accept()
def _create_groups(self, definitions): """Create AOVGroups based on definitions. :param definitions: AOVGroup definition data. :type definitions: dict :return: """ for name, group_data in definitions.items(): # Create a new AOVGroup. group = AOVGroup(name) # Process its list of AOVs to include. if consts.GROUP_INCLUDE_KEY in group_data: group.includes.extend(group_data[consts.GROUP_INCLUDE_KEY]) # Set any comment. if consts.COMMENT_KEY in group_data: group.comment = group_data[consts.COMMENT_KEY] if consts.PRIORITY_KEY in group_data: group.priority = group_data[consts.PRIORITY_KEY] # Set any icon. if consts.GROUP_ICON_KEY in group_data: group.icon = os.path.expandvars( group_data[consts.GROUP_ICON_KEY]) # Set the path to this file. group.path = self.path # Add the group to the list. self.groups.append(group)
def accept(self): """Accept the operation.""" group_name = self.group_name.text() if self._operation == DialogOperation.Edit: # Want to edit the existing group so use it and clear out the # current AOVs. group = self._group group.clear() else: group = AOVGroup(group_name) file_path = os.path.expandvars(self.file_widget.getPath()) group.path = file_path comment = self.comment.text() if comment: group.comment = comment # Find the AOVs to be in this group. aovs = self.aov_list.getSelectedAOVs() group.aovs.extend(aovs) # Emit appropriate signal based on operation type. if self._operation == DialogOperation.New: self.newAOVGroupSignal.emit(group) else: self.groupUpdatedSignal.emit(group) # Construct a writer and write the group to disk. writer = manager.AOVFileWriter() writer.addGroup(group) writer.writeToFile(file_path) return super(AOVGroupDialog, self).accept()