red-brick: Add a lock to the script manager upload function

Otherwise it might happen that a second execute_script call tries to
upload the script while the first execute_script call is in the process
of uploading it. If the first call then tries to execute the script
while the seconds has it open for writing then exec() will fail with
E_CANNOT_EXEC because a file open for writing cannot be executed.

Now script upload is protected by a lock, so two calls that would have
uploaded the script at the same time will now be serialized. Which fixes
the problem.
red-brick/pi: Update logs and files list on first show

Also add progress bar to program info widget.
red-brick: Don't create REDObjects on the callback thread

This might deadlock due to the synchrounuous operation of
create_object_in_qt_main_thread.
red-brick: Decouple some refresh calls with a QTimer single shot
red-brick: Move program button update logic to update_ui_state function
red-brick: Don't refresh all program logs and files at once

Only update on first show of each program info widget.