Made code python3 compatible

support also kept for python2.7.
cmleditor still depends on pygtk2 that is python2 only.