Difference between revisions of "Python/ViewingIntermediateResults"
From Apache OpenOffice Wiki
< Python
Marcoagpinto (talk | contribs) |
m |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:Viewing intermediate results}} | {{DISPLAYTITLE:Viewing intermediate results}} | ||
− | This script was published by kilorun at the [ | + | This script was published by kilorun at the [https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=63067 OpenOffice Basic, Python, BeanShell, JavaScript Forum]. |
This script is used to update in real time, the insertion into Calc when getting data from external sources like a website, without having to wait until the macro had finished before seeing the results. | This script is used to update in real time, the insertion into Calc when getting data from external sources like a website, without having to wait until the macro had finished before seeing the results. | ||
− | The forum doesn't mention this scrapping issue, it only | + | The forum doesn't mention this scrapping issue, it only focuses on eliminating the "threshold of the process by updating the status indicator". |
== Original code == | == Original code == | ||
− | < | + | <syntaxhighlight lang="Python"> |
import time | import time | ||
Line 31: | Line 31: | ||
time.sleep(1) | time.sleep(1) | ||
− | oStatusIndicator.setText( "Process finished" )</ | + | oStatusIndicator.setText( "Process finished" ) |
+ | </syntaxhighlight> | ||
Latest revision as of 14:08, 15 May 2021
This script was published by kilorun at the OpenOffice Basic, Python, BeanShell, JavaScript Forum.
This script is used to update in real time, the insertion into Calc when getting data from external sources like a website, without having to wait until the macro had finished before seeing the results.
The forum doesn't mention this scrapping issue, it only focuses on eliminating the "threshold of the process by updating the status indicator".
Original code
import time
def myTest3():
oDoc = XSCRIPTCONTEXT.getDocument()
oSheets = oDoc.getSheets()
mySheet = oSheets.getByName("Sheet1")
# set up Status Indicator
Controller = oDoc.getCurrentController()
DocFrame = Controller.getFrame()
oStatusIndicator = DocFrame.createStatusIndicator()
oStatusIndicator.start( "", 1 )
mySheet.getColumns().removeByIndex(0, 1)
oStatusIndicator.setText( "Process started" )
for i in range(0,5):
oStatusIndicator.setText( "Processing: " + str(i) )
mySheet.getCellByPosition(0,i).Value = i
time.sleep(1)
oStatusIndicator.setText( "Process finished" )