Force Redraw


I've got a few functions in a python plugin that have fairly long runtimes. I'm hoping to display feedback to the user on the progress of these functions similar to the way RV displays source loading information.

I'm trying something like this, at key points in the code:

rv.extra_commands.displayFeedback("update", 5.0)

But the RV view doesn't get redrawn until my entire function finishes executing. Is there a way to maybe force the main view to be redrawn?




2 条评论

  • 0
    Ray K

    I got a response from Jon:


    Hi Ray,

    The trick here is that redraw only schedules an update to happen. It does not actually force one. What you want to do to get the progress bar effect is to only do a little bit of your work each time the render event is called and then keep track of where you are in your mode execution so you can do a little more the next time your render method is called. You will still want to call redraw because you want to make sure a new render comes around soon to do more of your remaining work.

    I have included a sample package that coarsely demonstrates what I suggest going for. Please have a look and tell me if that helps.


  • 0
    nik yotis

    it works, apart from the fact that there should be a terminating condition -even when the render is finished it keeps on updating the loop "Completed %", but there is no renderign going on