glassman3d Posted October 3, 2013 Share Posted October 3, 2013 Hi there I am trying to create a generic progress bar so have been looking at hou.InteruptableOperation My conundrum is that due to in-house generic pipeline tools that implement this for all packages (including maya and softimage), I need to separate out the progress bar into 3 stages: Creation Update Exit The docs state not to call this class unless I am within a ‘with’ statement. This makes the separation of these stages very difficult I am attempting to call the __enter__ and __exit__ methods directly but am not having much luck Could someone give me a pointer about how to achieve this? Many thanks! Quote Link to comment Share on other sites More sharing options...
glassman3d Posted October 10, 2013 Author Share Posted October 10, 2013 answer from SESI: Hello Sam, It sounds like you should set the long operation name/message in hou.InterruptableOperation in order to update the progress bar dialog with message updates. For example: # Create an interruptable operation. operation = hou.InterruptableOperation("Doing Work", long_operation_name="Starting Tasks", open_interrupt_dialog=True) # Start the operation. This will pop-up the progress bar dialog after a second or two. operation.__enter__() # Execute tasks. Periodically update the progress percentage and message in the progress bar. num_tasks = 10 for i in range(num_tasks): # Do task work here. For this example, just sleep for a second. time.sleep(1) percent = float(i) / float(num_tasks) operation.updateLongProgress(percent, "Finished task %i" % (i + 1)) # Stop the operation. This closes the progress bar dialog. operation.__exit__(None, None, None) I hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.