summaryrefslogtreecommitdiff
path: root/cad/src/protein/commands/BackrubProteinSim/BackrubProteinSim_Command.py
blob: 2edde1a45efbbf6b28301b49a54539c481f992b1 (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
# Copyright 2008 Nanorex, Inc.  See LICENSE file for details.
"""
@author:    Urmi
@version:   $Id$
@copyright: 2008 Nanorex, Inc.  See LICENSE file for details.

"""

import foundation.changes as changes
from commands.SelectChunks.SelectChunks_GraphicsMode import SelectChunks_GraphicsMode
from command_support.EditCommand import EditCommand
from utilities.constants import red
from protein.commands.BackrubProteinSim.BackrubProteinSim_PropertyManager import BackrubProteinSim_PropertyManager


# == GraphicsMode part

_superclass_for_GM = SelectChunks_GraphicsMode

class BackrubProteinSim_GraphicsMode(SelectChunks_GraphicsMode ):
    """
    Graphics mode for Backrub Proteins sequence design command.
    """
    pass

# == Command part


class BackrubProteinSim_Command(EditCommand):
    """
    Class for protein sequence design with rosetta when backrub motion is allowed
    """

    # class constants
    GraphicsMode_class = BackrubProteinSim_GraphicsMode
    PM_class = BackrubProteinSim_PropertyManager


    commandName = 'BACKRUB_PROTEIN_SEQUENCE_DESIGN'
    featurename = "Backrub Protein Sequence Design"
    from utilities.constants import CL_SUBCOMMAND
    command_level = CL_SUBCOMMAND
    command_parent = 'BUILD_PROTEIN'

    command_should_resume_prevMode = True
    command_has_its_own_PM = True

    flyoutToolbar = None

    def _getFlyoutToolBarActionAndParentCommand(self):
        """
        See superclass for documentation.
        @see: self.command_update_flyout()
        """
        flyoutActionToCheck = 'rosetta_backrub_Action'
        parentCommandName = 'BUILD_PROTEIN'
        return flyoutActionToCheck, parentCommandName

    def keep_empty_group(self, group):
        """
        Returns True if the empty group should not be automatically deleted.
        otherwise returns False. The default implementation always returns
        False. Subclasses should override this method if it needs to keep the
        empty group for some reasons. Note that this method will only get called
        when a group has a class constant autdelete_when_empty set to True.

        @see: Command.keep_empty_group() which is overridden here.
        """

        bool_keep = EditCommand.keep_empty_group(self, group)

        return bool_keep