Skip to content

Commit

Permalink
Python3 support
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Lecher <jlec@gentoo.org>
  • Loading branch information
jlec committed Dec 7, 2015
1 parent 16fdff6 commit dc23f72
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions perp_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA
# Street, Fifth Floor, Boston, MA 02110-1301, USA
#
#
#
#
# To use: Load your scene. Orient the scene as you wish. Run the script.
# Could it be any simpler?!
#
# The TTT Matrix has to be the identity, do achieve this result. So,
# run the following:
# -- 'reset'
Expand All @@ -42,6 +42,8 @@
#
'''

from __future__ import print_function

import pymol
import random
from pymol.cgo import *
Expand Down Expand Up @@ -101,8 +103,8 @@ def getPPlane(viewVector, center, side_length=100):
viewVector[2]) + center[2]

else:
print "Z-component of viewVector is zero. Now, I need a nonzero value here \
so I'm just making one up. :)"
print("Z-component of viewVector is zero. Now, I need a nonzero value here \
so I'm just making one up. :)")
z = random.randint(-200, 200)

rVal[i] = [x, y, z]
Expand Down Expand Up @@ -131,8 +133,8 @@ def perp_maker(name='pPlane', quiet=1):

# Sanity check
if not quiet:
print "Camera is: " + str(camera)
print "Center is: " + str(center)
print("Camera is: " + str(camera))
print("Center is: " + str(center))

# Create the vector through the two points directed
# from the camera to the center - the viewVector
Expand All @@ -141,13 +143,13 @@ def perp_maker(name='pPlane', quiet=1):
center[2] - camera[2]]

if not quiet:
print "ViewVector is: " + str(viewVector)
print("ViewVector is: " + str(viewVector))

# Create the plane perpendicular to the viewVector
# running through the origin
pPlane = getPPlane(viewVector, center, side_length=100)
if not quiet:
print "Plane points calculated as: " + str(pPlane)
print("Plane points calculated as: " + str(pPlane))

# now create the CGO and load from the points
obj = [
Expand All @@ -169,7 +171,7 @@ def perp_maker(name='pPlane', quiet=1):
cmd.set_view(view)

if __name__ in ['pymol', '__main__']:
print '__name__ =', __name__
print('__name__ =', __name__)
perp_maker(quiet=0)

cmd.extend('perp_maker', perp_maker)
Expand Down

0 comments on commit dc23f72

Please sign in to comment.