[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2647] contrib/py/scripts/addons/ io_import_pdb_atomic_blender.py:

Clemens Barth barth at root-1.de
Wed Nov 23 01:32:16 CET 2011


Revision: 2647
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2647
Author:   blendphys
Date:     2011-11-23 00:32:15 +0000 (Wed, 23 Nov 2011)
Log Message:
-----------


Some code cosmetics (http://www.python.org/dev/peps/pep-0008/)

Modified Paths:
--------------
    contrib/py/scripts/addons/io_import_pdb_atomic_blender.py

Modified: contrib/py/scripts/addons/io_import_pdb_atomic_blender.py
===================================================================
--- contrib/py/scripts/addons/io_import_pdb_atomic_blender.py	2011-11-22 23:02:56 UTC (rev 2646)
+++ contrib/py/scripts/addons/io_import_pdb_atomic_blender.py	2011-11-23 00:32:15 UTC (rev 2647)
@@ -71,14 +71,15 @@
 Atomic_Blender_string     = "Atomic Blender 2.0\n==================="
 Atomic_Blender_panel_name = "PDB - Atomic Blender"
 
-# This is a list that contains some data of all possible atoms. The structure is as follows:
+# This is a list that contains some data of all possible atoms. The structure 
+# is as follows:
 #
 # 1, "Hydrogen", "H", [0.0,0.0,1.0], 0.32, 0.32, 0.32 , -1 , 1.54   means
 #
-# Number, name of atom, short name, color, radius (used for Blender), radius (covalent), radius (atomic), ... 
-#
-# ... then the charge state: charge state, radius (ionic), charge state, radius (ionic), ... all charge states 
-# for any atom are listed, if existing.
+# No., name, short name, color, radius (used), radius (covalent), radius (atomic),
+# 
+# charge state 1, radius (ionic) 1, charge state 2, radius (ionic) 2, ... all 
+# charge states for any atom are listed, if existing.
 
 Data_all_atoms = (
 ( 1,      "Hydrogen",        "H", (  0.0,   0.0,   1.0), 0.32, 0.32, 0.32 , -1 , 1.54 ),
@@ -310,29 +311,75 @@
 
 
 class CLASS_Input_Output(bpy.types.PropertyGroup):
-    bpy.types.Scene.atom_pdb_PDB_filename        = StringProperty(name = "File name", default="", description = "PDB file name")
-    bpy.types.Scene.atom_pdb_PDB_file            = StringProperty(name = "Path to file", default="", description = "Path of the PDB file")
-    bpy.types.Scene.use_atom_pdb_dupliverts      = BoolProperty  (name = "Use dupliverts (much faster)", default=True, description = "Use the dublication method via vertice referencing (Much faster loading!)")    
-    bpy.types.Scene.use_atom_pdb_mesh            = BoolProperty  (name = "Mesh balls", default=False, description = "Do you want to use mesh balls instead of NURBS?")    
-    bpy.types.Scene.atom_pdb_mesh_azimuth        = IntProperty   (name = "Azimuth", default=32, min=0, description = "Number of sectors (azimuth)")
-    bpy.types.Scene.atom_pdb_mesh_zenith         = IntProperty   (name = "Zenith", default=32, min=0, description = "Number of sectors (zenith)")
-    bpy.types.Scene.atom_pdb_scale_ballradius    = FloatProperty (name = "Balls", default=1.0, min=0.0, description = "Scale factor for all atom radii")
-    bpy.types.Scene.atom_pdb_scale_distances     = FloatProperty (name = "Distances", default=1.0, min=0.0, description = "Scale factor for all distances")
-    bpy.types.Scene.use_atom_pdb_center          = BoolProperty  (name = "Object to origin", default=True, description = "Shall the object first put into the global origin before applying the offsets on the left?")    
-    bpy.types.Scene.atom_pdb_offset_x            = FloatProperty (name = "X", default=0.0, description = "Offset in X")
-    bpy.types.Scene.atom_pdb_offset_y            = FloatProperty (name = "Y", default=0.0, description = "Offset in Y")
-    bpy.types.Scene.atom_pdb_offset_z            = FloatProperty (name = "Z", default=0.0, description = "Offset in Z")
-    bpy.types.Scene.use_atom_pdb_sticks          = BoolProperty  (name = "Use sticks", default=False, description = "Do you want to display also the sticks?")    
-    bpy.types.Scene.atom_pdb_sticks_sectors      = IntProperty   (name = "Sector", default = 20, min=0,   description = "Number of sectors of a stick")        
-    bpy.types.Scene.atom_pdb_sticks_radius       = FloatProperty (name = "Radius", default =  0.1, min=0.0, description = "Radius of a stick")  
-    bpy.types.Scene.use_atom_pdb_cam             = BoolProperty  (name = "Camera", default=False, description = "Do you need a camera?")   
-    bpy.types.Scene.use_atom_pdb_lamp            = BoolProperty  (name = "Lamp", default=False, description = "Do you need a lamp?")
-    bpy.types.Scene.atom_pdb_number_atoms        = StringProperty(name = "", default="Number", description = "This output shows the number of atoms which have been loaded")
-    bpy.types.Scene.atom_pdb_distance            = StringProperty(name = "", default="Distance (Angstrom)", description = "Distance of 2 objects in Angstrom")  
-    bpy.types.Scene.atom_pdb_mod_atomname        = StringProperty(name = "", default = "Atom name", description="Put in the name of the atom (e.g. Hydrogen)")
-    bpy.types.Scene.atom_pdb_mod_pm_radius       = FloatProperty (name = "", default = 100.0, min=0.0, description="Put in the radius of the atom (in pm)")
-    bpy.types.Scene.atom_pdb_mod_rel_radius      = FloatProperty (name = "", default = 1.05, min=1.0, description="Put in the scale factor")
-    bpy.types.Scene.atom_pdb_mod_all_radii       = FloatProperty (name = "Scale", default = 1.05, min=1.0, description="Put in the scale factor")
+    scn = bpy.types.Scene
+    scn.atom_pdb_PDB_filename = StringProperty(
+        name = "File name", default="", 
+        description = "PDB file name")
+    scn.atom_pdb_PDB_file = StringProperty(
+        name = "Path to file", default="", 
+        description = "Path of the PDB file")
+    scn.use_atom_pdb_dupliverts = BoolProperty(
+        name = "Use dupliverts (much faster)", default=True, 
+        description = "Use the dublication method via vertice referencing "
+        "(Much faster loading!)")    
+    scn.use_atom_pdb_mesh = BoolProperty(
+        name = "Mesh balls", default=False, 
+        description = "Do you want to use mesh balls instead of NURBS?")    
+    scn.atom_pdb_mesh_azimuth = IntProperty(
+        name = "Azimuth", default=32, min=0, 
+        description = "Number of sectors (azimuth)")
+    scn.atom_pdb_mesh_zenith = IntProperty(
+        name = "Zenith", default=32, min=0, 
+        description = "Number of sectors (zenith)")
+    scn.atom_pdb_scale_ballradius = FloatProperty(
+        name = "Balls", default=1.0, min=0.0, 
+        description = "Scale factor for all atom radii")
+    scn.atom_pdb_scale_distances = FloatProperty (
+        name = "Distances", default=1.0, min=0.0, 
+        description = "Scale factor for all distances")
+    scn.use_atom_pdb_center = BoolProperty(
+        name = "Object to origin", default=True, 
+        description = "Shall the object first put into the global origin "
+        "before applying the offsets on the left?")    
+    scn.atom_pdb_offset_x = FloatProperty(
+        name="X", default=0.0, description="Offset in X")
+    scn.atom_pdb_offset_y = FloatProperty(
+        name="Y", default=0.0, description="Offset in Y")
+    scn.atom_pdb_offset_z = FloatProperty(
+        name="Z", default=0.0, description="Offset in Z")
+    scn.use_atom_pdb_sticks = BoolProperty(
+        name="Use sticks", default=False, 
+        description="Do you want to display also the sticks?")    
+    scn.atom_pdb_sticks_sectors = IntProperty(
+        name = "Sector", default=20, min=0,
+        description="Number of sectors of a stick")        
+    scn.atom_pdb_sticks_radius = FloatProperty(
+        name = "Radius", default=0.1, min=0.0, 
+        description ="Radius of a stick")  
+    scn.use_atom_pdb_cam = BoolProperty(
+        name="Camera", default=False, 
+        description="Do you need a camera?")   
+    scn.use_atom_pdb_lamp = BoolProperty(
+        name="Lamp", default=False, 
+        description = "Do you need a lamp?")
+    scn.atom_pdb_number_atoms = StringProperty(name="", 
+        default="Number", description = "This output shows "
+        "the number of atoms which have been loaded")
+    scn.atom_pdb_distance = StringProperty(
+        name="", default="Distance (Angstrom)", 
+        description="Distance of 2 objects in Angstrom")  
+    scn.atom_pdb_mod_atomname = StringProperty(
+        name="", default="Atom name", 
+        description="Put in the name of the atom (e.g. Hydrogen)")
+    scn.atom_pdb_mod_pm_radius = FloatProperty(
+        name="", default=100.0, min=0.0, 
+        description="Put in the radius of the atom (in pm)")
+    scn.atom_pdb_mod_rel_radius = FloatProperty(
+        name="", default=1.05, min=1.0, 
+        description="Put in the scale factor")
+    scn.atom_pdb_mod_all_radii = FloatProperty(
+        name="Scale", default = 1.05, min=1.0, 
+        description="Put in the scale factor")
 
 
 # Button for measuring the distance of the active objects
@@ -366,7 +413,8 @@
 
     def execute(self, context):
         scn = bpy.context.scene
-        Modify_atom_radii_type_pm(scn.atom_pdb_mod_atomname, scn.atom_pdb_mod_pm_radius)
+        Modify_atom_radii_type_pm(scn.atom_pdb_mod_atomname, 
+                                  scn.atom_pdb_mod_pm_radius)
         return {'FINISHED'}
 
 
@@ -378,7 +426,8 @@
 
     def execute(self, context):
         scn = bpy.context.scene
-        Modify_atom_radii_type_scale(scn.atom_pdb_mod_atomname, scn.atom_pdb_mod_rel_radius)
+        Modify_atom_radii_type_scale(scn.atom_pdb_mod_atomname, 
+                                     scn.atom_pdb_mod_rel_radius)
         return {'FINISHED'}
 
 
@@ -390,7 +439,8 @@
 
     def execute(self, context):
         scn = bpy.context.scene
-        Modify_atom_radii_type_scale(scn.atom_pdb_mod_atomname, 1.0/scn.atom_pdb_mod_rel_radius)
+        Modify_atom_radii_type_scale(scn.atom_pdb_mod_atomname, 
+                                     1.0/scn.atom_pdb_mod_rel_radius)
         return {'FINISHED'}
 
 
@@ -432,7 +482,9 @@
         bradius    = scn.atom_pdb_scale_ballradius
         bdistance  = scn.atom_pdb_scale_distances
         center     = scn.use_atom_pdb_center 
-        offset_vec = Vector((scn.atom_pdb_offset_x,scn.atom_pdb_offset_y,scn.atom_pdb_offset_z))
+        offset_vec = Vector((scn.atom_pdb_offset_x,
+                             scn.atom_pdb_offset_y,
+                             scn.atom_pdb_offset_z))
         sticks     = scn.use_atom_pdb_sticks 
         ssector    = scn.atom_pdb_sticks_sectors
         sradius    = scn.atom_pdb_sticks_radius
@@ -441,7 +493,9 @@
         mesh       = scn.use_atom_pdb_mesh 
         dupliverts = scn.use_atom_pdb_dupliverts
               
-        atom_number               = Draw_scene(dupliverts,mesh,azimuth,zenith,bradius,bdistance,offset_vec,sticks,ssector,sradius,center,cam,lamp)

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list