summaryrefslogtreecommitdiff
path: root/cad/src/PM/PM_PAM3_AtomChooser.py
blob: ebffef3d758e0adad43ae0c1ecb02f0d693c35e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Copyright 2007-2008 Nanorex, Inc.  See LICENSE file for details.
"""
PM_PAM3_AtomChooser.py

@author: Ninad
@version: $Id$
@copyright: 2007-2008 Nanorex, Inc.  All rights reserved.
"""

from PM.PM_MolecularModelingKit import PM_MolecularModelingKit
from utilities.constants import diBALL
from utilities.GlobalPreferences import pref_MMKit_include_experimental_PAM_atoms

# Elements button list to create PAM3 atoms toolbutton group.
# Format:
# - button type
# - buttonId (element number),
# - buttonText (element symbol),
# - iconPath
# - tooltip (element name)
# - shortcut
# - column
# - row

PAM3_ATOMS_BUTTON_LIST = [
    #bruce 080412 revised this
    ( "QToolButton", 300, "Ax3", "", "PAM3-Axis",           None, 0, 0 ),
    ( "QToolButton", 301, "Ss3", "", "PAM3-Sugar",          None, 1, 0 ),
##    ( "QToolButton", 303, "Sj3", "", "PAM3-Sugar-Junction", None, 1, 1 ),
##    ( "QToolButton", 304, "Ae3", "", "PAM3-Axis-End",       None, 1, 0 ),
##    ( "QToolButton", 306, "Sh3", "", "PAM3-Sugar-Hydroxyl", None, 2, 1 ),
##    ( "QToolButton", 307, "Hp3", "", "PAM3-Hairpin",        None, 0, 2 )

    #NOTE: Following atoms are not used for now
    #( "QToolButton", 302, "Pl3", "", "PAM3-Phosphate",      None, 0, 2 ),
    #( "QToolButton", 305, "Se3", "", "PAM3-Sugar-End",      None, 1, 2 ),
]

PAM3_ATOMS_BUTTON_LIST_EXPERIMENTAL = [
    #bruce 080412 added this
    ( "QToolButton", 310, "Ub3", "", "PAM3-Unpaired-base",   None, 0, 1 ),
    ( "QToolButton", 311, "Ux3", "", "PAM3-Unpaired-base-x", None, 1, 1 ),
    ( "QToolButton", 312, "Uy3", "", "PAM3-Unpaired-base-y", None, 2, 1 ),
]

if pref_MMKit_include_experimental_PAM_atoms():
    PAM3_ATOMS_BUTTON_LIST += PAM3_ATOMS_BUTTON_LIST_EXPERIMENTAL


class PM_PAM3_AtomChooser( PM_MolecularModelingKit ):
    """
    The PM_PAM3_AtomChooser widget provides a PAM3 Atom Chooser,
    PAM3 stands for "Three Pseudo Atom Model "
    contained in its own group box, for a Property Manager dialog (or
    as a sub groupbox for Atom Chooser GroupBox.)

    A PM_PAM3_AtomChooser is a selection widget that displays all PAM3 atoms
    supported in NE1.

    @see: B{elements.py}
    @see: B{L{PM_MolecularModelingKit}}
    """

    viewerDisplay = diBALL

    def __init__(self,
                 parentWidget,
                 parentPropMgr   = None,
                 title           = "",
                 element         = "Ss3",
                 elementViewer   =  None
                 ):
        """
        Appends a PM_PAM3_AtomChooser widget to the bottom of I{parentWidget},
        a Property Manager dialog. (or as a sub groupbox for Atom Chooser
        GroupBox.)

        @param parentWidget: The parent PM_Dialog or PM_groupBox containing this
                             widget.
        @type  parentWidget: PM_Dialog or PM_GroupBox

        @param parentPropMgr: The parent Property Manager
        @type  parentPropMgr: PM_Dialog or None

        @param title: The button title on the group box containing the
                      Atom Chooser.
        @type  title: str

        @param element: The initially selected PAM3 atom. It can be either an
                        (PAM3) atom symbol or name.
        @type  element: str
        """

        PM_MolecularModelingKit.__init__( self,
                                          parentWidget,
                                          parentPropMgr,
                                          title,
                                          element,
                                          elementViewer)

        self._elementsButtonGroup.setButtonSize(width = 38, height = 38)


    def _addGroupBoxes(self):
        """
        various groupboxes present inside the PAM3 Atom chooser groupbox.
        """
        self._addElementsGroupBox(self)


    def getElementsButtonList(self):
        """
        Return the list of buttons in the PAM3 Atom chooser.
        @return: List containing information about the PAM3 atom toolbuttons
        @rtype:  list
        """
        return PAM3_ATOMS_BUTTON_LIST