Jump to content
Developer Wiki and Function Reference Links ×

Alert Information with string input


Rob87

Recommended Posts

Hi folks,

 

searched for this, but couldn't find anything related. But wonder why nobody else needs this.

 

Need:

An Alert Information with a string input. The input comes from another node and differs...

Need this to inform the user about what is done. F.e. "5 objects modified". 5 will differ and is one part of the string.

 

Thank you!

 

-Rob

Link to comment

Hello,

 

i changed the existing "Alert Inform Dialog", maybe it fits your needs now.

To create the node simply replace the whole code of any Marionette node with the code below.

 


@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
	#Name
	this = Marionette.Node( 'Alert Inform Dialog' )
	this.SetDescription( 'Displays an alert dialog which provides the '
						+ 'user an information about the result of a '
						+ 'command. It offers no user choices.' )

	#Input Ports
	input = Marionette.PortIn( None , 'item')
	input.SetDescription( "input" )
	
	alertTxt = Marionette.PortIn( "" , 'str_alert')
	alertTxt.SetDescription( "input" )
	
	advTxt = Marionette.PortIn( "" , 'str_advice')
	advTxt.SetDescription( "input" )
	

	#OIP Controls
	minorAlrt = Marionette.OIPControl( 'Minor Alert', Marionette.WidgetType.Bool, False)
	minorAlrt.SetDescription( 'The severity of the alert: minor(true) or major(false)' )


	#Output Ports
	output = Marionette.PortOut('item')   
	output.SetDescription( "output" )


#BEHAVIOR
	# this.SetListAbsorb()


def RunNode(self):
	#inputs
	input = self.Params.input.value
	alertTxt = self.Params.alertTxt.value
	advTxt = self.Params.advTxt.value
	minorAlrt = self.Params.minorAlrt.value


	#script
	if input is not None:
		vs.AlertInform(alertTxt, advTxt, minorAlrt);


	#outputs
	self.Params.output.value = input

 

To create the string you can just add strings together with the "Str" Node if you put in a list of things (in your case an integer and a string).

 

Regards,

Letti

  • Like 2
Link to comment
On 3/1/2023 at 6:40 PM, Letti R said:

Hello,

 

i changed the existing "Alert Inform Dialog", maybe it fits your needs now.

To create the node simply replace the whole code of any Marionette node with the code below.

 


@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
	#Name
	this = Marionette.Node( 'Alert Inform Dialog' )
	this.SetDescription( 'Displays an alert dialog which provides the '
						+ 'user an information about the result of a '
						+ 'command. It offers no user choices.' )

	#Input Ports
	input = Marionette.PortIn( None , 'item')
	input.SetDescription( "input" )
	
	alertTxt = Marionette.PortIn( "" , 'str_alert')
	alertTxt.SetDescription( "input" )
	
	advTxt = Marionette.PortIn( "" , 'str_advice')
	advTxt.SetDescription( "input" )
	

	#OIP Controls
	minorAlrt = Marionette.OIPControl( 'Minor Alert', Marionette.WidgetType.Bool, False)
	minorAlrt.SetDescription( 'The severity of the alert: minor(true) or major(false)' )


	#Output Ports
	output = Marionette.PortOut('item')   
	output.SetDescription( "output" )


#BEHAVIOR
	# this.SetListAbsorb()


def RunNode(self):
	#inputs
	input = self.Params.input.value
	alertTxt = self.Params.alertTxt.value
	advTxt = self.Params.advTxt.value
	minorAlrt = self.Params.minorAlrt.value


	#script
	if input is not None:
		vs.AlertInform(alertTxt, advTxt, minorAlrt);


	#outputs
	self.Params.output.value = input

 

To create the string you can just add strings together with the "Str" Node if you put in a list of things (in your case an integer and a string).

 

Regards,

Letti

Thank you Letti! 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...