def setupUi(win, toolbarArea): """ Create and populate the "Select" toolbar. @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 "Select" toolbar. win.selectToolBar = QToolBar_WikiHelp(win) win.selectToolBar.setEnabled(True) win.selectToolBar.setObjectName("selectToolBar") win.addToolBar(toolbarArea, win.selectToolBar) # Populate the "Select" toolbar. win.selectToolBar.addAction(win.selectLockAction) win.selectToolBar.addAction(win.selectAllAction) win.selectToolBar.addAction(win.selectNoneAction) win.selectToolBar.addAction(win.selectInvertAction) win.selectToolBar.addAction(win.selectConnectedAction) win.selectToolBar.addAction(win.selectDoublyAction) win.selectToolBar.addAction(win.selectExpandAction) win.selectToolBar.addAction(win.selectContractAction) win.selectToolBar.addAction(win.selectByNameAction)
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)
def setupUi(win, toolbarArea): """ Create and populate the "Standard Views" toolbar. @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 "Standard Views" toolbar. win.standardViewsToolBar = QToolBar_WikiHelp(win) win.standardViewsToolBar.setEnabled(True) win.standardViewsToolBar.setObjectName("standardViewsToolBar") win.addToolBar(toolbarArea, win.standardViewsToolBar) # Populate the "Standard Views" toolbar. win.standardViewsToolBar.addAction(win.viewFrontAction) win.standardViewsToolBar.addAction(win.viewBackAction) win.standardViewsToolBar.addAction(win.viewLeftAction) win.standardViewsToolBar.addAction(win.viewRightAction) win.standardViewsToolBar.addAction(win.viewTopAction) win.standardViewsToolBar.addAction(win.viewBottomAction) win.standardViewsToolBar.addAction(win.viewIsometricAction)
def setupUi(win, toolbarArea): """ Create and populate the "Display Styles" toolbar. @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 "Display Styles" toolbar. win.displayStylesToolBar = QToolBar_WikiHelp(win) win.displayStylesToolBar.setEnabled(True) win.displayStylesToolBar.setObjectName("displayStylesToolBar") win.addToolBar(toolbarArea, win.displayStylesToolBar) # Populate the "Display Styles" toolbar. win.displayStylesToolBar.addAction(win.dispDefaultAction) win.displayStylesToolBar.addAction(win.dispLinesAction) win.displayStylesToolBar.addAction(win.dispTubesAction) win.displayStylesToolBar.addAction(win.dispBallAction) win.displayStylesToolBar.addAction(win.dispCPKAction) win.displayStylesToolBar.addAction(win.dispDnaCylinderAction) win.displayStylesToolBar.addSeparator() win.displayStylesToolBar.addAction(win.dispHideAction) win.displayStylesToolBar.addAction(win.dispUnhideAction)
def setupUi(win, toolbarArea): """ Creates and populates the "Build Structures" toolbar in the main window. @param win: NE1's main window object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ # Create the "Build Structures" toolbar. win.buildStructuresToolBar = QToolBar_WikiHelp(win) win.buildStructuresToolBar.setEnabled(True) win.buildStructuresToolBar.setObjectName("buildStructuresToolBar") win.addToolBar(toolbarArea, win.buildStructuresToolBar) # Populate the "Build Structures" toolbar. # Begin with "Builders", then add single shot "Generators". win.buildStructuresToolBar.addAction(win.toolsDepositAtomAction) win.buildStructuresToolBar.addAction(win.buildDnaAction) win.buildStructuresToolBar.addAction(win.buildProteinAction) win.buildStructuresToolBar.addAction(win.buildNanotubeAction) win.buildStructuresToolBar.addAction(win.buildCrystalAction) win.buildStructuresToolBar.addAction(win.insertGrapheneAction) # This adds the Atom Generator example for developers. # It is enabled (displayed) if the "Atom Generator" debug pref is set to True. # Otherwise, it is disabled (hidden) from the UI. win.buildStructuresToolBar.addAction(win.insertAtomAction)
def setupUi(win, toolbarArea): """ Creates and populates the "Build Tools" 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 "Build Tools" toolbar. win.buildToolsToolBar = QToolBar_WikiHelp(win) win.buildToolsToolBar.setEnabled(True) win.buildToolsToolBar.setObjectName("buildToolsToolBar") win.addToolBar(toolbarArea, win.buildToolsToolBar) # Populate the "Build Tools" toolbar. win.buildToolsToolBar.addAction(win.toolsFuseChunksAction) win.buildToolsToolBar.addAction(win.modifyDeleteBondsAction) win.buildToolsToolBar.addAction(win.modifyHydrogenateAction) win.buildToolsToolBar.addAction(win.modifyDehydrogenateAction) win.buildToolsToolBar.addAction(win.modifyPassivateAction) win.buildToolsToolBar.addAction(win.modifyStretchAction) win.buildToolsToolBar.addAction(win.modifyMergeAction) win.buildToolsToolBar.addAction(win.modifyMirrorAction) win.buildToolsToolBar.addAction(win.modifyInvertAction) win.buildToolsToolBar.addAction(win.modifyAlignCommonAxisAction)
def setupUi(win, toolbarArea): """ Creates and populates the "Standard" 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 "Standard" toolbar. win.standardToolBar = QToolBar_WikiHelp(win) win.standardToolBar.setEnabled(True) win.standardToolBar.setObjectName("standardToolBar") win.addToolBar(toolbarArea, win.standardToolBar) # Populate the "Standard" toolbar. win.standardToolBar.addAction(win.fileOpenAction) win.standardToolBar.addAction(win.fileSaveAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.editMakeCheckpointAction) # hidden. win.standardToolBar.addAction(win.editUndoAction) win.standardToolBar.addAction(win.editRedoAction) win.standardToolBar.addAction(win.editCutAction) win.standardToolBar.addAction(win.editCopyAction) win.standardToolBar.addAction(win.pasteFromClipboardAction) win.standardToolBar.addAction(win.editDeleteAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.toolsSelectMoleculesAction) win.standardToolBar.addAction(win.toolsMoveMoleculeAction) win.standardToolBar.addAction(win.rotateComponentsAction) win.standardToolBar.addAction(win.modifyAdjustSelAction) win.standardToolBar.addAction(win.modifyAdjustAllAction) win.standardToolBar.addAction(win.simMinimizeEnergyAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.dispObjectColorAction) win.standardToolBar.addAction(win.resetChunkColorAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.colorSchemeAction) win.standardToolBar.addAction(win.lightingSchemeAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.editRenameAction) win.standardToolBar.addAction(win.editRenameObjectsAction) win.standardToolBar.addAction(win.editAddSuffixAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.editPrefsAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.helpWhatsThisAction)
def setupUi(win, toolbarArea): """ Creates and populates the "Build Structures" toolbar in the main window. @param win: NE1's main window object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ # Create the "Build Structures" toolbar. win.buildStructuresToolBar = QToolBar_WikiHelp(win) win.buildStructuresToolBar.setEnabled(True) win.buildStructuresToolBar.setObjectName("buildStructuresToolBar") win.addToolBar(toolbarArea, win.buildStructuresToolBar) # Populate the "Build Structures" toolbar. # Begin with "Builders", then add single shot "Generators". win.buildStructuresToolBar.addAction(win.toolsDepositAtomAction) win.buildStructuresToolBar.addAction(win.buildDnaAction) # New Nanotube Builder or old Nanotube Generator? if debug_pref("Use new 'Build > Nanotube' builder? (next session)", Choice_boolean_True, prefs_key="A10 devel/Old Nanotube Generator"): # New "Build > CNT", experimental. --Mark 2008-03-10 win.buildStructuresToolBar.addAction(win.buildNanotubeAction) else: # Original "Build > Nanotube" win.buildStructuresToolBar.addAction(win.nanotubeGeneratorAction) win.buildStructuresToolBar.addAction(win.toolsCookieCutAction) win.buildStructuresToolBar.addSeparator() # Generators after this. # This adds the Peptide Generator (piotr 080304) win.buildStructuresToolBar.addAction(win.insertPeptideAction) win.buildStructuresToolBar.addAction(win.insertGrapheneAction) # This adds the Atom Generator example for developers. win.buildStructuresToolBar.addAction(win.insertAtomAction)
def setupUi(win, toolbarArea): """ Create and populate the "View" toolbar. @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 "View" toolbar. win.viewToolBar = QToolBar_WikiHelp(win) win.viewToolBar.setEnabled(True) win.viewToolBar.setObjectName("viewToolBar") win.addToolBar(toolbarArea, win.viewToolBar) # Populate the "View" toolbar. win.viewToolBar.addAction(win.setViewHomeAction) win.viewToolBar.addAction(win.setViewFitToWindowAction) win.viewToolBar.addAction(win.setViewRecenterAction) win.viewToolBar.addAction(win.setViewZoomtoSelectionAction) win.viewToolBar.addAction(win.zoomToAreaAction) win.viewToolBar.addAction(win.zoomInOutAction) win.viewToolBar.addAction(win.panToolAction) win.viewToolBar.addAction(win.rotateToolAction) win.viewToolBar.addSeparator() win.viewToolBar.addAction(win.standardViewsAction) # A menu with views. win.viewToolBar.addAction(win.viewFlipViewVertAction) win.viewToolBar.addAction(win.viewFlipViewHorzAction) win.viewToolBar.addAction(win.viewRotatePlus90Action) win.viewToolBar.addAction(win.viewRotateMinus90Action) win.viewToolBar.addSeparator() win.viewToolBar.addAction(win.viewOrientationAction) win.viewToolBar.addAction(win.saveNamedViewAction) win.viewToolBar.addAction(win.viewNormalToAction) win.viewToolBar.addAction(win.viewParallelToAction)
def setupUi(win, toolbarArea): """ Create and populate the "Rendering" toolbar. @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 "Rendering" toolbar. win.renderingToolBar = QToolBar_WikiHelp(win) win.renderingToolBar.setEnabled(True) win.renderingToolBar.setObjectName("renderingToolBar") win.addToolBar(toolbarArea, win.renderingToolBar) # Populate the "Rendering" toolbar. win.renderingToolBar.addAction(win.viewQuteMolAction) win.renderingToolBar.addAction(win.viewRaytraceSceneAction) win.renderingToolBar.addSeparator() win.renderingToolBar.addAction(win.setStereoViewAction) # piotr 080516
class Ui_CommandToolbar( QWidget ): """ This provides most of the User Interface for the command toolbar called in CommandToolbar class. """ def __init__(self, win): """ Constructor for class Ui_CommandToolbar. @param win: Mainwindow object @type win: L{MWsemantics} """ QWidget.__init__(self) self.win = win def setupUi(self): """ Setup the UI for the command toolbar. """ #ninad 070123 : It's important to set the Vertical size policy of the # cmd toolbar widget. otherwise the flyout QToolbar messes up the #layout (makes the command toolbar twice as big) #I have set the vertical policy as fixed. Works fine. There are some # MainWindow resizing problems for but those are not due to this #size policy AFAIK self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) layout_cmdtoolbar = QHBoxLayout(self) layout_cmdtoolbar.setMargin(2) layout_cmdtoolbar.setSpacing(2) #See comment at the top for details about this flag if DEFINE_CONTROL_AREA_AS_A_QWIDGET: self.cmdToolbarControlArea = QWidget(self) else: self.cmdToolbarControlArea = QToolBar_WikiHelp(self) self.cmdToolbarControlArea.setAutoFillBackground(True) self.ctrlAreaPalette = self.getCmdMgrCtrlAreaPalette() self.cmdToolbarControlArea.setPalette(self.ctrlAreaPalette) self.cmdToolbarControlArea.setMinimumHeight(62) self.cmdToolbarControlArea.setMinimumWidth(380) self.cmdToolbarControlArea.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) #See comment at the top for details about this flag if DEFINE_CONTROL_AREA_AS_A_QWIDGET: layout_controlArea = QHBoxLayout(self.cmdToolbarControlArea) layout_controlArea.setMargin(0) layout_controlArea.setSpacing(0) self.cmdButtonGroup = QButtonGroup() btn_index = 0 for name in ('Build', 'Insert', 'Tools', 'Move', 'Simulation'): btn = QToolButton(self.cmdToolbarControlArea) btn.setObjectName(name) btn.setMinimumWidth(75) btn.setMaximumWidth(75) btn.setMinimumHeight(62) btn.setAutoRaise(True) btn.setCheckable(True) btn.setAutoExclusive(True) iconpath = "ui/actions/Command Toolbar/ControlArea/" + name + ".png" btn.setIcon(geticon(iconpath)) btn.setIconSize(QSize(22, 22)) btn.setText(name) btn.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) btn.setPalette(self.ctrlAreaPalette) self.cmdButtonGroup.addButton(btn, btn_index) btn_index += 1 #See comment at the top for details about this flag if DEFINE_CONTROL_AREA_AS_A_QWIDGET: layout_controlArea.addWidget(btn) else: self.cmdToolbarControlArea.layout().addWidget(btn) #following has issues. so not adding widget directly to the #toolbar. (instead adding it in its layout)-- ninad 070124 ##self.cmdToolbarControlArea.addWidget(btn) layout_cmdtoolbar.addWidget(self.cmdToolbarControlArea) #Flyout Toolbar in the command toolbar self.flyoutToolBar = FlyoutToolBar(self) layout_cmdtoolbar.addWidget(self.flyoutToolBar) #ninad 070116: Define a spacer item. It will have the exact geometry # as that of the flyout toolbar. it is added to the command toolbar # layout only when the Flyout Toolbar is hidden. It is required # to keep the 'Control Area' widget fixed in its place (otherwise, #after hiding the flyout toolbar, the layout adjusts the position of #remaining widget items) self.spacerItem = QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.spacerItem.setGeometry = self.flyoutToolBar.geometry() for btn in self.cmdButtonGroup.buttons(): if str(btn.objectName()) == 'Build': btn.setMenu(self.win.buildStructuresMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Build Commands") whatsThisTextForCommandToolbarBuildButton(btn) if str(btn.objectName()) == 'Insert': btn.setMenu(self.win.insertMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Insert Commands") whatsThisTextForCommandToolbarInsertButton(btn) if str(btn.objectName()) == 'Tools': #fyi: cmd stands for 'command toolbar' - ninad070406 self.win.cmdToolsMenu = QtGui.QMenu(self.win) self.win.cmdToolsMenu.addAction(self.win.toolsExtrudeAction) self.win.cmdToolsMenu.addAction(self.win.toolsFuseChunksAction) self.win.cmdToolsMenu.addSeparator() self.win.cmdToolsMenu.addAction(self.win.modifyMergeAction) self.win.cmdToolsMenu.addAction(self.win.modifyMirrorAction) self.win.cmdToolsMenu.addAction(self.win.modifyInvertAction) self.win.cmdToolsMenu.addAction(self.win.modifyStretchAction) btn.setMenu(self.win.cmdToolsMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Tools") whatsThisTextForCommandToolbarToolsButton(btn) if str(btn.objectName()) == 'Move': self.win.moveMenu = QtGui.QMenu(self.win) self.win.moveMenu.addAction(self.win.toolsMoveMoleculeAction) self.win.moveMenu.addAction(self.win.rotateComponentsAction) self.win.moveMenu.addSeparator() self.win.moveMenu.addAction( self.win.modifyAlignCommonAxisAction) ##self.win.moveMenu.addAction(\ ## self.win.modifyCenterCommonAxisAction) btn.setMenu(self.win.moveMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Move Commands") whatsThisTextForCommandToolbarMoveButton(btn) if str(btn.objectName()) == 'Dimension': btn.setMenu(self.win.dimensionsMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Dimensioning Commands") if str(btn.objectName()) == 'Simulation': btn.setMenu(self.win.simulationMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Simulation Commands") whatsThisTextForCommandToolbarSimulationButton(btn) # Convert all "img" tags in the button's "What's This" text # into abs paths (from their original rel paths). # Partially fixes bug 2943. --mark 2008-12-07 # [bruce 081209 revised this -- removed mac = False] fix_QAction_whatsthis(btn) return def truncateText(self, text, length = 12, truncateSymbol = '...'): """ Truncates the tooltip text with the given truncation symbol (three dots) in the case """ #ninad 070201 This is a temporary fix. Ideally it should show the whole #text in the toolbutton. But there are some layout / size policy #problems because of which the toolbar height increases after you print #tooltip text on two or more lines. (undesirable effect) if not text: print "no text to truncate. Returning" return truncatedLength = length - len(truncateSymbol) if len(text) > length: return text[:truncatedLength] + truncateSymbol else: return text def wrapToolButtonText(self, text): """ Add a newline character at the end of each word in the toolbutton text """ #ninad 070126 QToolButton lacks this method. This is not really a #'word wrap' but OK for now. #@@@ ninad 070126. Not calling this method as it is creating an annoying #resizing problem in the Command toolbar layout. Possible solution is #to add a spacer item in a vbox layout to the command toolbar layout stringlist = text.split(" ", QString.SkipEmptyParts) text2 = QString() if len(stringlist) > 1: for l in stringlist: text2.append(l) text2.append("\n") return text2 return None ##==================================================================## #color palettes (UI stuff) for different command toolbar areas def getCmdMgrCtrlAreaPalette(self): """ Return a palette for Command Manager control area (Palette for Tool Buttons in command toolbar control area) """ #See comment at the top for details about this flag if DEFINE_CONTROL_AREA_AS_A_QWIDGET: return getPalette(None, QPalette.Window, cmdTbarCntrlAreaBtnColor ) else: return getPalette(None, QPalette.Button, cmdTbarCntrlAreaBtnColor ) def getCmdMgrSubCtrlAreaPalette(self): """ Return a palette for Command Manager sub control area (Palette for Tool Buttons in command toolbar sub control area) """ #Define the color role. Make sure to apply color to QPalette.Button #instead of QPalette.Window as it is a QToolBar. - ninad 20070619 return getPalette(None, QPalette.Button, cmdTbarSubCntrlAreaBtnColor ) def getCmdMgrCommandAreaPalette(self): """ Return a palette for Command Manager 'Commands area'(flyout toolbar) (Palette for Tool Buttons in command toolbar command area) """ return self.flyoutToolBar.getPalette()
def setupUi(self): """ Setup the UI for the command toolbar. """ #ninad 070123 : It's important to set the Vertical size policy of the # cmd toolbar widget. otherwise the flyout QToolbar messes up the #layout (makes the command toolbar twice as big) #I have set the vertical policy as fixed. Works fine. There are some # MainWindow resizing problems for but those are not due to this #size policy AFAIK self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) layout_cmdtoolbar = QHBoxLayout(self) layout_cmdtoolbar.setMargin(2) layout_cmdtoolbar.setSpacing(2) #See comment at the top for details about this flag if DEFINE_CONTROL_AREA_AS_A_QWIDGET: self.cmdToolbarControlArea = QWidget(self) else: self.cmdToolbarControlArea = QToolBar_WikiHelp(self) self.cmdToolbarControlArea.setAutoFillBackground(True) self.ctrlAreaPalette = self.getCmdMgrCtrlAreaPalette() self.cmdToolbarControlArea.setPalette(self.ctrlAreaPalette) self.cmdToolbarControlArea.setMinimumHeight(62) self.cmdToolbarControlArea.setMinimumWidth(380) self.cmdToolbarControlArea.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) #See comment at the top for details about this flag if DEFINE_CONTROL_AREA_AS_A_QWIDGET: layout_controlArea = QHBoxLayout(self.cmdToolbarControlArea) layout_controlArea.setMargin(0) layout_controlArea.setSpacing(0) self.cmdButtonGroup = QButtonGroup() btn_index = 0 for name in ('Build', 'Insert', 'Tools', 'Move', 'Simulation'): btn = QToolButton(self.cmdToolbarControlArea) btn.setObjectName(name) btn.setMinimumWidth(75) btn.setMaximumWidth(75) btn.setMinimumHeight(62) btn.setAutoRaise(True) btn.setCheckable(True) btn.setAutoExclusive(True) iconpath = "ui/actions/Command Toolbar/ControlArea/" + name + ".png" btn.setIcon(geticon(iconpath)) btn.setIconSize(QSize(22, 22)) btn.setText(name) btn.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) btn.setPalette(self.ctrlAreaPalette) self.cmdButtonGroup.addButton(btn, btn_index) btn_index += 1 #See comment at the top for details about this flag if DEFINE_CONTROL_AREA_AS_A_QWIDGET: layout_controlArea.addWidget(btn) else: self.cmdToolbarControlArea.layout().addWidget(btn) #following has issues. so not adding widget directly to the #toolbar. (instead adding it in its layout)-- ninad 070124 ##self.cmdToolbarControlArea.addWidget(btn) layout_cmdtoolbar.addWidget(self.cmdToolbarControlArea) #Flyout Toolbar in the command toolbar self.flyoutToolBar = FlyoutToolBar(self) layout_cmdtoolbar.addWidget(self.flyoutToolBar) #ninad 070116: Define a spacer item. It will have the exact geometry # as that of the flyout toolbar. it is added to the command toolbar # layout only when the Flyout Toolbar is hidden. It is required # to keep the 'Control Area' widget fixed in its place (otherwise, #after hiding the flyout toolbar, the layout adjusts the position of #remaining widget items) self.spacerItem = QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.spacerItem.setGeometry = self.flyoutToolBar.geometry() for btn in self.cmdButtonGroup.buttons(): if str(btn.objectName()) == 'Build': btn.setMenu(self.win.buildStructuresMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Build Commands") whatsThisTextForCommandToolbarBuildButton(btn) if str(btn.objectName()) == 'Insert': btn.setMenu(self.win.insertMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Insert Commands") whatsThisTextForCommandToolbarInsertButton(btn) if str(btn.objectName()) == 'Tools': #fyi: cmd stands for 'command toolbar' - ninad070406 self.win.cmdToolsMenu = QtGui.QMenu(self.win) self.win.cmdToolsMenu.addAction(self.win.toolsExtrudeAction) self.win.cmdToolsMenu.addAction(self.win.toolsFuseChunksAction) self.win.cmdToolsMenu.addSeparator() self.win.cmdToolsMenu.addAction(self.win.modifyMergeAction) self.win.cmdToolsMenu.addAction(self.win.modifyMirrorAction) self.win.cmdToolsMenu.addAction(self.win.modifyInvertAction) self.win.cmdToolsMenu.addAction(self.win.modifyStretchAction) btn.setMenu(self.win.cmdToolsMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Tools") whatsThisTextForCommandToolbarToolsButton(btn) if str(btn.objectName()) == 'Move': self.win.moveMenu = QtGui.QMenu(self.win) self.win.moveMenu.addAction(self.win.toolsMoveMoleculeAction) self.win.moveMenu.addAction(self.win.rotateComponentsAction) self.win.moveMenu.addSeparator() self.win.moveMenu.addAction( self.win.modifyAlignCommonAxisAction) ##self.win.moveMenu.addAction(\ ## self.win.modifyCenterCommonAxisAction) btn.setMenu(self.win.moveMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Move Commands") whatsThisTextForCommandToolbarMoveButton(btn) if str(btn.objectName()) == 'Dimension': btn.setMenu(self.win.dimensionsMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Dimensioning Commands") if str(btn.objectName()) == 'Simulation': btn.setMenu(self.win.simulationMenu) btn.setPopupMode(QToolButton.MenuButtonPopup) btn.setToolTip("Simulation Commands") whatsThisTextForCommandToolbarSimulationButton(btn) # Convert all "img" tags in the button's "What's This" text # into abs paths (from their original rel paths). # Partially fixes bug 2943. --mark 2008-12-07 # [bruce 081209 revised this -- removed mac = False] fix_QAction_whatsthis(btn) return