def create_dialog(): global dialog_id dialog_id = vs.CreateLayout('Change Fixture Class', False, 'Apply', 'Cancel') vs.CreateStaticText(dialog_id, 4, 'Lighting-Type-', -1) vs.CreateEditText(dialog_id, 6, new_class, 20) vs.SetFirstLayoutItem(dialog_id, 4) vs.SetRightItem(dialog_id, 4, 6, 0, 0) return vs.RunLayoutDialog(dialog_id, dialog_handler)
def CreateDialog(): # Alignment constants kRight = 1 kBottom = 2 kLeft = 3 kColumn = 4 kResize = 0 kShift = 1 def GetPluginString(ndx): # Static Text if ndx == 1001: return 'OK' elif ndx == 1002: return 'Cancel' elif ndx == 1003: return 'Jands Vista Export Patch' elif ndx == 1004: return 'Fixture Name:' elif ndx == 1005: return 'Fixture Number:' elif ndx == 1006: return 'DMX Universe:' elif ndx == 1008: return 'DMX Address:' elif ndx == 1015: return '' elif ndx == 1016: return '' elif ndx == 1017: return '' elif ndx == 1018: return '' elif ndx == 1032: return '' # Help Text elif ndx == 2001: return 'Accepts the dialog data.' elif ndx == 2002: return 'Cancels the dialog data.' elif ndx == 2004: return 'Help text.' elif ndx == 2005: return 'Help text.' elif ndx == 2006: return 'Help text.' elif ndx == 2008: return 'Help text.' elif ndx == 2015: return 'Help text.' elif ndx == 2016: return 'Help text.' elif ndx == 2017: return 'Help text.' elif ndx == 2018: return 'Help text.' elif ndx == 2032: return 'Help text.' return '' def GetStr(ndx): result = GetPluginString( ndx + 1000 ) return result def GetHelpStr(ndx): result = GetPluginString( ndx + 2000 ) return result dialog = vs.CreateLayout( GetStr(3), False, GetStr(kOK), GetStr(kCancel) ) # create controls vs.CreateStaticText( dialog, kFixtureNameLabel, GetStr(kFixtureNameLabel), -1 ) vs.CreatePullDownMenu( dialog, kFixtureNamePopup, 16 ) vs.CreateStaticText( dialog, kFixtureNumberLabel, GetStr(kFixtureNumberLabel), -1 ) vs.CreatePullDownMenu( dialog, kFixtureNumberPopup, 16 ) vs.CreateStaticText( dialog, kDmaUniverseLabel, GetStr(kDmaUniverseLabel), -1 ) vs.CreatePullDownMenu( dialog, kDmxUniversePopup, 16 ) vs.CreateStaticText( dialog, kDmxAddressLabel, GetStr(kDmxAddressLabel), -1 ) vs.CreatePullDownMenu( dialog, kDmxAddressPopup, 16 ) vs.CreateLB( dialog, kLightingTypesLB, 34, 15 ) # set relations vs.SetFirstLayoutItem( dialog, kFixtureNameLabel ) vs.SetRightItem( dialog, kFixtureNameLabel, kFixtureNamePopup, 5, 0 ) vs.SetBelowItem( dialog, kFixtureNameLabel, kFixtureNumberLabel, 0, 0 ) vs.SetRightItem( dialog, kFixtureNumberLabel, kFixtureNumberPopup, 5, 0 ) vs.SetBelowItem( dialog, kFixtureNumberLabel, kDmaUniverseLabel, 0, 0 ) vs.SetRightItem( dialog, kDmaUniverseLabel, kDmxUniversePopup, 5, 0 ) vs.SetBelowItem( dialog, kDmaUniverseLabel, kDmxAddressLabel, 0, 0 ) vs.SetRightItem( dialog, kDmxAddressLabel, kDmxAddressPopup, 5, 0 ) vs.SetBelowItem( dialog, kDmxAddressLabel, kLightingTypesLB, 0, 0 ) # set alignments vs.AlignItemEdge( dialog, kFixtureNamePopup, kRight, 1, kShift ) vs.AlignItemEdge( dialog, kFixtureNumberPopup, kRight, 1, kShift ) vs.AlignItemEdge( dialog, kDmxUniversePopup, kRight, 1, kShift ) vs.AlignItemEdge( dialog, kDmxAddressPopup, kRight, 1, kShift ) # set help strings cnt = 1 while ( cnt <= 32 ): vs.SetHelpText( dialog, cnt, GetHelpStr(cnt) ) cnt += 1 return dialog
def dialog_layout(self) -> None: """ Creates the dialog layout """ input_field_width = 18 label_width = 22 self.dialog = vs.CreateLayout("Picture Options", True, "OK", "Cancel") # Name group # ========================================================================================= vs.CreateGroupBox(self.dialog, self.kWidgetID_nameGroup, "", False) vs.SetFirstLayoutItem(self.dialog, self.kWidgetID_nameGroup) # Name # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_pictureNameLabel, "Picture Name: ", -1) vs.SetFirstGroupItem(self.dialog, self.kWidgetID_nameGroup, self.kWidgetID_pictureNameLabel) vs.CreateEditText(self.dialog, self.kWidgetID_pictureName, self.parameters.pictureName, 30) vs.SetRightItem(self.dialog, self.kWidgetID_pictureNameLabel, self.kWidgetID_pictureName, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_pictureName, "Type a name here for the Picture") # Create Symbol # ------------------------------------------------------------------------------------------ vs.CreateCheckBox(self.dialog, self.kWidgetID_createSymbol, "Create Symbol") vs.SetBelowItem(self.dialog, self.kWidgetID_pictureNameLabel, self.kWidgetID_createSymbol, 0, 0) vs.SetBooleanItem(self.dialog, self.kWidgetID_createSymbol, self.parameters.createSymbol == "True") # Picture group # ========================================================================================= vs.CreateGroupBox(self.dialog, self.kWidgetID_imageGroup, "Image", True) vs.SetBelowItem(self.dialog, self.kWidgetID_nameGroup, self.kWidgetID_imageGroup, 0, 0) # With Image checkbox # ----------------------------------------------------------------------------------------- vs.CreateCheckBox(self.dialog, self.kWidgetID_withImage, "With Image") vs.SetFirstGroupItem(self.dialog, self.kWidgetID_imageGroup, self.kWidgetID_withImage) vs.SetBooleanItem(self.dialog, self.kWidgetID_withImage, self.parameters.withImage == "True") # Image Width dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_imageWidthLabel, "Image Width: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_withImage, self.kWidgetID_imageWidthLabel, 1, 0) valid, value = vs.ValidNumStr(self.parameters.imageWidth) if not valid: value = PictureParameters().imageWidth vs.CreateEditReal(self.dialog, self.kWidgetID_imageWidth, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_imageWidthLabel, self.kWidgetID_imageWidth, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_imageWidth, "Enter the width of the image here.") # Image Height dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_imageHeightLabel, "Image Height: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_imageWidthLabel, self.kWidgetID_imageHeightLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.imageHeight) if not valid: value = PictureParameters().imageHeight vs.CreateEditReal(self.dialog, self.kWidgetID_imageHeight, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_imageHeightLabel, self.kWidgetID_imageHeight, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_imageHeight, "Enter the height of the image here.") # Image Position dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_imagePositionLabel, "Image Position: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_imageHeightLabel, self.kWidgetID_imagePositionLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.imagePosition) if not valid: value = PictureParameters().imagePosition vs.CreateEditReal(self.dialog, self.kWidgetID_imagePosition, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_imagePositionLabel, self.kWidgetID_imagePosition, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_imagePosition, "Enter the position (depth) of the image here.") # Image Edit button # ----------------------------------------------------------------------------------------- vs.CreatePushButton(self.dialog, self.kWidgetID_imageEditButton, "Edit Image") vs.SetBelowItem(self.dialog, self.kWidgetID_imagePositionLabel, self.kWidgetID_imageEditButton, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_imageEditButton, "Allows to edit the picture image") # Frame group # ========================================================================================= vs.CreateGroupBox(self.dialog, self.kWidgetID_frameGroup, "Frame", True) vs.SetBelowItem(self.dialog, self.kWidgetID_imageGroup, self.kWidgetID_frameGroup, 0, 0) # With Frame checkbox # ----------------------------------------------------------------------------------------- vs.CreateCheckBox(self.dialog, self.kWidgetID_withFrame, "With Frame") vs.SetFirstGroupItem(self.dialog, self.kWidgetID_frameGroup, self.kWidgetID_withFrame) vs.SetBooleanItem(self.dialog, self.kWidgetID_withFrame, self.parameters.withFrame == "True") # Frame Width dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_frameWidthLabel, "Frame Width: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_withFrame, self.kWidgetID_frameWidthLabel, 1, 0) valid, value = vs.ValidNumStr(self.parameters.frameWidth) if not valid: value = PictureParameters().frameWidth vs.CreateEditReal(self.dialog, self.kWidgetID_frameWidth, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_frameWidthLabel, self.kWidgetID_frameWidth, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_frameWidth, "Enter the width of the frame here.") # Frame Height dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_frameHeightLabel, "Frame Height: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_frameWidthLabel, self.kWidgetID_frameHeightLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.frameHeight) if not valid: value = PictureParameters().frameHeight vs.CreateEditReal(self.dialog, self.kWidgetID_frameHeight, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_frameHeightLabel, self.kWidgetID_frameHeight, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_frameHeight, "Enter the height of the frame here.") # Frame Thickness dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_frameThicknessLabel, "Frame Thickness: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_frameHeightLabel, self.kWidgetID_frameThicknessLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.frameThickness) if not valid: value = PictureParameters().frameThickness vs.CreateEditReal(self.dialog, self.kWidgetID_frameThickness, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_frameThicknessLabel, self.kWidgetID_frameThickness, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_frameThickness, "Enter the thickness of the frame here.") # Frame Depth dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_frameDepthLabel, "Frame Depth: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_frameThicknessLabel, self.kWidgetID_frameDepthLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.frameDepth) if not valid: value = PictureParameters().frameDepth vs.CreateEditReal(self.dialog, self.kWidgetID_frameDepth, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_frameDepthLabel, self.kWidgetID_frameDepth, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_frameDepth, "Enter the depth of the frame here.") # Frame Class # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_frameClassLabel, "Frame Class: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_frameDepthLabel, self.kWidgetID_frameClassLabel, 0, 0) vs.CreateClassPullDownMenu(self.dialog, self.kWidgetID_frameClass, input_field_width) class_index = vs.GetPopUpChoiceIndex(self.dialog, self.kWidgetID_frameClass, self.parameters.frameClass) vs.SelectChoice(self.dialog, self.kWidgetID_frameClass, class_index, True) vs.SetRightItem(self.dialog, self.kWidgetID_frameClassLabel, self.kWidgetID_frameClass, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_frameClass, "Enter the class of the frame here.") # Frame Texture scale # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_frameTextureScaleLabel, "Frame Texture Scale: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_frameClassLabel, self.kWidgetID_frameTextureScaleLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.frameTextureScale) if not valid: value = PictureParameters().frameTextureScale vs.CreateEditReal(self.dialog, self.kWidgetID_frameTextureScale, 1, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_frameTextureScaleLabel, self.kWidgetID_frameTextureScale, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_frameTextureScale, "Enter the scale for the frame texture.") # Frame Texture rotation # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_frameTextureRotationLabel, "Frame Texture Rotation: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_frameTextureScaleLabel, self.kWidgetID_frameTextureRotationLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.frameTextureRotation) if not valid: value = PictureParameters().frameTextureRotation vs.CreateEditReal(self.dialog, self.kWidgetID_frameTextureRotation, 1, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_frameTextureRotationLabel, self.kWidgetID_frameTextureRotation, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_frameTextureRotation, "Enter the scale for the frame texture.") # Matboard group # ========================================================================================= vs.CreateGroupBox(self.dialog, self.kWidgetID_matboardGroup, "Matboard", True) vs.SetBelowItem(self.dialog, self.kWidgetID_frameGroup, self.kWidgetID_matboardGroup, 0, 0) # With Matboard checkbox # ----------------------------------------------------------------------------------------- vs.CreateCheckBox(self.dialog, self.kWidgetID_withMatboard, "With Matboard") vs.SetFirstGroupItem(self.dialog, self.kWidgetID_matboardGroup, self.kWidgetID_withMatboard) vs.SetBooleanItem(self.dialog, self.kWidgetID_withMatboard, self.parameters.withMatboard == "True") # Window Width dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_windowWidthLabel, "Window Width: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_withMatboard, self.kWidgetID_windowWidthLabel, 1, 0) valid, value = vs.ValidNumStr(self.parameters.windowWidth) if not valid: value = PictureParameters().windowWidth vs.CreateEditReal(self.dialog, self.kWidgetID_windowWidth, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_windowWidthLabel, self.kWidgetID_windowWidth, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_windowWidth, "Enter the width of the matboard window here.") # Window Height dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_windowHeightLabel, "Window Height: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_windowWidthLabel, self.kWidgetID_windowHeightLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.windowHeight) if not valid: value = PictureParameters().windowHeight vs.CreateEditReal(self.dialog, self.kWidgetID_windowHeight, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_windowHeightLabel, self.kWidgetID_windowHeight, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_windowHeight, "Enter the height of the matboard window here.") # Matboard Position dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_matboardPositionLabel, "Matboard Position: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_windowHeightLabel, self.kWidgetID_matboardPositionLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.matboardPosition) if not valid: value = PictureParameters().matboardPosition vs.CreateEditReal(self.dialog, self.kWidgetID_matboardPosition, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_matboardPositionLabel, self.kWidgetID_matboardPosition, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_matboardPosition, "Enter the position (depth) of the matboard here.") # Matboard Class # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_matboardClassLabel, "Matboard Class: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_matboardPositionLabel, self.kWidgetID_matboardClassLabel, 0, 0) vs.CreateClassPullDownMenu(self.dialog, self.kWidgetID_matboardClass, input_field_width) class_index = vs.GetPopUpChoiceIndex(self.dialog, self.kWidgetID_matboardClass, self.parameters.matboardClass) vs.SelectChoice(self.dialog, self.kWidgetID_matboardClass, class_index, True) vs.SetRightItem(self.dialog, self.kWidgetID_matboardClassLabel, self.kWidgetID_matboardClass, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_matboardClass, "Enter the class of the matboard here.") # Matboard Texture scale # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_matboardTextureScaleLabel, "Matboard Texture Scale: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_matboardClassLabel, self.kWidgetID_matboardTextureScaleLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.matboardTextureScale) if not valid: value = PictureParameters().matboardTextureScale vs.CreateEditReal(self.dialog, self.kWidgetID_matboardTextureScale, 1, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_matboardTextureScaleLabel, self.kWidgetID_matboardTextureScale, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_matboardTextureScale, "Enter the scale for the matboard texture.") # Matboard Texture rotation # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_matboardTextureRotatLabel, "Matboard Texture Rotation: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_matboardTextureScaleLabel, self.kWidgetID_matboardTextureRotatLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.matboardTextureRotat) if not valid: value = PictureParameters().matboardTextureRotat vs.CreateEditReal(self.dialog, self.kWidgetID_matboardTextureRotat, 1, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_matboardTextureRotatLabel, self.kWidgetID_matboardTextureRotat, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_matboardTextureRotat, "Enter the scale for the matboard texture.") # Glass group # ========================================================================================= vs.CreateGroupBox(self.dialog, self.kWidgetID_glassGroup, "Glass", True) vs.SetBelowItem(self.dialog, self.kWidgetID_matboardGroup, self.kWidgetID_glassGroup, 0, 0) # With Glass checkbox # ----------------------------------------------------------------------------------------- vs.CreateCheckBox(self.dialog, self.kWidgetID_withGlass, "With Glass") vs.SetFirstGroupItem(self.dialog, self.kWidgetID_glassGroup, self.kWidgetID_withGlass) vs.SetBooleanItem(self.dialog, self.kWidgetID_withGlass, self.parameters.withGlass == "True") # Glass Position dimension # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_glassPositionLabel, "Glass Position: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_withGlass, self.kWidgetID_glassPositionLabel, 0, 0) valid, value = vs.ValidNumStr(self.parameters.glassPosition) if not valid: value = PictureParameters().glassPosition vs.CreateEditReal(self.dialog, self.kWidgetID_glassPosition, 3, value, input_field_width) vs.SetRightItem(self.dialog, self.kWidgetID_glassPositionLabel, self.kWidgetID_glassPosition, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_glassPosition, "Enter the position (depth) of the glass here.") # Glass Class # ----------------------------------------------------------------------------------------- vs.CreateStaticText(self.dialog, self.kWidgetID_glassClassLabel, "Glass Class: ", label_width) vs.SetBelowItem(self.dialog, self.kWidgetID_glassPositionLabel, self.kWidgetID_glassClassLabel, 0, 0) vs.CreateClassPullDownMenu(self.dialog, self.kWidgetID_glassClass, input_field_width) class_index = vs.GetPopUpChoiceIndex(self.dialog, self.kWidgetID_glassClass, self.parameters.matboardClass) vs.SelectChoice(self.dialog, self.kWidgetID_glassClass, class_index, True) vs.SetRightItem(self.dialog, self.kWidgetID_glassClassLabel, self.kWidgetID_glassClass, 0, 0) vs.SetHelpText(self.dialog, self.kWidgetID_glassClass, "Enter the class of the glass here.")
def CreateDialog(): # Alignment constants kRight = 1 kBottom = 2 kLeft = 3 kColumn = 4 kResize = 0 kShift = 1 # dialog resource ID kTextStrTableID = 3000 def GetStr(ndx): result = vs.GetPluginString( kTextStrTableID + ndx - 1 ) return result def GetHelpStr(ndx): result = vs.GetPluginString( kTextStrTableID + ndx + 27 ) return result dialog = vs.CreateLayout( GetStr(kTitle), True, GetStr(kOK), GetStr(kCancel) ) # create controls vs.CreateStaticText( dialog, kIDLabelText, GetStr(kIDLabelText), -1 ) vs.CreateEditInteger( dialog, kIDLabel, 1, 26 ) vs.CreateStaticText( dialog, kWidthText, GetStr(kWidthText), -1 ) vs.CreateEditReal( dialog, kWidth, 3, 2.5, 26 ) vs.CreateStaticText( dialog, kHeightText, GetStr(kHeightText), -1 ) vs.CreateEditReal( dialog, kHeight, 3, 2.0, 26 ) vs.CreateStaticText( dialog, kElevationInWallText, GetStr(kElevationInWallText), -1 ) vs.CreateEditReal( dialog, kElevationInWall, 3, 1.2, 26 ) vs.CreateCheckBox( dialog, kOpenTheWindow, GetStr(kOpenTheWindow) ) vs.CreateStaticText( dialog, kOpeningAngleText, GetStr(kOpeningAngleText), -1 ) vs.CreateEditReal( dialog, kOpeningAngle, 2, 45, 26 ) vs.CreateStaticText( dialog, kLeafText, GetStr(kLeafText), -1 ) vs.CreatePullDownMenu( dialog, kLeaf, 26 ) vs.CreateCheckBox( dialog, kHasCurtains, GetStr(kHasCurtains) ) vs.CreateStaticText( dialog, kLedgeTypeText, GetStr(kLedgeTypeText), -1 ) vs.CreatePullDownMenu( dialog, kLedgeType, 16 ) vs.CreateStaticText( dialog, kLedgeMaterialText, GetStr(kLedgeMaterialText), -1 ) vs.CreatePullDownMenu( dialog, kLedgeMaterial, 26 ) vs.CreateCheckBox( dialog, kDrawTheCurts, GetStr(kDrawTheCurts) ) vs.CreateStaticText( dialog, kCurtsColorText, GetStr(kCurtsColorText), -1 ) vs.CreateColorPopup( dialog, kCurtsColor, 16 ) vs.CreateStaticText( dialog, kPiecesText, GetStr(kPiecesText), -1 ) vs.CreateEditInteger( dialog, kPieces, 2, 16 ) vs.CreateStaticText( dialog, kOpacityText, GetStr(kOpacityText), -1 ) vs.CreateControl( dialog, kOpacitySlider, 3, '', 100) # set relations vs.SetFirstLayoutItem( dialog, kIDLabelText ) vs.SetRightItem( dialog, kIDLabelText, kIDLabel, 2, 0 ) vs.SetBelowItem( dialog, kIDLabelText, kWidthText, 0, 0 ) vs.SetRightItem( dialog, kWidthText, kWidth, 2, 0 ) vs.SetBelowItem( dialog, kWidthText, kHeightText, 0, 0 ) vs.SetRightItem( dialog, kHeightText, kHeight, 2, 0 ) vs.SetBelowItem( dialog, kHeightText, kElevationInWallText, 0, 0 ) vs.SetRightItem( dialog, kElevationInWallText, kElevationInWall, 2, 0 ) vs.SetBelowItem( dialog, kElevationInWallText, kOpenTheWindow, 0, 0 ) vs.SetBelowItem( dialog, kOpenTheWindow, kOpeningAngleText, 2, 0 ) vs.SetRightItem( dialog, kOpeningAngleText, kOpeningAngle, 2, 0 ) vs.SetBelowItem( dialog, kOpeningAngleText, kLeafText, -2, 0 ) vs.SetRightItem( dialog, kLeafText, kLeaf, 2, 0 ) vs.SetBelowItem( dialog, kLeafText, kHasCurtains, 0, 0 ) vs.SetBelowItem( dialog, kHasCurtains, kLedgeTypeText, 2, 0 ) vs.SetRightItem( dialog, kLedgeTypeText, kLedgeType, 2, 0 ) vs.SetBelowItem( dialog, kLedgeTypeText, kLedgeMaterialText, 0, 0 ) vs.SetRightItem( dialog, kLedgeMaterialText, kLedgeMaterial, 2, 0 ) vs.SetBelowItem( dialog, kLedgeMaterialText, kDrawTheCurts, -2, 0 ) vs.SetBelowItem( dialog, kDrawTheCurts, kCurtsColorText, 2, 0 ) vs.SetRightItem( dialog, kCurtsColorText, kCurtsColor, 2, 0 ) vs.SetBelowItem( dialog, kCurtsColorText, kPiecesText, 0, 0 ) vs.SetRightItem( dialog, kPiecesText, kPieces, 2, 0 ) vs.SetBelowItem( dialog, kPiecesText, kOpacityText, 0, 0 ) vs.SetBelowItem( dialog, kOpacityText, kOpacitySlider, 0, 0 ) # set alignments vs.AlignItemEdge( dialog, kIDLabel, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kWidth, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kHeight, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kElevationInWall, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kOpeningAngle, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kLeaf, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kLedgeType, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kLedgeMaterial, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kCurtsColor, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kPieces, kColumn, 5, kShift ); vs.AlignItemEdge( dialog, kOpacitySlider, kColumn, 5, kResize ); # set help strings vs.SetHelpText(dialog,kOK,GetStr(kOK)) vs.SetHelpText(dialog,kCancel,GetStr(kCancel)) cnt = 4 while ( cnt <= 28 ): vs.SetHelpText( dialog, cnt, GetHelpStr(cnt) ) cnt += 1 return dialog
def CreateDialog(): # Alignment constants kRight = 1 kBottom = 2 kLeft = 3 kColumn = 4 kResize = 0 kShift = 1 def GetPluginString(ndx): # Static Text if ndx == 1001: return 'Pick Folder' elif ndx == 1002: return 'Cancel' elif ndx == 1003: return 'Import Gobo Images' elif ndx == 1004: return 'Scale' elif ndx == 1006: return '' elif ndx == 1008: return 'Diameter (inches)' elif ndx == 1009: return '' # Help Text elif ndx == 2001: return 'Pick a folder of images to import.' elif ndx == 2002: return 'Cancels the import.' elif ndx == 2004: return 'Scale factor for the image.' elif ndx == 2006: return 'Scale factor for the image.' elif ndx == 2008: return 'Diameter of the symbol after import.' elif ndx == 2009: return 'Diameter of the symbol after import.' return '' def GetStr(ndx): result = GetPluginString( ndx + 1000 ) return result def GetHelpStr(ndx): result = GetPluginString( ndx + 2000 ) return result major = 0 minor = 0 maintenance = 0 platform = 0 major, minor, maintenance, platform = vs.GetVersion( major, minor, maintenance, platform ) if (platform == 1): # IsMac v_scale = 1.05 else: v_scale = 1.05 dialog = vs.CreateLayout( GetStr(3), True, GetStr(kOK), GetStr(kCancel) ) # create controls vs.CreateStaticText( dialog, kUnnamed, GetStr(kUnnamed), -1 ) vs.CreateEditReal( dialog, kscale1, 1, 1.05, 16 ) vs.CreateStaticText( dialog, kUnnamed3, GetStr(kUnnamed3), -1 ) vs.CreateEditReal( dialog, ksize, 1, 24, 16 ) # set relations vs.SetFirstLayoutItem( dialog, kUnnamed ) vs.SetRightItem( dialog, kUnnamed, kscale1, 0, 0 ) vs.SetBelowItem( dialog, kUnnamed, kUnnamed3, 0, 0 ) vs.SetRightItem( dialog, kUnnamed3, ksize, 0, 0 ) # set alignments vs.AlignItemEdge( dialog, kscale1, kRight, 4, kShift ); vs.AlignItemEdge( dialog, ksize, kRight, 4, kShift ); # set help strings cnt = 1 while ( cnt <= 9 ): vs.SetHelpText( dialog, cnt, GetHelpStr(cnt) ) cnt += 1 return dialog