python desktop module extracted from core with some fixes