summaryrefslogtreecommitdiff
path: root/cad/src/ne1_ui/toolbars/Ui_MoveFlyout.py
blob: 9250592f9cedfb1152df354932f9f0c371879e91 (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
# Copyright 2008 Nanorex, Inc.  See LICENSE file for details.
"""

@author: Ninad
@copyright: 2008 Nanorex, Inc.  See LICENSE file for details.
@version:$Id$

History:
2008-08-05: Created during command stack refactoring project

TODO:
see the superclass
"""
from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout
from utilities.debug import print_compact_traceback
from PyQt4.Qt import QAction
_superclass = Ui_AbstractFlyout

class MoveFlyout(Ui_AbstractFlyout):
    """
    """
    def _action_in_controlArea_to_show_this_flyout(self):
        """
        Required action in the 'Control Area' as a reference for this
        flyout toolbar. See superclass method for documentation and todo note.
        """
        #Partlibrary is available as a sub item of the Insert menu in the
        #control area
        try:
            action = self.win.toolsMoveRotateActionGroup.checkedAction()
        except:
            print_compact_traceback("bug: no move action checked?")
            action = None

        return action

    def _getExitActionText(self):
        """
        Overrides superclass method.
        @see: self._createActions()
        """
        return "Exit Move"

    def getFlyoutActionList(self): #Ninad 20070618
        """
        Returns a tuple that contains mode spcific actionlists in the
        added in the flyout toolbar of the mode.
        CommandToolbar._createFlyoutToolBar method calls this
        @return: params: A tuple that contains 3 lists:
        (subControlAreaActionList, commandActionLists, allActionsList)
        """
        #'allActionsList' returns all actions in the flyout toolbar
        #including the subcontrolArea actions
        allActionsList = []

        #Action List for  subcontrol Area buttons.
        #In this mode, there is really no subcontrol area.
        #We will treat subcontrol area same as 'command area'
        #(subcontrol area buttons will have an empty list as their command area
        #list). We will set  the Comamnd Area palette background color to the
        #subcontrol area.

        subControlAreaActionList =[]


        subControlAreaActionList.append(self.exitModeAction)

        separator = QAction(self.win)
        separator.setSeparator(True)
        subControlAreaActionList.append(separator)

        subControlAreaActionList.append(self.win.toolsMoveMoleculeAction)
        subControlAreaActionList.append(self.win.rotateComponentsAction)
        subControlAreaActionList.append(self.win.modifyAlignCommonAxisAction)

        allActionsList.extend(subControlAreaActionList)

        #Empty actionlist for the 'Command Area'
        commandActionLists = []

        #Append empty 'lists' in 'commandActionLists equal to the
        #number of actions in subControlArea
        for i in range(len(subControlAreaActionList)):
            lst = []
            commandActionLists.append(lst)

        params = (subControlAreaActionList, commandActionLists, allActionsList)

        return params

    def _addWhatsThisText(self):
        """
        Add 'What's This' help text for all actions on toolbar.
        """
        from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForMoveCommandToolbar
        whatsThisTextForMoveCommandToolbar(self)
        return

    def _addToolTipText(self):
        """
        Add 'Tool tip' help text for all actions on toolbar.
        """
        from ne1_ui.ToolTipText_for_CommandToolbars import toolTipTextForMoveCommandToolbar
        toolTipTextForMoveCommandToolbar(self)
        return