summaryrefslogtreecommitdiff
path: root/cad/src/ne1_ui/toolbars/Ui_SimulationToolBar.py
blob: afb0e2be085a96bc4c5fa287102fb6949004d5db (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
# Copyright 2004-2007 Nanorex, Inc.  See LICENSE file for details. 
"""
$Id$
"""

from PyQt4 import QtGui
from foundation.wiki_help import QToolBar_WikiHelp

def setupUi(win, toolbarArea):
    """
    Creates and populates the "Simulation" toolbar in the main window.

    @param win: NE1's main window object.
    @type  win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>}
    
    @param toolbarArea: The ToolBarArea of the main window where this toolbar
                        will live (i.e. top, right, left, bottom).
    @type  toolbarArea: U{B{Qt.ToolBarArea enum}<http://doc.trolltech.com/4.2/qt.html#ToolBarArea-enum>}
    """
    
    # Create the "Simulation" toolbar.
    win.simulationToolBar = QToolBar_WikiHelp(win)
    win.simulationToolBar.setEnabled(True)
    win.simulationToolBar.setObjectName("simulationToolBar")
    win.addToolBar(toolbarArea, win.simulationToolBar)
    
    # Populate the "Simulation" toolbar.
    win.simulationToolBar.addAction(win.simSetupAction)
    win.simulationToolBar.addAction(win.simMoviePlayerAction)
    win.simulationToolBar.addSeparator()
    win.simulationToolBar.addAction(win.jigsMotorAction)
    win.simulationToolBar.addAction(win.jigsLinearMotorAction)
    win.simulationToolBar.addAction(win.jigsAnchorAction)
    win.simulationToolBar.addAction(win.jigsStatAction)
    win.simulationToolBar.addAction(win.jigsThermoAction)
    
    # Create the "Simulation Jigs" menu, to be added to the Simuation toolbar.
    #win.simulationJigsMenu = QtGui.QMenu()
    #win.simulationJigsMenu.setObjectName("simulationJigsMenu")
    #win.simulationJigsAction.setMenu(win.simulationJigsMenu)
    
    # Populate the "Simulation Jigs" menu.
    #win.simulationJigsMenu.addAction(win.jigsMotorAction)
    #win.simulationJigsMenu.addAction(win.jigsLinearMotorAction)
    #win.simulationJigsMenu.addAction(win.jigsAnchorAction)
    #win.simulationJigsMenu.addAction(win.jigsStatAction)
    
    #win.simulationToolBar.addAction(win.simulationJigsAction)
    
    # To do: The simulation measurement menu that appears in the 
    # "Simulation" menu and command toolbar is missing from the "Simulation"
    # toolbar. This isn't hard to fix, but it isn't important to do now.
    # To fix, search for "measurementsMenu" in 
    # Ui_SimulationMenu.py. That code needs work to look more like the
    # code above that creates and populates the "Simulation Jigs" menu,
    # which I've commented out since I don't think it is necessary
    # (i.e. just place all the jig options on the toolbar, not in a menu).
    # Mark 2007-12-24
    
def retranslateUi(win):
    """
    Assigns the I{window title} property of the "Simulation" toolbar.
    
    The window title of the "Simulation" toolbar will be displayed in the popup 
    menu under "View > Toolbars".
    """
    win.simulationToolBar.setWindowTitle(
        QtGui.QApplication.translate(
            "MainWindow", "Simulation", 
            None, QtGui.QApplication.UnicodeUTF8))
    win.simulationToolBar.setToolTip(
        QtGui.QApplication.translate(
            "MainWindow", "Simulation Toolbar", 
            None, QtGui.QApplication.UnicodeUTF8))