This does two things :
replace the push button "reset range" to a checkbox with two states. The checkbox controls the variable "original_range". It allows the user to disable the automatic range scale (without the special trick of changing range values to stop the automatic range scale).
restore the saved setting "original_range" which is plugged into the new checkbox.
disable the min/max QLineEdit when the mode is automatic, because these widgets can lose focus when they're being edited and their values change at the same time