/********************************************************************** This script is provided as part of the Daz Script Documentation. The contents of this script, and\or any portion thereof, may only be used in accordance with the following license: Creative Commons Attribution 3.0 Unported (CC BY 3.0) - http://creativecommons.org/licenses/by/3.0 To contact Daz 3D or for more information about Daz Script visit the Daz 3D website: - http://www.daz3d.com **********************************************************************/ // Source: /public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/general_ui/simple_image_dialog/start // Define an anonymous function; // serves as our main loop, // limits the scope of variables (function( sFileName ){ /*********************************************************************/ // String : A function for retrieving a translation if one exists function text( sText ) { // If the version of the application supports qsTr() if( typeof( qsTr ) != "undefined" ){ // Return the translated (if any) text return qsTr( sText ); } // Return the original text return sText; }; /*********************************************************************/ // Define the template for What's This text var sWhatsThis = "%1

%2"; // Create a basic dialog var wDlg = new DzBasicDialog(); // Get the wrapped widget for the dialog var oDlgWgt = wDlg.getWidget(); // Set the title of the dialog wDlg.caption = "My Image"; // Strip the space for a settings key var sKey = wDlg.caption.replace( / /g, "" ) + "Dlg"; // Set an [unique] object name on the wrapped dialog widget; // this is used for recording position and size separately // from all other [uniquely named] DzBasicDialog instances oDlgWgt.objectName = sKey; // Create a pixmap for the image var pixImage = new Pixmap( sFileName ); // Create a label and assign a pixmap var wLabel = new DzLabel( wDlg ); wLabel.pixmap = pixImage; wLabel.toolTip = sFileName; wLabel.whatsThis = sWhatsThis.arg( text( "Image Path" ) ).arg( wLabel.toolTip ); // Add the label to the dialog wDlg.addWidget( wLabel, 0, DzWidget.AlignCenter ); // Get the minimum size of the dialog var sizeHint = oDlgWgt.minimumSizeHint; // Set the fixed size of the dialog wDlg.setFixedSize( sizeHint.width, sizeHint.height ); // Set the text on the accept button wDlg.setAcceptButtonText( text( "&Close" ) ); // Hide the cancel button wDlg.showCancelButton( false ); // Display the dialog wDlg.exec(); // Finalize the function and invoke })( String("%1/images/local-user-product.png").arg( App.getResourcesPath()) );