I've been following this thread in attempts to configure my ui preferences programmatically. I've had no issues with loading styles (which subsequently sets the custom ui if I saved it this way), but I am unable to setEditForm solely. The following things do not work (result is that the properties stay on Autogenerate default option) both in the python console and in my plugin. I've tried with both QGIS 2.0 and 2.4.
layer.setEditForm('C:/my/full/pathname/with spaces/form.ui')
layer.setEditForm('C:/my/full/pathname/withoutspaces/form.ui')
layer.setEditForm("C:/same/as/above")
layer.setEditForm("C:\same\as\above")
layer.setEditForm('C:\same\as\above')