[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2710] trunk/py/scripts/addons/ io_mesh_pdb: general cleanup, also added some TODO comments

Campbell Barton ideasman42 at gmail.com
Fri Dec 2 00:22:16 CET 2011


Revision: 2710
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2710
Author:   campbellbarton
Date:     2011-12-01 23:22:11 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
general cleanup, also added some TODO comments

Modified Paths:
--------------
    trunk/py/scripts/addons/io_mesh_pdb/__init__.py
    trunk/py/scripts/addons/io_mesh_pdb/import_pdb.py

Modified: trunk/py/scripts/addons/io_mesh_pdb/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_pdb/__init__.py	2011-12-01 22:34:41 UTC (rev 2709)
+++ trunk/py/scripts/addons/io_mesh_pdb/__init__.py	2011-12-01 23:22:11 UTC (rev 2710)
@@ -33,6 +33,7 @@
 
 
 import bpy
+from bpy.types import Operator, Panel
 from bpy_extras.io_utils import ImportHelper
 from bpy.props import (StringProperty,
                        BoolProperty,
@@ -49,7 +50,7 @@
 
 # The panel, which is loaded after the file has been
 # chosen via the menu 'File -> Import'
-class CLASS_atom_pdb_panel(bpy.types.Panel):
+class CLASS_atom_pdb_panel(Panel):
     bl_label       = "PDB - Atomic Blender"
     #bl_space_type  = "PROPERTIES"
     #bl_region_type = "WINDOW"
@@ -62,18 +63,18 @@
     # I explain it in the following from my point of view:
     #
     # Before this class is entirely treaten (here: drawing the panel) the
-    # poll method is called first. Basically, some conditions are 
-    # checked before other things in the class are done afterwards. If a 
-    # condition is not valid, one returns 'False' such that nothing further 
+    # poll method is called first. Basically, some conditions are
+    # checked before other things in the class are done afterwards. If a
+    # condition is not valid, one returns 'False' such that nothing further
     # is done. 'True' means: 'Go on'
     #
     # In the case here, it is verified if the ATOM_PDB_FILEPATH variable contains
     # a name. If not - and this is the case directly after having started the
     # script - the panel does not appear because 'False' is returned. However,
-    # as soon as a file has been chosen, the panel appears because 
+    # as soon as a file has been chosen, the panel appears because
     # ATOM_PDB_FILEPATH contains a name.
     #
-    # Please, correct me if I'm wrong. 
+    # Please, correct me if I'm wrong.
     @classmethod
     def poll(self, context):
         if import_pdb.ATOM_PDB_FILEPATH == "":
@@ -96,288 +97,285 @@
         col.prop(scn, "atom_pdb_PDB_file")
 
         layout.separator()
-        
-        row = layout.row()  
-        col = row.column(align=True) 
+
+        row = layout.row()
+        col = row.column(align=True)
         col.prop(scn, "use_atom_pdb_mesh")
         col.prop(scn, "atom_pdb_mesh_azimuth")
-        col.prop(scn, "atom_pdb_mesh_zenith")    
-        
-     
-        col = row.column(align=True)    
+        col.prop(scn, "atom_pdb_mesh_zenith")
+
+
+        col = row.column(align=True)
         col.label(text="Scaling factors")
         col.prop(scn, "atom_pdb_scale_ballradius")
         col.prop(scn, "atom_pdb_scale_distances")
-        row = layout.row() 
+        row = layout.row()
         col = row.column()
         col.prop(scn, "use_atom_pdb_sticks")
         col = row.column(align=True)
         col.prop(scn, "atom_pdb_sticks_sectors")
         col.prop(scn, "atom_pdb_sticks_radius")
 
-        row = layout.row()           
-        row.prop(scn, "use_atom_pdb_center")        
-          
-        row = layout.row()        
+        row = layout.row()
+        row.prop(scn, "use_atom_pdb_center")
+
+        row = layout.row()
         col = row.column()
         col.prop(scn, "use_atom_pdb_cam")
-        col.prop(scn, "use_atom_pdb_lamp")          
-        col = row.column() 
+        col.prop(scn, "use_atom_pdb_lamp")
+        col = row.column()
         col.operator("atom_pdb.button_reload")
 
         # TODO, use lanel() instead
         col.prop(scn, "atom_pdb_number_atoms")
 
         layout.separator()
-              
-        row = layout.row()             
+
+        row = layout.row()
         row.operator("atom_pdb.button_distance")
-        row.prop(scn, "atom_pdb_distance") 
+        row.prop(scn, "atom_pdb_distance")
         layout.separator()
-             
+
         row = layout.row()
         row.label(text="All changes concern:")
         row = layout.row()
-        row.prop(scn, "atom_pdb_radius_how")       
-             
-        row = layout.row()                   
-        row.label(text="1. Change type of radii")            
+        row.prop(scn, "atom_pdb_radius_how")
+
         row = layout.row()
-        row.prop(scn, "atom_pdb_radius_type")      
-            
-        row = layout.row()                   
-        row.label(text="2. Change atom radii in pm")                       
-        row = layout.row() 
-        row.prop(scn, "atom_pdb_radius_pm_name") 
-        row = layout.row() 
+        row.label(text="1. Change type of radii")
+        row = layout.row()
+        row.prop(scn, "atom_pdb_radius_type")
+
+        row = layout.row()
+        row.label(text="2. Change atom radii in pm")
+        row = layout.row()
+        row.prop(scn, "atom_pdb_radius_pm_name")
+        row = layout.row()
         row.prop(scn, "atom_pdb_radius_pm")
-                                                        
-        row = layout.row()            
-        row.label(text="3. Change atom radii by scale")              
+
         row = layout.row()
-        col = row.column() 
+        row.label(text="3. Change atom radii by scale")
+        row = layout.row()
+        col = row.column()
         col.prop(scn, "atom_pdb_radius_all")
-        col = row.column(align=True) 
+        col = row.column(align=True)
         col.operator( "atom_pdb.radius_all_bigger" )
         col.operator( "atom_pdb.radius_all_smaller" )
-         
+
         if bpy.context.mode == 'EDIT_MESH':
-        
+
             layout.separator()
             row = layout.row()
             row.operator( "atom_pdb.separate_atom" )
 
 
 class CLASS_atom_pdb_IO(bpy.types.PropertyGroup):
-    
+
     def Callback_radius_type(self, context):
         scnn = bpy.context.scene
         import_pdb.DEF_atom_pdb_radius_type(
                 scnn.atom_pdb_radius_type,
                 scnn.atom_pdb_radius_how,
                 )
-        
+
     def Callback_radius_pm(self, context):
         scnn = bpy.context.scene
         import_pdb.DEF_atom_pdb_radius_pm(
-                scnn.atom_pdb_radius_pm_name, 
+                scnn.atom_pdb_radius_pm_name,
                 scnn.atom_pdb_radius_pm,
                 scnn.atom_pdb_radius_how,
                 )
-           
+
     # In the file dialog window
     scn = bpy.types.Scene
     scn.use_atom_pdb_cam = BoolProperty(
-        name="Camera", default=False, 
-        description="Do you need a camera?")   
+        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?")      
+        name="Lamp", default=False,
+        description = "Do you need a lamp?")
     scn.use_atom_pdb_mesh = BoolProperty(
-        name = "Mesh balls", default=False, 
-        description = "Do you want to use mesh balls instead of NURBS?")    
+        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, 
+        name = "Azimuth", default=32, min=0,
         description = "Number of sectors (azimuth)")
     scn.atom_pdb_mesh_zenith = IntProperty(
-        name = "Zenith", default=32, min=0, 
+        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, 
+        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, 
+        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, 
+        name = "Object to origin", default=True,
         description = "Shall the object first put into the global origin "
-        "before applying the offsets on the left?")    
+        "before applying the offsets on the left?")
     scn.use_atom_pdb_sticks = BoolProperty(
-        name="Use sticks", default=False, 
-        description="Do you want to display also the sticks?")    
+        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")        
+        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")  
+        name = "Radius", default=0.1, min=0.0,
+        description ="Radius of a stick")
     scn.atom_pdb_atomradius = EnumProperty(
         name="Type of radius",
         description="Choose type of atom radius",
         items=(('0', "Pre-defined", "Use pre-defined radius"),
                ('1', "Atomic", "Use atomic radius"),
                ('2', "van der Waals", "Use van der Waals radius")),
-               default='0',)        
+               default='0',)
 
     # In the panel
     scn.atom_pdb_datafile = StringProperty(
-        name = "", description="Path to your custom data file", 
+        name = "", description="Path to your custom data file",
         maxlen = 256, default = "", subtype='FILE_PATH')
     scn.atom_pdb_PDB_file = StringProperty(
-        name = "Path to file", default="", 
-        description = "Path of the PDB file")               
+        name = "Path to file", default="",
+        description = "Path of the PDB file")
     # TODO, remove this property, its used for display only!
-    scn.atom_pdb_number_atoms = StringProperty(name="", 
+    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 (A)", 
-        description="Distance of 2 objects in Angstrom")  
+        name="", default="Distance (A)",
+        description="Distance of 2 objects in Angstrom")
     scn.atom_pdb_radius_how = EnumProperty(
         name="",
         description="Which objects shall be modified?",

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list