Loading screen/gif during script execution

Hi,

In my perspective project, I created som transform scripts in charts to get a lot of data from my DB. These actions can last between 5 to 10 seconds.
Is it possible to show a loading screen or hourglass pointer to inform user that action is in progress ?

Thanks

in style you can add:
cursor: wait or cursor: progress
((on windows10:) wait is the blue circle wait gif thingy and progress is the old pointer+hourglass)

and back to normal is
cursor: auto

it only works when hovering that element tho or if you do it in the root it will work unless you hover a button/inputfield.
It does not prevent clicks. If you want that aswell you can add in pointer-events: none But be sure to turn it back to auto, else you cant click anything anymore! pointer-events: auto

1 Like

Thanks

It shows me a parse error for code below :
image

you will need to use brackets around cursor and pointer-events
like so
self.props.style['cursor']='wait'

2 Likes

Technically, just pointer-events, since that’s not a valid Python identifier directly.

1 Like

Is there a way to disable root view and show a popup message during the script execution ?
Changing cursor does not work fine for me.

What is not working about the cursor?

Showing a popup seems a bit exessive. Unless it really takes several minutes to execute your script…
But you could open a popup and close it again in a script.
if you set the popup to modal the user will only be able to interact with the popup (just dont put anything to close it on the popup so that the script is the only thing that can close it)

It depends on the quantity of data. 1 - 10 seconds.

Cursor doesn’t work at all. The script do the opposite : cusror is waiting after the execution. :man_shrugging:

did you set it to wait before it starts and back to ‘auto’ when its done ?xd

I put it at the beginning and the end of the script yes.

It’s a script transform in chart series

if its not turning back to normal you are probably doing something wrong xd could you show me the script?

My script transform on TimesSeriesChart.series property.
The component is on the root.

import system
	
self.parent.props.style.cursor="wait"
self.parent.props.style['pointer-events']="none"
	
try:
	start_datetime=system.date.fromMillis(int(self.view.params.start_datetime))
except:
	start_datetime=self.view.params.start_datetime
				
try:
	end_datetime=system.date.fromMillis(int(self.view.params.end_datetime))
except:
	end_datetime=self.view.params.end_datetime
		
inputs={
	'project_id':self.view.params.project_id,
	'device_id':self.view.params.device_id,
	'name':self.view.params.name,
	'start_datetime':start_datetime,
	'end_datetime':end_datetime,
	'overview':bool(value)
	}
	
	
result=campaign.generateChart(inputs)
	
if result['state']:
	series=result['outputs']
	if len(series) == 0 :
		self.props.title.visible=True
		self.meta.visible=False
	else:
		self.props.title.visible=False
		self.meta.visible=True
		
	self.parent.props.style.cursor="auto"
	self.parent.props.style['pointer-events']="auto"	
	return series
else:
	self.props.title.visible=False
	self.meta.visible=False
	self.parent.props.style.cursor="auto"
	self.parent.props.style['pointer-events']="auto"
	return []