Progress dialog pops up after hiding it when messageBox is displayed

Progress dialog pops up after hiding it when messageBox is displayed

m0d0
Contributor Contributor
414 Views
0 Replies
Message 1 of 1

Progress dialog pops up after hiding it when messageBox is displayed

m0d0
Contributor
Contributor

Hi,

 

i am probably misunderstanding the behavior of the delay argument in ProgressDialog.show() method.

import adsk.core, adsk.fusion, adsk.cam, traceback
from time import sleep

def run(context):
    ui = None

    ITERATIONS = 10
    TIME_PER_ITERATION = 0.05
    DELAY = 1
    
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        progressDialog = ui.createProgressDialog()
        progressDialog.show('title','percentage %p\nvalue: %v\nmaximum: %m',0,ITERATIONS,DELAY)

        for i in range(ITERATIONS):
            if progressDialog.wasCancelled:
                    break
            progressDialog.progressValue = i+1
            sleep(TIME_PER_ITERATION)
        
        progressDialog.hide() 

        ui.messageBox('End')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

 As far as i understood the description, the progress dialog shouldn't appear at all if TIME_PER_ITERATION  * ITERATIONS < DELAY. The progress dialog doesn't appear if you are not displaying a message box after the progress. But if you are using the message box the progress dialog pops up at the moment the message box is displayed. Is this the exspected behavior? Is there a way to  'permanently' hide the progress dialog?

 

I am thankful for any ideas!

 

0 Likes
415 Views
0 Replies
Replies (0)