From 3decb7471877d555243eab79f45dd2b73a473561 Mon Sep 17 00:00:00 2001
From: Stefan Bienert <stefan.bienert@unibas.ch>
Date: Tue, 2 Aug 2011 13:43:01 +0200
Subject: [PATCH] Exported chain description get/ set functions to python

---
 modules/mol/base/doc/editors.rst         | 5 +++++
 modules/mol/base/doc/entity.rst          | 8 ++++++++
 modules/mol/base/pymod/export_chain.cc   | 2 ++
 modules/mol/base/pymod/export_editors.cc | 1 +
 4 files changed, 16 insertions(+)

diff --git a/modules/mol/base/doc/editors.rst b/modules/mol/base/doc/editors.rst
index be0a1d3ca..d73972f55 100644
--- a/modules/mol/base/doc/editors.rst
+++ b/modules/mol/base/doc/editors.rst
@@ -96,6 +96,11 @@ The basic functionality of editors is implemented in the EditorBase class.
      :param type:  Must be a value of enum ChainType
                    (see :attr:`ChainHandle.chain_type`)   
 
+  .. method:: SetChainDescription(chain, description)
+
+     :param chain:       Must be a valid chain
+     :param description: Description to be added
+
   .. method:: InsertAtom(residue, atom_name, pos, 
                          element="", occupancy=1.0, b_factor=0.0,
                          is_hetatm=False)
diff --git a/modules/mol/base/doc/entity.rst b/modules/mol/base/doc/entity.rst
index e2f1ab571..a68ae0371 100644
--- a/modules/mol/base/doc/entity.rst
+++ b/modules/mol/base/doc/entity.rst
@@ -298,6 +298,10 @@ The Handle Classes
      Where ``CHAINTYPE_N_CHAINTYPES`` holds the number of different types
      available.
 
+  .. attribute:: description
+
+     Details about the chain. Not categorised, just text.
+
   .. attribute:: residues
    
      List of all residues of this chain. The residues are sorted from N- to 
@@ -411,6 +415,10 @@ The Handle Classes
 
     See :attr:`chain_type`
 
+  .. method:: GetChainDescription()
+
+    See :attr:`description`
+
 .. class:: ResidueHandle
 
   The residue is either used to represent complete molecules or building blocks 
diff --git a/modules/mol/base/pymod/export_chain.cc b/modules/mol/base/pymod/export_chain.cc
index 117d1b2f6..f524d5d17 100644
--- a/modules/mol/base/pymod/export_chain.cc
+++ b/modules/mol/base/pymod/export_chain.cc
@@ -52,6 +52,7 @@ void export_Chain()
     .add_property("valid", &ChainBase::IsValid)
     .def("IsValid", &ChainBase::IsValid)
     .def("GetChainType", &ChainBase::GetChainType)
+    .def("GetChainDescription", &ChainBase::GetChainDescription)
   ;
   generic_prop_def<ChainBase>(chain_base);
   class_<ChainHandle, bases<ChainBase> >("ChainHandle", init<>())
@@ -82,6 +83,7 @@ void export_Chain()
     .add_property("residue_count", &ChainHandle::GetResidueCount)
     .add_property("atom_count", &ChainHandle::GetAtomCount)
     .add_property("chain_type", &ChainHandle::GetChainType)
+    .add_property("description", &ChainHandle::GetChainDescription)
     .def("InSequence", &ChainHandle::InSequence)
     .def("Select", select_string, arg("flags")=0)
     .def("Select", select_query, arg("flags")=0)
diff --git a/modules/mol/base/pymod/export_editors.cc b/modules/mol/base/pymod/export_editors.cc
index 61ea42ceb..4d3b42197 100644
--- a/modules/mol/base/pymod/export_editors.cc
+++ b/modules/mol/base/pymod/export_editors.cc
@@ -213,6 +213,7 @@ void export_Editors()
     .def("Connect", connect_d)    
     .def("RenameChain", &EditorBase::RenameChain)
     .def("SetChainType", &EditorBase::SetChainType)
+    .def("SetChainDescription", &EditorBase::SetChainDescription)
     .def("RenameResidue", &EditorBase::RenameResidue)
     .def("RenameAtom", &EditorBase::RenameAtom)
     .def("AddTorsion", &EditorBase::AddTorsion)
-- 
GitLab