Move control of whether elements are disabled into the python code.