python_code
stringlengths
0
992k
repo_name
stringlengths
8
46
file_path
stringlengths
5
162
# Copyright 2006-2007 Nanorex, Inc. See LICENSE file for details. """ ViewOrientationWindow.py @author: Ninad @version: $Id$ @copyright: 2006-2007 Nanorex, Inc. See LICENSE file for details. Module classification: [bruce 080101] Ideally this might be general and not need to be a singleton, and be classified into "widgets". For all I know, it already almost is, but certainly the attr accesses into "win" are not yet that general, and I can't tell how much else might not be. So to be safe I'm putting it into ne1_ui, though refactoring almost all of it into "widgets" would be good to do sometime. """ from PyQt4 import QtCore, QtGui from PyQt4.Qt import Qt, SIGNAL, QMainWindow, QDockWidget from ne1_ui.Ui_ViewOrientation import Ui_ViewOrientation from utilities.icon_utilities import geticon class ViewOrientationWindow(QDockWidget, Ui_ViewOrientation): def __init__(self, win): QDockWidget.__init__(self, win) self.win = win #self.setupUi(self.win) self.setupUi(self) win.standardViewMethodDict = {} win.namedViewMethodDict = {} self.lastViewList = None #Signals QtCore.QObject.connect(self.saveNamedViewToolButton,QtCore.SIGNAL("clicked()"), win.saveNamedView) QtCore.QObject.connect(self.orientationViewList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.changeViewOrientation) QtCore.QObject.connect(self.pinOrientationWindowToolButton, SIGNAL("clicked()"), self.changePinIcon) def createOrientationViewList(self): """ Create a list of views for the first time. It includes all standard views and all named views that exist in the MT. """ #NIY ninad061116 #Add items as QListWidgetItem ... #Defining these as QListWidgetItem facilitates use of itemDoubleClicked Signal) ninad 061115 win = self.win self.addStandardViewItems() self.namedViewList = win.getNamedViewList() #Save the last named view list for item in self.namedViewList: itemNamedView = QtGui.QListWidgetItem(item.name, self.orientationViewList) itemNamedView.setIcon( geticon("ui/modeltree/csys.png")) win.namedViewMethodDict[itemNamedView] = item.change_view self.lastViewList = self.namedViewList def addStandardViewItems(self): """ Add the standard views to the Orientation Window """ win = self.win #The default items itemViewNormalTo = QtGui.QListWidgetItem(win.viewNormalToAction.objectName(), self.orientationViewList) itemViewNormalTo.setIcon(win.viewNormalToAction.icon()) win.standardViewMethodDict[itemViewNormalTo] = win.viewNormalTo itemViewParallelTo= QtGui.QListWidgetItem(win.viewParallelToAction.objectName(), self.orientationViewList) itemViewParallelTo.setIcon(win.viewParallelToAction.icon()) win.standardViewMethodDict[itemViewParallelTo] = win.viewParallelTo itemViewFront = QtGui.QListWidgetItem(win.viewFrontAction.objectName(), self.orientationViewList) itemViewFront.setIcon(win.viewFrontAction.icon()) win.standardViewMethodDict[itemViewFront] = win.viewFront itemViewBack = QtGui.QListWidgetItem(win.viewBackAction.objectName(), self.orientationViewList) itemViewBack.setIcon(win.viewBackAction.icon()) win.standardViewMethodDict[itemViewBack] = win.viewBack itemViewLeft = QtGui.QListWidgetItem(win.viewLeftAction.objectName(), self.orientationViewList) itemViewLeft.setIcon(win.viewLeftAction.icon()) win.standardViewMethodDict[itemViewLeft] = win.viewLeft itemViewRight = QtGui.QListWidgetItem(win.viewRightAction.objectName(), self.orientationViewList) itemViewRight.setIcon(win.viewRightAction.icon()) win.standardViewMethodDict[itemViewRight] = win.viewRight itemViewTop = QtGui.QListWidgetItem(win.viewTopAction.objectName(), self.orientationViewList) itemViewTop.setIcon(win.viewTopAction.icon()) win.standardViewMethodDict[itemViewTop] = win.viewTop itemViewBottom = QtGui.QListWidgetItem(win.viewBottomAction.objectName(), self.orientationViewList) itemViewBottom.setIcon(win.viewBottomAction.icon()) win.standardViewMethodDict[itemViewBottom] = win.viewBottom itemViewIsometric = QtGui.QListWidgetItem(win.viewIsometricAction.objectName(), self.orientationViewList) itemViewIsometric.setIcon(win.viewIsometricAction.icon()) win.standardViewMethodDict[itemViewIsometric] = win.viewIsometric itemViewFlipViewVert = QtGui.QListWidgetItem(win.viewFlipViewVertAction.objectName(), self.orientationViewList) itemViewFlipViewVert.setIcon(win.viewFlipViewVertAction.icon()) win.standardViewMethodDict[itemViewFlipViewVert] = win.viewFlipViewVert itemViewFlipViewHorz = QtGui.QListWidgetItem(win.viewFlipViewHorzAction.objectName(), self.orientationViewList) itemViewFlipViewHorz.setIcon(win.viewFlipViewHorzAction.icon()) win.standardViewMethodDict[itemViewFlipViewHorz] = win.viewFlipViewHorz itemViewRotatePlus90 = QtGui.QListWidgetItem(win.viewRotatePlus90Action.objectName(), self.orientationViewList) itemViewRotatePlus90.setIcon(win.viewRotatePlus90Action.icon()) win.standardViewMethodDict[itemViewRotatePlus90] = win.viewRotatePlus90 itemViewRotateMinus90 = QtGui.QListWidgetItem(win.viewRotateMinus90Action.objectName(), self.orientationViewList) itemViewRotateMinus90.setIcon(win.viewRotateMinus90Action.icon()) win.standardViewMethodDict[itemViewRotateMinus90] = win.viewRotateMinus90 return def updateOrientationViewList(self, viewList=None): """ Update the orientation view list when a new Saved Named View Node is created """ # ninad 061201: This function is called from inside the mt_update() if the orientation # window is visible. win = self.win self.namedViewList = win.getNamedViewList() # check whether the list of view nodes is same as before. If its same, no need to go further. if self.namedViewList == self.lastViewList: ## print "updateOrientationViewList called but returning as named view nodes haven't changed" return #start with a clean slate #@@@ ninad 061201 It would have been better to update the dictionary with new key value pairs #(and removing key-val pairs not in the new list.) There should be a better way to update the #self.orientationViewList instead of erasing everything in it. #We are passing view nodes name (item.name) to # a QListWidgetItem . And this QListWidgetItem object in turn is included in the dictionary. # Since, even a huge assembly is unlikely to have a large number of named view nodes, for now I will #just use dict.clear() to clear the old dictionary and also self.orientationViewList.clear() to clear all the #items in orientationViewList (similar to what MMKit does)...Perhaps the latter implementation #should be changed in future win.namedViewMethodDict.clear() self.orientationViewList.clear() self.addStandardViewItems() # Add standard views as the list widget items to the orientation window for item in self.namedViewList: itemNamedView = QtGui.QListWidgetItem(item.name, self.orientationViewList) itemNamedView.setIcon( geticon("ui/modeltree/csys.png")) win.namedViewMethodDict[itemNamedView] = item.change_view self.lastViewList = self.namedViewList def changeViewOrientation(self, widgetItemJunk = None): #Ninad 061115 """ Change the view when the item in the Orientation view window is double clicked @param widgetItemJunk: This is the widget item from the itemDoubleClicked signal. It is not used. We just want to know that this event occured @type widgetItemJunk: QWidgetItem or None """ win = self.win if win.standardViewMethodDict.has_key( self.orientationViewList.currentItem() ): viewMethod = win.standardViewMethodDict[self.orientationViewList.currentItem()] viewMethod() elif win.namedViewMethodDict.has_key( self.orientationViewList.currentItem() ): viewMethod = win.namedViewMethodDict[self.orientationViewList.currentItem()] viewMethod() else: print "bug while changing the view from Orientation Window."\ "Ignoring change view command" #@@ ninad 061201 Not sure if it would ever be called. #Adding just to be safe. return #Hide orientation window after changing the view if it is 'unpinned' if not self.pinOrientationWindowToolButton.isChecked(): win.orientationWindow.setVisible(False) # REVIEW: should we replace win.orientationWindow by self, which # I think is always the same? [bruce 080101 question] def changePinIcon(self): """ Change the icon of the Pinned button """ if self.pinOrientationWindowToolButton.isChecked(): self.pinOrientationWindowToolButton.setIcon( geticon("ui/dialogs/pinned.png")) else: self.pinOrientationWindowToolButton.setIcon( geticon("ui/dialogs/unpinned.png")) def getLastNamedViewList(self, list): self.lastNamedViewList = list return self.lastNamedViewList def keyReleaseEvent(self, event): """ The keystroke release event handler for the Orientation dialog. @param event: The key release event. @type event: U{B{QKeyEvent}<http://doc.trolltech.com/4/qkeyevent.html>} @note: This overrides QWidget.keyReleaseEvent(). """ key = event.key() if key == Qt.Key_Escape: # Close the dialog if the user has (pressed and then) released the # Esc key. self.close() else: event.ignore() # Important, per the Qt documentation. def closeEvent(self, ce): """ When the user closes the dialog by clicking the 'X' button on the dialog title bar, uncheck the vieOrientationAction icon and close the dialog. """ self.win.viewOrientationAction.setChecked(False) ce.accept()
NanoCAD-master
cad/src/ne1_ui/ViewOrientationWindow.py
""" The Graphical User Interface (gui) module provides classes for the NE1 user interface. """
NanoCAD-master
cad/src/ne1_ui/__init__.py
# Copyright 2004-2008 Nanorex, Inc. See LICENSE file for details. """ WhatsThisText_for_MainWindow.py This file provides functions for setting the "What's This" and tooltip text for widgets in the NE1 Main Window, except widgets in Property Managers. Edit WhatsThisText_for_PropertyManagers.py to set "What's This" and tooltip text for widgets in the NE1 Property Managers. @version: $Id$ @copyright: 2004-2008 Nanorex, Inc. See LICENSE file for details. Note: bruce 080210 split whatsthis_utilities.py out of this file into their own new file. To do: - Change the heading for all Display Style actions from "Display <ds>" to "Apply <ds> Display Style to the selection". Change tooltips and wiki help pages as well. - Replace current text string name with "_text" (like "Open File" example) """ from PyQt4.Qt import QWhatsThis def createWhatsThisTextForMainWindowWidgets(win): """ Adds the "What's This" help text to items found in the NE1 mainwindow toolbars and menus . @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} @note: Property Managers specify "What's This" text for their own widgets, usually in a method called add_whats_this_text(), not in this file. """ # # File Toolbar # # Open File _text = \ "<u><b>Open File</b></u> (Ctrl + O)"\ "<p><img source=\"ui/actions/File/Open.png\"><br> "\ "Opens a new file."\ "</p>" win.fileOpenAction.setWhatsThis( _text ) # Import File fileImportText = \ "<u><b>Open Babel</b></u>"\ "<p>"\ "Imports a file of any chemical file format supported by "\ "<b>Open Babel</b> into the current Part."\ "</p>" win.fileImportOpenBabelAction.setWhatsThis(fileImportText) # Close File fileCloseAction = \ "<b>Close and begin a new model</b>"\ "<p>"\ "Close the .mmp file currently being edited and loads a new one "\ "</p>" win.fileCloseAction.setWhatsThis(fileCloseAction) #Export File fileExportText = \ "<u><b>Open Babel</b></u>"\ "<p>"\ "Exports the current part in any chemical file format "\ "supported by <b>Open Babel</b>. Note that exclusive "\ "features of NanoEngineer-1 are not saved to the exported file."\ "</p>" win.fileExportOpenBabelAction.setWhatsThis(fileExportText) # Save File fileSaveText = \ "<u><b>Save File</b></u> (Ctrl + S) "\ "<p>"\ "<img source=\"ui/actions/File/Save.png\"><br> "\ "Saves the current file."\ "</p>" win.fileSaveAction.setWhatsThis( fileSaveText ) # Save File As fileSaveAsText = \ "<b>Save File As</b>"\ "<p>"\ "Allows the user to save the current .mmp file with a new name or."\ "in a different location"\ "</p>" win.fileSaveAsAction.setWhatsThis( fileSaveAsText ) # Import Molecular Machine Part fileInsertMmpActionText = \ "<b> Molecular Machine Part</b>"\ "<p>"\ "<img source=\"ui/actions/Insert/Molecular_Machine_Part.png\"><br> "\ "Inserts an existing .mmp file into the current part."\ "</p>" win.fileInsertMmpAction.setWhatsThis( fileInsertMmpActionText ) # Import Protein Data Bank File fileInsertPdbActionText = \ "<b> Protein Databank File</b>"\ "<p>"\ "Inserts an existing .pdb file into the current part."\ "</p>" win.fileInsertPdbAction.setWhatsThis( fileInsertPdbActionText ) # Import AMBER .in file fileInsertInActionText = \ "<b> AMBER .in file fragment</b>"\ "<p>"\ "Inserts a fragment of an AMBER .in file into the current part.<p>"\ "The fragment should just contain the lines defining the actual z-matrix. "\ "Loop closure bonds are not created, nor are bond orders inferred."\ "</p>" win.fileInsertInAction.setWhatsThis( fileInsertInActionText ) # Export Protein Data Bank File fileExportPdbActionText = \ "<b> Export Protein Databank File</b>"\ "<p>"\ "Saves the current .mmp model as a Protein Databank File"\ "</p>" win.fileExportPdbAction.setWhatsThis( fileExportPdbActionText ) # Export Jpeg File fileExportJpgActionText = \ "<b> Export JPEG File</b>"\ "<p>"\ "Saves the current .mmp model as a JPEG File"\ "</p>" win.fileExportJpgAction.setWhatsThis( fileExportJpgActionText ) # Export PNG File fileExportPngActionText = \ "<b> Export PNG File</b>"\ "<p>"\ "Saves the current .mmp model as a PNG File"\ "</p>" win.fileExportPngAction.setWhatsThis( fileExportPngActionText ) # Export POV-ray File fileExportPovActionText = \ "<b> Export POV-Ray File</b>"\ "<p>"\ "Saves the current .mmp model as a POV-Ray File"\ "</p>" win.fileExportPovAction.setWhatsThis( fileExportPovActionText ) # Export POV-ray File fileExportAmdlActionText = \ "<b> Export Animation Master Model</b>"\ "<p>"\ "Saves the current .mmp model as an Animation Master Model File"\ "</p>" win.fileExportAmdlAction.setWhatsThis( fileExportAmdlActionText ) # Exit fileExitActionText = \ "<b> Exit NanoEngineer-1</b>"\ "<p>"\ "Closes NanoEngineer-1"\ "<p>"\ "You will be prompted to save any current changes to the .mmp file"\ "</p>" win.fileExitAction.setWhatsThis( fileExitActionText ) # # Edit Toolbar # # Make Checkpoint ### editMakeCheckpointText = \ "<u><b>Make Checkpoint</b></u>"\ "<p>"\ "<img source=\"ui/actions/Edit/Make_CheckPoint.png\"><br> "\ "Make Undo checkpoint."\ "</p>" win.editMakeCheckpointAction.setWhatsThis( editMakeCheckpointText ) # Automatic Checkpointing ### [minor changes, bruce 060319] editAutoCheckpointingText = \ "<u><b>Automatic Checkpointing</b></u>"\ "<p>"\ "Enables/Disables <b>Automatic Checkpointing</b>. When enabled, "\ "the program maintains the Undo stack automatically. When disabled, "\ "the user is required to manually create Undo checkpoints using the "\ "<b>Make Checkpoint</b> button: "\ "</p>"\ "<p><img source=\"ui/actions/Edit/Make_CheckPoint.png\">"\ "</p>"\ "<p><b>Automatic Checkpointing</b> can impact program performance. "\ "By disabling Automatic Checkpointing, the program will run faster. "\ "</p>"\ "<p><b><i>Remember that you must make your own Undo checkpoints "\ "manually when Automatic Checkpointing is disabled.</i></b>"\ "</p>" win.editAutoCheckpointingAction.setWhatsThis( editAutoCheckpointingText ) # Clear Undo Stack ### [minor changes, bruce 060319] editClearUndoStackText = \ "<u><b>Clear Undo Stack</b></u>"\ "<p>"\ "Clears all checkpoints on the Undo and Redo "\ "stacks, freeing up memory."\ "</p>" win.editClearUndoStackAction.setWhatsThis( editClearUndoStackText ) # Undo editUndoText = \ "<u><b>Undo</b></u> (Ctrl + Z) "\ "<p>"\ "<img source=\"ui/actions/Edit/Undo.png\"><br> "\ "Reverses the last edit or command which changed structure "\ "or selection. "\ "</p>" #bruce 060317 revised this text to reflect #what it does in A7; 060320 added 1421-not-fixed warning win.editUndoAction.setWhatsThis( editUndoText ) win.editUndoText = editUndoText #bruce 060317 to help fix bug 1421 in #Undo whatsthis wiki help link # Redo from platform_dependent.PlatformDependent import is_macintosh if is_macintosh(): redo_accel = "(Ctrl + Shift + Z)" # note: this is further #modified (Ctrl -> Cmd) by other code # changing this is partly redundant with code in undo*.py, #but as of 060317 it's desirable in editRedoText too else: redo_accel = "(Ctrl + Y)" editRedoText = \ "<u><b>Redo</b></u> %s<br> "\ "<img source=\"ui/actions/Edit/Redo.png\"> <br>"\ "Restores a change which was undone using the Undo command."\ "<br><font color=\"#808080\">"\ "</p>" \ % redo_accel # This "known bug" (below) is no longer a bug, at least it works on Windows. # I'll ask someone with a MacOSX machine to test. --Mark 2008-05-05. #"Known bug: the link to wiki help for Redo "\ #"only works if you got this popup from the Edit menu item "\ #"for Redo, not from the Redo toolbutton. </font>"\ #"</p>" \ #% redo_accel #bruce 060317 revised this text to be more accurate, and split #out redo_accel; 060320 added 1421-not-fixed warning win.editRedoAction.setWhatsThis( editRedoText ) win.editRedoText = editRedoText #bruce 060317 to help fix bug 1421 #in Redo whatsthis wiki help link # Cut editCutText = \ "<u><b>Cut</b></u> (Ctrl + X) "\ "<p>"\ "<img source=\"ui/actions/Edit/Cut.png\"><br> "\ "Removes the selected object(s) and stores the cut data on the"\ "clipboard."\ "</p>" win.editCutAction.setWhatsThis( editCutText ) # Copy editCopyText = \ "<u><b>Copy</b></u> (Ctrl + C) "\ "<p>"\ "<img source=\"ui/actions/Edit/Copy.png\"><br> "\ "Places a copy of the selected chunk(s) on the clipboard "\ "while leaving the original chunk(s) unaffected."\ "</p>" win.editCopyAction.setWhatsThis( editCopyText ) # Paste editPasteText = \ "<u><b>Paste</b></u> (Ctrl + V) "\ "<p>"\ "<img source=\"ui/actions/Edit/Paste_On.png\"><br> "\ "<b>Paste</b> places the user in <b>Build</b> mode "\ "where copied chunks on the clipboard can be pasted into "\ "the model by double clicking in empty space. If the "\ "current clipboard chunk has a <b><i>hotspot</i></b>, "\ "it can be bonded to another chunk by single clicking on "\ "one of the chunk's bondpoints."\ "</p>"\ "<p>A <b><i>Hotspot</i></b> is a green bondpoint on a "\ "clipboard chunk indicating it will be the active "\ "bondpoint which will connect to another chunk's bondpoint. "\ "To specify a hotspot on the clipboard chunk, click on one "\ "of its bondpoints in the <b><i>MMKit's Thumbview</i></b>."\ "</p>" win.editPasteAction.setWhatsThis( editPasteText ) # Paste From Clipboard pasteFromClipboardText = \ "<u><b>Paste From Clipboard</b></u> "\ "<p>"\ "<img source=\"ui/actions/properties manager/clipboard-full.png\">"\ "<br> "\ "Allows the user to preview the contents of the "\ "clipboard and past items into the Workspace."\ "The preview window also allows the user to set "\ "hot spots on chunks."\ "</p>" win.pasteFromClipboardAction.setWhatsThis( pasteFromClipboardText ) win.editDnaDisplayStyleAction.setWhatsThis( """<b>Edit DNA Display Style</b> <p> <img source=\"ui/actions/Edit/EditDnaDisplayStyle.png\"> <br> Edit the DNA Display Style settings used whenever the <b>Global Display Style</b> is set to <i>DNA Cylinder</i>. These settings also apply to DNA strands and segments that have had their display style set to <i>DNA Cylinder</i>. </p>""") win.editProteinDisplayStyleAction.setWhatsThis( """<b>Edit Protein Display Style</b> <p> <img source=\"ui/actions/Edit/EditProteinDisplayStyle.png\"> <br> Edit the Protein Display Style settings used whenever the <b>Global Display Style</b> is set to <i>Protein</i>. </p>""") #Rename (deprecated by Rename Selection) EditrenameActionText = \ "<u><b>Rename</b></u> "\ "<p>"\ "<img source=\"ui/actions/Edit/Rename.png\">"\ "<br> "\ "Allows the user to rename the selected chunk "\ "</p>" win.editRenameAction.setWhatsThis( EditrenameActionText ) #Rename selection _text = \ "<u><b>Rename Selection</b></u> "\ "<p>"\ "<img source=\"ui/actions/Edit/Rename.png\">"\ "<br> "\ "Rename the selected object(s). Only leaf nodes in the model tree are "\ "renamed. Specifically, group nodes are not renamed, even if they are "\ "selected)."\ "</p>"\ "To uniquely name multiple objects, include the <b>#</b> character "\ "at the end of the name. This (re)numbers the selected objects."\ "</p>" win.editRenameSelectionAction.setWhatsThis( _text ) #editAddSuffixAction EditeditAddSuffixActionActionText = \ "<u><b>Add Suffix</b></u> "\ "<p>"\ "<img source=\"ui/actions/Edit/Add_Suffix.png\">"\ "<br> "\ "Add suffix to the name of the selected object(s)."\ "</p>" win.editAddSuffixAction.setWhatsThis( EditeditAddSuffixActionActionText ) # Delete editDeleteText = \ "<u><b>Delete</b></u> (DEL) "\ "<p>"\ "<img source=\"ui/actions/Edit/Delete.png\"><br> "\ "Deletes the selected object(s). "\ "For this Alpha release, deleted objects may "\ "be permanently lost, or they might be recoverable "\ "using Undo."\ "</p>" #bruce 060212 revised above text (and fixed spelling error); #should be revised again before A7 release win.editDeleteAction.setWhatsThis( editDeleteText ) # Color Scheme _text = \ "<u><b>Color Scheme</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/ColorScheme.png\"><br> "\ "Edit and save/restore favorite NanoEngineer-1 color schemes "\ "including background color, selection/highlight color, etc."\ "</p>" win.colorSchemeAction.setWhatsThis( _text ) # Lighting Scheme _text = \ "<u><b>Lighting Scheme</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/LightingScheme.png\"><br> "\ "Edit and save/restore favorite NanoEngineer-1 lighting schemes."\ "</p>" win.lightingSchemeAction.setWhatsThis( _text ) #Preferences Dialog editPrefsText = \ "<u><b>Preferences Dialog</b></u>"\ "<p>"\ "Allows you to edit various user preferences "\ "such as changing atom, bond display properties,"\ "lighting, background color, window position and"\ "size, plugins etc. </p>" win.editPrefsAction.setWhatsThis( editPrefsText ) # # View Toolbar # # Home View setViewHomeActionText = \ "<u><b>Home</b></u> (Home)"\ "<p>"\ "<img source=\"ui/actions/View/Modify/Home.png\"><br>"\ "When you create a new model, it appears in a "\ "default view orientation (FRONT view). When you "\ "open an existing model, it appears in the "\ "orientation it was last saved. You can change the "\ "default orientation by selecting <b>Set Home View "\ "to Current View</b> from the <b>View</b> menu."\ "</p>" win.setViewHomeAction.setWhatsThis( setViewHomeActionText ) # Zoom to fit setViewFitToWindowActionText = \ "<u><b>Zoom to Fit</b></u>"\ "<p><img source=\"ui/actions/View/Modify/Zoom_To_Fit.png\"><br> "\ "Refits the model to the screen so you can "\ "view the entire model."\ "</p>" win.setViewFitToWindowAction.setWhatsThis( setViewFitToWindowActionText ) # Recenter setViewRecenterActionText = \ "<u><b>Recenter</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Modify/Recenter.png\"><br> "\ "Changes the view center and zoom factor so "\ "that the origin is in the center of the view "\ "and you can view the entire model."\ "</p>" win.setViewRecenterAction.setWhatsThis( setViewRecenterActionText ) # Zoom to Area (used to be Zoom Tool). Mark 2008-01-29. setzoomToAreaActionText = \ "<u><b>Zoom to Area</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Modify/ZoomToArea.png\"><br> "\ "Allows the user to zoom into a specific area of "\ "the model by specifying a rectangular area. "\ "The area is specified by holding down the left button, "\ "dragging the mouse, and then releasing the mouse button."\ "</p>"\ "Pressing the <b>Escape</b> key exits Zoom to Area and returns to the"\ "previous command."\ "</p>"\ "<p>A mouse with a mouse wheel can also be used to "\ "zoom in/out."\ "</p>"\ "<p>The keyboard can also be used to zoom in/out:"\ "<br>- <b>Zoom in</b> by pressing the 'period' key ( '.' )."\ "<br>- <b>Zoom out</b> by pressing the 'comma' key ( ',' )."\ "</p>" win.zoomToAreaAction.setWhatsThis( setzoomToAreaActionText ) # Zoom (In/Out) setzoomInOutActionText = \ "<u><b>Zoom In/Out</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Modify/Zoom_In_Out.png\"><br> "\ "Enters a temporary zoom mode that allows the user to zoom in or out "\ "using the mouse. Press ESC or click this button again to exit "\ "temporary zoom mode and return to the previous command."\ "</p>"\ "<p>- <b>Zoom in</b> by holding down the mouse button and pulling "\ "the mouse closer (cursor moves down)."\ "<br>- <b>Zoom out</b> by holding the mouse button and pushing "\ "the mouse away (cursor moves up)."\ "</p>"\ "<p>A mouse with a mouse wheel can also be used to "\ "zoom in/out."\ "</p>"\ "<p>The keyboard can also be used to zoom in/out:"\ "<br>- <b>Zoom in</b> by pressing the 'period' key ( '.' )."\ "<br>- <b>Zoom out</b> by pressing the 'comma' key ( ',' )."\ "</p>" win.zoomInOutAction.setWhatsThis( setzoomInOutActionText ) #Zoom To Selection setViewZoomtoSelectionActionText = \ "<u><b>Zoom to Selection</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Modify/Zoom_To_Selection.png\"><br> "\ " Zooms view to selected atoms or chunks. "\ "</p>" win.setViewZoomtoSelectionAction.setWhatsThis\ ( setViewZoomtoSelectionActionText ) # Pan Tool setpanToolActionText = \ "<u><b>Pan Tool</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Modify/Pan.png\"><br> "\ "Allows X-Y panning using the left mouse button."\ "</p>"\ "Pressing the <b>Escape</b> key exits Pan Tool and returns to the"\ "previous command."\ "</p>"\ "<p>Users with a 3-button mouse can pan the model at "\ "any time by pressing the middle mouse button while "\ "holding down the Shift key."\ "</p>" win.panToolAction.setWhatsThis( setpanToolActionText ) # Rotate Tool setrotateToolActionText = \ "<u><b>Rotate Tool</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Modify/Rotate.png\"><br> "\ "Allows free rotation using the left mouse button."\ "</p>"\ "<p>Holding down the <b>A</b> key activates auto-rotation, which will "\ "continue rotation after releasing the mouse button (try it!)."\ "Pressing the <b>Escape</b> key exits Rotate Tool and returns to the"\ "previous command."\ "</p>"\ "<p>Users with a 3-button mouse can rotate the "\ "model at any time by pressing "\ "the middle mouse button and dragging "\ "the mouse."\ "</p>" win.rotateToolAction.setWhatsThis( setrotateToolActionText ) #Standard Views standardViews_btnText = \ "<u><b>Standard Views</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Standard_Views.png\"><br> "\ "Displays the Standards Views Menu "\ "</p>" win.standardViews_btn.setWhatsThis( standardViews_btnText ) # Orthographic Projection setViewOrthoActionText = \ "<u><b>Orthographic Projection</b></u>"\ "<p>"\ "Sets nonperspective (or parallel) projection, "\ "with no foreshortening."\ "</p>" win.setViewOrthoAction.setWhatsThis( setViewOrthoActionText ) # Perspective Projection setViewPerspecActionText = \ "<u><b>Perspective Projection</b></u>"\ "<p>"\ "Set perspective projection, drawing objects "\ "slightly larger that are closer to the viewer."\ "</p>" win.setViewPerspecAction.setWhatsThis( setViewPerspecActionText ) # Normal To viewNormalToActionText = \ "<u><b>Set View Normal To</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Set_View_Normal_To/\"><br> "\ "Orients view to the normal vector of the plane "\ "defined by 3 or more selected atoms, or a jig's "\ "axis."\ "</p>" win.viewNormalToAction.setWhatsThis( viewNormalToActionText ) # Parallel To _text = \ "<u><b>Set View Parallel To</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Set_View_Parallel_To.png\"><br> "\ "Orients view parallel to the vector defined by "\ "2 selected atoms."\ "</p>" win.viewParallelToAction.setWhatsThis( _text ) # Save Named View _text = \ "<u><b>Save Named View</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Modify/Save_Named_View.png\"><br> "\ "Saves the current view as a custom "\ "<b>named view</b> and places it in "\ "the Model Tree."\ "</p>" \ "<p>The view can be restored by selecting "\ "<b>Change View</b> from its context "\ "menu in the Model Tree."\ "</p>" win.saveNamedViewAction.setWhatsThis( _text ) # Front View _text = \ "<u><b>Front View</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Front.png\"><br> "\ "Orients the view to the Front View."\ "</p>" win.viewFrontAction.setWhatsThis( _text ) # Back View _text = \ "<u><b>Back View</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Back.png\"><br> "\ "Orients the view to the Back View."\ "</p>" win.viewBackAction.setWhatsThis( _text ) # Top View _text = \ "<u><b>Top View</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Top.png\"><br> "\ "Orients the view to the Top View."\ "</p>" win.viewTopAction.setWhatsThis( _text ) # Bottom View _text = \ "<u><b>Bottom View</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Bottom.png\"><br> "\ "Orients the view to the Bottom View."\ "</p>" win.viewBottomAction.setWhatsThis( _text ) # Left View _text = \ "<u><b>Left View</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Left.png\"><br> "\ "Orients the view to the Left View."\ "</p>" win.viewLeftAction.setWhatsThis( _text ) # Right View _text = \ "<u><b>Right View</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Right.png\"><br> "\ "Orients the view to the Right View."\ "</p>" win.viewRightAction.setWhatsThis( _text ) #Isometric View _text = \ "<u><b>IsometricView</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Isometric.png\"><br> "\ "Orients the view to the Isometric View."\ "</p>" win.viewIsometricAction.setWhatsThis( _text ) # Flip View Vertically _text = \ "<u><b>Flip View Vertically</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/FlipViewVert.png\"><br> "\ "Flip the view vertically."\ "</p>" win.viewFlipViewVertAction.setWhatsThis( _text ) # Flip View Horizontally _text = \ "<u><b>Flip View Horizontally</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/FlipViewHorz.png\"><br> "\ "Flip the view horizontally."\ "</p>" win.viewFlipViewHorzAction.setWhatsThis( _text ) # Rotate View +90 _text = \ """<u><b>Rotate View +90</b></u> <p> <img source=\"ui/actions/View/Rotate_View_+90.png\"><br> Increment the current view by 90 degrees around the vertical axis. </p>""" win.viewRotatePlus90Action.setWhatsThis( _text ) # Rotate View -90 _text = \ """<u><b>Rotate View -90</b></u> <p> <img source=\"ui/actions/View/Rotate_View_-90.png\"><br> Decrement the current view by 90 degrees around the vertical axis. </p>""" win.viewRotateMinus90Action.setWhatsThis( _text ) # Standard Views Menu (on View toolbar) _text = \ """<u><b>Standard Views</b></u> <p> <img source=\"ui/actions/View/Standard_Views.png\"><br> Menu of standard views. </p>""" win.standardViewsAction.setWhatsThis( _text) # View Manager (was Orientation Window) _text = \ """<u><b>Orientation View Manager</b></u> (Space) <p> <img source=\"ui/actions/View/Modify/Orientation.png\"><br> Opens the Orientation view manager window which provides a convenient way to quickly access standard and custom views. It is also used to manage <a href=Feature:Save_Named_View>Named Views</a>. </p>""" win.viewOrientationAction.setWhatsThis( _text ) # Set Current View to Home View _text = \ """<b>Replace Home View with current view</b> <p> Replaces the Home View with the current view.</p> <p> <img source=\"ui/whatsthis/HotTip.png\"><br> <b>Hot Tip:</b> Press the <b>Home key</b> to switch to the Home View at any time. </p>""" win.setViewHomeToCurrentAction.setWhatsThis( _text ) # Semi-Full Screen view viewSemiFullScreenActionText = \ "<b>Semi-Full Screen</b>"\ "<p>"\ "Sets display to semi-full screen. "\ "</p>" win.viewSemiFullScreenAction.setWhatsThis( viewSemiFullScreenActionText ) # Display Rulers viewRulersActionText = \ "<b>Display Rulers</b>"\ "<p>"\ "Turns on/off the rulers."\ "</p>" win.viewRulersAction.setWhatsThis( viewRulersActionText ) # Display Reports viewReportsActionText = \ "<b>Display Reports</b>"\ "<p>"\ "Toggles the display of the report window"\ "</p>" win.viewReportsAction.setWhatsThis( viewReportsActionText ) # Full Screen view viewFullScreenActionText = \ "<b>Full Screen</b>"\ "<p>"\ "Sets display to Full Screen "\ "</p>" win.viewFullScreenAction.setWhatsThis( viewFullScreenActionText ) # QuteMolX viewQuteMolActionText = \ "<u><b>QuteMolX</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/QuteMol.png\"><br> "\ "Opens the QuteMolX Properties Manager where the user can "\ "alter rendering styles and launch QutemolX."\ "</p>" \ "QuteMolX must be installed and enabled as a "\ "plug-in from <b>Preferences > Plug-ins</b> for "\ "this feature to work." \ "</p>" win.viewQuteMolAction.setWhatsThis( viewQuteMolActionText ) # POV-Ray (was Raytrace Scene) viewRaytraceSceneActionText = \ "<u><b>POV-Ray</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/Raytrace_Scene.png\"><br> "\ "Raytrace the current scene using POV-Ray. "\ "</p>" \ "POV-Ray must be installed and enabled as "\ "a plug-in from <b>Preferences > Plug-ins</b> "\ "for this feature to work." \ "</p>" win.viewRaytraceSceneAction.setWhatsThis( viewRaytraceSceneActionText ) # Stereo View viewStereoViewActionText = \ "<u><b>Stereo View</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Stereo_View.png\"><br> "\ "Displays the Stereo View Property Manager "\ "</p>" win.setStereoViewAction.setWhatsThis(viewStereoViewActionText) # # Insert toolbar # # Graphene _text = \ """<u><b>Build Graphene</b></u> <p> <img source=\"ui/actions/Tools/Build Structures/Graphene.png\"><br> Inserts a 2D sheet of graphene (centered at 0, 0, 0) based on the current parameters in the <a href=Property_Manager>property manager</a>. <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> Since this command <i>is not interactive</i> like most other modeling commands, the user must press the <b>Preview</b> button to insert the graphene structure into the model. The <b>Preview</b> button is located at the top of the <a href=Property_Manager>property manager</a> and looks like this: <br> <img source=\"ui/whatsthis/PreviewButton.png\"> </p>""" win.insertGrapheneAction.setWhatsThis( _text ) # Build Nanotube _text = \ "<u><b>Build Nanotube</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Structures/Nanotube.png\"> <br>"\ "Enters the carbon nanotube modeling sub-system. Nanotube modeling "\ "sub-commands are presented in the flyout area of the "\ "<a href=Command_Toolbar>command toolbar</a>."\ "</p>" win.buildNanotubeAction.setWhatsThis( _text ) # Build DNA _text = \ "<u><b>Build DNA</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Structures/DNA.png\"><br> "\ "Enters the DNA modeling sub-system. DNA modeling sub-commands are "\ "presented in the flyout area of the "\ "<a href=Command_Toolbar>command toolbar</a>."\ "</p>" win.buildDnaAction.setWhatsThis( _text ) # Build Protein _text = \ "<u><b>Build Protein</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Structures/Protein.png\"><br> "\ "Enters the protein/peptide modeling sub-system. Protein/peptide "\ "modeling sub-commands are presented in the flyout area of the "\ "<a href=Command_Toolbar>command toolbar</a>."\ "</p>" win.buildProteinAction.setWhatsThis( _text ) # POV-Ray Scene insertPovraySceneActionText = \ "<u><b>POV-Ray Scene</b></u>"\ "<p>"\ "<img source=\"ui/actions/POV-Ray_Scene.png\"><br> "\ "Inserts a POV-Ray Scene file based on the "\ "current model and viewpoint. "\ "</p>" win.insertPovraySceneAction.setWhatsThis(insertPovraySceneActionText ) # Part Library _text = \ "<u><b>Part Library</b></u>"\ "<p>"\ "<img source=\"ui/actions/Insert/Part_Library.png\"><br> "\ "Prompts the user to select an .mmp file from the NanoEngineer-1 "\ "Part Library to be inserted into the current part. "\ "</p>" win.partLibAction.setWhatsThis( _text ) # Comment _text = \ """<u><b>Comment</b></u> <p> <img source=\"ui/actions/Insert/Comment.png\"><br> Inserts a comment in the current part. </p>""" win.insertCommentAction.setWhatsThis( _text ) # Plane _text = \ """<u><b>Plane</b></u> <p> <img source=\"ui/actions/Insert/Reference Geometry/Plane.png\"><br> Inserts a plane into the <a href=Graphics_Area>graphics area</a>. </p>""" win.referencePlaneAction.setWhatsThis( _text ) # # Display toolbar # # Display Default dispDefaultActionText = \ "<u><b>Display Default</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/Default.png\"><br> "\ "Changes the <i>display setting</i> of the selection (i.e. selected "\ "atoms, chunks, DNA, etc.) to <b>Default</b>. Objects with their "\ "display setting set to <b>Default</b> are rendered in the "\ "<b>Global Display Style</b>. "\ "</p>"\ "<p>The current <b>Global Display Style</b> is displayed in the "\ "status bar in the lower right corner of the main window and can "\ "be changed from there."\ "</p>" win.dispDefaultAction.setWhatsThis(dispDefaultActionText ) # Display Invisible dispInvisActionText = \ "<u><b>Display Invisible</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/Invisible.png\"><br> "\ "Changes the <i>display setting</i> of selected atoms "\ "or chunks to <b>Invisible</b>, making them invisible."\ "</p>"\ "<p>If no atoms or chunks are selected, then this "\ "action will change the <b>Current Display Mode</b> "\ "of the 3D workspace to <b>Invisible</b>. All chunks "\ "with their display setting set to <b>Default</b> will"\ " inherit this display property."\ "</p>" win.dispInvisAction.setWhatsThis(dispInvisActionText ) # Display Lines dispLinesActionText = \ "<u><b>Display Lines</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/Lines.png\"><br> "\ "Changes the <i>display setting</i> of the selection (i.e. selected "\ "atoms, chunks, DNA, etc.) to <b>Lines</b> display style. "\ "Only bonds are rendered as colored lines. "\ "</p>"\ "<p>The thickness of bond lines can be changed from the <b>Bonds</b> "\ "page of the <b>Preferences</b> dialog."\ "</p>" win.dispLinesAction.setWhatsThis(dispLinesActionText ) # Display Tubes dispTubesActionText = \ "<u><b>Display Tubes</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/Tubes.png\"><br> "\ "Changes the <i>display setting</i> of the selection (i.e. selected "\ "atoms, chunks, DNA, etc.) to <b>Tubes</b> display style. "\ "Atoms and bonds are rendered as colored tubes."\ "</p>" win.dispTubesAction.setWhatsThis(dispTubesActionText ) # Display Ball and Stick dispBallActionText = \ "<u><b>Display Ball and Stick</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/Ball_and_Stick.png\"><br> "\ "Changes the <i>display setting</i> of the selection (i.e. selected "\ "atoms, chunks, DNA, etc.) to <b>Ball and Stick</b> display style. "\ "Atoms are rendered as spheres and bonds are rendered as narrow "\ "cylinders."\ "</p>"\ "<p>The scale of the spheres and cylinders can be "\ "changed from the <b>Atoms</b> and <b>Bonds</b> pages "\ "of the <b>Preferences</b> dialog."\ "</p>" win.dispBallAction.setWhatsThis(dispBallActionText ) # Display CPK # [bruce extended and slightly corrected text, 060307] _text = \ "<u><b>Display CPK</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/CPK.png\"><br> "\ "Changes the <i>display setting</i> of the selection (i.e. selected "\ "atoms, chunks, DNA, etc.) to <b>CPK</b> display style. Atoms are "\ "rendered as spheres with a size equal to 0.775 of their VdW radius, "\ "corresponding to a contact force of approximately 0.1 nN with "\ "neighboring nonbonded atoms. Bonds are not rendered."\ "</p>"\ "<p>The scale of the spheres can be changed from the "\ "<b>Atoms</b> page of the <b>Preferences</b> dialog."\ "</p>" win.dispCPKAction.setWhatsThis( _text ) # DNA Cylinder _text = \ "<u><b>Display DNA Cylinder</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/DNACylinder.png\"><br> "\ "Changes the <i>display setting</i> of the selection (i.e. selected "\ "DNA, etc.) to <b>DNA Cylinder</b> display style. DNA are rendered "\ "based on the settings found in the <b>DNA Cylinder Display Style "\ "Options</b> in the <b>DNA</b> page of the <b>Preferences</b> dialog."\ "</p>"\ "<p>Atoms and bonds are not rendered. This is considered a bug that "\ "will be fixed soon."\ "</p>" win.dispDnaCylinderAction.setWhatsThis( _text ) # Hide (Selection) _text = \ "<u><b>Hide</b></u> "\ "<p>"\ "<img source=\"ui/actions/View/Display/Hide.png\"><br> "\ "Hides the current selection. Works on atoms, chunks and/or any "\ "other object that can be hidden."\ "</p>" win.dispHideAction.setWhatsThis( _text ) # Unhide (Selection) unhideActionText = \ "<u><b>Unhide</b></u> "\ "<p>"\ "<img source=\"ui/actions/View/Display/Unhide.png\"><br> "\ "Unhides the current selection. Works on atoms, chunks and/or any "\ "other object that can be hidden.</p>"\ "<p>"\ "If a selected chunk is both hidden <i>and</i> contains invisible "\ "atoms, then the first unhide operation will unhide the chunk and "\ "the second unhide operation will unhide the invisible atoms inside "\ "the chunk."\ "</p>" win.dispUnhideAction.setWhatsThis(unhideActionText) # Display Cylinder dispCylinderActionText = \ "<u><b>Display Cylinder</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/Cylinder.png\"><br> "\ "Changes the <i>display setting</i> of selected "\ "chunks to <b>Cylinder</b> mode. Chunks are "\ "rendered as cylinders. "\ "</p>"\ "<p>If no chunks are selected, then this action "\ "will change the <b>Current Display Mode</b> of "\ "the 3D workspace to <b>Cylinder</b>. All chunks "\ "with their display setting set to <b>Default</b> "\ "will inherit this display property."\ "</p>" win.dispCylinderAction.setWhatsThis(dispCylinderActionText ) # Display Surface dispSurfaceActionText = \ "<u><b>Display Surface</b></u>"\ "<p>"\ "<img source=\"ui/actions/View/Display/Surface.png\"><br> "\ "Changes the <i>display setting</i> of selected "\ "chunks to <b>Surface</b> mode. Chunks are "\ "rendered as a smooth surface."\ "</p>"\ "<p>If no chunks are selected, then this action "\ "will change the <b>Current Display Mode</b> of "\ "the 3D workspace to <b>Surface</b>. All chunks "\ "with their display setting set to <b>Default</b>"\ " will inherit this display property."\ "</p>" win.dispSurfaceAction.setWhatsThis(dispSurfaceActionText ) # Reset Chunk Color dispResetChunkColorText = \ "<u><b>Reset Chunk Color</b></u>"\ "<p>"\ "<img source=\"ui/actions/Edit/Reset_Chunk_Color.png\"><br> "\ "Resets (removes) the user defined color of all selected chunks. "\ "All atoms and bonds in the chunk are rendered in their normal "\ "element colors."\ "</p>" win.resetChunkColorAction.setWhatsThis(dispResetChunkColorText ) # Reset Atoms Display dispResetAtomsDisplayText = \ "<u><b>Reset Atoms Display</b></u>"\ "Renders the selected atoms (or the atoms in the"\ "selected chunks) with the same display style as "\ "that of their parent chunk" win.dispResetAtomsDisplayAction.setWhatsThis(dispResetAtomsDisplayText) # Show Invisible Atoms dispShowInvisAtomsText = \ "<u><b>Show Invisible Atoms</b></u>"\ "Renders the selected atoms (or the atoms in the "\ "selected chunks) with the same display style as "\ " their parent chunk. However, if the parent chunk "\ "is set as invisible, this feature will not work." win.dispShowInvisAtomsAction.setWhatsThis(dispShowInvisAtomsText) #Element Color Settings Dialog dispElementColorSettingsText = \ "<u><b>Element Color Settings Dialog</b></u>"\ "Element colors can be manually changed " \ "using this dialog. Also, the user can load"\ "or save the element colors" win.dispElementColorSettingsAction.setWhatsThis\ (dispElementColorSettingsText) # # Select toolbar # # Select All selectAllActionText = \ "<u><b>Select All</b></u> (Ctrl + A)"\ "<p>"\ "<img source=\"ui/actions/Tools/Select/Select_All.png\"><br> "\ "When in <b>Build</b> mode, this will select all the "\ "atoms in the model. Otherwise, this will select all "\ "the chunks in the model."\ "</p>" win.selectAllAction.setWhatsThis(selectAllActionText ) # Select None selectNoneActionText = \ "<u><b>Select None</b></u></p>"\ "<p>"\ "<img source=\"ui/actions/Tools/Select/Select_None.png\"><br> "\ "Unselects everything currently selected. "\ "</p>" win.selectNoneAction.setWhatsThis(selectNoneActionText ) # InvertSelection selectInvertActionText = \ "<u><b>Invert Selection</b></u> (Ctrl + Shift + I)"\ "<p>"\ "<img source=\"ui/actions/Tools/Select/Select_Invert.png\"><br> "\ "Inverts the current selection."\ "</p>" win.selectInvertAction.setWhatsThis(selectInvertActionText ) # Select Connected selectConnectedActionText = \ "<u><b>Select Connected</b></u> (Ctrl + Shift + C)"\ "<p>"\ "<img source=\"ui/actions/Tools/Select/Select_Connected.png\"><br> "\ "Selects all the atoms that can be reached by "\ "the currently selected atom via an unbroken "\ "chain of bonds. </p>"\ "<p>"\ "<p>You can also select all connected atoms by "\ "double clicking on an atom or bond while in "\ "<b>Build</b> mode.</p>" win.selectConnectedAction.setWhatsThis(selectConnectedActionText ) # Select Doubly selectDoublyActionText = \ "<u><b>Select Doubly</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Select/Select_Doubly.png\"><br> "\ "Selects all the atoms that can be reached from a "\ "currently selected atom through two disjoint "\ "unbroken chains of bonds. Atoms singly connected "\ "to this group and unconnected to anything else "\ "are also included in the selection."\ "</p>" win.selectDoublyAction.setWhatsThis(selectDoublyActionText ) # Expand Selection selectExpandActionText = \ "<u><b>Expand Selection</b></u> (Ctrl + D)"\ "<p>"\ "<img source=\"ui/actions/Tools/Select/Expand.png\"><br> "\ "Selects any atom that is a neighbor of a "\ "currently selected atom."\ "</p>" win.selectExpandAction.setWhatsThis(selectExpandActionText ) # Contract Selection selectContractActionText = \ "<u><b>Contract Selection</b></u> "\ "(Ctrl + Shift + D)"\ "<p>"\ "<img source=\"ui/actions/Tools/Select/Contract.png\"><br> "\ "Deselects any atom that is a neighbor of a "\ "non-picked atom or has a bondpoint."\ "</p>" win.selectContractAction.setWhatsThis(selectContractActionText ) # Selection Lock _text = \ """<u><b>Selection Lock</b></u> (Ctrl + L) <p> <img source=\"ui/actions/Tools/Select/Selection_Unlocked.png\"> (off) <img source=\"ui/actions/Tools/Select/Selection_Locked.png\"> (on)<br> Toggles the mouse <i>Selection Lock</i> on and off. </p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> When enabled, selection operations using the mouse (i.e. clicks and region selections) are disabled in the <a href=Graphics_Area>graphics area</a>. All other selection commands available via toolbars, menus, the model tree and keyboard shortcuts are not affected when the Selection Lock is turned on. </p>""" win.selectLockAction.setWhatsThis( _text ) # # Modify Toolbar # # Adjust Selection modifyAdjustSelActionText = \ "<u><b>Adjust Selection</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Adjust_Selection.png\"><br> "\ "Adjusts the atom and bond positions (<i>of the "\ "selection</i>) to make the geometry more "\ "realistic. The operations used to move the "\ "atoms and bonds approximate molecular mechanics"\ " methods."\ "</p>" win.modifyAdjustSelAction.setWhatsThis(modifyAdjustSelActionText ) # Adjust All modifyAdjustAllActionText = \ "<u><b>Adjust All</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Adjust_All.png\"><br> "\ "Adjusts the atom and bond positions (<i>of the"\ " entire part</i>) to make the geometry of the "\ " part more realistic. The operations used to "\ "move the atoms and bonds approximate molecular "\ "mechanics methods."\ "</p>" win.modifyAdjustAllAction.setWhatsThis(modifyAdjustAllActionText ) # Hydrogenate modifyHydrogenateActionText = \ "<u><b>Hydrogenate</b></u>"\ "<P>"\ "<img source=\"ui/actions/Tools/Build Tools/Hydrogenate.png\"><br> "\ "Adds hydrogen atoms to all the bondpoints in "\ "the selection.</p>" win.modifyHydrogenateAction.setWhatsThis(modifyHydrogenateActionText ) # Dehydrogenate modifyDehydrogenateActionText = \ "<u><b>Dehydrogenate</b></u>"\ "<P>"\ "<img source=\"ui/actions/Tools/Build Tools/Dehydrogenate.png\"><br> "\ "Removes all hydrogen atoms from the "\ "selection.</p>" win.modifyDehydrogenateAction.setWhatsThis(modifyDehydrogenateActionText ) # Passivate modifyPassivateActionText = \ "<u><b>Passivate</b></u>"\ "<P>"\ "<img source=\"ui/actions/Tools/Build Tools/Passivate.png\"><br> "\ "Changes the types of incompletely bonded atoms "\ "to atoms with the right number of bonds, using"\ " atoms with the best atomic radius."\ "</p>" win.modifyPassivateAction.setWhatsThis(modifyPassivateActionText ) # Stretch modifyStretchActionText = \ "<u><b>Stretch</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Tools/Stretch.png\"><br> "\ "Stretches the bonds of the selected chunk(s).</p>" win.modifyStretchAction.setWhatsThis(modifyStretchActionText ) # Delete Bonds modifyDeleteBondsActionText = \ "<u><b>Cut Bonds</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Tools/Delete_Bonds.png\"><br> "\ "Delete all bonds between selected and unselected atoms or chunks.</p>" win.modifyDeleteBondsAction.setWhatsThis(modifyDeleteBondsActionText ) # Separate/New Chunk modifySeparateActionText = \ "<u><b>Separate</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Tools/Separate.png\"><br> "\ "Creates a new chunk(s) from the currently "\ "selected atoms. If the selected atoms belong to different "\ "chunks, multiple new chunks are created.</p>" win.modifySeparateAction.setWhatsThis(modifySeparateActionText ) # New Chunk makeChunkFromSelectedAtomsActionText = \ "<u><b>New Chunk</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Tools/New_Chunk.png\"><br> "\ "Creates a new chunk from the currently selected atoms. "\ "All atoms end up in a single chunk.</p>" win.makeChunkFromSelectedAtomsAction.setWhatsThis\ (makeChunkFromSelectedAtomsActionText ) # Combine Chunks modifyMergeActionText = \ "<u><b>Combine Chunks</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Tools/Combine_Chunks.png\"><br> "\ "Combines two or more chunks into a single chunk.</p>" win.modifyMergeAction.setWhatsThis(modifyMergeActionText ) # Invert Chunks modifyInvertActionText = \ "<u><b>Invert</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Tools/Invert.png\"><br> "\ "Inverts the atoms of the selected chunks.</p>" win.modifyInvertAction.setWhatsThis(modifyInvertActionText ) # Mirror Selected Chunks #Note that the the feature name is intentionally kept "Mirror" instead of #"Mirror Chunks" because # in future we will support mirrroing atoms as well. -- ninad060814 modifyMirrorActionText = \ "<u><b>Mirror</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Tools/Mirror.png\"><br> "\ "Mirrors the selected <b> chunks </b> about a "\ "reference Grid or Plane.<br>" win.modifyMirrorAction.setWhatsThis(modifyMirrorActionText ) win.toolsMoveMoleculeAction.setWhatsThis( """<u><b>Translate</b></u> <p> <img source=\"ui/actions/Command Toolbar/MoveCommands/Translate.png\"><br> Translate the selection interactively. Special translation options are provided in the <a href=Property_Manager>property manager</a>.</p> """) win.rotateComponentsAction.setWhatsThis( """<u><b>Rotate</b></u> <p> <img source=\"ui/actions/Command Toolbar/MoveCommands/Rotate.png\"><br> Rotate the selection interactively. Special rotation options are provided in the <a href=Property_Manager>property manager</a>.</p> """) # Align to Common Axis modifyAlignCommonAxisActionText = \ "<u><b>Align To Common Axis</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Tools/"\ "AlignToCommonAxis.png\"><br> "\ "Aligns one or more chunks to the axis of the first selected chunk. "\ "You must select two or more chunks before using this feature."\ "</p>" win.modifyAlignCommonAxisAction.setWhatsThis\ ( modifyAlignCommonAxisActionText ) #Center on Common Axis modifyCenterCommonAxisActionText = \ "<u><b>Center On Common Axis</b></u>"\ "<p>"\ "<b> Moves</b> all selected chunks to "\ "the center of the <b> first </b> "\ "selected chunk and also <b>aligns</b> "\ "them to the axis of the first one . You "\ "must select two or more chunks before "\ "using this feature. </p>" win.modifyCenterCommonAxisAction.setWhatsThis\ (modifyCenterCommonAxisActionText) # # Tools Toolbar # # Select Chunks toolsSelectMoleculesActionText = \ "<u><b>Select Chunks</b></u><!-- [[Feature:Select Chunks Mode]] -->"\ "<p>"\ "<img source=\"ui/cursors/SelectArrowCursor.png\"><br> "\ "<b>Select Chunks</b> allows you to select/unselect chunks with the "\ "mouse.</p>"\ "<p>"\ "<b><u>Mouse/Key Combinations</u></b></p>"\ "<p><b>Left Click/Drag</b> - selects a chunk(s).</p>"\ "<p>"\ "<b>Ctrl+Left Click/Drag</b> - removes chunk(s) from selection.</p>"\ "<p>"\ "<b>Shift+Left Click/Drag</b> - adds chunk(s) to selection."\ "</p>" win.toolsSelectMoleculesAction.setWhatsThis\ ( toolsSelectMoleculesActionText ) # Build Atoms toolsDepositAtomActionText = \ "<u><b>Build Atoms</b></u><!-- [[Feature:Build Atoms]] -->"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Structures/BuildAtoms.png\"><br> "\ "Enters the atom modeling sub-system for building/editing molecular "\ "structures. Atom (and bond) modeling sub-commands are presented in the "\ "flyout area of the <a href=Command_Toolbar>command toolbar</a>."\ "</p>" win.toolsDepositAtomAction.setWhatsThis( toolsDepositAtomActionText ) # Build Crystal toolsCookieCutActionText = \ "<u><b>Build Crystal</b></u><!-- [[Feature:Build Crystal Mode]] -->"\ "<p>"\ "<img source=\"ui/actions/Tools/Build Structures/Cookie_Cutter.png\"><br>"\ "Enters the Crystal modeling sub-system which provides an interactive "\ "modeling environment for cutting out multi-layered shapes from slabs "\ "of diamond or lonsdaleite 3D lattice. Crystal modeling sub-commands "\ "are presented in the flyout area of the "\ "<a href=Command_Toolbar>command toolbar</a>."\ "</p>" win.buildCrystalAction.setWhatsThis( toolsCookieCutActionText ) # Extrude _text = \ """<u><b>Extrude</b></u><!-- [[Feature:Extrude Mode]] --><br> <p> <img source=\"ui/actions/Insert/Features/Extrude.png\"><br> Creates rod or ring structures from one or more (selected) molecular fragments as a <i>repeating unit</i>. Extrude can also be used to create linear (rod) or circular (ring) patterns from the current selection.</p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> Something must be selected (i.e. the repeating unit) before entering this command. </p>""" win.toolsExtrudeAction.setWhatsThis( _text ) # Fuse Chunks _text = \ """<u><b>Fuse Chunks Mode</b></u> <!-- [[Feature:Fuse Chunks Mode]] --> <p> <img source=\"ui/actions/Tools/Build Tools/Fuse_Chunks.png\"><br> Fuses two or more chunks. Two fusing options are supported:</[> <p> <b>Make Bonds</b>:<br> creates bonds between <a href=Bondpoints>bondpoints</a> of the selected chunk and any other chunks within bonding distance. Bondpoints are highlighted and lines are drawn (and undrawn) as chunks are moved interactively to indicate bonding relationships between bondpoints. Bondpoints with too many bonding relationships are highlighted in magenta and will not make bonds.</p> <p> <b>Fuse Atoms</b>:<br> fuses pairs of overlapping atoms between chunks. The overlapping atoms in the selected chunk(s) are highlighted in green while the atoms that will be deleted in non-selected chunks are highlighted in dark red. </p> <p> <img source=\"ui/whatsthis/HotTip.png\"><br> <b>Hot Tip:</b> This command can be very slow for large models with lots of atoms. To improve preformance, use <b>Hide</b> to hide everything you don't need before entering this command. After you are done, select all nodes in the model tree (or click <b>Select All</b>) and click <b>Unhide</b>. </p>""" win.toolsFuseChunksAction.setWhatsThis( _text ) # # Simulator Toolbar # # Minimize Energy simMinimizeEnergyActionText = \ "<u><b>Minimize Energy</b></u>"\ "<p>"\ "<img source=\"ui/actions/Simulation/Minimize_Energy.png\"><br> "\ "The potential energy of a chemical structure "\ "is a function of the relative positions of "\ "its atoms. To obtain this energy with "\ "complete accuracy involves a lot of computer "\ "time spent on quantum mechanical "\ "calculations, which cannot be practically "\ "done on a desktop computer. To get an "\ "approximate potential energy without all "\ "that, we represent the energy as a series "\ "of terms involving geometric properties of "\ "the structure: lengths of chemical bonds, "\ "angles between pairs and triples of chemical "\ "bonds, etc. </p>" \ "<p>" \ "As is generally the case with physical "\ "systems, the gradient of the potential "\ "energy represents the forces acting on "\ "various particles. The atoms want to move in "\ "the direction that most reduces the "\ "potential energy. Energy minimization is a "\ "process of adjusting the atom positions to "\ "try to find a global minimum of the "\ "potential energy. Each atom "\ "contributes three variables (its x, y, and z"\ " coordinates) so the search space is "\ "multi-dimensional. The global minimum is the "\ "configuration that the atoms will settle "\ "into if lowered to zero Kelvin. </p>" win.simMinimizeEnergyAction.setWhatsThis( simMinimizeEnergyActionText ) checkAtomTypesActionText = \ "<u><b>Check AMBER AtomTypes</b></u>"\ "<p>"\ "Shows which AtomTypes will be assigned to each atom when the AMBER force field is in use."\ "</p>" win.checkAtomTypesAction.setWhatsThis( checkAtomTypesActionText ) # Change Chunk Color dispObjectColorActionText = \ "<u><b>Edit Color</b></u>"\ "<p>"\ "<img source=\"ui/actions/Edit/Edit_Color.png\"><br> "\ "Allows the user to change the color of all selected chunks and/or "\ "jigs (i.e. rotary and linear motors)."\ "</p>" win.dispObjectColorAction.setWhatsThis( dispObjectColorActionText ) # Run Dynamics (was NanoDynamics-1). Mark 060807. _text = \ """<u><b>Run Dynamics</b></u> <p> <img source=\"ui/actions/Simulation/RunDynamics.png\"><br> Opens the dialog for running <b>NanoDynamics-1</b>, the native molecular dynamics simulator for NanoEngineer-1. <b>NanoDynamics-1</b> creates a trajectory (movie) file by calculating the inter-atomic potentials and bonding of the entire model.</p> """ win. simSetupAction.setWhatsThis( _text ) # Simulation Jigs simulationJigsActionText = \ "<u><b>Simulation Jigs</b></u>"\ "<p>"\ "<img source=\"ui/actions/Simulation/SimulationJigs.png\"><br> "\ "Drop down menu for adding rotary motors, linear motors and "\ "other jigs used to simulate structures"\ "</p>" win.simulationJigsAction.setWhatsThis( simulationJigsActionText ) # Play Movie (was Movie Player) Mark 060807. _text = \ """<u><b>Play Movie</b></u> <p> <img source=\"ui/actions/Simulation/PlayMovie.png\"><br> Plays the most recent trajectory (movie) file created by the NanoEngineer-1 molecular dynamics simulator. To create a movie file, select <b>Run Dynamics</b>.</p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> You must first have created a movie file to play it. </p>""" win. simMoviePlayerAction.setWhatsThis( _text ) # Make Graphs (was Plot Tool) Mark 060807. _text = \ """<u><b>Plot Graphs</b></u> <p> <img source=\"ui/actions/Simulation/PlotGraphs.png\"><br> Plot a graph from a NanoDynamics-1 simulation trace file using GNUplot.</p> <p> The following list of jigs write data to the trace file:</p> <p> <b>Rotary Motors:</b> speed (GHz) and torque (nn-nm)<br> <b>Linear Motors:</b> displacement (pm)<br> <b>Anchors:</b> torque (nn-nm)<br> <b>Thermostats:</b> energy added (zJ)<br> <b>Thermometer:</b> temperature (K)<br> <b>Measure Distance:</b> distance (angstroms)<br> <b>Measure Angle:</b> angle (degrees)<br> <b>Measure Dihedral:</b> dihedral (degrees)<br> </p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> A NanoDynamics-1 simulation must have been run to create and plot a trace file <i><b>and</b></i> the part must have at least one of the jigs listed above which writes data to the trace file. </p>""" win. simPlotToolAction.setWhatsThis( _text ) # # Jigs # # Anchor _text = \ """<u><b>Anchor</b></u> <p> <img source=\"ui/actions/Simulation/Anchor.png\"><br> Attaches an <b>Anchor</b> to the selected atoms. Anchors, AKA <i>grounds</i> in other molecular dynamics programs, constrains an atom's motion during minimization or simulation runs.</p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> You must be in the <b>Build Atoms</b> command to create anchors since this is the only command that allows the user to select individual atoms. Simply select the atom(s) you want to anchor and then select this command. Anchors are drawn as a black wireframe box around each selected atom.</p> """ win.jigsAnchorAction.setWhatsThis( _text ) # Rotary Motor _text = \ """<u><b>Rotary Motor</b></u> <p> <img source=\"ui/actions/Simulation/RotaryMotor.png\"><br> Attaches a <b>Rotary Motor</b> to the selected atoms. The Rotary Motor is used by the simulator to apply rotary motion to a set of atoms during a simulation run. You may specify the <b>torque (in nN*nm)</b> and <b>speed (in Ghz)</b> of the motor.</p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> You must be in the <b>Build Atoms</b> command to create motors since this is the only command that allows the user to select individual atoms. Simply select the atoms you want to attach a motor to and then select this command.</p> """ win.jigsMotorAction.setWhatsThis( _text ) # Linear Motor _text = \ """<u><b>Linear Motor</b></u> <p> <img source=\"ui/actions/Simulation/LinearMotor.png\"><br> Attaches a <b>Linear Motor</b> to the selected atoms. The Linear Motor is used by the simulator to apply linear motion to a set of atoms during a simulation run. You may specify the <b>force (in nN*nm)</b> and <b>stiffness (in N/m)</b> of the motor.</p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> You must be in the <b>Build Atoms</b> command to create motors since this is the only command that allows the user to select individual atoms. Simply select the atoms you want to attach a motor to and then select this command.</p> """ win.jigsLinearMotorAction.setWhatsThis( _text ) # Thermostat _text = \ """<u><b>Thermostat</b></u> <p> <img source=\"ui/actions/Simulation/Thermostat.png\"><br> Attaches a <b>Langevin Thermostat</b> to a single selected atom, thereby associating the thermostat to the entire molecule of which the selected atom is a member. The user specifies the temperature (in Kelvin).</p> <p> The Langevin Thermostat is used to set and hold the temperature of a molecule during a simulation run.</p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> You must be in the <b>Build Atoms</b> command to create a Langevin Thermostat since this is the only command that allows the user to select individual atoms. Simply select a single atom you want to attach the thermostat to and then select this command. The thermostat is drawn as a blue wireframe box around the selected atom.</p> """ win.jigsStatAction.setWhatsThis( _text ) # Thermometer _text = \ """<u><b>Thermometer</b></u> <p> <img source=\"ui/actions/Simulation/Measurements/Thermometer.png\"><br> "\ Attaches a <b>Thermometer</b> to a single selected atom, thereby associating the themometer to the entire molecule of which the selected atom is a member.</p> <p> The temperature of the molecule will be recorded and written to a trace file during a simulation run.</p> <p> <img source=\"ui/whatsthis/Remember.png\"><br> <b>Remember:</b> You must be in the <b>Build Atoms</b> command to create a Thermometer since this is the only command that allows the user to select individual atoms. Simply select a single atom you want to attach the thermometer to and then select this command. The thermometer is drawn as a dark red wireframe box around the selected atom.</p> """ win.jigsThermoAction.setWhatsThis( _text ) # ESP Image jigsESPImageActionText = \ "<u><b>ESP Image</b></u>"\ "<p>"\ "<img source=\"ui/actions/Simulation/ESP_Image.png\"><br> "\ "An <b>ESP Image</b> allows the user to visualize "\ "the electrostatic potential of points on the face "\ "of a square 2D surface. Nano-Hive's MPQC ESP "\ "Plane plug-in is used to calculate the "\ "electrostatic potential."\ "</p>"\ "<p>To create an ESP Image, enter <b>Build</b> "\ "mode, select three or more atoms and then select "\ "this jig. The ESP Image is drawn as a plane with "\ "a bounding volume."\ "</p>" win.jigsESPImageAction.setWhatsThis(jigsESPImageActionText ) # Atom Set jigsAtomSetActionText = \ "<u><b>Atom Set</b></u>"\ "<p>"\ "<img source=\"ui/actions/Tools/Atom_Set.png\"><br> "\ "An <b>Atom Set</b> jig provides a convienient way "\ "to save an atom selection which can be reselected "\ "later."\ "</p>"\ "<p>To create an Atom Set, enter <b>Build</b> mode, "\ "select any number of atoms and then select this "\ "jig. The Atom Set is drawn as a set of wireframe "\ "boxes around each atom in the selection."\ "</p>"\ "<p>To reselect the atoms in an Atom Set, select "\ "it's context menu in the Model Tree and click the "\ "menu item that states "\ "<b>Select this jig's atoms</b>."\ "</p>" win.jigsAtomSetAction.setWhatsThis(jigsAtomSetActionText ) # Measure Distance jigsDistanceActionText = \ "<u><b>Measure Distance Jig</b></u>"\ "<p>"\ "<img source=\"ui/actions/Simulation/Measurements/"\ "Measure_Distance.png\">"\ "<br> "\ "A <b>Measure Distance Jig</b> functions as a "\ "dimension to display the distance between two "\ "atoms."\ "</p>"\ "<p>To create the Measure Distance Jig, enter "\ "<b>Build</b> mode, select two atoms and then "\ "select this jig. The Measure Distance Jig is "\ "drawn as a pair of wireframe boxes around each "\ "atom connected by a line and a pair of numbers. "\ "The first number is the distance between the "\ "VdW radii (this can be a negative number for "\ "atoms that are close together). The second number "\ "is the distance between the nuclei."\ "</p>"\ "<p>The Measure Distance Jig will write the two "\ "distance values to the trace file for each frame "\ "of a simulation run and can be plotted using the "\ "Plot Tool."\ "</p>" win.jigsDistanceAction.setWhatsThis(jigsDistanceActionText ) # Measure Angle jigsAngleActionText = \ "<u><b>Measure Angle Jig</b></u>"\ "<p>"\ "<img source=\"ui/actions/Simulation/Measurements/" \ "Measure_Angle.png\"><br> "\ "A <b>Measure Angle Jig</b> functions as a dimension "\ "to display the angle between three atoms."\ "</p>"\ "<p>To create the Measure Angle Jig, enter "\ "<b>Build</b> mode, select three atoms and then "\ "select this jig. The Measure Angle Jig is "\ "drawn as a set of wireframe boxes around each atom "\ "and a number which is the angle between the three "\ "atoms."\ "</p>"\ "<p>The Measure Angle Jig will write the angle value "\ "to the trace file "\ "for each frame of a simulation run and can be "\ "plotted using the Plot Tool."\ "</p>" win.jigsAngleAction.setWhatsThis(jigsAngleActionText ) # Measure Dihedral jigsDihedralActionText = \ "<u><b>Measure Dihedral Jig</b></u>"\ "<p>"\ "<img source=\"ui/actions/Simulation/Measurements/"\ "Measure_Dihedral.png\">"\ "<br> "\ "A <b>Measure Dihedral Jig</b> functions as a "\ "dimension to display the dihedral angle of a four"\ " atom sequence."\ "</p>"\ "<p>To create the Measure Dihedral Jig, enter "\ "<b>Build</b> mode, select four atoms and then "\ "select this jig. The Measure Dihedral Jig is "\ "drawn as a set of wireframe boxes around each "\ "atom and a number which is the dihedral angle "\ "value."\ "</p>"\ "<p>The Measure Dihedral Jig will write the "\ "dihedral angle value to the trace file "\ "for each frame of a simulation run and can be "\ "plotted using the Plot Tool."\ "</p>" win.jigsDihedralAction.setWhatsThis(jigsDihedralActionText ) # GAMESS Jig jigsGamessActionText = \ "<u><b>GAMESS Jig</b></u>"\ "<p>"\ "<img source=\"ui/actions/Simulation/Gamess.png\"><br> "\ "A <b>GAMESS Jig</b> is used to tag a set of atoms "\ "for running a GAMESS calculation. <b>Energy</b> "\ "and <b>Geometry Optimization</b> calculations are "\ "supported."\ "</p>"\ "<p>To create the GAMESS Jig, enter <b>Build</b> mode, "\ "select the atoms to tag and then select this jig. "\ "The GAMESS Jig is drawn as a set of magenta "\ "wireframe boxes around each atom."\ "</p>" win.jigsGamessAction.setWhatsThis(jigsGamessActionText ) # Grid Plane Jig jigsGridPlaneActionText = \ "<u><b>Grid Plane</b></u>"\ "<p>"\ "<img source=\"ui/actions/Insert/Reference Geometry/"\ "Grid_Plane.png\"><br> "\ "A <b>Grid Plane</b> jig is a rectanglar plane "\ "that can display a square or SiC grid within its "\ "boundary. It is often used as an aid in "\ "constructing large lattice structures made of "\ "silicon carbide (SiC). It is also used as a "\ "visual aid in estimating distances between atoms "\ "and/or other structures."\ "</p>"\ "<p>To create the Grid Plane jig, enter"\ "<b>Build</b> mode, select three or more atoms "\ "and then select this jig. "\ "</p>"\ "<p>The Grid Plane jig is drawn as a rectanglar "\ "plane with a grid."\ "</p>" win.jigsGridPlaneAction.setWhatsThis(jigsGridPlaneActionText ) # # Help Toolbar # # What's This _text = \ "<u><b>Enter \"What's This\" mode</b></u>"\ "<p>"\ "<img source=\"ui/actions/Help/WhatsThis.png\"><br> "\ "This invokes \"What's This?\" help mode which is part of NanoEngineer-1's "\ "online help system, and provides users with information about the "\ "functionality and usage of a particular command button or widget.</p>" win.helpWhatsThisAction.setWhatsThis( _text ) win.helpMouseControlsAction.setWhatsThis("Displays help for mouse controls") win.helpKeyboardShortcutsAction.setWhatsThis("Displays help for keyboard"\ "shortcuts") win.helpSelectionShortcutsAction.setWhatsThis("Displays help for selection"\ " controls") win.helpGraphicsCardAction.setWhatsThis("Displays information for the"\ " computer's graphics card") win.helpAboutAction.setWhatsThis("Displays information about this version"\ " of NanoEngineer-1") # # Status bar # # Global Display Style combobox _text = \ "<u><b>Global Display Style</b></u>"\ "<p>"\ "Use this widget to change the <b>Global Display Style</b>."\ "</p>"\ "Objects with their display setting set to <b>Default</b> are "\ "rendered in the <b>Global Display Style</b>."\ "</p>" win.statusBar().globalDisplayStylesComboBox.setWhatsThis( _text ) def create_whats_this_descriptions_for_NanoHive_dialog(w): "Create What's This descriptions for the Nano-Hive dialog widgets." # MPQC Electrostatics Potential Plane MPQCESPText = \ "<u><b>MPQC Electrostatics Potential Plane</b></u>"\ "Enables the <i>MPQC Electrostatics Potential Plane</i> "\ "plugin. "\ "</p>" w.MPQC_ESP_checkbox.setWhatsThis(MPQCESPText ) MPQCESPTipText = "Enables/disables MPQC Electrostatics "\ "Potential Plane Plugin" w.MPQC_ESP_checkbox.setToolTip(MPQCESPTipText) def whats_this_text_for_glpane(): """ Return a What's This description for a GLPane. """ #bruce 080912 moved this here from part of a method in class GLPane import sys if sys.platform == "darwin": # TODO: figure out how to get fix_whatsthis_text_and_links to handle # this for us (like it does for most whatsthis text). # The href link herein also doesn't work (at least on my Mac). # For more info see comments from today in other files. # [bruce 081209 comment] ctrl_or_cmd = "Cmd" else: ctrl_or_cmd = "Ctrl" glpaneText = \ "<a href=Graphics_Area><b>Graphics Area</b></a><br> "\ "<br>This is where the action is."\ "<p><b>Mouse Button Commands :</b><br> "\ "<br> "\ "<b>Left Mouse Button (LMB)</b> - Select<br> "\ "<b>LMB + Shift</b> - add to current selection <br> "\ "<b>LMB + " + ctrl_or_cmd + "</b> - remove from current selection <br> "\ "<b>LMB + Shift + " + ctrl_or_cmd + "</b> - delete highlighted object <br> "\ "<br> "\ "<b>Middle Mouse Button (MMB)</b> - Rotate view <br> "\ "<b>MMB + Shift</b> - Pan view <br> "\ "<b>MMB + " + ctrl_or_cmd + "</b> - Rotate view around the point of view (POV) <br> "\ "<br> "\ "<b>Right Mouse Button (RMB)</b> - Display context-sensitive menus <br>"\ "<br> "\ "<b>Mouse Wheel</b> - Zoom in/out (configurable from Preference settings)"\ "</p>" return glpaneText # end
NanoCAD-master
cad/src/ne1_ui/WhatsThisText_for_MainWindow.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: Created on 2008-11-06 TODO: Created as a part of a NFR by Mark on Nov 6, 2008. This is a quick implementation subjected to a number of changes / revisions. """ import foundation.env as env from PyQt4.Qt import QToolButton from PyQt4.Qt import QPalette from PyQt4.Qt import QTextOption from PyQt4.Qt import QLabel from PyQt4.Qt import QAction, QMenu from PyQt4.Qt import Qt, SIGNAL from PM.PM_Colors import getPalette from PM.PM_Colors import sequenceEditStrandMateBaseColor from PM.PM_DockWidget import PM_DockWidget from PM.PM_WidgetRow import PM_WidgetRow from PM.PM_ToolButton import PM_ToolButton from PM.PM_ComboBox import PM_ComboBox from PM.PM_TextEdit import PM_TextEdit from PM.PM_LineEdit import PM_LineEdit from PM.PM_PushButton import PM_PushButton from PM.PM_SpinBox import PM_SpinBox from PM.PM_SelectionListWidget import PM_SelectionListWidget from PM.PM_DnaSearchResultTable import PM_DnaSearchResultTable from utilities.icon_utilities import geticon, getpixmap from utilities.prefs_constants import dnaSearchTypeLabelChoice_prefs_key from widgets.prefs_widgets import connect_comboBox_with_pref _superclass = PM_DockWidget class SelectNodeByNameDockWidget(PM_DockWidget): """ The Ui_DnaSequenceEditor class defines UI elements for the Sequence Editor object. The sequence editor is usually visible while in DNA edit mode. It is a DockWidget that is doced at the bottom of the MainWindow """ _title = "Select Node by Name" _groupBoxCount = 0 _lastGroupBox = None def __init__(self, win): """ Constructor for the Ui_DnaSequenceEditor @param win: The parentWidget (MainWindow) for the sequence editor """ self.win = win parentWidget = win _superclass.__init__(self, parentWidget, title = self._title) win.addDockWidget(Qt.BottomDockWidgetArea, self) self.setFixedHeight(120) ##self.setFixedWidth(90) self.connect_or_disconnect_signals(True) if not self.win.selectByNameAction.isChecked(): self.close() def show(self): """ Overrides superclass method. """ _superclass.show(self) val = env.prefs[dnaSearchTypeLabelChoice_prefs_key] self.searchTypeComboBox_indexChanged(val) def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be overridden in subclasses. By default it does nothing. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect self._listWidget.connect_or_disconnect_signals(isConnect) change_connect( self.searchToolButton, SIGNAL("clicked()"), self.searchNodes) prefs_key = dnaSearchTypeLabelChoice_prefs_key connect_comboBox_with_pref(self.searchTypeComboBox, prefs_key ) change_connect( self.searchTypeComboBox, SIGNAL("currentIndexChanged(int)"), self.searchTypeComboBox_indexChanged) def searchTypeComboBox_indexChanged(self, val): if val == 0: ##self._widgetRow1.show() ##self._widgetRow2.hide() self._widgetRow1.setEnabled(True) self._widgetRow2.setEnabled(False) else: ##self._widgetRow2.show() ##self._widgetRow1.hide() self._widgetRow2.setEnabled(True) self._widgetRow1.setEnabled(False) def searchNodes(self): """ ONLY implemented for DnaStrand or DnaSegments. """ assy = self.win.assy topnode = assy.part.topnode lst = [] def func(node): if isinstance(node, assy.DnaStrandOrSegment): lst.append(node) topnode.apply2all(func) choice = env.prefs[dnaSearchTypeLabelChoice_prefs_key] if choice == 0: nodes = self._searchNodesByName(lst) elif choice == 1: nodes = self._searchNodesByNucleotides(lst) self._listWidget.insertItems( row = 0, items = nodes) def _searchNodesByNucleotides(self, nodeList): lst = nodeList min_val = self._nucleotidesSpinBox_1.value() max_val = self._nucleotidesSpinBox_2.value() if min_val > max_val: print "Lower value for number of nucleotides exceeds max search value" return () def func2(node): n = node.getNumberOfNucleotides() return (n >= min_val and n <= max_val) return filter(lambda m:func2(m), lst) def _searchNodesByName(self, nodeList): nodeNameString = self.findLineEdit.text() nodeNameString = str(nodeNameString) lst = nodeList def func2(node): n = len(nodeNameString) if len(node.name)< n: return False nameString = str(node.name[:n]) if nameString.lower() == nodeNameString.lower(): return True return False return filter(lambda m:func2(m), lst) def closeEvent(self, event): self.win.selectByNameAction.setChecked(False) _superclass.closeEvent(self, event) def _loadWidgets(self): """ Overrides PM.PM_DockWidget._loadWidgets. Loads the widget in this dockwidget. """ self._loadMenuWidgets() self._loadTableWidget() def _loadTableWidget(self): self._listWidget = PM_DnaSearchResultTable(self, self.win) def _loadMenuWidgets(self): """ Load the various menu widgets (e.g. Open, save sequence options, Find and replace widgets etc. """ #Note: Find and replace widgets might be moved to their own class. self.searchTypeComboBox = \ PM_ComboBox( self, label = "Search options:", choices = ["By node name", "By # of bases (DNA only)"], setAsDefault = True) #Find widgets -- self._nucleotidesSpinBox_1 = PM_SpinBox(self, label = "", value = 10, setAsDefault = False, singleStep = 10, minimum = 1, maximum = 50000) self._nucleotidesSpinBox_2 = PM_SpinBox(self, label = "", value = 50, setAsDefault = False, singleStep = 10, minimum = 1, maximum = 50000) self.findLineEdit = \ PM_LineEdit( self, label = "", spanWidth = False) self.findLineEdit.setMaximumWidth(80) self.findOptionsToolButton = PM_ToolButton(self) self.findOptionsToolButton.setMaximumWidth(12) self.findOptionsToolButton.setAutoRaise(True) ##self.findOptionsToolButton.setPopupMode(QToolButton.MenuButtonPopup) ##self._setFindOptionsToolButtonMenu() self.searchToolButton = PM_ToolButton( self, iconPath = "ui/actions/Properties Manager/Find_Next.png") self.searchToolButton.setAutoRaise(False) self.warningSign = QLabel(self) self.warningSign.setPixmap( getpixmap('ui/actions/Properties Manager/Warning.png')) self.warningSign.hide() self.phraseNotFoundLabel = QLabel(self) self.phraseNotFoundLabel.setText("Not Found") self.phraseNotFoundLabel.hide() # NOTE: Following needs cleanup in the PM_WidgetRow/ PM_WidgetGrid # but this explanation is sufficient until thats done -- # When the widget type starts with the word 'PM_' , the # PM_WidgetRow treats it as a well defined widget and thus doesn't try # to create a QWidget object (or its subclasses) # This is the reason why qLabels such as self.warningSign and # self.phraseNotFoundLabel are defined as PM_Labels and not 'QLabels' # If they were defined as 'QLabel'(s) then PM_WidgetRow would have # recreated the label. Since we want to show/hide the above mentioned # labels (and if they were recreated as mentioned above), # we would have needed to define those something like this: # self.phraseNotFoundLabel = widgetRow._widgetList[-2] #Cleanup in PM_widgetGrid could be to check if the widget starts with #'Q' instead of 'PM_' #Widgets to include in the widget row. widgetList1 = [ ('QLabel', " Search for name:", 1), ('PM_LineEdit', self.findLineEdit, 2), ('PM_ToolButton', self.findOptionsToolButton, 3), ('PM_ToolButton', self.searchToolButton, 4), ('PM_Label', self.warningSign, 5), ('PM_Label', self.phraseNotFoundLabel, 6), ('QSpacerItem', 5, 5, 7) ] widgetList2 = [ ('QLabel', " Number of bases: >=", 1), ('PM_SpinBox', self._nucleotidesSpinBox_1, 2), ('QLabel', " <=", 3), ('PM_SpinBox', self._nucleotidesSpinBox_2, 4), ('QSpacerItem', 5, 5, 5)] widgetList3 = [ ('QSpacerItem', 5, 5, 1), ('PM_ToolButton', self.searchToolButton, 2), ('PM_Label', self.warningSign, 3), ('PM_Label', self.phraseNotFoundLabel, 4), ('QSpacerItem', 5, 5, 5) ] self._widgetRow1 = PM_WidgetRow(self, title = '', widgetList = widgetList1, label = "", spanWidth = True ) self._widgetRow2 = PM_WidgetRow(self, title = '', widgetList = widgetList2, label = "", spanWidth = True ) self._widgetRow3 = PM_WidgetRow(self, title = '', widgetList = widgetList3, label = "", spanWidth = True )
NanoCAD-master
cad/src/ne1_ui/SelectNodeByNameDockWidget.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ Ui_MainWindowWidgetConnections.py Creates all signal-slot connections for all Main Window widgets used in menus and toolbars. @author: Mark @version: $Id$ @copyright: 2004-2007 Nanorex, Inc. See LICENSE file for details. History: 2007-12-23: Moved all connect() calls from MWsemantics to here. """ from PyQt4 import QtCore from PyQt4.Qt import SIGNAL def setupUi(win): """ Create all connects for all Main Window widgets used in menus and toolbars. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.connect(win.dispBallAction,SIGNAL("triggered()"),win.dispBall) win.connect(win.dispDefaultAction,SIGNAL("triggered()"),win.dispDefault) win.connect(win.dispElementColorSettingsAction,SIGNAL("triggered()"),win.dispElementColorSettings) win.connect(win.dispInvisAction,SIGNAL("triggered()"),win.dispInvis) win.connect(win.dispLightingAction,SIGNAL("triggered()"),win.dispLighting) win.connect(win.dispLinesAction,SIGNAL("triggered()"),win.dispLines) win.connect(win.dispObjectColorAction,SIGNAL("triggered()"),win.dispObjectColor) win.connect(win.resetChunkColorAction,SIGNAL("triggered()"),win.dispResetChunkColor) win.connect(win.dispResetAtomsDisplayAction,SIGNAL("triggered()"),win.dispResetAtomsDisplay) win.connect(win.dispShowInvisAtomsAction,SIGNAL("triggered()"),win.dispShowInvisAtoms) win.connect(win.dispTubesAction,SIGNAL("triggered()"),win.dispTubes) win.connect(win.dispCPKAction,SIGNAL("triggered()"),win.dispCPK) win.connect(win.dispHideAction,SIGNAL("triggered()"),win.dispHide) win.connect(win.dispUnhideAction,SIGNAL("triggered()"),win.dispUnhide) win.connect(win.dispHybridAction,SIGNAL("triggered()"),win.dispHybrid) win.connect(win.editAutoCheckpointingAction,SIGNAL("toggled(bool)"),win.editAutoCheckpointing) win.connect(win.editClearUndoStackAction,SIGNAL("triggered()"),win.editClearUndoStack) win.connect(win.editCopyAction,SIGNAL("triggered()"),win.editCopy) win.connect(win.editCutAction,SIGNAL("triggered()"),win.editCut) win.connect(win.editDeleteAction,SIGNAL("triggered()"),win.killDo) win.connect(win.editMakeCheckpointAction,SIGNAL("triggered()"),win.editMakeCheckpoint) win.connect(win.editPasteAction,SIGNAL("triggered()"),win.editPaste) win.connect(win.editDnaDisplayStyleAction, SIGNAL("triggered()"), win.enterDnaDisplayStyleCommand) win.connect(win.editProteinDisplayStyleAction, SIGNAL("triggered()"), win.enterProteinDisplayStyleCommand) # editRenameAction deprecated. Use editRenameSelection. Mark 2008-11-13. #win.connect(win.editRenameAction,SIGNAL("triggered()"),win.editRename) win.connect(win.editRenameSelectionAction,SIGNAL("triggered()"),win.editRenameSelection) win.connect(win.editAddSuffixAction,SIGNAL("triggered()"),win.editAddSuffix) win.connect(win.pasteFromClipboardAction, SIGNAL("triggered()"), win.editPasteFromClipboard ) win.connect(win.partLibAction, SIGNAL("triggered()"), win.insertPartFromPartLib) win.connect(win.viewFullScreenAction, SIGNAL("toggled(bool)"), win.setViewFullScreen) win.connect(win.viewSemiFullScreenAction, SIGNAL("toggled(bool)"), win.setViewSemiFullScreen) win.connect(win.viewReportsAction, SIGNAL("toggled(bool)"), win.reportsDockWidget.toggle) win.connect(win.viewRulersAction, SIGNAL("toggled(bool)"), win.toggleRulers) #Urmi background color chooser option 080522 win.connect(win.colorSchemeAction, SIGNAL("triggered()"), win.colorSchemeCommand) win.connect(win.lightingSchemeAction, SIGNAL("triggered()"), win.lightingSchemeCommand) win.connect(win.editPrefsAction,SIGNAL("triggered()"),win.editPrefs) win.connect(win.editRedoAction,SIGNAL("triggered()"),win.editRedo) win.connect(win.editUndoAction,SIGNAL("triggered()"),win.editUndo) #= Connections for the "File" menu and toolbar widgets. win.connect(win.fileCloseAction, SIGNAL("triggered()"), win.fileClose) win.connect(win.fileExitAction, SIGNAL("triggered()"), win.close) win.connect(win.fileOpenAction, SIGNAL("triggered()"), win.fileOpen) win.connect(win.fileSaveAction, SIGNAL("triggered()"), win.fileSave) win.connect(win.fileSaveAsAction, SIGNAL("triggered()"), win.fileSaveAs) win.connect(win.fileSaveSelectionAction, SIGNAL("triggered()"), win.fileSaveSelection) win.connect(win.fileSetWorkingDirectoryAction, SIGNAL("triggered()"), win.fileSetWorkingDirectory) win.connect(win.fileInsertMmpAction, SIGNAL("triggered()"), win.fileInsertMmp) win.connect(win.fileInsertPdbAction, SIGNAL("triggered()"), win.fileInsertPdb) win.connect(win.fileInsertInAction, SIGNAL("triggered()"), win.fileInsertIn) win.connect(win.fileExportQuteMolXPdbAction, SIGNAL("triggered()"), win.fileExportQuteMolXPdb) win.connect(win.fileExportPdbAction, SIGNAL("triggered()"), win.fileExportPdb) win.connect(win.fileFetchPdbAction, SIGNAL("triggered()"), win.fileFetchPdb) win.connect(win.fileExportJpgAction, SIGNAL("triggered()"), win.fileExportJpg) win.connect(win.fileExportPngAction, SIGNAL("triggered()"), win.fileExportPng) win.connect(win.fileExportPovAction, SIGNAL("triggered()"), win.fileExportPov) win.connect(win.fileExportAmdlAction, SIGNAL("triggered()"), win.fileExportAmdl) win.connect(win.helpTutorialsAction,SIGNAL("triggered()"),win.helpTutorials) win.connect(win.helpAboutAction,SIGNAL("triggered()"),win.helpAbout) win.connect(win.helpGraphicsCardAction,SIGNAL("triggered()"),win.helpGraphicsCard) win.connect(win.helpKeyboardShortcutsAction,SIGNAL("triggered()"),win.helpKeyboardShortcuts) win.connect(win.helpSelectionShortcutsAction,SIGNAL("triggered()"),win.helpSelectionShortcuts) win.connect(win.helpMouseControlsAction,SIGNAL("triggered()"),win.helpMouseControls) win.connect(win.helpWhatsThisAction,SIGNAL("triggered()"),win.helpWhatsThis) win.connect(win.buildDnaAction,SIGNAL("triggered()"),win.activateDnaTool) win.connect(win.buildNanotubeAction,SIGNAL("triggered()"),win.activateNanotubeTool) win.connect(win.insertCommentAction,SIGNAL("triggered()"),win.insertComment) win.connect(win.insertGrapheneAction,SIGNAL("triggered()"),win.insertGraphene) win.connect(win.jigsAnchorAction,SIGNAL("triggered()"),win.makeAnchor) win.connect(win.jigsAngleAction,SIGNAL("triggered()"),win.makeMeasureAngle) win.connect(win.jigsAtomSetAction,SIGNAL("triggered()"),win.makeAtomSet) win.connect(win.jigsDihedralAction,SIGNAL("triggered()"),win.makeMeasureDihedral) win.connect(win.jigsDistanceAction,SIGNAL("triggered()"),win.makeMeasureDistance) win.connect(win.jigsESPImageAction,SIGNAL("triggered()"),win.makeESPImage) win.connect(win.jigsGamessAction,SIGNAL("triggered()"),win.makeGamess) win.connect(win.jigsGridPlaneAction,SIGNAL("triggered()"),win.makeGridPlane) win.connect(win.referencePlaneAction,SIGNAL("triggered()"), win.createPlane) win.connect(win.referenceLineAction,SIGNAL("triggered()"), win.createPolyLine) win.connect(win.jigsLinearMotorAction, SIGNAL("triggered()"), win.makeLinearMotor) win.connect(win.jigsMotorAction, SIGNAL("triggered()"), win.makeRotaryMotor) win.connect(win.jigsStatAction,SIGNAL("triggered()"),win.makeStat) win.connect(win.jigsThermoAction,SIGNAL("triggered()"),win.makeThermo) win.connect(win.modifyAlignCommonAxisAction,SIGNAL("triggered()"),win.modifyAlignCommonAxis) win.connect(win.modifyCenterCommonAxisAction,SIGNAL("triggered()"),win.modifyCenterCommonAxis) win.connect(win.modifyDehydrogenateAction,SIGNAL("triggered()"),win.modifyDehydrogenate) win.connect(win.modifyDeleteBondsAction,SIGNAL("triggered()"),win.modifyDeleteBonds) win.connect(win.modifyHydrogenateAction,SIGNAL("triggered()"),win.modifyHydrogenate) win.connect(win.modifyInvertAction,SIGNAL("triggered()"),win.modifyInvert) win.connect(win.modifyMergeAction,SIGNAL("triggered()"),win.modifyMerge) win.connect(win.makeChunkFromSelectedAtomsAction, SIGNAL("triggered()"),win.makeChunkFromAtom) win.connect(win.modifyAdjustAllAction,SIGNAL("triggered()"),win.modifyAdjustAll) win.connect(win.modifyAdjustSelAction,SIGNAL("triggered()"),win.modifyAdjustSel) win.connect(win.modifyPassivateAction,SIGNAL("triggered()"),win.modifyPassivate) win.connect(win.modifySeparateAction,SIGNAL("triggered()"),win.modifySeparate) win.connect(win.modifyStretchAction,SIGNAL("triggered()"),win.modifyStretch) win.connect(win.panToolAction,SIGNAL("toggled(bool)"),win.panTool) win.connect(win.rotateToolAction,SIGNAL("toggled(bool)"),win.rotateTool) win.connect(win.saveNamedViewAction,SIGNAL("triggered()"),win.saveNamedView) win.connect(win.selectAllAction,SIGNAL("triggered()"),win.selectAll) win.connect(win.selectConnectedAction,SIGNAL("triggered()"),win.selectConnected) win.connect(win.selectContractAction,SIGNAL("triggered()"),win.selectContract) win.connect(win.selectDoublyAction,SIGNAL("triggered()"),win.selectDoubly) win.connect(win.selectExpandAction,SIGNAL("triggered()"),win.selectExpand) win.connect(win.selectInvertAction,SIGNAL("triggered()"),win.selectInvert) win.connect(win.selectNoneAction,SIGNAL("triggered()"),win.selectNone) win.connect(win.selectLockAction,SIGNAL("toggled(bool)"),win.selectLock) win.connect(win.selectByNameAction,SIGNAL("toggled(bool)"),win.toggle_selectByNameDockWidget) ##win.connect(win.helpTipAction,SIGNAL("triggered()"), win.toggleQuickHelpTip) win.connect(win.viewOrientationAction,SIGNAL("toggled(bool)"),win.showOrientationWindow) #ninad061114 ##When Standard Views button is clicked, show its QMenu.-- By default, nothing happens if you click on the ##toolbutton with submenus. The menus are displayed only when you click on the small downward arrow ## of the tool button. Therefore the following slot is added. Also QWidgetAction is used ## for it to add this feature (see Ui_ViewToolBar for details) ninad 070109 win.connect(win.standardViews_btn,SIGNAL("pressed()"),win.showStandardViewsMenu) win.connect(win.viewBackAction,SIGNAL("triggered()"),win.viewBack) win.connect(win.viewBottomAction,SIGNAL("triggered()"),win.viewBottom) win.connect(win.setViewFitToWindowAction,SIGNAL("triggered()"),win.setViewFitToWindow) win.connect(win.viewFrontAction,SIGNAL("triggered()"),win.viewFront) win.connect(win.setViewHomeAction,SIGNAL("triggered()"),win.setViewHome) win.connect(win.setViewHomeToCurrentAction,SIGNAL("triggered()"),win.setViewHomeToCurrent) win.connect(win.viewLeftAction,SIGNAL("triggered()"),win.viewLeft) win.connect(win.viewRotateMinus90Action,SIGNAL("triggered()"),win.viewRotateMinus90) win.connect(win.viewNormalToAction,SIGNAL("triggered()"),win.viewNormalTo) win.connect(win.viewFlipViewVertAction,SIGNAL("triggered()"),win.viewFlipViewVert) win.connect(win.viewFlipViewHorzAction,SIGNAL("triggered()"),win.viewFlipViewHorz) win.connect(win.setViewOrthoAction,SIGNAL("triggered()"),win.setViewOrtho) win.connect(win.viewParallelToAction,SIGNAL("triggered()"),win.viewParallelTo) win.connect(win.setViewPerspecAction,SIGNAL("triggered()"),win.setViewPerspec) win.connect(win.viewRotatePlus90Action,SIGNAL("triggered()"),win.viewRotatePlus90) win.connect(win.setViewRecenterAction,SIGNAL("triggered()"),win.setViewRecenter) win.connect(win.viewRightAction,SIGNAL("triggered()"),win.viewRight) win.connect(win.viewTopAction,SIGNAL("triggered()"),win.viewTop) win.connect(win.simMoviePlayerAction,SIGNAL("triggered()"),win.simMoviePlayer) win.connect(win.simNanoHiveAction,SIGNAL("triggered()"),win.simNanoHive) win.connect(win.simPlotToolAction,SIGNAL("triggered()"),win.simPlot) win.connect(win.simSetupAction,SIGNAL("triggered()"),win.simSetup) win.connect(win.rosettaSetupAction,SIGNAL("triggered()"),win.rosettaSetup) win.connect(win.buildCrystalAction,SIGNAL("triggered()"), win.enterBuildCrystalCommand) win.connect(win.setStereoViewAction,SIGNAL("triggered()"),win.stereoSettings) win.connect(win.toolsDepositAtomAction, SIGNAL("triggered()"), win.toolsBuildAtoms) win.connect(win.toolsExtrudeAction,SIGNAL("triggered()"),win.toolsExtrude) win.connect(win.toolsFuseChunksAction,SIGNAL("triggered()"),win.toolsFuseChunks) #Move and Rotate Components mode win.connect(win.toolsMoveMoleculeAction,SIGNAL("triggered()"),win.toolsMoveMolecule) win.connect(win.rotateComponentsAction,SIGNAL("triggered()"),win.toolsRotateComponents) win.connect(win.toolsSelectMoleculesAction,SIGNAL("triggered()"),win.toolsSelectMolecules) win.connect(win.zoomToAreaAction,SIGNAL("toggled(bool)"),win.zoomToArea) win.connect(win.zoomInOutAction,SIGNAL("toggled(bool)"),win.zoomInOut) win.connect(win.viewQuteMolAction,SIGNAL("triggered()"),win.viewQuteMol) win.connect(win.viewRaytraceSceneAction,SIGNAL("triggered()"),win.viewRaytraceScene) win.connect(win.insertPovraySceneAction,SIGNAL("triggered()"),win.insertPovrayScene) win.connect(win.dispSurfaceAction,SIGNAL("triggered()"),win.dispSurface) win.connect(win.dispCylinderAction,SIGNAL("triggered()"),win.dispCylinder) win.connect(win.dispDnaCylinderAction,SIGNAL("triggered()"),win.dispDnaCylinder) win.connect(win.simMinimizeEnergyAction,SIGNAL("triggered()"),win.simMinimizeEnergy) win.connect(win.checkAtomTypesAction,SIGNAL("triggered()"),win.modifyCheckAtomTypes) win.connect(win.fileImportOpenBabelAction, SIGNAL("triggered()"), win.fileOpenBabelImport) win.connect(win.fileImportIOSAction, SIGNAL("triggered()"), win.fileIOSImport) win.connect(win.fileExportOpenBabelAction, SIGNAL("triggered()"), win.fileOpenBabelExport) win.connect(win.fileExportIOSAction, SIGNAL("triggered()"), win.fileIOSExport) win.connect(win.viewIsometricAction,SIGNAL("triggered()"),win.viewIsometric) win.connect(win.modifyMirrorAction,SIGNAL("triggered()"),win.modifyMirror) win.connect(win.setViewZoomtoSelectionAction,SIGNAL("triggered()"),win.setViewZoomToSelection) # Atom Generator example for developers. Mark and Jeff. 2007-06-13 #@ Jeff - add a link to the public wiki page when ready. Mark 2007-06-13. win.connect(win.insertAtomAction,SIGNAL("triggered()"),win.insertAtom) win.connect(win.buildProteinAction,SIGNAL("triggered()"),win.activateProteinTool) QtCore.QObject.connect(win.fileExitAction, QtCore.SIGNAL("activated()"), win.close)
NanoCAD-master
cad/src/ne1_ui/Ui_MainWindowWidgetConnections.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ Ui_MainWindowWidgets.py Creates all widgets use by the Main Window, including: - QAction used as menu items for menus in the main menu bar - QActions, QToolButtons, etc. in main toolbars - QAction for the Command toolbar @author: Mark @version: $Id$ @copyright: 2004-2007 Nanorex, Inc. See LICENSE file for details. History: 2007-12-23: Moved all QActions from menu and toolbar setupUi() functions here. """ import foundation.env as env from PyQt4 import QtGui from PyQt4.Qt import QToolButton from utilities.icon_utilities import geticon from utilities.prefs_constants import displayRulers_prefs_key from ne1_ui.NE1_QWidgetAction import NE1_QWidgetAction # Dock widgets from ne1_ui.Ui_ReportsDockWidget import Ui_ReportsDockWidget def setupUi(win): """ Creates all the QActions used in the main menubar and toolbars. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ MainWindow = win # Create the NE1 main menu bar. win.MenuBar = QtGui.QMenuBar(MainWindow) win.MenuBar.setEnabled(True) win.MenuBar.setObjectName("MenuBar") #= File (menu and toolbar) widgets. # Create the "File" menu. win.fileMenu = QtGui.QMenu(win.MenuBar) win.fileMenu.setObjectName("fileMenu") # Create the "Import" menu, a submenu of the "File" menu. win.importMenu = QtGui.QMenu(win.fileMenu) win.importMenu.setObjectName("importMenu") # Create the "Export" menu, a submenu of the "File" menu. win.exportMenu = QtGui.QMenu(win.fileMenu) win.exportMenu.setObjectName("exportMenu") #Create the "Fetch" menu, a submenu of file menu win.fetchMenu = QtGui.QMenu(win.fileMenu) win.fetchMenu.setObjectName("fetchMenu") win.fileOpenAction = QtGui.QAction(MainWindow) win.fileOpenAction.setIcon(geticon("ui/actions/File/Open.png")) win.fileOpenAction.setObjectName("fileOpenAction") win.fileCloseAction = QtGui.QAction(MainWindow) win.fileCloseAction.setObjectName("fileCloseAction") win.fileSaveAction = QtGui.QAction(MainWindow) win.fileSaveAction.setIcon(geticon("ui/actions/File/Save.png")) win.fileSaveAction.setObjectName("fileSaveAction") win.fileSaveAsAction = QtGui.QAction(MainWindow) win.fileSaveAsAction.setObjectName("fileSaveAsAction") win.fileImportOpenBabelAction = QtGui.QAction(MainWindow) win.fileImportOpenBabelAction.setObjectName("fileImportOpenBabelAction") win.fileImportIOSAction = QtGui.QAction(MainWindow) win.fileImportIOSAction.setObjectName("fileImportIOSAction") win.fileFetchPdbAction = QtGui.QAction(MainWindow) win.fileFetchPdbAction.setObjectName("fileFetchPdbAction") win.fileExportPdbAction = QtGui.QAction(MainWindow) win.fileExportPdbAction.setObjectName("fileExportPdbAction") win.fileExportQuteMolXPdbAction = QtGui.QAction(MainWindow) win.fileExportQuteMolXPdbAction.setObjectName("fileExportQuteMolXPdbAction") win.fileExportJpgAction = QtGui.QAction(MainWindow) win.fileExportJpgAction.setObjectName("fileExportJpgAction") win.fileExportPngAction = QtGui.QAction(MainWindow) win.fileExportPngAction.setObjectName("fileExportPngAction") win.fileExportPovAction = QtGui.QAction(MainWindow) win.fileExportPovAction.setObjectName("fileExportPovAction") win.fileExportAmdlAction = QtGui.QAction(MainWindow) win.fileExportAmdlAction.setObjectName("fileExportAmdlAction") win.fileExportOpenBabelAction = QtGui.QAction(MainWindow) win.fileExportOpenBabelAction.setObjectName("fileExportOpenBabelAction") win.fileExportIOSAction = QtGui.QAction(MainWindow) win.fileExportIOSAction.setObjectName("fileExportIOSAction") # This action (i.e. the "Set Working Directory" menu item) was removed from # the File menu for Alpha 9 since it was deemed undesireable. # If you want a full explanation, ask me. Mark 2007-12-30. win.fileSetWorkingDirectoryAction = QtGui.QAction(MainWindow) win.fileSetWorkingDirectoryAction.setObjectName("fileSetWorkingDirectoryAction") win.fileExitAction = QtGui.QAction(MainWindow) win.fileExitAction.setObjectName("fileExitAction") # "Save Selection" is not implemented yet (NIY). Mark 2007-12-20. win.fileSaveSelectionAction = QtGui.QAction(MainWindow) win.fileSaveSelectionAction.setObjectName("fileSaveSelectionAction") #= Edit (menu and toolbar) widgets. # Create the "Edit" menu. win.editMenu = QtGui.QMenu(win.MenuBar) win.editMenu.setObjectName("editMenu") win.editUndoAction = QtGui.QAction(MainWindow) win.editUndoAction.setIcon(geticon("ui/actions/Edit/Undo.png")) win.editUndoAction.setVisible(True) win.editUndoAction.setObjectName("editUndoAction") win.editRedoAction = QtGui.QAction(MainWindow) win.editRedoAction.setChecked(False) win.editRedoAction.setIcon(geticon("ui/actions/Edit/Redo.png")) win.editRedoAction.setVisible(True) win.editRedoAction.setObjectName("editRedoAction") win.editMakeCheckpointAction = QtGui.QAction(MainWindow) win.editMakeCheckpointAction.setIcon( geticon("ui/actions/Edit/Make_Checkpoint.png")) win.editMakeCheckpointAction.setObjectName("editMakeCheckpointAction") win.editAutoCheckpointingAction = QtGui.QAction(MainWindow) win.editAutoCheckpointingAction.setCheckable(True) win.editAutoCheckpointingAction.setChecked(True) win.editAutoCheckpointingAction.setObjectName("editAutoCheckpointingAction") win.editClearUndoStackAction = QtGui.QAction(MainWindow) win.editClearUndoStackAction.setObjectName("editClearUndoStackAction") win.editCutAction = QtGui.QAction(MainWindow) win.editCutAction.setEnabled(True) win.editCutAction.setIcon(geticon("ui/actions/Edit/Cut.png")) win.editCutAction.setObjectName("editCutAction") win.editCopyAction = QtGui.QAction(MainWindow) win.editCopyAction.setEnabled(True) win.editCopyAction.setIcon(geticon("ui/actions/Edit/Copy.png")) win.editCopyAction.setObjectName("editCopyAction") win.editPasteAction = QtGui.QAction(MainWindow) win.editPasteAction.setIcon(geticon("ui/actions/Edit/Paste_Off.png")) win.editPasteAction.setObjectName("editPasteAction") win.pasteFromClipboardAction = QtGui.QAction(MainWindow) win.pasteFromClipboardAction.setIcon(geticon( "ui/actions/Properties Manager/clipboard-full.png")) win.pasteFromClipboardAction.setObjectName("pasteFromClipboardAction") win.pasteFromClipboardAction.setText("Paste from clipboard...") win.editDeleteAction = QtGui.QAction(MainWindow) win.editDeleteAction.setIcon(geticon("ui/actions/Edit/Delete.png")) win.editDeleteAction.setObjectName("editDeleteAction") # editRenameAction has been deprecated. Use editRenameSelectionAction. # Mark 2008-11-13. win.editRenameAction = QtGui.QAction(MainWindow) win.editRenameAction.setIcon(geticon("ui/actions/Edit/Rename.png")) win.editRenameAction.setObjectName("editRenameAction") win.editRenameSelectionAction = QtGui.QAction(MainWindow) win.editRenameSelectionAction.setIcon( geticon("ui/actions/Edit/Rename.png")) win.editRenameSelectionAction.setObjectName("editRenameSelectionAction") win.editAddSuffixAction = QtGui.QAction(MainWindow) win.editAddSuffixAction.setIcon(geticon("ui/actions/Edit/Add_Suffixes.png")) win.editAddSuffixAction.setObjectName("editAddSuffixAction") win.dispObjectColorAction = QtGui.QAction(MainWindow) win.dispObjectColorAction.setIcon(geticon("ui/actions/Edit/Edit_Color.png")) win.dispObjectColorAction.setObjectName("dispObjectColorAction") win.editDnaDisplayStyleAction = QtGui.QAction(MainWindow) win.editDnaDisplayStyleAction.setText("DNA Display Style") win.editDnaDisplayStyleAction.setIcon( geticon("ui/actions/Edit/EditDnaDisplayStyle.png")) win.editProteinDisplayStyleAction = QtGui.QAction(MainWindow) win.editProteinDisplayStyleAction.setText("Protein Display Style") win.editProteinDisplayStyleAction.setIcon( geticon("ui/actions/Edit/EditProteinDisplayStyle.png")) win.resetChunkColorAction = QtGui.QAction(MainWindow) win.resetChunkColorAction.setIcon( geticon("ui/actions/Edit/Reset_Chunk_Color.png")) win.resetChunkColorAction.setObjectName("resetChunkColorAction") #= View (menu and toolbar) actions. # Create the "View" menu. win.viewMenu = QtGui.QMenu(win.MenuBar) win.viewMenu.setObjectName("viewMenu") # Create the "Display" menu, a submenu of the "View" menu. win.displayMenu = QtGui.QMenu(win.viewMenu) win.displayMenu.setObjectName("displayMenu") # Create the "Modify" menu, a submenu of the "View" menu. win.modifyMenu = QtGui.QMenu(win.viewMenu) win.modifyMenu.setObjectName("viewMenu") # Note: The "Toolbars" submenu is created in Ui_ViewMenu.setupIu(). #== View > Modify (menu and toolbar) actions. win.viewOrientationAction = QtGui.QAction(MainWindow) win.viewOrientationAction.setCheckable(True) win.viewOrientationAction.setIcon( geticon("ui/actions/View/Modify/Orientation.png")) win.viewOrientationAction.setObjectName("viewOrientationAction") win.setViewFitToWindowAction = QtGui.QAction(MainWindow) win.setViewFitToWindowAction.setIcon( geticon("ui/actions/View/Modify/Zoom_To_Fit.png")) win.setViewFitToWindowAction.setObjectName("setViewFitToWindowAction") win.setViewZoomtoSelectionAction = QtGui.QAction(MainWindow) win.setViewZoomtoSelectionAction.setIcon( geticon("ui/actions/View/Modify/Zoom_To_Selection.png")) win.setViewZoomtoSelectionAction.setObjectName("setViewZoomtoSelectionAction") win.zoomToAreaAction = QtGui.QAction(MainWindow) win.zoomToAreaAction.setCheckable(True) win.zoomToAreaAction.setIcon( geticon("ui/actions/View/Modify/ZoomToArea.png")) win.zoomToAreaAction.setObjectName("zoomToAreaAction") win.zoomInOutAction = QtGui.QAction(MainWindow) win.zoomInOutAction.setCheckable(True) win.zoomInOutAction.setIcon( geticon("ui/actions/View/Modify/Zoom_In_Out.png")) win.zoomInOutAction.setObjectName("zoomInOutAction") win.setViewRecenterAction = QtGui.QAction(MainWindow) win.setViewRecenterAction.setEnabled(True) win.setViewRecenterAction.setIcon( geticon("ui/actions/View/Modify/Recenter.png")) win.setViewRecenterAction.setObjectName("setViewRecenterAction") win.panToolAction = QtGui.QAction(MainWindow) win.panToolAction.setCheckable(True) win.panToolAction.setIcon(geticon("ui/actions/View/Modify/Pan.png")) win.panToolAction.setObjectName("panToolAction") win.rotateToolAction = QtGui.QAction(MainWindow) win.rotateToolAction.setCheckable(True) win.rotateToolAction.setIcon(geticon("ui/actions/View/Modify/Rotate.png")) win.rotateToolAction.setObjectName("rotateToolAction") win.setViewHomeAction = QtGui.QAction(MainWindow) win.setViewHomeAction.setIcon(geticon("ui/actions/View/Modify/Home.png")) win.setViewHomeAction.setObjectName("setViewHomeAction") win.setViewHomeToCurrentAction = QtGui.QAction(MainWindow) win.setViewHomeToCurrentAction.setObjectName("setViewHomeToCurrentAction") #= View toolbar QActions. win.viewNormalToAction = QtGui.QAction(MainWindow) win.viewNormalToAction.setIcon( geticon("ui/actions/View/Set_View_Normal_To.png")) win.viewNormalToAction.setObjectName("NormalTo") win.viewParallelToAction = QtGui.QAction(MainWindow) win.viewParallelToAction.setIcon( geticon("ui/actions/View/Set_View_Parallel_To.png")) win.viewParallelToAction.setObjectName("ParallelTo") win.saveNamedViewAction = QtGui.QAction(MainWindow) win.saveNamedViewAction.setIcon( geticon("ui/actions/View/Modify/Save_Named_View.png")) win.saveNamedViewAction.setObjectName("saveNamedViewAction") win.viewFrontAction = QtGui.QAction(MainWindow) win.viewFrontAction.setEnabled(True) win.viewFrontAction.setIcon(geticon("ui/actions/View/Front.png")) win.viewFrontAction.setObjectName("Front") win.viewBackAction = QtGui.QAction(MainWindow) win.viewBackAction.setIcon(geticon("ui/actions/View/Back.png")) win.viewBackAction.setObjectName("Back") win.viewRightAction = QtGui.QAction(MainWindow) win.viewRightAction.setIcon(geticon("ui/actions/View/Right.png")) win.viewRightAction.setObjectName("Right") win.viewLeftAction = QtGui.QAction(MainWindow) win.viewLeftAction.setIcon(geticon("ui/actions/View/Left.png")) win.viewLeftAction.setObjectName("Left") win.viewTopAction = QtGui.QAction(MainWindow) win.viewTopAction.setIcon(geticon("ui/actions/View/Top.png")) win.viewTopAction.setObjectName("Top") win.viewBottomAction = QtGui.QAction(MainWindow) win.viewBottomAction.setEnabled(True) win.viewBottomAction.setIcon(geticon("ui/actions/View/Bottom.png")) win.viewBottomAction.setObjectName("Bottom") win.viewIsometricAction = QtGui.QAction(MainWindow) win.viewIsometricAction.setIcon(geticon("ui/actions/View/Isometric.png")) win.viewIsometricAction.setObjectName("Isometric") win.viewFlipViewVertAction = QtGui.QAction(MainWindow) win.viewFlipViewVertAction.setIcon( geticon("ui/actions/View/FlipViewVert.png")) win.viewFlipViewVertAction.setObjectName("FlipViewVert") win.viewFlipViewHorzAction = QtGui.QAction(MainWindow) win.viewFlipViewHorzAction.setIcon( geticon("ui/actions/View/FlipViewHorz.png")) win.viewFlipViewHorzAction.setObjectName("FlipViewHorz") win.viewRotatePlus90Action = QtGui.QAction(MainWindow) win.viewRotatePlus90Action.setIcon( geticon("ui/actions/View/Rotate_View_+90.png")) win.viewRotatePlus90Action.setObjectName("RotatePlus90") win.viewRotateMinus90Action = QtGui.QAction(MainWindow) win.viewRotateMinus90Action.setIcon( geticon("ui/actions/View/Rotate_View_-90.png")) win.viewRotateMinus90Action.setObjectName("RotateMinus90") win.viewDefviewAction = QtGui.QAction(MainWindow) win.viewDefviewAction.setObjectName("viewDefviewAction") #== View > Display (menu and toolbar) actions. win.dispDefaultAction = QtGui.QAction(MainWindow) win.dispDefaultAction.setIcon( geticon("ui/actions/View/Display/Default.png")) win.dispDefaultAction.setObjectName("dispDefaultAction") win.dispInvisAction = QtGui.QAction(MainWindow) win.dispInvisAction.setIcon( geticon("ui/actions/View/Display/Invisible.png")) win.dispInvisAction.setObjectName("dispInvisAction") win.dispLinesAction = QtGui.QAction(MainWindow) win.dispLinesAction.setIcon( geticon("ui/actions/View/Display/Lines.png")) win.dispLinesAction.setObjectName("dispLinesAction") win.dispTubesAction = QtGui.QAction(MainWindow) win.dispTubesAction.setEnabled(True) win.dispTubesAction.setIcon( geticon("ui/actions/View/Display/Tubes.png")) win.dispTubesAction.setObjectName("dispTubesAction") win.dispCPKAction = QtGui.QAction(MainWindow) win.dispCPKAction.setIcon(geticon("ui/actions/View/Display/CPK.png")) win.dispCPKAction.setObjectName("dispCPKAction") win.dispBallAction = QtGui.QAction(MainWindow) win.dispBallAction.setIcon( geticon("ui/actions/View/Display/Ball_and_Stick.png")) win.dispBallAction.setObjectName("dispBallAction") #@ This QAction is unused. See comments at the top of Ui_ViewMenu.py. win.dispHybridAction = QtGui.QAction(MainWindow) win.dispHybridAction.setIcon( geticon("ui/actions/View/Display/Hybrid.png")) win.dispHybridAction.setCheckable(True) win.dispHybridAction.setObjectName("dispHybridAction") win.dispCylinderAction = QtGui.QAction(MainWindow) win.dispCylinderAction.setIcon( geticon("ui/actions/View/Display/Cylinder.png")) win.dispCylinderAction.setObjectName("dispCylinderAction") win.dispDnaCylinderAction = QtGui.QAction(MainWindow) win.dispDnaCylinderAction.setIcon( geticon("ui/actions/View/Display/DnaCylinder.png")) win.dispDnaCylinderAction.setObjectName("dispDnaCylinderAction") win.dispHideAction = QtGui.QAction(MainWindow) win.dispHideAction.setIcon( geticon("ui/actions/View/Display/Hide.png")) win.dispHideAction.setObjectName("dispHideAction") win.dispUnhideAction = QtGui.QAction(MainWindow) win.dispUnhideAction.setIcon( geticon("ui/actions/View/Display/Unhide.png")) win.dispUnhideAction.setObjectName("dispUnhideAction") # This is currently NIY. Mark 2007-12-28 win.dispSurfaceAction = QtGui.QAction(MainWindow) win.dispSurfaceAction.setIcon( geticon("ui/actions/View/Display/Surface.png")) win.dispSurfaceAction.setObjectName("dispSurfaceAction") win.setViewPerspecAction = QtGui.QAction(MainWindow) win.setViewPerspecAction.setCheckable(True) win.setViewOrthoAction = QtGui.QAction(MainWindow) win.setViewOrthoAction.setCheckable(True) win.orthoPerpActionGroup = QtGui.QActionGroup(MainWindow) win.orthoPerpActionGroup.setExclusive(True) win.orthoPerpActionGroup.addAction(win.setViewPerspecAction) win.orthoPerpActionGroup.addAction(win.setViewOrthoAction) # piotr 080516 added stereo view action win.setStereoViewAction = QtGui.QAction(MainWindow) win.setStereoViewAction.setIcon( geticon("ui/actions/View/Stereo_View.png")) win.setStereoViewAction.setObjectName("setStereoViewAction") win.viewQuteMolAction = QtGui.QAction(MainWindow) win.viewQuteMolAction.setIcon( geticon("ui/actions/View/Display/QuteMol.png")) win.viewQuteMolAction.setObjectName("viewQuteMolAction") win.viewRaytraceSceneAction = QtGui.QAction(MainWindow) win.viewRaytraceSceneAction.setIcon( geticon("ui/actions/View/Display/Raytrace_Scene.png")) win.viewRaytraceSceneAction.setObjectName("viewRaytraceSceneAction") win.dispSetEltable1Action = QtGui.QAction(MainWindow) win.dispSetEltable1Action.setObjectName("dispSetEltable1Action") win.dispSetEltable2Action = QtGui.QAction(MainWindow) win.dispSetEltable2Action.setObjectName("dispSetEltable2Action") win.dispResetAtomsDisplayAction = QtGui.QAction(MainWindow) win.dispResetAtomsDisplayAction.setObjectName("dispResetAtomsDisplayAction") win.dispShowInvisAtomsAction = QtGui.QAction(MainWindow) win.dispShowInvisAtomsAction.setObjectName("dispShowInvisAtomsAction") win.dispElementColorSettingsAction = QtGui.QAction(MainWindow) win.dispElementColorSettingsAction.setObjectName("dispElementColorSettingsAction") win.dispElementColorSettingsAction.setIcon( geticon("ui/actions/View/Display/Element_Color_Settings.png")) win.dispLightingAction = QtGui.QAction(MainWindow) win.dispLightingAction.setObjectName("dispLightingAction") win.viewSemiFullScreenAction = QtGui.QAction(MainWindow) win.viewSemiFullScreenAction.setText('Semi-Full Screen') win.viewSemiFullScreenAction.setCheckable(True) win.viewSemiFullScreenAction.setChecked(False) win.viewSemiFullScreenAction.setShortcut('F11') win.viewFullScreenAction = QtGui.QAction(MainWindow) win.viewFullScreenAction.setText('Full Screen') win.viewFullScreenAction.setCheckable(True) win.viewFullScreenAction.setChecked(False) win.viewFullScreenAction.setShortcut('F12') win.viewReportsAction = QtGui.QAction(MainWindow) win.viewReportsAction.setCheckable(True) win.viewReportsAction.setChecked(True) win.viewReportsAction.setText('Reports') win.viewRulersAction = QtGui.QAction(MainWindow) win.viewRulersAction.setCheckable(True) win.viewRulersAction.setChecked(env.prefs[displayRulers_prefs_key]) win.viewRulersAction.setText('Rulers') #= Insert (menu and toolbar) widgets. # Create the "Insert" menu. win.insertMenu = QtGui.QMenu(win.MenuBar) win.insertMenu.setObjectName("Insert") # Create the "Reference Geometry" menu, a submenu of the "Insert" menu. #win.referenceGeometryMenu = QtGui.QMenu(win.insertMenu) #win.referenceGeometryMenu.setObjectName("referenceGeometryMenu") win.jigsAtomSetAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsAtomSetAction.setIcon(geticon("ui/actions/Tools/Atom_Set.png")) win.jigsAtomSetAction.setObjectName("jigsAtomSetAction") win.fileInsertMmpAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.fileInsertMmpAction.setObjectName("fileInsertMmpAction") win.fileInsertMmpAction.setIcon( geticon('ui/actions/Insert/MMP.png')) win.fileInsertPdbAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.fileInsertPdbAction.setObjectName("fileInsertPdbAction") win.fileInsertPdbAction.setIcon(geticon('ui/actions/Insert/PDB.png')) win.fileInsertInAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.fileInsertInAction.setObjectName("fileInsertInAction") win.partLibAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.partLibAction.setObjectName("partLibAction") win.partLibAction.setIcon(geticon('ui/actions/Insert/Part_Library.png')) win.insertCommentAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.insertCommentAction.setIcon( geticon("ui/actions/Insert/Comment.png")) win.insertCommentAction.setObjectName("insertCommentAction") win.insertPovraySceneAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.insertPovraySceneAction.setIcon( geticon("ui/actions/Insert/POV-Ray_Scene.png")) win.insertPovraySceneAction.setObjectName("insertPovraySceneAction") win.jigsGridPlaneAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsGridPlaneAction.setIcon( geticon("ui/actions/Insert/Reference Geometry/Grid_Plane.png")) win.jigsGridPlaneAction.setObjectName("jigsGridPlaneAction") win.referencePlaneAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.referencePlaneAction.setIcon( geticon("ui/actions/Insert/Reference Geometry/Plane.png")) win.referencePlaneAction.setObjectName("referencePlaneAction") win.referenceLineAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.referenceLineAction.setIcon( geticon("ui/actions/Insert/Reference Geometry/Plane.png")) win.referenceLineAction.setObjectName("referenceLineAction") win.referenceLineAction.setText("Line...") #= Tools (menu and toolbar) widgets. # Create the "Tools" menu. win.toolsMenu = QtGui.QMenu(win.MenuBar) win.toolsMenu.setObjectName("Tools") # Create the "Build Structures" menu, a submenu of the "Tools" menu. win.buildStructuresMenu = QtGui.QMenu(win.toolsMenu) win.buildStructuresMenu.setObjectName("buildStructuresMenu") # Create the "Build Tools" menu, a submenu of the "Tools" menu. win.buildToolsMenu = QtGui.QMenu(win.toolsMenu) win.buildToolsMenu.setObjectName("buildToolsMenu") # Create the "Dimensions" menu, a submenu of the "Tools" menu. win.dimensionsMenu = QtGui.QMenu(win.toolsMenu) win.dimensionsMenu.setObjectName("dimensionsMenu") # Create the "Selection" menu, a submenu of the "Tools" menu. win.selectionMenu = QtGui.QMenu(win.toolsMenu) win.selectionMenu.setObjectName("selectionMenu") win.editPrefsAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.editPrefsAction.setIcon(geticon("ui/actions/Tools/Options.png")) win.editPrefsAction.setObjectName("editPrefsAction") #Urmi background color scheme option 080522 win.colorSchemeAction = QtGui.QAction(MainWindow) win.colorSchemeAction.setIcon(geticon("ui/actions/View/ColorScheme.png")) win.colorSchemeAction.setObjectName("colorSchemeAction") win.lightingSchemeAction = QtGui.QAction(MainWindow) win.lightingSchemeAction.setIcon(geticon("ui/actions/View/LightingScheme.png")) win.lightingSchemeAction.setObjectName("lightingSchemeAction") win.modifyAdjustSelAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyAdjustSelAction.setEnabled(True) win.modifyAdjustSelAction.setIcon( geticon("ui/actions/Tools/Adjust_Selection.png")) win.modifyAdjustSelAction.setObjectName("modifyAdjustSelAction") win.modifyAdjustAllAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyAdjustAllAction.setIcon( geticon("ui/actions/Tools/Adjust_All.png")) win.modifyAdjustAllAction.setObjectName("modifyAdjustAllAction") win.simMinimizeEnergyAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.simMinimizeEnergyAction.setIcon( geticon("ui/actions/Simulation/Minimize_Energy.png")) win.simMinimizeEnergyAction.setObjectName("simMinimizeEnergyAction") win.checkAtomTypesAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.checkAtomTypesAction.setObjectName("checkAtomTypesAction") win.toolsExtrudeAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.toolsExtrudeAction.setCheckable(True) win.toolsExtrudeAction.setIcon( geticon("ui/actions/Insert/Features/Extrude.png")) win.toolsFuseChunksAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.toolsFuseChunksAction.setCheckable(1) # make the Fuse Mode button checkable win.toolsFuseChunksAction.setIcon( geticon("ui/actions/Tools/Build Tools/Fuse_Chunks.png")) win.modifyMirrorAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyMirrorAction.setIcon( geticon("ui/actions/Tools/Build Tools/Mirror.png")) win.modifyMirrorAction.setObjectName("modifyMirrorAction") win.modifyInvertAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyInvertAction.setIcon( geticon("ui/actions/Tools/Build Tools/Invert.png")) win.modifyInvertAction.setObjectName("modifyInvertAction") win.modifyStretchAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyStretchAction.setIcon( geticon("ui/actions/Tools/Build Tools/Stretch.png")) win.modifyStretchAction.setObjectName("modifyStretchAction") #== "Tools > Build Structures" (menu and toolbar) widgets. win.toolsDepositAtomAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.toolsDepositAtomAction.setCheckable(1) # make the build button checkable win.toolsDepositAtomAction.setIcon( geticon("ui/actions/Tools/Build Structures/BuildAtoms.png")) win.buildCrystalAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.buildCrystalAction.setCheckable(1) # make the crystal button checkable win.buildCrystalAction.setIcon( geticon("ui/actions/Tools/Build Structures/Build Crystal.png")) win.insertGrapheneAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.insertGrapheneAction.setIcon( geticon("ui/actions/Tools/Build Structures/Graphene.png")) win.insertGrapheneAction.setObjectName("insertGrapheneAction") win.nanotubeGeneratorAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.nanotubeGeneratorAction.setIcon( geticon("ui/actions/Tools/Build Structures/Nanotube.png")) win.nanotubeGeneratorAction.setObjectName("nanotubeGeneratorAction") win.buildNanotubeAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.buildNanotubeAction.setIcon( geticon("ui/actions/Tools/Build Structures/Nanotube.png")) win.buildNanotubeAction.setObjectName("buildNanotubeAction") win.buildDnaAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.buildDnaAction.setIcon( geticon("ui/actions/Tools/Build Structures/DNA.png")) win.buildDnaAction.setObjectName("buildDnaAction") # Atom Generator (Developer Example). Mark 2007-06-08 win.insertAtomAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.insertAtomAction.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/InsertAtom.png")) win.insertAtomAction.setObjectName("insertAtomAction") # Peptide Generator, piotr 080304 win.buildProteinAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.buildProteinAction.setIcon( geticon("ui/actions/Tools/Build Structures/Peptide.png")) win.buildProteinAction.setObjectName("buildProteinAction") #== "Tools > Build Tools" (menu and toolbar) widgets. win.modifyHydrogenateAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyHydrogenateAction.setIcon( geticon("ui/actions/Tools/Build Tools/Hydrogenate.png")) win.modifyHydrogenateAction.setObjectName("modifyHydrogenateAction") win.modifyDehydrogenateAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyDehydrogenateAction.setIcon( geticon("ui/actions/Tools/Build Tools/Dehydrogenate.png")) win.modifyDehydrogenateAction.setObjectName("modifyDehydrogenateAction") win.modifyPassivateAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyPassivateAction.setIcon( geticon("ui/actions/Tools/Build Tools/Passivate.png")) win.modifyPassivateAction.setObjectName("modifyPassivateAction") win.modifyDeleteBondsAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyDeleteBondsAction.setIcon( geticon("ui/actions/Tools/Build Tools/Delete_Bonds.png")) win.modifyDeleteBondsAction.setObjectName("modifyDeleteBondsAction") win.modifySeparateAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifySeparateAction.setIcon( geticon("ui/actions/Tools/Build Tools/Separate.png")) win.modifySeparateAction.setObjectName("modifySeparateAction") win.modifyMergeAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyMergeAction.setIcon(geticon( "ui/actions/Tools/Build Tools/Combine_Chunks.png")) win.modifyMergeAction.setObjectName("modifyMergeAction") win.makeChunkFromSelectedAtomsAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.makeChunkFromSelectedAtomsAction.setIcon(geticon( "ui/actions/Tools/Build Tools/New_Chunk.png")) win.makeChunkFromSelectedAtomsAction.setObjectName( "makeChunkFromSelectedAtomsAction") win.modifyAlignCommonAxisAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyAlignCommonAxisAction.setIcon( geticon("ui/actions/Tools/Build Tools/AlignToCommonAxis.png")) win.modifyAlignCommonAxisAction.setObjectName("modifyAlignCommonAxisAction") win.modifyCenterCommonAxisAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.modifyCenterCommonAxisAction.setObjectName( "modifyCenterCommonAxisAction") #= "Tools > Dimensions" (menu and toolbar) widgets. win.jigsDistanceAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsDistanceAction.setIcon( geticon("ui/actions/Tools/Dimensions/Measure_Distance.png")) win.jigsDistanceAction.setObjectName("jigsDistanceAction") win.jigsAngleAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsAngleAction.setIcon( geticon("ui/actions/Tools/Dimensions/Measure_Angle.png")) win.jigsAngleAction.setObjectName("jigsAngleAction") win.jigsDihedralAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsDihedralAction.setIcon( geticon("ui/actions/Tools/Dimensions/Measure_Dihedral.png")) win.jigsDihedralAction.setObjectName("jigsDihedralAction") #= "Tools > Select" (menu and toolbar) widgets. win.selectAllAction = QtGui.QAction(MainWindow) win.selectAllAction.setEnabled(True) win.selectAllAction.setIcon( geticon("ui/actions/Tools/Select/Select_All.png")) win.selectAllAction.setObjectName("selectAllAction") win.selectNoneAction = QtGui.QAction(MainWindow) win.selectNoneAction.setIcon( geticon("ui/actions/Tools/Select/Select_None.png")) win.selectNoneAction.setObjectName("selectNoneAction") win.selectInvertAction = QtGui.QAction(MainWindow) win.selectInvertAction.setIcon( geticon("ui/actions/Tools/Select/Select_Invert.png")) win.selectInvertAction.setObjectName("selectInvertAction") win.selectConnectedAction = QtGui.QAction(MainWindow) win.selectConnectedAction.setIcon( geticon("ui/actions/Tools/Select/Select_Connected.png")) win.selectConnectedAction.setObjectName("selectConnectedAction") win.selectDoublyAction = QtGui.QAction(MainWindow) win.selectDoublyAction.setIcon( geticon("ui/actions/Tools/Select/Select_Doubly.png")) win.selectDoublyAction.setObjectName("selectDoublyAction") win.selectExpandAction = QtGui.QAction(MainWindow) win.selectExpandAction.setIcon( geticon("ui/actions/Tools/Select/Expand.png")) win.selectExpandAction.setObjectName("selectExpandAction") win.selectContractAction = QtGui.QAction(MainWindow) win.selectContractAction.setIcon( geticon("ui/actions/Tools/Select/Contract.png")) win.selectContractAction.setObjectName("selectContractAction") win.selectLockAction = QtGui.QAction(MainWindow) win.selectLockAction.setIcon( geticon("ui/actions/Tools/Select/Selection_Unlocked.png")) win.selectLockAction.setObjectName("selectLockAction") win.selectLockAction.setCheckable(True) win.selectByNameAction = QtGui.QAction(MainWindow) win.selectByNameAction.setIcon( geticon("ui/actions/Tools/Select/Select_By_Name.png")) win.selectByNameAction.setObjectName("selectByNameAction") win.selectByNameAction.setCheckable(True) #= "Simulation" (menu and toolbar) widgets. # Create the "Simulation" menu win.simulationMenu = QtGui.QMenu(win.MenuBar) win.simulationMenu.setObjectName("simulationMenu") # Create the "Measurements" menu. #@ Not used??? MAS win.measurementsMenu = QtGui.QMenu() win.measurementsMenu.setObjectName("measurementsMenu") win.measurementsMenu.setIcon( geticon("ui/actions/Tools/Dimensions/Dimension.png")) win.simSetupAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.simSetupAction.setCheckable(True) win.simSetupAction.setChecked(False) win.simSetupAction.setEnabled(True) win.simSetupAction.setIcon( geticon("ui/actions/Simulation/RunDynamics.png")) win.simSetupAction.setObjectName("simSetupAction") win.simMoviePlayerAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.simMoviePlayerAction.setIcon( geticon("ui/actions/Simulation/PlayMovie.png")) win.rosettaSetupAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.rosettaSetupAction.setCheckable(True) win.rosettaSetupAction.setChecked(False) win.rosettaSetupAction.setEnabled(True) win.rosettaSetupAction.setIcon( geticon("ui/actions/Simulation/Rosetta.png")) win.rosettaSetupAction.setObjectName("rosettaSetupAction") win.simPlotToolAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.simPlotToolAction.setIcon( geticon("ui/actions/Simulation/PlotGraphs.png")) win.simPlotToolAction.setObjectName("simPlotToolAction") win.jigsMotorAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsMotorAction.setIcon( geticon("ui/actions/Simulation/RotaryMotor.png")) win.jigsMotorAction.setObjectName("jigsMotorAction") win.jigsLinearMotorAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsLinearMotorAction.setIcon( geticon("ui/actions/Simulation/LinearMotor.png")) win.jigsLinearMotorAction.setObjectName("jigsLinearMotorAction") win.jigsStatAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsStatAction.setIcon( geticon("ui/actions/Simulation/Thermostat.png")) win.jigsStatAction.setObjectName("jigsStatAction") win.jigsThermoAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsThermoAction.setIcon( geticon("ui/actions/Simulation/Measurements/Thermometer.png")) win.jigsThermoAction.setObjectName("jigsThermoAction") win.jigsAnchorAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsAnchorAction.setIcon( geticon("ui/actions/Simulation/Anchor.png")) win.jigsAnchorAction.setObjectName("jigsAnchorAction") win.simulationJigsAction = QtGui.QAction(win) win.simulationJigsAction.setIcon( geticon("ui/actions/Simulation/SimulationJigs.png")) win.simulationJigsAction.setObjectName("simulationJigsAction") win.jigsGamessAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsGamessAction.setEnabled(True) win.jigsGamessAction.setIcon( geticon("ui/actions/Simulation/GAMESS.png")) win.jigsGamessAction.setObjectName("jigsGamessAction") win.jigsESPImageAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.jigsESPImageAction.setIcon( geticon("ui/actions/Simulation/ESP_Image.png")) win.jigsESPImageAction.setObjectName("jigsESPImageAction") # This only shows up if the user enables the NH1 plugin (via Preferences) # which is hidden since NH1 doesn't work with NE1. # See UserPrefs.enable_nanohive(). win.simNanoHiveAction = QtGui.QAction(MainWindow) win.simNanoHiveAction.setVisible(False) win.simNanoHiveAction.setObjectName("simNanoHiveAction") #= Rendering menu. # Create the "Tools" menu. win.renderingMenu = QtGui.QMenu(win.MenuBar) win.renderingMenu.setObjectName("Rendering") #= "Help" (menu and toolbar) widgets. win.helpMenu = QtGui.QMenu(win.MenuBar) win.helpMenu.setObjectName("helpMenu") win.helpTutorialsAction = QtGui.QAction(MainWindow) win.helpTutorialsAction.setObjectName("helpAboutAction") win.helpMouseControlsAction = QtGui.QAction(MainWindow) win.helpMouseControlsAction.setObjectName("helpMouseControlsAction") win.helpKeyboardShortcutsAction = QtGui.QAction(MainWindow) win.helpKeyboardShortcutsAction.setObjectName("helpKeyboardShortcutsAction") win.helpSelectionShortcutsAction = QtGui.QAction(MainWindow) win.helpSelectionShortcutsAction.setObjectName("helpSelectionShortcutsAction") win.helpGraphicsCardAction = QtGui.QAction(MainWindow) win.helpGraphicsCardAction.setObjectName("helpGraphicsCardAction") win.helpWhatsThisAction = QtGui.QAction(MainWindow) win.helpWhatsThisAction.setIcon(geticon("ui/actions/Help/WhatsThis.png")) win.helpWhatsThisAction.setObjectName("helpWhatsThisAction") win.helpAboutAction = QtGui.QAction(MainWindow) win.helpAboutAction.setObjectName("helpAboutAction") #= Widgets for toolbars # "Standard" toolbar widgets. # Action items from the Tools menu @@@ninad061110 # Not decided whether select chunks and move chunks options # will be a part of Tools Menu win.toolsSelectMoleculesAction = QtGui.QAction(MainWindow) win.toolsSelectMoleculesAction.setCheckable(1) # make the select chunks button checkable win.toolsSelectMoleculesAction.setIcon( geticon("ui/actions/Misc/SelectChunks.png")) # Define an action grop for move molecules (translate and rotate components) # actions ...to make them mutually exclusive. # -- ninad 070309 win.toolsMoveRotateActionGroup = QtGui.QActionGroup(MainWindow) win.toolsMoveRotateActionGroup.setExclusive(True) win.toolsMoveMoleculeAction = NE1_QWidgetAction(win.toolsMoveRotateActionGroup, win = MainWindow) win.toolsMoveMoleculeAction.setCheckable(1) # make the Move mode button checkable win.toolsMoveMoleculeAction.setIcon( geticon("ui/actions/Command Toolbar/MoveCommands/Translate.png")) win.rotateComponentsAction = NE1_QWidgetAction(win.toolsMoveRotateActionGroup, win = MainWindow) win.rotateComponentsAction.setCheckable(1) # make the Move mode button checkable win.rotateComponentsAction.setIcon( geticon("ui/actions/Command Toolbar/MoveCommands/Rotate.png")) #= "View" toolbars. # Create "Standard Views" dropdown menu for the "View" toolbar. win.standardViewsMenu = QtGui.QMenu("Standard Views") # Populate the "Standard Views" menu. win.standardViewsMenu.addAction(win.viewFrontAction) win.standardViewsMenu.addAction(win.viewBackAction) win.standardViewsMenu.addAction(win.viewLeftAction) win.standardViewsMenu.addAction(win.viewRightAction) win.standardViewsMenu.addAction(win.viewTopAction) win.standardViewsMenu.addAction(win.viewBottomAction) win.standardViewsMenu.addAction(win.viewIsometricAction) win.standardViewsAction = NE1_QWidgetAction(MainWindow, win = MainWindow) win.standardViewsAction.setEnabled(True) win.standardViewsAction.setIcon( geticon("ui/actions/View/Standard_Views.png")) win.standardViewsAction.setObjectName("standardViews") win.standardViewsAction.setText("Standard Views") win.standardViewsAction.setMenu(win.standardViewsMenu) win.standardViews_btn = QtGui.QToolButton() win.standardViews_btn.setPopupMode(QToolButton.MenuButtonPopup) win.standardViewsAction.setDefaultWidget(win.standardViews_btn) win.standardViews_btn.setDefaultAction(win.standardViewsAction) # Dock widgets win.reportsDockWidget = Ui_ReportsDockWidget(win) def retranslateUi(win): """ Sets text related attributes for all main window QAction widgets. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ """ This function centralizes and sets UI text for main window QAction widgets for the purpose of making it easier for the programmer to translate the UI into other languages using Qt Linguist. @param MainWindow: The main window @type MainWindow: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} @see: U{B{The Qt Linquist Manual}<http://doc.trolltech.com/4/linguist-manual.html>} @attention: It is never OK to set the shortcut "Ctrl+H or Cmd+H on Mac)" via setShortcut() since this shortcut is reserved on Mac OS X for hiding a window. """ #= File (menu and toolbar) actions. win.fileOpenAction.setText( QtGui.QApplication.translate( "MainWindow", "&Open...", None, QtGui.QApplication.UnicodeUTF8)) win.fileOpenAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) win.fileOpenAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Open(Ctrl+O)", None, QtGui.QApplication.UnicodeUTF8)) win.fileOpenAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) win.fileCloseAction.setText( QtGui.QApplication.translate( "MainWindow", "&Close and begin new model", None, QtGui.QApplication.UnicodeUTF8)) win.fileCloseAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) win.fileSaveAction.setText( QtGui.QApplication.translate( "MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8)) win.fileSaveAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Save (Ctrl+S)", None, QtGui.QApplication.UnicodeUTF8)) win.fileSaveAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Save", None, QtGui.QApplication.UnicodeUTF8)) win.fileSaveAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8)) win.fileSaveAsAction.setText( QtGui.QApplication.translate( "MainWindow", "Save &As...", None, QtGui.QApplication.UnicodeUTF8)) win.fileSaveAsAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Save As", None, QtGui.QApplication.UnicodeUTF8)) win.fileImportOpenBabelAction.setText( QtGui.QApplication.translate( "MainWindow", "Open Babel import...", None, QtGui.QApplication.UnicodeUTF8)) win.fileImportOpenBabelAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Open Babel", None, QtGui.QApplication.UnicodeUTF8)) win.fileImportOpenBabelAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Open Babel import", None, QtGui.QApplication.UnicodeUTF8)) win.fileImportIOSAction.setText( QtGui.QApplication.translate( "MainWindow", "IOS import...", None, QtGui.QApplication.UnicodeUTF8)) win.fileImportIOSAction.setIconText( QtGui.QApplication.translate( "MainWindow", "IOS", None, QtGui.QApplication.UnicodeUTF8)) win.fileImportIOSAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "IOS import", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportPdbAction.setText( QtGui.QApplication.translate( "MainWindow", "Protein Data Bank...", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportQuteMolXPdbAction.setText( QtGui.QApplication.translate( "MainWindow", "Protein Data Bank for QuteMolX...", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportJpgAction.setText( QtGui.QApplication.translate( "MainWindow", "JPEG image...", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportPngAction.setText( QtGui.QApplication.translate( "MainWindow", "PNG image...", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportPovAction.setText( QtGui.QApplication.translate( "MainWindow", "POV-Ray...", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportAmdlAction.setText( QtGui.QApplication.translate( "MainWindow", "Animation Master Model...", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportOpenBabelAction.setText( QtGui.QApplication.translate( "MainWindow", "Open Babel export...", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportOpenBabelAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Open Babel", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportOpenBabelAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Open Babel export", None, QtGui.QApplication.UnicodeUTF8)) #ios export win.fileExportIOSAction.setText( QtGui.QApplication.translate( "MainWindow", "IOS export...", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportIOSAction.setIconText( QtGui.QApplication.translate( "MainWindow", "IOS", None, QtGui.QApplication.UnicodeUTF8)) win.fileExportIOSAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "IOS export", None, QtGui.QApplication.UnicodeUTF8)) #fetch pdb win.fileFetchPdbAction.setText( QtGui.QApplication.translate( "MainWindow", "PDB file from RCSB...", None, QtGui.QApplication.UnicodeUTF8)) win.fileFetchPdbAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Fetch PDB", None, QtGui.QApplication.UnicodeUTF8)) win.fileFetchPdbAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Fetch a PDB file from RCSB", None, QtGui.QApplication.UnicodeUTF8)) win.fileExitAction.setText( QtGui.QApplication.translate( "MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) win.fileExitAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Exit", None, QtGui.QApplication.UnicodeUTF8)) #= Edit (menu and toolbar) actions. win.editUndoAction.setText( QtGui.QApplication.translate( "MainWindow", "&Undo", None, QtGui.QApplication.UnicodeUTF8)) win.editUndoAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Undo", None, QtGui.QApplication.UnicodeUTF8)) win.editUndoAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Ctrl+Z", None, QtGui.QApplication.UnicodeUTF8)) win.editUndoAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Undo (Ctrl+Z)", None, QtGui.QApplication.UnicodeUTF8)) win.editRedoAction.setText( QtGui.QApplication.translate( "MainWindow", "&Redo", None, QtGui.QApplication.UnicodeUTF8)) win.editRedoAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Redo", None, QtGui.QApplication.UnicodeUTF8)) # Redo is a special case between Mac OS X and the other platforms: # - Cmd+Shift+Z on Mac # - Ctrl+Y on Windows and Linux # We take care of tooltips and keyboard shortcut settings here. # -Mark 2008-05-05. from platform_dependent.PlatformDependent import is_macintosh if is_macintosh(): redo_accel = "Cmd+Shift+Z" else: redo_accel = "Ctrl+Y" win.editRedoAction.setShortcut( QtGui.QApplication.translate( "MainWindow", redo_accel, None, QtGui.QApplication.UnicodeUTF8)) win.editRedoAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Redo (" + redo_accel + ")", None, QtGui.QApplication.UnicodeUTF8)) win.editCutAction.setText( QtGui.QApplication.translate( "MainWindow", "&Cut", None, QtGui.QApplication.UnicodeUTF8)) win.editCutAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Cut", None, QtGui.QApplication.UnicodeUTF8)) win.editCutAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Ctrl+X", None, QtGui.QApplication.UnicodeUTF8)) win.editCutAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Cut (Ctrl+X)", None, QtGui.QApplication.UnicodeUTF8)) win.editCopyAction.setText( QtGui.QApplication.translate( "MainWindow", "C&opy", None, QtGui.QApplication.UnicodeUTF8)) win.editCopyAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Copy", None, QtGui.QApplication.UnicodeUTF8)) win.editCopyAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Ctrl+C", None, QtGui.QApplication.UnicodeUTF8)) win.editCopyAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Copy (Ctrl+V)", None, QtGui.QApplication.UnicodeUTF8)) win.editPasteAction.setText( QtGui.QApplication.translate( "MainWindow", "&Paste", None, QtGui.QApplication.UnicodeUTF8)) win.editPasteAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Paste", None, QtGui.QApplication.UnicodeUTF8)) win.editPasteAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Ctrl+V", None, QtGui.QApplication.UnicodeUTF8)) win.editDeleteAction.setText( QtGui.QApplication.translate( "MainWindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8)) win.editDeleteAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Delete", None, QtGui.QApplication.UnicodeUTF8)) win.editDeleteAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Delete (Del)", None, QtGui.QApplication.UnicodeUTF8)) win.editRenameAction.setText( QtGui.QApplication.translate( "MainWindow", "Rename", None, QtGui.QApplication.UnicodeUTF8)) win.editRenameAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Rename", None, QtGui.QApplication.UnicodeUTF8)) win.editRenameAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Rename (Shift+R)", None, QtGui.QApplication.UnicodeUTF8)) win.editRenameAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Shift+R", None, QtGui.QApplication.UnicodeUTF8)) win.editRenameSelectionAction.setText( QtGui.QApplication.translate( "MainWindow", "Rename Selection", None, QtGui.QApplication.UnicodeUTF8)) win.editRenameSelectionAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Rename Selection", None, QtGui.QApplication.UnicodeUTF8)) win.editRenameSelectionAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Rename Selection", None, QtGui.QApplication.UnicodeUTF8)) win.editAddSuffixAction.setText( QtGui.QApplication.translate( "MainWindow", "Add Suffixes", None, QtGui.QApplication.UnicodeUTF8)) win.editAddSuffixAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Add Suffixes", None, QtGui.QApplication.UnicodeUTF8)) win.editAddSuffixAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Add Suffixes", None, QtGui.QApplication.UnicodeUTF8)) win.editMakeCheckpointAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Make Checkpoint", None, QtGui.QApplication.UnicodeUTF8)) win.editAutoCheckpointingAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Automatic Checkpointing", None, QtGui.QApplication.UnicodeUTF8)) win.editClearUndoStackAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Clear Undo Stack", None, QtGui.QApplication.UnicodeUTF8)) win.dispObjectColorAction.setText( QtGui.QApplication.translate( "MainWindow", "Change Color of Selection...", None, QtGui.QApplication.UnicodeUTF8)) win.dispObjectColorAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Change Color of Selected Objects", None, QtGui.QApplication.UnicodeUTF8)) win.dispObjectColorAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Change Color", None, QtGui.QApplication.UnicodeUTF8)) #= View (menu and toolbar) actions. win.viewOrientationAction.setText( QtGui.QApplication.translate( "MainWindow", "Orientation Manager...", None, QtGui.QApplication.UnicodeUTF8)) win.viewOrientationAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Space", None, QtGui.QApplication.UnicodeUTF8)) win.setViewFitToWindowAction.setText( QtGui.QApplication.translate( "MainWindow", "&Zoom to Fit", None, QtGui.QApplication.UnicodeUTF8)) win.setViewFitToWindowAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Zoom to Fit", None, QtGui.QApplication.UnicodeUTF8)) win.setViewFitToWindowAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Zoom to Fit (Ctrl+F)", None, QtGui.QApplication.UnicodeUTF8)) win.setViewFitToWindowAction.setShortcut( QtGui.QApplication.translate( "MainWindow", "Ctrl+F", None, QtGui.QApplication.UnicodeUTF8)) win.zoomToAreaAction.setText( QtGui.QApplication.translate( "MainWindow", "&Zoom to Area", None, QtGui.QApplication.UnicodeUTF8)) win.zoomToAreaAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Zoom to Area", None, QtGui.QApplication.UnicodeUTF8)) win.setViewZoomtoSelectionAction.setText( QtGui.QApplication.translate( "MainWindow", "Zoom To Selection", None, QtGui.QApplication.UnicodeUTF8)) win.setViewZoomtoSelectionAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Zoom To Selection", None, QtGui.QApplication.UnicodeUTF8)) win.setViewZoomtoSelectionAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Zoom to Selection", None, QtGui.QApplication.UnicodeUTF8)) win.zoomInOutAction.setText( QtGui.QApplication.translate( "MainWindow", "Zoom", None, QtGui.QApplication.UnicodeUTF8)) win.zoomInOutAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Zoom", None, QtGui.QApplication.UnicodeUTF8)) win.zoomInOutAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Zoom In . (dot) | Zoom Out , (comma)", None, QtGui.QApplication.UnicodeUTF8)) win.panToolAction.setText(QtGui.QApplication.translate("MainWindow", "&Pan", None, QtGui.QApplication.UnicodeUTF8)) win.panToolAction.setIconText(QtGui.QApplication.translate("MainWindow", "Pan ", None, QtGui.QApplication.UnicodeUTF8)) win.rotateToolAction.setText(QtGui.QApplication.translate("MainWindow", "Rotate", None, QtGui.QApplication.UnicodeUTF8)) win.rotateToolAction.setIconText(QtGui.QApplication.translate("MainWindow", "Rotate", None, QtGui.QApplication.UnicodeUTF8)) win.setViewHomeAction.setText(QtGui.QApplication.translate("MainWindow", "&Home", None, QtGui.QApplication.UnicodeUTF8)) win.setViewHomeAction.setIconText(QtGui.QApplication.translate("MainWindow", "Home", None, QtGui.QApplication.UnicodeUTF8)) win.setViewHomeAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Home View (Home)", None, QtGui.QApplication.UnicodeUTF8)) win.setViewHomeAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Home", None, QtGui.QApplication.UnicodeUTF8)) win.setViewRecenterAction.setText(QtGui.QApplication.translate("MainWindow", "&Recenter", None, QtGui.QApplication.UnicodeUTF8)) win.setViewRecenterAction.setIconText(QtGui.QApplication.translate("MainWindow", "Recenter", None, QtGui.QApplication.UnicodeUTF8)) win.setViewRecenterAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Recenter (Ctrl+R)", None, QtGui.QApplication.UnicodeUTF8)) win.setViewRecenterAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8)) win.setViewHomeToCurrentAction.setText(QtGui.QApplication.translate("MainWindow", "Replace 'Home View' with the current view", None, QtGui.QApplication.UnicodeUTF8)) win.setViewHomeToCurrentAction.setIconText(QtGui.QApplication.translate("MainWindow", "Replace 'Home View' with the current view", None, QtGui.QApplication.UnicodeUTF8)) win.setViewHomeToCurrentAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Replace 'Home View' with the current view (Ctrl+Home)", None, QtGui.QApplication.UnicodeUTF8)) win.setViewHomeToCurrentAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Home", None, QtGui.QApplication.UnicodeUTF8)) win.saveNamedViewAction.setText(QtGui.QApplication.translate("MainWindow", "Save Named View", None, QtGui.QApplication.UnicodeUTF8)) win.saveNamedViewAction.setIconText(QtGui.QApplication.translate("MainWindow", "Save Named View", None, QtGui.QApplication.UnicodeUTF8)) #VIEW > DISPLAY MENU ITEMS win.dispBallAction.setText(QtGui.QApplication.translate("MainWindow", "Ball and Stick", None, QtGui.QApplication.UnicodeUTF8)) win.dispBallAction.setIconText(QtGui.QApplication.translate("MainWindow", "Ball and Stick", None, QtGui.QApplication.UnicodeUTF8)) win.dispBallAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Apply <b>Ball and Stick</b> display style to the selection", None, QtGui.QApplication.UnicodeUTF8)) win.dispDefaultAction.setText(QtGui.QApplication.translate("MainWindow", "Default", None, QtGui.QApplication.UnicodeUTF8)) win.dispDefaultAction.setIconText(QtGui.QApplication.translate("MainWindow", "Default", None, QtGui.QApplication.UnicodeUTF8)) win.dispDefaultAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Apply <b>Default</b> display setting to the selection", None, QtGui.QApplication.UnicodeUTF8)) win.dispInvisAction.setText(QtGui.QApplication.translate("MainWindow", "Invisible", None, QtGui.QApplication.UnicodeUTF8)) win.dispInvisAction.setIconText(QtGui.QApplication.translate("MainWindow", "Invisible", None, QtGui.QApplication.UnicodeUTF8)) win.dispLinesAction.setText(QtGui.QApplication.translate("MainWindow", "Lines", None, QtGui.QApplication.UnicodeUTF8)) win.dispLinesAction.setIconText(QtGui.QApplication.translate("MainWindow", "Lines", None, QtGui.QApplication.UnicodeUTF8)) win.dispLinesAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Apply <b>Lines</b> display style to the selection", None, QtGui.QApplication.UnicodeUTF8)) win.dispTubesAction.setText(QtGui.QApplication.translate("MainWindow", "Tubes", None, QtGui.QApplication.UnicodeUTF8)) win.dispTubesAction.setIconText(QtGui.QApplication.translate("MainWindow", "Tubes", None, QtGui.QApplication.UnicodeUTF8)) win.dispTubesAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Apply <b>Tubes</b> display style to the selection", None, QtGui.QApplication.UnicodeUTF8)) win.dispCPKAction.setText(QtGui.QApplication.translate("MainWindow", "CPK", None, QtGui.QApplication.UnicodeUTF8)) win.dispCPKAction.setIconText(QtGui.QApplication.translate("MainWindow", "CPK", None, QtGui.QApplication.UnicodeUTF8)) win.dispCPKAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Apply <b>CPK</b> display style to the selection", None, QtGui.QApplication.UnicodeUTF8)) win.dispHybridAction.setText(QtGui.QApplication.translate("MainWindow", "Hybrid Display", None, QtGui.QApplication.UnicodeUTF8)) win.dispHybridAction.setIconText(QtGui.QApplication.translate("MainWindow", "Hybrid", None, QtGui.QApplication.UnicodeUTF8)) win.dispSurfaceAction.setIconText(QtGui.QApplication.translate("MainWindow", "Surface", None, QtGui.QApplication.UnicodeUTF8)) win.dispSurfaceAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Apply <b>Surface</b> display style to the selection", None, QtGui.QApplication.UnicodeUTF8)) win.dispCylinderAction.setIconText(QtGui.QApplication.translate("MainWindow", "Cylinder", None, QtGui.QApplication.UnicodeUTF8)) win.dispCylinderAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Apply <b>Cylinder</b> display style to the selection", None, QtGui.QApplication.UnicodeUTF8)) win.dispDnaCylinderAction.setIconText(QtGui.QApplication.translate("MainWindow", "DNA Cylinder", None, QtGui.QApplication.UnicodeUTF8)) win.dispDnaCylinderAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Apply <b>DNA Cylinder</b> display style to the selection", None, QtGui.QApplication.UnicodeUTF8)) win.dispHideAction.setIconText(QtGui.QApplication.translate("MainWindow", "Hide", None, QtGui.QApplication.UnicodeUTF8)) win.dispHideAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Hide", None, QtGui.QApplication.UnicodeUTF8)) win.dispUnhideAction.setIconText(QtGui.QApplication.translate("MainWindow", "Unhide", None, QtGui.QApplication.UnicodeUTF8)) win.dispUnhideAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Unhide", None, QtGui.QApplication.UnicodeUTF8)) # FOLLOWING VIEW MENU ITEMS NEED SORTING win.viewFrontAction.setText(QtGui.QApplication.translate("MainWindow", "&Front", None, QtGui.QApplication.UnicodeUTF8)) win.viewFrontAction.setIconText(QtGui.QApplication.translate("MainWindow", "Front", None, QtGui.QApplication.UnicodeUTF8)) win.viewFrontAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Front View", None, QtGui.QApplication.UnicodeUTF8)) win.viewBackAction.setText(QtGui.QApplication.translate("MainWindow", "&Back", None, QtGui.QApplication.UnicodeUTF8)) win.viewBackAction.setIconText(QtGui.QApplication.translate("MainWindow", "Back", None, QtGui.QApplication.UnicodeUTF8)) win.viewBackAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Back View", None, QtGui.QApplication.UnicodeUTF8)) win.viewTopAction.setText(QtGui.QApplication.translate("MainWindow", "&Top", None, QtGui.QApplication.UnicodeUTF8)) win.viewTopAction.setIconText(QtGui.QApplication.translate("MainWindow", "Top", None, QtGui.QApplication.UnicodeUTF8)) win.viewTopAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Top View", None, QtGui.QApplication.UnicodeUTF8)) win.viewBottomAction.setText(QtGui.QApplication.translate("MainWindow", "Botto&m", None, QtGui.QApplication.UnicodeUTF8)) win.viewBottomAction.setIconText(QtGui.QApplication.translate("MainWindow", "Bottom", None, QtGui.QApplication.UnicodeUTF8)) win.viewBottomAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Bottom View", None, QtGui.QApplication.UnicodeUTF8)) win.viewRightAction.setText(QtGui.QApplication.translate("MainWindow", "&Right", None, QtGui.QApplication.UnicodeUTF8)) win.viewRightAction.setIconText(QtGui.QApplication.translate("MainWindow", "Right", None, QtGui.QApplication.UnicodeUTF8)) win.viewRightAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Right View", None, QtGui.QApplication.UnicodeUTF8)) win.viewRightAction.setStatusTip(QtGui.QApplication.translate("MainWindow", "Right View", None, QtGui.QApplication.UnicodeUTF8)) win.viewLeftAction.setText(QtGui.QApplication.translate("MainWindow", "&Left", None, QtGui.QApplication.UnicodeUTF8)) win.viewLeftAction.setIconText(QtGui.QApplication.translate("MainWindow", "Left", None, QtGui.QApplication.UnicodeUTF8)) win.viewLeftAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Left View", None, QtGui.QApplication.UnicodeUTF8)) win.viewFlipViewVertAction.setText(QtGui.QApplication.translate("MainWindow", "Flip View Vertically", None, QtGui.QApplication.UnicodeUTF8)) win.viewFlipViewVertAction.setIconText(QtGui.QApplication.translate("MainWindow", "Flip View Vertically", None, QtGui.QApplication.UnicodeUTF8)) win.viewFlipViewVertAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Flip View Vertically", None, QtGui.QApplication.UnicodeUTF8)) win.viewFlipViewVertAction.setStatusTip(QtGui.QApplication.translate("MainWindow", "Flip View Vertically", None, QtGui.QApplication.UnicodeUTF8)) win.viewFlipViewHorzAction.setText(QtGui.QApplication.translate("MainWindow", "Flip View Horizontally", None, QtGui.QApplication.UnicodeUTF8)) win.viewFlipViewHorzAction.setIconText(QtGui.QApplication.translate("MainWindow", "Flip View Horizontally", None, QtGui.QApplication.UnicodeUTF8)) win.viewFlipViewHorzAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Flip View Horizontally", None, QtGui.QApplication.UnicodeUTF8)) win.viewFlipViewHorzAction.setStatusTip(QtGui.QApplication.translate("MainWindow", "Flip View Horizontally", None, QtGui.QApplication.UnicodeUTF8)) win.viewIsometricAction.setText(QtGui.QApplication.translate("MainWindow", "&Isometric", None, QtGui.QApplication.UnicodeUTF8)) win.viewIsometricAction.setIconText(QtGui.QApplication.translate("MainWindow", "Isometric", None, QtGui.QApplication.UnicodeUTF8)) win.resetChunkColorAction.setText(QtGui.QApplication.translate("MainWindow", "&Reset Color of Selected Chunks", None, QtGui.QApplication.UnicodeUTF8)) win.resetChunkColorAction.setIconText(QtGui.QApplication.translate("MainWindow", "Reset Color of Selected Chunks", None, QtGui.QApplication.UnicodeUTF8)) #= Insert (menu and toolbar) actions. win.jigsAtomSetAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Atom Set", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertMmpAction.setText(QtGui.QApplication.translate( "MainWindow", "MMP file", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertMmpAction.setIconText(QtGui.QApplication.translate( "MainWindow", "MMP file", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertMmpAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Insert Molecular Machine Part (MMP) file", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertPdbAction.setText(QtGui.QApplication.translate( "MainWindow", "PDB file", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertPdbAction.setIconText(QtGui.QApplication.translate( "MainWindow", "PDB file", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertPdbAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Insert Protein Data Bank (PDB) file", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertInAction.setText(QtGui.QApplication.translate( "MainWindow", "IN file", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertInAction.setIconText(QtGui.QApplication.translate( "MainWindow", "IN file", None, QtGui.QApplication.UnicodeUTF8)) win.fileInsertInAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Insert AMBER .in file fragment", None, QtGui.QApplication.UnicodeUTF8)) win.insertCommentAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Comment", None, QtGui.QApplication.UnicodeUTF8)) win.insertPovraySceneAction.setIconText(QtGui.QApplication.translate( "MainWindow", "POV-Ray Scene", None, QtGui.QApplication.UnicodeUTF8)) win.insertPovraySceneAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Insert POV-Ray Scene file", None, QtGui.QApplication.UnicodeUTF8)) win.jigsGridPlaneAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Grid Plane", None, QtGui.QApplication.UnicodeUTF8)) win.referencePlaneAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Plane", None, QtGui.QApplication.UnicodeUTF8)) # Part Lib win.partLibAction.setText(QtGui.QApplication.translate( "MainWindow", "Part Library", None, QtGui.QApplication.UnicodeUTF8)) win.partLibAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Part from Part Library", None, QtGui.QApplication.UnicodeUTF8)) win.partLibAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Insert Part from Part Library", None, QtGui.QApplication.UnicodeUTF8)) #= Tools (menu and toolbar) actions. win.modifyAdjustSelAction.setText(QtGui.QApplication.translate( "MainWindow", "Adjust Selection", None, QtGui.QApplication.UnicodeUTF8)) win.modifyAdjustSelAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Adjust Selection", None, QtGui.QApplication.UnicodeUTF8)) win.modifyAdjustSelAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Adjust Selection", None, QtGui.QApplication.UnicodeUTF8)) win.modifyAdjustAllAction.setText(QtGui.QApplication.translate( "MainWindow", "Adjust All", None, QtGui.QApplication.UnicodeUTF8)) win.modifyAdjustAllAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Adjust All", None, QtGui.QApplication.UnicodeUTF8)) win.simMinimizeEnergyAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Minimize Energy", None, QtGui.QApplication.UnicodeUTF8)) win.checkAtomTypesAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Check AMBER AtomTypes", None, QtGui.QApplication.UnicodeUTF8)) win.toolsExtrudeAction.setText(QtGui.QApplication.translate( "MainWindow", "Extrude", None, QtGui.QApplication.UnicodeUTF8)) win.toolsFuseChunksAction.setText(QtGui.QApplication.translate( "MainWindow", "Fuse", None, QtGui.QApplication.UnicodeUTF8)) win.toolsFuseChunksAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Fuse Chunks", None, QtGui.QApplication.UnicodeUTF8)) win.toolsExtrudeAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Extrude", None, QtGui.QApplication.UnicodeUTF8)) win.editPrefsAction.setText(QtGui.QApplication.translate( "MainWindow", "Preferences...", None, QtGui.QApplication.UnicodeUTF8)) win.colorSchemeAction.setText( QtGui.QApplication.translate( "MainWindow", "Color Scheme", None, QtGui.QApplication.UnicodeUTF8)) win.lightingSchemeAction.setText(QtGui.QApplication.translate( "MainWindow", "Lighting Scheme", None, QtGui.QApplication.UnicodeUTF8)) win.modifyMirrorAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Mirror", None, QtGui.QApplication.UnicodeUTF8)) win.modifyMirrorAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Mirror Chunks", None, QtGui.QApplication.UnicodeUTF8)) win.modifyInvertAction.setText(QtGui.QApplication.translate( "MainWindow", "&Invert", None, QtGui.QApplication.UnicodeUTF8)) win.modifyInvertAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Invert", None, QtGui.QApplication.UnicodeUTF8)) win.editPrefsAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Preferences...", None, QtGui.QApplication.UnicodeUTF8)) win.editPrefsAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Preferences", None, QtGui.QApplication.UnicodeUTF8)) #Urmi background color chooser option 080522 win.colorSchemeAction.setToolTip( QtGui.QApplication.translate( "MainWindow", "Color Scheme", None, QtGui.QApplication.UnicodeUTF8)) win.colorSchemeAction.setIconText( QtGui.QApplication.translate( "MainWindow", "Color Scheme", None, QtGui.QApplication.UnicodeUTF8)) win.lightingSchemeAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Lighting Scheme", None, QtGui.QApplication.UnicodeUTF8)) win.lightingSchemeAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Lighting Scheme", None, QtGui.QApplication.UnicodeUTF8)) #= Tools > Build Structures (menu and toolbar) actions. win.toolsDepositAtomAction.setText( QtGui.QApplication.translate( "MainWindow", "Atoms", None, QtGui.QApplication.UnicodeUTF8)) win.toolsDepositAtomAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Build Atoms", None, QtGui.QApplication.UnicodeUTF8)) win.buildCrystalAction.setText(QtGui.QApplication.translate( "MainWindow", "Crystal", None, QtGui.QApplication.UnicodeUTF8)) win.buildCrystalAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Build Crystal", None, QtGui.QApplication.UnicodeUTF8)) win.nanotubeGeneratorAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Nanotube", None, QtGui.QApplication.UnicodeUTF8)) win.nanotubeGeneratorAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Generate Nanotube (old)", None, QtGui.QApplication.UnicodeUTF8)) win.insertGrapheneAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Graphene", None, QtGui.QApplication.UnicodeUTF8)) win.insertGrapheneAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Generate Graphene", None, QtGui.QApplication.UnicodeUTF8)) win.buildDnaAction.setText(QtGui.QApplication.translate( "MainWindow", "DNA", None, QtGui.QApplication.UnicodeUTF8)) win.buildDnaAction.setIconText(QtGui.QApplication.translate( "MainWindow", "DNA", None, QtGui.QApplication.UnicodeUTF8)) win.buildDnaAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Build DNA", None, QtGui.QApplication.UnicodeUTF8)) win.buildNanotubeAction.setText(QtGui.QApplication.translate( "MainWindow", "Nanotube", None, QtGui.QApplication.UnicodeUTF8)) win.buildNanotubeAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Nanotube", None, QtGui.QApplication.UnicodeUTF8)) win.buildNanotubeAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Build Nanotube", None, QtGui.QApplication.UnicodeUTF8)) # Atom Generator example for developers. win.insertAtomAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Insert Atom", None, QtGui.QApplication.UnicodeUTF8)) win.insertAtomAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Insert Atom (Developer Example)", None, QtGui.QApplication.UnicodeUTF8)) # Peptide Generator. piotr 080304 # piotr 080710 : Use "Peptide" label instead of "Protein" # if the "Enable Proteins" debug pref is set to False. # This should be moved to "interactive builders" sections # on the Build Structures toolbar. from utilities.GlobalPreferences import ENABLE_PROTEINS if ENABLE_PROTEINS: win.buildProteinAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Protein", None, QtGui.QApplication.UnicodeUTF8)) win.buildProteinAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Build Protein", None, QtGui.QApplication.UnicodeUTF8)) else: win.buildProteinAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Peptide", None, QtGui.QApplication.UnicodeUTF8)) win.buildProteinAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Generate Peptide", None, QtGui.QApplication.UnicodeUTF8)) #= "Tools > Build Tools" (menu and toolbar) actions. win.modifyHydrogenateAction.setText(QtGui.QApplication.translate("MainWindow", "&Hydrogenate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyHydrogenateAction.setIconText(QtGui.QApplication.translate("MainWindow", "Hydrogenate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyHydrogenateAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Hydrogenate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyDehydrogenateAction.setText(QtGui.QApplication.translate("MainWindow", "&Dehydrogenate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyDehydrogenateAction.setIconText(QtGui.QApplication.translate("MainWindow", "Dehydrogenate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyPassivateAction.setText(QtGui.QApplication.translate("MainWindow", "&Passivate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyPassivateAction.setIconText(QtGui.QApplication.translate("MainWindow", "Passivate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyPassivateAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Passivate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyDeleteBondsAction.setText(QtGui.QApplication.translate( "MainWindow", "Cut &Bonds",None, QtGui.QApplication.UnicodeUTF8)) win.modifyDeleteBondsAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Cut Bonds",None, QtGui.QApplication.UnicodeUTF8)) win.modifyMergeAction.setText(QtGui.QApplication.translate( "MainWindow","Combine",None,QtGui.QApplication.UnicodeUTF8)) win.modifyMergeAction.setToolTip(QtGui.QApplication.translate( "MainWindow","Combine Selected Chunks",None, QtGui.QApplication.UnicodeUTF8)) win.makeChunkFromSelectedAtomsAction.setText(QtGui.QApplication.translate( "MainWindow","New Chunk",None,QtGui.QApplication.UnicodeUTF8)) win.makeChunkFromSelectedAtomsAction.setToolTip(QtGui.QApplication.translate( "MainWindow","Create a new chunk for selected atoms",None, QtGui.QApplication.UnicodeUTF8)) win.modifySeparateAction.setText(QtGui.QApplication.translate( "MainWindow", "&Separate", None,QtGui.QApplication.UnicodeUTF8)) win.modifySeparateAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Separate", None, QtGui.QApplication.UnicodeUTF8)) win.modifyAlignCommonAxisAction.setText(QtGui.QApplication.translate( "MainWindow", "Align to &Common Axis",None, QtGui.QApplication.UnicodeUTF8)) win.modifyAlignCommonAxisAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Align to Common Axis",None, QtGui.QApplication.UnicodeUTF8)) win.modifyCenterCommonAxisAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Center on Common Axis",None, QtGui.QApplication.UnicodeUTF8)) #TOOLS > DIMENSIONS MENU win.jigsDistanceAction.setText(QtGui.QApplication.translate("MainWindow", "Measure Distance", None, QtGui.QApplication.UnicodeUTF8)) win.jigsDistanceAction.setIconText(QtGui.QApplication.translate("MainWindow", "Measure Distance", None, QtGui.QApplication.UnicodeUTF8)) win.jigsAngleAction.setText(QtGui.QApplication.translate("MainWindow", "Measure Angle", None, QtGui.QApplication.UnicodeUTF8)) win.jigsAngleAction.setIconText(QtGui.QApplication.translate("MainWindow", "Measure Angle", None, QtGui.QApplication.UnicodeUTF8)) win.jigsDihedralAction.setText(QtGui.QApplication.translate("MainWindow", "Measure Dihedral", None, QtGui.QApplication.UnicodeUTF8)) win.jigsDihedralAction.setIconText(QtGui.QApplication.translate("MainWindow", "Measure Dihedral", None, QtGui.QApplication.UnicodeUTF8)) #TOOLS > SELECT MENU ITEMS win.selectAllAction.setText(QtGui.QApplication.translate("MainWindow", "&All", None, QtGui.QApplication.UnicodeUTF8)) win.selectAllAction.setIconText(QtGui.QApplication.translate("MainWindow", "All", None, QtGui.QApplication.UnicodeUTF8)) win.selectAllAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Select All (Ctrl+A)", None, QtGui.QApplication.UnicodeUTF8)) win.selectAllAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+A", None, QtGui.QApplication.UnicodeUTF8)) win.selectNoneAction.setText(QtGui.QApplication.translate("MainWindow", "&None", None, QtGui.QApplication.UnicodeUTF8)) win.selectNoneAction.setIconText(QtGui.QApplication.translate("MainWindow", "None", None, QtGui.QApplication.UnicodeUTF8)) win.selectNoneAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Select None (Ctrl+N)", None, QtGui.QApplication.UnicodeUTF8)) win.selectNoneAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+N", None, QtGui.QApplication.UnicodeUTF8)) win.selectInvertAction.setText(QtGui.QApplication.translate("MainWindow", "&Invert", None, QtGui.QApplication.UnicodeUTF8)) win.selectInvertAction.setIconText(QtGui.QApplication.translate("MainWindow", "Invert", None, QtGui.QApplication.UnicodeUTF8)) win.selectInvertAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Invert Selection (Ctrl+Shift+I)", None, QtGui.QApplication.UnicodeUTF8)) win.selectInvertAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Shift+I", None, QtGui.QApplication.UnicodeUTF8)) win.selectConnectedAction.setText(QtGui.QApplication.translate("MainWindow", "&Connected", None, QtGui.QApplication.UnicodeUTF8)) win.selectConnectedAction.setIconText(QtGui.QApplication.translate("MainWindow", "Connected", None, QtGui.QApplication.UnicodeUTF8)) win.selectConnectedAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Select Connected (Ctrl+Shift+C)", None, QtGui.QApplication.UnicodeUTF8)) win.selectConnectedAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Shift+C", None, QtGui.QApplication.UnicodeUTF8)) win.selectDoublyAction.setText(QtGui.QApplication.translate("MainWindow", "&Doubly", None, QtGui.QApplication.UnicodeUTF8)) win.selectDoublyAction.setIconText(QtGui.QApplication.translate("MainWindow", "Doubly", None, QtGui.QApplication.UnicodeUTF8)) win.selectDoublyAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Select Doubly", None, QtGui.QApplication.UnicodeUTF8)) win.selectExpandAction.setIconText(QtGui.QApplication.translate("MainWindow", "Expand", None, QtGui.QApplication.UnicodeUTF8)) win.selectExpandAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Expand Selection (Ctrl+D)", None, QtGui.QApplication.UnicodeUTF8)) win.selectExpandAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+D", None, QtGui.QApplication.UnicodeUTF8)) win.selectContractAction.setIconText(QtGui.QApplication.translate("MainWindow", "Contract", None, QtGui.QApplication.UnicodeUTF8)) win.selectContractAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Contract Selection (Ctrl+Shift+D)", None, QtGui.QApplication.UnicodeUTF8)) win.selectContractAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Shift+D", None, QtGui.QApplication.UnicodeUTF8)) win.selectLockAction.setIconText(QtGui.QApplication.translate("MainWindow", "Lock", None, QtGui.QApplication.UnicodeUTF8)) win.selectLockAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Selection Lock (Ctrl+L)", None, QtGui.QApplication.UnicodeUTF8)) win.selectLockAction.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+L", None, QtGui.QApplication.UnicodeUTF8)) win.selectByNameAction.setText(QtGui.QApplication.translate( "MainWindow", "Select By Name", None, QtGui.QApplication.UnicodeUTF8)) #= "Simulation" (menu and toolbar) actions. win.simSetupAction.setText(QtGui.QApplication.translate( "MainWindow", " Run Dynamics...", None, QtGui.QApplication.UnicodeUTF8)) win.simSetupAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Run Dynamics", None, QtGui.QApplication.UnicodeUTF8)) win.simSetupAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Run Dynamics", None, QtGui.QApplication.UnicodeUTF8)) win.simMoviePlayerAction.setText(QtGui.QApplication.translate( "MainWindow", "Play Movie",None, QtGui.QApplication.UnicodeUTF8)) win.simMoviePlayerAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Play Movie",None, QtGui.QApplication.UnicodeUTF8)) win.rosettaSetupAction.setText(QtGui.QApplication.translate( "MainWindow", " Rosetta", None, QtGui.QApplication.UnicodeUTF8)) win.rosettaSetupAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Rosetta", None, QtGui.QApplication.UnicodeUTF8)) win.rosettaSetupAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Rosetta", None, QtGui.QApplication.UnicodeUTF8)) win.simPlotToolAction.setText(QtGui.QApplication.translate( "MainWindow", "Plot Graphs", None, QtGui.QApplication.UnicodeUTF8)) win.simPlotToolAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Plot Graphs", None, QtGui.QApplication.UnicodeUTF8)) win.jigsESPImageAction.setText(QtGui.QApplication.translate( "MainWindow", "ESP Image", None, QtGui.QApplication.UnicodeUTF8)) win.jigsESPImageAction.setIconText(QtGui.QApplication.translate( "MainWindow", "ESP Image", None, QtGui.QApplication.UnicodeUTF8)) win.simulationJigsAction.setToolTip(QtGui.QApplication.translate( "MainWindow", "Simulation Jigs", None, QtGui.QApplication.UnicodeUTF8)) import sys if sys.platform == "win32": gms_str = "PC GAMESS" else: gms_str = "GAMESS" win.jigsGamessAction.setText(QtGui.QApplication.translate( "MainWindow", gms_str, None, QtGui.QApplication.UnicodeUTF8)) win.jigsGamessAction.setIconText(QtGui.QApplication.translate( "MainWindow", gms_str, None, QtGui.QApplication.UnicodeUTF8)) # Simulation Jigs win.jigsLinearMotorAction.setText(QtGui.QApplication.translate( "MainWindow", "&Linear Motor", None, QtGui.QApplication.UnicodeUTF8)) win.jigsLinearMotorAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Linear Motor", None, QtGui.QApplication.UnicodeUTF8)) win.jigsStatAction.setText(QtGui.QApplication.translate( "MainWindow", "Thermo&stat", None, QtGui.QApplication.UnicodeUTF8)) win.jigsStatAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Thermostat", None, QtGui.QApplication.UnicodeUTF8)) win.jigsAnchorAction.setText(QtGui.QApplication.translate( "MainWindow", "&Anchor", None, QtGui.QApplication.UnicodeUTF8)) win.jigsAnchorAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Anchor", None, QtGui.QApplication.UnicodeUTF8)) win.jigsMotorAction.setText(QtGui.QApplication.translate( "MainWindow", "&Rotary Motor", None, QtGui.QApplication.UnicodeUTF8)) win.jigsMotorAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Rotary Motor", None, QtGui.QApplication.UnicodeUTF8)) #= "Simuation > Measurements" (menu and toolbar) actions. win.jigsThermoAction.setText(QtGui.QApplication.translate( "MainWindow", "&Thermometer", None, QtGui.QApplication.UnicodeUTF8)) win.jigsThermoAction.setIconText(QtGui.QApplication.translate( "MainWindow", "Thermometer", None, QtGui.QApplication.UnicodeUTF8)) #= "Help" (menu and toolbar) actions. win.helpAboutAction.setText(QtGui.QApplication.translate("MainWindow", "&About NanoEngineer-1", None, QtGui.QApplication.UnicodeUTF8)) win.helpAboutAction.setIconText(QtGui.QApplication.translate("MainWindow", "About NanoEngineer-1", None, QtGui.QApplication.UnicodeUTF8)) win.helpWhatsThisAction.setText(QtGui.QApplication.translate("MainWindow", "Enter \"What\'s This\" help mode", None, QtGui.QApplication.UnicodeUTF8)) win.helpWhatsThisAction.setIconText(QtGui.QApplication.translate("MainWindow", "What\'s This", None, QtGui.QApplication.UnicodeUTF8)) win.helpGraphicsCardAction.setText(QtGui.QApplication.translate("MainWindow", "Graphics Card Info...", None, QtGui.QApplication.UnicodeUTF8)) win.helpGraphicsCardAction.setIconText(QtGui.QApplication.translate("MainWindow", "Graphics Card Info", None, QtGui.QApplication.UnicodeUTF8)) win.helpMouseControlsAction.setIconText(QtGui.QApplication.translate("MainWindow", "Mouse Controls...", None, QtGui.QApplication.UnicodeUTF8)) win.helpMouseControlsAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Mouse Controls", None, QtGui.QApplication.UnicodeUTF8)) win.helpKeyboardShortcutsAction.setIconText(QtGui.QApplication.translate("MainWindow", "Keyboard Shortcuts...", None, QtGui.QApplication.UnicodeUTF8)) win.helpKeyboardShortcutsAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Keyboard Shortcuts", None, QtGui.QApplication.UnicodeUTF8)) win.helpSelectionShortcutsAction.setIconText(QtGui.QApplication.translate("MainWindow", "Selection Shortcuts...", None, QtGui.QApplication.UnicodeUTF8)) win.helpSelectionShortcutsAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Selection Shortcuts", None, QtGui.QApplication.UnicodeUTF8)) win.helpTutorialsAction.setText(QtGui.QApplication.translate("MainWindow", "NanoEngineer-1 Tutorials...", None, QtGui.QApplication.UnicodeUTF8)) win.helpTutorialsAction.setIconText(QtGui.QApplication.translate("MainWindow", "NanoEngineer-1 Tutorials...", None, QtGui.QApplication.UnicodeUTF8)) # Other QActions not used in menus. These QActions are used in toolbars, # context menus, etc. win.viewDefviewAction.setText(QtGui.QApplication.translate("MainWindow", "Orientations", None, QtGui.QApplication.UnicodeUTF8)) win.viewDefviewAction.setIconText(QtGui.QApplication.translate("MainWindow", "Orientations", None, QtGui.QApplication.UnicodeUTF8)) win.viewDefviewAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Default Views", None, QtGui.QApplication.UnicodeUTF8)) win.modifyStretchAction.setText(QtGui.QApplication.translate("MainWindow", "S&tretch", None, QtGui.QApplication.UnicodeUTF8)) win.modifyStretchAction.setIconText(QtGui.QApplication.translate("MainWindow", "Stretch", None, QtGui.QApplication.UnicodeUTF8)) win.dispSetEltable1Action.setText(QtGui.QApplication.translate("MainWindow", "Set Atom Colors to Default", None, QtGui.QApplication.UnicodeUTF8)) win.dispSetEltable1Action.setIconText(QtGui.QApplication.translate("MainWindow", "Set Atom Colors to Default", None, QtGui.QApplication.UnicodeUTF8)) win.dispSetEltable2Action.setText(QtGui.QApplication.translate("MainWindow", "Set Atom Colors to Alternate", None, QtGui.QApplication.UnicodeUTF8)) win.dispSetEltable2Action.setIconText(QtGui.QApplication.translate("MainWindow", "Set Atom Colors to Alternate", None, QtGui.QApplication.UnicodeUTF8)) win.dispElementColorSettingsAction.setText(QtGui.QApplication.translate("MainWindow", "Element Color Settings...", None, QtGui.QApplication.UnicodeUTF8)) win.dispElementColorSettingsAction.setIconText(QtGui.QApplication.translate("MainWindow", "Element Color Settings...", None, QtGui.QApplication.UnicodeUTF8)) win.dispLightingAction.setText(QtGui.QApplication.translate("MainWindow", "Lighting...", None, QtGui.QApplication.UnicodeUTF8)) win.dispLightingAction.setIconText(QtGui.QApplication.translate("MainWindow", "Lighting", None, QtGui.QApplication.UnicodeUTF8)) win.dispResetAtomsDisplayAction.setText(QtGui.QApplication.translate("MainWindow", "Reset Atoms Display", None, QtGui.QApplication.UnicodeUTF8)) win.dispResetAtomsDisplayAction.setIconText(QtGui.QApplication.translate("MainWindow", "Reset Atoms Display", None, QtGui.QApplication.UnicodeUTF8)) win.dispShowInvisAtomsAction.setText(QtGui.QApplication.translate("MainWindow", "Show Invisible Atoms", None, QtGui.QApplication.UnicodeUTF8)) win.dispShowInvisAtomsAction.setIconText(QtGui.QApplication.translate("MainWindow", "Show Invisible Atoms", None, QtGui.QApplication.UnicodeUTF8)) win.simNanoHiveAction.setText(QtGui.QApplication.translate("MainWindow", "Nano-Hive...", None, QtGui.QApplication.UnicodeUTF8)) win.simNanoHiveAction.setIconText(QtGui.QApplication.translate("MainWindow", "Nano-Hive", None, QtGui.QApplication.UnicodeUTF8)) win.fileSaveSelectionAction.setIconText(QtGui.QApplication.translate("MainWindow", "Save Selection...", None, QtGui.QApplication.UnicodeUTF8)) win.viewRotatePlus90Action.setIconText(QtGui.QApplication.translate("MainWindow", "Rotate View +90", None, QtGui.QApplication.UnicodeUTF8)) win.viewRotateMinus90Action.setIconText(QtGui.QApplication.translate("MainWindow", "Rotate View -90", None, QtGui.QApplication.UnicodeUTF8)) win.viewNormalToAction.setIconText(QtGui.QApplication.translate("MainWindow", "Set View Normal To", None, QtGui.QApplication.UnicodeUTF8)) win.viewNormalToAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Set View Normal To", None, QtGui.QApplication.UnicodeUTF8)) win.viewParallelToAction.setIconText(QtGui.QApplication.translate("MainWindow", "Set View Parallel To", None, QtGui.QApplication.UnicodeUTF8)) win.viewParallelToAction.setToolTip(QtGui.QApplication.translate("MainWindow", "Set View Parallel To", None, QtGui.QApplication.UnicodeUTF8)) win.viewQuteMolAction.setIconText(QtGui.QApplication.translate("MainWindow", "QuteMolX", None, QtGui.QApplication.UnicodeUTF8)) win.viewRaytraceSceneAction.setIconText(QtGui.QApplication.translate("MainWindow", "POV-Ray", None, QtGui.QApplication.UnicodeUTF8)) win.setViewPerspecAction.setText( QtGui.QApplication.translate( "MainWindow", "Perspective", None, QtGui.QApplication.UnicodeUTF8)) win.setViewOrthoAction.setText( QtGui.QApplication.translate( "MainWindow", "Orthographic", None, QtGui.QApplication.UnicodeUTF8)) win.setStereoViewAction.setText( QtGui.QApplication.translate( "MainWindow", "Stereo View", None, QtGui.QApplication.UnicodeUTF8)) #= Toolbar stuff #= "Standard" toolbar widgets win.toolsSelectMoleculesAction.setText( QtGui.QApplication.translate("MainWindow", "Select Chunks", None, QtGui.QApplication.UnicodeUTF8)) win.toolsSelectMoleculesAction.setToolTip( QtGui.QApplication.translate("MainWindow", "Select Chunks", None, QtGui.QApplication.UnicodeUTF8)) win.toolsMoveMoleculeAction.setText( QtGui.QApplication.translate("MainWindow", "Translate", None, QtGui.QApplication.UnicodeUTF8)) win.toolsMoveMoleculeAction.setToolTip( QtGui.QApplication.translate("MainWindow", "Translate Selection", None, QtGui.QApplication.UnicodeUTF8)) win.rotateComponentsAction.setText( QtGui.QApplication.translate("MainWindow", "Rotate", None, QtGui.QApplication.UnicodeUTF8)) win.rotateComponentsAction.setToolTip( QtGui.QApplication.translate("MainWindow", "Rotate Selection", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/Ui_MainWindowWidgets.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ MWsemantics.py provides the main window class, MWsemantics. @version: $Id$ @copyright: 2004-2009 Nanorex, Inc. See LICENSE file for details. History: too much to mention, except for breakups of the file. [maybe some of those are not listed here?] bruce 050413 split out movieDashboardSlotsMixin bruce 050907 split out fileSlotsMixin mark 060120 split out viewSlotsMixin mark 2008-02-02 split out displaySlotsMixin [Much more splitup of this file is needed. Ideally we would split up the class MWsemantics (as for BuildCrystal_Command), not just the file.] [some of that splitup has been done, now, by Ninad in the Qt4 branch] """ from utilities.qt4transition import qt4warning from PyQt4 import QtGui, QtCore from PyQt4.Qt import Qt from PyQt4.Qt import QFont from PyQt4.Qt import QMenu from PyQt4.Qt import QSettings from PyQt4.Qt import QVariant from PyQt4.Qt import QMainWindow, SIGNAL from PyQt4.Qt import QMessageBox from PyQt4.Qt import QToolBar from PyQt4.Qt import QStatusBar from model.elements import PeriodicTable from model.assembly import Assembly from graphics.drawing.graphics_card_info import get_gl_info_string ## grantham 20051201 import os, sys import time from utilities import debug_flags from platform_dependent.PlatformDependent import find_or_make_Nanorex_directory from platform_dependent.PlatformDependent import open_file_in_editor from platform_dependent.PlatformDependent import find_or_make_Nanorex_subdir from ne1_ui.ViewOrientationWindow import ViewOrientationWindow # Ninad 061121 from utilities.debug import print_compact_traceback from utilities.debug_prefs import debug_pref, Choice_boolean_False from utilities.constants import str_or_unicode from utilities.constants import RECENTFILES_QSETTINGS_KEY from ne1_ui.Ui_MainWindow import Ui_MainWindow from ne1_ui.Ui_PartWindow import Ui_PartWindow from utilities.Log import greenmsg, redmsg, orangemsg from operations.ops_files import fileSlotsMixin from operations.ops_view import viewSlotsMixin from operations.ops_display import displaySlotsMixin from operations.ops_modify import modifySlotsMixin from operations.ops_select import renameableLeafNode from foundation.changes import register_postinit_object import foundation.preferences as preferences import foundation.env as env import foundation.undo_internals as undo_internals from commandSequencer.CommandSequencer import CommandSequencer from operations.ops_select import objectSelected from operations.ops_select import ATOMS from widgets.widget_helpers import TextMessageBox from widgets.simple_dialogs import grab_text_line_using_dialog from utilities.prefs_constants import qutemol_enabled_prefs_key from utilities.prefs_constants import nanohive_enabled_prefs_key from utilities.prefs_constants import povray_enabled_prefs_key from utilities.prefs_constants import megapov_enabled_prefs_key from utilities.prefs_constants import povdir_enabled_prefs_key from utilities.prefs_constants import gamess_enabled_prefs_key from utilities.prefs_constants import gromacs_enabled_prefs_key from utilities.prefs_constants import cpp_enabled_prefs_key from utilities.prefs_constants import rosetta_enabled_prefs_key from utilities.prefs_constants import rosetta_database_enabled_prefs_key from utilities.prefs_constants import nv1_enabled_prefs_key from utilities.prefs_constants import workingDirectory_prefs_key from utilities.prefs_constants import getDefaultWorkingDirectory from utilities.prefs_constants import rememberWinPosSize_prefs_key from utilities.prefs_constants import captionPrefix_prefs_key from utilities.prefs_constants import captionSuffix_prefs_key from utilities.prefs_constants import captionFullPath_prefs_key from utilities.prefs_constants import displayRulers_prefs_key from utilities.prefs_constants import mouseWheelDirection_prefs_key from utilities.prefs_constants import zoomInAboutScreenCenter_prefs_key from utilities.prefs_constants import zoomOutAboutScreenCenter_prefs_key eCCBtab1 = [1,2, 5,6,7,8,9,10, 13,14,15,16,17,18, 32,33,34,35,36, 51,52,53,54] eCCBtab2 = {} for i, elno in zip(range(len(eCCBtab1)), eCCBtab1): eCCBtab2[elno] = i # Debugging for "Open Recent Files" menu. Mark 2007-12-28 debug_recent_files = False # Do not commit with True recentfiles_use_QSettings = True # bruce 050919 debug flag if debug_recent_files: def debug_fileList(fileList): print "BEGIN fileList" for x in fileList: print x print "END fileList" else: def debug_fileList(fileList): pass # ####################################################################### class MWsemantics(QMainWindow, fileSlotsMixin, viewSlotsMixin, displaySlotsMixin, modifySlotsMixin, Ui_MainWindow, object): """ The single Main Window object. """ #bruce 071008 added object superclass # bruce 050413 fileSlotsMixin needs to come before MainWindow in the list # of superclasses, since MainWindow overrides its methods with "NIM stubs". # mark 060120: same for viewSlotsMixin. initialised = 0 #bruce 041222 _ok_to_autosave_geometry_changes = False #bruce 051218 # The default font for the main window. If I try to set defaultFont using QApplition.font() here, # it returns Helvetica pt12 (?), so setting it below in the constructor is a workaround. # Mark 2007-05-27. defaultFont = None def __init__(self, parent = None, name = None): assert isinstance(self, object) #bruce 071008 self._init_part_two_done = False self._activepw = None self.commandToolbar = None self.orientationWindow = None self._dnaSequenceEditor = None #see self.createSequenceEditrIfNeeded #for details self._proteinSequenceEditor = None # These boolean flags, if True, stop the execution of slot # methods that are called because the state of 'self.viewFullScreenAction # or self.viewSemiFullScreenAction is changed. Maybe there is a way to # do this using QActionGroup (which make the actions mutually exclusive) #.. tried that but it didn't work. After doing this when I tried to # toggle the checked action in the action group, it didn't work #..will try it again sometime in future. The following flags are good # enough for now. See methods self.showFullScreen and # self.showSemiFullScreen where they are used. -- Ninad 2007-12-06 self._block_viewFullScreenAction_event = False self._block_viewSemiFullScreenAction_event = False # The following maintains a list of all widgets that are hidden during # the FullScreen or semiFullScreen mode. This list is then used in # self.showNormal to show the hidden widgets if any. The list is cleared # at the end of self.showNormal self._widgetToHideDuringFullScreenMode = [] undo_internals.just_before_mainwindow_super_init() qt4warning('MainWindow.__init__(self, parent, name, Qt.WDestructiveClose) - what is destructive close?') QMainWindow.__init__(self, parent) self.defaultFont = QFont(self.font()) # Makes copy of app's default font. # Setup the NE1 graphical user interface. self.setupUi() # Ui_MainWindow.setupUi() undo_internals.just_after_mainwindow_super_init() # bruce 050104 moved this here so it can be used earlier # (it might need to be moved into main.py at some point) self.tmpFilePath = find_or_make_Nanorex_directory() # Load all NE1 custom cursors. from ne1_ui.cursors import loadCursors loadCursors(self) # Set the main window environment variable. This sets a single # global variable to self. All uses of it need review (and revision) # to add support for MDI. Mark 2008-01-02. env.setMainWindow(self) # Start NE1 with an empty document called "Untitled". # See also the _make_and_init_assy method in our mixin class in # ops_files.py, which creates and inits an assy using the same method. # # Note: It is very desirable to change this startup behavior so that # the user must select "File > New" to open an empty document after # NE1 starts. Mark 2007-12-30. self.assy = self._make_a_main_assy() #bruce 050429: as part of fixing bug 413, it's now required to call # self.assy.reset_changed() sometime in this method; it's called below. pw = Ui_PartWindow(self.assy, self) # note: calls glpane.setAssy inside GLPane.__init__; that calls _reinit_modes self.assy.set_glpane(pw.glpane) # sets assy.o and assy.glpane self.assy.set_modelTree(pw.modelTree) # sets assy.mt self._activepw = pw # Note: nothing in this class can set self._activepw (except to None), # which one might guess means that no code yet switches between partwindows, # but GLPane.makeCurrent *does* set self._activepw to its .partWindow # (initialized to its parent arg when it's created), so that conclusion is not clear. # [bruce 070503 comment] # Set the caption to the name of the current (default) part - Mark [2004-10-11] self.update_mainwindow_caption() # This is only used by the Atom Color preference dialog, not the # molecular modeling kit in Build Atom (deposit mode), etc. start_element = 6 # Carbon self.Element = start_element # Attr/list for Atom Selection Filter. mark 060401 # These should become attrs of the assy. mark 2008-01-02. self.filtered_elements = [] # Holds list of elements to be selected when the Atom Selection Filter is enabled. self.filtered_elements.append(PeriodicTable.getElement(start_element)) # Carbon self.selection_filter_enabled = False # Set to True to enable the Atom Selection Filter. # Enables the QWorkspace widget which provides Multiple Document # Interface (MDI) support for NE1 and adds the Part Window to it. # If not enabled, just add the Part Window widget to the # centralAreaVBoxLayout only (the default). if debug_pref("Enable QWorkspace for MDI support? (next session)", Choice_boolean_False, ## non_debug = True, #bruce 080416 hid this, since MDI is not yet implemented # (this change didn't make it into .rc2) prefs_key = "A10/Use QWorkspace"): print "QWorkspace for MDI support is enabled (experimental)" from PyQt4.Qt import QWorkspace self.workspace = QWorkspace() # Note: The QWorkspace class is deprecated in Qt 4.3 and instructs # developers to use the new QMdiArea class instead. # See: http://doc.trolltech.com/4.3/qmdiarea.html # Uncomment the two lines below when we've upgraded to Qt 4.3. # from PyQt4.Qt import QMdiArea # self.workspace = QMdiArea() self.centralAreaVBoxLayout.addWidget(self.workspace) self.workspace.addWindow(pw) pw.showMaximized() else: self.centralAreaVBoxLayout.addWidget(pw) if not self._init_part_two_done: # I bet there are pieces of _init_part_two that should be done EVERY time we bring up a # new partwindow. # [I guess that comment is by Will... for now, this code doesn't do those things # more than once, it appears. [bruce 070503 comment]] MWsemantics._init_part_two(self) self.commandSequencer.start_using_initial_mode('$STARTUP_MODE') env.register_post_event_ui_updater( self.post_event_ui_updater) #bruce 070925 #Urmi 20080716: initiliaze the Rosetta simulation parameters self.rosettaArgs = [] return def _make_a_main_assy(self): #bruce 080813 split this out, revised """ [private] Make a new main assy, meant for caller to store as self.assy. Called during __init__, and by _make_and_init_assy (in a mixin class) for fileClose and fileOpen. """ res = Assembly(self, "Untitled", own_window_UI = True, run_updaters = True, commandSequencerClass = CommandSequencer ) #bruce 060127 added own_window_UI flag to help fix bug 1403; # it's required for this assy to support Undo. return res def _init_part_two(self): """ #@ NEED DOCSTRING """ # Create the NE1 Progress Dialog. mark 2007-12-06 self.createProgressDialog() # Create the Preferences dialog widget. from ne1_ui.prefs.Preferences import Preferences self.userPrefs = Preferences(self.assy) # Enable/disable plugins. These should be moved to a central method # where all plug-ins get added and enabled during invocation. Mark 050921. self.userPrefs.enable_qutemol(env.prefs[qutemol_enabled_prefs_key]) self.userPrefs.enable_nanohive(env.prefs[nanohive_enabled_prefs_key]) self.userPrefs.enable_povray(env.prefs[povray_enabled_prefs_key]) self.userPrefs.enable_megapov(env.prefs[megapov_enabled_prefs_key]) self.userPrefs.enable_povdir(env.prefs[povdir_enabled_prefs_key]) self.userPrefs.enable_gamess(env.prefs[gamess_enabled_prefs_key]) self.userPrefs.enable_gromacs(env.prefs[gromacs_enabled_prefs_key]) self.userPrefs.enable_cpp(env.prefs[cpp_enabled_prefs_key]) self.userPrefs.enable_rosetta(env.prefs[rosetta_enabled_prefs_key]) self.userPrefs.enable_rosetta_db(env.prefs[rosetta_database_enabled_prefs_key]) self.userPrefs.enable_nv1(env.prefs[nv1_enabled_prefs_key]) #Mouse wheel behavior settings. self.updateMouseWheelSettings() # Create the Help dialog. Mark 050812 from ne1_ui.help.help import Ne1HelpDialog self.help = Ne1HelpDialog() from commands.PovraySceneProperties.PovraySceneProp import PovraySceneProp self.povrayscenecntl = PovraySceneProp(self) from commands.CommentProperties.CommentProp import CommentProp self.commentcntl = CommentProp(self) # Minimize Energy dialog. Mark 060705. from commands.MinimizeEnergy.MinimizeEnergyProp import MinimizeEnergyProp self.minimize_energy = MinimizeEnergyProp(self) # Atom Generator example for developers. Mark and Jeff. 2007-06-13 from commands.BuildAtom.AtomGenerator import AtomGenerator self.atomcntl = AtomGenerator(self) # We must enable keyboard focus for a widget if it processes # keyboard events. [Note added by bruce 041223: I don't know if this is # needed for this window; it's needed for some subwidgets, incl. glpane, # and done in their own code. This window forwards its own key events to # the glpane. This doesn't prevent other subwidgets from having focus.] self.setFocusPolicy(QtCore.Qt.StrongFocus) # 'depositState' is used by BuildAtoms_Command #to determine what type of object (atom, clipboard chunk or library part) # to deposit when pressing the left mouse button in Build mode. # # depositState can be either: # 'Atoms' - deposit an atom based on the current atom type selected in the MMKit 'Atoms' # page or dashboard atom type combobox(es). # 'Clipboard' - deposit a chunk from the clipboard based on what is currently selected in # the MMKit 'Clipboard' page or dashboard clipboard/paste combobox. # 'Library' - deposit a part from the library based on what is currently selected in the # MMKit 'Library' page. There is no dashboard option for this. self.depositState = 'Atoms' self.assy.reset_changed() #bruce 050429, part of fixing bug 413 # 'movie_is_playing' is a flag that indicates a movie is playing. It is # used by other code to speed up rendering times by optionally disabling # the (re)building of display lists for each frame of the movie. self.movie_is_playing = False # Current Working Directory (CWD). # When NE1 starts, the CWD is set to the Working Directory (WD) # preference from the user prefs db. Every time the user opens or # inserts a file during a session, the CWD changes to the directory # containing that file. When the user closes the current file and then # attempts to open a new file, the CWD will still be the directory of # the last file opened or inserted. # If the user changes the WD via 'File > Set Working Directory' when # a file is open, the CWD will not be changed to the new WD. (This # rule may change. Need to discuss with Ninad). # On the other hand, if there is no part open, the CWD will be # changed to the new WD. Mark 060729. self.currentWorkingDirectory = '' # Make sure the working directory from the user prefs db exists since # it might have been deleted. if os.path.isdir(env.prefs[workingDirectory_prefs_key]): self.currentWorkingDirectory = env.prefs[workingDirectory_prefs_key] else: # The CWD does not exist, so set it to the default working dir. self.currentWorkingDirectory = getDefaultWorkingDirectory() # bruce 050810 replaced user preference initialization with this, # and revised update_mainwindow_caption to match from foundation.changes import Formula self._caption_formula = Formula( # this should depend on whatever update_mainwindow_caption_properly depends on; # but it can't yet depend on assy.has_changed(), # so that calls update_mainwindow_caption_properly (or the equiv) directly. lambda: (env.prefs[captionPrefix_prefs_key], env.prefs[captionSuffix_prefs_key], env.prefs[captionFullPath_prefs_key]), self.update_mainwindow_caption_properly ) # Setting 'initialized' to 1 enables win_update(). # [should this be moved into _init_after_geometry_is_set?? # bruce 060104 question] self.initialised = 1 # be told to add new Jigs menu items, now or as they become available [bruce 050504] register_postinit_object( "Jigs menu items", self ) # Anything which depends on this window's geometry (which is not yet set at this point) # should be done in the _init_after_geometry_is_set method below, not here. [bruce guess 060104] self._init_part_two_done = True return # from _init_part_two def updateMouseWheelSettings(self): """ Updates important mouse wheel attrs kept in self, including: - Mouse direction - Zoom in point - Zoom out point @note: These are typically set from the Preferences dialog. """ if env.prefs[mouseWheelDirection_prefs_key] == 0: self.mouseWheelDirection = 1 else: self.mouseWheelDirection = -1 self.mouseWheelZoomInPoint = env.prefs[zoomInAboutScreenCenter_prefs_key] self.mouseWheelZoomOutPoint = env.prefs[zoomOutAboutScreenCenter_prefs_key] def _get_commandSequencer(self): #bruce 080813 revised res = self.assy.commandSequencer assert res return res commandSequencer = property(_get_commandSequencer) def _get_currentCommand(self): return self.commandSequencer.currentCommand currentCommand = property(_get_currentCommand) def post_event_ui_updater(self): #bruce 070925 self.currentCommand.command_post_event_ui_updater() return def createPopupMenu(self): # Ninad 070328 """ Returns a popup menu containing checkable entries for the toolbars and dock widgets present in the main window. This function is called by the main window every time the user activates a context menu, typically by right-clicking on a toolbar or a dock widget. This reimplements QMainWindow's createPopupMenu() method. @return: The popup menu. @rtype: U{B{QMenu}<http://doc.trolltech.com/4/qmenu.html>} @note: All main window toolbars must be created before calling createPopupMenu(). @see: U{B{QMainWindow.createPopupMenu} <http://doc.trolltech.com/4.3/qmainwindow.html#createPopupMenu>} """ menu = QMenu(self) contextMenuToolBars = \ [self.standardToolBar, self.viewToolBar, self.standardViewsToolBar, self.displayStylesToolBar, self.simulationToolBar, self.buildToolsToolBar, self.selectToolBar, self.buildStructuresToolBar, self.renderingToolBar] for toolbar in contextMenuToolBars: menu.addAction(toolbar.toggleViewAction()) return menu def showFullScreen(self): """ Full screen mode. (maximize the glpane real estate by hiding/ collapsing other widgets. (only Menu bar and the glpane are shown) The widgets hidden or collapsed include: - MainWindow Title bar - Command Manager, - All toolbars, - ModelTree/PM area, - History Widget, - Statusbar @param val: The state of the QAction (checked or uncheced) If True, it will show the main window full screen , otherwise show it with its regular size @type val: boolean @see: self.showSemiFullScreen, self.showNormal @see: ops_view.viewSlotsMixin.setViewFullScreen """ if self._block_viewFullScreenAction_event: #see self.__init__ for a detailed comment about this instance #variable return self._block_viewFullScreenAction_event = False if self.viewSemiFullScreenAction.isChecked(): self._block_viewSemiFullScreenAction_event = True self.viewSemiFullScreenAction.setChecked(False) self._block_viewSemiFullScreenAction_event = False self._showFullScreenCommonCode() for widget in self.children(): if isinstance(widget, QToolBar): if widget.isVisible(): widget.hide() self._widgetToHideDuringFullScreenMode.append(widget) self.commandToolbar.hide() def _showFullScreenCommonCode(self, hideLeftArea = True): """ The common code for making the Mainwindow full screen (maximimzing the 3D workspace area) This is used by both, View > Full Screen and View > Semi-Full Screen @see: self.showFullScreen @see: self._showSemiFullScreen """ #see self.__init__ for a detailed comment about this list self._widgetToHideDuringFullScreenMode = [] QMainWindow.showFullScreen(self) for widget in self.children(): if isinstance(widget, QStatusBar): if widget.isVisible(): widget.hide() self._widgetToHideDuringFullScreenMode.append(widget) self.activePartWindow().collapseLeftArea(hideLeftArea) self.reportsDockWidget.hide() def showSemiFullScreen(self): """ Semi-Full Screen mode. (maximize the glpane real estate by hiding/ collapsing other widgets. This is different than the 'Full Screen mode' as it hides or collapses only the following widgets -- - MainWindow Title bar and border - Report Widget - Statusbar @param val: The state of the QAction (checked or uncheced) If True, it will show the main window full screen , otherwise show it with its regular size @type val: boolean @see: self.showFullScreen, self.showNormal @see: ops_view.viewSlotsMixin.setViewSemiFullScreen """ if self._block_viewSemiFullScreenAction_event: #see self.__init__ for a detailed comment about this instance #variable return self._block_viewSemiFullScreenAction_event = False if self.viewFullScreenAction.isChecked(): self._block_viewFullScreenAction_event = True self.viewFullScreenAction.setChecked(False) self._block_viewFullScreenAction_event = False self._showFullScreenCommonCode(hideLeftArea = False) def showNormal(self): QMainWindow.showNormal(self) self.activePartWindow().expandLeftArea() # Note: This will show the reports dock widget even if the user # dismissed it earlier in his session. This is OK, they can just # dismiss it again if they don't want it. If users complain, this # will be easy to fix by overriding its hide() and show() methods # (I suggest adding a keyword arg to hide() called "breifly", set # to False by default, which sets a flag attr that show() can check. # Mark 2008-01-05. self.reportsDockWidget.show() for widget in self._widgetToHideDuringFullScreenMode: widget.show() self.commandToolbar.show() #Clear the list of hidden widgets (those are no more hidden) self._widgetToHideDuringFullScreenMode = [] def activePartWindow(self): # WARNING: this is inlined in a few methods of self return self._activepw def get_glpane(self): #bruce 071008; inlines self.activePartWindow return self._activepw.glpane glpane = property(get_glpane) #bruce 071008 to replace __getattr__ def get_mt(self): #bruce 071008; inlines self.activePartWindow # TODO: rename .mt to .modelTree return self._activepw.modelTree mt = property(get_mt) #bruce 071008 to replace __getattr__ def closeEvent(self, ce): fileSlotsMixin.closeEvent(self, ce) def sponsoredList(self): return ( self.povrayscenecntl, self.minimize_energy) def _init_after_geometry_is_set(self): #bruce 060104 renamed this from startRun and replaced its docstring. """ Do whatever initialization of self needs to wait until its geometry has been set. [Should be called only once, after geometry is set; can be called before self is shown. As of 070531, this is called directly from main.py, after our __init__ but before we're first shown.] """ # older docstring: # After the main window(its size and location) has been setup, begin to run the program from this method. # [Huaicai 11/1/05: try to fix the initial MMKitWin off screen problem by splitting from the __init__() method] self.win_update() # bruce 041222 undo_internals.just_before_mainwindow_init_returns() # (this is now misnamed, now that it's not part of __init__) return __did_cleanUpBeforeExiting = False #bruce 070618 def cleanUpBeforeExiting(self): #bruce 060127 added this re bug 1412 (Python crashes on exit, newly common) """ NE1 is going to exit. (The user has already been given the chance to save current files if they are modified, and (whether or not they were saved) has approved the exit.) Perform whatever internal side effects are desirable to make the exit safe and efficient, and/or to implement features which save other info (e.g. preferences) upon exiting. This should be safe to call more than once, even though doing so is a bug. """ # We do most things in their own try/except clauses, so if they fail, # we'll still do the other actions [bruce 070618 change]. # But we always print something if they fail. if self.__did_cleanUpBeforeExiting: # This makes sure it's safe to call this method more than once. # (By itself, this fixes the exception in bug 2444 but not the double dialogs from it. # The real fix for bug 2444 is elsewhere, and means this is no longer called more than once, # but I'll leave this in for robustness.) [bruce 070618] return self.__did_cleanUpBeforeExiting = True msg = "exception (ignored) in cleanUpBeforeExiting: " try: # wware 060406 bug 1263 - signal the simulator that we are exiting # (bruce 070618 moved this here from 3 places in prepareToCloseAndExit.) from simulation.runSim import SimRunner SimRunner.PREPARE_TO_CLOSE = True except: print_compact_traceback( msg ) try: env.history.message(greenmsg("Exiting program.")) except: print_compact_traceback( msg ) try: if env.prefs[rememberWinPosSize_prefs_key]: # Fixes bug 1249-2. Mark 060518. self.userPrefs.save_current_win_pos_and_size() except: print_compact_traceback( msg ) ## self._make_and_init_assy() # (this seems to take too long, and is probably not needed) try: self.deleteOrientationWindow() # ninad 061121- perhaps it's unnecessary except: print_compact_traceback( msg ) try: if self.assy: self.assy.close_assy() # note: we won't also call # self.assy.commandSequencer.exit_all_commands # (with or without warn_about_abandoned_changes = False). # Ideally we might sometimes like that warning here, # but it's better to never have it than to risk exit bugs # (in case it's too late to give it), # or to bother users with duplicate warnings (if they # already said to discard ordinary unsaved changes, # different than the ones that warns about) which we # don't presently have enough info to avoid giving. # As for the exits themselves, they are not needed, # and might be too slow and/or risk exit bugs. # [bruce 080909 comment] self.assy.deinit() # in particular, stop trying to update Undo/Redo actions # all the time (which might cause crashes once their # associated widgets are deallocated) except: print_compact_traceback( msg ) return def postinit_item(self, item): #bruce 050504 try: item(self) except: # blame item print_compact_traceback( "exception (ignored) in postinit_item(%r): " % item ) return def win_update(self): """ Update most state which directly affects the GUI display, in some cases repainting it directly. (Someday this should update all of it, but only what's needed, and perhaps also call QWidget.update. #e) [no longer named update, since that conflicts with QWidget.update] """ if not self.initialised: return pw = self.activePartWindow() pw.glpane.gl_update() pw.modelTree.mt_update() self.reportsDockWidget.history_object.h_update() # this is self.reportsDockWidget.history_object, not env.history, # since it's really about this window's widget-owner, # not about the place to print history messages [bruce 050913] return ################################### # File Toolbar Slots ################################### # file toolbar slots are inherited from fileSlotsMixin (in ops_files.py) as of bruce 050907. # Notes: # #e closeEvent method (moved to fileSlotsMixin) should be split in two # and the outer part moved back into this file. # _make_and_init_assy method was moved to fileSlotsMixin (as it should be) ################################### # Edit Toolbar Slots ################################### def editMakeCheckpoint(self): """ Slot for making a checkpoint (only available when Automatic Checkpointing is disabled). """ import operations.undo_UI as undo_UI undo_UI.editMakeCheckpoint(self) return def editUndo(self): self.assy.editUndo() def editRedo(self): self.assy.editRedo() def editAutoCheckpointing(self, enabled): """ Slot for enabling/disabling automatic checkpointing. """ import foundation.undo_manager as undo_manager undo_manager.editAutoCheckpointing(self, enabled) # note: see code comment there, for why that's not in undo_UI. # note: that will probably do this (among other things): # self.editMakeCheckpointAction.setVisible(not enabled) return def editClearUndoStack(self): """ Slot for clearing the Undo Stack. Requires the user to confirm. """ import operations.undo_UI as undo_UI undo_UI.editClearUndoStack(self) return # bruce 050131 moved some history messages from the following methods # into the assy methods they call, so the menu command versions also # have them def editCut(self): self.assy.cut_sel() self.win_update() def editCopy(self): self.assy.copy_sel() self.win_update() def editPaste(self): """ Single shot paste operation accessible using 'Ctrl + V' or Edit > Paste. Implementation notes for the single shot paste operation: - The object (chunk or group) is pasted with a slight offset. Example: Create a graphene sheet, select it , do Ctrl + C and then Ctrl + V ... the pasted object is offset to original one. - It deselects others, selects the pasted item and then does a zoom to selection so that the selected item is in the center of the screen. - Bugs/ Unsupported feature: If you paste multiple copies of an object they are pasted at the same location. (i.e. the offset is constant) @see: L{ops_copy_Mixin.paste} """ if self.assy.shelf.members: pastables = self.assy.shelf.getPastables() if not pastables: msg = orangemsg("Nothing to paste.") env.history.message(msg) return recentPastable = pastables[-1] self.assy.paste(recentPastable) else: msg = orangemsg("Nothing to paste.") env.history.message(msg) return def editPasteFromClipboard(self): """ Invokes the L{PasteFromClipboard_Command}, a temporary command to paste items in the clipboard, into the 3D workspace. It also stores the command NE1 should return to after exiting this temporary command. """ if self.assy.shelf.members: pastables = self.assy.shelf.getPastables() if not pastables: msg = orangemsg("Nothing to paste. Paste Command cancelled.") env.history.message(msg) return #pre-commandstack refactoring/cleanup comment: #Make 'paste' as a general command to fix this bug: Enter Dna command #, invoke paste command, exit paste, enter Dna again -- the flyout #toolbar for dna is not visible . This whole thing will get revised #after the command stack cleanup (to be coded soon) # -- Ninad 2008-07-29 self.commandSequencer.userEnterCommand('PASTE') else: msg = orangemsg("Clipboard is empty. Paste Command cancelled.") env.history.message(msg) return def insertPartFromPartLib(self): """ Sets the current command to L{PartLibrary_Command}, for inserting (pasting) a part from the partlib into the 3D workspace. It also stores the command NE1 should return to after exiting this temporary command. """ self.commandSequencer.userEnterCommand('PARTLIB') #bruce 071011 guess ### REVIEW return # TODO: rename killDo to editDelete def killDo(self): """ Deletes selected atoms, chunks, jigs and groups. """ self.assy.delete_sel() ##bruce 050427 moved win_update into delete_sel as part of fixing bug 566 ##self.win_update() def resizeSelectedDnaSegments(self): """ Invokes the MultipleDnaSegmentResize_EditCommand to resize the selected segments. @see: chunk.make_glpane_cmenu_items (which makes a context menu which has an item which can call this method) """ #TODO: need more ui options to invoke this command. selectedSegments = self.assy.getSelectedDnaSegments() if len(selectedSegments) > 0: commandSequencer = self.commandSequencer commandSequencer.userEnterCommand('MULTIPLE_DNA_SEGMENT_RESIZE') assert commandSequencer.currentCommand.commandName == 'MULTIPLE_DNA_SEGMENT_RESIZE' commandSequencer.currentCommand.editStructure(list(selectedSegments)) return def editAddSuffix(self): """ Adds a suffix to the name(s) of the selected objects. """ # Don't allow renaming while animating (b/w views). if self.glpane.is_animating: return _cmd = greenmsg("Add Suffix: ") if not objectSelected(self.assy): if objectSelected(self.assy, objectFlags = ATOMS): _msg = redmsg("Cannot rename atoms.") else: _msg = redmsg("Nothing selected.") env.history.message(_cmd + _msg) return _renameList = self.assy.getSelectedRenameables() ok, new_name = grab_text_line_using_dialog( title = "Add Suffixes", label = "Suffix to add to selected nodes:", iconPath = "ui/actions/Edit/Add_Suffixes.png") if not ok: return _number_renamed = 0 for _object in _renameList: if _object.rename_enabled(): _new_name = _object.name + new_name print "new name = ", _new_name ok, info = _object.try_rename(_new_name) if ok: _number_renamed += 1 _msg = "%d of %d selected objects renamed." \ % (_number_renamed, len(_renameList)) env.history.message(_cmd + _msg) def editRenameSelection(self): # probably by Mark """ Renames multiple selected objects (chunks or jigs). """ # Don't allow renaming while animating (b/w views). if self.glpane.is_animating: return _cmd = greenmsg("Rename: ") if not objectSelected(self.assy): if objectSelected(self.assy, objectFlags = ATOMS): _msg = redmsg("Cannot rename atoms.") else: _msg = redmsg("Nothing selected.") env.history.message(_cmd + _msg) return _renameList = self.assy.getSelectedRenameables() ok, new_name = grab_text_line_using_dialog( title = "Rename", label = "New name:", iconPath = "ui/actions/Edit/Rename.png") if not ok: # No msg. Ok for now. --Mark return # Renumber the selected objects if the last character is "#" # i.e. the # character will be replaced by a number, resulting in # uniquely named (numbered) nodes in the model tree. # IIRC, the numbering is not guaranteed to be in any specific order, # but testing has shown that leaf nodes are numbered in the order # they appear in the model tree. --Mark 2008-11-12 # REVIEW: I would guess that getSelectedRenameables is guaranteed # to return nodes in model tree order. If analysis of its code # confirms that, then its docstring should be made to say that. # [bruce 090115 comment] if new_name[-1] == "#": _renumber = True new_name = new_name[:-1] else: _renumber = False _number_renamed = 0 for _object in _renameList: if renameableLeafNode(_object): # REVIEW: should renameableLeafNode be tested by getSelectedRenameables? # [bruce 081124 question] if _renumber: ok, info = _object.try_rename(new_name + str(_number_renamed + 1)) else: ok, info = _object.try_rename(new_name) if ok: _number_renamed += 1 _msg = "%d of %d selected objects renamed." \ % (_number_renamed, len(_renameList)) env.history.message(_cmd + _msg) return def renameObject(self, object): """ Prompts the user to rename I{object}, which can be any renameable node. @param object: The object to be renamed. @type object: Node @return: A descriptive message about what happened. @rtype: string """ # Don't allow renaming while animating (b/w views). if self.glpane.is_animating: return # Note: see similar code in rename_node_using_dialog in another class. oldname = object.name ok = object.rename_enabled() # Various things below can set ok to False (if it's not already) # and set text to the reason renaming is not ok (for use in error messages). # Or they can put the new name in text, leave ok True, and do the renaming. if not ok: text = "Renaming this object is not permitted." #e someday we might want to call try_rename on fake text # to get a more specific error message... for now it doesn't have one. else: ok, text = grab_text_line_using_dialog( title = "Rename", label = "new name for [%s]:" % oldname, iconPath = "ui/actions/Edit/Rename.png", default = oldname ) if ok: ok, text = object.try_rename(text) if ok: msg = "Renamed [%s] to [%s]" % (oldname, text) self.mt.mt_update() else: msg = "Can't rename [%s]: %s" % (oldname, text) # text is reason why not return msg def editRename(self): """ Renames the selected node/object. @note: Does not work for DnaStrands or DnaSegments. @deprecated: Use editRenameSelection instead. """ _cmd = greenmsg("Rename: ") if not objectSelected(self.assy): if objectSelected(self.assy, objectFlags = ATOMS): _msg = redmsg("Cannot rename atoms.") else: _msg = redmsg("Nothing selected.") env.history.message(_cmd + _msg) return _renameableList = self.assy.getSelectedRenameables() _numSelectedObjects = len(_renameableList) # _numSelectedObjects is > 1 if the user selected a single DnaStrand # or DnaSegment, since they contain chunk nodes. This is a bug # that I will discuss with Bruce. --Mark 2008-03-14 if _numSelectedObjects == 0: _msg = "Renaming this object is not permitted." elif _numSelectedObjects == 1: _msg = self.renameObject(_renameableList[0]) else: _msg = redmsg("Only one object can be selected.") env.history.message(_cmd + _msg) def editPrefs(self): """ Edit Preferences """ self.userPrefs.show() ################################### # View Toolbar Slots ################################### # View toolbar slots are inherited from viewSlotsMixin # (in ops_view.py) as of 2006-01-20. Mark ################################### # Display Toolbar Slots ################################### # Display toolbar slots are inherited from displaySlotsMixin # (in ops_display.py) as of 2008-020-02. Mark ############################################################### # Select Toolbar Slots ############################################################### def selectAll(self): """ Select all parts if nothing selected. If some parts are selected, select all atoms in those parts. If some atoms are selected, select all atoms in the parts in which some atoms are selected. """ env.history.message(greenmsg("Select All:")) self.assy.selectAll() def selectNone(self): env.history.message(greenmsg("Select None:")) self.assy.selectNone() def selectInvert(self): """ If some parts are selected, select the other parts instead. If some atoms are selected, select the other atoms instead (even in chunks with no atoms selected, which end up with all atoms selected). (And unselect all currently selected parts or atoms.) """ #env.history.message(greenmsg("Invert Selection:")) # assy method revised by bruce 041217 after discussion with Josh self.assy.selectInvert() def selectConnected(self): """ Select any atom that can be reached from any currently selected atom through a sequence of bonds. """ self.assy.selectConnected() def selectDoubly(self): """ Select any atom that can be reached from any currently selected atom through two or more non-overlapping sequences of bonds. Also select atoms that are connected to this group by one bond and have no other bonds. """ self.assy.selectDoubly() def selectExpand(self): """ Slot for Expand Selection, which selects any atom that is bonded to any currently selected atom. """ self.assy.selectExpand() def selectContract(self): """ Slot for Contract Selection, which unselects any atom which has a bond to an unselected atom, or which has any open bonds. """ self.assy.selectContract() def selectLock(self, lockState): """ Slot for Lock Selection, which locks/unlocks selection. @param lockState: The new selection lock state, either locked (True) or unlocked (False). @type lockState: boolean """ self.assy.lockSelection(lockState) ################################### # Jig Toolbar Slots ################################### def makeGamess(self): self.assy.makegamess() def makeAnchor(self): # Changed name from makeGround. Mark 051104. self.assy.makeAnchor() def makeStat(self): self.assy.makestat() def makeThermo(self): self.assy.makethermo() def makeRotaryMotor(self): self.assy.makeRotaryMotor() def makeLinearMotor(self): self.assy.makeLinearMotor() def createPlane(self): commandSequencer = self.commandSequencer commandSequencer.userEnterCommand('REFERENCE_PLANE') commandSequencer.currentCommand.runCommand() def makeGridPlane(self): self.assy.makeGridPlane() def createPolyLine(self): pass if 0: #NIY self.assy.createPolyLine() def makeESPImage(self): self.assy.makeESPImage() def makeAtomSet(self): self.assy.makeAtomSet() def makeMeasureDistance(self): self.assy.makeMeasureDistance() def makeMeasureAngle(self): self.assy.makeMeasureAngle() def makeMeasureDihedral(self): self.assy.makeMeasureDihedral() ################################### # Modify Toolbar Slots ################################### # Modify toolbar slots are inherited from modifySlotsMixin # (in ops_display.py) as of 2008-020-02. Mark ################################### # Help Toolbar Slots ################################### def helpTutorials(self): from foundation.wiki_help import open_wiki_help_URL url = "http://www.nanoengineer-1.net/mediawiki/index.php?title=Tutorials" worked = open_wiki_help_URL(url) return def helpMouseControls(self): self.help.showDialog(0) return def helpKeyboardShortcuts(self): self.help.showDialog(1) return def helpSelectionShortcuts(self): self.help.showDialog(2) return def helpGraphicsCard(self): """ Display details about the system\'s graphics card in a dialog. """ ginfo = get_gl_info_string( self.glpane) #bruce 070308 added glpane arg msgbox = TextMessageBox(self) msgbox.setWindowTitle("Graphics Card Info") msgbox.setText(ginfo) msgbox.show() return # I modified a copy of cpuinfo.py from # http://cvs.sourceforge.net/viewcvs.py/numpy/Numeric3/scipy/distutils/ # thinking it might help us support users better if we had a built-in utility # for interrogating the CPU. I do not plan to commit cpuinfo.py until I speak # to Bruce about this. Mark 051209. # # def helpCpuInfo(self): # """ # Displays this system's CPU information. # """ # from cpuinfo import get_cpuinfo # cpuinfo = get_cpuinfo() # # from widgets import TextMessageBox # msgbox = TextMessageBox(self) # msgbox.setCaption("CPU Info") # msgbox.setText(cpuinfo) # msgbox.show() def helpAbout(self): """ Displays information about this version of NanoEngineer-1. """ from utilities.version import Version v = Version() product = v.product versionString = "Version " + repr(v) if v.releaseCandidate: versionString += ("_RC%d" % v.releaseCandidate) if v.releaseType: versionString += (" (%s)" % v.releaseType) date = "Release Date: " + v.releaseDate filePath = os.path.dirname(os.path.abspath(sys.argv[0])) if filePath.endswith('/Contents/Resources'): filePath = filePath[:-19] installdir = "Running from: " + filePath techsupport = "For technical support, send email to [email protected]" website = "Website: www.nanoengineer-1.com" wiki = "Wiki and Tutorials: www.nanoengineer-1.net" aboutstr = product + " " + versionString \ + "\n\n" \ + date \ + "\n\n" \ + installdir \ + "\n\n" \ + v.copyright \ + "\n\n" \ + techsupport \ + "\n" \ + website \ + "\n" \ + wiki QMessageBox.about ( self, "About NanoEngineer-1", aboutstr) return def helpWhatsThis(self): from PyQt4.Qt import QWhatsThis ##bruce 050408 QWhatsThis.enterWhatsThisMode() return ################################### # Modes Toolbar Slots ################################### # get into Select Atoms mode def toolsSelectAtoms(self): # note: this can NO LONGER be called from update_select_mode [as of bruce 060403] self.commandSequencer.userEnterCommand('SELECTATOMS', always_update = True) # get into Select Chunks mode def toolsSelectMolecules(self):# note: this can also be called from update_select_mode [bruce 060403 comment] self.commandSequencer.userEnterCommand('SELECTMOLS', always_update = True) def update_select_mode(self): """ change currentCommand or assy.selwhat or selection to make them consistent """ #bruce 081216 moved this here, from a method on self.mt # (where it made no sense) from operations.update_select_mode import update_select_mode # todo: move this to toplevel update_select_mode(self) # get into Move Chunks (or Translate Components) command def toolsMoveMolecule(self): self.ensureInCommand('MODIFY') self.commandSequencer.currentCommand.propMgr.activate_translateGroupBox() return # Rotate Components command def toolsRotateComponents(self): self.ensureInCommand('MODIFY') self.commandSequencer.currentCommand.propMgr.activate_rotateGroupBox() return # get into Build mode def toolsBuildAtoms(self): # note: this can now be called from update_select_mode [as of bruce 060403] self.depositState = 'Atoms' self.commandSequencer.userEnterCommand('DEPOSIT', always_update = True) # get into cookiecutter mode def enterBuildCrystalCommand(self): self.commandSequencer.userEnterCommand('CRYSTAL', always_update = True) # get into Extrude mode def toolsExtrude(self): self.commandSequencer.userEnterCommand('EXTRUDE', always_update = True) # get into Fuse Chunks mode def toolsFuseChunks(self): self.commandSequencer.userEnterCommand('FUSECHUNKS', always_update = True) ################################### # Simulator Toolbar Slots ################################### def simMinimizeEnergy(self): """ Opens the Minimize Energy dialog. """ self.minimize_energy.setup() def simSetup(self): """ Creates a movie of a molecular dynamics simulation. """ if debug_flags.atom_debug: #bruce 060106 added this (fixing trivial bug 1260) print "atom_debug: reloading sim_commandruns on each use, for development" import simulation.sim_commandruns as sim_commandruns reload(sim_commandruns) from simulation.sim_commandruns import simSetup_CommandRun cmdrun = simSetup_CommandRun( self) cmdrun.run() return #Urmi 20080725: Methods for running Rosetta Simulation def rosettaSetup(self): """ Setup rosetta simulation. """ from simulation.ROSETTA.RosettaSimulationPopUpDialog import RosettaSimulationPopUpDialog form = RosettaSimulationPopUpDialog(self) self.connect(form, SIGNAL('editingFinished()'), self.runRosetta) return def runRosetta(self): """ Run a Rosetta simulation. """ from simulation.ROSETTA.rosetta_commandruns import rosettaSetup_CommandRun if self.rosettaArgs[0] > 0: cmdrun = rosettaSetup_CommandRun(self, self.rosettaArgs, "ROSETTA_FIXED_BACKBONE_SEQUENCE_DESIGN") cmdrun.run() return def setRosettaParameters(self, numRuns, otherOptionsText): """ Set parameters for a Rosetta . @param numRuns: number of Rosetta simulations. @type numRuns: int @param otherOptionsText: string of all the other options, including the ones in Rosett pop up dialog. @type otherOptionsText: str """ protein = "" if self.commandSequencer.currentCommand.commandName == 'BUILD_PROTEIN' or \ self.commandSequencer.currentCommand.commandName == 'EDIT_PROTEIN' or \ self.commandSequencer.currentCommand.commandName == 'EDIT_RESIDUES': protein = self.commandSequencer.currentCommand.propMgr.current_protein #run Rosetta for the first selected protein if protein == "" and len(self.assy.selmols) >= 1: for chunk in self.assy.selmols: if chunk.isProteinChunk(): protein = chunk.name break argList = [numRuns, otherOptionsText, protein] self.rosettaArgs = [] self.rosettaArgs.extend(argList) return #end of Rosetta simulation methods def simNanoHive(self): """ Opens the Nano-Hive dialog... for details see subroutine's docstring. """ # This should be probably be modeled after the simSetup_CommandRun class # I'll do this if Bruce agrees. For now, I want to get this working ASAP. # Mark 050915. self.nanohive.showDialog(self.assy) def simPlot(self): """ Opens the "Make Graphs" dialog if there is a movie file (i.e. a movie file has been opened in the Movie Player). For details see subroutine's docstring. """ from commands.Plot.PlotTool import simPlot dialog = simPlot(self.assy) # Returns "None" if there is no current movie file. [mark 2007-05-03] if dialog: self.plotcntl = dialog #probably useless, but done since old code did it; # conceivably, keeping it matters due to its refcount. [bruce 050327] # matters now, since dialog can be None. [mark 2007-05-03] return def simMoviePlayer(self): """ Plays a DPB movie file created by the simulator. """ from commands.PlayMovie.movieMode import simMoviePlayer simMoviePlayer(self.assy) return def JobManager(self): """ Opens the Job Manager dialog... for details see subroutine's docstring. @note: This is not implemented. """ from analysis.GAMESS.JobManager import JobManager dialog = JobManager(self) if dialog: self.jobmgrcntl = dialog # probably useless, but done since old code did it; # conceivably, keeping it matters due to its refcount. # See Bruce's note in simPlot(). return def serverManager(self): """ Opens the server manager dialog. @note: This is not implemented. """ from processes.ServerManager import ServerManager ServerManager().showDialog() ################################### # Insert Menu/Toolbar Slots ################################### def ensureInCommand(self, commandName): #bruce 071009 """ If the current command's .commandName differs from the one given, change to that command. @note: As of 080730, userEnterCommand has the same special case of doing nothing if we're already in the named command. So we just call it. (Even before, it had almost that special case; see its docstring for details.) @note: all uses of this method are causes for suspicion, about whether some sort of refactoring or generalization is called for, unless they are called from a user command whose purpose is solely to switch to the named command. (In other words, switching to it for some reason other than the user asking for that is suspicious.) (That happens in current code [071011], and ought to be cleared up somehow, but maybe not using this method in particular.) """ self.commandSequencer.userEnterCommand(commandName) # note: this changes the value of .currentCommand return def insertAtom(self): self.ensureInCommand('SELECTMOLS') self.atomcntl.show() def insertGraphene(self): """ Invokes the graphene command ('BUILD_GRAPHENE') """ self.commandSequencer.userEnterCommand('BUILD_GRAPHENE') self.commandSequencer.currentCommand.runCommand() # Build > CNT related slots and methods. ###################### def activateNanotubeTool(self): """ Activates the Nanotube toolbar. """ commandSequencer = self.commandSequencer commandSequencer.userEnterCommand('BUILD_NANOTUBE') return def insertNanotube(self, isChecked = False): """ @param isChecked: If Nanotube button in the Nanotube Flyout toolbar is checked, enter NanotubeLineMode. (provided you are using the new InsertNanotube_EditCommand command. @type isChecked: boolean @see: B{Ui_NanotubeFlyout.activateInsertNanotubeLine_EditCommand} """ self.enterOrExitTemporaryCommand('INSERT_NANOTUBE') currentCommand = self.commandSequencer.currentCommand if currentCommand.commandName == "INSERT_NANOTUBE": currentCommand.runCommand() return def activateDnaTool(self): """ Enter the InsertDna_EditCommand command. @see:B{self.insertDna} @see: B{ops_select_Mixin.getSelectedDnaGroups} @see: B{dna_model.DnaGroup.edit} """ selectedDnaGroupList = self.assy.getSelectedDnaGroups() #If exactly one DnaGroup is selected then when user invokes Build > Dna #command, edit the selected Dnagroup instead of creating a new one #For all other cases, invoking Build > Dna wikk create a new DnaGroup if len(selectedDnaGroupList) == 1: selDnaGroup = selectedDnaGroupList[0] selDnaGroup.edit() else: commandSequencer = self.commandSequencer commandSequencer.userEnterCommand('BUILD_DNA') assert self.commandSequencer.currentCommand.commandName == 'BUILD_DNA' self.commandSequencer.currentCommand.runCommand() def enterOrExitTemporaryCommand(self, commandName): #bruce 080730 split this out of several methods commandSequencer = self.commandSequencer currentCommand = commandSequencer.currentCommand if currentCommand.commandName != commandName: # enter command, if not already in it commandSequencer.userEnterCommand( commandName) else: # exit command, if already in it currentCommand.command_Done() return def enterBreakStrandCommand(self, isChecked = False): """ """ #REVIEW- arg isChecked is unused. Need to revise this this in several #methods-- Ninad 2008-07-31 self.enterOrExitTemporaryCommand( 'BREAK_STRANDS' ) def enterJoinStrandsCommand(self, isChecked = False): """ """ self.enterOrExitTemporaryCommand( 'JOIN_STRANDS' ) def enterMakeCrossoversCommand(self, isChecked = False): """ Enter make crossovers command. """ self.enterOrExitTemporaryCommand( 'MAKE_CROSSOVERS' ) def enterOrderDnaCommand(self, isChecked = False): """ """ self.enterOrExitTemporaryCommand('ORDER_DNA') def enterDnaDisplayStyleCommand(self, isChecked = False): """ """ self.enterOrExitTemporaryCommand('EDIT_DNA_DISPLAY_STYLE') #UM 063008: protein flyout toolbar commands def activateProteinTool(self): """ Activates the Protein toolbar. """ commandSequencer = self.commandSequencer commandSequencer.userEnterCommand('BUILD_PROTEIN') return def insertPeptide(self, isChecked = False): """ Invokes the peptide command (INSERT_PEPTIDE) @param isChecked: If insertPeptide button in the Protein Flyout toolbar is checked, enter insertPeptideMode. @type isChecked: bool """ self.enterOrExitTemporaryCommand('INSERT_PEPTIDE') currentCommand = self.commandSequencer.currentCommand if currentCommand.commandName == "INSERT_PEPTIDE": currentCommand.runCommand() def enterProteinDisplayStyleCommand(self, isChecked = False): """ Enter protein display style command @param isChecked: If enterProteinDisplayStyleCommand button in the Protein Flyout toolbar is checked, enter ProteinDisplayStyleMode. @type isChecked: bool """ self.enterOrExitTemporaryCommand('EDIT_PROTEIN_DISPLAY_STYLE') def enterEditProteinCommand(self, isChecked = False): """ Enter edit rotamers command @param isChecked: If enterEditProteinCommand button in the Protein Flyout toolbar is checked, enter enterEditProteinMode. @type isChecked: bool """ self.enterOrExitTemporaryCommand('EDIT_PROTEIN') def enterEditResiduesCommand(self, isChecked = False): """ Enter edit residues command @param isChecked: If enterEditResiduesCommand button in the Protein Flyout toolbar is checked, enter enterEditResiduesMode. @type isChecked: bool """ self.enterOrExitTemporaryCommand('EDIT_RESIDUES') def enterCompareProteinsCommand(self, isChecked = False): """ Enter compare proteins command @param isChecked: If enterCompareProteinsCommand button in the Protein Flyout toolbar is checked, enter enterCompareProteinsMode. @type isChecked: bool """ self.enterOrExitTemporaryCommand('COMPARE_PROTEINS') def enterStereoPropertiesCommand(self): """ Enter Stereo Properties Command """ self.enterOrExitTemporaryCommand('STEREO_PROPERTIES') def enterQuteMolCommand(self): """ Show the QuteMol property manager. """ commandSequencer = self.commandSequencer commandSequencer.userEnterCommand('QUTEMOL') # note: if we make the Qutemol action a 'ckeckable action' # (so when unchecked by the user, it should exit the QuteMol command), # then replace the above by a call to self.enterOrExitTemporaryCommand. def insertDna(self, isChecked = False): """ @param isChecked: If Dna Duplex button in the Dna Flyout toolbar is checked, enter DnaLineMode. (provided you are using the new DNADuplexEditCommand command. @type isChecked: boolean @see: B{Ui_DnaFlyout.activateInsertDna_EditCommand} """ self.enterOrExitTemporaryCommand('INSERT_DNA') currentCommand = self.commandSequencer.currentCommand if currentCommand.commandName == 'INSERT_DNA': currentCommand.runCommand() def orderDna(self, dnaGroupList = ()): """ open a text editor and load a temporary text file containing all the DNA strand names and their sequences in the current DNA object. It will look something like this: (comma separated values. To be revised) Strand1,ATCAGCTACGCATCGCT Strand2,TAGTCGATGCGTAGCGA The user can then save the file to a permanent location. @see: Ui_DnaFlyout.orderDnaCommand @see: self._writeDnaSequence @TODO: This works only for a single DNA group So dnaGroupList always contain a single item. """ dnaGroupNameString = '' fileBaseName = 'DnaSequence' dnaSequence = '' if dnaGroupList: dnaSequence = '' for dnaGroup in dnaGroupList: dnaSequence = dnaSequence + dnaGroup.getDnaSequence(format = 'CSV') else: currentCommand = self.commandSequencer.currentCommand if currentCommand.commandName == 'BUILD_DNA': if currentCommand.struct is not None: dnaSequence = currentCommand.struct.getDnaSequence() dnaGroupNameString = currentCommand.struct.name fileBaseName = dnaGroupNameString if dnaSequence: tmpdir = find_or_make_Nanorex_subdir('temp') temporaryFile = os.path.join(tmpdir, "%s.csv" % fileBaseName) self._writeDnaSequence(temporaryFile, dnaGroupNameString, dnaSequence) open_file_in_editor(temporaryFile) def _writeDnaSequence(self, fileName, dnaGroupNameString, dnaSequence): """ Open a temporary file and write the specified dna sequence to it @param fileName: the full path of the temporary file to be opened @param dnaSequence: The dnaSequence string to be written to the file. @see: self.orderDna """ #Create Header headerString = '#NanoEngineer-1 DNA Order Form created on: ' timestr = "%s\n" % time.strftime("%Y-%m-%d at %H:%M:%S") if self.assy.filename: mmpFileName = "[" + os.path.normpath(self.assy.filename) + "]" else: mmpFileName = "[" + self.assy.name + "]" + \ " ( The mmp file was probably not saved when the "\ " sequence was written)" if dnaGroupNameString: fileNameInfo_header = "#This sequence is created for node "\ "[%s] of file %s\n\n"%(dnaGroupNameString, mmpFileName) else: fileNameInfo_header = "#This sequence is created for file '%s\n\n'"%( mmpFileName) headerString = headerString + timestr + fileNameInfo_header f = open(fileName,'w') # Write header f.write(headerString) f.write("Name,Sequence,Notes\n") # Per IDT's Excel format. f.write(dnaSequence) def createDnaSequenceEditorIfNeeded(self): """ Returns a Sequence editor object (a dockwidget). If one doesn't already exists, it creates one . (created only once and only when its first requested and then the object is reused) @return: The sequence editor object (self._dnaSequenceEditor @rtype: B{DnaSequenceEditor} @see: InsertDna_PropertyManager._loadSequenceEditor @WARNING: QMainwindow.restoreState prints a warning message because its unable to find this object in the next session. (as this object is created only when requested) This warning message is harmless, but if we want to get rid of it, easiest way is to always create this object when MainWindow is created. (This is a small object so may be thats the best way) """ if self._dnaSequenceEditor is None: from dna.DnaSequenceEditor.DnaSequenceEditor import DnaSequenceEditor self._dnaSequenceEditor = DnaSequenceEditor(self) self._dnaSequenceEditor.setObjectName("dna_sequence_editor") #Should changes.keep_forevenr be called here? #Answer : No because python references to these objects are kept in #the MainWindow attrs return self._dnaSequenceEditor def createProteinSequenceEditorIfNeeded(self): """ Returns a Sequence editor object (a dockwidget). If one doesn't already exists, it creates one . (created only once and only when its first requested and then the object is reused) @return: The sequence editor object (self._proteinSequenceEditor @rtype: B{ProteinSequenceEditor} """ if self._proteinSequenceEditor is None: from protein.ProteinSequenceEditor.ProteinSequenceEditor import ProteinSequenceEditor self._proteinSequenceEditor = ProteinSequenceEditor(self) self._proteinSequenceEditor.setObjectName("protein_sequence_editor") return self._proteinSequenceEditor def toggle_selectByNameDockWidget(self, bool_toggle): pw = self._activepw leftChannelDockWidget = pw.getLeftChannelDockWidget() if bool_toggle: leftChannelDockWidget.show() else: leftChannelDockWidget.close() def insertPovrayScene(self): self.povrayscenecntl.setup() def insertComment(self): """ Insert a new comment into the model tree. """ self.commentcntl.setup() ################################### # Slots for future tools ################################### # Mirror Tool def toolsMirror(self): env.history.message(redmsg("Mirror Tool: Not implemented yet.")) # Mirror Circular Boundary Tool def toolsMirrorCircularBoundary(self): env.history.message(redmsg("Mirror Circular Boundary Tool: Not implemented yet.")) ################################### # Slots for Done and Cancel actions for current command ################################### def toolsDone(self): """ @note: called from several places, including ok_btn_clicked (and in some cases, cancel_btn_clicked) of PM_Dialog and its subclasses The calls from ok_btn_clicked and cancel_btn_clicked methods are probablycorrect, but are deprecated, and should be replaced by calls of self.command.command_Done (where self is the calling PM). """ #bruce 080815/080827 docstring command_to_exit = self.currentCommand.command_that_supplies_PM() command_to_exit.command_Done() return def toolsCancel(self): """ Cancel the command which is supplying the currently visible Property Manager. @note: called only from cancel_btn_clicked methods in PM_Dialog or its subclasses, but some of those call toolsDone instead. (where self is the calling PM). """ #bruce 080815/080827 docstring command_to_exit = self.currentCommand.command_that_supplies_PM() command_to_exit.command_Cancel() return ###################################### # Show View > Orientation Window ####################################### def showOrientationWindow(self, isChecked = False): #Ninad 061121 if isChecked: if not self.orientationWindow: self.orientationWindow = ViewOrientationWindow(self) #self.orientationWindow.createOrientationViewList(namedViewList) self.orientationWindow.createOrientationViewList() self.orientationWindow.setVisible(True) else: if not self.orientationWindow.isVisible(): self.orientationWindow.setVisible(True) else: if self.orientationWindow and self.orientationWindow.isVisible(): self.orientationWindow.setVisible(False) return self.orientationWindow def deleteOrientationWindow(self): """ Delete the orientation window when the main window closes. """ #ninad 061121 - this is probably unnecessary if self.orientationWindow: self.orientationWindow.close() self.orientationWindow = None return self.orientationWindow # key event handling revised by bruce 041220 to fix some bugs; # see comments in the GLPane methods. def keyPressEvent(self, e): self.glpane.keyPressEvent(e) def keyReleaseEvent(self, e): self.glpane.keyReleaseEvent(e) def wheelEvent(self, event): #bruce 070607 fix bug xxx [just reported, has no bug number yet] ## print "mwsem ignoring wheelEvent",event # Note: this gets called by wheel events with mouse inside history widget, # whenever it has reached its scrolling limit. Defining it here prevents the bug # of Qt passing it on to GLPane (maybe only happens if GLPane was last-clicked widget), # causing unintended mousewheel zoom. Apparently just catching this and returning is # enough -- it's not necessary to also call event.ignore(). Guess: this method's default # implem passes it either to "central widget" (just guessing that's the GLPane) or to # the last widget we clicked on (or more likely, the one with the keyfocus). return # Methods for temporarily disabling QActions in toolbars/menus ########## def enableViews(self, enableFlag = True): """ Disables/enables view actions on toolbar and menu. This is typically used to momentarily disable some of the view actions while animating between views. @param enableFlag: Flag to enable/disable the View actions in this method. @type enableFlag: boolean """ self.viewNormalToAction.setEnabled(enableFlag) self.viewParallelToAction.setEnabled(enableFlag) self.viewFrontAction.setEnabled(enableFlag) self.viewBackAction.setEnabled(enableFlag) self.viewTopAction.setEnabled(enableFlag) self.viewBottomAction.setEnabled(enableFlag) self.viewLeftAction.setEnabled(enableFlag) self.viewRightAction.setEnabled(enableFlag) self.viewIsometricAction.setEnabled(enableFlag) self.setViewHomeAction.setEnabled(enableFlag) self.setViewFitToWindowAction.setEnabled(enableFlag) self.setViewRecenterAction.setEnabled(enableFlag) self.viewFlipViewVertAction.setEnabled(enableFlag) self.viewFlipViewHorzAction.setEnabled(enableFlag) self.viewRotatePlus90Action.setEnabled(enableFlag) self.viewRotateMinus90Action.setEnabled(enableFlag) return def disable_QActions_for_extrudeMode(self, disableFlag = True): """ Disables action items in the main window for extrudeMode. """ self.disable_QActions_for_movieMode(disableFlag) self.modifyHydrogenateAction.setEnabled(not disableFlag) self.modifyDehydrogenateAction.setEnabled(not disableFlag) self.modifyPassivateAction.setEnabled(not disableFlag) self.modifyDeleteBondsAction.setEnabled(not disableFlag) self.modifyStretchAction.setEnabled(not disableFlag) self.modifySeparateAction.setEnabled(not disableFlag) self.modifyMergeAction.setEnabled(not disableFlag) self.modifyInvertAction.setEnabled(not disableFlag) self.modifyMirrorAction.setEnabled(not disableFlag) self.modifyAlignCommonAxisAction.setEnabled(not disableFlag) # All QActions in the Modify menu/toolbar should be disabled, # too. mark 060323 return def disable_QActions_for_sim(self, disableFlag = True): """ Disables actions items in the main window during simulations (and minimize). """ self.disable_QActions_for_movieMode(disableFlag) self.simMoviePlayerAction.setEnabled(not disableFlag) return def disable_QActions_for_movieMode(self, disableFlag = True): """ Disables action items in the main window for movieMode; also called by disable_QActions_for_extrudeMode and by disable_QActions_for_sim. """ enable = not disableFlag self.modifyAdjustSelAction.setEnabled(enable) # "Adjust Selection" self.modifyAdjustAllAction.setEnabled(enable) # "Adjust All" self.simMinimizeEnergyAction.setEnabled(enable) # Minimize Energy self.checkAtomTypesAction.setEnabled(enable) # Check AMBER AtomTypes self.rosettaSetupAction.setEnabled(enable) self.simSetupAction.setEnabled(enable) # "Simulator" self.fileSaveAction.setEnabled(enable) # "File Save" self.fileSaveAsAction.setEnabled(enable) # "File Save As" self.fileOpenAction.setEnabled(enable) # "File Open" self.fileCloseAction.setEnabled(enable) # "File Close" self.fileInsertMmpAction.setEnabled(enable) # "Insert MMP" self.fileInsertPdbAction.setEnabled(enable) # "Insert PDB" self.fileInsertInAction.setEnabled(enable) # "Insert IN" self.editDeleteAction.setEnabled(enable) # "Delete" # [bruce 050426 comment: I'm skeptical of disabling zoom/pan/rotate, # and suggest for some others (especially "simulator") that they # auto-exit the mode rather than be disabled, # but I won't revise these for now.] # # [update, bruce 070813/070820] # Zoom/pan/rotate are now rewritten to suspend rather than exit # the current mode, so they no longer need disabling in Extrude or # Movie modes. (There is one known minor bug (2517) -- Movie mode # asks whether to rewind (via popup dialog), which is only appropriate # to ask if it's being exited. Fixing this is relevant to the # upcoming "command sequencer".) # This is also called by disable_QActions_for_sim, and whether this # change is safe in that case is not carefully reviewed or tested, # but it seems likely to be ok. ## self.zoomToAreaAction.setEnabled(enable) # "Zoom Tool" ## self.panToolAction.setEnabled(enable) # "Pan Tool" ## self.rotateToolAction.setEnabled(enable) # "Rotate Tool" return # == Caption methods def update_mainwindow_caption_properly(self, junk = None): #bruce 050810 added this self.update_mainwindow_caption(self.assy.has_changed()) # The call to updateWindowTitle() is harmless, even when MDI support # isn't enabled. self.activePartWindow().updateWindowTitle(self.assy.has_changed()) def update_mainwindow_caption(self, changed = False): #by mark; bruce 050810 revised this in several ways, fixed bug 785 """ Update the window title (caption) at the top of the of the main window. Example: "partname.mmp" @param changed: If True, the caption will include the prefix and suffix (via user prefs settings in the "Preferences | Window" dialog) to denote the part has been modified. @type changed: boolean @attention: I intend to remove the prefix and suffix user prefs and use the standard way applications indicate that a document has unsaved changes. On Mac OS X the close button will have a modified look; on other platforms the window title will have an '*' (asterisk). BTW, this has already been done in PartWindow.updateWindowTitle(). Mark 2008-01-02. @see: U{B{windowTitle}<http://doc.trolltech.com/4/qwidget.html#windowTitle-prop>}, U{B{windowModified}<http://doc.trolltech.com/4/qwidget.html#windowModified-prop>} """ # WARNING: there is mostly-duplicated code in this method and in # class Ui_PartWindow.updateWindowTitle. I guess they are both # always called, but only one of them matters depending on whether # experimental (and unfinished) MDI support is enabled. # Ideally a single helper function, or single method in a new # common superclass, would be used. [bruce 081227 comment] caption_prefix = env.prefs[captionPrefix_prefs_key] caption_suffix = env.prefs[captionSuffix_prefs_key] caption_fullpath = env.prefs[captionFullPath_prefs_key] if changed: prefix = caption_prefix suffix = caption_suffix else: prefix = '' suffix = '' # this is not needed here since it's already done in the prefs values # themselves when we set them: # if prefix and not prefix.endswith(" "): # prefix = prefix + " " # if suffix and not suffix.startswith(" "): # suffix = " " + suffix partname = "Untitled" # fallback value if no file yet if self.assy.filename: #bruce 081227 cleanup: try -> if, etc junk, basename = os.path.split(self.assy.filename) if basename: if caption_fullpath: partname = os.path.normpath(self.assy.filename) #fixed bug 453-1 ninad060721 else: partname = basename # WARNING: the following code differs in the two versions # of this routine. ##e [bruce 050811 comment:] # perhaps we should move prefix to the beginning, # rather than just before "["; # and in any case the other stuff here, # self.name() + " - " + "[" + "]", should also be # user-changeable, IMHO. #print "****self.accessibleName *****=", self.accessibleName() self.setWindowTitle(self.trUtf8("NanoEngineer-1" + " - " + prefix + "[" + partname.encode("utf_8") + "]" + suffix )) # review: also call self.setWindowModified(changed)? return def createProgressDialog(self): """ Creates the main window's Progress Dialog, which can be used to display a progress dialog at any time. It is modal by default. @see: _readmmp() for an example of use. @see: U{B{QProgressDialog}<http://doc.trolltech.com/4/qprogressdialog.html>} """ from PyQt4.Qt import QProgressDialog self.progressDialog = QProgressDialog(self) self.progressDialog.setWindowModality(Qt.WindowModal) self.progressDialog.setWindowTitle("NanoEngineer-1") # setMinimumDuration() doesn't work. Qt bug? self.progressDialog.setMinimumDuration(500) # 500 ms = 0.5 seconds #= Methods for "Open Recent Files" menu, a submenu of the "Files" menu. def getRecentFilesListAndPrefsSetting(self): """ Returns the list of recent files that appears in the "Open Recent Files" menu and the preference settings object. @return: List of recent files, preference settings. @rtype: list, QSettings @see: U{B{QSettings}<http://doc.trolltech.com/4/qsettings.html>} """ if recentfiles_use_QSettings: prefsSetting = QSettings("Nanorex", "NanoEngineer-1") fileList = prefsSetting.value(RECENTFILES_QSETTINGS_KEY).toStringList() else: prefsSetting = preferences.prefs_context() fileList = prefsSetting.get(RECENTFILES_QSETTINGS_KEY, []) return fileList, prefsSetting def updateRecentFileList(self, fileName): """ Add I{filename} into the recent file list. @param filename: The filename to add to the recently opened files list. @type filename: string """ # LIST_CAPACITY could be set by user preference (NIY). LIST_CAPACITY = 9 # Warning: Potential bug if number of recent files >= 10 # (i.e. LIST_CAPACITY >= 10). See fileSlotsMixin.openRecentFile(). fileName = os.path.normpath(str_or_unicode(fileName)) fileList, prefsSetting = self.getRecentFilesListAndPrefsSetting() if len(fileList) > 0: # If filename is already in fileList, delete it from the list. # filename will be added to the top of the list later. for ii in range(len(fileList)): if str_or_unicode(fileName) == str_or_unicode(fileList[ii]): del fileList[ii] break if recentfiles_use_QSettings: fileList.prepend(fileName) else: fileList.insert(0, fileName) fileList = fileList[:LIST_CAPACITY] if recentfiles_use_QSettings: assert isinstance(prefsSetting, QSettings) prefsSetting.setValue(RECENTFILES_QSETTINGS_KEY, QVariant(fileList)) if 0: #debug_recent_files: # confirm that the information really made it into the QSetting. fileListTest = prefsSetting.value(RECENTFILES_QSETTINGS_KEY).toStringList() fileListTest = map(str, list(fileListTest)) assert len(fileListTest) == len(fileList) for i in range(len(fileList)): assert str_or_unicode(fileList[i]) == str_or_unicode(fileListTest[i]) else: prefsSetting[RECENTFILES_QSETTINGS_KEY] = fileList del prefsSetting self.createOpenRecentFilesMenu() return def createOpenRecentFilesMenu(self): """ Creates the "Open Recent Files" menu, a submenu of the "File" menu. This is called whenever a new file is opened or the current file is renamed. """ if hasattr(self, "openRecentFilesMenu"): # Remove the current "Open Recent Files" menu. # It will be recreated below. self.fileMenu.removeAction(self.openRecentFilesMenuAction) # Create a new "Open Recent Files" menu from the current list. self.openRecentFilesMenu = QMenu("Open Recent Files", self) fileList, prefsSetting = self.getRecentFilesListAndPrefsSetting() self.openRecentFilesMenu.clear() for ii in range(len(fileList)): _recent_filename = os.path.normpath(str_or_unicode(fileList[ii]).encode("utf_8")) # Fixes bug 2193. Mark 060808. self.openRecentFilesMenu.addAction( QtGui.QApplication.translate( "Main Window", "&" + str(ii + 1) + " " + _recent_filename, None, QtGui.QApplication.UnicodeUTF8)) # Insert the "Open Recent Files" menu above "File > Close". self.openRecentFilesMenuAction = \ self.fileMenu.insertMenu(self.fileCloseAction, self.openRecentFilesMenu) self.connect(self.openRecentFilesMenu, SIGNAL('triggered(QAction*)'), self.openRecentFile) return def colorSchemeCommand(self): """ This is a slot method for invoking the B{Color Scheme} command. """ self.enterOrExitTemporaryCommand('COLOR_SCHEME') def lightingSchemeCommand(self): """ This is a slot method for invoking the B{Lighting Scheme} command. """ self.enterOrExitTemporaryCommand('LIGHTING_SCHEME') def toggleRulers(self, isChecked): """ Displays/hides the rulers in the 3D graphics area (glpane). @param isChecked: Checked state of the B{View > Rulers} menu item @type isChecked: boolean """ if isChecked: env.prefs[displayRulers_prefs_key] = True else: env.prefs[displayRulers_prefs_key] = False pass # end of class MWsemantics # end
NanoCAD-master
cad/src/ne1_ui/MWsemantics.py
# Copyright 2004-2008 Nanorex, Inc. See LICENSE file for details. """ Ui_PartWindow.py provides the part window class. @version: $Id$ @copyright: 2004-2008 Nanorex, Inc. See LICENSE file for details. To Do: - Reorder widget and layout creation so that the code is easier to follow and understand. Also will make it more obvious were to insert future widgets and layouts post Rattlesnake. - Add "Right Area" frame (pwRightArea) containing the glpane. - More attr renaming. - Review/refine layouts one last time. - Remove any unused methods I missed. - Fix window title(s) when MDI is enabled (after Rattlesnake release) History: Mark 2007-06-27: PartWindow and GridPosition classes moved here from MWSemantics.py. Mark 2008-01-05: Implemented the new U{B{NE1 Part Window Framework (SDI)} <http://www.nanoengineer-1.net/mediawiki/index.php?title=NE1_Main_Window_Framework>} which includes moving the history widget to the new reportDockWidget, renaming key attrs and widgets (i.e. pwLeftArea and pwBottomArea) """ import os from PyQt4.Qt import Qt, QWidget, QFrame, QVBoxLayout, QSplitter, QTimer from PyQt4.Qt import QTabWidget, QScrollArea, QSizePolicy, SIGNAL from graphics.widgets.GLPane import GLPane from PM.PM_Constants import PM_DEFAULT_WIDTH, PM_MAXIMUM_WIDTH, PM_MINIMUM_WIDTH from utilities.icon_utilities import geticon from modelTree.ModelTree import ModelTree from utilities.qt4transition import qt4warnDestruction from utilities import debug_flags import foundation.env as env from utilities.debug import print_compact_traceback from utilities.prefs_constants import captionFullPath_prefs_key from ne1_ui.SelectNodeByNameDockWidget import SelectNodeByNameDockWidget _DEBUG = False # Do not commit with True class _pwProjectTabWidget(QTabWidget): """ A helper class for the Project Tab Widget (a QTabWidget). It was created to help fix bug 2522. @note: [bruce 070829] to fix bug 2522 I need to intercept removeTab(), so I made this subclass. It needs to know the GLPane, which is set using KLUGE_setGLPane(). @see: U{B{Bug 2522} <https://mirror2.cvsdude.com/bugz/polosims_svn/show_bug.cgi?id=2540>} """ #bruce 070829 made this subclass re bug 2522 def KLUGE_setGLPane(self, glpane): self._glpane = glpane return def removeTab(self, index): res = QTabWidget.removeTab(self, index) # note: AFAIK, res is always None if index != -1: # -1 happens! glpane = self._glpane glpane.gl_update_confcorner() # fix bug 2522 (try 2) return res pass class LeftFrame(QFrame): """ The left area frame that contains the model tree and property manager. This subclass of QFrame was written exclusively to deal with the undersired behavior of the spitter moving while resizing the part window. """ def __init__(self, parent): QFrame.__init__(self, parent) self.parent = parent return def resizeEvent(self, event): """ Reimplementation of the resizeEvent handler. It determines if the frame is being resized by the splitter (allowed) or programmably via a resize of the part window (not allowed). """ if self.parent.resizeTimer.isActive(): # LeftFrame is being resized (programmably) by the part window # as the user drags the resize handle. # We don't want that, so don't change the splitter position. return # LeftFrame is most likely being resized by the user via the splitter, # but it is also possible that the user clicked the maximize/restore # button. If the user did this, set the splitter position to the # "old" width (not the current width) since it has been changed # programmably (and we didn't want that). size = event.size() oldSize = event.oldSize() delta = abs(size.width() - oldSize.width()) if delta < 10: # 10 pixels. Value chosen based on experimentation. self.parent.splitterPosition = size.width() if _DEBUG: print "New Size: ", self.parent.splitterPosition else: self.parent.splitterPosition = oldSize.width() if _DEBUG: print "Old Size: ", self.parent.splitterPosition QWidget.resizeEvent(self, event) return class Ui_PartWindow(QWidget): """ The Ui_PartWindow class provides a Part Window UI object composed of three primary areas: - The "left area" contains the Project TabWidget which contains the Model Tree and Property Manager (tabs). Other tabs (widgets) can be added as needed. - The "right area" contains the Graphics Area (i.e. glpane) displaying the current model. - The "bottom area" lives below the left and right areas, spanning the full width of the part window. It can be used whenever a landscape layout is needed (i.e. the Sequence Editor). Typically, this area is not used and is hidden by default. A "part window" splitter lives between the left and right areas that allow the user to resize the shared area occupied by them. There is no splitter between the top and bottom areas. This class supports and is limited to a B{Single Document Interface (SDI)}. In time, NE1 will migrate to and support a Multiple Document Interface (MDI) to allow multiple project documents (i.e. parts, assemblies, simulations, text files, graphs, tables, etc. documents) to be available within the common workspace of the NE1 main window. @see: U{B{NE1 Main Window Framework} <http://www.nanoengineer-1.net/mediawiki/index.php?title=NE1_Main_Window_Framework>} """ widgets = [] # For debugging purposes. splitterPosition = PM_DEFAULT_WIDTH _previous_splitterPosition = PM_DEFAULT_WIDTH # Used for restoring the splitter position when collapsing/expanding # the left area. def __init__(self, assy, parent): """ Constructor for the part window. @param assy: The assembly (part) @type assy: Assembly @param parent: The parent widget. @type parent: U{B{QMainWindow} <http://doc.trolltech.com/4/qmainwindow.html>} """ QWidget.__init__(self, parent) self.parent = parent self.assy = assy # note: to support MDI, self.assy would probably need to be a # different assembly for each PartWindow. # [bruce 080216 comment] self.setWindowIcon(geticon("ui/border/Part.png")) self.updateWindowTitle() # The main layout for the part window is a VBoxLayout <pwVBoxLayout>. self.pwVBoxLayout = QVBoxLayout(self) pwVBoxLayout = self.pwVBoxLayout pwVBoxLayout.setMargin(0) pwVBoxLayout.setSpacing(0) # ################################################################ # <pwSplitter> is the horizontal splitter b/w the # pwLeftArea (mt and pm) and the glpane. self.pwSplitter = QSplitter(Qt.Horizontal) pwSplitter = self.pwSplitter pwSplitter.setObjectName("pwSplitter") pwSplitter.setHandleWidth(3) # 3 pixels wide. pwVBoxLayout.addWidget(pwSplitter) # ################################################################## # <pwLeftArea> is the container holding the pwProjectTabWidget. # Note: Making pwLeftArea (and pwRightArea and pwBottomArea) QFrame # widgets has the benefit of making it easy to draw a border around # each area. One purpose of this would be to help developers understand # (visually) how the part window is laid out. I intend to add a debug # pref to draw part window area borders and add "What's This" text to # them. Mark 2008-01-05. self.pwLeftArea = LeftFrame(self) pwLeftArea = self.pwLeftArea pwLeftArea.setObjectName("pwLeftArea") pwLeftArea.setMinimumWidth(PM_MINIMUM_WIDTH) pwLeftArea.setMaximumWidth(PM_MAXIMUM_WIDTH) # Setting the frame style like this is nice since it clearly # defines the splitter at the top-left corner. pwLeftArea.setFrameStyle( QFrame.Panel | QFrame.Sunken ) # This layout will contain splitter (above) and the pwBottomArea. leftChannelVBoxLayout = QVBoxLayout(pwLeftArea) leftChannelVBoxLayout.setMargin(0) leftChannelVBoxLayout.setSpacing(0) pwSplitter.addWidget(pwLeftArea) # Makes it so pwLeftArea is not collapsible. pwSplitter.setCollapsible (0, False) # ################################################################## # <pwProjectTabWidget> is a QTabWidget that contains the MT and PM # widgets. It lives in the "left area" of the part window. self.pwProjectTabWidget = _pwProjectTabWidget() # _pwProjectTabWidget subclasses QTabWidget # Note [bruce 070829]: to fix bug 2522 I need to intercept # self.pwProjectTabWidget.removeTab, so I made it a subclass of # QTabWidget. It needs to know the GLPane, but that's not created # yet, so we set it later using KLUGE_setGLPane (below). # Note: No parent supplied. Could this be the source of the # minor vsplitter resizing problem I was trying to resolve a few # months ago? Try supplying a parent later. Mark 2008-01-01 self.pwProjectTabWidget.setObjectName("pwProjectTabWidget") self.pwProjectTabWidget.setCurrentIndex(0) self.pwProjectTabWidget.setAutoFillBackground(True) # Create the model tree "tab" widget. It will contain the MT GUI widget. # Set the tab icon, too. self.modelTreeTab = QWidget() self.modelTreeTab.setObjectName("modelTreeTab") self.pwProjectTabWidget.addTab( self.modelTreeTab, geticon("ui/modeltree/Model_Tree.png"), "") modelTreeTabLayout = QVBoxLayout(self.modelTreeTab) modelTreeTabLayout.setMargin(0) modelTreeTabLayout.setSpacing(0) # Create the model tree (GUI) and add it to the tab layout. self.modelTree = ModelTree(self.modelTreeTab, parent) self.modelTree.modelTreeGui.setObjectName("modelTreeGui") modelTreeTabLayout.addWidget(self.modelTree.modelTreeGui) # Create the property manager "tab" widget. It will contain the PropMgr # scroll area, which will contain the property manager and all its # widgets. self.propertyManagerTab = QWidget() self.propertyManagerTab.setObjectName("propertyManagerTab") self.propertyManagerScrollArea = QScrollArea(self.pwProjectTabWidget) self.propertyManagerScrollArea.setObjectName("propertyManagerScrollArea") self.propertyManagerScrollArea.setWidget(self.propertyManagerTab) self.propertyManagerScrollArea.setWidgetResizable(True) # Eureka! # setWidgetResizable(True) will resize the Property Manager (and its # contents) correctly when the scrollbar appears/disappears. # It even accounts correctly for collapsed/expanded groupboxes! # Mark 2007-05-29 # Add the property manager scroll area as a "tabbed" widget. # Set the tab icon, too. self.pwProjectTabWidget.addTab( self.propertyManagerScrollArea, geticon("ui/modeltree/Property_Manager.png"), "") # Finally, add the "pwProjectTabWidget" to the left channel layout. leftChannelVBoxLayout.addWidget(self.pwProjectTabWidget) # Create the glpane and make it a child of the part splitter. self.glpane = GLPane(assy, self, 'glpane name', parent) # note: our owner (MWsemantics) assumes # there is just this one GLPane for assy, and stores it # into assy as assy.o and assy.glpane. [bruce 080216 comment] # Add what's this text to self.glpane. # [bruce 080912 moved this here from part of a method in class GLPane. # In this code's old location, Mark wrote [2007-06-01]: "Problem - # I don't believe this text is processed by fix_whatsthis_text_and_links() # in whatsthis_utilities.py." Now that this code is here, I don't know # whether that's still true. ] from ne1_ui.WhatsThisText_for_MainWindow import whats_this_text_for_glpane self.glpane.setWhatsThis( whats_this_text_for_glpane() ) # update [re the above comment], bruce 081209: # I added the following explicit call of fix_whatsthis_text_and_links, # but it doesn't work to replace Ctrl with Cmd on Mac; # see today's comment in fix_whatsthis_text_and_links for likely reason. # So I will leave this here, but also leave in place the kluges # in whats_this_text_for_glpane to do that replacement itself. # The wiki help link in this whatsthis text doesn't work, # but I guess that is an independent issue, related to lack # of use of class QToolBar_WikiHelp or similar code, for GLPane # or this class or the main window class. from foundation.whatsthis_utilities import fix_whatsthis_text_and_links fix_whatsthis_text_and_links(self.glpane) # doesn't yet work self.pwProjectTabWidget.KLUGE_setGLPane(self.glpane) # help fix bug 2522 [bruce 070829] qt4warnDestruction(self.glpane, 'GLPane of PartWindow') pwSplitter.addWidget(self.glpane) # ################################################################## # <pwBottomArea> is a container at the bottom of the part window # spanning its entire width. It is intended to be used as an extra # area for use by Property Managers (or anything else) that needs # a landscape oriented layout. # An example is the Sequence Editor, which is part of the # Strand Properties PM. self.pwBottomArea = QFrame() # IMHO, self is not a good parent. Mark 2008-01-04. pwBottomArea = self.pwBottomArea pwBottomArea.setObjectName("pwBottomArea") pwBottomArea.setMaximumHeight(50) # Add a frame border to see what it looks like. pwBottomArea.setFrameStyle( QFrame.Panel | QFrame.Sunken ) self.pwVBoxLayout.addWidget(pwBottomArea) # Hide the bottom frame for now. Later this might be used for the # sequence editor. pwBottomArea.hide() #This widget implementation is subject to heavy revision. The purpose #is to implement a NFR that Mark urgently needs : The NFR is: Need a #way to quickly find a node in the MT by entering its name. #-- Ninad 2008-11-06 self.pwSpecialDockWidgetInLeftChannel = SelectNodeByNameDockWidget(self.glpane.win) leftChannelVBoxLayout.addWidget(self.pwSpecialDockWidgetInLeftChannel) # See the resizeEvent() docstring for more information about # resizeTimer. self.resizeTimer = QTimer(self) self.resizeTimer.setSingleShot(True) return def getLeftChannelDockWidget(self): return self.pwSpecialDockWidgetInLeftChannel def updateWindowTitle(self, changed = False): #by mark; bruce 050810 revised this in several ways, fixed bug 785 """ Update the window title (caption) at the top of the part window. Example: "partname.mmp" This implements the standard way most applications indicate that a document has unsaved changes. On Mac OS X the close button will have a modified look; on other platforms the window title will have an '*' (asterisk). @note: We'll want to experiment with this to make sure it @param changed: If True, the document has unsaved changes. @type changed: boolean @see: U{B{windowTitle}<http://doc.trolltech.com/4/qwidget.html#windowTitle-prop>}, U{B{windowModified}<http://doc.trolltech.com/4/qwidget.html#windowModified-prop>} """ # WARNING: there is mostly-duplicated code in this method and in # MWsemantics.update_mainwindow_caption. See the comment in that # method for more info and todos. [bruce 081227 comment] caption_fullpath = env.prefs[captionFullPath_prefs_key] partname = "Untitled" # fallback value if no file yet if self.assy.filename: #bruce 081227 cleanup: try -> if, etc # self.assy.filename is always an empty string, even after a # file has been opened with a complete name. Need to ask Bruce # about this problem, resulting in a bug (i.e. the window title # is always "Untitled". Mark 2008-01-02. junk, basename = os.path.split(self.assy.filename) if basename: if caption_fullpath: partname = os.path.normpath(self.assy.filename) #fixed bug 453-1 ninad060721 else: partname = basename # WARNING: the following code differs in the two versions # of this routine. # The "[*]" placeholder below is modified or removed by Qt; see: # http://doc.trolltech.com/4/qwidget.html#windowModified-prop self.setWindowTitle(self.trUtf8(partname + '[*]')) self.setWindowModified(changed) # replaces '[*]' by '' or '*' return def collapseLeftArea(self, hideLeftArea = True): """ Make the left area collapsible (via the splitter). The left area will be hidden (collapsed,actually) if I{hideLeftArea} is True (the default). """ self._previous_splitterPosition = self.pwLeftArea.width() if hideLeftArea: self.pwSplitter.setCollapsible(0, True) self.setSplitterPosition(pos = 0) return def expandLeftArea(self): """ Expand the left area. @see: L{MWsemantics._showFullScreenCommonCode()} for an example showing how it is used. """ self.setSplitterPosition(pos = self._previous_splitterPosition) self.pwSplitter.setCollapsible(0, False) self.pwLeftArea.setMinimumWidth(PM_MINIMUM_WIDTH) self.pwLeftArea.setMaximumWidth(PM_MAXIMUM_WIDTH) return def updatePropertyManagerTab(self, tab): #Ninad 061207 "Update the Properties Manager tab with 'tab' " self.parent.glpane.gl_update_confcorner() #bruce 070627, since PM affects confcorner appearance if self.propertyManagerScrollArea.widget(): # The following is necessary to get rid of those C object # deleted errors (and the resulting bugs) lastwidgetobject = self.propertyManagerScrollArea.takeWidget() if lastwidgetobject: # bruce 071018 revised this code; see my comment on same # code in PM_Dialog try: lastwidgetobject.update_props_if_needed_before_closing except AttributeError: if 1 or debug_flags.atom_debug: msg1 = "Last PropMgr %r doesn't have method" % lastwidgetobject msg2 =" update_props_if_needed_before_closing. That's" msg3 = " OK (for now, only implemented for Plane PM). " msg4 = "Ignoring Exception: " print_compact_traceback(msg1 + msg2 + msg3 + msg4) else: lastwidgetobject.update_props_if_needed_before_closing() lastwidgetobject.hide() # @ ninad 061212 perhaps hiding the widget is not needed self.pwProjectTabWidget.removeTab( self.pwProjectTabWidget.indexOf(self.propertyManagerScrollArea)) # Set the PropertyManager tab scroll area to the appropriate widget. self.propertyManagerScrollArea.setWidget(tab) self.pwProjectTabWidget.addTab( self.propertyManagerScrollArea, geticon("ui/modeltree/Property_Manager.png"), "") self.pwProjectTabWidget.setCurrentIndex( self.pwProjectTabWidget.indexOf(self.propertyManagerScrollArea)) return def KLUGE_current_PropertyManager(self): #bruce 070627; revised 070829 as part of fixing bug 2523 """ Return the current Property Manager widget (whether or not its tab is chosen, but only if it has a tab), or None if there is not one. @warning: This method's existence (not only its implementation) is a kluge, since the right way to access that would be by asking the "command sequencer"; but that's not yet implemented, so this is the best we can do for now. Also, it would be better to get the top command and talk to it, not its PM (a QWidget). Also, whatever calls this will be making assumptions about that PM which are really only the command's business. So in short, every call of this is in need of cleanup once we have a working "command sequencer". (That's true of many things related to PMs, not only this method.) @warning: The return values are (presumably) widgets, but they can also be mode objects and generator objects, due to excessive use of multiple inheritance in the current PM code. So be careful what you do with them -- they might have lots of extra methods/attrs, and setting your own attrs in them might mess things up. """ res = self.propertyManagerScrollArea.widget() if not hasattr(res, 'done_btn'): # not sure what widget this is otherwise, but it is a widget # (not None) for the default mode, at least on startup, so just # return None in this case return None # Sometimes this PM remains present from a prior command, even when # there is no longer a tab for the PM. As part of fixing bug 2523 # we have to avoid returning it in that case. How we do that is a kluge, # but hopefully this entire kluge function can be dispensed with soon. # This change also fixes bug 2522 on the Mac (but not on Windows -- # for that, we needed to intercept removeTab in separate code above). index = self.pwProjectTabWidget.indexOf( self.propertyManagerScrollArea) if index == -1: return None # Due to bugs in other code, sometimes the PM tab is left in place, # though the PM itself is hidden. To avoid finding the PM in that case, # also check whether it's hidden. This will fix the CC part of a new bug # just reported by Keith in email (when hitting Ok in DNA Gen). if res.isHidden(): # probably a QWidget method [bruce 080205 comment] return None return res def dismiss(self): self.parent.removePartWindow(self) return def setSplitterPosition(self, pos = PM_DEFAULT_WIDTH, setDefault = True): """ Set the position of the splitter between the left area and graphics area so that the width of the container holding the model tree (and property manager) is I{pos} pixels wide. @param pos: The splitter position (in pixel units). @type pos: int @param setDefault: If True (the default), I{pos} becomes the new default position. @type setDefault: boolean """ self.pwSplitter.moveSplitter(pos, 1) if _DEBUG: print "New Splitter Position: %d (setDefault=%d)" \ % (pos, setDefault) if setDefault: self.splitterPosition = pos return def resizeEvent(self, event): """ This reimplementation of QWidget.resizeEvent is here to deal with the undesired behavior of the splitter while resizing the part window. Normally, the splitter will drift back and forth while resizing the part window. This forces the splitter to stay fixed during resize operations. """ # When self.resizeTimer.isActive() = True, the partwindow is being # resized. This is checked by the resizeEvent handler in LeftFrame # to determine if the splitter is being moved by the user or # programmably by self's resizeEvent. if self.resizeTimer.isActive(): self.resizeTimer.stop() # Stop the timer. self.resizeTimer.start( 500 ) # (Re)strand a .5 second singleshot timer. self.setSplitterPosition(self.splitterPosition, setDefault = False) QWidget.resizeEvent(self, event) return
NanoCAD-master
cad/src/ne1_ui/Ui_PartWindow.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtCore, QtGui from PyQt4.Qt import Qt from PyQt4.Qt import QRect from utilities.icon_utilities import geticon class Ui_ViewOrientation: def setupUi(self, orientationWidget): win = self.win MainWindow = self.win # Set the default width and height. _width = 150 _height = 280 _maxWidth = 400 # 400 should be more than enough. --mark # "View > Orientation" Dock Widget orientationWidget.setEnabled(True) orientationWidget.setFloating(True) orientationWidget.setVisible(False) orientationWidget.setWindowTitle("Orientation" ) orientationWidget.setWindowIcon( geticon("ui/actions/View/Modify/Orientation.png")) orientationWidget.setGeometry(QRect(0, 0, _width, _height)) orientationWidget.setMaximumWidth(400) x = max(0, win.geometry().x()) y = max(0, win.geometry().y()) orientationWidget.move(x, y) self.orientationWindowContents = QtGui.QWidget(orientationWidget) gridlayout = QtGui.QGridLayout(self.orientationWindowContents) gridlayout.setMargin(4) gridlayout.setSpacing(4) hboxlayout = QtGui.QHBoxLayout() hboxlayout.setMargin(0) hboxlayout.setSpacing(6) self.pinOrientationWindowToolButton = QtGui.QToolButton(self.orientationWindowContents) self.pinOrientationWindowToolButton.setCheckable(True) self.pinOrientationWindowToolButton.setIcon( geticon("ui/dialogs/unpinned.png")) hboxlayout.addWidget(self.pinOrientationWindowToolButton) self.saveNamedViewToolButton = QtGui.QToolButton(self.orientationWindowContents) self.saveNamedViewToolButton.setIcon( geticon("ui/actions/View/Modify/Save_Named_View.png")) #@@ ninad 061115 dir path will be modified hboxlayout.addWidget(self.saveNamedViewToolButton) gridlayout.addLayout(hboxlayout, 0, 0, 1, 1) self.orientationViewList = QtGui.QListWidget(orientationWidget) self.orientationViewList.setFlow(QtGui.QListWidget.TopToBottom) self.orientationViewList.setWindowIcon( geticon("ui/actions/View/Modify/Orientation.png")) gridlayout.addWidget(self.orientationViewList, 1, 0, 1, 1) orientationWidget.setWidget(self.orientationWindowContents) MainWindow.addDockWidget(Qt.BottomDockWidgetArea, orientationWidget)
NanoCAD-master
cad/src/ne1_ui/Ui_ViewOrientation.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ ToolTipText_for_CommandToolbars.py This file provides functions for setting the "Tooltip" text for widgets (typically QActions) in the Command Toolbar. @author: Mark @version:$Id$ @copyright: 2004-2007 Nanorex, Inc. See LICENSE file for details. """ # Try to keep this list in order (by appearance in Command Toolbar). --Mark # Build command toolbars #################### def toolTipTextForAtomsCommandToolbar(commandToolbar): """ "ToolTip" text for widgets in the Build Atoms Command Toolbar. @note: This is a placeholder function. Currenly, all the tooltip text is defined in BuildAtoms_Command.py. """ return def toolTipTextForDnaCommandToolbar(commandToolbar): """ "ToolTip" text for the Build DNA Command Toolbar """ commandToolbar.dnaDuplexAction.setToolTip("Insert DNA") commandToolbar.breakStrandAction.setToolTip("Break Strands") commandToolbar.joinStrandsAction.setToolTip("Join Strands") commandToolbar.dnaOrigamiAction.setToolTip("Origami") commandToolbar.convertDnaAction.setToolTip("Convert DNA") commandToolbar.orderDnaAction.setToolTip("Order DNA") commandToolbar.editDnaDisplayStyleAction.setToolTip("Edit DNA Display Style") return def toolTipTextForProteinCommandToolbar(commandToolbar): """ "ToolTip" text for the Build Protein Command Toolbar """ commandToolbar.modelProteinAction.setToolTip("Model Protein") commandToolbar.simulateProteinAction.setToolTip("Simulate Protein using Rosetta") commandToolbar.buildPeptideAction.setToolTip("Insert Peptide") commandToolbar.compareProteinsAction.setToolTip("Compare Proteins") commandToolbar.displayProteinStyleAction.setToolTip("Edit Protein Display Style") commandToolbar.rosetta_fixedbb_design_Action.setToolTip("Fixed Backbone Protein Sequence Design") commandToolbar.rosetta_backrub_Action.setToolTip("Backrub Motion") commandToolbar.editResiduesAction.setToolTip("Edit Residues") commandToolbar.rosetta_score_Action.setToolTip("Compute Rosetta Score") return def toolTipTextForNanotubeCommandToolbar(commandToolbar): """ "ToolTip" text for widgets in the Build Nanotube Command Toolbar. """ commandToolbar.insertNanotubeAction.setToolTip("Insert Nanotube") return def toolTipTextForCrystalCommandToolbar(commandToolbar): """ "Tool Tip" text for widgets in the Build Crystal Command Toolbar. """ commandToolbar.polygonShapeAction.setToolTip( "Polygon (P)") commandToolbar.circleShapeAction.setToolTip( "Circle (C)") commandToolbar.squareShapeAction.setToolTip( "Square (S)") commandToolbar.rectCtrShapeAction.setToolTip( "Rectangular (R)") commandToolbar.rectCornersShapeAction.setToolTip( "Rectangle Corners (Shift+R)") commandToolbar.triangleShapeAction.setToolTip( "Triangle (T)") commandToolbar.diamondShapeAction.setToolTip( "Diamond (D)") commandToolbar.hexagonShapeAction.setToolTip( "Hexagon (H)") commandToolbar.lassoShapeAction.setToolTip( "Lasso (L)") return # Move command toolbar #################### def toolTipTextForMoveCommandToolbar(commandToolbar): """ "ToolTip" text for widgets in the Move Command Toolbar. """ return def toolTipTextForMovieCommandToolbar(commandToolbar): """ "ToolTip" text for widgets in the Movie Command Toolbar. """ return
NanoCAD-master
cad/src/ne1_ui/ToolTipText_for_CommandToolbars.py
# Copyright 2007-2008 Nanorex, Inc. See LICENSE file for details. """ WhatsThisText_for_PreferencesDialog.py This file provides functions for setting the "What's This" and tooltip text for widgets in the NE1 Preferences dialog only. Edit WhatsThisText_for_MainWindow.py to set "What's This" and tooltip text for widgets in the Main Window. @version: $Id$ @copyright: 2007-2008 Nanorex, Inc. See LICENSE file for details. """ import sys def whatsThis_PreferencesDialog(preferencesDialog): """ Assigning the I{What's This} text for the Preferences dialog. """ _pd = preferencesDialog if sys.platform == 'darwin': # TODO: figure out how to get fix_whatsthis_text_and_links to handle # this for us (like it does for most whatsthis text). # For more info see comments from today in other files. # [bruce 081209 comment] _keyString = "<b>(Cmd + C and Cmd + V)</b> respectively" else: _keyString = "<b>(Ctrl + C and Ctrl + V)</b> respectively" #General preference _text = """<b>Offset scale factor for pasting chunks</b> <p>When one or more chunks, that are placed as independent nodes in the Model Tree, are copied and then pasted using the modifier keys %s, this scale factor determines the offset of the pasted chunks from the original chunks. Note that if the copied selection includes any DNA objects such as DNA segments, strands etc, the program will use an offset scale that is used for pasting the DNA objects instead of this offset scale) </p>"""%(_keyString) _pd.pasteOffsetScaleFactorForChunks_doubleSpinBox.setWhatsThis(_text) _pd.pasteOffsetForChunks_lable.setWhatsThis(_text) _text = """<b>Offset scale factor for pasting Dna objects</b> <p>When one or more DNA objects such as DNA segments, strands etc, are copied and then pasted using the modifier keys %s, this scale factor determines the offset of the pasted DNA objects from the original ones. Note that this also applies to pasting chunks within a group in the Model Tree. </p>"""%(_keyString) _pd.pasteOffsetScaleFactorForDnaObjects_doubleSpinBox.setWhatsThis(_text) _pd.pasteOffsetForDna_lable.setWhatsThis(_text) # Bond line thickness _text = \ "<b>Bond line thickness</b>"\ "<p>"\ "Sets the line thickness to <i>n</i> pixels wheneven bonds "\ "are rendered as lines (i.e. when the global display style is set to "\ "<b>Lines</b> display style)."\ "</p>" _pd.bond_line_thickness_spinbox.setWhatsThis(_text) # nice! _pd.textLabel1.setWhatsThis(_text) # and What's This text for all the others widgets (yuk!) _pd.display_origin_axis_checkbox.setWhatsThis( """<p><b>Display origin axis</b></p> <p> Shows/Hides the origin axis""") _pd.display_pov_axis_checkbox.setWhatsThis( """<p><b>Display point of view axis</b></p> <p> Shows/Hides the point of view axis""") _text = \ """<p><b>Display compass</b></p> <p> Shows/Hides the display compass""" _pd.compassGroupBox.setWhatsThis(_text) _pd.display_compass_labels_checkbox.setWhatsThis( """Shows/Hides the display compass axis labels.""") _pd.watch_motion_groupbox.setWhatsThis( """<p><b>Watch motion in real time</b></p> <p> Enables/disables realtime graphical updates during adjust operations when using <b>Adjust All</b> or <b>Adjust Selection</b>""") _text = \ """Changes the location of the display compass.""" _pd.textLabel1_4.setWhatsThis(_text) _pd.compass_position_combox.setWhatsThis(_text) _text = \ """<b>Update every <i>n units.</u></b> <p> Specify how often to update the model during the adjustment. This allows the user to monitor results during adjustments. </p>""" _pd.update_number_spinbox.setWhatsThis(_text) _pd.update_units_combobox.setWhatsThis(_text) _pd.update_every_rbtn.setWhatsThis( """<b>Update every <i>n units.</u></b> <p> Specify how often to update the model during the adjustment. This allows the user to monitor results during adjustments. </p>""") _pd.update_asap_rbtn.setWhatsThis( """<b>Update as fast as possible</b> <p> Update every 2 seconds, or faster (up to 20x/sec)if it doesn't slow adjustments by more than 20% </p>""") _text = \ """<b>EndRMS</b> <p> Continue until this RMS force is reached. </p>""" _pd.endrms_lbl.setWhatsThis(_text) _pd.endRmsDoubleSpinBox.setWhatsThis(_text) _text = \ """<b>EndMax</b> <p> Continue until no interaction exceeds this force. </p>""" _pd.endmax_lbl.setWhatsThis(_text) _pd.endMaxDoubleSpinBox.setWhatsThis(_text) _text = \ """<b>CutoverMax</b> <p>Use steepest descent until no interaction exceeds this force. </p>""" _pd.cutovermax_lbl.setWhatsThis(_text) _pd.cutoverMaxDoubleSpinBox.setWhatsThis(_text) _text = \ """<b>CutoverRMS</b> <p> Use steepest descent until this RMS force is reached. </p>""" _pd.cutoverRmsDoubleSpinBox.setWhatsThis(_text) _pd.cutoverrms_lbl.setWhatsThis(_text) # Sponsor Logos Download Permission _pd.sponsorLogosGroupBox.setWhatsThis( """<b>Sponsor logos download permission</b> <p> This group of buttons sets the permission for downloading sponsor logos. </p>""") _pd.logoAlwaysAskRadioBtn.setWhatsThis( """<b>Always ask before downloading</b> <p> When sponsor logos have been updated, ask permission to download them. </p>""") _pd.logoNeverAskRadioBtn.setWhatsThis( """<b>Never ask before downloading</b> <p> When sponsor logos have been updated, download them without asking permission to do so. </p>""") _pd.logoNeverDownLoadRadioBtn.setWhatsThis( """<b>Never download</b> <p> Don't ask permission to download sponsor logos and don't download them. </p>""") _pd.animate_views_checkbox.setWhatsThis( """<p><b>Animate between views</b></p> <p> Enables/disables animation when switching between the current view and a new view. </p>""") _text = \ """<p><b>View animation speed</b></p> <p> Sets the animation speed when animating between views (i.e. Front view to Right view). It is recommended that this be set to Fast when working on large models. </p>""" _pd.textLabel1_5.setWhatsThis(_text) _pd.animation_speed_slider.setWhatsThis(_text) _text = \ """<p><b>Mouse rotation speed</b></p> <p> Specifies the speed factor to use when rotating the view by dragging the mouse (i.e. during the <b>Rotate</b> command or when using the middle mouse button). </p>""" _pd.mouseSpeedDuringRotation_slider.setWhatsThis(_text) _pd.rotationSensitivity_txtlbl.setWhatsThis(_text) _text = \ """<p><b>Level of detail</b></p> <p> Sets the level of detail for atoms and bonds.<br> <br> <b>High</b> = Best graphics quality (slowest rendering speed)<br> <b>Medium</b> = Good graphics quality<br> <b>Low</b> = Poor graphics quality (fastest rendering speed) <br> <b>Variable</b> automatically switches between High, Medium and Low based on the model size (number of atoms). </p>""" _pd.textLabel1_7.setWhatsThis(_text) _pd.level_of_detail_combox.setWhatsThis(_text) _pd.textLabel1_3_2.setWhatsThis( """<p><b>Ball and stick atom scale</b></p> <p> Sets the ball and stick atom scale factor. It is best to change the scale factor while the current model is displayed in ball and stick mode.""") _pd.ballStickAtomScaleFactorSpinBox.setWhatsThis( """<p><b>Ball and stick atom scale</b></p> <p> Sets the atom scale factor for ball and stick display style. It is best to change the scale factor while the global display style is set to ball and stick.""") _pd.textLabel1_3_2_2.setWhatsThis( """<p><b>CPK atom scale</b></p> <p> Changes the CPK atom scale factor. It is best to change the scale factor while in CPK display mode so you can see the graphical effect of changing the scale.""") _pd.cpkAtomScaleFactorDoubleSpinBox.setWhatsThis( """<p><b>CPK atom scale</b></p> <p> Set the atom scale factor for CPK display style. It is best to change the scale factor while the global display style is set to CPK so you can see the graphical effect of changing the scale.""") _pd.reset_cpk_scale_factor_btn.setWhatsThis( """Restore the default value of the CPK scale factor""") _pd.reset_ballstick_scale_factor_btn.setWhatsThis( """Restore the default value of the ball and stick scale factor.""") _pd.haloWidthResetButton.setWhatsThis( """Restore the default value of halo width.""") _pd.multCyl_radioButton.setWhatsThis( """<p><b>Multiple cylinders</b></p> <p> <p><b>High order bonds</b> are displayed using <b>multiple cylinders.</b></p> <p> <b>Double bonds</b> are drawn with two cylinders.<br> <b>Triple bonds</b> are drawn with three cylinders.<br> <b>Aromatic bonds</b> are drawn as a single cylinder with a short green cylinder in the middle.""") _pd.vanes_radioButton.setWhatsThis( """<p><b>Vanes</b></p> <p> <p><i>High order bonds</i> are displayed using <b>Vanes.</b></p> <p> <p>Vanes represent <i>pi systems</i> in high order bonds and are rendered as rectangular polygons. The orientation of the vanes approximates the orientation of the pi system(s).</p> <p>Create an acetylene or ethene molecule and select this option to see how vanes are rendered. </p>""") _pd.ribbons_radioButton.setWhatsThis( """<p><b>Ribbons</b></p> <p> <p><i>High order bonds</i> are displayed using <b>Ribbons.</b></p> <p> <p>Ribbons represent <i>pi systems</i> in high order bonds and are rendered as ribbons. The orientation of the ribbons approximates the orientation of the pi system.</p> <p>Create an acetylene or ethene molecule and select this option to see how ribbons are rendered. </p>""") _pd.show_bond_labels_checkbox.setWhatsThis( """<p><b>Show bond type letters</b></p> <p> <p>Shows/Hides bond type letters (labels) on top of bonds.</p> <u>Bond type letters:</u><br> <b>2</b> = Double bond<br> <b>3</b> = Triple bond<br> <b>A</b> = Aromatic bond<br> <b>G</b> = Graphitic bond<br>""") _pd.show_valence_errors_checkbox.setWhatsThis( """<p><b>Show valence errors</b></p> <p> Enables/Disables valence error checker.</p> When enabled, atoms with valence errors are displayed with a pink wireframe sphere. This indicates that one or more of the atom's bonds are not of the correct order (type), or that the atom has the wrong number of bonds, or (for PAM DNA pseudoatoms) that there is some error in bond directions or in which PAM elements are bonded. The error details can be seen in the tooltip for the atom.""") _text = \ """<p><b>Ball and stick bond scale</b></p> <p> Set scale (size) factor for the cylinder representing bonds in ball and stick display mode""" _pd.textLabel1_3.setWhatsThis(_text) _pd.cpk_cylinder_rad_spinbox.setWhatsThis(_text) _pd.autobond_checkbox.setWhatsThis( """<p>Default setting for <b>Autobonding</b> at startup (enabled/disabled)</p>""") _pd.water_checkbox.setWhatsThis( """<p>Default setting for <b>Water (surface)</b> at startup (enabled/disabled)</p>""") _pd.buildmode_select_atoms_checkbox.setWhatsThis( """<b>Auto select atoms of deposited object</b> <p> When depositing atoms, clipboard chunks or library parts, their atoms will automatically be selected.""") _pd.buildmode_highlighting_checkbox.setWhatsThis( """<p>Default setting for <b>Hover highlighting</b> at startup (enabled/disabled)</p>""") _pd.gromacs_label.setWhatsThis( """Enable GROMACS and choose the mdrun executable path to use.""") _pd.gromacs_checkbox.setWhatsThis( """This enables GROMACS as a plug-in. GROMACS is a free rendering program available from http://www.gromacs.org/. GROMACS must be installed on your computer before you can enable the GROMACS plug-in. Check this and choose the the path to the mdrun executable from your GROMACS distribution.""") _pd.gromacs_path_lineedit.setWhatsThis( """The full path to the mdrun executable file for GROMACS.""") _pd.gromacs_choose_btn.setWhatsThis( """This opens up a file chooser dialog so that you can specify the location of the GROMACS executable (mdrun).""") _text = \ """Specify the C-preprocessor (cpp) for GROMACS to use.""" _pd.cpp_label.setWhatsThis(_text) _pd.cpp_checkbox.setWhatsThis(_text) _pd.cpp_path_lineedit.setWhatsThis( """The full path to the C-preprocessor (cpp) executable file for GROMACS to use.""") _pd.cpp_choose_btn.setWhatsThis( """Allows you to choose the path to the C-preprocessor (cpp) executable file for GROMACS to use.""") _text = \ """This enables POV-Ray as a plug-in. POV-Ray is a free raytracing program available from http://www.povray.org/. POV-Ray must be installed on your computer before you can enable the POV-Ray plug-in. """ _pd.povray_checkbox.setWhatsThis(_text) _pd.povray_lbl.setWhatsThis(_text) _text = \ """This enables QuteMolX as a plug-in. QuteMolX is available for download from http://nanoengineer-1.com/QuteMolX. QuteMolX must be installed on your computer before you can enable this plug-in.""" _pd.qutemol_lbl.setWhatsThis(_text) _pd.qutemol_checkbox.setWhatsThis(_text) _text = \ """This enables Nano-Hive as a plug-in. Nano-Hive is available for download from http://www.nano-hive.com/. Nano-Hive must be installed on your computer before you can enable the Nano-Hive plug-in.""" _pd.nanohive_lbl.setWhatsThis(_text) _pd.nanohive_checkbox.setWhatsThis(_text) _pd.povray_path_lineedit.setWhatsThis( """The full path to the POV-Ray executable file.""") _pd.qutemol_path_lineedit.setWhatsThis( """The full path to the QuteMolX executable file.""") _pd.nanohive_path_lineedit.setWhatsThis( """The full path to the Nano-Hive executable file.""") _text = \ """<p>This enables PC-GAMESS (Windows) or GAMESS (Linux or MacOS) as a plug-in. </p> <p>For Windows users, PC-GAMESS is available for download from http://classic.chem.msu.su/gran/gamess/. PC-GAMESS must be installed on your computer before you can enable the PC-GAMESS plug-in.</p> <p>For Linux and MacOS users, GAMESS is available for download from http://www.msg.ameslab.gov/GAMESS/GAMESS.html. GAMESS must be installed on your computer before you can enable the GAMESS plug-in. </p>""" _pd.gamess_lbl.setWhatsThis(_text) _pd.gamess_checkbox.setWhatsThis(_text) _pd.megapov_path_lineedit.setWhatsThis( """The full path to the MegaPOV executable file (megapov.exe).""") _text = \ """This enables MegaPOV as a plug-in. MegaPOV is a free addon raytracing program available from http://megapov.inetart.net/. Both MegaPOV and POV-Ray must be installed on your computer before you can enable the MegaPOV plug-in. MegaPOV allows rendering to happen silently on Windows (i.e. no POV_Ray GUI is displayed while rendering).""" _pd.megapov_checkbox.setWhatsThis(_text) _pd.megapov_lbl.setWhatsThis(_text) _pd.gamess_path_lineedit.setWhatsThis( """The gamess executable file. Usually it's called gamess.??.x or ??gamess.exe.""") _pd.povdir_lineedit.setWhatsThis( """Specify a directory for where to find POV-Ray or MegaPOV include files such as transforms.inc.""") _pd.qutemol_choose_btn.setWhatsThis( """This opens up a file chooser dialog so that you can specify the location of the QuteMolX executable.""") _pd.nanohive_choose_btn.setWhatsThis( """This opens up a file chooser dialog so that you can specify the location of the Nano-Hive executable.""") _pd.povray_choose_btn.setWhatsThis( """This opens up a file chooser dialog so that you can specify the location of the POV-Ray executable.""") _pd.megapov_choose_btn.setWhatsThis( """This opens up a file chooser dialog so that you can specify the location of the MegaPOV executable (megapov.exe).""") _pd.gamess_choose_btn.setWhatsThis( """This opens up a file chooser dialog so that you can specify the location of the GAMESS or PC-GAMESS executable.""") _pd.povdir_checkbox.setWhatsThis( """Select a user-customized directory for POV-Ray and MegaPOV include files, such as transforms.inc.""") _pd.undo_automatic_checkpoints_checkbox.setWhatsThis( """<p><b>Automatic checkpoints</b></p> <p> Specifies whether <b>automatic checkpointing</b> is enabled/disabled during program startup only. It does not enable/disable <b>automatic checkpointing</b> when the program is running. <p><b>Automatic checkpointing</b> can be enabled/disabled by the user at any time from <b>Edit > Automatic checkpointing</b>. When enabled, the program maintains the undo stack automatically. When disabled, the user is required to manually set undo checkpoints using the <b>set checkpoint</b> button in the Edit Toolbar/Menu.</p> <p><b>Automatic checkpointing</b> can impact program performance. By disabling automatic checkpointing, the program will run faster.</p> <p><b><i>Remember to you must set your own undo checkpoints manually when automatic checkpointing is disabled.</i></b></p> <p>""") _pd.undo_restore_view_checkbox.setWhatsThis( """<p><b>Restore view when undoing structural changes</b></p> <p> <p>When checked, the current view is stored along with each <b><i>structural change</i></b> on the undo stack. The view is then restored when the user undoes a structural change.</p> <p><b><i>Structural changes</i></b> include any operation that modifies the model. Examples include adding, deleting or moving an atom, chunk or jig. </p> <p>Selection (picking/unpicking) and view changes are examples of operations that do not modify the model (i.e. are not structural changes). </p>""") _pd.groupBox3.setWhatsThis( """Format prefix and suffix text the delimits the part name in the caption in window border.""") _text = \ """Saves the main window's current position and size for the next time the program starts.""" _pd.save_current_btn.setWhatsThis(_text) _pd.restore_saved_size_btn.setWhatsThis( """Restores the main window's current position from the last time the program was closed""") _text = \ """Sets background color from preset list or choose to customize your own background color""" _pd.label_8.setWhatsThis(_text) _pd.backgroundColorComboBox.setWhatsThis(_text) _pd.hoverHighlightingStyleGroupBox.setWhatsThis( """<p><b>Hover highlighting style</b></p> <p> <p>Creates a highlight surrounding an object that the cursor is placed over. The highlight shows what would be selected if the mouse was clicked. Has options to view the highlighting in many ways as well as choose the color of the highlight. </p>""") _pd.selectionColorStyleGroupBox.setWhatsThis( """<p><b>Selection style</b></p> <p> <p>When an object or objects have been selected they become highlighted. The highlighting has many textures and colors that may be changed. </p>""") _text = \ """Sets the width of the colored halo if colored halo is chosen as a highlighting style or selection style.""" _pd.label_25.setWhatsThis(_text) _pd.haloWidthSpinBox.setWhatsThis(_text) _text = \ """Changes the appearance of any objects in the work place.""" _pd.label_9.setWhatsThis(_text) _pd.globalDisplayStyleStartupComboBox.setWhatsThis(_text) return
NanoCAD-master
cad/src/ne1_ui/prefs/WhatsThisText_for_PreferencesDialog.py
# Copyright 2005-2008 Nanorex, Inc. See LICENSE file for details. """ Preferences.py @author: Mark @version: $Id$ @copyright: 2005-2008 Nanorex, Inc. See LICENSE file for details. History: -Mark 2008-05-20: Created by Mark from a copy of UserPrefs.py """ import os, sys from PyQt4 import QtCore, QtGui from PyQt4.Qt import QDialog from PyQt4.Qt import QFileDialog from PyQt4.Qt import QMessageBox from PyQt4.Qt import QButtonGroup from PyQt4.Qt import QAbstractButton from PyQt4.Qt import QDoubleValidator from PyQt4.Qt import SIGNAL from PyQt4.Qt import QPalette from PyQt4.Qt import QColorDialog from PyQt4.Qt import QString from PyQt4.Qt import QFont from PyQt4.Qt import Qt from PyQt4.Qt import QWhatsThis from PyQt4.Qt import QTreeWidget from PyQt4.Qt import QSize from ne1_ui.prefs.PreferencesDialog import Ui_PreferencesDialog import foundation.preferences as preferences from utilities.debug import print_compact_traceback from utilities.debug_prefs import debug_pref, Choice_boolean_False import foundation.env as env from widgets.widget_helpers import RGBf_to_QColor, QColor_to_RGBf from widgets.widget_helpers import double_fixup from widgets.prefs_widgets import connect_colorpref_to_colorframe, connect_checkbox_with_boolean_pref from utilities import debug_flags from utilities.constants import str_or_unicode from platform_dependent.PlatformDependent import screen_pos_size from platform_dependent.PlatformDependent import get_rootdir from platform_dependent.Paths import get_default_plugin_path from utilities.icon_utilities import geticon from utilities.prefs_constants import displayCompass_prefs_key from utilities.prefs_constants import displayCompassLabels_prefs_key from utilities.prefs_constants import displayPOVAxis_prefs_key from utilities.prefs_constants import displayConfirmationCorner_prefs_key from utilities.prefs_constants import enableAntiAliasing_prefs_key from utilities.prefs_constants import animateStandardViews_prefs_key from utilities.prefs_constants import displayVertRuler_prefs_key from utilities.prefs_constants import displayHorzRuler_prefs_key from utilities.prefs_constants import rulerPosition_prefs_key from utilities.prefs_constants import rulerColor_prefs_key from utilities.prefs_constants import rulerOpacity_prefs_key from utilities.prefs_constants import showRulersInPerspectiveView_prefs_key from utilities.prefs_constants import Adjust_watchRealtimeMinimization_prefs_key from utilities.prefs_constants import Adjust_minimizationEngine_prefs_key from utilities.prefs_constants import electrostaticsForDnaDuringAdjust_prefs_key from utilities.prefs_constants import Adjust_cutoverRMS_prefs_key from utilities.prefs_constants import qutemol_enabled_prefs_key from utilities.prefs_constants import qutemol_path_prefs_key from utilities.prefs_constants import nanohive_enabled_prefs_key from utilities.prefs_constants import nanohive_path_prefs_key from utilities.prefs_constants import povray_enabled_prefs_key from utilities.prefs_constants import povray_path_prefs_key from utilities.prefs_constants import megapov_enabled_prefs_key from utilities.prefs_constants import megapov_path_prefs_key from utilities.prefs_constants import povdir_enabled_prefs_key from utilities.prefs_constants import gamess_enabled_prefs_key from utilities.prefs_constants import gmspath_prefs_key from utilities.prefs_constants import gromacs_enabled_prefs_key from utilities.prefs_constants import gromacs_path_prefs_key from utilities.prefs_constants import cpp_enabled_prefs_key from utilities.prefs_constants import cpp_path_prefs_key from utilities.prefs_constants import rosetta_enabled_prefs_key from utilities.prefs_constants import rosetta_path_prefs_key from utilities.prefs_constants import rosetta_database_enabled_prefs_key from utilities.prefs_constants import rosetta_dbdir_prefs_key from utilities.prefs_constants import nv1_enabled_prefs_key from utilities.prefs_constants import nv1_path_prefs_key from utilities.prefs_constants import startupGlobalDisplayStyle_prefs_key from utilities.prefs_constants import buildModeAutobondEnabled_prefs_key from utilities.prefs_constants import buildModeWaterEnabled_prefs_key from utilities.prefs_constants import buildModeHighlightingEnabled_prefs_key from utilities.prefs_constants import buildModeSelectAtomsOfDepositedObjEnabled_prefs_key from utilities.prefs_constants import light1Color_prefs_key from utilities.prefs_constants import light2Color_prefs_key from utilities.prefs_constants import light3Color_prefs_key from utilities.prefs_constants import atomHighlightColor_prefs_key from utilities.prefs_constants import bondpointHighlightColor_prefs_key from utilities.prefs_constants import levelOfDetail_prefs_key from utilities.prefs_constants import diBALL_AtomRadius_prefs_key from utilities.prefs_constants import cpkScaleFactor_prefs_key from utilities.prefs_constants import showBondStretchIndicators_prefs_key from utilities.prefs_constants import showValenceErrors_prefs_key #General page prefs - paste offset scale for chunk and dna pasting prefs key from utilities.prefs_constants import pasteOffsetScaleFactorForChunks_prefs_key from utilities.prefs_constants import pasteOffsetScaleFactorForDnaObjects_prefs_key # Color (page) prefs from utilities.prefs_constants import backgroundColor_prefs_key from utilities.prefs_constants import backgroundGradient_prefs_key from utilities.prefs_constants import hoverHighlightingColorStyle_prefs_key from utilities.prefs_constants import hoverHighlightingColor_prefs_key from utilities.prefs_constants import selectionColorStyle_prefs_key from utilities.prefs_constants import selectionColor_prefs_key from utilities.prefs_constants import haloWidth_prefs_key # Mouse wheel prefs from utilities.prefs_constants import mouseWheelDirection_prefs_key from utilities.prefs_constants import zoomInAboutScreenCenter_prefs_key from utilities.prefs_constants import zoomOutAboutScreenCenter_prefs_key from utilities.prefs_constants import mouseWheelTimeoutInterval_prefs_key # Pan settings from utilities.prefs_constants import panArrowKeysDirection_prefs_key # DNA prefs from utilities.prefs_constants import bdnaBasesPerTurn_prefs_key from utilities.prefs_constants import bdnaRise_prefs_key from utilities.prefs_constants import dnaDefaultStrand1Color_prefs_key from utilities.prefs_constants import dnaDefaultStrand2Color_prefs_key from utilities.prefs_constants import dnaDefaultSegmentColor_prefs_key from utilities.prefs_constants import dnaStrutScaleFactor_prefs_key from utilities.prefs_constants import arrowsOnBackBones_prefs_key from utilities.prefs_constants import arrowsOnThreePrimeEnds_prefs_key from utilities.prefs_constants import arrowsOnFivePrimeEnds_prefs_key from utilities.prefs_constants import useCustomColorForThreePrimeArrowheads_prefs_key from utilities.prefs_constants import dnaStrandThreePrimeArrowheadsCustomColor_prefs_key from utilities.prefs_constants import useCustomColorForFivePrimeArrowheads_prefs_key from utilities.prefs_constants import dnaStrandFivePrimeArrowheadsCustomColor_prefs_key # DNA Minor Groove Error Indicator prefs from utilities.prefs_constants import dnaDisplayMinorGrooveErrorIndicators_prefs_key from utilities.prefs_constants import dnaMinMinorGrooveAngle_prefs_key from utilities.prefs_constants import dnaMaxMinorGrooveAngle_prefs_key from utilities.prefs_constants import dnaMinorGrooveErrorIndicatorColor_prefs_key # DNA style prefs 080310 piotr from utilities.prefs_constants import dnaStyleStrandsShape_prefs_key from utilities.prefs_constants import dnaStyleStrandsColor_prefs_key from utilities.prefs_constants import dnaStyleStrandsScale_prefs_key from utilities.prefs_constants import dnaStyleStrandsArrows_prefs_key from utilities.prefs_constants import dnaStyleAxisShape_prefs_key from utilities.prefs_constants import dnaStyleAxisColor_prefs_key from utilities.prefs_constants import dnaStyleAxisScale_prefs_key from utilities.prefs_constants import dnaStyleAxisEndingStyle_prefs_key from utilities.prefs_constants import dnaStyleStrutsShape_prefs_key from utilities.prefs_constants import dnaStyleStrutsColor_prefs_key from utilities.prefs_constants import dnaStyleStrutsScale_prefs_key from utilities.prefs_constants import dnaStyleBasesShape_prefs_key from utilities.prefs_constants import dnaStyleBasesColor_prefs_key from utilities.prefs_constants import dnaStyleBasesScale_prefs_key # DNA labels and base indicators. 080325 piotr from utilities.prefs_constants import dnaStrandLabelsEnabled_prefs_key from utilities.prefs_constants import dnaStrandLabelsColor_prefs_key from utilities.prefs_constants import dnaStrandLabelsColorMode_prefs_key from utilities.prefs_constants import dnaBaseIndicatorsEnabled_prefs_key from utilities.prefs_constants import dnaBaseInvIndicatorsEnabled_prefs_key from utilities.prefs_constants import dnaBaseIndicatorsAngle_prefs_key from utilities.prefs_constants import dnaBaseIndicatorsColor_prefs_key from utilities.prefs_constants import dnaBaseInvIndicatorsColor_prefs_key from utilities.prefs_constants import dnaBaseIndicatorsDistance_prefs_key from utilities.prefs_constants import dnaStyleBasesDisplayLetters_prefs_key from utilities.prefs_constants import dnaBaseIndicatorsPlaneNormal_prefs_key # Undo prefs from utilities.prefs_constants import undoRestoreView_prefs_key from utilities.prefs_constants import undoAutomaticCheckpoints_prefs_key from utilities.prefs_constants import undoStackMemoryLimit_prefs_key from utilities.prefs_constants import historyMsgSerialNumber_prefs_key from utilities.prefs_constants import historyMsgTimestamp_prefs_key from utilities.prefs_constants import historyHeight_prefs_key from utilities.prefs_constants import rememberWinPosSize_prefs_key from utilities.prefs_constants import captionFullPath_prefs_key from utilities.prefs_constants import dynamicToolTipAtomChunkInfo_prefs_key from utilities.prefs_constants import dynamicToolTipAtomMass_prefs_key from utilities.prefs_constants import dynamicToolTipAtomPosition_prefs_key from utilities.prefs_constants import dynamicToolTipAtomDistanceDeltas_prefs_key from utilities.prefs_constants import dynamicToolTipBondLength_prefs_key from utilities.prefs_constants import dynamicToolTipBondChunkInfo_prefs_key from utilities.prefs_constants import dynamicToolTipAtomDistancePrecision_prefs_key from utilities.prefs_constants import captionPrefix_prefs_key from utilities.prefs_constants import captionSuffix_prefs_key from utilities.prefs_constants import compassPosition_prefs_key from utilities.prefs_constants import defaultProjection_prefs_key from utilities.prefs_constants import displayOriginAsSmallAxis_prefs_key from utilities.prefs_constants import displayOriginAxis_prefs_key from utilities.prefs_constants import animateMaximumTime_prefs_key from utilities.prefs_constants import mouseSpeedDuringRotation_prefs_key from utilities.prefs_constants import Adjust_endRMS_prefs_key from utilities.prefs_constants import Adjust_endMax_prefs_key from utilities.prefs_constants import Adjust_cutoverMax_prefs_key from utilities.prefs_constants import sponsor_permanent_permission_prefs_key from utilities.prefs_constants import sponsor_download_permission_prefs_key from utilities.prefs_constants import bondpointHotspotColor_prefs_key from utilities.prefs_constants import diBALL_bondcolor_prefs_key from utilities.prefs_constants import bondHighlightColor_prefs_key from utilities.prefs_constants import bondStretchColor_prefs_key from utilities.prefs_constants import bondVaneColor_prefs_key from utilities.prefs_constants import pibondStyle_prefs_key from utilities.prefs_constants import pibondLetters_prefs_key from utilities.prefs_constants import linesDisplayModeThickness_prefs_key from utilities.prefs_constants import diBALL_BondCylinderRadius_prefs_key from utilities.prefs_constants import material_specular_highlights_prefs_key from utilities.prefs_constants import material_specular_shininess_prefs_key from utilities.prefs_constants import material_specular_brightness_prefs_key from utilities.prefs_constants import material_specular_finish_prefs_key from utilities.prefs_constants import povdir_path_prefs_key from utilities.prefs_constants import dynamicToolTipBendAnglePrecision_prefs_key from utilities.prefs_constants import dynamicToolTipVdwRadiiInAtomDistance_prefs_key from utilities.prefs_constants import displayFontPointSize_prefs_key from utilities.prefs_constants import useSelectedFont_prefs_key from utilities.prefs_constants import displayFont_prefs_key from utilities.prefs_constants import keepBondsDuringTransmute_prefs_key from utilities.prefs_constants import indicateOverlappingAtoms_prefs_key from utilities.prefs_constants import fogEnabled_prefs_key # Cursor text prefs. from utilities.prefs_constants import cursorTextFontSize_prefs_key from utilities.prefs_constants import cursorTextColor_prefs_key #global display preferences from utilities.constants import diDEFAULT ,diTrueCPK, diLINES from utilities.constants import diBALL, diTUBES, diDNACYLINDER from utilities.constants import black, white, gray from widgets.prefs_widgets import connect_doubleSpinBox_with_pref # = # Preferences widgets constants. I suggest that these be moved to another # file (i.e. prefs_constants.py or another file). Discuss with Bruce. -Mark # Widget constants for the "Graphics Area" page. BG_BLUE_SKY = 0 BG_EVENING_SKY = 1 BG_SEAGREEN = 2 BG_BLACK = 3 BG_WHITE = 4 BG_GRAY = 5 BG_CUSTOM = 6 # GDS = global display style GDS_INDEXES = [diLINES, diTUBES, diBALL, diTrueCPK, diDNACYLINDER] GDS_NAMES = ["Lines", "Tubes", "Ball and Stick", "CPK", "DNA Cylinder"] GDS_ICONS = ["Lines", "Tubes", "Ball_and_Stick", "CPK", "DNACylinder" ] # Widget constants for the "Colors" page. # HHS = hover highlighting styles from utilities.prefs_constants import HHS_HALO from utilities.prefs_constants import HHS_SOLID from utilities.prefs_constants import HHS_SCREENDOOR1 from utilities.prefs_constants import HHS_CROSSHATCH1 from utilities.prefs_constants import HHS_BW_PATTERN from utilities.prefs_constants import HHS_POLYGON_EDGES from utilities.prefs_constants import HHS_DISABLED from utilities.prefs_constants import HHS_INDEXES from utilities.prefs_constants import HHS_OPTIONS # SS = selection styles from utilities.prefs_constants import SS_HALO from utilities.prefs_constants import SS_SOLID from utilities.prefs_constants import SS_SCREENDOOR1 from utilities.prefs_constants import SS_CROSSHATCH1 from utilities.prefs_constants import SS_BW_PATTERN from utilities.prefs_constants import SS_POLYGON_EDGES from utilities.prefs_constants import SS_INDEXES from utilities.prefs_constants import SS_OPTIONS # = end of Preferences widgets constants. debug_sliders = False # Do not commit as True def debug_povdir_signals(): return 0 and env.debug() # This list of mode names correspond to the names listed in the modes combo box. # [TODO: It needs to be renamed, since "modes" is too generic to search for # as a global name, which in theory could referenced from other modules.] modes = ['SELECTMOLS', 'MODIFY', 'DEPOSIT', 'CRYSTAL', 'EXTRUDE', 'FUSECHUNKS', 'MOVIE'] ### REVIEW: is this constant still used anywhere? # If not, it should be removed. # [bruce 080815 question] def parentless_open_dialog_pref(): #bruce 060710 for Mac A8 # see if setting this True fixes the Mac-specific bugs in draggability of this dialog, and CPU usage while it's up from utilities.debug_prefs import debug_pref, Choice_boolean_False return debug_pref("parentless open file dialogs?", Choice_boolean_False, prefs_key = "A8.1 devel/parentless open file dialogs") parentless_open_dialog_pref() def get_filename_and_save_in_prefs(parent, prefs_key, caption=''): """ Present user with the Qt file chooser to select a file. prefs_key is the key to save the filename in the prefs db caption is the string for the dialog caption. """ # see also get_dirname_and_save_in_prefs, which has similar code if parentless_open_dialog_pref(): parent = None filename = str_or_unicode(QFileDialog.getOpenFileName( parent, caption, get_rootdir(), # '/' on Mac or Linux, something else on Windows )) if not filename: # Cancelled. return None # Save filename in prefs db. prefs = preferences.prefs_context() prefs[prefs_key] = os.path.normpath(filename) return filename def get_dirname_and_save_in_prefs(parent, prefs_key, caption=''): #bruce 060710 for Mac A8 """ Present user with the Qt file chooser to select an existing directory. If they do that, and if prefs_key is not null, save its full pathname in env.prefs[prefs_key]. @param prefs_key: the pref_key to save the pathname. @type prefs_key: text @param caption: the string for the dialog caption. @type caption: text """ # see also get_filename_and_save_in_prefs, which has similar code if parentless_open_dialog_pref(): parent = None filename = str_or_unicode(QFileDialog.getExistingDirectory( parent,### if this was None, it might fix the Mac bug where you can't drag the dialog around [bruce 060710] caption, get_rootdir(), # '/' on Mac or Linux -- maybe not the best choice if they've chosen one before? )) if not filename: # Cancelled. return None # Save filename in prefs db. prefs = preferences.prefs_context() prefs[prefs_key] = filename return filename # main window layout save/restore def _fullkey(keyprefix, *subkeys): #e this func belongs in preferences.py res = keyprefix for subkey in subkeys: res += "/" + subkey return res def _size_pos_keys( keyprefix): return _fullkey(keyprefix, "geometry", "size"), _fullkey(keyprefix, "geometry", "pos") def _tupleFromQPoint(qpoint): return qpoint.x(), qpoint.y() def _tupleFromQSize(qsize): return qsize.width(), qsize.height() def _get_window_pos_size(win): size = _tupleFromQSize( win.size()) pos = _tupleFromQPoint( win.pos()) return pos, size def save_window_pos_size( win, keyprefix): #bruce 050913 removed histmessage arg """ Save the size and position of the given main window, win, in the preferences database, using keys based on the given keyprefix, which caller ought to reserve for geometry aspects of the main window. (#e Someday, maybe save more aspects like dock layout and splitter bar positions??) """ ## from preferences import prefs_context ## prefs = prefs_context() ksize, kpos = _size_pos_keys( keyprefix) pos, size = _get_window_pos_size(win) changes = { ksize: size, kpos: pos } env.prefs.update( changes) # use update so it only opens/closes dbfile once env.history.message("saved window position %r and size %r" % (pos,size)) return def load_window_pos_size( win, keyprefix, defaults = None, screen = None): #bruce 050913 removed histmessage arg; 060517 revised """ Load the last-saved size and position of the given main window, win, from the preferences database, using keys based on the given keyprefix, which caller ought to reserve for geometry aspects of the main window. (If no prefs have been stored, return reasonable or given defaults.) Then set win's actual position and size (using supplied defaults, and limited by supplied screen size, both given as ((pos_x,pos_y),(size_x,size_y)). (#e Someday, maybe restore more aspects like dock layout and splitter bar positions??) """ if screen is None: screen = screen_pos_size() ((x0, y0), (w, h)) = screen x1 = x0 + w y1 = y0 + h pos, size = _get_prefs_for_window_pos_size( win, keyprefix, defaults) # now use pos and size, within limits set by screen px, py = pos sx, sy = size if sx > w: sx = w if sy > h: sy = h if px < x0: px = x0 if py < y0: py = y0 if px > x1 - sx: px = x1 - sx if py > y1 - sy: py = y1 - sy env.history.message("restoring last-saved window position %r and size %r" \ % ((px, py),(sx, sy))) win.resize(sx, sy) win.move(px, py) return def _get_prefs_for_window_pos_size( win, keyprefix, defaults = None): """ Load and return the last-saved size and position of the given main window, win, from the preferences database, using keys based on the given keyprefix, which caller ought to reserve for geometry aspects of the main window. (If no prefs have been stored, return reasonable or given defaults.) """ #bruce 060517 split this out of load_window_pos_size if defaults is None: defaults = _get_window_pos_size(win) dpos, dsize = defaults px, py = dpos # check correctness of args, even if not used later sx, sy = dsize import foundation.preferences as preferences prefs = preferences.prefs_context() ksize, kpos = _size_pos_keys( keyprefix) pos = prefs.get(kpos, dpos) size = prefs.get(ksize, dsize) return pos, size def validate_gamess_path(parent, gmspath): """ Checks that gmspath (GAMESS executable) exists. If not, the user is asked if they want to use the File Chooser to select the GAMESS executable. This function does not check whether the GAMESS path is actually GAMESS or if it is the correct version of GAMESS for this platform (i.e. PC GAMESS for Windows). @return: "gmspath" if it is validated or if the user does not want to change it for any reason, or "new_gmspath" if gmspath is invalid and the user selected a new GAMESS executable. Return value might be "". """ if not gmspath: # It is OK if gmspath is empty. return "" elif os.path.exists(gmspath): return gmspath else: ret = QMessageBox.warning( parent, "GAMESS Executable Path", gmspath + " does not exist.\nDo you want to use the File Chooser to browse for the GAMESS executable?", "&Yes", "&No", "", 0, 1 ) if ret == 0: # Yes new_gmspath = get_gamess_path(parent) if not new_gmspath: return gmspath # Cancelled from file chooser. Just return the original gmspath. else: return new_gmspath else: # No return gmspath def get_pref_or_optval(key, val, optval): """ Return <key>'s value. If <val> is equal to <key>'s value, return <optval> instead. """ if env.prefs[key] == val: return optval else: return env.prefs[key] class Preferences(QDialog, Ui_PreferencesDialog): """ The Preferences dialog used for accessing and changing user preferences. """ pagenameList = [] # List of page names in prefsStackedWidget. def __init__(self, assy): QDialog.__init__(self) self.setupUi(self) # Some important attrs. self.glpane = assy.o self.w = assy.w self.assy = assy self.pagenameList = self.getPagenameList() # Start of dialog setup. self._setupDialog_TopLevelWidgets() self._setupPage_General() self._setupPage_Color() self._setupPage_GraphicsArea() self._setupPage_ZoomPanRotate() self._setupPage_Rulers() self._setupPage_Atoms() self._setupPage_Bonds() self._setupPage_Dna() self._setupPage_DnaMinorGrooveErrorIndicator() self._setupPage_DnaBaseOrientationIndicators() self._setupPage_Adjust() self._setupPage_Lighting() self._setupPage_Plugins() self._setupPage_Undo() self._setupPage_Window() self._setupPage_Reports() self._setupPage_Tooltips() # Assign "What's This" text for all widgets. from ne1_ui.prefs.WhatsThisText_for_PreferencesDialog import whatsThis_PreferencesDialog whatsThis_PreferencesDialog(self) self._hideOrShowWidgets() return # End of _init_() def _setupDialog_TopLevelWidgets(self): """ Setup all the main dialog widgets and their signal-slot connection(s). """ self.setWindowIcon(geticon("ui/actions/Tools/Options.png")) # This connects the "itemSelectedChanged" signal generated when the # user selects an item in the "Category" QTreeWidget on the left # side of the Preferences dialog (inside the "Systems Option" tab) # to the slot for turning to the correct page in the QStackedWidget # on the right side. self.connect(self.categoryTreeWidget, SIGNAL("itemSelectionChanged()"), self.showPage) # Connections for OK and What's This buttons at the bottom of the dialog. self.connect(self.okButton, SIGNAL("clicked()"), self.accept) self.connect(self.whatsThisToolButton, SIGNAL("clicked()"),QWhatsThis.enterWhatsThisMode) self.whatsThisToolButton.setIcon( geticon("ui/actions/Properties Manager/WhatsThis.png")) self.whatsThisToolButton.setIconSize(QSize(22, 22)) self.whatsThisToolButton.setToolTip('Enter "What\'s This?" help mode') # Set the margin and spacing for these two gridlayouts: # gridlayout = grid layout for the Preference dialog # gridlayout1 = grid layout for the System Options tab self.gridlayout.setMargin(2) self.gridlayout.setSpacing(2) self.gridlayout1.setMargin(4) self.gridlayout1.setSpacing(0) return def _setupPage_General(self): """ Setup the "General" page. """ # Sponsor logos download permission options in General tab self.logosDownloadPermissionBtnGroup = QButtonGroup() self.logosDownloadPermissionBtnGroup.setExclusive(True) for button in self.sponsorLogosGroupBox.children(): if isinstance(button, QAbstractButton): self.logosDownloadPermissionBtnGroup.addButton(button) buttonId = 0 if button.text().startsWith("Never ask"): buttonId = 1 elif button.text().startsWith("Never download"): buttonId = 2 self.logosDownloadPermissionBtnGroup.setId(button, buttonId) # Check the correct permission radio button. if env.prefs[sponsor_permanent_permission_prefs_key]: if env.prefs[sponsor_download_permission_prefs_key]: self.logoNeverAskRadioBtn.setChecked(True) else: self.logoNeverDownLoadRadioBtn.setChecked(True) else: self.logoAlwaysAskRadioBtn.setChecked(True) self.connect(self.logosDownloadPermissionBtnGroup, SIGNAL("buttonClicked(int)"), self.setPrefsLogoDownloadPermissions) # Build Atoms option connections. connect_checkbox_with_boolean_pref( self.autobond_checkbox, buildModeAutobondEnabled_prefs_key ) connect_checkbox_with_boolean_pref( self.water_checkbox, buildModeWaterEnabled_prefs_key ) connect_checkbox_with_boolean_pref( self.buildmode_highlighting_checkbox, buildModeHighlightingEnabled_prefs_key ) connect_checkbox_with_boolean_pref( self.buildmode_select_atoms_checkbox, buildModeSelectAtomsOfDepositedObjEnabled_prefs_key ) #Scale factor for copy-paste operation (see ops_copy_Mixin._pasteGroup()) self.pasteOffsetScaleFactorForChunks_doubleSpinBox.setValue( env.prefs[pasteOffsetScaleFactorForChunks_prefs_key]) self.pasteOffsetScaleFactorForDnaObjects_doubleSpinBox.setValue( env.prefs[pasteOffsetScaleFactorForDnaObjects_prefs_key]) self.connect(self.pasteOffsetScaleFactorForChunks_doubleSpinBox, SIGNAL("valueChanged(double)"), self.change_pasteOffsetScaleFactorForChunks) self.connect(self.pasteOffsetScaleFactorForDnaObjects_doubleSpinBox, SIGNAL("valueChanged(double)"), self.change_pasteOffsetScaleFactorForDnaObjects) return def _setupPage_Color(self): """ Setup the "Color" page. """ # Background color widgets and connection(s). self._loadBackgroundColorItems() self.connect(self.backgroundColorComboBox, SIGNAL("activated(int)"), self.changeBackgroundColor) # Fog checkbox connect_checkbox_with_boolean_pref( self.enableFogCheckBox, fogEnabled_prefs_key ) self.connect(self.enableFogCheckBox, SIGNAL("toggled(bool)"), self.enable_fog) # Hover highlighting color style widgets and connection(s). self._loadHoverHighlightingColorStylesItems() self.hoverHighlightingStyleComboBox.setCurrentIndex(HHS_INDEXES.index(env.prefs[hoverHighlightingColorStyle_prefs_key])) self.connect(self.hoverHighlightingStyleComboBox, SIGNAL("activated(int)"), self._change_hhStyle) connect_colorpref_to_colorframe( hoverHighlightingColor_prefs_key, self.hoverHighlightingColorFrame) self.connect(self.hoverHighlightingColorButton, SIGNAL("clicked()"), self._change_hhColor) # Selection color style widgets and connection(s). self._loadSelectionColorStylesItems() self.selectionStyleComboBox.setCurrentIndex(SS_INDEXES.index(env.prefs[selectionColorStyle_prefs_key])) self.connect(self.selectionStyleComboBox, SIGNAL("activated(int)"), self._change_selectionStyle) connect_colorpref_to_colorframe( selectionColor_prefs_key, self.selectionColorFrame) self.connect(self.selectionColorButton, SIGNAL("clicked()"), self._change_selectionColor) # Halo width spinbox. self.connect(self.haloWidthSpinBox, SIGNAL("valueChanged(int)"), self.change_haloWidth) self.connect(self.haloWidthResetButton, SIGNAL("clicked()"), self.reset_haloWidth) self.haloWidthResetButton.setIcon(geticon('ui/dialogs/Reset.png')) self.haloWidthSpinBox.setValue(env.prefs[haloWidth_prefs_key]) self.change_haloWidth(env.prefs[haloWidth_prefs_key]) # Needed to update the reset button. return def _setupPage_GraphicsArea(self): """ Setup widgets to initial (default or defined) values on the 'Graphics Area' page. """ # Setup the Global Display Style at start-up combobox self._setupGlobalDisplayStyleAtStartup_ComboBox() self.connect(self.compassGroupBox, SIGNAL("stateChanged(int)"), self.display_compass) self.connect(self.compass_position_combox, SIGNAL("activated(int)"), self.set_compass_position) connect_checkbox_with_boolean_pref( self.compassGroupBox, displayCompass_prefs_key ) connect_checkbox_with_boolean_pref( self.display_compass_labels_checkbox, displayCompassLabels_prefs_key ) connect_checkbox_with_boolean_pref( self.display_origin_axis_checkbox, displayOriginAxis_prefs_key ) connect_checkbox_with_boolean_pref( self.display_pov_axis_checkbox, displayPOVAxis_prefs_key ) self.compass_position_combox.setCurrentIndex(self.glpane.compassPosition) connect_checkbox_with_boolean_pref( self.display_confirmation_corner_checkbox, displayConfirmationCorner_prefs_key ) connect_checkbox_with_boolean_pref( self.enable_antialiasing_checkbox, enableAntiAliasing_prefs_key ) # Cursor text font point size spinbox self.connect(self.cursorTextFontSizeSpinBox, SIGNAL("valueChanged(int)"), self.change_cursorTextFontSize) # Cursor text font size reset button. self.connect(self.cursorTextFontSizeResetButton, SIGNAL("clicked()"), self.reset_cursorTextFontSize) self.cursorTextFontSizeResetButton.setIcon(geticon('ui/dialogs/Reset.png')) self.cursorTextFontSizeSpinBox.setValue(env.prefs[ cursorTextFontSize_prefs_key ] ) self.change_cursorTextFontSize(env.prefs[cursorTextFontSize_prefs_key]) # Needed to update the reset button. # Cursor text color connect_colorpref_to_colorframe(cursorTextColor_prefs_key, self.cursorTextColorFrame) self.connect(self.cursorTextColorButton, SIGNAL("clicked()"), self.change_cursorTextColor) return def _setupPage_ZoomPanRotate(self): """ Setup widgets to initial (default or defined) values on the 'Zoom, Pan Rotate' page. """ # Animation speed checkbox and slider. connect_checkbox_with_boolean_pref( self.animate_views_checkbox, animateStandardViews_prefs_key ) self.resetAnimationSpeed_btn.setIcon( geticon('ui/dialogs/Reset.png')) self.connect(self.animation_speed_slider, SIGNAL("sliderReleased()"), self.change_view_animation_speed) self.connect(self.resetAnimationSpeed_btn, SIGNAL("clicked()"), self.reset_animationSpeed) speed = int (env.prefs[animateMaximumTime_prefs_key] * -100) self.animation_speed_slider.setValue(speed) self._updateResetButton(self.resetAnimationSpeed_btn, animateMaximumTime_prefs_key) #mouse speed during rotation slider - ninad060906 self.resetMouseSpeedDuringRotation_btn.setIcon( geticon('ui/dialogs/Reset.png')) self.connect(self.mouseSpeedDuringRotation_slider, SIGNAL("sliderReleased()"), self.change_mouseSpeedDuringRotation) self.connect(self.resetMouseSpeedDuringRotation_btn, SIGNAL("clicked()"), self.reset_mouseSpeedDuringRotation) mouseSpeedDuringRotation = int(env.prefs[mouseSpeedDuringRotation_prefs_key] * 100) self.mouseSpeedDuringRotation_slider.setValue(mouseSpeedDuringRotation) self._updateResetButton(self.resetMouseSpeedDuringRotation_btn, mouseSpeedDuringRotation_prefs_key) # Mouse wheel zoom settings combo boxes self.mouseWheelDirectionComboBox.setCurrentIndex( env.prefs[mouseWheelDirection_prefs_key]) self.mouseWheelZoomInPointComboBox.setCurrentIndex( env.prefs[zoomInAboutScreenCenter_prefs_key]) self.mouseWheelZoomOutPointComboBox.setCurrentIndex( env.prefs[zoomOutAboutScreenCenter_prefs_key]) self.hhTimeoutIntervalDoubleSpinBox.setValue(env.prefs[mouseWheelTimeoutInterval_prefs_key]) # Pan settings direction = env.prefs[panArrowKeysDirection_prefs_key] # 1 = View direcgion (default) # -1 = Camera direction if direction == 1: self.panArrowKeysDirectionComboBox.setCurrentIndex(0) else: self.panArrowKeysDirectionComboBox.setCurrentIndex(1) # Connections for "Mouse controls" page. self.connect(self.mouseWheelDirectionComboBox, SIGNAL("currentIndexChanged(int)"), self.set_mouse_wheel_direction) self.connect(self.mouseWheelZoomInPointComboBox, SIGNAL("currentIndexChanged(int)"), self.set_mouse_wheel_zoom_in_position) self.connect(self.mouseWheelZoomOutPointComboBox, SIGNAL("currentIndexChanged(int)"), self.set_mouse_wheel_zoom_out_position) self.connect(self.hhTimeoutIntervalDoubleSpinBox, SIGNAL("valueChanged(double)"), self.set_mouse_wheel_timeout_interval) self.connect(self.panArrowKeysDirectionComboBox, SIGNAL("currentIndexChanged(int)"), self.set_pan_arrow_keys_direction) return def _setupPage_Rulers(self): """ Setup the "Rulers" page. """ self.connect(self.rulerDisplayComboBox, SIGNAL("currentIndexChanged(int)"), self.set_ruler_display) self.connect(self.rulerPositionComboBox, SIGNAL("currentIndexChanged(int)"), self.set_ruler_position) self.connect(self.ruler_color_btn, SIGNAL("clicked()"), self.change_ruler_color) self.connect(self.rulerOpacitySpinBox, SIGNAL("valueChanged(int)"), self.change_ruler_opacity) if env.prefs[displayVertRuler_prefs_key] and env.prefs[displayHorzRuler_prefs_key]: self.rulerDisplayComboBox.setCurrentIndex(0) elif not env.prefs[displayHorzRuler_prefs_key]: self.rulerDisplayComboBox.setCurrentIndex(1) elif not env.prefs[displayVertRuler_prefs_key]: self.rulerDisplayComboBox.setCurrentIndex(2) self.rulerPositionComboBox.setCurrentIndex(env.prefs[rulerPosition_prefs_key]) connect_colorpref_to_colorframe( rulerColor_prefs_key, self.ruler_color_frame) self.rulerOpacitySpinBox.setValue(int(env.prefs[rulerOpacity_prefs_key] * 100)) connect_checkbox_with_boolean_pref( self.showRulersInPerspectiveViewCheckBox, showRulersInPerspectiveView_prefs_key ) return def _setupPage_Atoms(self): """ Setup the "Atoms" page. """ # "Change Element Colors" button. self.connect(self.change_element_colors_btn, SIGNAL("clicked()"), self.change_element_colors) # Atom colors connect_colorpref_to_colorframe( atomHighlightColor_prefs_key, self.atom_hilite_color_frame) connect_colorpref_to_colorframe( bondpointHighlightColor_prefs_key, self.bondpoint_hilite_color_frame) connect_colorpref_to_colorframe( bondpointHotspotColor_prefs_key, self.hotspot_color_frame) self.connect(self.atom_hilite_color_btn, SIGNAL("clicked()"), self.change_atom_hilite_color) self.connect(self.bondpoint_hilite_color_btn, SIGNAL("clicked()"), self.change_bondpoint_hilite_color) self.connect(self.hotspot_color_btn, SIGNAL("clicked()"), self.change_hotspot_color) self.connect(self.reset_atom_colors_btn, SIGNAL("clicked()"), self.reset_atom_colors) # Level of detail. self.connect(self.level_of_detail_combox, SIGNAL("activated(int)"), self.change_level_of_detail) lod = env.prefs[ levelOfDetail_prefs_key ] lod = int(lod) loditem = lod # index of corresponding spinbox item -- this is only correct for 0,1,2; other cases handled below if lod <= -1: # 'variable' (only -1 is used now, but other negative values might be used in future) # [bruce 060215 changed prefs value for 'variable' from 3 to -1, in case we have more LOD levels in the future] # [bruce 060317 fixed bug 1551 (in two files) by removing lod == 3 case from if/elif statement.] loditem = 3 # index of the spinbox item that says "variable" elif lod > 2: loditem = 2 self.level_of_detail_combox.setCurrentIndex(loditem) # Ball and Stick atom scale factor. self.connect(self.ballStickAtomScaleFactorSpinBox, SIGNAL("valueChanged(int)"), self.change_ballStickAtomScaleFactor) self.connect(self.reset_ballstick_scale_factor_btn, SIGNAL("clicked()"), self.reset_ballStickAtomScaleFactor) self.reset_ballstick_scale_factor_btn.setIcon( geticon('ui/dialogs/Reset.png')) _sf = int (env.prefs[diBALL_AtomRadius_prefs_key] * 100.0) self.ballStickAtomScaleFactorSpinBox.setValue(_sf) self.change_ballStickAtomScaleFactor(_sf) # Needed to update the reset button. # CPK atom scale factor. self.connect(self.cpkAtomScaleFactorDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_cpkAtomScaleFactor) self.connect(self.reset_cpk_scale_factor_btn, SIGNAL("clicked()"), self.reset_cpkAtomScaleFactor) self.reset_cpk_scale_factor_btn.setIcon( geticon('ui/dialogs/Reset.png')) self.cpkAtomScaleFactorDoubleSpinBox.setValue(env.prefs[cpkScaleFactor_prefs_key]) self.change_cpkAtomScaleFactor(env.prefs[cpkScaleFactor_prefs_key]) # Needed to update the reset button. # Checkboxes. connect_checkbox_with_boolean_pref( self.overlappingAtomIndicatorsCheckBox, indicateOverlappingAtoms_prefs_key ) connect_checkbox_with_boolean_pref( self.keepBondsTransmuteCheckBox, keepBondsDuringTransmute_prefs_key) return def _setupPage_Bonds(self): """ Setup the "Bonds" page. """ # Create "High order bond display" button group, which lives inside # of self.high_order_bond_display_groupbox (a QGroupBox). self.high_order_bond_display_btngrp = QButtonGroup() self.high_order_bond_display_btngrp.setExclusive(True) objId = 0 for obj in [self.multCyl_radioButton, self.vanes_radioButton, self.ribbons_radioButton]: self.high_order_bond_display_btngrp.addButton(obj) self.high_order_bond_display_btngrp.setId(obj, objId) objId +=1 self.connect(self.high_order_bond_display_btngrp, SIGNAL("buttonClicked(int)"), self.change_high_order_bond_display) self.connect(self.reset_bond_colors_btn, SIGNAL("clicked()"), self.reset_bond_colors) self.connect(self.show_bond_labels_checkbox, SIGNAL("toggled(bool)"), self.change_bond_labels) self.connect(self.show_valence_errors_checkbox, SIGNAL("toggled(bool)"), self.change_show_valence_errors) self.connect(self.ballstick_bondcolor_btn, SIGNAL("clicked()"), self.change_ballstick_bondcolor) self.connect(self.bond_hilite_color_btn, SIGNAL("clicked()"), self.change_bond_hilite_color) self.connect(self.bond_line_thickness_spinbox, SIGNAL("valueChanged(int)"), self.change_bond_line_thickness) self.connect(self.bond_stretch_color_btn, SIGNAL("clicked()"), self.change_bond_stretch_color) self.connect(self.bond_vane_color_btn, SIGNAL("clicked()"), self.change_bond_vane_color) self.connect(self.cpk_cylinder_rad_spinbox, SIGNAL("valueChanged(int)"), self.change_ballstick_cylinder_radius) #bruce 050805 here's the new way: subscribe to the preference value, # but make sure to only have one such subs (for one widget's bgcolor) at a time. # The colors in these frames will now automatically update whenever the prefs value changes. ##e (should modify this code to share its prefskey list with the one for restore_defaults) connect_colorpref_to_colorframe( bondHighlightColor_prefs_key, self.bond_hilite_color_frame) connect_colorpref_to_colorframe( bondStretchColor_prefs_key, self.bond_stretch_color_frame) connect_colorpref_to_colorframe( bondVaneColor_prefs_key, self.bond_vane_color_frame) connect_colorpref_to_colorframe( diBALL_bondcolor_prefs_key, self.ballstick_bondcolor_frame) connect_checkbox_with_boolean_pref( self.showBondStretchIndicators_checkBox, showBondStretchIndicators_prefs_key) # also handle the non-color prefs on this page: # ('pi_bond_style', ['multicyl','vane','ribbon'], pibondStyle_prefs_key, 'multicyl' ), pibondstyle_sym = env.prefs[ pibondStyle_prefs_key] button_code = { 'multicyl':0,'vane':1, 'ribbon':2 }.get( pibondstyle_sym, 0) # Errors in prefs db are not detected -- we just use the first button because (we happen to know) it's the default. # This int encoding is specific to this buttongroup. # The prefs db and the rest of the code uses the symbolic strings listed above. if button_code == 0: self.multCyl_radioButton.setChecked(True) elif button_code ==1: self.vanes_radioButton.setChecked(True) else: self.ribbons_radioButton.setChecked(True) # ('pi_bond_letters', 'boolean', pibondLetters_prefs_key, False ), self.show_bond_labels_checkbox.setChecked( env.prefs[ pibondLetters_prefs_key] ) # I don't know whether this sends the signal as if the user changed it # (and even if Qt doc says no, this needs testing since I've seen it be wrong about those things before), # but in the present code it doesn't matter unless it causes storing default value explicitly into prefs db # (I can't recall whether or not it does). Later this might matter more, e.g. if we have prefs-value modtimes. # [bruce 050806] # ('show_valence_errors', 'boolean', showValenceErrors_prefs_key, True ), # (This is a per-atom warning, but I decided to put it on the Bonds page since you need it when # working on high order bonds. And, since I could fit that into the UI more easily.) if hasattr(self, 'show_valence_errors_checkbox'): self.show_valence_errors_checkbox.setChecked( env.prefs[ showValenceErrors_prefs_key] ) # note: this does cause the checkbox to send its "toggled(bool)" signal to our slot method. # Set Lines Dislplay Mode line thickness. Mark 050831. self.update_bond_line_thickness_suffix() self.bond_line_thickness_spinbox.setValue( env.prefs[linesDisplayModeThickness_prefs_key] ) # Set CPK Cylinder radius (percentage). Mark 051003. self.cpk_cylinder_rad_spinbox.setValue(int (env.prefs[diBALL_BondCylinderRadius_prefs_key] * 100.0)) return def _setupPage_Dna(self): """ Setup the "DNA" page. """ # Connections for "DNA defaults" groupbox widgets. connect_doubleSpinBox_with_pref(self.dnaBasesPerTurnDoubleSpinBox, bdnaBasesPerTurn_prefs_key ) connect_doubleSpinBox_with_pref(self.dnaRiseDoubleSpinBox, bdnaRise_prefs_key) self.connect(self.dnaRestoreFactoryDefaultsPushButton, SIGNAL("clicked()"), self.dnaRestoreFactoryDefaults) connect_colorpref_to_colorframe(dnaDefaultStrand1Color_prefs_key, self.dnaDefaultStrand1ColorFrame) self.connect(self.dnaDefaultStrand1ColorPushButton, SIGNAL("clicked()"), self.changeDnaDefaultStrand1Color) connect_colorpref_to_colorframe(dnaDefaultStrand2Color_prefs_key, self.dnaDefaultStrand2ColorFrame) self.connect(self.dnaDefaultStrand2ColorPushButton, SIGNAL("clicked()"), self.changeDnaDefaultStrand2Color) connect_colorpref_to_colorframe(dnaDefaultSegmentColor_prefs_key, self.dnaDefaultSegmentColorFrame) self.connect(self.dnaDefaultSegmentColorPushButton, SIGNAL("clicked()"), self.changeDnaDefaultSegmentColor) self.dnaBasesPerTurnDoubleSpinBox.setValue(env.prefs[bdnaBasesPerTurn_prefs_key]) self.dnaRiseDoubleSpinBox.setValue(env.prefs[bdnaRise_prefs_key]) # Connections for "DNA Strand Arrowheads" groupbox widgets. self.connect(self.strandThreePrimeArrowheadsCustomColorPushButton, SIGNAL("clicked()"), self.change_dnaStrandThreePrimeArrowheadCustomColor) self.connect(self.strandFivePrimeArrowheadsCustomColorPushButton, SIGNAL("clicked()"), self.change_dnaStrandFivePrimeArrowheadCustomColor) self.connect(self.strandThreePrimeArrowheadsCustomColorCheckBox, SIGNAL("toggled(bool)"), self.update_dnaStrandThreePrimeArrowheadCustomColorWidgets) self.connect(self.strandFivePrimeArrowheadsCustomColorCheckBox, SIGNAL("toggled(bool)"), self.update_dnaStrandFivePrimeArrowheadCustomColorWidgets) # DNA strand arrowheads preferences connect_checkbox_with_boolean_pref(self.arrowsOnBackBones_checkBox, arrowsOnBackBones_prefs_key) connect_checkbox_with_boolean_pref(self.arrowsOnThreePrimeEnds_checkBox, arrowsOnThreePrimeEnds_prefs_key) connect_checkbox_with_boolean_pref( self.arrowsOnFivePrimeEnds_checkBox, arrowsOnFivePrimeEnds_prefs_key) connect_checkbox_with_boolean_pref( self.strandThreePrimeArrowheadsCustomColorCheckBox, useCustomColorForThreePrimeArrowheads_prefs_key) connect_checkbox_with_boolean_pref( self.strandFivePrimeArrowheadsCustomColorCheckBox, useCustomColorForFivePrimeArrowheads_prefs_key) #Join strands command may override global strand arrow head options connect_colorpref_to_colorframe( dnaStrandThreePrimeArrowheadsCustomColor_prefs_key, self.strandThreePrimeArrowheadsCustomColorFrame) connect_colorpref_to_colorframe( dnaStrandFivePrimeArrowheadsCustomColor_prefs_key, self.strandFivePrimeArrowheadsCustomColorFrame) self.update_dnaStrandThreePrimeArrowheadCustomColorWidgets( env.prefs[useCustomColorForThreePrimeArrowheads_prefs_key]) self.update_dnaStrandFivePrimeArrowheadCustomColorWidgets( env.prefs[useCustomColorForFivePrimeArrowheads_prefs_key]) def _setupPage_DnaMinorGrooveErrorIndicator(self): """ Setup the "DNA Minor Groove Error Indicator" page. """ # Connections for "DNA Minor Groove Error Indicator" groupbox widgets. self.connect(self.dnaMinGrooveAngleSpinBox, SIGNAL("valueChanged(int)"), self.save_dnaMinMinorGrooveAngles) self.connect(self.dnaMaxGrooveAngleSpinBox, SIGNAL("valueChanged(int)"), self.save_dnaMaxMinorGrooveAngles) self.connect(self.dnaGrooveIndicatorColorButton, SIGNAL("clicked()"), self.change_dnaMinorGrooveErrorIndicatorColor) self.connect(self.dnaMinorGrooveRestoreFactoryDefaultsPushButton, SIGNAL("clicked()"), self._restore_dnaMinorGrooveFactoryDefaults) # Display Minor Groove Error Indicator groupbox widgets. connect_checkbox_with_boolean_pref( self.dnaDisplayMinorGrooveErrorGroupBox, dnaDisplayMinorGrooveErrorIndicators_prefs_key) self.dnaMinGrooveAngleSpinBox.setValue( env.prefs[dnaMinMinorGrooveAngle_prefs_key]) self.dnaMaxGrooveAngleSpinBox.setValue( env.prefs[dnaMaxMinorGrooveAngle_prefs_key]) connect_colorpref_to_colorframe( dnaMinorGrooveErrorIndicatorColor_prefs_key, self.dnaGrooveIndicatorColorFrame) def _setupPage_DnaBaseOrientationIndicators(self): """ Setup the "DNA Base Orientation Indicators" page. """ # Connections for "DNA base orientation indicator" groupbox widgets. self.connect(self.dnaDisplayBaseOrientationIndicatorsGroupBox, SIGNAL("toggled(bool)"), self.toggle_dnaDisplayBaseOrientationIndicatorsGroupBox) self.connect(self.dnaBaseOrientationIndicatorsInverseCheckBox, SIGNAL("toggled(bool)"), self.toggle_dnaDisplayBaseOrientationInvIndicatorsCheckBox) self.connect(self.dnaBaseOrientationIndicatorsThresholdSpinBox, SIGNAL("valueChanged(double)"), self.change_dnaBaseIndicatorsAngle) self.connect(self.dnaBaseOrientationIndicatorsTerminalDistanceSpinBox, SIGNAL("valueChanged(double)"), self.change_dnaBaseIndicatorsDistance) self.connect(self.dnaChooseBaseOrientationIndicatorsColorButton, SIGNAL("clicked()"), self.change_dnaBaseIndicatorsColor) self.connect(self.dnaChooseBaseOrientationIndicatorsInvColorButton, SIGNAL("clicked()"), self.change_dnaBaseInvIndicatorsColor) self.connect(self.dnaBaseIndicatorsPlaneNormalComboBox, SIGNAL("activated(int)"), self.change_dnaBaseOrientIndicatorsPlane) # DNA Base Orientation Indicator stuff. self.dnaDisplayBaseOrientationIndicatorsGroupBox.setChecked( env.prefs[dnaBaseIndicatorsEnabled_prefs_key]) self.dnaBaseIndicatorsPlaneNormalComboBox.setCurrentIndex( env.prefs[dnaBaseIndicatorsPlaneNormal_prefs_key]) self.dnaBaseOrientationIndicatorsInverseCheckBox.setChecked( env.prefs[dnaBaseInvIndicatorsEnabled_prefs_key]) self.update_dnaBaseIndicatorsAngle() self.update_dnaBaseIndicatorsDistance() connect_colorpref_to_colorframe(dnaBaseIndicatorsColor_prefs_key, self.dnaBaseOrientationIndicatorsColorFrame) connect_colorpref_to_colorframe(dnaBaseInvIndicatorsColor_prefs_key, self.dnaBaseOrientationIndicatorsInvColorFrame) def _setupPage_Adjust(self): """ Setup the "Adjust" page. """ self.connect(self.adjustEngineCombobox, SIGNAL("activated(int)"), self.set_adjust_minimization_engine) self.connect(self.endRmsDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeEndRms) self.connect(self.endMaxDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeEndMax) self.connect(self.cutoverRmsDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeCutoverRms) self.connect(self.cutoverMaxDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeCutoverMax) self.endRmsDoubleSpinBox.setSpecialValueText("Automatic") self.endMaxDoubleSpinBox.setSpecialValueText("Automatic") self.cutoverRmsDoubleSpinBox.setSpecialValueText("Automatic") self.cutoverMaxDoubleSpinBox.setSpecialValueText("Automatic") # "Settings for Adjust" groupbox. ########################### # Adjust Engine combobox. self.adjustEngineCombobox.setCurrentIndex( env.prefs[Adjust_minimizationEngine_prefs_key]) # Watch motion in real time checkbox. connect_checkbox_with_boolean_pref( self.watch_motion_groupbox, Adjust_watchRealtimeMinimization_prefs_key ) self.watch_motion_groupbox.setEnabled( env.prefs[Adjust_watchRealtimeMinimization_prefs_key]) # "Watch motion..." radio btngroup self.watch_motion_buttongroup = QButtonGroup() self.watch_motion_buttongroup.setExclusive(True) for obj in self.watch_motion_groupbox.children(): if isinstance(obj, QAbstractButton): self.watch_motion_buttongroup.addButton(obj) #Preference for enabling/disabling electrostatics during Adjustment #for the DNA reduced model. Ninad 20070809 connect_checkbox_with_boolean_pref( self.electrostaticsForDnaDuringAdjust_checkBox, electrostaticsForDnaDuringAdjust_prefs_key) # Convergence Criteria groupbox # [WARNING: bruce 060705 copied this into MinimizeEnergyProp.py] self.endrms = get_pref_or_optval(Adjust_endRMS_prefs_key, -1.0, 0.0) self.endRmsDoubleSpinBox.setValue(self.endrms) self.endmax = get_pref_or_optval(Adjust_endMax_prefs_key, -1.0, 0.0) self.endMaxDoubleSpinBox.setValue(self.endmax) self.cutoverrms = get_pref_or_optval(Adjust_cutoverRMS_prefs_key, -1.0, 0.0) self.cutoverRmsDoubleSpinBox.setValue(self.cutoverrms) self.cutovermax = get_pref_or_optval(Adjust_cutoverMax_prefs_key, -1.0, 0.0) self.cutoverMaxDoubleSpinBox.setValue(self.cutovermax) return def _setupPage_Lighting(self): """ Setup the "Lighting" page. """ # Connections for "Lighting" page. self.connect(self.light_ambient_slider, SIGNAL("valueChanged(int)"), self.change_lighting) self.connect(self.light_ambient_slider, SIGNAL("sliderReleased()"), self.save_lighting) self.connect(self.light_checkbox, SIGNAL("toggled(bool)"), self.toggle_light) self.connect(self.light_color_btn, SIGNAL("clicked()"), self.change_light_color) self.connect(self.light_combobox, SIGNAL("activated(int)"), self.change_active_light) self.connect(self.light_diffuse_slider, SIGNAL("sliderReleased()"), self.save_lighting) self.connect(self.light_diffuse_slider, SIGNAL("valueChanged(int)"), self.change_lighting) self.connect(self.light_specularity_slider, SIGNAL("valueChanged(int)"), self.change_lighting) self.connect(self.light_specularity_slider, SIGNAL("sliderReleased()"), self.save_lighting) self.connect(self.light_x_linedit, SIGNAL("returnPressed()"), self.save_lighting) self.connect(self.light_y_linedit, SIGNAL("returnPressed()"), self.save_lighting) self.connect(self.light_z_linedit, SIGNAL("returnPressed()"), self.save_lighting) self.connect(self.lighting_restore_defaults_btn, SIGNAL("clicked()"), self.restore_default_lighting) self.connect(self.ms_brightness_slider, SIGNAL("sliderReleased()"), self.change_material_brightness_stop) self.connect(self.ms_brightness_slider, SIGNAL("valueChanged(int)"), self.change_material_brightness) self.connect(self.ms_brightness_slider, SIGNAL("sliderPressed()"), self.change_material_brightness_start) self.connect(self.ms_finish_slider, SIGNAL("valueChanged(int)"), self.change_material_finish) self.connect(self.ms_finish_slider, SIGNAL("sliderReleased()"), self.change_material_finish_stop) self.connect(self.ms_finish_slider, SIGNAL("sliderPressed()"), self.change_material_finish_start) self.connect(self.ms_on_checkbox, SIGNAL("toggled(bool)"), self.toggle_material_specularity) self.connect(self.ms_shininess_slider, SIGNAL("sliderReleased()"), self.change_material_shininess_stop) self.connect(self.ms_shininess_slider, SIGNAL("sliderPressed()"), self.change_material_shininess_start) self.connect(self.ms_shininess_slider, SIGNAL("valueChanged(int)"), self.change_material_shininess) self._updatePage_Lighting() return def _updatePage_Lighting(self, lights = None): #mark 051124 """ Setup widgets to initial (default or defined) values on the Lighting page. """ if not lights: self.lights = self.original_lights = self.glpane.getLighting() else: self.lights = lights light_num = self.light_combobox.currentIndex() self.update_light_combobox_items() # Move lc_prefs_keys upstairs. Mark. lc_prefs_keys = [light1Color_prefs_key, light2Color_prefs_key, light3Color_prefs_key] self.current_light_key = lc_prefs_keys[light_num] # Get prefs key for current light color. connect_colorpref_to_colorframe(self.current_light_key, self.light_color_frame) self.light_color = env.prefs[self.current_light_key] # These sliders generate signals whenever their 'setValue()' slot is called (below). # This creates problems (bugs) for us, so we disconnect them temporarily. self.disconnect(self.light_ambient_slider, SIGNAL("valueChanged(int)"), self.change_lighting) self.disconnect(self.light_diffuse_slider, SIGNAL("valueChanged(int)"), self.change_lighting) self.disconnect(self.light_specularity_slider, SIGNAL("valueChanged(int)"), self.change_lighting) # self.lights[light_num][0] contains 'color' attribute. # We already have it (self.light_color) from the prefs key (above). a = self.lights[light_num][1] # ambient intensity d = self.lights[light_num][2] # diffuse intensity s = self.lights[light_num][3] # specular intensity self.light_ambient_slider.setValue(int (a * 100)) # generates signal self.light_diffuse_slider.setValue(int (d * 100)) # generates signal self.light_specularity_slider.setValue(int (s * 100)) # generates signal self.light_ambient_linedit.setText(str(a)) self.light_diffuse_linedit.setText(str(d)) self.light_specularity_linedit.setText(str(s)) self.light_x_linedit.setText(str (self.lights[light_num][4])) self.light_y_linedit.setText(str (self.lights[light_num][5])) self.light_z_linedit.setText(str (self.lights[light_num][6])) self.light_checkbox.setChecked(self.lights[light_num][7]) # Reconnect the slots to the light sliders. self.connect(self.light_ambient_slider, SIGNAL("valueChanged(int)"), self.change_lighting) self.connect(self.light_diffuse_slider, SIGNAL("valueChanged(int)"), self.change_lighting) self.connect(self.light_specularity_slider, SIGNAL("valueChanged(int)"), self.change_lighting) self._setup_material_group() return # _setup_material_group() should be folded back into _updatePage_Lighting(). Mark 051204. def _setup_material_group(self, reset = False): """ Setup Material Specularity widgets to initial (default or defined) values on the Lighting page. If reset = False, widgets are reset from the prefs db. If reset = True, widgets are reset from their previous values. """ if reset: self.material_specularity = self.original_material_specularity self.whiteness = self.original_whiteness self.shininess = self.original_shininess self.brightness = self.original_brightness else: self.material_specularity = self.original_material_specularity = \ env.prefs[material_specular_highlights_prefs_key] self.whiteness = self.original_whiteness = \ int(env.prefs[material_specular_finish_prefs_key] * 100) self.shininess = self.original_shininess = \ int(env.prefs[material_specular_shininess_prefs_key]) self.brightness = self.original_brightness= \ int(env.prefs[material_specular_brightness_prefs_key] * 100) # Enable/disable specular highlights. self.ms_on_checkbox.setChecked(self.material_specularity ) # For whiteness, the stored range is 0.0 (Plastic) to 1.0 (Metal). The Qt slider range # is 0 - 100, so we multiply by 100 (above) to set the slider. Mark. 051129. self.ms_finish_slider.setValue(self.whiteness) # generates signal self.ms_finish_linedit.setText(str(self.whiteness * .01)) # For shininess, the range is 15 (low) to 60 (high). Mark. 051129. self.ms_shininess_slider.setValue(self.shininess) # generates signal self.ms_shininess_linedit.setText(str(self.shininess)) # For brightness, the range is 0.0 (low) to 1.0 (high). Mark. 051203. self.ms_brightness_slider.setValue(self.brightness) # generates signal self.ms_brightness_linedit.setText(str(self.brightness * .01)) return def _setupPage_Plugins(self): """ Setup the "Plug-ins" page. """ # QuteMolX signal-slot connections. self.connect(self.qutemol_checkbox, SIGNAL("toggled(bool)"), self.enable_qutemol) self.connect( self.qutemol_path_lineedit, SIGNAL("textEdited (const QString&) "), self.set_qutemol_path) self.connect(self.qutemol_choose_btn, SIGNAL("clicked()"), self.choose_qutemol_path) # NanoHive-1 signal-slot connections. self.connect(self.nanohive_checkbox, SIGNAL("toggled(bool)"), self.enable_nanohive) self.connect( self.nanohive_path_lineedit, SIGNAL("textEdited (const QString&) "), self.set_nanohive_path) self.connect(self.nanohive_choose_btn, SIGNAL("clicked()"), self.choose_nanohive_path) # POV-Ray signal-slot connections. self.connect(self.povray_checkbox, SIGNAL("toggled(bool)"), self.enable_povray) self.connect( self.povray_path_lineedit, SIGNAL("textEdited (const QString&) "), self.set_povray_path) self.connect(self.povray_choose_btn, SIGNAL("clicked()"), self.choose_povray_path) # POV dir signal-slot connections. self.connect(self.povdir_checkbox, SIGNAL("toggled(bool)"), self.enable_povdir) self.connect( self.povdir_lineedit, SIGNAL("textEdited (const QString&) "), self.povdir_lineedit_textChanged ) self.connect(self.povdir_choose_btn, SIGNAL("clicked()"), self.set_povdir) self.connect( self.povdir_lineedit, SIGNAL("returnPressed()"), self.povdir_lineedit_returnPressed ) # MegaPOV signal-slot connections. self.connect(self.megapov_checkbox, SIGNAL("toggled(bool)"), self.enable_megapov) self.connect( self.megapov_path_lineedit, SIGNAL("textEdited (const QString&) "), self.set_megapov_path ) self.connect(self.megapov_choose_btn, SIGNAL("clicked()"), self.choose_megapov_path) # GAMESS signal-slot connections. self.connect(self.gamess_checkbox, SIGNAL("toggled(bool)"), self.enable_gamess) self.connect(self.gamess_path_lineedit, SIGNAL("textEdited(const QString&)"), self.set_gamess_path) self.connect(self.gamess_choose_btn, SIGNAL("clicked()"), self.choose_gamess_path) # GROMACS signal-slot connections. self.connect(self.gromacs_checkbox, SIGNAL("toggled(bool)"), self.enable_gromacs) self.connect(self.gromacs_path_lineedit, SIGNAL("textEdited(const QString&)"), self.set_gromacs_path) self.connect(self.gromacs_choose_btn, SIGNAL("clicked()"), self.choose_gromacs_path) # cpp signal-slot connections. self.connect(self.cpp_checkbox, SIGNAL("toggled(bool)"), self.enable_cpp) self.connect(self.cpp_path_lineedit, SIGNAL("textEdited(const QString&)"), self.set_cpp_path) self.connect(self.cpp_choose_btn, SIGNAL("clicked()"), self.choose_cpp_path) # Rosetta signal-slots connections. self.connect(self.rosetta_checkbox, SIGNAL("toggled(bool)"), self.enable_rosetta) self.connect(self.rosetta_path_lineedit, SIGNAL("textEdited(const QString&)"), self.set_rosetta_path) self.connect(self.rosetta_choose_btn, SIGNAL("clicked()"), self.choose_rosetta_path) # Rosetta database signal-slots connections. self.connect(self.rosetta_db_checkbox, SIGNAL("toggled(bool)"), self.enable_rosetta_db) self.connect(self.rosetta_db_path_lineedit, SIGNAL("textEdited(const QString&)"), self.set_rosetta_db_path) self.connect(self.rosetta_db_choose_btn, SIGNAL("clicked()"), self.choose_rosetta_db_path) # NanoVision-1 signal-slots connections. self.connect(self.nv1_checkbox, SIGNAL("toggled(bool)"), self.enable_nv1) self.connect(self.nv1_path_lineedit, SIGNAL("textEdited(const QString&)"), self.set_nv1_path) self.connect(self.nv1_choose_btn, SIGNAL("clicked()"), self.choose_nv1_path) return def _setupPage_Undo(self): """ Setup the "Undo" page. """ # Connections for "Undo" page. self.connect(self.undo_stack_memory_limit_spinbox, SIGNAL("valueChanged(int)"), self.change_undo_stack_memory_limit) self.connect(self.update_number_spinbox, SIGNAL("valueChanged(int)"), self.update_number_spinbox_valueChanged) return def _setupPage_Window(self): """ Setup the "Window" page. """ # Connections for "Window" page. self.connect(self.caption_fullpath_checkbox, SIGNAL("stateChanged(int)"), self.set_caption_fullpath) self.connect(self.current_height_spinbox, SIGNAL("valueChanged(int)"), self.change_window_size) self.connect(self.current_width_spinbox, SIGNAL("valueChanged(int)"), self.change_window_size) self.connect(self.restore_saved_size_btn, SIGNAL("clicked()"), self.restore_saved_size) self.connect(self.save_current_btn, SIGNAL("clicked()"), self.save_current_win_pos_and_size) # Connections for font widgets (in "Windows" page). Mark 2007-05-27. self.connect(self.selectedFontGroupBox, SIGNAL("toggled(bool)"), self.change_use_selected_font) self.connect(self.fontComboBox, SIGNAL("currentFontChanged (const QFont &)"), self.change_font) self.connect(self.fontSizeSpinBox, SIGNAL("valueChanged(int)"), self.change_fontsize) self.connect(self.makeDefaultFontPushButton, SIGNAL("clicked()"), self.change_selected_font_to_default_font) # Update the max value of the Current Size spinboxes screen = screen_pos_size() ((x0, y0), (w, h)) = screen self.current_width_spinbox.setRange(1, w) self.current_height_spinbox.setRange(1, h) # Set value of the Current Size Spinboxes pos, size = _get_window_pos_size(self.w) self.current_width_spinbox.setValue(size[0]) self.current_height_spinbox.setValue(size[1]) # Set string of Saved Size Lineedits from utilities.prefs_constants import mainwindow_geometry_prefs_key_prefix keyprefix = mainwindow_geometry_prefs_key_prefix pos, size = _get_prefs_for_window_pos_size( self.w, keyprefix) self.update_saved_size(size[0], size[1]) connect_checkbox_with_boolean_pref( self.remember_win_pos_and_size_checkbox, rememberWinPosSize_prefs_key ) self.caption_prefix_linedit.setText(env.prefs[captionPrefix_prefs_key]) self.caption_suffix_linedit.setText(env.prefs[captionSuffix_prefs_key]) ##e someday we should make a 2-way connector function for LineEdits too connect_checkbox_with_boolean_pref( self.caption_fullpath_checkbox, captionFullPath_prefs_key ) # Update Display Font widgets self.set_font_widgets(setFontFromPrefs = True) # Also sets the current display font. # Connect all QLineEdit widgets last. Otherwise they'll generate signals. self.connect( self.caption_prefix_linedit, SIGNAL("textChanged ( const QString & ) "), self.caption_prefix_linedit_textChanged ) self.connect( self.caption_prefix_linedit, SIGNAL("returnPressed()"), self.caption_prefix_linedit_returnPressed ) self.connect( self.caption_suffix_linedit, SIGNAL("textChanged ( const QString & ) "), self.caption_suffix_linedit_textChanged ) self.connect( self.caption_suffix_linedit, SIGNAL("returnPressed()"), self.caption_suffix_linedit_returnPressed ) return def _setupPage_Reports(self): """ Setup the "Reports" page. """ connect_checkbox_with_boolean_pref( self.msg_serial_number_checkbox, historyMsgSerialNumber_prefs_key ) connect_checkbox_with_boolean_pref( self.msg_timestamp_checkbox, historyMsgTimestamp_prefs_key ) return def _setupPage_Tooltips(self): """ Setup the "Tooltips" page. """ # Connections for "Tooltips" page. self.connect(self.dynamicToolTipAtomDistancePrecision_spinbox, SIGNAL("valueChanged(int)"), self.change_dynamicToolTipAtomDistancePrecision) self.connect(self.dynamicToolTipBendAnglePrecision_spinbox, SIGNAL("valueChanged(int)"), self.change_dynamicToolTipBendAnglePrecision) #Atom related Dynamic tooltip preferences connect_checkbox_with_boolean_pref(self.dynamicToolTipAtomChunkInfo_checkbox, dynamicToolTipAtomChunkInfo_prefs_key) connect_checkbox_with_boolean_pref(self.dynamicToolTipAtomMass_checkbox, dynamicToolTipAtomMass_prefs_key) connect_checkbox_with_boolean_pref(self.dynamicToolTipAtomPosition_checkbox, dynamicToolTipAtomPosition_prefs_key) connect_checkbox_with_boolean_pref(self.dynamicToolTipAtomDistanceDeltas_checkbox, dynamicToolTipAtomDistanceDeltas_prefs_key) connect_checkbox_with_boolean_pref( self.includeVdwRadiiInAtomDistanceInfo, dynamicToolTipVdwRadiiInAtomDistance_prefs_key) #Bond related dynamic tool tip preferences connect_checkbox_with_boolean_pref(self.dynamicToolTipBondLength_checkbox, dynamicToolTipBondLength_prefs_key) connect_checkbox_with_boolean_pref(self.dynamicToolTipBondChunkInfo_checkbox, dynamicToolTipBondChunkInfo_prefs_key) self.dynamicToolTipAtomDistancePrecision_spinbox.setValue(env.prefs[ dynamicToolTipAtomDistancePrecision_prefs_key ] ) self.dynamicToolTipBendAnglePrecision_spinbox.setValue(env.prefs[ dynamicToolTipBendAnglePrecision_prefs_key ] ) return def _hideOrShowWidgets(self): """ Permanently hides some widgets in the Preferences dialog. This provides an easy and convenient way of hiding widgets that have been added but not fully implemented. It is also possible to show hidden widgets that have a debug pref set to enable them. """ gms_and_esp_widgetList = [self.nanohive_lbl, self.nanohive_checkbox, self.nanohive_path_lineedit, self.nanohive_choose_btn, self.gamess_checkbox, self.gamess_lbl, self.gamess_path_lineedit, self.gamess_choose_btn] for widget in gms_and_esp_widgetList: if debug_pref("Show GAMESS and ESP Image UI options", Choice_boolean_False, prefs_key = True): widget.show() else: widget.hide() # NanoVision-1 nv1_widgetList = [self.nv1_checkbox, self.nv1_label, self.nv1_path_lineedit, self.nv1_choose_btn] for widget in nv1_widgetList: widget.hide() # Rosetta rosetta_widgetList = [self.rosetta_checkbox, self.rosetta_label, self.rosetta_path_lineedit, self.rosetta_choose_btn, self.rosetta_db_checkbox, self.rosetta_db_label, self.rosetta_db_path_lineedit, self.rosetta_db_choose_btn] from utilities.GlobalPreferences import ENABLE_PROTEINS for widget in rosetta_widgetList: if ENABLE_PROTEINS: widget.show() else: widget.hide() return # caption_prefix slot methods [#e should probably refile these with other slot methods?] def caption_prefix_linedit_textChanged(self, qstring): ## print "caption_prefix_linedit_textChanged: %r" % str(qstring) # this works self.any_caption_text_changed() def caption_prefix_linedit_returnPressed(self): ## print "caption_prefix_linedit_returnPressed" # This works, but the Return press also closes the dialog! # [later, bruce 060710 -- probably due to a Qt Designer property on the button, fixable by .setAutoDefault(0) ###@@@] # (Both for the lineedit whose signal we're catching, and the one whose signal catching is initially nim.) # Certainly that makes it a good idea to catch it, though it'd be better to somehow "capture" it # so it would not close the dialog. self.any_caption_text_changed() # caption_suffix slot methods can be equivalent to the ones for caption_prefix caption_suffix_linedit_textChanged = caption_prefix_linedit_textChanged caption_suffix_linedit_returnPressed = caption_prefix_linedit_returnPressed ###### Private methods ############################### def _loadBackgroundColorItems(self): """ Load the background color combobox with all the color options and sets the current background color """ backgroundIndexes = [BG_BLUE_SKY, BG_EVENING_SKY, BG_SEAGREEN, BG_BLACK, BG_WHITE, BG_GRAY, BG_CUSTOM] backgroundNames = ["Blue Sky (default)", "Evening Sky", "Sea Green", "Black", "White", "Gray", "Custom..."] backgroundIcons = ["Background_BlueSky", "Background_EveningSky", "Background_SeaGreen", "Background_Black", "Background_White", "Background_Gray", "Background_Custom"] backgroundIconsDict = dict(zip(backgroundNames, backgroundIcons)) backgroundNamesDict = dict(zip(backgroundIndexes, backgroundNames)) for backgroundName in backgroundNames: basename = backgroundIconsDict[backgroundName] + ".png" iconPath = os.path.join("ui/dialogs/Preferences/", basename) self.backgroundColorComboBox.addItem(geticon(iconPath), backgroundName) self._updateBackgroundColorComboBoxIndex() return def _updateBackgroundColorComboBoxIndex(self): """ Set current index in the background color combobox. """ if self.glpane.backgroundGradient: self.backgroundColorComboBox.setCurrentIndex(self.glpane.backgroundGradient - 1) else: if (env.prefs[ backgroundColor_prefs_key ] == black): self.backgroundColorComboBox.setCurrentIndex(BG_BLACK) elif (env.prefs[ backgroundColor_prefs_key ] == white): self.backgroundColorComboBox.setCurrentIndex(BG_WHITE) elif (env.prefs[ backgroundColor_prefs_key ] == gray): self.backgroundColorComboBox.setCurrentIndex(BG_GRAY) else: self.backgroundColorComboBox.setCurrentIndex(BG_CUSTOM) return def _loadHoverHighlightingColorStylesItems(self): """ Load the hover highlighting style combobox with items. """ for hoverHighlightingStyle in HHS_OPTIONS: self.hoverHighlightingStyleComboBox.addItem(hoverHighlightingStyle) return def _loadSelectionColorStylesItems(self): """ Load the selection color style combobox with items. """ for selectionStyle in SS_OPTIONS: self.selectionStyleComboBox.addItem(selectionStyle) return # = Methods for the "Graphics Area" page. def _setupGlobalDisplayStyleAtStartup_ComboBox(self): """ Loads the global display style combobox with all the display options and sets the current display style """ gdsIconDist = dict(zip(GDS_NAMES, GDS_ICONS)) for gdsName in GDS_NAMES: # gds = global display style basename = gdsIconDist[gdsName] + ".png" iconPath = os.path.join("ui/actions/View/Display/", basename) self.globalDisplayStyleStartupComboBox.addItem(geticon(iconPath), gdsName) display_style = env.prefs[ startupGlobalDisplayStyle_prefs_key ] self.globalDisplayStyleStartupComboBox.setCurrentIndex(GDS_INDEXES.index(display_style)) self.connect(self.globalDisplayStyleStartupComboBox, SIGNAL("activated(int)"), self.setGlobalDisplayStyleAtStartUp) def setGlobalDisplayStyleAtStartUp(self, gdsIndexUnused): """ Slot method for the "Global Display Style at Start-up" combo box in the Preferences dialog (and not the combobox in the status bar of the main window). @param gdsIndexUnused: The current index of the combobox. It is unused. @type gdsIndexUnused: int @note: This changes the global display style of the glpane. """ # Get the GDS index from the current combox box index. display_style = GDS_INDEXES[self.globalDisplayStyleStartupComboBox.currentIndex()] if display_style == env.prefs[startupGlobalDisplayStyle_prefs_key]: return # set the pref env.prefs[startupGlobalDisplayStyle_prefs_key] = display_style # Set the current display style in the glpane. # (This will be noticed later by chunk.draw of affected chunks.) self.glpane.setGlobalDisplayStyle(display_style) self.glpane.gl_update() return #e this is really a slot method -- should refile it def any_caption_text_changed(self): # Update Caption prefs # The prefix and suffix updates should be done via slots [bruce 050811 doing that now] and include a validator. # Will do later. Mark 050716. # (in theory, only one of these has changed, and even though we resave prefs for both, # only the changed one will trigger any formulas watching the prefs value for changes. [bruce 050811]) #bruce 070503 Qt4 bugfix (prefix and suffix): str().strip() rather than QString().stripWhiteSpace() # (but, like the old code, still only allows one space char on the side that can have one, # in order to most easily require at least one on that side; if mot for that, we'd use rstrip and lstrip) prefix = str_or_unicode(self.caption_prefix_linedit.text()) prefix = prefix.strip() if prefix: prefix = prefix + ' ' env.prefs[captionPrefix_prefs_key] = prefix suffix = str_or_unicode(self.caption_suffix_linedit.text()) suffix = suffix.strip() if suffix: suffix = ' ' + suffix env.prefs[captionSuffix_prefs_key] = suffix return ###### End of private methods. ######################## ########## Slot methods for "General" page widgets ################ def display_compass(self, val): """ Slot for the Display Compass checkbox, which enables/disables the Display Compass Labels checkbox. """ self.display_compass_labels_checkbox.setEnabled(val) def set_compass_position(self, val): """ Set position of compass. @param val: The position, where: - 0 = upper right - 1 = upper left - 2 = lower left - 3 = lower right @type val: int """ # set the pref env.prefs[compassPosition_prefs_key] = val # update the glpane self.glpane.compassPosition = val self.glpane.gl_update() return # "Cursor text" slots (on Graphics Area page) def change_cursorTextColor(self): """ Change the cursor text color. """ self.usual_change_color( cursorTextColor_prefs_key) return def change_cursorTextFontSize(self, ptSize): """ Change the cursor text font size. """ env.prefs[ cursorTextFontSize_prefs_key ] = ptSize self._updateResetButton(self.cursorTextFontSizeResetButton, cursorTextFontSize_prefs_key) return def reset_cursorTextFontSize(self): """ Slot called when pressing the Font size reset button. Restores the default value. """ env.prefs.restore_defaults([cursorTextFontSize_prefs_key]) self.cursorTextFontSizeSpinBox.setValue(env.prefs[cursorTextFontSize_prefs_key]) # End "Cursor text" slots. def change_pasteOffsetScaleFactorForChunks(self, val): """ Slot method for the I{Paste offset scale for chunks} doublespinbox. @param val: The timeout interval in seconds. @type val: double @see ops_copy_Mixin._pasteGroup() """ env.prefs[pasteOffsetScaleFactorForChunks_prefs_key] = val def change_pasteOffsetScaleFactorForDnaObjects(self, val): """ Slot method for the I{Paste offset scale for dna objects} doublespinbox. @param val: The timeout interval in seconds. @type val: double """ env.prefs[pasteOffsetScaleFactorForDnaObjects_prefs_key] = val def enable_fog(self, val): """ Switches fog. """ self.glpane.gl_update() def set_default_projection_OBSOLETE(self, projection): """ Set the projection. @param projection: The projection, where: - 0 = Perspective - 1 = Orthographic @type projection: int @deprecated: I'm removing this from the Preferences dialog. The defaultProjection_prefs_key will be set instead by the main window UI (View > Display menu). -Mark 2008-05-20 """ # set the pref env.prefs[defaultProjection_prefs_key] = projection self.glpane.setViewProjection(projection) def change_displayOriginAsSmallAxis(self, value): """" This sets the preference to view origin as small axis so that it is sticky across sessions. """ #set the preference env.prefs[displayOriginAsSmallAxis_prefs_key] = value #niand060920 This condition might not be necessary as we are disabling the btn_grp #for the oridin axis radiobuttons if env.prefs[displayOriginAxis_prefs_key]: self.glpane.gl_update() def change_high_quality_graphics(self, state): #mark 060315. """ Enable/disable high quality graphics during view animations. @attention: This has never been implemented. The checkbox has been removed from the UI file for A9. Mark 060815. """ # Let the user know this is NIY. Addresses bug 1249 for A7. mark 060314. msg = "High Quality Graphics is not implemented yet." from utilities.Log import orangemsg env.history.message(orangemsg(msg)) def change_view_animation_speed(self): """ Sets the view animation speed between .25 (fast) and 3.0 (slow) seconds. """ # To change the range, edit the maxValue and minValue attr for the slider. # For example, if you want the fastest animation time to be .1 seconds, # change maxValue to -10. If you want the slowest time to be 4.0 seconds, # change minValue to -400. mark 060124. env.prefs[animateMaximumTime_prefs_key] = \ self.animation_speed_slider.value() / -100.0 self._updateResetButton(self.resetAnimationSpeed_btn, animateMaximumTime_prefs_key) return def _updateResetButton(self, resetButton, key): """ Enables/disables I{resetButton} if I{key} is not equal/equal to its default value. """ if env.prefs.has_default_value(key): resetButton.setEnabled(0) else: resetButton.setEnabled(1) return def reset_animationSpeed(self): """ Slot called when pressing the Animation speed reset button. Restores the default value of the animation speed. """ env.prefs.restore_defaults([animateMaximumTime_prefs_key]) self.animation_speed_slider.setValue(int (env.prefs[animateMaximumTime_prefs_key] * -100)) self.resetAnimationSpeed_btn.setEnabled(0) return def change_mouseSpeedDuringRotation(self): """ Slot that sets the speed factor controlling rotation speed during mouse button drags. 0.3 = slow and 1.0 = fast. """ env.prefs[mouseSpeedDuringRotation_prefs_key] = \ self.mouseSpeedDuringRotation_slider.value() / 100.0 self._updateResetButton(self.resetMouseSpeedDuringRotation_btn, mouseSpeedDuringRotation_prefs_key) return def reset_mouseSpeedDuringRotation(self): """ Slot called when pressing the Mouse speed during rotation reset button. Restores the default value of the mouse speed. """ env.prefs.restore_defaults([mouseSpeedDuringRotation_prefs_key]) self.mouseSpeedDuringRotation_slider.setValue(int (env.prefs[mouseSpeedDuringRotation_prefs_key] * 100.0)) self.resetMouseSpeedDuringRotation_btn.setEnabled(0) def changeEndRms(self, endRms): """ Slot for EndRMS. """ if endRms: env.prefs[Adjust_endRMS_prefs_key] = endRms else: env.prefs[Adjust_endRMS_prefs_key] = -1.0 def changeEndMax(self, endMax): """ Slot for EndMax. """ if endMax: env.prefs[Adjust_endMax_prefs_key] = endMax else: env.prefs[Adjust_endMax_prefs_key] = -1.0 def changeCutoverRms(self, cutoverRms): """ Slot for CutoverRMS. """ if cutoverRms: env.prefs[Adjust_cutoverRMS_prefs_key] = cutoverRms else: env.prefs[Adjust_cutoverRMS_prefs_key] = -1.0 def changeCutoverMax(self, cutoverMax): """ Slot for CutoverMax. """ if cutoverMax: env.prefs[Adjust_cutoverMax_prefs_key] = cutoverMax else: env.prefs[Adjust_cutoverMax_prefs_key] = -1.0 def set_adjust_minimization_engine(self, engine): """ Combobox action, sets Adjust_minimizationEngine preference """ env.prefs[Adjust_minimizationEngine_prefs_key] = engine def setPrefsLogoDownloadPermissions(self, permission): """ Set the sponsor logos download permissions in the persistent user preferences database. @param permission: The permission, where: 0 = Always ask before downloading 1 = Never ask before downloading 2 = Never download @type permission: int """ if permission == 1: env.prefs[sponsor_permanent_permission_prefs_key] = True env.prefs[sponsor_download_permission_prefs_key] = True elif permission == 2: env.prefs[sponsor_permanent_permission_prefs_key] = True env.prefs[sponsor_download_permission_prefs_key] = False else: env.prefs[sponsor_permanent_permission_prefs_key] = False # = BG color slot methods def changeBackgroundColor(self, idx): """ Slot method for the background color combobox. @note: the pref_keys are set in setBackgroundGradient() and setBackgroundColor(). """ #print "changeBackgroundColor(): Slot method called. Idx =", idx if idx == BG_BLUE_SKY: self.glpane.setBackgroundGradient(idx + 1) elif idx == BG_EVENING_SKY: self.glpane.setBackgroundGradient(idx + 1) elif idx == BG_SEAGREEN: self.glpane.setBackgroundGradient(idx + 1) elif idx == BG_BLACK: self.glpane.setBackgroundColor(black) elif idx == BG_WHITE: self.glpane.setBackgroundColor(white) elif idx == BG_GRAY: self.glpane.setBackgroundColor(gray) elif idx == BG_CUSTOM: #change background color to Custom Color self.chooseCustomBackgroundColor() else: msg = "Unknown color idx=", idx print_compact_traceback(msg) self.glpane.gl_update() # Needed! return def chooseCustomBackgroundColor(self): """ Choose a custom background color. """ c = QColorDialog.getColor(RGBf_to_QColor(self.glpane.getBackgroundColor()), self) if c.isValid(): self.glpane.setBackgroundColor(QColor_to_RGBf(c)) else: # User cancelled. Reset the combobox to the previous item. self._updateBackgroundColorComboBoxIndex() def _change_hhStyle(self, idx): """ Slot method for Hover Highlighting combobox. Change the (3D) hover highlighting style. """ env.prefs[hoverHighlightingColorStyle_prefs_key] = HHS_INDEXES[idx] def _change_hhColor(self): """ Change the 3D hover highlighting color. """ self.usual_change_color(hoverHighlightingColor_prefs_key) def _change_selectionStyle(self, idx): """ Slot method for Selection Style combobox used to Change the (3D) selection color style. """ env.prefs[selectionColorStyle_prefs_key] = SS_INDEXES[idx] def _change_selectionColor(self): """ Change the 3D selection color. """ self.usual_change_color(selectionColor_prefs_key) def change_haloWidth(self, width): """ Change the halo style width. @param width: The width in pixels. @type width: int """ env.prefs[haloWidth_prefs_key] = width self._updateResetButton(self.haloWidthResetButton, haloWidth_prefs_key) return def reset_haloWidth(self): """ Slot called when pressing the Halo width reset button. Restores the default value of the halo width. """ env.prefs.restore_defaults([haloWidth_prefs_key]) self.haloWidthSpinBox.setValue(env.prefs[haloWidth_prefs_key]) def set_mouse_wheel_direction(self, direction): """ Slot for Mouse Wheel Direction combo box. @param direction: The mouse wheel direction for zooming in. 0 = Pull (default), 1 = Push @type direction: int """ env.prefs[mouseWheelDirection_prefs_key] = direction self.w.updateMouseWheelSettings() return def set_mouse_wheel_zoom_in_position(self, position): """ Slot for Mouse Wheel "Zoom In Position" combo box. @param position: The mouse wheel zoom in position, where: 0 = Cursor position (default) 1 = Graphics area center @type position: int """ env.prefs[zoomInAboutScreenCenter_prefs_key] = position self.w.updateMouseWheelSettings() return def set_mouse_wheel_zoom_out_position(self, position): """ Slot for Mouse Wheel "Zoom Out Position" combo box. @param position: The mouse wheel zoom out position, where: 0 = Cursor position (default) 1 = Graphics area center @type position: int """ env.prefs[zoomOutAboutScreenCenter_prefs_key] = position self.w.updateMouseWheelSettings() return def set_mouse_wheel_timeout_interval(self, interval): """ Slot method for the I{Hover highlighting timeout interval} spinbox. @param interval: The timeout interval in seconds. @type interval: double """ env.prefs[mouseWheelTimeoutInterval_prefs_key] = interval return def set_pan_arrow_keys_direction(self, direction): """ Slot for Pan setting "Arrow Keys Direction" combo box. @param direction: The arrow keys direction for pan control, where: 0 = View direction (default) 1 = Camera direction @type direction: int """ if direction == 0: env.prefs[panArrowKeysDirection_prefs_key] = 1 else: env.prefs[panArrowKeysDirection_prefs_key] = -1 return # = Ruler slot methods def set_ruler_display(self, display): """ Set display of individual rulers. @param display: The ruler display, where: - 0 = display both rulers - 1 = display vertical ruler only - 2 = display horizontal ruler only @type display: int """ env.prefs[displayVertRuler_prefs_key] = True env.prefs[displayHorzRuler_prefs_key] = True if display == 1: env.prefs[displayHorzRuler_prefs_key] = False elif display == 2: env.prefs[displayVertRuler_prefs_key] = False # update the glpane self.glpane.gl_update() def set_ruler_position(self, position): """ Set position of ruler(s). @param position: The ruler position, where: - 0 = lower left - 1 = upper left - 2 = lower right - 3 = upper right @type position: int """ # set the pref env.prefs[rulerPosition_prefs_key] = position # update the glpane self.glpane.gl_update() def change_ruler_color(self): """ Change the ruler color. """ self.usual_change_color( rulerColor_prefs_key) def change_ruler_opacity(self, opacity): """ Change the ruler opacity. """ env.prefs[rulerOpacity_prefs_key] = opacity * 0.01 ########## End of slot methods for "General" page widgets ########### ########## Slot methods for "Atoms" page widgets ################ def change_element_colors(self): """ Display the Element Color Settings Dialog. """ # Since the prefs dialog is modal, the element color settings dialog must be modal. self.w.showElementColorSettings(self) def usual_change_color(self, prefs_key, caption = "choose"): #bruce 050805 from widgets.prefs_widgets import colorpref_edit_dialog colorpref_edit_dialog( self, prefs_key, caption = caption) def change_atom_hilite_color(self): """ Change the atom highlight color. """ self.usual_change_color( atomHighlightColor_prefs_key) def change_bondpoint_hilite_color(self): """ Change the bondpoint highlight color. """ self.usual_change_color( bondpointHighlightColor_prefs_key) def change_hotspot_color(self): #bruce 050808 implement new slot which Mark recently added to .ui file """ Change the free valence hotspot color. """ #e fyi, we might rename hotspot to something like "bonding point" someday... self.usual_change_color( bondpointHotspotColor_prefs_key) def reset_atom_colors(self): #bruce 050805 let's try it like this: env.prefs.restore_defaults([ #e this list should be defined in a more central place. atomHighlightColor_prefs_key, bondpointHighlightColor_prefs_key, bondpointHotspotColor_prefs_key ]) def change_level_of_detail(self, level_of_detail_item): #bruce 060215 revised this """ Change the level of detail, where <level_of_detail_item> is a value between 0 and 3 where: - 0 = low - 1 = medium - 2 = high - 3 = variable (based on number of atoms in the part) @note: the prefs db value for 'variable' is -1, to allow for higher LOD levels in the future. """ lod = level_of_detail_item if level_of_detail_item == 3: lod = -1 env.prefs[levelOfDetail_prefs_key] = lod self.glpane.gl_update() # the redraw this causes will (as of tonight) always recompute the correct drawLevel (in Part._recompute_drawLevel), # and chunks will invalidate their display lists as needed to accomodate the change. [bruce 060215] return def change_ballStickAtomScaleFactor(self, scaleFactor): """ Change the Ball and Stick atom scale factor. @param scaleFactor: The scale factor (%). @type scaleFactor: int """ env.prefs[diBALL_AtomRadius_prefs_key] = scaleFactor * .01 self._updateResetButton(self.reset_ballstick_scale_factor_btn, diBALL_AtomRadius_prefs_key) return def reset_ballStickAtomScaleFactor(self): """ Slot called when pressing the CPK Atom Scale Factor reset button. Restores the default value of the CPK Atom Scale Factor. """ env.prefs.restore_defaults([diBALL_AtomRadius_prefs_key]) self.ballStickAtomScaleFactorSpinBox.setValue(int (env.prefs[diBALL_AtomRadius_prefs_key] * 100.0)) return def change_cpkAtomScaleFactor(self, scaleFactor): """ Change the atom scale factor for CPK display style. @param scaleFactor: The scale factor (between 0.5 and 1.0). @type scaleFactor: float """ env.prefs[cpkScaleFactor_prefs_key] = scaleFactor self._updateResetButton(self.reset_cpk_scale_factor_btn, cpkScaleFactor_prefs_key) return def reset_cpkAtomScaleFactor(self): """ Slot called when pressing the CPK Atom Scale Factor reset button. Restores the default value of the CPK Atom Scale Factor. """ env.prefs.restore_defaults([cpkScaleFactor_prefs_key]) self.cpkAtomScaleFactorDoubleSpinBox.setValue(env.prefs[cpkScaleFactor_prefs_key]) ########## End of slot methods for "Atoms" page widgets ########### ########## Slot methods for "Bonds" page widgets ################ def change_bond_hilite_color(self): """ Change the bond highlight color. """ self.usual_change_color( bondHighlightColor_prefs_key) def change_bond_stretch_color(self): """ Change the bond stretch color. """ self.usual_change_color( bondStretchColor_prefs_key) def change_bond_vane_color(self): """ Change the bond vane color for pi orbitals. """ self.usual_change_color( bondVaneColor_prefs_key) def change_ballstick_bondcolor(self): #bruce 060607 renamed this in this file and .ui/.py dialog files """ Change the bond cylinder color used in Ball & Stick display mode. """ self.usual_change_color( diBALL_bondcolor_prefs_key) def reset_bond_colors(self): #bruce 050805 let's try it like this: env.prefs.restore_defaults([ #e this list should be defined in a more central place. bondHighlightColor_prefs_key, bondStretchColor_prefs_key, bondVaneColor_prefs_key, diBALL_bondcolor_prefs_key, ]) def change_high_order_bond_display(self, val): #bruce 050806 filled this in """ Slot for the button group that sets the high order bond display. """ # ('pi_bond_style', ['multicyl','vane','ribbon'], pibondStyle_prefs_key, 'multicyl' ), try: symbol = {0:'multicyl', 1:'vane', 2:'ribbon'}[val] # note: this decoding must use the same (arbitrary) int->symbol mapping as the button group does. # It's just a coincidence that the order is the same as in the prefs-type listed above. except KeyError: #bruce 060627 added specific exception class (untested) print "bug in change_high_order_bond_display: unknown val ignored:", val else: env.prefs[ pibondStyle_prefs_key ] = symbol return def change_bond_labels(self, val): #bruce 050806 filled this in """ Slot for the checkbox that turns Pi Bond Letters on/off. """ # (BTW, these are not "labels" -- someday we might add user-settable longer bond labels, # and the term "labels" should refer to that. These are just letters indicating the bond type. [bruce 050806]) env.prefs[ pibondLetters_prefs_key ] = not not val # See also the other use of pibondLetters_prefs_key, where the checkbox is kept current when first shown. return def change_show_valence_errors(self, val): #bruce 050806 made this up """ Slot for the checkbox that turns Show Valence Errors on/off. """ env.prefs[ showValenceErrors_prefs_key ] = not not val ## if debug_flags.atom_debug: ## print showValenceErrors_prefs_key, env.prefs[ showValenceErrors_prefs_key ] #k prints true, from our initial setup of page return def change_bond_line_thickness(self, pixel_thickness): #mark 050831 """ Set the default bond line thickness for Lines display. pixel_thickness can be 1, 2 or 3. """ env.prefs[linesDisplayModeThickness_prefs_key] = pixel_thickness self.update_bond_line_thickness_suffix() def update_bond_line_thickness_suffix(self): """ Updates the suffix for the bond line thickness spinbox. """ if env.prefs[linesDisplayModeThickness_prefs_key] == 1: self.bond_line_thickness_spinbox.setSuffix(' pixel') else: self.bond_line_thickness_spinbox.setSuffix(' pixels') def change_ballstick_cylinder_radius(self, val): """ Change the CPK (Ball and Stick) cylinder radius by % value <val>. """ #bruce 060607 renamed change_cpk_cylinder_radius -> change_ballstick_cylinder_radius (in this file and .ui/.py dialog files) env.prefs[diBALL_BondCylinderRadius_prefs_key] = val *.01 # Bruce wrote: #k gl_update is probably not needed and in some cases is a slowdown [bruce 060607 comment] # so I tested it and confirmed that gl_update() isn't needed. # Mark 2008-01-31 #self.glpane.gl_update() ########## End of slot methods for "Bonds" page widgets ########### ########## Slot methods for "DNA" page widgets ################ def dnaRestoreFactoryDefaults(self): """ Slot for I{Restore Factory Defaults} button. """ env.prefs.restore_defaults([ bdnaBasesPerTurn_prefs_key, bdnaRise_prefs_key, dnaDefaultStrand1Color_prefs_key, dnaDefaultStrand2Color_prefs_key, dnaDefaultSegmentColor_prefs_key ]) # These generate signals (good), which calls slots # save_dnaBasesPerTurn() and save_dnaRise() self.dnaBasesPerTurnDoubleSpinBox.setValue(env.prefs[bdnaBasesPerTurn_prefs_key]) self.dnaRiseDoubleSpinBox.setValue(env.prefs[bdnaRise_prefs_key]) def changeDnaDefaultStrand1Color(self): """ Slot for the I{Choose...} button for changing the DNA default strand1 color. """ self.usual_change_color( dnaDefaultStrand1Color_prefs_key ) def changeDnaDefaultStrand2Color(self): """ Slot for the I{Choose...} button for changing the DNA default strand2 color. """ self.usual_change_color( dnaDefaultStrand2Color_prefs_key ) def changeDnaDefaultSegmentColor(self): """ Slot for the I{Choose...} button for changing the DNA default segment color. """ self.usual_change_color( dnaDefaultSegmentColor_prefs_key ) def save_dnaStrutScale(self, scale_factor): """ Slot for B{Strut Scale Factor} spinbox. @param scale_factor: The struct scale factor. @type scale_factor: int """ env.prefs[dnaStrutScaleFactor_prefs_key] = scale_factor * .01 def update_dnaStrandThreePrimeArrowheadCustomColorWidgets(self, enabled_flag): """ Slot for the "Custom color" checkbox,for three prime arrowhead used to disable/enable thecolor related widgets (frame and choose button). """ self.strandThreePrimeArrowheadsCustomColorFrame.setEnabled(enabled_flag) self.strandThreePrimeArrowheadsCustomColorPushButton.setEnabled(enabled_flag) return def update_dnaStrandFivePrimeArrowheadCustomColorWidgets(self, enabled_flag): """ Slot for the "Custom color" checkbox, used to disable/enable the color related widgets (frame and choose button). """ self.strandFivePrimeArrowheadsCustomColorFrame.setEnabled(enabled_flag) self.strandFivePrimeArrowheadsCustomColorPushButton.setEnabled(enabled_flag) return def change_dnaStrandThreePrimeArrowheadCustomColor(self): """ Slot for the I{Choose...} button for changing the DNA strand three prime arrowhead color. """ self.usual_change_color( dnaStrandThreePrimeArrowheadsCustomColor_prefs_key ) def change_dnaStrandFivePrimeArrowheadCustomColor(self): """ Slot for the I{Choose...} button for changing the DNA strand five prime arrowhead color. """ self.usual_change_color( dnaStrandFivePrimeArrowheadsCustomColor_prefs_key ) def save_dnaMinMinorGrooveAngles(self, minAngle): """ Slot for minimum minor groove angle spinboxes. @param minAngle: The minimum angle. @type minAngle: int """ env.prefs[dnaMinMinorGrooveAngle_prefs_key] = minAngle def save_dnaMaxMinorGrooveAngles(self, maxAngle): """ Slot for maximum minor groove angle spinboxes. @param maxAngle: The maximum angle. @type maxAngle: int """ env.prefs[dnaMaxMinorGrooveAngle_prefs_key] = maxAngle def change_dnaMinorGrooveErrorIndicatorColor(self): """ Slot for the I{Choose...} button for changing the DNA minor groove error indicator color. """ self.usual_change_color( dnaMinorGrooveErrorIndicatorColor_prefs_key ) def _restore_dnaMinorGrooveFactoryDefaults(self): """ Slot for Minor Groove Error Indicator I{Restore Factory Defaults} button. """ env.prefs.restore_defaults([ dnaMinMinorGrooveAngle_prefs_key, dnaMaxMinorGrooveAngle_prefs_key, dnaMinorGrooveErrorIndicatorColor_prefs_key, ]) # These generate signals! self.dnaMinGrooveAngleSpinBox.setValue( env.prefs[dnaMinMinorGrooveAngle_prefs_key]) self.dnaMaxGrooveAngleSpinBox.setValue( env.prefs[dnaMaxMinorGrooveAngle_prefs_key]) # DNA display style piotr 080310 def change_dnaStyleStrandsColor(self, value): """ Changes DNA Style strands color. @param color: The color mode: - 0 = color same as chunk - 1 = base oder - 2 = strand order @type color: int """ env.prefs[dnaStyleStrandsColor_prefs_key] = value def change_dnaStyleStrutsColor(self, color): """ Changes DNA Style struts color. @param color: The color mode: - 0 = color same as chunk - 1 = strand order - 2 = base type @type color: int """ env.prefs[dnaStyleStrutsColor_prefs_key] = color def change_dnaStyleAxisColor(self, color): """ Changes DNA Style axis color. @param color: The color mode: - 0 = color same as chunk - 0 = color same as chunk - 1 = base oder - 2 = discrete bse order - 3 = base type - 4 = strand order @type color: int """ env.prefs[dnaStyleAxisColor_prefs_key] = color def change_dnaStyleBasesColor(self, color): """ Changes DNA Style bases color. @param color: The color mode: - 0 = color same as chunk - 1 = base order - 2 = strand order - 3 = base type @type color: int """ env.prefs[dnaStyleBasesColor_prefs_key] = color def change_dnaStyleStrandsShape(self, shape): """ Changes DNA Style strands shape. @param shape: The shape mode: - 0 = none (hidden) - 1 = cylinders - 2 = tube @type shape: int """ env.prefs[dnaStyleStrandsShape_prefs_key] = shape def change_dnaStyleStrutsShape(self, shape): """ Changes DNA Style strands shape. @param shape: The shape mode: - 0 = none (hidden) - 1 = base-axis-base - 2 = straight cylinders @type shape: int """ env.prefs[dnaStyleStrutsShape_prefs_key] = shape def change_dnaStyleAxisShape(self, shape): """ Changes DNA Style strands shape. @param shape: The shape mode: - 0 = none (hidden) - 1 = wide tube - 2 = narrow tube @type shape: int """ env.prefs[dnaStyleAxisShape_prefs_key] = shape def change_dnaStyleBasesShape(self, shape): """ Changes DNA Style strands shape. @param shape: The shape mode: - 0 = none (hidden) - 1 = spheres - 2 = cartoon-like @type shape: int """ env.prefs[dnaStyleBasesShape_prefs_key] = shape def change_dnaStyleStrandsScale(self, scale_factor): """ @param scale_factor: The strands scale factor. @type scale_factor: float """ env.prefs[dnaStyleStrandsScale_prefs_key] = scale_factor #self.update_dnaStyleStrandsScale() def update_dnaStyleStrandsScale(self): """ Updates the DNA Style Strands Scale spin box. """ # Set strands scale. self.dnaStyleStrandsScaleSpinBox.setValue( float(env.prefs[dnaStyleStrandsScale_prefs_key])) def change_dnaStyleStrutsScale(self, scale_factor): """ @param scale_factor: The struts scale factor. @type scale_factor: float """ env.prefs[dnaStyleStrutsScale_prefs_key] = scale_factor def change_dnaStyleAxisScale(self, scale_factor): """ @param scale_factor: The axis scale factor. @type scale_factor: float """ env.prefs[dnaStyleAxisScale_prefs_key] = scale_factor def change_dnaStyleBasesScale(self, scale_factor): """ @param scale_factor: The bases scale factor. @type scale_factor: float """ env.prefs[dnaStyleBasesScale_prefs_key] = scale_factor #self.update_dnaStyleBasesScale() def update_dnaStyleBasesScale(self): """ Updates the DNA Style bases scale spin box. """ # Set axis scale. self.dnaStyleBasesScaleSpinBox.setValue( float(env.prefs[dnaStyleBasesScale_prefs_key])) def change_dnaBaseIndicatorsAngle(self, angle): """ @param angle: The angular threshold for DNA base indicators. @type angle: double """ print "angle (set) = ", angle env.prefs[dnaBaseIndicatorsAngle_prefs_key] = angle self.update_dnaBaseIndicatorsAngle() def update_dnaBaseIndicatorsAngle(self): """ Updates the DNA base orientation indicators angular threshold spinbox. """ self.dnaBaseOrientationIndicatorsThresholdSpinBox.setValue( float(env.prefs[dnaBaseIndicatorsAngle_prefs_key])) def change_dnaBaseIndicatorsDistance(self, distance): """ @param distance: The distance threshold for DNA base indicators. @type distance: double """ env.prefs[dnaBaseIndicatorsDistance_prefs_key] = distance self.update_dnaBaseIndicatorsDistance() def update_dnaBaseIndicatorsDistance(self): """ Updates the DNA base orientation indicators distance threshold spinbox. """ self.dnaBaseOrientationIndicatorsTerminalDistanceSpinBox.setValue( int(env.prefs[dnaBaseIndicatorsDistance_prefs_key])) def change_dnaStyleStrandsArrows(self, shape): """ Changes DNA Style strands shape. @param shape: The shape mode: - 0 = none (hidden) @type shape: int """ env.prefs[dnaStyleStrandsArrows_prefs_key] = shape def change_dnaStyleAxisEndingStyle(self, shape): """ Changes DNA Style strands ends. @param shape: The ending style shape: - 0 = flat - 1 = taper beginning - 2 = taper ending - 3 = taper both ends - 4 = spherical @type shape: int """ env.prefs[dnaStyleAxisEndingStyle_prefs_key] = shape def toggle_dnaDisplayStrandLabelsGroupBox(self, state): """ Toggles DNA Strand Labels GroupBox. @param state: Is the GroupBox enabled? - True = on - False = off @type state: boolean """ env.prefs[dnaStrandLabelsEnabled_prefs_key] = state def toggle_dnaDisplayBaseOrientationIndicatorsGroupBox(self, state): """ Toggles DNA Base Orientation Indicators GroupBox. @param state: Is the GroupBox enabled? - True = on - False = off @type state: boolean """ env.prefs[dnaBaseIndicatorsEnabled_prefs_key] = state def toggle_dnaDisplayBaseOrientationInvIndicatorsCheckBox(self, state): """ Toggles DNA Base Orientation Inverse Indicators CheckBox. @param state: Is the CheckBox enabled? - True = on - False = off @type state: boolean """ env.prefs[dnaBaseInvIndicatorsEnabled_prefs_key] = state def toggle_dnaStyleBasesDisplayLettersCheckBox(self, state): """ Toggles DNA Base Letters. @param state: Is the CheckBox enabled? - True = on - False = off @type state: boolean """ env.prefs[dnaStyleBasesDisplayLetters_prefs_key] = state def change_dnaBaseOrientIndicatorsPlane(self, idx): """ Slot for the "Plane" combobox for changing the DNA base indicators plane. """ env.prefs[dnaBaseIndicatorsPlaneNormal_prefs_key] = idx def change_dnaBaseIndicatorsColor(self): """ Slot for the I{Choose...} button for changing the DNA base indicators color. """ self.usual_change_color( dnaBaseIndicatorsColor_prefs_key ) def change_dnaBaseInvIndicatorsColor(self): """ Slot for the I{Choose...} button for changing the DNA base inverse indicators color. """ self.usual_change_color( dnaBaseInvIndicatorsColor_prefs_key ) def change_dnaStrandLabelsColor(self): """ Slot for the I{Choose...} button for changing the DNA strand labels color. """ self.usual_change_color( dnaStrandLabelsColor_prefs_key ) def change_dnaStrandLabelsColorMode(self, mode): """ Changes DNA Style strand labels color mode. @param mode: The color mode: - 0 = same as chunk - 1 = black - 2 = white - 3 = custom @type mode: int """ env.prefs[dnaStrandLabelsColorMode_prefs_key] = mode # == End of slot methods for "DNA" page widgets == # == Slot methods for "Lighting" page widgets == def change_lighting(self, specularityValueJunk = None): """ Updates glpane lighting using the current lighting parameters from the light checkboxes and sliders. This is also the slot for the light sliders. @param specularityValueJunk: This value from the slider is not used We are interested in valueChanged signal only @type specularityValueJunk = int or None """ light_num = self.light_combobox.currentIndex() light1, light2, light3 = self.glpane.getLighting() a = self.light_ambient_slider.value() * .01 d = self.light_diffuse_slider.value() * .01 s = self.light_specularity_slider.value() * .01 self.light_ambient_linedit.setText(str(a)) self.light_diffuse_linedit.setText(str(d)) self.light_specularity_linedit.setText(str(s)) new_light = [ self.light_color, a, d, s, \ float(str(self.light_x_linedit.text())), \ float(str(self.light_y_linedit.text())), \ float(str(self.light_z_linedit.text())), \ self.light_checkbox.isChecked()] # This is a kludge. I'm certain there is a more elegant way. Mark 051204. if light_num == 0: self.glpane.setLighting([new_light, light2, light3]) elif light_num == 1: self.glpane.setLighting([light1, new_light, light3]) elif light_num == 2: self.glpane.setLighting([light1, light2, new_light]) else: print "Unsupported light # ", light_num,". No lighting change made." def change_active_light(self, currentIndexJunk = None): """ Slot for the Light number combobox. This changes the current light. @param currentIndexJunk: This index value from the combobox is not used We are interested in 'activated' signal only @type currentIndexJunk = int or None """ self._updatePage_Lighting() def change_light_color(self): """ Slot for light color "Choose" button. Saves the new color in the prefs db. Changes the current Light color in the graphics area and the light color swatch in the UI. """ self.usual_change_color(self.current_light_key) self.light_color = env.prefs[self.current_light_key] self.save_lighting() def update_light_combobox_items(self): """Updates all light combobox items with '(On)' or '(Off)' label. """ for i in range(3): if self.lights[i][7]: txt = "%d (On)" % (i+1) else: txt = "%d (Off)" % (i+1) self.light_combobox.setItemText(i, txt) def toggle_light(self, on): """ Slot for light 'On' checkbox. It updates the current item in the light combobox with '(On)' or '(Off)' label. """ if on: txt = "%d (On)" % (self.light_combobox.currentIndex()+1) else: txt = "%d (Off)" % (self.light_combobox.currentIndex()+1) self.light_combobox.setItemText(self.light_combobox.currentIndex(),txt) self.save_lighting() def save_lighting(self): """ Saves lighting parameters (but not material specularity parameters) to pref db. This is also the slot for light sliders (only when released). """ self.change_lighting() self.glpane.saveLighting() def toggle_material_specularity(self, val): """ This is the slot for the Material Specularity Enabled checkbox. """ env.prefs[material_specular_highlights_prefs_key] = val def change_material_finish(self, finish): """ This is the slot for the Material Finish slider. 'finish' is between 0 and 100. Saves finish parameter to pref db. """ # For whiteness, the stored range is 0.0 (Metal) to 1.0 (Plastic). # The Qt slider range is 0 - 100, so we multiply by 100 to set the slider. Mark. 051129. env.prefs[material_specular_finish_prefs_key] = float(finish * 0.01) self.ms_finish_linedit.setText(str(finish * 0.01)) def change_material_shininess(self, shininess): """ This is the slot for the Material Shininess slider. 'shininess' is between 15 (low) and 60 (high). """ env.prefs[material_specular_shininess_prefs_key] = float(shininess) self.ms_shininess_linedit.setText(str(shininess)) def change_material_brightness(self, brightness): """ This is the slot for the Material Brightness slider. 'brightness' is between 0 (low) and 100 (high). """ env.prefs[material_specular_brightness_prefs_key] = float(brightness * 0.01) self.ms_brightness_linedit.setText(str(brightness * 0.01)) def change_material_finish_start(self): if debug_sliders: print "Finish slider pressed" env.prefs.suspend_saving_changes() #bruce 051205 new prefs feature - keep updating to glpane but not (yet) to disk def change_material_finish_stop(self): if debug_sliders: print "Finish slider released" env.prefs.resume_saving_changes() #bruce 051205 new prefs feature - save accumulated changes now def change_material_shininess_start(self): if debug_sliders: print "Shininess slider pressed" env.prefs.suspend_saving_changes() def change_material_shininess_stop(self): if debug_sliders: print "Shininess slider released" env.prefs.resume_saving_changes() def change_material_brightness_start(self): if debug_sliders: print "Brightness slider pressed" env.prefs.suspend_saving_changes() def change_material_brightness_stop(self): if debug_sliders: print "Brightness slider released" env.prefs.resume_saving_changes() def reset_lighting(self): """ Slot for Reset button. """ # This has issues. # I intend to remove the Reset button for A7. Confirm with Bruce. Mark 051204. self._setup_material_group(reset = True) self._updatePage_Lighting(self.original_lights) self.glpane.saveLighting() def restore_default_lighting(self): """ Slot for Restore Defaults button. """ self.glpane.restoreDefaultLighting() # Restore defaults for the Material Specularity properties env.prefs.restore_defaults([ material_specular_highlights_prefs_key, material_specular_shininess_prefs_key, material_specular_finish_prefs_key, material_specular_brightness_prefs_key, #bruce 051203 bugfix ]) self._updatePage_Lighting() self.save_lighting() ########## End of slot methods for "Lighting" page widgets ########### ########## Slot methods for "Plug-ins" page widgets ################ def choose_gamess_path(self): """ Slot for GAMESS path "Choose" button. """ gamess_exe = get_filename_and_save_in_prefs(self, gmspath_prefs_key, 'Choose GAMESS Executable') if gamess_exe: self.gamess_path_lineedit.setText(env.prefs[gmspath_prefs_key]) def set_gamess_path(self, newValue): """ Slot for GAMESS path line editor. """ env.prefs[gamess_path_prefs_key] = str_or_unicode(newValue) def enable_gamess(self, enable = True): """ Enables/disables GAMESS plugin. @param enable: Enabled when True. Disables when False. @type enable: bool """ if enable: self.gamess_path_lineedit.setEnabled(1) self.gamess_choose_btn.setEnabled(1) env.prefs[gamess_enabled_prefs_key] = True else: self.gamess_path_lineedit.setEnabled(0) self.gamess_choose_btn.setEnabled(0) #self.gamess_path_lineedit.setText("") #env.prefs[gmspath_prefs_key] = '' env.prefs[gamess_enabled_prefs_key] = False # GROMACS slots ####################################### def choose_gromacs_path(self): """ Slot for GROMACS path "Choose" button. """ mdrun_executable = \ get_filename_and_save_in_prefs(self, gromacs_path_prefs_key, 'Choose mdrun executable (GROMACS)') if mdrun_executable: self.gromacs_path_lineedit.setText(env.prefs[gromacs_path_prefs_key]) def set_gromacs_path(self, newValue): """ Slot for GROMACS path line editor. """ env.prefs[gromacs_path_prefs_key] = str_or_unicode(newValue) def enable_gromacs(self, enable = True): """ If True, GROMACS path is set in Preferences>Plug-ins @param enable: Is the path set? @type enable: bool """ state = self.gromacs_checkbox.checkState() if enable: if (state != Qt.Checked): self.gromacs_checkbox.setCheckState(Qt.Checked) self.gromacs_path_lineedit.setEnabled(True) self.gromacs_choose_btn.setEnabled(True) env.prefs[gromacs_enabled_prefs_key] = True # Sets the GROMACS (executable) path to the standard location, if it exists. if not env.prefs[gromacs_path_prefs_key]: env.prefs[gromacs_path_prefs_key] = get_default_plugin_path( \ "C:\\GROMACS_3.3.3\\bin\\mdrun.exe", \ "/Applications/GROMACS_3.3.3/bin/mdrun", "/usr/bin/g_mdrun") self.gromacs_path_lineedit.setText(env.prefs[gromacs_path_prefs_key]) else: if (state != Qt.Unchecked): self.gromacs_checkbox.setCheckState(Qt.Unchecked) self.gromacs_path_lineedit.setEnabled(False) self.gromacs_choose_btn.setEnabled(False) #self.gromacs_path_lineedit.setText("") #env.prefs[gromacs_path_prefs_key] = '' env.prefs[gromacs_enabled_prefs_key] = False # cpp slots ####################################### def choose_cpp_path(self): """ Sets the path to cpp (C pre-processor) """ cpp_executable = get_filename_and_save_in_prefs(self, cpp_path_prefs_key, 'Choose cpp Executable (used by GROMACS)') if cpp_executable: self.cpp_path_lineedit.setText(env.prefs[cpp_path_prefs_key]) def set_cpp_path(self, newValue): """ Slot for cpp path line editor. """ env.prefs[cpp_path_prefs_key] = str_or_unicode(newValue) def enable_cpp(self, enable = True): """ Enables/disables cpp plugin. @param enable: Enabled when True. Disables when False. @type enable: bool """ state = self.cpp_checkbox.checkState() if enable: if (state != Qt.Checked): self.cpp_checkbox.setCheckState(Qt.Checked) self.cpp_path_lineedit.setEnabled(True) self.cpp_choose_btn.setEnabled(True) env.prefs[cpp_enabled_prefs_key] = True # Sets the cpp path to the standard location, if it exists. if not env.prefs[cpp_path_prefs_key]: env.prefs[cpp_path_prefs_key] = get_default_plugin_path( \ "C:\\GROMACS_3.3.3\\MCPP\\bin\\mcpp.exe", \ "/Applications/GROMACS_3.3.3/mcpp/bin/mcpp", \ "/usr/bin/cpp") self.cpp_path_lineedit.setText(env.prefs[cpp_path_prefs_key]) else: if (state != Qt.Unchecked): self.cpp_checkbox.setCheckState(Qt.Unchecked) self.cpp_path_lineedit.setEnabled(False) self.cpp_choose_btn.setEnabled(False) #self.cpp_path_lineedit.setText("") #env.prefs[cpp_path_prefs_key] = '' env.prefs[cpp_enabled_prefs_key] = False # NanoVision-1 slots ####################################### def choose_nv1_path(self): """ Slot for NanoVision-1 path "Choose" button. """ nv1_executable = get_filename_and_save_in_prefs(self, nv1_path_prefs_key, 'Choose NanoVision-1 Executable') if nv1_executable: self.nv1_path_lineedit.setText(env.prefs[nv1_path_prefs_key]) def set_nv1_path(self, newValue): """ Slot for NanoVision-1 path line editor. """ env.prefs[nv1_path_prefs_key] = str_or_unicode(newValue) def enable_nv1(self, enable = True): """ If True, NV1 path is set in Preferences > Plug-ins @param enable: Is the path set? @type enable: bool """ state = self.nv1_checkbox.checkState() if enable: if (state != Qt.Checked): self.nv1_checkbox.setCheckState(Qt.Checked) self.nv1_path_lineedit.setEnabled(True) self.nv1_choose_btn.setEnabled(True) env.prefs[nv1_enabled_prefs_key] = True # Sets the NV1 (executable) path to the standard location, if it exists. if not env.prefs[nv1_path_prefs_key]: env.prefs[nv1_path_prefs_key] = get_default_plugin_path( \ "C:\\Program Files\\Nanorex\\NanoVision-1\\NanoVision-1.exe", \ "/Applications/Nanorex/NanoVision-1 0.1.0/NanoVision-1.app", \ "/usr/local/Nanorex/NanoVision-1 0.1.0/NanoVision-1") self.nv1_path_lineedit.setText(env.prefs[nv1_path_prefs_key]) else: if (state != Qt.Unchecked): self.nv1_checkbox.setCheckState(Qt.Unchecked) self.nv1_path_lineedit.setEnabled(False) self.nv1_choose_btn.setEnabled(False) #self.nv1_path_lineedit.setText("") #env.prefs[nv1_path_prefs_key] = '' env.prefs[nv1_enabled_prefs_key] = False return # Rosetta slots ####################################### def choose_rosetta_path(self): """ Slot for Rosetta path "Choose" button. """ rosetta_executable = get_filename_and_save_in_prefs(self, rosetta_path_prefs_key, 'Choose Rosetta Executable') if rosetta_executable: self.rosetta_path_lineedit.setText(env.prefs[rosetta_path_prefs_key]) def set_rosetta_path(self, newValue): """ Slot for Rosetta path line editor. """ env.prefs[rosetta_path_prefs_key] = str_or_unicode(newValue) return def enable_rosetta(self, enable = True): """ If True, rosetta path is set in Preferences > Plug-ins @param enable: Is the path set? @type enable: bool """ state = self.rosetta_checkbox.checkState() if enable: if (state != Qt.Checked): self.rosetta_checkbox.setCheckState(Qt.Checked) self.rosetta_path_lineedit.setEnabled(True) self.rosetta_choose_btn.setEnabled(True) env.prefs[rosetta_enabled_prefs_key] = True # Sets the rosetta (executable) path to the standard location, if it exists. if not env.prefs[rosetta_path_prefs_key]: env.prefs[rosetta_path_prefs_key] = get_default_plugin_path( \ "C:\\Rosetta\\rosetta.exe", \ "/Users/marksims/Nanorex/Rosetta/rosetta++/rosetta.mactel", \ "/usr/local/Rosetta/Rosetta") self.rosetta_path_lineedit.setText(env.prefs[rosetta_path_prefs_key]) else: if (state != Qt.Unchecked): self.rosetta_checkbox.setCheckState(Qt.Unchecked) self.rosetta_path_lineedit.setEnabled(False) self.rosetta_choose_btn.setEnabled(False) env.prefs[rosetta_enabled_prefs_key] = False return # Rosetta DB slots ####################################### def choose_rosetta_db_path(self): """ Slot for Rosetta DB path "Choose" button. """ rosetta_db_executable = get_filename_and_save_in_prefs(self, rosetta_dbdir_prefs_key, 'Choose Rosetta database directory') # piotr 081908: this pref key doesn't exist #if rosetta_db_executable: # self.rosetta_db_path_lineedit.setText(env.prefs[rosetta_db_path_prefs_key]) def set_rosetta_db_path(self, newValue): """ Slot for Rosetta db path line editor. """ env.prefs[rosetta_dbdir_prefs_key] = str_or_unicode(newValue) def enable_rosetta_db(self, enable = True): """ If True, rosetta db path is set in Preferences > Plug-ins @param enable: Is the path set? @type enable: bool """ state = self.rosetta_db_checkbox.checkState() if enable: if (state != Qt.Checked): self.rosetta_db_checkbox.setCheckState(Qt.Checked) self.rosetta_db_path_lineedit.setEnabled(True) self.rosetta_db_choose_btn.setEnabled(True) env.prefs[rosetta_database_enabled_prefs_key] = True # Sets the rosetta (executable) path to the standard location, if it exists. if not env.prefs[rosetta_dbdir_prefs_key]: env.prefs[rosetta_dbdir_prefs_key] = get_default_plugin_path( \ "C:\\Rosetta\\rosetta_database", \ "/Users/marksims/Nanorex/Rosetta/Rosetta_database", \ "/usr/local/Rosetta/Rosetta_database") self.rosetta_db_path_lineedit.setText(env.prefs[rosetta_dbdir_prefs_key]) else: if (state != Qt.Unchecked): self.rosetta_db_checkbox.setCheckState(Qt.Unchecked) self.rosetta_db_path_lineedit.setEnabled(False) self.rosetta_db_choose_btn.setEnabled(False) env.prefs[rosetta_database_enabled_prefs_key] = False return # QuteMolX slots ####################################### def choose_qutemol_path(self): """ Slot for QuteMolX path "Choose" button. """ qp = get_filename_and_save_in_prefs(self, qutemol_path_prefs_key, 'Choose QuteMolX Executable') if qp: self.qutemol_path_lineedit.setText(qp) def set_qutemol_path(self, newValue): """ Slot for QuteMol path line editor. """ env.prefs[qutemol_path_prefs_key] = str_or_unicode(newValue) def enable_qutemol(self, enable = True): """ Enables/disables QuteMolX plugin. @param enable: Enabled when True. Disables when False. @type enable: bool """ if enable: self.qutemol_path_lineedit.setEnabled(1) self.qutemol_choose_btn.setEnabled(1) env.prefs[qutemol_enabled_prefs_key] = True # Sets the QuteMolX (executable) path to the standard location, if it exists. if not env.prefs[qutemol_path_prefs_key]: env.prefs[qutemol_path_prefs_key] = get_default_plugin_path( \ "C:\\Program Files\\Nanorex\\QuteMolX\\QuteMolX.exe", \ "/Applications/Nanorex/QuteMolX 0.5.0/QuteMolX.app", \ "/usr/local/Nanorex/QuteMolX 0.5.0/QuteMolX") self.qutemol_path_lineedit.setText(env.prefs[qutemol_path_prefs_key]) else: self.qutemol_path_lineedit.setEnabled(0) self.qutemol_choose_btn.setEnabled(0) #self.qutemol_path_lineedit.setText("") #env.prefs[qutemol_path_prefs_key] = '' env.prefs[qutemol_enabled_prefs_key] = False # NanoHive-1 slots ##################################### def choose_nanohive_path(self): """ Slot for Nano-Hive path "Choose" button. """ nh = get_filename_and_save_in_prefs(self, nanohive_path_prefs_key, 'Choose Nano-Hive Executable') if nh: self.nanohive_path_lineedit.setText(nh) def set_nanohive_path(self, newValue): """ Slot for NanoHive path line editor. """ env.prefs[nanohive_path_prefs_key] = str_or_unicode(newValue) def enable_nanohive(self, enable = True): """ Enables/disables NanoHive-1 plugin. @param enable: Enabled when True. Disables when False. @type enable: bool @attention: This is disabled since the NH1 plugin doesn't work yet. """ if enable: self.nanohive_path_lineedit.setEnabled(1) self.nanohive_choose_btn.setEnabled(1) # Leave Nano-Hive action button/menu hidden for A7. Mark 2006-01-04. # self.w.simNanoHiveAction.setVisible(1) # Sets the Nano-Hive (executable) path to the standard location, if it exists. if not env.prefs[nanohive_path_prefs_key]: env.prefs[nanohive_path_prefs_key] = get_default_plugin_path( "C:\\Program Files\\Nano-Hive\\bin\\win32-x86\\NanoHive.exe", \ "/usr/local/bin/NanoHive", \ "/usr/local/bin/NanoHive") env.prefs[nanohive_enabled_prefs_key] = True self.nanohive_path_lineedit.setText(env.prefs[nanohive_path_prefs_key]) # Create the Nano-Hive dialog widget. # Not needed for A7. Mark 2006-01-05. #if not self.w.nanohive: # from NanoHive import NanoHive # self.w.nanohive = NanoHive(self.assy) else: self.nanohive_path_lineedit.setEnabled(0) self.nanohive_choose_btn.setEnabled(0) self.w.nanohive = None self.w.simNanoHiveAction.setVisible(0) #self.nanohive_path_lineedit.setText("") #env.prefs[nanohive_path_prefs_key] = '' env.prefs[nanohive_enabled_prefs_key] = False # POV-Ray slots ##################################### def choose_povray_path(self): """ Slot for POV-Ray path "Choose" button. """ povray_exe = get_filename_and_save_in_prefs(self, povray_path_prefs_key, 'Choose POV-Ray Executable') if povray_exe: self.povray_path_lineedit.setText(povray_exe) def set_povray_path(self, newValue): """ Slot for POV-Ray path line editor. """ env.prefs[povray_path_prefs_key] = str_or_unicode(newValue) def enable_povray(self, enable = True): """ Enables/disables POV-Ray plugin. @param enable: Enabled when True. Disables when False. @type enable: bool """ if enable: self.povray_path_lineedit.setEnabled(1) self.povray_choose_btn.setEnabled(1) env.prefs[povray_enabled_prefs_key] = True # Sets the POV-Ray (executable) path to the standard location, if it exists. if not env.prefs[povray_path_prefs_key]: env.prefs[povray_path_prefs_key] = get_default_plugin_path( \ "C:\\Program Files\\POV-Ray for Windows v3.6\\bin\\pvengine.exe", \ "/usr/local/bin/pvengine", \ "/usr/local/bin/pvengine") self.povray_path_lineedit.setText(env.prefs[povray_path_prefs_key]) else: self.povray_path_lineedit.setEnabled(0) self.povray_choose_btn.setEnabled(0) #self.povray_path_lineedit.setText("") #env.prefs[povray_path_prefs_key] = '' env.prefs[povray_enabled_prefs_key] = False self._update_povdir_enables() #bruce 060710 # MegaPOV slots ##################################### def choose_megapov_path(self): """ Slot for MegaPOV path "Choose" button. """ megapov_exe = get_filename_and_save_in_prefs(self, megapov_path_prefs_key, 'Choose MegaPOV Executable') if megapov_exe: self.megapov_path_lineedit.setText(megapov_exe) def set_megapov_path(self, newValue): """ Slot for MegaPOV path line editor. """ env.prefs[megapov_path_prefs_key] = str_or_unicode(newValue) def enable_megapov(self, enable = True): """ Enables/disables MegaPOV plugin. @param enable: Enabled when True. Disables when False. @type enable: bool """ if enable: self.megapov_path_lineedit.setEnabled(1) self.megapov_choose_btn.setEnabled(1) env.prefs[megapov_enabled_prefs_key] = True # Sets the MegaPOV (executable) path to the standard location, if it exists. if not env.prefs[megapov_path_prefs_key]: env.prefs[megapov_path_prefs_key] = get_default_plugin_path( \ "C:\\Program Files\\POV-Ray for Windows v3.6\\bin\\megapov.exe", \ "/usr/local/bin/megapov", \ "/usr/local/bin/megapov") self.megapov_path_lineedit.setText(env.prefs[megapov_path_prefs_key]) else: self.megapov_path_lineedit.setEnabled(0) self.megapov_choose_btn.setEnabled(0) #self.megapov_path_lineedit.setText("") #env.prefs[megapov_path_prefs_key] = '' env.prefs[megapov_enabled_prefs_key] = False self._update_povdir_enables() #bruce 060710 # POV-Ray include slots ####################################### # pov include directory [bruce 060710 for Mac A8; will be A8.1 in Windows, not sure about Linux] def _update_povdir_enables(self): #bruce 060710 """ [private method] Call this whenever anything changes regarding when to enable the povdir checkbox, line edit, or choose button. We enable the checkbox when either of the POV-Ray or MegaPOV plugins is enabled. We enable the line edit and choose button when that condition holds and when the checkbox is checked. We update this when any relevant checkbox changes, or when showing this page. This will work by reading prefs values, so only call it from slot methods after they have updated prefs values. """ enable_checkbox = env.prefs[povray_enabled_prefs_key] or env.prefs[megapov_enabled_prefs_key] self.povdir_checkbox.setEnabled(enable_checkbox) self.povdir_lbl.setEnabled(enable_checkbox) enable_edits = enable_checkbox and env.prefs[povdir_enabled_prefs_key] # note: that prefs value should and presumably does agree with self.povdir_checkbox.isChecked() self.povdir_lineedit.setEnabled(enable_edits) self.povdir_choose_btn.setEnabled(enable_edits) return def enable_povdir(self, enable = True): #bruce 060710 """ Slot method for povdir checkbox. povdir is enabled when enable = True. povdir is disabled when enable = False. """ env.prefs[povdir_enabled_prefs_key] = not not enable self._update_povdir_enables() ## self.povdir_lineedit.setText(env.prefs[povdir_path_prefs_key]) return def set_povdir(self): #bruce 060710 """ Slot for Pov include dir "Choose" button. """ povdir_path = get_dirname_and_save_in_prefs(self, povdir_path_prefs_key, 'Choose Custom POV-Ray Include directory') # note: return value can't be ""; if user cancels, value is None; # to set "" you have to edit the lineedit text directly, but this doesn't work since # no signal is caught to save that into the prefs db! # ####@@@@ we ought to catch that signal... is it returnPressed?? would that be sent if they were editing it, then hit ok? # or if they clicked elsewhere? (currently that fails to remove focus from the lineedits, on Mac, a minor bug IMHO) # (or uncheck the checkbox for the same effect). (#e do we want a "clear" button, for A8.1?) if povdir_path: self.povdir_lineedit.setText(env.prefs[povdir_path_prefs_key]) # the function above already saved it in prefs, under the same condition return def povdir_lineedit_textChanged(self, *args): #bruce 060710 if debug_povdir_signals(): print "povdir_lineedit_textChanged",args # this happens on programmatic changes, such as when the page is shown or the choose button slot sets the text try: # note: Ideally we'd only do this when return was pressed, mouse was clicked elsewhere (with that also removing keyfocus), # other keyfocus removals, including dialog ok or cancel. That is mostly nim, # so we have to do it all the time for now -- this is the only way for the user to set the text to "". # (This even runs on programmatic sets of the text. Hope that's ok.) env.prefs[povdir_path_prefs_key] = path = str_or_unicode( self.povdir_lineedit.text() ).strip() if debug_povdir_signals(): print "debug fyi: set pov include dir to [%s]" % (path,) except: if env.debug(): print_compact_traceback("bug, ignored: ") return def povdir_lineedit_returnPressed(self, *args): #bruce 060710 if debug_povdir_signals(): print "povdir_lineedit_returnPressed",args # this happens when return is pressed in the widget, but NOT when user clicks outside it # or presses OK on the dialog -- which means it's useless when taken alone, # in case user edits text and then presses ok without ever pressing return. ########## End of slot methods for "Plug-ins" page widgets ########### ########## Slot methods for "Undo" (former name "Caption") page widgets ################ def change_undo_stack_memory_limit(self, mb_val): """ Slot for 'Undo Stack Memory Limit' spinbox. Sets the RAM limit for the Undo Stack. <mb-val> can range from 0-99999 (MB). """ env.prefs[undoStackMemoryLimit_prefs_key] = mb_val def change_historyHeight(self, value): """ Slot for history height spinbox. """ env.prefs[ historyHeight_prefs_key] = value ########## End of slot methods for "Undo" page widgets ########### ########## Start slot methods for "ToolTips" page widgets ########### def change_dynamicToolTipAtomDistancePrecision(self, value): """ Update the atom distance precision for the dynamic tool tip. """ env.prefs[ dynamicToolTipAtomDistancePrecision_prefs_key ] = value def change_dynamicToolTipBendAnglePrecision(self, value): """ Update the bend angle precision for the dynamic tool tip. """ env.prefs[ dynamicToolTipBendAnglePrecision_prefs_key ] = value ########## End of slot methods for "ToolTips" page widgets ########### ########## Slot methods for "Window" (former name "Caption") page widgets ################ #e there are some new slot methods for this in other places, which should be refiled here. [bruce 050811] def change_window_size(self, val = 0): """ Slot for both the width and height spinboxes that change the current window size. Also called from other slots to change the window size based on new values in spinboxes. <val> is not used. """ w = self.current_width_spinbox.value() h = self.current_height_spinbox.value() self.w.resize(w,h) def update_saved_size(self, w, h): """ Update the saved width and height text. """ self.saved_width_lineedit.setText(QString(str(w) + " pixels")) self.saved_height_lineedit.setText(QString(str(h) + " pixels")) def save_current_win_pos_and_size(self): #bruce 051218; see also debug.py's _debug_save_window_layout from utilities.prefs_constants import mainwindow_geometry_prefs_key_prefix keyprefix = mainwindow_geometry_prefs_key_prefix save_window_pos_size( self.w, keyprefix) # prints history message size = self.w.size() self.update_saved_size(size.width(), size.height()) return def restore_saved_size(self): """ Restore the window size, but not the position, from the prefs db. """ from utilities.prefs_constants import mainwindow_geometry_prefs_key_prefix keyprefix = mainwindow_geometry_prefs_key_prefix pos, size = _get_prefs_for_window_pos_size( self.w, keyprefix) w = size[0] h = size[1] self.update_saved_size(w, h) self.current_width_spinbox.setValue(w) self.current_height_spinbox.setValue(h) self.change_window_size() return def change_use_selected_font(self, use_selected_font): """ Slot for "Use Selected Font" checkbox on the groupbox. Called when the checkbox is toggled. """ env.prefs[useSelectedFont_prefs_key] = use_selected_font self.set_font() return def change_font(self, font): """ Slot for the Font combobox. Called whenever the font is changed. """ env.prefs[displayFont_prefs_key] = str_or_unicode(font.family()) self.set_font() return def change_fontsize(self, pointsize): """ Slot for the Font size spinbox. """ env.prefs[displayFontPointSize_prefs_key] = pointsize self.set_font() return def change_selected_font_to_default_font(self): """ Slot for "Make the selected font the default font" button. The default font will be displayed in the Font and Size widgets. """ font = self.w.defaultFont env.prefs[displayFont_prefs_key] = str_or_unicode(font.family()) env.prefs[displayFontPointSize_prefs_key] = font.pointSize() self.set_font_widgets(setFontFromPrefs = True) # Also sets the current display font. if debug_flags.atom_debug: print "change_selected_font_to_default_font(): " \ "Button clicked. Default font: ", font.family(), \ ", size=", font.pointSize() return def set_font_widgets(self, setFontFromPrefs = True): """ Update font widgets based on font prefs. Unconnects signals from slots, updates widgets, then reconnects slots. @param setFontFromPrefs: when True (default), sets the display font (based on font prefs). @type setFontFromPrefs: bool """ if debug_flags.atom_debug: print "set_font_widgets(): Here!" if env.prefs[displayFont_prefs_key] == "defaultFont": # Set the font and point size prefs to the application's default font. # This code only called the first time NE1 is run (or the prefs db does not exist) font = self.w.defaultFont font_family = str_or_unicode(font.family()) # Note: when this used str() rather than str_or_unicode(), # it prevented NE1 from running on some international systems # (when it had never run before and needed to initialize this # prefs value). # We can now reproduce the bug (see bug 2883 for details), # so I am using str_or_unicode to try to fix it. [bruce 080529] font_size = font.pointSize() env.prefs[displayFont_prefs_key] = font_family env.prefs[displayFontPointSize_prefs_key] = font_size if debug_flags.atom_debug: print "set_font_widgets(): No prefs db. " \ "Using default font: ", font.family(), \ ", size=", font.pointSize() else: font_family = env.prefs[displayFont_prefs_key] font_size = env.prefs[displayFontPointSize_prefs_key] font = QFont(font_family, font_size) self.disconnect(self.selectedFontGroupBox, SIGNAL("toggled(bool)"), self.change_use_selected_font) self.disconnect(self.fontComboBox, SIGNAL("currentFontChanged (const QFont &)"), self.change_font) self.disconnect(self.fontSizeSpinBox, SIGNAL("valueChanged(int)"), self.change_fontsize) self.disconnect(self.makeDefaultFontPushButton, SIGNAL("clicked()"), self.change_selected_font_to_default_font) self.selectedFontGroupBox.setChecked(env.prefs[useSelectedFont_prefs_key]) # Generates signal! self.fontComboBox.setCurrentFont(font) # Generates signal! self.fontSizeSpinBox.setValue(font_size) # Generates signal! self.connect(self.selectedFontGroupBox, SIGNAL("toggled(bool)"), self.change_use_selected_font) self.connect(self.fontComboBox, SIGNAL("currentFontChanged (const QFont &)"), self.change_font) self.connect(self.fontSizeSpinBox, SIGNAL("valueChanged(int)"), self.change_fontsize) self.connect(self.makeDefaultFontPushButton, SIGNAL("clicked()"), self.change_selected_font_to_default_font) if setFontFromPrefs: self.set_font() return def set_font(self): """ Set the current display font using the font prefs. """ use_selected_font = env.prefs[useSelectedFont_prefs_key] if use_selected_font: font = self.fontComboBox.currentFont() font_family = str_or_unicode(font.family()) fontsize = self.fontSizeSpinBox.value() font.setPointSize(fontsize) env.prefs[displayFont_prefs_key] = font_family env.prefs[displayFontPointSize_prefs_key] = fontsize if debug_flags.atom_debug: print "set_font(): Using selected font: ", font.family(), ", size=", font.pointSize() else: # Use default font font = self.w.defaultFont if debug_flags.atom_debug: print "set_font(): Using default font: ", font.family(), ", size=", font.pointSize() # Set font self.w.setFont(font) return def set_caption_fullpath(self, val): #bruce 050810 revised this # there is now a separate connection which sets the pref, so this is not needed: ## self.win.caption_fullpath = val # and there is now a Formula in MWsemantics which makes the following no longer needed: ## self.win.update_mainwindow_caption(self.win.assy.has_changed()) pass def update_number_spinbox_valueChanged(self,a0): # some day we'll use this to set a user preferences, for now it's a no-op pass ########## End of slot methods for "Window" page widgets ########### ########## Slot methods for top level widgets ################ def show(self, pagename = ""): """ Display the Preferences dialog with page I{pagename}. @param pagename: Name of the Preferences page. Default is "General". @type pagename: string """ self.showPage(pagename) # Must use exec_() and not show() with self.modal=True. I tried it and # it doesn't work whenever the user is prompted by NE1 to enable # a plug-in via the Preferences dialog. -Mark 2008-05-22 self.exec_() return def showPage(self, pagename = ""): """ Show the current page of the Preferences dialog. If no page is selected from the Category tree widget, show the "General" page. @param pagename: Name of the Preferences page. Default is "General". Only names found in self.pagenameList are allowed. @type pagename: string @note: This is the slot method for the "Category" QTreeWidget. """ if not pagename: selectedItemsList = self.categoryTreeWidget.selectedItems() if selectedItemsList: selectedItem = selectedItemsList[0] pagename = str(selectedItem.text(0)) else: pagename = 'General' # Strip whitespaces, commas and dashes from pagename just before # checking for it in self.pagenameList. pagename = pagename.replace(" ", "") pagename = pagename.replace(",", "") pagename = pagename.replace("-", "") if not pagename in self.pagenameList: msg = 'Preferences page unknown: pagename =%s\n' \ 'pagename must be one of the following:\n%r\n' \ % (pagename, self.pagenameList) print_compact_traceback(msg) try: # Show page <pagename>. self.prefsStackedWidget.setCurrentIndex(self.pagenameList.index(pagename)) except: print_compact_traceback("Bug in showPage() ignored: ") self.setWindowTitle("Preferences - %s" % pagename) return def getPagenameList(self): """ Returns a list of page names (i.e. the "stack of widgets") inside prefsStackedWidget. @return: List of page names. @rtype: List @attention: Qt Designer assigns the QStackedWidget property "currentPageName" (which is not a formal attr) to the QWidget (page) attr "objectName". @see: U{B{QStackedWidget}<http://doc.trolltech.com/4/qstackedwidget.html>}. """ _pagenameList = [] for _widgetIndex in range(self.prefsStackedWidget.count()): _widget = self.prefsStackedWidget.widget(_widgetIndex) _pagename = str(_widget.objectName()) _pagenameList.append(_pagename) return _pagenameList def accept(self): """ The slot method for the 'OK' button. """ QDialog.accept(self) return def reject(self): """ The slot method for the "Cancel" button. """ # The Cancel button has been removed, but this still gets called # when the user hits the dialog's "Close" button in the dialog's # window border (upper right X). # Since I've not implemented 'Cancel', it is safer to go ahead and # save all preferences anyway. Otherwise, any changed preferences # will not be persistent (after this session). # This will need to be removed when we implement a true cancel function. # Mark 050629. QDialog.reject(self) return pass # end of class Preferences # end
NanoCAD-master
cad/src/ne1_ui/prefs/Preferences.py
NanoCAD-master
cad/src/ne1_ui/prefs/__init__.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'PreferencesDialog.ui' # # Created: Fri Dec 12 03:50:46 2008 # by: PyQt4 UI code generator 4.3.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_PreferencesDialog(object): def setupUi(self, PreferencesDialog): PreferencesDialog.setObjectName("PreferencesDialog") PreferencesDialog.resize(QtCore.QSize(QtCore.QRect(0,0,620,600).size()).expandedTo(PreferencesDialog.minimumSizeHint())) PreferencesDialog.setMinimumSize(QtCore.QSize(620,600)) self.gridlayout = QtGui.QGridLayout(PreferencesDialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.prefsTabWidget = QtGui.QTabWidget(PreferencesDialog) self.prefsTabWidget.setObjectName("prefsTabWidget") self.systemOptionsTab = QtGui.QWidget() self.systemOptionsTab.setObjectName("systemOptionsTab") self.hboxlayout = QtGui.QHBoxLayout(self.systemOptionsTab) self.hboxlayout.setMargin(9) self.hboxlayout.setSpacing(6) self.hboxlayout.setObjectName("hboxlayout") self.categoryTreeWidget = QtGui.QTreeWidget(self.systemOptionsTab) self.categoryTreeWidget.setWindowModality(QtCore.Qt.NonModal) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(7)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.categoryTreeWidget.sizePolicy().hasHeightForWidth()) self.categoryTreeWidget.setSizePolicy(sizePolicy) self.categoryTreeWidget.setMinimumSize(QtCore.QSize(170,0)) self.categoryTreeWidget.setObjectName("categoryTreeWidget") self.hboxlayout.addWidget(self.categoryTreeWidget) self.prefsStackedWidget = QtGui.QStackedWidget(self.systemOptionsTab) self.prefsStackedWidget.setObjectName("prefsStackedWidget") self.General = QtGui.QWidget() self.General.setObjectName("General") self.gridlayout1 = QtGui.QGridLayout(self.General) self.gridlayout1.setMargin(9) self.gridlayout1.setSpacing(6) self.gridlayout1.setObjectName("gridlayout1") self.vboxlayout = QtGui.QVBoxLayout() self.vboxlayout.setMargin(0) self.vboxlayout.setSpacing(4) self.vboxlayout.setObjectName("vboxlayout") self.sponsorLogosGroupBox = QtGui.QGroupBox(self.General) self.sponsorLogosGroupBox.setObjectName("sponsorLogosGroupBox") self.vboxlayout1 = QtGui.QVBoxLayout(self.sponsorLogosGroupBox) self.vboxlayout1.setMargin(9) self.vboxlayout1.setSpacing(0) self.vboxlayout1.setObjectName("vboxlayout1") self.logoAlwaysAskRadioBtn = QtGui.QRadioButton(self.sponsorLogosGroupBox) self.logoAlwaysAskRadioBtn.setObjectName("logoAlwaysAskRadioBtn") self.vboxlayout1.addWidget(self.logoAlwaysAskRadioBtn) self.logoNeverAskRadioBtn = QtGui.QRadioButton(self.sponsorLogosGroupBox) self.logoNeverAskRadioBtn.setObjectName("logoNeverAskRadioBtn") self.vboxlayout1.addWidget(self.logoNeverAskRadioBtn) self.logoNeverDownLoadRadioBtn = QtGui.QRadioButton(self.sponsorLogosGroupBox) self.logoNeverDownLoadRadioBtn.setObjectName("logoNeverDownLoadRadioBtn") self.vboxlayout1.addWidget(self.logoNeverDownLoadRadioBtn) self.vboxlayout.addWidget(self.sponsorLogosGroupBox) self.buildmode_groupbox = QtGui.QGroupBox(self.General) self.buildmode_groupbox.setObjectName("buildmode_groupbox") self.vboxlayout2 = QtGui.QVBoxLayout(self.buildmode_groupbox) self.vboxlayout2.setMargin(9) self.vboxlayout2.setSpacing(0) self.vboxlayout2.setObjectName("vboxlayout2") self.autobond_checkbox = QtGui.QCheckBox(self.buildmode_groupbox) self.autobond_checkbox.setObjectName("autobond_checkbox") self.vboxlayout2.addWidget(self.autobond_checkbox) self.buildmode_highlighting_checkbox = QtGui.QCheckBox(self.buildmode_groupbox) self.buildmode_highlighting_checkbox.setObjectName("buildmode_highlighting_checkbox") self.vboxlayout2.addWidget(self.buildmode_highlighting_checkbox) self.water_checkbox = QtGui.QCheckBox(self.buildmode_groupbox) self.water_checkbox.setObjectName("water_checkbox") self.vboxlayout2.addWidget(self.water_checkbox) self.buildmode_select_atoms_checkbox = QtGui.QCheckBox(self.buildmode_groupbox) self.buildmode_select_atoms_checkbox.setObjectName("buildmode_select_atoms_checkbox") self.vboxlayout2.addWidget(self.buildmode_select_atoms_checkbox) self.vboxlayout.addWidget(self.buildmode_groupbox) self.groupBox_2 = QtGui.QGroupBox(self.General) self.groupBox_2.setObjectName("groupBox_2") self.gridlayout2 = QtGui.QGridLayout(self.groupBox_2) self.gridlayout2.setMargin(9) self.gridlayout2.setSpacing(6) self.gridlayout2.setObjectName("gridlayout2") self.hboxlayout1 = QtGui.QHBoxLayout() self.hboxlayout1.setMargin(0) self.hboxlayout1.setSpacing(4) self.hboxlayout1.setObjectName("hboxlayout1") self.pasteOffsetForDna_lable = QtGui.QLabel(self.groupBox_2) self.pasteOffsetForDna_lable.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.pasteOffsetForDna_lable.setObjectName("pasteOffsetForDna_lable") self.hboxlayout1.addWidget(self.pasteOffsetForDna_lable) self.pasteOffsetScaleFactorForDnaObjects_doubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox_2) self.pasteOffsetScaleFactorForDnaObjects_doubleSpinBox.setObjectName("pasteOffsetScaleFactorForDnaObjects_doubleSpinBox") self.hboxlayout1.addWidget(self.pasteOffsetScaleFactorForDnaObjects_doubleSpinBox) self.gridlayout2.addLayout(self.hboxlayout1,1,0,1,1) self.hboxlayout2 = QtGui.QHBoxLayout() self.hboxlayout2.setMargin(0) self.hboxlayout2.setSpacing(4) self.hboxlayout2.setObjectName("hboxlayout2") self.pasteOffsetForChunks_lable = QtGui.QLabel(self.groupBox_2) self.pasteOffsetForChunks_lable.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.pasteOffsetForChunks_lable.setObjectName("pasteOffsetForChunks_lable") self.hboxlayout2.addWidget(self.pasteOffsetForChunks_lable) self.pasteOffsetScaleFactorForChunks_doubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox_2) self.pasteOffsetScaleFactorForChunks_doubleSpinBox.setObjectName("pasteOffsetScaleFactorForChunks_doubleSpinBox") self.hboxlayout2.addWidget(self.pasteOffsetScaleFactorForChunks_doubleSpinBox) self.gridlayout2.addLayout(self.hboxlayout2,0,0,1,1) self.vboxlayout.addWidget(self.groupBox_2) spacerItem = QtGui.QSpacerItem(20,1,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout.addItem(spacerItem) self.gridlayout1.addLayout(self.vboxlayout,0,0,1,1) spacerItem1 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout1.addItem(spacerItem1,0,1,1,1) self.prefsStackedWidget.addWidget(self.General) self.Color = QtGui.QWidget() self.Color.setObjectName("Color") self.gridlayout3 = QtGui.QGridLayout(self.Color) self.gridlayout3.setMargin(9) self.gridlayout3.setSpacing(6) self.gridlayout3.setObjectName("gridlayout3") spacerItem2 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout3.addItem(spacerItem2,0,1,1,1) self.vboxlayout3 = QtGui.QVBoxLayout() self.vboxlayout3.setMargin(0) self.vboxlayout3.setSpacing(4) self.vboxlayout3.setObjectName("vboxlayout3") self.backgroundGroupBox = QtGui.QGroupBox(self.Color) self.backgroundGroupBox.setObjectName("backgroundGroupBox") self.gridlayout4 = QtGui.QGridLayout(self.backgroundGroupBox) self.gridlayout4.setMargin(9) self.gridlayout4.setSpacing(6) self.gridlayout4.setObjectName("gridlayout4") self.enableFogCheckBox = QtGui.QCheckBox(self.backgroundGroupBox) self.enableFogCheckBox.setObjectName("enableFogCheckBox") self.gridlayout4.addWidget(self.enableFogCheckBox,1,0,1,1) self.hboxlayout3 = QtGui.QHBoxLayout() self.hboxlayout3.setMargin(0) self.hboxlayout3.setSpacing(4) self.hboxlayout3.setObjectName("hboxlayout3") self.label_8 = QtGui.QLabel(self.backgroundGroupBox) self.label_8.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_8.setObjectName("label_8") self.hboxlayout3.addWidget(self.label_8) self.backgroundColorComboBox = QtGui.QComboBox(self.backgroundGroupBox) self.backgroundColorComboBox.setObjectName("backgroundColorComboBox") self.hboxlayout3.addWidget(self.backgroundColorComboBox) self.gridlayout4.addLayout(self.hboxlayout3,0,0,1,1) self.vboxlayout3.addWidget(self.backgroundGroupBox) self.hoverHighlightingStyleGroupBox = QtGui.QGroupBox(self.Color) self.hoverHighlightingStyleGroupBox.setObjectName("hoverHighlightingStyleGroupBox") self.gridlayout5 = QtGui.QGridLayout(self.hoverHighlightingStyleGroupBox) self.gridlayout5.setMargin(9) self.gridlayout5.setSpacing(6) self.gridlayout5.setObjectName("gridlayout5") self.label_21 = QtGui.QLabel(self.hoverHighlightingStyleGroupBox) self.label_21.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_21.setObjectName("label_21") self.gridlayout5.addWidget(self.label_21,1,0,1,1) self.hboxlayout4 = QtGui.QHBoxLayout() self.hboxlayout4.setMargin(0) self.hboxlayout4.setSpacing(2) self.hboxlayout4.setObjectName("hboxlayout4") self.hoverHighlightingColorFrame = QtGui.QFrame(self.hoverHighlightingStyleGroupBox) self.hoverHighlightingColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.hoverHighlightingColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.hoverHighlightingColorFrame.setFrameShape(QtGui.QFrame.Box) self.hoverHighlightingColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.hoverHighlightingColorFrame.setObjectName("hoverHighlightingColorFrame") self.hboxlayout4.addWidget(self.hoverHighlightingColorFrame) self.hoverHighlightingColorButton = QtGui.QPushButton(self.hoverHighlightingStyleGroupBox) self.hoverHighlightingColorButton.setAutoDefault(False) self.hoverHighlightingColorButton.setObjectName("hoverHighlightingColorButton") self.hboxlayout4.addWidget(self.hoverHighlightingColorButton) self.gridlayout5.addLayout(self.hboxlayout4,1,1,1,1) self.hoverHighlightingStyleComboBox = QtGui.QComboBox(self.hoverHighlightingStyleGroupBox) self.hoverHighlightingStyleComboBox.setObjectName("hoverHighlightingStyleComboBox") self.gridlayout5.addWidget(self.hoverHighlightingStyleComboBox,0,0,1,2) self.vboxlayout3.addWidget(self.hoverHighlightingStyleGroupBox) self.selectionColorStyleGroupBox = QtGui.QGroupBox(self.Color) self.selectionColorStyleGroupBox.setObjectName("selectionColorStyleGroupBox") self.gridlayout6 = QtGui.QGridLayout(self.selectionColorStyleGroupBox) self.gridlayout6.setMargin(9) self.gridlayout6.setSpacing(6) self.gridlayout6.setObjectName("gridlayout6") self.label_22 = QtGui.QLabel(self.selectionColorStyleGroupBox) self.label_22.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_22.setObjectName("label_22") self.gridlayout6.addWidget(self.label_22,1,0,1,1) self.hboxlayout5 = QtGui.QHBoxLayout() self.hboxlayout5.setMargin(0) self.hboxlayout5.setSpacing(2) self.hboxlayout5.setObjectName("hboxlayout5") self.selectionColorFrame = QtGui.QFrame(self.selectionColorStyleGroupBox) self.selectionColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.selectionColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.selectionColorFrame.setFrameShape(QtGui.QFrame.Box) self.selectionColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.selectionColorFrame.setObjectName("selectionColorFrame") self.hboxlayout5.addWidget(self.selectionColorFrame) self.selectionColorButton = QtGui.QPushButton(self.selectionColorStyleGroupBox) self.selectionColorButton.setAutoDefault(False) self.selectionColorButton.setObjectName("selectionColorButton") self.hboxlayout5.addWidget(self.selectionColorButton) self.gridlayout6.addLayout(self.hboxlayout5,1,1,1,1) self.selectionStyleComboBox = QtGui.QComboBox(self.selectionColorStyleGroupBox) self.selectionStyleComboBox.setObjectName("selectionStyleComboBox") self.gridlayout6.addWidget(self.selectionStyleComboBox,0,0,1,2) self.vboxlayout3.addWidget(self.selectionColorStyleGroupBox) self.hboxlayout6 = QtGui.QHBoxLayout() self.hboxlayout6.setMargin(0) self.hboxlayout6.setSpacing(2) self.hboxlayout6.setObjectName("hboxlayout6") self.label_25 = QtGui.QLabel(self.Color) self.label_25.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_25.setObjectName("label_25") self.hboxlayout6.addWidget(self.label_25) self.haloWidthSpinBox = QtGui.QSpinBox(self.Color) self.haloWidthSpinBox.setMaximum(10) self.haloWidthSpinBox.setMinimum(1) self.haloWidthSpinBox.setProperty("value",QtCore.QVariant(5)) self.haloWidthSpinBox.setObjectName("haloWidthSpinBox") self.hboxlayout6.addWidget(self.haloWidthSpinBox) self.haloWidthResetButton = QtGui.QToolButton(self.Color) self.haloWidthResetButton.setIcon(QtGui.QIcon("../../../../../:icons/UserPrefsDialog_image0")) self.haloWidthResetButton.setObjectName("haloWidthResetButton") self.hboxlayout6.addWidget(self.haloWidthResetButton) spacerItem3 = QtGui.QSpacerItem(20,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout6.addItem(spacerItem3) self.vboxlayout3.addLayout(self.hboxlayout6) spacerItem4 = QtGui.QSpacerItem(20,16,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout3.addItem(spacerItem4) self.gridlayout3.addLayout(self.vboxlayout3,0,0,1,1) self.prefsStackedWidget.addWidget(self.Color) self.GraphicsArea = QtGui.QWidget() self.GraphicsArea.setObjectName("GraphicsArea") self.gridlayout7 = QtGui.QGridLayout(self.GraphicsArea) self.gridlayout7.setMargin(9) self.gridlayout7.setSpacing(6) self.gridlayout7.setObjectName("gridlayout7") self.vboxlayout4 = QtGui.QVBoxLayout() self.vboxlayout4.setMargin(0) self.vboxlayout4.setSpacing(4) self.vboxlayout4.setObjectName("vboxlayout4") self.hboxlayout7 = QtGui.QHBoxLayout() self.hboxlayout7.setMargin(0) self.hboxlayout7.setSpacing(2) self.hboxlayout7.setObjectName("hboxlayout7") self.label_9 = QtGui.QLabel(self.GraphicsArea) self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_9.setObjectName("label_9") self.hboxlayout7.addWidget(self.label_9) self.globalDisplayStyleStartupComboBox = QtGui.QComboBox(self.GraphicsArea) self.globalDisplayStyleStartupComboBox.setObjectName("globalDisplayStyleStartupComboBox") self.hboxlayout7.addWidget(self.globalDisplayStyleStartupComboBox) self.vboxlayout4.addLayout(self.hboxlayout7) self.compassGroupBox = QtGui.QGroupBox(self.GraphicsArea) self.compassGroupBox.setCheckable(True) self.compassGroupBox.setChecked(True) self.compassGroupBox.setObjectName("compassGroupBox") self.gridlayout8 = QtGui.QGridLayout(self.compassGroupBox) self.gridlayout8.setMargin(9) self.gridlayout8.setSpacing(6) self.gridlayout8.setObjectName("gridlayout8") spacerItem5 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout8.addItem(spacerItem5,0,1,1,1) self.vboxlayout5 = QtGui.QVBoxLayout() self.vboxlayout5.setMargin(0) self.vboxlayout5.setSpacing(0) self.vboxlayout5.setObjectName("vboxlayout5") self.hboxlayout8 = QtGui.QHBoxLayout() self.hboxlayout8.setMargin(0) self.hboxlayout8.setSpacing(4) self.hboxlayout8.setObjectName("hboxlayout8") self.textLabel1_4 = QtGui.QLabel(self.compassGroupBox) self.textLabel1_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_4.setObjectName("textLabel1_4") self.hboxlayout8.addWidget(self.textLabel1_4) self.compass_position_combox = QtGui.QComboBox(self.compassGroupBox) self.compass_position_combox.setObjectName("compass_position_combox") self.hboxlayout8.addWidget(self.compass_position_combox) self.vboxlayout5.addLayout(self.hboxlayout8) self.display_compass_labels_checkbox = QtGui.QCheckBox(self.compassGroupBox) self.display_compass_labels_checkbox.setChecked(True) self.display_compass_labels_checkbox.setObjectName("display_compass_labels_checkbox") self.vboxlayout5.addWidget(self.display_compass_labels_checkbox) self.gridlayout8.addLayout(self.vboxlayout5,0,0,1,1) self.vboxlayout4.addWidget(self.compassGroupBox) self.groupBox7_2 = QtGui.QGroupBox(self.GraphicsArea) self.groupBox7_2.setObjectName("groupBox7_2") self.gridlayout9 = QtGui.QGridLayout(self.groupBox7_2) self.gridlayout9.setMargin(9) self.gridlayout9.setSpacing(6) self.gridlayout9.setObjectName("gridlayout9") self.display_pov_axis_checkbox = QtGui.QCheckBox(self.groupBox7_2) self.display_pov_axis_checkbox.setChecked(False) self.display_pov_axis_checkbox.setObjectName("display_pov_axis_checkbox") self.gridlayout9.addWidget(self.display_pov_axis_checkbox,1,0,1,1) self.display_origin_axis_checkbox = QtGui.QCheckBox(self.groupBox7_2) self.display_origin_axis_checkbox.setChecked(True) self.display_origin_axis_checkbox.setObjectName("display_origin_axis_checkbox") self.gridlayout9.addWidget(self.display_origin_axis_checkbox,0,0,1,1) self.vboxlayout4.addWidget(self.groupBox7_2) self.cursorTextGroupBox = QtGui.QGroupBox(self.GraphicsArea) self.cursorTextGroupBox.setCheckable(True) self.cursorTextGroupBox.setObjectName("cursorTextGroupBox") self.hboxlayout9 = QtGui.QHBoxLayout(self.cursorTextGroupBox) self.hboxlayout9.setMargin(9) self.hboxlayout9.setSpacing(4) self.hboxlayout9.setObjectName("hboxlayout9") self.gridlayout10 = QtGui.QGridLayout() self.gridlayout10.setMargin(0) self.gridlayout10.setSpacing(6) self.gridlayout10.setObjectName("gridlayout10") self.label_2 = QtGui.QLabel(self.cursorTextGroupBox) self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_2.setObjectName("label_2") self.gridlayout10.addWidget(self.label_2,0,0,1,1) self.hboxlayout10 = QtGui.QHBoxLayout() self.hboxlayout10.setMargin(0) self.hboxlayout10.setSpacing(2) self.hboxlayout10.setObjectName("hboxlayout10") self.cursorTextFontSizeSpinBox = QtGui.QSpinBox(self.cursorTextGroupBox) self.cursorTextFontSizeSpinBox.setMaximum(16) self.cursorTextFontSizeSpinBox.setMinimum(8) self.cursorTextFontSizeSpinBox.setProperty("value",QtCore.QVariant(11)) self.cursorTextFontSizeSpinBox.setObjectName("cursorTextFontSizeSpinBox") self.hboxlayout10.addWidget(self.cursorTextFontSizeSpinBox) self.cursorTextFontSizeResetButton = QtGui.QToolButton(self.cursorTextGroupBox) self.cursorTextFontSizeResetButton.setIcon(QtGui.QIcon("../../../../../:icons/UserPrefsDialog_image0")) self.cursorTextFontSizeResetButton.setObjectName("cursorTextFontSizeResetButton") self.hboxlayout10.addWidget(self.cursorTextFontSizeResetButton) self.gridlayout10.addLayout(self.hboxlayout10,0,1,1,1) self.label_26 = QtGui.QLabel(self.cursorTextGroupBox) self.label_26.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_26.setObjectName("label_26") self.gridlayout10.addWidget(self.label_26,1,0,1,1) self.hboxlayout11 = QtGui.QHBoxLayout() self.hboxlayout11.setMargin(0) self.hboxlayout11.setSpacing(2) self.hboxlayout11.setObjectName("hboxlayout11") self.cursorTextColorFrame = QtGui.QFrame(self.cursorTextGroupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.cursorTextColorFrame.sizePolicy().hasHeightForWidth()) self.cursorTextColorFrame.setSizePolicy(sizePolicy) self.cursorTextColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.cursorTextColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.cursorTextColorFrame.setFrameShape(QtGui.QFrame.Box) self.cursorTextColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.cursorTextColorFrame.setObjectName("cursorTextColorFrame") self.hboxlayout11.addWidget(self.cursorTextColorFrame) self.cursorTextColorButton = QtGui.QPushButton(self.cursorTextGroupBox) self.cursorTextColorButton.setAutoDefault(False) self.cursorTextColorButton.setObjectName("cursorTextColorButton") self.hboxlayout11.addWidget(self.cursorTextColorButton) self.gridlayout10.addLayout(self.hboxlayout11,1,1,1,1) self.hboxlayout9.addLayout(self.gridlayout10) spacerItem6 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout9.addItem(spacerItem6) self.vboxlayout4.addWidget(self.cursorTextGroupBox) self.vboxlayout6 = QtGui.QVBoxLayout() self.vboxlayout6.setMargin(0) self.vboxlayout6.setSpacing(0) self.vboxlayout6.setObjectName("vboxlayout6") self.display_confirmation_corner_checkbox = QtGui.QCheckBox(self.GraphicsArea) self.display_confirmation_corner_checkbox.setChecked(False) self.display_confirmation_corner_checkbox.setObjectName("display_confirmation_corner_checkbox") self.vboxlayout6.addWidget(self.display_confirmation_corner_checkbox) self.enable_antialiasing_checkbox = QtGui.QCheckBox(self.GraphicsArea) self.enable_antialiasing_checkbox.setObjectName("enable_antialiasing_checkbox") self.vboxlayout6.addWidget(self.enable_antialiasing_checkbox) self.vboxlayout4.addLayout(self.vboxlayout6) spacerItem7 = QtGui.QSpacerItem(223,111,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout4.addItem(spacerItem7) self.gridlayout7.addLayout(self.vboxlayout4,0,0,1,1) spacerItem8 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout7.addItem(spacerItem8,0,1,1,1) self.prefsStackedWidget.addWidget(self.GraphicsArea) self.ZoomPanandRotate = QtGui.QWidget() self.ZoomPanandRotate.setObjectName("ZoomPanandRotate") self.gridlayout11 = QtGui.QGridLayout(self.ZoomPanandRotate) self.gridlayout11.setMargin(9) self.gridlayout11.setSpacing(6) self.gridlayout11.setObjectName("gridlayout11") spacerItem9 = QtGui.QSpacerItem(231,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout11.addItem(spacerItem9,0,1,1,1) self.vboxlayout7 = QtGui.QVBoxLayout() self.vboxlayout7.setMargin(0) self.vboxlayout7.setSpacing(4) self.vboxlayout7.setObjectName("vboxlayout7") self.groupBox8 = QtGui.QGroupBox(self.ZoomPanandRotate) self.groupBox8.setObjectName("groupBox8") self.gridlayout12 = QtGui.QGridLayout(self.groupBox8) self.gridlayout12.setMargin(9) self.gridlayout12.setSpacing(6) self.gridlayout12.setObjectName("gridlayout12") self.hboxlayout12 = QtGui.QHBoxLayout() self.hboxlayout12.setMargin(0) self.hboxlayout12.setSpacing(4) self.hboxlayout12.setObjectName("hboxlayout12") self.vboxlayout8 = QtGui.QVBoxLayout() self.vboxlayout8.setMargin(0) self.vboxlayout8.setSpacing(0) self.vboxlayout8.setObjectName("vboxlayout8") spacerItem10 = QtGui.QSpacerItem(101,20,QtGui.QSizePolicy.Fixed,QtGui.QSizePolicy.Minimum) self.vboxlayout8.addItem(spacerItem10) self.textLabel1_5 = QtGui.QLabel(self.groupBox8) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.textLabel1_5.sizePolicy().hasHeightForWidth()) self.textLabel1_5.setSizePolicy(sizePolicy) self.textLabel1_5.setScaledContents(False) self.textLabel1_5.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_5.setObjectName("textLabel1_5") self.vboxlayout8.addWidget(self.textLabel1_5) spacerItem11 = QtGui.QSpacerItem(101,20,QtGui.QSizePolicy.Fixed,QtGui.QSizePolicy.Minimum) self.vboxlayout8.addItem(spacerItem11) self.rotationSensitivity_txtlbl = QtGui.QLabel(self.groupBox8) self.rotationSensitivity_txtlbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.rotationSensitivity_txtlbl.setObjectName("rotationSensitivity_txtlbl") self.vboxlayout8.addWidget(self.rotationSensitivity_txtlbl) self.hboxlayout12.addLayout(self.vboxlayout8) self.gridlayout13 = QtGui.QGridLayout() self.gridlayout13.setMargin(0) self.gridlayout13.setSpacing(6) self.gridlayout13.setObjectName("gridlayout13") spacerItem12 = QtGui.QSpacerItem(87,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout13.addItem(spacerItem12,2,1,1,1) self.resetAnimationSpeed_btn = QtGui.QToolButton(self.groupBox8) self.resetAnimationSpeed_btn.setEnabled(False) self.resetAnimationSpeed_btn.setIcon(QtGui.QIcon("../../../../../:icons/UserPrefsDialog_image0")) self.resetAnimationSpeed_btn.setObjectName("resetAnimationSpeed_btn") self.gridlayout13.addWidget(self.resetAnimationSpeed_btn,1,3,1,1) spacerItem13 = QtGui.QSpacerItem(23,16,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout13.addItem(spacerItem13,2,3,1,1) spacerItem14 = QtGui.QSpacerItem(23,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout13.addItem(spacerItem14,0,3,1,1) self.textLabel3_4 = QtGui.QLabel(self.groupBox8) self.textLabel3_4.setObjectName("textLabel3_4") self.gridlayout13.addWidget(self.textLabel3_4,0,2,1,1) self.mouseSpeedDuringRotation_slider = QtGui.QSlider(self.groupBox8) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.mouseSpeedDuringRotation_slider.sizePolicy().hasHeightForWidth()) self.mouseSpeedDuringRotation_slider.setSizePolicy(sizePolicy) self.mouseSpeedDuringRotation_slider.setMinimumSize(QtCore.QSize(125,0)) self.mouseSpeedDuringRotation_slider.setMinimum(30) self.mouseSpeedDuringRotation_slider.setMaximum(100) self.mouseSpeedDuringRotation_slider.setProperty("value",QtCore.QVariant(50)) self.mouseSpeedDuringRotation_slider.setOrientation(QtCore.Qt.Horizontal) self.mouseSpeedDuringRotation_slider.setObjectName("mouseSpeedDuringRotation_slider") self.gridlayout13.addWidget(self.mouseSpeedDuringRotation_slider,3,0,1,3) self.textLabel3_4_2 = QtGui.QLabel(self.groupBox8) self.textLabel3_4_2.setObjectName("textLabel3_4_2") self.gridlayout13.addWidget(self.textLabel3_4_2,2,2,1,1) spacerItem15 = QtGui.QSpacerItem(88,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout13.addItem(spacerItem15,0,1,1,1) self.textLabel2_3_2 = QtGui.QLabel(self.groupBox8) self.textLabel2_3_2.setObjectName("textLabel2_3_2") self.gridlayout13.addWidget(self.textLabel2_3_2,2,0,1,1) self.animation_speed_slider = QtGui.QSlider(self.groupBox8) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.animation_speed_slider.sizePolicy().hasHeightForWidth()) self.animation_speed_slider.setSizePolicy(sizePolicy) self.animation_speed_slider.setMinimumSize(QtCore.QSize(125,0)) self.animation_speed_slider.setMinimum(-300) self.animation_speed_slider.setMaximum(-25) self.animation_speed_slider.setOrientation(QtCore.Qt.Horizontal) self.animation_speed_slider.setObjectName("animation_speed_slider") self.gridlayout13.addWidget(self.animation_speed_slider,1,0,1,3) self.resetMouseSpeedDuringRotation_btn = QtGui.QToolButton(self.groupBox8) self.resetMouseSpeedDuringRotation_btn.setEnabled(False) self.resetMouseSpeedDuringRotation_btn.setIcon(QtGui.QIcon("../../../../../:icons/UserPrefsDialog_image0")) self.resetMouseSpeedDuringRotation_btn.setObjectName("resetMouseSpeedDuringRotation_btn") self.gridlayout13.addWidget(self.resetMouseSpeedDuringRotation_btn,3,3,1,1) self.textLabel2_3 = QtGui.QLabel(self.groupBox8) self.textLabel2_3.setObjectName("textLabel2_3") self.gridlayout13.addWidget(self.textLabel2_3,0,0,1,1) self.hboxlayout12.addLayout(self.gridlayout13) self.gridlayout12.addLayout(self.hboxlayout12,1,0,1,1) self.hboxlayout13 = QtGui.QHBoxLayout() self.hboxlayout13.setMargin(0) self.hboxlayout13.setSpacing(0) self.hboxlayout13.setObjectName("hboxlayout13") self.animate_views_checkbox = QtGui.QCheckBox(self.groupBox8) self.animate_views_checkbox.setChecked(True) self.animate_views_checkbox.setObjectName("animate_views_checkbox") self.hboxlayout13.addWidget(self.animate_views_checkbox) spacerItem16 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout13.addItem(spacerItem16) self.gridlayout12.addLayout(self.hboxlayout13,0,0,1,1) self.vboxlayout7.addWidget(self.groupBox8) self.groupBox_4 = QtGui.QGroupBox(self.ZoomPanandRotate) self.groupBox_4.setObjectName("groupBox_4") self.gridlayout14 = QtGui.QGridLayout(self.groupBox_4) self.gridlayout14.setMargin(9) self.gridlayout14.setSpacing(6) self.gridlayout14.setObjectName("gridlayout14") self.hboxlayout14 = QtGui.QHBoxLayout() self.hboxlayout14.setMargin(0) self.hboxlayout14.setSpacing(4) self.hboxlayout14.setObjectName("hboxlayout14") self.vboxlayout9 = QtGui.QVBoxLayout() self.vboxlayout9.setMargin(0) self.vboxlayout9.setSpacing(4) self.vboxlayout9.setObjectName("vboxlayout9") self.label_19 = QtGui.QLabel(self.groupBox_4) self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_19.setObjectName("label_19") self.vboxlayout9.addWidget(self.label_19) self.label_17 = QtGui.QLabel(self.groupBox_4) self.label_17.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_17.setObjectName("label_17") self.vboxlayout9.addWidget(self.label_17) self.label_18 = QtGui.QLabel(self.groupBox_4) self.label_18.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_18.setObjectName("label_18") self.vboxlayout9.addWidget(self.label_18) self.hboxlayout14.addLayout(self.vboxlayout9) self.vboxlayout10 = QtGui.QVBoxLayout() self.vboxlayout10.setMargin(0) self.vboxlayout10.setSpacing(4) self.vboxlayout10.setObjectName("vboxlayout10") self.mouseWheelDirectionComboBox = QtGui.QComboBox(self.groupBox_4) self.mouseWheelDirectionComboBox.setObjectName("mouseWheelDirectionComboBox") self.vboxlayout10.addWidget(self.mouseWheelDirectionComboBox) self.mouseWheelZoomInPointComboBox = QtGui.QComboBox(self.groupBox_4) self.mouseWheelZoomInPointComboBox.setObjectName("mouseWheelZoomInPointComboBox") self.vboxlayout10.addWidget(self.mouseWheelZoomInPointComboBox) self.mouseWheelZoomOutPointComboBox = QtGui.QComboBox(self.groupBox_4) self.mouseWheelZoomOutPointComboBox.setObjectName("mouseWheelZoomOutPointComboBox") self.vboxlayout10.addWidget(self.mouseWheelZoomOutPointComboBox) self.hboxlayout14.addLayout(self.vboxlayout10) self.gridlayout14.addLayout(self.hboxlayout14,0,0,1,1) self.hboxlayout15 = QtGui.QHBoxLayout() self.hboxlayout15.setMargin(0) self.hboxlayout15.setSpacing(4) self.hboxlayout15.setObjectName("hboxlayout15") self.label_20 = QtGui.QLabel(self.groupBox_4) self.label_20.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_20.setObjectName("label_20") self.hboxlayout15.addWidget(self.label_20) self.hhTimeoutIntervalDoubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox_4) self.hhTimeoutIntervalDoubleSpinBox.setDecimals(1) self.hhTimeoutIntervalDoubleSpinBox.setMaximum(1.0) self.hhTimeoutIntervalDoubleSpinBox.setSingleStep(0.1) self.hhTimeoutIntervalDoubleSpinBox.setProperty("value",QtCore.QVariant(0.5)) self.hhTimeoutIntervalDoubleSpinBox.setObjectName("hhTimeoutIntervalDoubleSpinBox") self.hboxlayout15.addWidget(self.hhTimeoutIntervalDoubleSpinBox) self.gridlayout14.addLayout(self.hboxlayout15,1,0,1,1) self.vboxlayout7.addWidget(self.groupBox_4) self.panSettingsGroupBox = QtGui.QGroupBox(self.ZoomPanandRotate) self.panSettingsGroupBox.setObjectName("panSettingsGroupBox") self.gridlayout15 = QtGui.QGridLayout(self.panSettingsGroupBox) self.gridlayout15.setMargin(9) self.gridlayout15.setSpacing(6) self.gridlayout15.setObjectName("gridlayout15") self.panArrowKeysDirectionComboBox = QtGui.QComboBox(self.panSettingsGroupBox) self.panArrowKeysDirectionComboBox.setObjectName("panArrowKeysDirectionComboBox") self.gridlayout15.addWidget(self.panArrowKeysDirectionComboBox,0,1,1,1) self.label_28 = QtGui.QLabel(self.panSettingsGroupBox) self.label_28.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_28.setObjectName("label_28") self.gridlayout15.addWidget(self.label_28,0,0,1,1) self.vboxlayout7.addWidget(self.panSettingsGroupBox) spacerItem17 = QtGui.QSpacerItem(20,161,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout7.addItem(spacerItem17) self.gridlayout11.addLayout(self.vboxlayout7,0,0,1,1) self.prefsStackedWidget.addWidget(self.ZoomPanandRotate) self.Rulers = QtGui.QWidget() self.Rulers.setObjectName("Rulers") self.gridlayout16 = QtGui.QGridLayout(self.Rulers) self.gridlayout16.setMargin(9) self.gridlayout16.setSpacing(6) self.gridlayout16.setObjectName("gridlayout16") spacerItem18 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout16.addItem(spacerItem18,0,1,1,1) self.vboxlayout11 = QtGui.QVBoxLayout() self.vboxlayout11.setMargin(0) self.vboxlayout11.setSpacing(6) self.vboxlayout11.setObjectName("vboxlayout11") self.rulersGroupBox = QtGui.QGroupBox(self.Rulers) self.rulersGroupBox.setObjectName("rulersGroupBox") self.gridlayout17 = QtGui.QGridLayout(self.rulersGroupBox) self.gridlayout17.setMargin(9) self.gridlayout17.setSpacing(6) self.gridlayout17.setObjectName("gridlayout17") self.label_5 = QtGui.QLabel(self.rulersGroupBox) self.label_5.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_5.setObjectName("label_5") self.gridlayout17.addWidget(self.label_5,3,0,1,1) self.textLabel3_2_4 = QtGui.QLabel(self.rulersGroupBox) self.textLabel3_2_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel3_2_4.setObjectName("textLabel3_2_4") self.gridlayout17.addWidget(self.textLabel3_2_4,2,0,1,1) self.label_10 = QtGui.QLabel(self.rulersGroupBox) self.label_10.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_10.setObjectName("label_10") self.gridlayout17.addWidget(self.label_10,1,0,1,1) self.rulerPositionComboBox = QtGui.QComboBox(self.rulersGroupBox) self.rulerPositionComboBox.setObjectName("rulerPositionComboBox") self.gridlayout17.addWidget(self.rulerPositionComboBox,1,1,1,1) self.hboxlayout16 = QtGui.QHBoxLayout() self.hboxlayout16.setMargin(0) self.hboxlayout16.setSpacing(4) self.hboxlayout16.setObjectName("hboxlayout16") self.ruler_color_frame = QtGui.QFrame(self.rulersGroupBox) self.ruler_color_frame.setMinimumSize(QtCore.QSize(23,23)) self.ruler_color_frame.setMaximumSize(QtCore.QSize(23,23)) self.ruler_color_frame.setFrameShape(QtGui.QFrame.Box) self.ruler_color_frame.setFrameShadow(QtGui.QFrame.Plain) self.ruler_color_frame.setObjectName("ruler_color_frame") self.hboxlayout16.addWidget(self.ruler_color_frame) self.ruler_color_btn = QtGui.QPushButton(self.rulersGroupBox) self.ruler_color_btn.setAutoDefault(False) self.ruler_color_btn.setObjectName("ruler_color_btn") self.hboxlayout16.addWidget(self.ruler_color_btn) self.gridlayout17.addLayout(self.hboxlayout16,2,1,1,1) self.rulerOpacitySpinBox = QtGui.QSpinBox(self.rulersGroupBox) self.rulerOpacitySpinBox.setMaximum(100) self.rulerOpacitySpinBox.setProperty("value",QtCore.QVariant(70)) self.rulerOpacitySpinBox.setObjectName("rulerOpacitySpinBox") self.gridlayout17.addWidget(self.rulerOpacitySpinBox,3,1,1,1) self.rulerDisplayComboBox = QtGui.QComboBox(self.rulersGroupBox) self.rulerDisplayComboBox.setObjectName("rulerDisplayComboBox") self.gridlayout17.addWidget(self.rulerDisplayComboBox,0,1,1,1) self.label_12 = QtGui.QLabel(self.rulersGroupBox) self.label_12.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_12.setObjectName("label_12") self.gridlayout17.addWidget(self.label_12,0,0,1,1) self.showRulersInPerspectiveViewCheckBox = QtGui.QCheckBox(self.rulersGroupBox) self.showRulersInPerspectiveViewCheckBox.setObjectName("showRulersInPerspectiveViewCheckBox") self.gridlayout17.addWidget(self.showRulersInPerspectiveViewCheckBox,4,0,1,2) self.vboxlayout11.addWidget(self.rulersGroupBox) spacerItem19 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout11.addItem(spacerItem19) self.gridlayout16.addLayout(self.vboxlayout11,0,0,1,1) self.prefsStackedWidget.addWidget(self.Rulers) self.Atoms = QtGui.QWidget() self.Atoms.setObjectName("Atoms") self.gridlayout18 = QtGui.QGridLayout(self.Atoms) self.gridlayout18.setMargin(9) self.gridlayout18.setSpacing(6) self.gridlayout18.setObjectName("gridlayout18") spacerItem20 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout18.addItem(spacerItem20,0,1,1,1) self.vboxlayout12 = QtGui.QVBoxLayout() self.vboxlayout12.setMargin(0) self.vboxlayout12.setSpacing(6) self.vboxlayout12.setObjectName("vboxlayout12") self.atom_colors_grpbox = QtGui.QGroupBox(self.Atoms) self.atom_colors_grpbox.setObjectName("atom_colors_grpbox") self.vboxlayout13 = QtGui.QVBoxLayout(self.atom_colors_grpbox) self.vboxlayout13.setMargin(9) self.vboxlayout13.setSpacing(2) self.vboxlayout13.setObjectName("vboxlayout13") self.hboxlayout17 = QtGui.QHBoxLayout() self.hboxlayout17.setMargin(0) self.hboxlayout17.setSpacing(6) self.hboxlayout17.setObjectName("hboxlayout17") spacerItem21 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout17.addItem(spacerItem21) self.change_element_colors_btn = QtGui.QPushButton(self.atom_colors_grpbox) self.change_element_colors_btn.setAutoDefault(False) self.change_element_colors_btn.setObjectName("change_element_colors_btn") self.hboxlayout17.addWidget(self.change_element_colors_btn) self.vboxlayout13.addLayout(self.hboxlayout17) self.groupBox13 = QtGui.QGroupBox(self.atom_colors_grpbox) self.groupBox13.setObjectName("groupBox13") self.vboxlayout14 = QtGui.QVBoxLayout(self.groupBox13) self.vboxlayout14.setMargin(9) self.vboxlayout14.setSpacing(2) self.vboxlayout14.setObjectName("vboxlayout14") self.gridlayout19 = QtGui.QGridLayout() self.gridlayout19.setMargin(0) self.gridlayout19.setSpacing(6) self.gridlayout19.setObjectName("gridlayout19") self.hboxlayout18 = QtGui.QHBoxLayout() self.hboxlayout18.setMargin(0) self.hboxlayout18.setSpacing(4) self.hboxlayout18.setObjectName("hboxlayout18") self.atom_hilite_color_frame = QtGui.QFrame(self.groupBox13) self.atom_hilite_color_frame.setMinimumSize(QtCore.QSize(23,23)) self.atom_hilite_color_frame.setMaximumSize(QtCore.QSize(23,23)) self.atom_hilite_color_frame.setFrameShape(QtGui.QFrame.Box) self.atom_hilite_color_frame.setFrameShadow(QtGui.QFrame.Plain) self.atom_hilite_color_frame.setObjectName("atom_hilite_color_frame") self.hboxlayout18.addWidget(self.atom_hilite_color_frame) self.atom_hilite_color_btn = QtGui.QPushButton(self.groupBox13) self.atom_hilite_color_btn.setAutoDefault(False) self.atom_hilite_color_btn.setObjectName("atom_hilite_color_btn") self.hboxlayout18.addWidget(self.atom_hilite_color_btn) self.gridlayout19.addLayout(self.hboxlayout18,0,1,1,1) self.hotspot_lbl_2 = QtGui.QLabel(self.groupBox13) self.hotspot_lbl_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.hotspot_lbl_2.setObjectName("hotspot_lbl_2") self.gridlayout19.addWidget(self.hotspot_lbl_2,1,0,1,1) self.hboxlayout19 = QtGui.QHBoxLayout() self.hboxlayout19.setMargin(0) self.hboxlayout19.setSpacing(4) self.hboxlayout19.setObjectName("hboxlayout19") self.hotspot_color_frame = QtGui.QFrame(self.groupBox13) self.hotspot_color_frame.setMinimumSize(QtCore.QSize(23,23)) self.hotspot_color_frame.setMaximumSize(QtCore.QSize(23,23)) self.hotspot_color_frame.setFrameShape(QtGui.QFrame.Box) self.hotspot_color_frame.setFrameShadow(QtGui.QFrame.Plain) self.hotspot_color_frame.setObjectName("hotspot_color_frame") self.hboxlayout19.addWidget(self.hotspot_color_frame) self.hotspot_color_btn = QtGui.QPushButton(self.groupBox13) self.hotspot_color_btn.setAutoDefault(False) self.hotspot_color_btn.setObjectName("hotspot_color_btn") self.hboxlayout19.addWidget(self.hotspot_color_btn) self.gridlayout19.addLayout(self.hboxlayout19,2,1,1,1) self.textLabel3_2_3 = QtGui.QLabel(self.groupBox13) self.textLabel3_2_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel3_2_3.setObjectName("textLabel3_2_3") self.gridlayout19.addWidget(self.textLabel3_2_3,0,0,1,1) self.hboxlayout20 = QtGui.QHBoxLayout() self.hboxlayout20.setMargin(0) self.hboxlayout20.setSpacing(4) self.hboxlayout20.setObjectName("hboxlayout20") self.bondpoint_hilite_color_frame = QtGui.QFrame(self.groupBox13) self.bondpoint_hilite_color_frame.setMinimumSize(QtCore.QSize(23,23)) self.bondpoint_hilite_color_frame.setMaximumSize(QtCore.QSize(23,23)) self.bondpoint_hilite_color_frame.setFrameShape(QtGui.QFrame.Box) self.bondpoint_hilite_color_frame.setFrameShadow(QtGui.QFrame.Plain) self.bondpoint_hilite_color_frame.setObjectName("bondpoint_hilite_color_frame") self.hboxlayout20.addWidget(self.bondpoint_hilite_color_frame) self.bondpoint_hilite_color_btn = QtGui.QPushButton(self.groupBox13) self.bondpoint_hilite_color_btn.setAutoDefault(False) self.bondpoint_hilite_color_btn.setDefault(False) self.bondpoint_hilite_color_btn.setObjectName("bondpoint_hilite_color_btn") self.hboxlayout20.addWidget(self.bondpoint_hilite_color_btn) self.gridlayout19.addLayout(self.hboxlayout20,1,1,1,1) self.hotspot_lbl = QtGui.QLabel(self.groupBox13) self.hotspot_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.hotspot_lbl.setObjectName("hotspot_lbl") self.gridlayout19.addWidget(self.hotspot_lbl,2,0,1,1) self.vboxlayout14.addLayout(self.gridlayout19) self.hboxlayout21 = QtGui.QHBoxLayout() self.hboxlayout21.setMargin(0) self.hboxlayout21.setSpacing(6) self.hboxlayout21.setObjectName("hboxlayout21") spacerItem22 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout21.addItem(spacerItem22) self.reset_atom_colors_btn = QtGui.QPushButton(self.groupBox13) self.reset_atom_colors_btn.setAutoDefault(False) self.reset_atom_colors_btn.setObjectName("reset_atom_colors_btn") self.hboxlayout21.addWidget(self.reset_atom_colors_btn) self.vboxlayout14.addLayout(self.hboxlayout21) self.vboxlayout13.addWidget(self.groupBox13) self.vboxlayout12.addWidget(self.atom_colors_grpbox) self.hboxlayout22 = QtGui.QHBoxLayout() self.hboxlayout22.setMargin(0) self.hboxlayout22.setSpacing(6) self.hboxlayout22.setObjectName("hboxlayout22") self.gridlayout20 = QtGui.QGridLayout() self.gridlayout20.setMargin(0) self.gridlayout20.setSpacing(6) self.gridlayout20.setObjectName("gridlayout20") self.vboxlayout15 = QtGui.QVBoxLayout() self.vboxlayout15.setMargin(0) self.vboxlayout15.setSpacing(2) self.vboxlayout15.setObjectName("vboxlayout15") self.textLabel1_3_2 = QtGui.QLabel(self.Atoms) self.textLabel1_3_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_3_2.setObjectName("textLabel1_3_2") self.vboxlayout15.addWidget(self.textLabel1_3_2) self.textLabel1_3_2_2 = QtGui.QLabel(self.Atoms) self.textLabel1_3_2_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_3_2_2.setObjectName("textLabel1_3_2_2") self.vboxlayout15.addWidget(self.textLabel1_3_2_2) self.gridlayout20.addLayout(self.vboxlayout15,1,0,1,1) self.level_of_detail_combox = QtGui.QComboBox(self.Atoms) self.level_of_detail_combox.setObjectName("level_of_detail_combox") self.gridlayout20.addWidget(self.level_of_detail_combox,0,1,1,1) self.textLabel1_7 = QtGui.QLabel(self.Atoms) self.textLabel1_7.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_7.setObjectName("textLabel1_7") self.gridlayout20.addWidget(self.textLabel1_7,0,0,1,1) self.gridlayout21 = QtGui.QGridLayout() self.gridlayout21.setMargin(0) self.gridlayout21.setSpacing(6) self.gridlayout21.setObjectName("gridlayout21") self.reset_cpk_scale_factor_btn = QtGui.QToolButton(self.Atoms) self.reset_cpk_scale_factor_btn.setIcon(QtGui.QIcon("../../../../../:icons/UserPrefsDialog_image0")) self.reset_cpk_scale_factor_btn.setObjectName("reset_cpk_scale_factor_btn") self.gridlayout21.addWidget(self.reset_cpk_scale_factor_btn,1,1,1,1) self.reset_ballstick_scale_factor_btn = QtGui.QToolButton(self.Atoms) self.reset_ballstick_scale_factor_btn.setIcon(QtGui.QIcon("../../../../../:icons/UserPrefsDialog_image0")) self.reset_ballstick_scale_factor_btn.setObjectName("reset_ballstick_scale_factor_btn") self.gridlayout21.addWidget(self.reset_ballstick_scale_factor_btn,0,1,1,1) self.ballStickAtomScaleFactorSpinBox = QtGui.QSpinBox(self.Atoms) self.ballStickAtomScaleFactorSpinBox.setMaximum(125) self.ballStickAtomScaleFactorSpinBox.setMinimum(50) self.ballStickAtomScaleFactorSpinBox.setProperty("value",QtCore.QVariant(100)) self.ballStickAtomScaleFactorSpinBox.setObjectName("ballStickAtomScaleFactorSpinBox") self.gridlayout21.addWidget(self.ballStickAtomScaleFactorSpinBox,0,0,1,1) self.cpkAtomScaleFactorDoubleSpinBox = QtGui.QDoubleSpinBox(self.Atoms) self.cpkAtomScaleFactorDoubleSpinBox.setDecimals(3) self.cpkAtomScaleFactorDoubleSpinBox.setMaximum(1.0) self.cpkAtomScaleFactorDoubleSpinBox.setMinimum(0.5) self.cpkAtomScaleFactorDoubleSpinBox.setSingleStep(0.005) self.cpkAtomScaleFactorDoubleSpinBox.setProperty("value",QtCore.QVariant(0.775)) self.cpkAtomScaleFactorDoubleSpinBox.setObjectName("cpkAtomScaleFactorDoubleSpinBox") self.gridlayout21.addWidget(self.cpkAtomScaleFactorDoubleSpinBox,1,0,1,1) self.gridlayout20.addLayout(self.gridlayout21,1,1,1,1) self.hboxlayout22.addLayout(self.gridlayout20) spacerItem23 = QtGui.QSpacerItem(16,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout22.addItem(spacerItem23) self.vboxlayout12.addLayout(self.hboxlayout22) self.overlappingAtomIndicatorsCheckBox = QtGui.QCheckBox(self.Atoms) self.overlappingAtomIndicatorsCheckBox.setObjectName("overlappingAtomIndicatorsCheckBox") self.vboxlayout12.addWidget(self.overlappingAtomIndicatorsCheckBox) self.keepBondsTransmuteCheckBox = QtGui.QCheckBox(self.Atoms) self.keepBondsTransmuteCheckBox.setObjectName("keepBondsTransmuteCheckBox") self.vboxlayout12.addWidget(self.keepBondsTransmuteCheckBox) spacerItem24 = QtGui.QSpacerItem(20,30,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout12.addItem(spacerItem24) self.gridlayout18.addLayout(self.vboxlayout12,0,0,1,1) self.prefsStackedWidget.addWidget(self.Atoms) self.Bonds = QtGui.QWidget() self.Bonds.setObjectName("Bonds") self.gridlayout22 = QtGui.QGridLayout(self.Bonds) self.gridlayout22.setMargin(9) self.gridlayout22.setSpacing(6) self.gridlayout22.setObjectName("gridlayout22") spacerItem25 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout22.addItem(spacerItem25,0,1,1,1) self.vboxlayout16 = QtGui.QVBoxLayout() self.vboxlayout16.setMargin(0) self.vboxlayout16.setSpacing(6) self.vboxlayout16.setObjectName("vboxlayout16") self.groupBox4 = QtGui.QGroupBox(self.Bonds) self.groupBox4.setObjectName("groupBox4") self.vboxlayout17 = QtGui.QVBoxLayout(self.groupBox4) self.vboxlayout17.setMargin(9) self.vboxlayout17.setSpacing(4) self.vboxlayout17.setObjectName("vboxlayout17") self.gridlayout23 = QtGui.QGridLayout() self.gridlayout23.setMargin(0) self.gridlayout23.setSpacing(6) self.gridlayout23.setObjectName("gridlayout23") self.textLabel3_2 = QtGui.QLabel(self.groupBox4) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.textLabel3_2.sizePolicy().hasHeightForWidth()) self.textLabel3_2.setSizePolicy(sizePolicy) self.textLabel3_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel3_2.setObjectName("textLabel3_2") self.gridlayout23.addWidget(self.textLabel3_2,0,0,1,1) self.hboxlayout23 = QtGui.QHBoxLayout() self.hboxlayout23.setMargin(0) self.hboxlayout23.setSpacing(4) self.hboxlayout23.setObjectName("hboxlayout23") self.bond_stretch_color_frame = QtGui.QFrame(self.groupBox4) self.bond_stretch_color_frame.setMinimumSize(QtCore.QSize(23,23)) self.bond_stretch_color_frame.setMaximumSize(QtCore.QSize(23,23)) self.bond_stretch_color_frame.setFrameShape(QtGui.QFrame.Box) self.bond_stretch_color_frame.setFrameShadow(QtGui.QFrame.Plain) self.bond_stretch_color_frame.setObjectName("bond_stretch_color_frame") self.hboxlayout23.addWidget(self.bond_stretch_color_frame) self.bond_stretch_color_btn = QtGui.QPushButton(self.groupBox4) self.bond_stretch_color_btn.setAutoDefault(False) self.bond_stretch_color_btn.setDefault(False) self.bond_stretch_color_btn.setObjectName("bond_stretch_color_btn") self.hboxlayout23.addWidget(self.bond_stretch_color_btn) self.gridlayout23.addLayout(self.hboxlayout23,2,1,1,1) self.hboxlayout24 = QtGui.QHBoxLayout() self.hboxlayout24.setMargin(0) self.hboxlayout24.setSpacing(4) self.hboxlayout24.setObjectName("hboxlayout24") self.bond_hilite_color_frame = QtGui.QFrame(self.groupBox4) self.bond_hilite_color_frame.setMinimumSize(QtCore.QSize(23,23)) self.bond_hilite_color_frame.setMaximumSize(QtCore.QSize(23,23)) self.bond_hilite_color_frame.setFrameShape(QtGui.QFrame.Box) self.bond_hilite_color_frame.setFrameShadow(QtGui.QFrame.Plain) self.bond_hilite_color_frame.setObjectName("bond_hilite_color_frame") self.hboxlayout24.addWidget(self.bond_hilite_color_frame) self.bond_hilite_color_btn = QtGui.QPushButton(self.groupBox4) self.bond_hilite_color_btn.setAutoDefault(False) self.bond_hilite_color_btn.setObjectName("bond_hilite_color_btn") self.hboxlayout24.addWidget(self.bond_hilite_color_btn) self.gridlayout23.addLayout(self.hboxlayout24,0,1,1,1) self.textLabel3_3 = QtGui.QLabel(self.groupBox4) self.textLabel3_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel3_3.setObjectName("textLabel3_3") self.gridlayout23.addWidget(self.textLabel3_3,3,0,1,1) self.hboxlayout25 = QtGui.QHBoxLayout() self.hboxlayout25.setMargin(0) self.hboxlayout25.setSpacing(4) self.hboxlayout25.setObjectName("hboxlayout25") self.ballstick_bondcolor_frame = QtGui.QFrame(self.groupBox4) self.ballstick_bondcolor_frame.setMinimumSize(QtCore.QSize(23,23)) self.ballstick_bondcolor_frame.setMaximumSize(QtCore.QSize(23,23)) self.ballstick_bondcolor_frame.setFrameShape(QtGui.QFrame.Box) self.ballstick_bondcolor_frame.setFrameShadow(QtGui.QFrame.Plain) self.ballstick_bondcolor_frame.setObjectName("ballstick_bondcolor_frame") self.hboxlayout25.addWidget(self.ballstick_bondcolor_frame) self.ballstick_bondcolor_btn = QtGui.QPushButton(self.groupBox4) self.ballstick_bondcolor_btn.setAutoDefault(False) self.ballstick_bondcolor_btn.setObjectName("ballstick_bondcolor_btn") self.hboxlayout25.addWidget(self.ballstick_bondcolor_btn) self.gridlayout23.addLayout(self.hboxlayout25,1,1,1,1) self.textLabel3 = QtGui.QLabel(self.groupBox4) self.textLabel3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel3.setObjectName("textLabel3") self.gridlayout23.addWidget(self.textLabel3,1,0,1,1) self.textLabel3_2_2 = QtGui.QLabel(self.groupBox4) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.textLabel3_2_2.sizePolicy().hasHeightForWidth()) self.textLabel3_2_2.setSizePolicy(sizePolicy) self.textLabel3_2_2.setMinimumSize(QtCore.QSize(0,0)) self.textLabel3_2_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel3_2_2.setObjectName("textLabel3_2_2") self.gridlayout23.addWidget(self.textLabel3_2_2,2,0,1,1) self.hboxlayout26 = QtGui.QHBoxLayout() self.hboxlayout26.setMargin(0) self.hboxlayout26.setSpacing(4) self.hboxlayout26.setObjectName("hboxlayout26") self.bond_vane_color_frame = QtGui.QFrame(self.groupBox4) self.bond_vane_color_frame.setMinimumSize(QtCore.QSize(23,23)) self.bond_vane_color_frame.setMaximumSize(QtCore.QSize(23,23)) self.bond_vane_color_frame.setFrameShape(QtGui.QFrame.Box) self.bond_vane_color_frame.setFrameShadow(QtGui.QFrame.Plain) self.bond_vane_color_frame.setObjectName("bond_vane_color_frame") self.hboxlayout26.addWidget(self.bond_vane_color_frame) self.bond_vane_color_btn = QtGui.QPushButton(self.groupBox4) self.bond_vane_color_btn.setAutoDefault(False) self.bond_vane_color_btn.setObjectName("bond_vane_color_btn") self.hboxlayout26.addWidget(self.bond_vane_color_btn) self.gridlayout23.addLayout(self.hboxlayout26,3,1,1,1) self.vboxlayout17.addLayout(self.gridlayout23) self.hboxlayout27 = QtGui.QHBoxLayout() self.hboxlayout27.setMargin(0) self.hboxlayout27.setSpacing(6) self.hboxlayout27.setObjectName("hboxlayout27") spacerItem26 = QtGui.QSpacerItem(20,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout27.addItem(spacerItem26) self.reset_bond_colors_btn = QtGui.QPushButton(self.groupBox4) self.reset_bond_colors_btn.setAutoDefault(False) self.reset_bond_colors_btn.setObjectName("reset_bond_colors_btn") self.hboxlayout27.addWidget(self.reset_bond_colors_btn) self.vboxlayout17.addLayout(self.hboxlayout27) self.vboxlayout16.addWidget(self.groupBox4) self.hboxlayout28 = QtGui.QHBoxLayout() self.hboxlayout28.setMargin(0) self.hboxlayout28.setSpacing(4) self.hboxlayout28.setObjectName("hboxlayout28") self.vboxlayout18 = QtGui.QVBoxLayout() self.vboxlayout18.setMargin(0) self.vboxlayout18.setSpacing(2) self.vboxlayout18.setObjectName("vboxlayout18") self.textLabel1_3 = QtGui.QLabel(self.Bonds) self.textLabel1_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_3.setObjectName("textLabel1_3") self.vboxlayout18.addWidget(self.textLabel1_3) self.textLabel1 = QtGui.QLabel(self.Bonds) self.textLabel1.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1.setObjectName("textLabel1") self.vboxlayout18.addWidget(self.textLabel1) self.hboxlayout28.addLayout(self.vboxlayout18) self.vboxlayout19 = QtGui.QVBoxLayout() self.vboxlayout19.setMargin(0) self.vboxlayout19.setSpacing(2) self.vboxlayout19.setObjectName("vboxlayout19") self.cpk_cylinder_rad_spinbox = QtGui.QSpinBox(self.Bonds) self.cpk_cylinder_rad_spinbox.setMaximum(400) self.cpk_cylinder_rad_spinbox.setMinimum(50) self.cpk_cylinder_rad_spinbox.setProperty("value",QtCore.QVariant(100)) self.cpk_cylinder_rad_spinbox.setObjectName("cpk_cylinder_rad_spinbox") self.vboxlayout19.addWidget(self.cpk_cylinder_rad_spinbox) self.bond_line_thickness_spinbox = QtGui.QSpinBox(self.Bonds) self.bond_line_thickness_spinbox.setMaximum(4) self.bond_line_thickness_spinbox.setMinimum(1) self.bond_line_thickness_spinbox.setObjectName("bond_line_thickness_spinbox") self.vboxlayout19.addWidget(self.bond_line_thickness_spinbox) self.hboxlayout28.addLayout(self.vboxlayout19) spacerItem27 = QtGui.QSpacerItem(16,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout28.addItem(spacerItem27) self.vboxlayout16.addLayout(self.hboxlayout28) self.high_order_bond_display_groupbox = QtGui.QGroupBox(self.Bonds) self.high_order_bond_display_groupbox.setObjectName("high_order_bond_display_groupbox") self.vboxlayout20 = QtGui.QVBoxLayout(self.high_order_bond_display_groupbox) self.vboxlayout20.setMargin(9) self.vboxlayout20.setSpacing(0) self.vboxlayout20.setObjectName("vboxlayout20") self.multCyl_radioButton = QtGui.QRadioButton(self.high_order_bond_display_groupbox) self.multCyl_radioButton.setChecked(True) self.multCyl_radioButton.setObjectName("multCyl_radioButton") self.vboxlayout20.addWidget(self.multCyl_radioButton) self.vanes_radioButton = QtGui.QRadioButton(self.high_order_bond_display_groupbox) self.vanes_radioButton.setObjectName("vanes_radioButton") self.vboxlayout20.addWidget(self.vanes_radioButton) self.ribbons_radioButton = QtGui.QRadioButton(self.high_order_bond_display_groupbox) self.ribbons_radioButton.setObjectName("ribbons_radioButton") self.vboxlayout20.addWidget(self.ribbons_radioButton) self.vboxlayout16.addWidget(self.high_order_bond_display_groupbox) self.vboxlayout21 = QtGui.QVBoxLayout() self.vboxlayout21.setMargin(0) self.vboxlayout21.setSpacing(0) self.vboxlayout21.setObjectName("vboxlayout21") self.show_bond_labels_checkbox = QtGui.QCheckBox(self.Bonds) self.show_bond_labels_checkbox.setObjectName("show_bond_labels_checkbox") self.vboxlayout21.addWidget(self.show_bond_labels_checkbox) self.show_valence_errors_checkbox = QtGui.QCheckBox(self.Bonds) self.show_valence_errors_checkbox.setObjectName("show_valence_errors_checkbox") self.vboxlayout21.addWidget(self.show_valence_errors_checkbox) self.showBondStretchIndicators_checkBox = QtGui.QCheckBox(self.Bonds) self.showBondStretchIndicators_checkBox.setObjectName("showBondStretchIndicators_checkBox") self.vboxlayout21.addWidget(self.showBondStretchIndicators_checkBox) self.vboxlayout16.addLayout(self.vboxlayout21) spacerItem28 = QtGui.QSpacerItem(20,144,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout16.addItem(spacerItem28) self.gridlayout22.addLayout(self.vboxlayout16,0,0,1,1) self.prefsStackedWidget.addWidget(self.Bonds) self.DNA = QtGui.QWidget() self.DNA.setObjectName("DNA") self.gridlayout24 = QtGui.QGridLayout(self.DNA) self.gridlayout24.setMargin(9) self.gridlayout24.setSpacing(6) self.gridlayout24.setObjectName("gridlayout24") self.vboxlayout22 = QtGui.QVBoxLayout() self.vboxlayout22.setMargin(0) self.vboxlayout22.setSpacing(6) self.vboxlayout22.setObjectName("vboxlayout22") self.groupBox = QtGui.QGroupBox(self.DNA) self.groupBox.setObjectName("groupBox") self.vboxlayout23 = QtGui.QVBoxLayout(self.groupBox) self.vboxlayout23.setMargin(9) self.vboxlayout23.setSpacing(2) self.vboxlayout23.setObjectName("vboxlayout23") self.gridlayout25 = QtGui.QGridLayout() self.gridlayout25.setMargin(0) self.gridlayout25.setSpacing(6) self.gridlayout25.setObjectName("gridlayout25") self.label_24 = QtGui.QLabel(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_24.sizePolicy().hasHeightForWidth()) self.label_24.setSizePolicy(sizePolicy) self.label_24.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_24.setObjectName("label_24") self.gridlayout25.addWidget(self.label_24,4,0,1,1) self.label_23 = QtGui.QLabel(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_23.sizePolicy().hasHeightForWidth()) self.label_23.setSizePolicy(sizePolicy) self.label_23.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_23.setObjectName("label_23") self.gridlayout25.addWidget(self.label_23,3,0,1,1) self.hboxlayout29 = QtGui.QHBoxLayout() self.hboxlayout29.setMargin(0) self.hboxlayout29.setSpacing(4) self.hboxlayout29.setObjectName("hboxlayout29") self.dnaDefaultStrand1ColorFrame = QtGui.QFrame(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dnaDefaultStrand1ColorFrame.sizePolicy().hasHeightForWidth()) self.dnaDefaultStrand1ColorFrame.setSizePolicy(sizePolicy) self.dnaDefaultStrand1ColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.dnaDefaultStrand1ColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.dnaDefaultStrand1ColorFrame.setFrameShape(QtGui.QFrame.Box) self.dnaDefaultStrand1ColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.dnaDefaultStrand1ColorFrame.setObjectName("dnaDefaultStrand1ColorFrame") self.hboxlayout29.addWidget(self.dnaDefaultStrand1ColorFrame) self.dnaDefaultStrand1ColorPushButton = QtGui.QPushButton(self.groupBox) self.dnaDefaultStrand1ColorPushButton.setAutoDefault(False) self.dnaDefaultStrand1ColorPushButton.setObjectName("dnaDefaultStrand1ColorPushButton") self.hboxlayout29.addWidget(self.dnaDefaultStrand1ColorPushButton) self.gridlayout25.addLayout(self.hboxlayout29,3,1,1,1) self.dnaConformationComboBox = QtGui.QComboBox(self.groupBox) self.dnaConformationComboBox.setObjectName("dnaConformationComboBox") self.gridlayout25.addWidget(self.dnaConformationComboBox,0,1,1,1) self.hboxlayout30 = QtGui.QHBoxLayout() self.hboxlayout30.setMargin(0) self.hboxlayout30.setSpacing(4) self.hboxlayout30.setObjectName("hboxlayout30") self.dnaDefaultSegmentColorFrame = QtGui.QFrame(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dnaDefaultSegmentColorFrame.sizePolicy().hasHeightForWidth()) self.dnaDefaultSegmentColorFrame.setSizePolicy(sizePolicy) self.dnaDefaultSegmentColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.dnaDefaultSegmentColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.dnaDefaultSegmentColorFrame.setFrameShape(QtGui.QFrame.Box) self.dnaDefaultSegmentColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.dnaDefaultSegmentColorFrame.setObjectName("dnaDefaultSegmentColorFrame") self.hboxlayout30.addWidget(self.dnaDefaultSegmentColorFrame) self.dnaDefaultSegmentColorPushButton = QtGui.QPushButton(self.groupBox) self.dnaDefaultSegmentColorPushButton.setAutoDefault(False) self.dnaDefaultSegmentColorPushButton.setObjectName("dnaDefaultSegmentColorPushButton") self.hboxlayout30.addWidget(self.dnaDefaultSegmentColorPushButton) self.gridlayout25.addLayout(self.hboxlayout30,5,1,1,1) self.label_6 = QtGui.QLabel(self.groupBox) self.label_6.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_6.setObjectName("label_6") self.gridlayout25.addWidget(self.label_6,2,0,1,1) self.dnaBasesPerTurnDoubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox) self.dnaBasesPerTurnDoubleSpinBox.setDecimals(2) self.dnaBasesPerTurnDoubleSpinBox.setSingleStep(0.1) self.dnaBasesPerTurnDoubleSpinBox.setObjectName("dnaBasesPerTurnDoubleSpinBox") self.gridlayout25.addWidget(self.dnaBasesPerTurnDoubleSpinBox,1,1,1,1) self.label_11 = QtGui.QLabel(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_11.sizePolicy().hasHeightForWidth()) self.label_11.setSizePolicy(sizePolicy) self.label_11.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_11.setObjectName("label_11") self.gridlayout25.addWidget(self.label_11,0,0,1,1) self.hboxlayout31 = QtGui.QHBoxLayout() self.hboxlayout31.setMargin(0) self.hboxlayout31.setSpacing(4) self.hboxlayout31.setObjectName("hboxlayout31") self.dnaDefaultStrand2ColorFrame = QtGui.QFrame(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dnaDefaultStrand2ColorFrame.sizePolicy().hasHeightForWidth()) self.dnaDefaultStrand2ColorFrame.setSizePolicy(sizePolicy) self.dnaDefaultStrand2ColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.dnaDefaultStrand2ColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.dnaDefaultStrand2ColorFrame.setFrameShape(QtGui.QFrame.Box) self.dnaDefaultStrand2ColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.dnaDefaultStrand2ColorFrame.setObjectName("dnaDefaultStrand2ColorFrame") self.hboxlayout31.addWidget(self.dnaDefaultStrand2ColorFrame) self.dnaDefaultStrand2ColorPushButton = QtGui.QPushButton(self.groupBox) self.dnaDefaultStrand2ColorPushButton.setAutoDefault(False) self.dnaDefaultStrand2ColorPushButton.setObjectName("dnaDefaultStrand2ColorPushButton") self.hboxlayout31.addWidget(self.dnaDefaultStrand2ColorPushButton) self.gridlayout25.addLayout(self.hboxlayout31,4,1,1,1) self.label_4 = QtGui.QLabel(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) self.label_4.setSizePolicy(sizePolicy) self.label_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_4.setObjectName("label_4") self.gridlayout25.addWidget(self.label_4,1,0,1,1) self.label_7 = QtGui.QLabel(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth()) self.label_7.setSizePolicy(sizePolicy) self.label_7.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_7.setObjectName("label_7") self.gridlayout25.addWidget(self.label_7,5,0,1,1) self.dnaRiseDoubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox) self.dnaRiseDoubleSpinBox.setDecimals(3) self.dnaRiseDoubleSpinBox.setSingleStep(0.01) self.dnaRiseDoubleSpinBox.setObjectName("dnaRiseDoubleSpinBox") self.gridlayout25.addWidget(self.dnaRiseDoubleSpinBox,2,1,1,1) self.vboxlayout23.addLayout(self.gridlayout25) self.hboxlayout32 = QtGui.QHBoxLayout() self.hboxlayout32.setMargin(0) self.hboxlayout32.setSpacing(4) self.hboxlayout32.setObjectName("hboxlayout32") spacerItem29 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout32.addItem(spacerItem29) self.dnaRestoreFactoryDefaultsPushButton = QtGui.QPushButton(self.groupBox) self.dnaRestoreFactoryDefaultsPushButton.setAutoDefault(False) self.dnaRestoreFactoryDefaultsPushButton.setObjectName("dnaRestoreFactoryDefaultsPushButton") self.hboxlayout32.addWidget(self.dnaRestoreFactoryDefaultsPushButton) self.vboxlayout23.addLayout(self.hboxlayout32) self.vboxlayout22.addWidget(self.groupBox) self.dna_reduced_model_options_grpbox = QtGui.QGroupBox(self.DNA) self.dna_reduced_model_options_grpbox.setObjectName("dna_reduced_model_options_grpbox") self.gridlayout26 = QtGui.QGridLayout(self.dna_reduced_model_options_grpbox) self.gridlayout26.setMargin(9) self.gridlayout26.setSpacing(6) self.gridlayout26.setObjectName("gridlayout26") self.hboxlayout33 = QtGui.QHBoxLayout() self.hboxlayout33.setMargin(0) self.hboxlayout33.setSpacing(2) self.hboxlayout33.setObjectName("hboxlayout33") self.strandFivePrimeArrowheadsCustomColorCheckBox = QtGui.QCheckBox(self.dna_reduced_model_options_grpbox) self.strandFivePrimeArrowheadsCustomColorCheckBox.setObjectName("strandFivePrimeArrowheadsCustomColorCheckBox") self.hboxlayout33.addWidget(self.strandFivePrimeArrowheadsCustomColorCheckBox) self.hboxlayout34 = QtGui.QHBoxLayout() self.hboxlayout34.setMargin(0) self.hboxlayout34.setSpacing(4) self.hboxlayout34.setObjectName("hboxlayout34") self.strandFivePrimeArrowheadsCustomColorFrame = QtGui.QFrame(self.dna_reduced_model_options_grpbox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.strandFivePrimeArrowheadsCustomColorFrame.sizePolicy().hasHeightForWidth()) self.strandFivePrimeArrowheadsCustomColorFrame.setSizePolicy(sizePolicy) self.strandFivePrimeArrowheadsCustomColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.strandFivePrimeArrowheadsCustomColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.strandFivePrimeArrowheadsCustomColorFrame.setFrameShape(QtGui.QFrame.Box) self.strandFivePrimeArrowheadsCustomColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.strandFivePrimeArrowheadsCustomColorFrame.setObjectName("strandFivePrimeArrowheadsCustomColorFrame") self.hboxlayout34.addWidget(self.strandFivePrimeArrowheadsCustomColorFrame) self.strandFivePrimeArrowheadsCustomColorPushButton = QtGui.QPushButton(self.dna_reduced_model_options_grpbox) self.strandFivePrimeArrowheadsCustomColorPushButton.setAutoDefault(False) self.strandFivePrimeArrowheadsCustomColorPushButton.setObjectName("strandFivePrimeArrowheadsCustomColorPushButton") self.hboxlayout34.addWidget(self.strandFivePrimeArrowheadsCustomColorPushButton) self.hboxlayout33.addLayout(self.hboxlayout34) self.gridlayout26.addLayout(self.hboxlayout33,4,0,1,1) self.hboxlayout35 = QtGui.QHBoxLayout() self.hboxlayout35.setMargin(0) self.hboxlayout35.setSpacing(2) self.hboxlayout35.setObjectName("hboxlayout35") self.strandThreePrimeArrowheadsCustomColorCheckBox = QtGui.QCheckBox(self.dna_reduced_model_options_grpbox) self.strandThreePrimeArrowheadsCustomColorCheckBox.setObjectName("strandThreePrimeArrowheadsCustomColorCheckBox") self.hboxlayout35.addWidget(self.strandThreePrimeArrowheadsCustomColorCheckBox) self.hboxlayout36 = QtGui.QHBoxLayout() self.hboxlayout36.setMargin(0) self.hboxlayout36.setSpacing(4) self.hboxlayout36.setObjectName("hboxlayout36") self.strandThreePrimeArrowheadsCustomColorFrame = QtGui.QFrame(self.dna_reduced_model_options_grpbox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.strandThreePrimeArrowheadsCustomColorFrame.sizePolicy().hasHeightForWidth()) self.strandThreePrimeArrowheadsCustomColorFrame.setSizePolicy(sizePolicy) self.strandThreePrimeArrowheadsCustomColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.strandThreePrimeArrowheadsCustomColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.strandThreePrimeArrowheadsCustomColorFrame.setFrameShape(QtGui.QFrame.Box) self.strandThreePrimeArrowheadsCustomColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.strandThreePrimeArrowheadsCustomColorFrame.setObjectName("strandThreePrimeArrowheadsCustomColorFrame") self.hboxlayout36.addWidget(self.strandThreePrimeArrowheadsCustomColorFrame) self.strandThreePrimeArrowheadsCustomColorPushButton = QtGui.QPushButton(self.dna_reduced_model_options_grpbox) self.strandThreePrimeArrowheadsCustomColorPushButton.setAutoDefault(False) self.strandThreePrimeArrowheadsCustomColorPushButton.setObjectName("strandThreePrimeArrowheadsCustomColorPushButton") self.hboxlayout36.addWidget(self.strandThreePrimeArrowheadsCustomColorPushButton) self.hboxlayout35.addLayout(self.hboxlayout36) self.gridlayout26.addLayout(self.hboxlayout35,3,0,1,1) self.arrowsOnFivePrimeEnds_checkBox = QtGui.QCheckBox(self.dna_reduced_model_options_grpbox) self.arrowsOnFivePrimeEnds_checkBox.setChecked(True) self.arrowsOnFivePrimeEnds_checkBox.setObjectName("arrowsOnFivePrimeEnds_checkBox") self.gridlayout26.addWidget(self.arrowsOnFivePrimeEnds_checkBox,2,0,1,1) self.arrowsOnThreePrimeEnds_checkBox = QtGui.QCheckBox(self.dna_reduced_model_options_grpbox) self.arrowsOnThreePrimeEnds_checkBox.setChecked(True) self.arrowsOnThreePrimeEnds_checkBox.setObjectName("arrowsOnThreePrimeEnds_checkBox") self.gridlayout26.addWidget(self.arrowsOnThreePrimeEnds_checkBox,1,0,1,1) self.arrowsOnBackBones_checkBox = QtGui.QCheckBox(self.dna_reduced_model_options_grpbox) self.arrowsOnBackBones_checkBox.setObjectName("arrowsOnBackBones_checkBox") self.gridlayout26.addWidget(self.arrowsOnBackBones_checkBox,0,0,1,1) self.vboxlayout22.addWidget(self.dna_reduced_model_options_grpbox) spacerItem30 = QtGui.QSpacerItem(20,421,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout22.addItem(spacerItem30) self.gridlayout24.addLayout(self.vboxlayout22,0,0,1,1) spacerItem31 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout24.addItem(spacerItem31,0,1,1,1) self.prefsStackedWidget.addWidget(self.DNA) self.MinorGrooveErrorIndicators = QtGui.QWidget() self.MinorGrooveErrorIndicators.setObjectName("MinorGrooveErrorIndicators") self.gridlayout27 = QtGui.QGridLayout(self.MinorGrooveErrorIndicators) self.gridlayout27.setMargin(9) self.gridlayout27.setSpacing(6) self.gridlayout27.setObjectName("gridlayout27") spacerItem32 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout27.addItem(spacerItem32,0,1,1,1) self.vboxlayout24 = QtGui.QVBoxLayout() self.vboxlayout24.setMargin(0) self.vboxlayout24.setSpacing(6) self.vboxlayout24.setObjectName("vboxlayout24") self.dnaDisplayMinorGrooveErrorGroupBox = QtGui.QGroupBox(self.MinorGrooveErrorIndicators) self.dnaDisplayMinorGrooveErrorGroupBox.setCheckable(True) self.dnaDisplayMinorGrooveErrorGroupBox.setChecked(False) self.dnaDisplayMinorGrooveErrorGroupBox.setObjectName("dnaDisplayMinorGrooveErrorGroupBox") self.gridlayout28 = QtGui.QGridLayout(self.dnaDisplayMinorGrooveErrorGroupBox) self.gridlayout28.setMargin(9) self.gridlayout28.setSpacing(6) self.gridlayout28.setObjectName("gridlayout28") self.vboxlayout25 = QtGui.QVBoxLayout() self.vboxlayout25.setMargin(0) self.vboxlayout25.setSpacing(2) self.vboxlayout25.setObjectName("vboxlayout25") self.label_15 = QtGui.QLabel(self.dnaDisplayMinorGrooveErrorGroupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_15.sizePolicy().hasHeightForWidth()) self.label_15.setSizePolicy(sizePolicy) self.label_15.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_15.setObjectName("label_15") self.vboxlayout25.addWidget(self.label_15) self.label_16 = QtGui.QLabel(self.dnaDisplayMinorGrooveErrorGroupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_16.sizePolicy().hasHeightForWidth()) self.label_16.setSizePolicy(sizePolicy) self.label_16.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_16.setObjectName("label_16") self.vboxlayout25.addWidget(self.label_16) self.bg1_color_lbl_3 = QtGui.QLabel(self.dnaDisplayMinorGrooveErrorGroupBox) self.bg1_color_lbl_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.bg1_color_lbl_3.setObjectName("bg1_color_lbl_3") self.vboxlayout25.addWidget(self.bg1_color_lbl_3) self.gridlayout28.addLayout(self.vboxlayout25,0,0,1,1) self.vboxlayout26 = QtGui.QVBoxLayout() self.vboxlayout26.setMargin(0) self.vboxlayout26.setSpacing(2) self.vboxlayout26.setObjectName("vboxlayout26") self.dnaMinGrooveAngleSpinBox = QtGui.QSpinBox(self.dnaDisplayMinorGrooveErrorGroupBox) self.dnaMinGrooveAngleSpinBox.setMaximum(179) self.dnaMinGrooveAngleSpinBox.setProperty("value",QtCore.QVariant(0)) self.dnaMinGrooveAngleSpinBox.setObjectName("dnaMinGrooveAngleSpinBox") self.vboxlayout26.addWidget(self.dnaMinGrooveAngleSpinBox) self.dnaMaxGrooveAngleSpinBox = QtGui.QSpinBox(self.dnaDisplayMinorGrooveErrorGroupBox) self.dnaMaxGrooveAngleSpinBox.setMaximum(179) self.dnaMaxGrooveAngleSpinBox.setProperty("value",QtCore.QVariant(0)) self.dnaMaxGrooveAngleSpinBox.setObjectName("dnaMaxGrooveAngleSpinBox") self.vboxlayout26.addWidget(self.dnaMaxGrooveAngleSpinBox) self.hboxlayout37 = QtGui.QHBoxLayout() self.hboxlayout37.setMargin(0) self.hboxlayout37.setSpacing(4) self.hboxlayout37.setObjectName("hboxlayout37") self.dnaGrooveIndicatorColorFrame = QtGui.QFrame(self.dnaDisplayMinorGrooveErrorGroupBox) self.dnaGrooveIndicatorColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.dnaGrooveIndicatorColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.dnaGrooveIndicatorColorFrame.setFrameShape(QtGui.QFrame.Box) self.dnaGrooveIndicatorColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.dnaGrooveIndicatorColorFrame.setObjectName("dnaGrooveIndicatorColorFrame") self.hboxlayout37.addWidget(self.dnaGrooveIndicatorColorFrame) self.dnaGrooveIndicatorColorButton = QtGui.QPushButton(self.dnaDisplayMinorGrooveErrorGroupBox) self.dnaGrooveIndicatorColorButton.setAutoDefault(False) self.dnaGrooveIndicatorColorButton.setObjectName("dnaGrooveIndicatorColorButton") self.hboxlayout37.addWidget(self.dnaGrooveIndicatorColorButton) self.vboxlayout26.addLayout(self.hboxlayout37) self.gridlayout28.addLayout(self.vboxlayout26,0,1,1,1) self.hboxlayout38 = QtGui.QHBoxLayout() self.hboxlayout38.setMargin(0) self.hboxlayout38.setSpacing(4) self.hboxlayout38.setObjectName("hboxlayout38") spacerItem33 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout38.addItem(spacerItem33) self.dnaMinorGrooveRestoreFactoryDefaultsPushButton = QtGui.QPushButton(self.dnaDisplayMinorGrooveErrorGroupBox) self.dnaMinorGrooveRestoreFactoryDefaultsPushButton.setAutoDefault(False) self.dnaMinorGrooveRestoreFactoryDefaultsPushButton.setObjectName("dnaMinorGrooveRestoreFactoryDefaultsPushButton") self.hboxlayout38.addWidget(self.dnaMinorGrooveRestoreFactoryDefaultsPushButton) self.gridlayout28.addLayout(self.hboxlayout38,1,0,1,2) self.vboxlayout24.addWidget(self.dnaDisplayMinorGrooveErrorGroupBox) spacerItem34 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout24.addItem(spacerItem34) self.gridlayout27.addLayout(self.vboxlayout24,0,0,1,1) self.prefsStackedWidget.addWidget(self.MinorGrooveErrorIndicators) self.BaseOrientationIndicators = QtGui.QWidget() self.BaseOrientationIndicators.setObjectName("BaseOrientationIndicators") self.gridlayout29 = QtGui.QGridLayout(self.BaseOrientationIndicators) self.gridlayout29.setMargin(9) self.gridlayout29.setSpacing(6) self.gridlayout29.setObjectName("gridlayout29") spacerItem35 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout29.addItem(spacerItem35,0,1,1,1) self.vboxlayout27 = QtGui.QVBoxLayout() self.vboxlayout27.setMargin(0) self.vboxlayout27.setSpacing(4) self.vboxlayout27.setObjectName("vboxlayout27") self.dnaDisplayBaseOrientationIndicatorsGroupBox = QtGui.QGroupBox(self.BaseOrientationIndicators) self.dnaDisplayBaseOrientationIndicatorsGroupBox.setCheckable(True) self.dnaDisplayBaseOrientationIndicatorsGroupBox.setChecked(False) self.dnaDisplayBaseOrientationIndicatorsGroupBox.setObjectName("dnaDisplayBaseOrientationIndicatorsGroupBox") self.gridlayout30 = QtGui.QGridLayout(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.gridlayout30.setMargin(9) self.gridlayout30.setSpacing(6) self.gridlayout30.setObjectName("gridlayout30") self.dnaBaseIndicatorsPlaneNormalComboBox = QtGui.QComboBox(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.dnaBaseIndicatorsPlaneNormalComboBox.setObjectName("dnaBaseIndicatorsPlaneNormalComboBox") self.gridlayout30.addWidget(self.dnaBaseIndicatorsPlaneNormalComboBox,0,1,1,1) self.bg1_color_lbl_6 = QtGui.QLabel(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.bg1_color_lbl_6.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.bg1_color_lbl_6.setObjectName("bg1_color_lbl_6") self.gridlayout30.addWidget(self.bg1_color_lbl_6,2,0,1,1) self.hboxlayout39 = QtGui.QHBoxLayout() self.hboxlayout39.setMargin(0) self.hboxlayout39.setSpacing(4) self.hboxlayout39.setObjectName("hboxlayout39") self.dnaBaseOrientationIndicatorsInvColorFrame = QtGui.QFrame(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.dnaBaseOrientationIndicatorsInvColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.dnaBaseOrientationIndicatorsInvColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.dnaBaseOrientationIndicatorsInvColorFrame.setFrameShape(QtGui.QFrame.Box) self.dnaBaseOrientationIndicatorsInvColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.dnaBaseOrientationIndicatorsInvColorFrame.setObjectName("dnaBaseOrientationIndicatorsInvColorFrame") self.hboxlayout39.addWidget(self.dnaBaseOrientationIndicatorsInvColorFrame) self.dnaChooseBaseOrientationIndicatorsInvColorButton = QtGui.QPushButton(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.dnaChooseBaseOrientationIndicatorsInvColorButton.setAutoDefault(False) self.dnaChooseBaseOrientationIndicatorsInvColorButton.setObjectName("dnaChooseBaseOrientationIndicatorsInvColorButton") self.hboxlayout39.addWidget(self.dnaChooseBaseOrientationIndicatorsInvColorButton) self.gridlayout30.addLayout(self.hboxlayout39,2,1,1,1) self.dnaBaseOrientationIndicatorsInverseCheckBox = QtGui.QCheckBox(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.dnaBaseOrientationIndicatorsInverseCheckBox.setObjectName("dnaBaseOrientationIndicatorsInverseCheckBox") self.gridlayout30.addWidget(self.dnaBaseOrientationIndicatorsInverseCheckBox,3,0,1,2) self.label_35 = QtGui.QLabel(self.dnaDisplayBaseOrientationIndicatorsGroupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_35.sizePolicy().hasHeightForWidth()) self.label_35.setSizePolicy(sizePolicy) self.label_35.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_35.setObjectName("label_35") self.gridlayout30.addWidget(self.label_35,0,0,1,1) self.label_13 = QtGui.QLabel(self.dnaDisplayBaseOrientationIndicatorsGroupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_13.sizePolicy().hasHeightForWidth()) self.label_13.setSizePolicy(sizePolicy) self.label_13.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_13.setObjectName("label_13") self.gridlayout30.addWidget(self.label_13,4,0,1,1) self.dnaBaseOrientationIndicatorsTerminalDistanceSpinBox = QtGui.QDoubleSpinBox(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.dnaBaseOrientationIndicatorsTerminalDistanceSpinBox.setDecimals(0) self.dnaBaseOrientationIndicatorsTerminalDistanceSpinBox.setMaximum(1000000.0) self.dnaBaseOrientationIndicatorsTerminalDistanceSpinBox.setSingleStep(1.0) self.dnaBaseOrientationIndicatorsTerminalDistanceSpinBox.setObjectName("dnaBaseOrientationIndicatorsTerminalDistanceSpinBox") self.gridlayout30.addWidget(self.dnaBaseOrientationIndicatorsTerminalDistanceSpinBox,5,1,1,1) self.dnaBaseOrientationIndicatorsThresholdSpinBox = QtGui.QDoubleSpinBox(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.dnaBaseOrientationIndicatorsThresholdSpinBox.setDecimals(1) self.dnaBaseOrientationIndicatorsThresholdSpinBox.setMaximum(180.0) self.dnaBaseOrientationIndicatorsThresholdSpinBox.setSingleStep(0.1) self.dnaBaseOrientationIndicatorsThresholdSpinBox.setProperty("value",QtCore.QVariant(30.0)) self.dnaBaseOrientationIndicatorsThresholdSpinBox.setObjectName("dnaBaseOrientationIndicatorsThresholdSpinBox") self.gridlayout30.addWidget(self.dnaBaseOrientationIndicatorsThresholdSpinBox,4,1,1,1) self.hboxlayout40 = QtGui.QHBoxLayout() self.hboxlayout40.setMargin(0) self.hboxlayout40.setSpacing(4) self.hboxlayout40.setObjectName("hboxlayout40") self.dnaBaseOrientationIndicatorsColorFrame = QtGui.QFrame(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.dnaBaseOrientationIndicatorsColorFrame.setMinimumSize(QtCore.QSize(23,23)) self.dnaBaseOrientationIndicatorsColorFrame.setMaximumSize(QtCore.QSize(23,23)) self.dnaBaseOrientationIndicatorsColorFrame.setFrameShape(QtGui.QFrame.Box) self.dnaBaseOrientationIndicatorsColorFrame.setFrameShadow(QtGui.QFrame.Plain) self.dnaBaseOrientationIndicatorsColorFrame.setObjectName("dnaBaseOrientationIndicatorsColorFrame") self.hboxlayout40.addWidget(self.dnaBaseOrientationIndicatorsColorFrame) self.dnaChooseBaseOrientationIndicatorsColorButton = QtGui.QPushButton(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.dnaChooseBaseOrientationIndicatorsColorButton.setAutoDefault(False) self.dnaChooseBaseOrientationIndicatorsColorButton.setObjectName("dnaChooseBaseOrientationIndicatorsColorButton") self.hboxlayout40.addWidget(self.dnaChooseBaseOrientationIndicatorsColorButton) self.gridlayout30.addLayout(self.hboxlayout40,1,1,1,1) self.label_14 = QtGui.QLabel(self.dnaDisplayBaseOrientationIndicatorsGroupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_14.sizePolicy().hasHeightForWidth()) self.label_14.setSizePolicy(sizePolicy) self.label_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_14.setObjectName("label_14") self.gridlayout30.addWidget(self.label_14,5,0,1,1) self.bg1_color_lbl_5 = QtGui.QLabel(self.dnaDisplayBaseOrientationIndicatorsGroupBox) self.bg1_color_lbl_5.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.bg1_color_lbl_5.setObjectName("bg1_color_lbl_5") self.gridlayout30.addWidget(self.bg1_color_lbl_5,1,0,1,1) self.vboxlayout27.addWidget(self.dnaDisplayBaseOrientationIndicatorsGroupBox) spacerItem36 = QtGui.QSpacerItem(20,111,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout27.addItem(spacerItem36) self.gridlayout29.addLayout(self.vboxlayout27,0,0,1,1) self.prefsStackedWidget.addWidget(self.BaseOrientationIndicators) self.Adjust = QtGui.QWidget() self.Adjust.setObjectName("Adjust") self.gridlayout31 = QtGui.QGridLayout(self.Adjust) self.gridlayout31.setMargin(9) self.gridlayout31.setSpacing(6) self.gridlayout31.setObjectName("gridlayout31") self.vboxlayout28 = QtGui.QVBoxLayout() self.vboxlayout28.setMargin(0) self.vboxlayout28.setSpacing(6) self.vboxlayout28.setObjectName("vboxlayout28") self.adjustPhysicsEngineGroupBox = QtGui.QGroupBox(self.Adjust) self.adjustPhysicsEngineGroupBox.setObjectName("adjustPhysicsEngineGroupBox") self.vboxlayout29 = QtGui.QVBoxLayout(self.adjustPhysicsEngineGroupBox) self.vboxlayout29.setMargin(9) self.vboxlayout29.setSpacing(4) self.vboxlayout29.setObjectName("vboxlayout29") self.adjustEngineCombobox = QtGui.QComboBox(self.adjustPhysicsEngineGroupBox) self.adjustEngineCombobox.setObjectName("adjustEngineCombobox") self.vboxlayout29.addWidget(self.adjustEngineCombobox) self.electrostaticsForDnaDuringAdjust_checkBox = QtGui.QCheckBox(self.adjustPhysicsEngineGroupBox) self.electrostaticsForDnaDuringAdjust_checkBox.setObjectName("electrostaticsForDnaDuringAdjust_checkBox") self.vboxlayout29.addWidget(self.electrostaticsForDnaDuringAdjust_checkBox) self.vboxlayout28.addWidget(self.adjustPhysicsEngineGroupBox) self.watch_motion_groupbox = QtGui.QGroupBox(self.Adjust) self.watch_motion_groupbox.setCheckable(True) self.watch_motion_groupbox.setObjectName("watch_motion_groupbox") self.vboxlayout30 = QtGui.QVBoxLayout(self.watch_motion_groupbox) self.vboxlayout30.setMargin(9) self.vboxlayout30.setSpacing(0) self.vboxlayout30.setObjectName("vboxlayout30") self.update_asap_rbtn = QtGui.QRadioButton(self.watch_motion_groupbox) self.update_asap_rbtn.setChecked(True) self.update_asap_rbtn.setObjectName("update_asap_rbtn") self.vboxlayout30.addWidget(self.update_asap_rbtn) self.hboxlayout41 = QtGui.QHBoxLayout() self.hboxlayout41.setMargin(0) self.hboxlayout41.setSpacing(6) self.hboxlayout41.setObjectName("hboxlayout41") self.update_every_rbtn = QtGui.QRadioButton(self.watch_motion_groupbox) self.update_every_rbtn.setObjectName("update_every_rbtn") self.hboxlayout41.addWidget(self.update_every_rbtn) self.update_number_spinbox = QtGui.QSpinBox(self.watch_motion_groupbox) self.update_number_spinbox.setMaximum(9999) self.update_number_spinbox.setMinimum(1) self.update_number_spinbox.setProperty("value",QtCore.QVariant(1)) self.update_number_spinbox.setObjectName("update_number_spinbox") self.hboxlayout41.addWidget(self.update_number_spinbox) self.update_units_combobox = QtGui.QComboBox(self.watch_motion_groupbox) self.update_units_combobox.setObjectName("update_units_combobox") self.hboxlayout41.addWidget(self.update_units_combobox) self.vboxlayout30.addLayout(self.hboxlayout41) self.vboxlayout28.addWidget(self.watch_motion_groupbox) self.groupBox20 = QtGui.QGroupBox(self.Adjust) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.groupBox20.sizePolicy().hasHeightForWidth()) self.groupBox20.setSizePolicy(sizePolicy) self.groupBox20.setObjectName("groupBox20") self.hboxlayout42 = QtGui.QHBoxLayout(self.groupBox20) self.hboxlayout42.setMargin(9) self.hboxlayout42.setSpacing(4) self.hboxlayout42.setObjectName("hboxlayout42") self.vboxlayout31 = QtGui.QVBoxLayout() self.vboxlayout31.setMargin(0) self.vboxlayout31.setSpacing(2) self.vboxlayout31.setObjectName("vboxlayout31") self.endrms_lbl = QtGui.QLabel(self.groupBox20) self.endrms_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.endrms_lbl.setObjectName("endrms_lbl") self.vboxlayout31.addWidget(self.endrms_lbl) self.endmax_lbl = QtGui.QLabel(self.groupBox20) self.endmax_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.endmax_lbl.setObjectName("endmax_lbl") self.vboxlayout31.addWidget(self.endmax_lbl) self.cutoverrms_lbl = QtGui.QLabel(self.groupBox20) self.cutoverrms_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.cutoverrms_lbl.setObjectName("cutoverrms_lbl") self.vboxlayout31.addWidget(self.cutoverrms_lbl) self.cutovermax_lbl = QtGui.QLabel(self.groupBox20) self.cutovermax_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.cutovermax_lbl.setObjectName("cutovermax_lbl") self.vboxlayout31.addWidget(self.cutovermax_lbl) self.hboxlayout42.addLayout(self.vboxlayout31) self.vboxlayout32 = QtGui.QVBoxLayout() self.vboxlayout32.setMargin(0) self.vboxlayout32.setSpacing(2) self.vboxlayout32.setObjectName("vboxlayout32") self.endRmsDoubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox20) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.endRmsDoubleSpinBox.sizePolicy().hasHeightForWidth()) self.endRmsDoubleSpinBox.setSizePolicy(sizePolicy) self.endRmsDoubleSpinBox.setDecimals(2) self.endRmsDoubleSpinBox.setMaximum(101.0) self.endRmsDoubleSpinBox.setProperty("value",QtCore.QVariant(1.0)) self.endRmsDoubleSpinBox.setObjectName("endRmsDoubleSpinBox") self.vboxlayout32.addWidget(self.endRmsDoubleSpinBox) self.endMaxDoubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox20) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.endMaxDoubleSpinBox.sizePolicy().hasHeightForWidth()) self.endMaxDoubleSpinBox.setSizePolicy(sizePolicy) self.endMaxDoubleSpinBox.setDecimals(2) self.endMaxDoubleSpinBox.setMaximum(101.0) self.endMaxDoubleSpinBox.setProperty("value",QtCore.QVariant(0.0)) self.endMaxDoubleSpinBox.setObjectName("endMaxDoubleSpinBox") self.vboxlayout32.addWidget(self.endMaxDoubleSpinBox) self.cutoverRmsDoubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox20) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.cutoverRmsDoubleSpinBox.sizePolicy().hasHeightForWidth()) self.cutoverRmsDoubleSpinBox.setSizePolicy(sizePolicy) self.cutoverRmsDoubleSpinBox.setDecimals(2) self.cutoverRmsDoubleSpinBox.setMaximum(101.0) self.cutoverRmsDoubleSpinBox.setProperty("value",QtCore.QVariant(0.0)) self.cutoverRmsDoubleSpinBox.setObjectName("cutoverRmsDoubleSpinBox") self.vboxlayout32.addWidget(self.cutoverRmsDoubleSpinBox) self.cutoverMaxDoubleSpinBox = QtGui.QDoubleSpinBox(self.groupBox20) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.cutoverMaxDoubleSpinBox.sizePolicy().hasHeightForWidth()) self.cutoverMaxDoubleSpinBox.setSizePolicy(sizePolicy) self.cutoverMaxDoubleSpinBox.setDecimals(2) self.cutoverMaxDoubleSpinBox.setMaximum(101.0) self.cutoverMaxDoubleSpinBox.setProperty("value",QtCore.QVariant(0.0)) self.cutoverMaxDoubleSpinBox.setObjectName("cutoverMaxDoubleSpinBox") self.vboxlayout32.addWidget(self.cutoverMaxDoubleSpinBox) self.hboxlayout42.addLayout(self.vboxlayout32) spacerItem37 = QtGui.QSpacerItem(80,20,QtGui.QSizePolicy.MinimumExpanding,QtGui.QSizePolicy.Minimum) self.hboxlayout42.addItem(spacerItem37) self.vboxlayout28.addWidget(self.groupBox20) spacerItem38 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout28.addItem(spacerItem38) self.gridlayout31.addLayout(self.vboxlayout28,0,0,2,1) self.grpbtn_4 = QtGui.QPushButton(self.Adjust) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.grpbtn_4.sizePolicy().hasHeightForWidth()) self.grpbtn_4.setSizePolicy(sizePolicy) self.grpbtn_4.setMaximumSize(QtCore.QSize(16,16)) self.grpbtn_4.setIcon(QtGui.QIcon("../../../../../../../:icons/MinimizeEnergyPropDialog_image6")) self.grpbtn_4.setAutoDefault(False) self.grpbtn_4.setDefault(False) self.grpbtn_4.setFlat(True) self.grpbtn_4.setObjectName("grpbtn_4") self.gridlayout31.addWidget(self.grpbtn_4,0,1,1,1) spacerItem39 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout31.addItem(spacerItem39,1,1,1,1) self.prefsStackedWidget.addWidget(self.Adjust) self.Lighting = QtGui.QWidget() self.Lighting.setObjectName("Lighting") self.gridlayout32 = QtGui.QGridLayout(self.Lighting) self.gridlayout32.setMargin(9) self.gridlayout32.setSpacing(6) self.gridlayout32.setObjectName("gridlayout32") self.vboxlayout33 = QtGui.QVBoxLayout() self.vboxlayout33.setMargin(0) self.vboxlayout33.setSpacing(4) self.vboxlayout33.setObjectName("vboxlayout33") self.groupBox8_2 = QtGui.QGroupBox(self.Lighting) self.groupBox8_2.setEnabled(True) self.groupBox8_2.setObjectName("groupBox8_2") self.gridlayout33 = QtGui.QGridLayout(self.groupBox8_2) self.gridlayout33.setMargin(9) self.gridlayout33.setSpacing(6) self.gridlayout33.setObjectName("gridlayout33") self.vboxlayout34 = QtGui.QVBoxLayout() self.vboxlayout34.setMargin(0) self.vboxlayout34.setSpacing(2) self.vboxlayout34.setObjectName("vboxlayout34") self.hboxlayout43 = QtGui.QHBoxLayout() self.hboxlayout43.setMargin(0) self.hboxlayout43.setSpacing(6) self.hboxlayout43.setObjectName("hboxlayout43") self.light_combobox = QtGui.QComboBox(self.groupBox8_2) self.light_combobox.setObjectName("light_combobox") self.hboxlayout43.addWidget(self.light_combobox) spacerItem40 = QtGui.QSpacerItem(60,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout43.addItem(spacerItem40) self.vboxlayout34.addLayout(self.hboxlayout43) self.hboxlayout44 = QtGui.QHBoxLayout() self.hboxlayout44.setMargin(0) self.hboxlayout44.setSpacing(6) self.hboxlayout44.setObjectName("hboxlayout44") self.light_checkbox = QtGui.QCheckBox(self.groupBox8_2) self.light_checkbox.setObjectName("light_checkbox") self.hboxlayout44.addWidget(self.light_checkbox) spacerItem41 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout44.addItem(spacerItem41) self.vboxlayout34.addLayout(self.hboxlayout44) self.hboxlayout45 = QtGui.QHBoxLayout() self.hboxlayout45.setMargin(0) self.hboxlayout45.setSpacing(6) self.hboxlayout45.setObjectName("hboxlayout45") self.hboxlayout46 = QtGui.QHBoxLayout() self.hboxlayout46.setMargin(0) self.hboxlayout46.setSpacing(6) self.hboxlayout46.setObjectName("hboxlayout46") self.light_color_frame = QtGui.QFrame(self.groupBox8_2) self.light_color_frame.setMinimumSize(QtCore.QSize(25,0)) self.light_color_frame.setFrameShape(QtGui.QFrame.Box) self.light_color_frame.setFrameShadow(QtGui.QFrame.Plain) self.light_color_frame.setObjectName("light_color_frame") self.hboxlayout46.addWidget(self.light_color_frame) self.light_color_btn = QtGui.QPushButton(self.groupBox8_2) self.light_color_btn.setAutoDefault(False) self.light_color_btn.setObjectName("light_color_btn") self.hboxlayout46.addWidget(self.light_color_btn) self.hboxlayout45.addLayout(self.hboxlayout46) spacerItem42 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout45.addItem(spacerItem42) self.vboxlayout34.addLayout(self.hboxlayout45) self.hboxlayout47 = QtGui.QHBoxLayout() self.hboxlayout47.setMargin(0) self.hboxlayout47.setSpacing(6) self.hboxlayout47.setObjectName("hboxlayout47") self.light_ambient_linedit = QtGui.QLineEdit(self.groupBox8_2) self.light_ambient_linedit.setMaximumSize(QtCore.QSize(40,32767)) self.light_ambient_linedit.setReadOnly(True) self.light_ambient_linedit.setObjectName("light_ambient_linedit") self.hboxlayout47.addWidget(self.light_ambient_linedit) self.light_ambient_slider = QtGui.QSlider(self.groupBox8_2) self.light_ambient_slider.setMaximum(100) self.light_ambient_slider.setOrientation(QtCore.Qt.Horizontal) self.light_ambient_slider.setTickInterval(10) self.light_ambient_slider.setObjectName("light_ambient_slider") self.hboxlayout47.addWidget(self.light_ambient_slider) self.vboxlayout34.addLayout(self.hboxlayout47) self.hboxlayout48 = QtGui.QHBoxLayout() self.hboxlayout48.setMargin(0) self.hboxlayout48.setSpacing(6) self.hboxlayout48.setObjectName("hboxlayout48") self.light_diffuse_linedit = QtGui.QLineEdit(self.groupBox8_2) self.light_diffuse_linedit.setMaximumSize(QtCore.QSize(40,32767)) self.light_diffuse_linedit.setReadOnly(True) self.light_diffuse_linedit.setObjectName("light_diffuse_linedit") self.hboxlayout48.addWidget(self.light_diffuse_linedit) self.light_diffuse_slider = QtGui.QSlider(self.groupBox8_2) self.light_diffuse_slider.setMaximum(100) self.light_diffuse_slider.setOrientation(QtCore.Qt.Horizontal) self.light_diffuse_slider.setTickInterval(10) self.light_diffuse_slider.setObjectName("light_diffuse_slider") self.hboxlayout48.addWidget(self.light_diffuse_slider) self.vboxlayout34.addLayout(self.hboxlayout48) self.hboxlayout49 = QtGui.QHBoxLayout() self.hboxlayout49.setMargin(0) self.hboxlayout49.setSpacing(6) self.hboxlayout49.setObjectName("hboxlayout49") self.light_specularity_linedit = QtGui.QLineEdit(self.groupBox8_2) self.light_specularity_linedit.setMaximumSize(QtCore.QSize(40,32767)) self.light_specularity_linedit.setReadOnly(True) self.light_specularity_linedit.setObjectName("light_specularity_linedit") self.hboxlayout49.addWidget(self.light_specularity_linedit) self.light_specularity_slider = QtGui.QSlider(self.groupBox8_2) self.light_specularity_slider.setMaximum(100) self.light_specularity_slider.setOrientation(QtCore.Qt.Horizontal) self.light_specularity_slider.setTickInterval(10) self.light_specularity_slider.setObjectName("light_specularity_slider") self.hboxlayout49.addWidget(self.light_specularity_slider) self.vboxlayout34.addLayout(self.hboxlayout49) self.hboxlayout50 = QtGui.QHBoxLayout() self.hboxlayout50.setMargin(0) self.hboxlayout50.setSpacing(6) self.hboxlayout50.setObjectName("hboxlayout50") self.light_x_linedit = QtGui.QLineEdit(self.groupBox8_2) self.light_x_linedit.setObjectName("light_x_linedit") self.hboxlayout50.addWidget(self.light_x_linedit) spacerItem43 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout50.addItem(spacerItem43) self.vboxlayout34.addLayout(self.hboxlayout50) self.hboxlayout51 = QtGui.QHBoxLayout() self.hboxlayout51.setMargin(0) self.hboxlayout51.setSpacing(6) self.hboxlayout51.setObjectName("hboxlayout51") self.light_y_linedit = QtGui.QLineEdit(self.groupBox8_2) self.light_y_linedit.setObjectName("light_y_linedit") self.hboxlayout51.addWidget(self.light_y_linedit) spacerItem44 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout51.addItem(spacerItem44) self.vboxlayout34.addLayout(self.hboxlayout51) self.hboxlayout52 = QtGui.QHBoxLayout() self.hboxlayout52.setMargin(0) self.hboxlayout52.setSpacing(6) self.hboxlayout52.setObjectName("hboxlayout52") self.light_z_linedit = QtGui.QLineEdit(self.groupBox8_2) self.light_z_linedit.setMaxLength(32767) self.light_z_linedit.setObjectName("light_z_linedit") self.hboxlayout52.addWidget(self.light_z_linedit) spacerItem45 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout52.addItem(spacerItem45) self.vboxlayout34.addLayout(self.hboxlayout52) self.gridlayout33.addLayout(self.vboxlayout34,0,1,1,1) self.vboxlayout35 = QtGui.QVBoxLayout() self.vboxlayout35.setMargin(0) self.vboxlayout35.setSpacing(2) self.vboxlayout35.setObjectName("vboxlayout35") self.light_label = QtGui.QLabel(self.groupBox8_2) self.light_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.light_label.setObjectName("light_label") self.vboxlayout35.addWidget(self.light_label) self.on_label = QtGui.QLabel(self.groupBox8_2) self.on_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.on_label.setObjectName("on_label") self.vboxlayout35.addWidget(self.on_label) self.color_label = QtGui.QLabel(self.groupBox8_2) self.color_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.color_label.setObjectName("color_label") self.vboxlayout35.addWidget(self.color_label) self.ambient_label = QtGui.QLabel(self.groupBox8_2) self.ambient_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.ambient_label.setObjectName("ambient_label") self.vboxlayout35.addWidget(self.ambient_label) self.diffuse_label = QtGui.QLabel(self.groupBox8_2) self.diffuse_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.diffuse_label.setObjectName("diffuse_label") self.vboxlayout35.addWidget(self.diffuse_label) self.specularity_label = QtGui.QLabel(self.groupBox8_2) self.specularity_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.specularity_label.setObjectName("specularity_label") self.vboxlayout35.addWidget(self.specularity_label) self.x_label = QtGui.QLabel(self.groupBox8_2) self.x_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.x_label.setObjectName("x_label") self.vboxlayout35.addWidget(self.x_label) self.y_label = QtGui.QLabel(self.groupBox8_2) self.y_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.y_label.setObjectName("y_label") self.vboxlayout35.addWidget(self.y_label) self.z_label = QtGui.QLabel(self.groupBox8_2) self.z_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.z_label.setObjectName("z_label") self.vboxlayout35.addWidget(self.z_label) self.gridlayout33.addLayout(self.vboxlayout35,0,0,1,1) self.vboxlayout33.addWidget(self.groupBox8_2) self.groupBox9_2 = QtGui.QGroupBox(self.Lighting) self.groupBox9_2.setEnabled(True) self.groupBox9_2.setObjectName("groupBox9_2") self.hboxlayout53 = QtGui.QHBoxLayout(self.groupBox9_2) self.hboxlayout53.setMargin(9) self.hboxlayout53.setSpacing(4) self.hboxlayout53.setObjectName("hboxlayout53") self.hboxlayout54 = QtGui.QHBoxLayout() self.hboxlayout54.setMargin(0) self.hboxlayout54.setSpacing(2) self.hboxlayout54.setObjectName("hboxlayout54") self.vboxlayout36 = QtGui.QVBoxLayout() self.vboxlayout36.setMargin(0) self.vboxlayout36.setSpacing(0) self.vboxlayout36.setObjectName("vboxlayout36") self.ms_on_label = QtGui.QLabel(self.groupBox9_2) self.ms_on_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.ms_on_label.setObjectName("ms_on_label") self.vboxlayout36.addWidget(self.ms_on_label) spacerItem46 = QtGui.QSpacerItem(70,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.vboxlayout36.addItem(spacerItem46) self.ms_finish_label = QtGui.QLabel(self.groupBox9_2) self.ms_finish_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.ms_finish_label.setObjectName("ms_finish_label") self.vboxlayout36.addWidget(self.ms_finish_label) spacerItem47 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.vboxlayout36.addItem(spacerItem47) self.ms_shininess_label = QtGui.QLabel(self.groupBox9_2) self.ms_shininess_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.ms_shininess_label.setObjectName("ms_shininess_label") self.vboxlayout36.addWidget(self.ms_shininess_label) spacerItem48 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.vboxlayout36.addItem(spacerItem48) self.ms_brightness__label = QtGui.QLabel(self.groupBox9_2) self.ms_brightness__label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.ms_brightness__label.setObjectName("ms_brightness__label") self.vboxlayout36.addWidget(self.ms_brightness__label) self.hboxlayout54.addLayout(self.vboxlayout36) self.vboxlayout37 = QtGui.QVBoxLayout() self.vboxlayout37.setMargin(0) self.vboxlayout37.setSpacing(0) self.vboxlayout37.setObjectName("vboxlayout37") self.ms_on_checkbox = QtGui.QCheckBox(self.groupBox9_2) self.ms_on_checkbox.setMinimumSize(QtCore.QSize(0,21)) self.ms_on_checkbox.setObjectName("ms_on_checkbox") self.vboxlayout37.addWidget(self.ms_on_checkbox) spacerItem49 = QtGui.QSpacerItem(50,20,QtGui.QSizePolicy.Fixed,QtGui.QSizePolicy.Minimum) self.vboxlayout37.addItem(spacerItem49) self.ms_finish_linedit = QtGui.QLineEdit(self.groupBox9_2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.ms_finish_linedit.sizePolicy().hasHeightForWidth()) self.ms_finish_linedit.setSizePolicy(sizePolicy) self.ms_finish_linedit.setMaximumSize(QtCore.QSize(50,32767)) self.ms_finish_linedit.setMaxLength(5) self.ms_finish_linedit.setReadOnly(True) self.ms_finish_linedit.setObjectName("ms_finish_linedit") self.vboxlayout37.addWidget(self.ms_finish_linedit) spacerItem50 = QtGui.QSpacerItem(50,20,QtGui.QSizePolicy.Fixed,QtGui.QSizePolicy.Minimum) self.vboxlayout37.addItem(spacerItem50) self.ms_shininess_linedit = QtGui.QLineEdit(self.groupBox9_2) self.ms_shininess_linedit.setMaximumSize(QtCore.QSize(50,32767)) self.ms_shininess_linedit.setMaxLength(5) self.ms_shininess_linedit.setReadOnly(True) self.ms_shininess_linedit.setObjectName("ms_shininess_linedit") self.vboxlayout37.addWidget(self.ms_shininess_linedit) spacerItem51 = QtGui.QSpacerItem(50,20,QtGui.QSizePolicy.Fixed,QtGui.QSizePolicy.Minimum) self.vboxlayout37.addItem(spacerItem51) self.ms_brightness_linedit = QtGui.QLineEdit(self.groupBox9_2) self.ms_brightness_linedit.setMaximumSize(QtCore.QSize(50,32767)) self.ms_brightness_linedit.setMaxLength(5) self.ms_brightness_linedit.setReadOnly(True) self.ms_brightness_linedit.setObjectName("ms_brightness_linedit") self.vboxlayout37.addWidget(self.ms_brightness_linedit) self.hboxlayout54.addLayout(self.vboxlayout37) self.vboxlayout38 = QtGui.QVBoxLayout() self.vboxlayout38.setMargin(0) self.vboxlayout38.setSpacing(0) self.vboxlayout38.setObjectName("vboxlayout38") spacerItem52 = QtGui.QSpacerItem(100,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.vboxlayout38.addItem(spacerItem52) self.hboxlayout55 = QtGui.QHBoxLayout() self.hboxlayout55.setMargin(0) self.hboxlayout55.setSpacing(4) self.hboxlayout55.setObjectName("hboxlayout55") self.textLabel1_6 = QtGui.QLabel(self.groupBox9_2) self.textLabel1_6.setObjectName("textLabel1_6") self.hboxlayout55.addWidget(self.textLabel1_6) spacerItem53 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Fixed,QtGui.QSizePolicy.Minimum) self.hboxlayout55.addItem(spacerItem53) self.textLabel2_4 = QtGui.QLabel(self.groupBox9_2) self.textLabel2_4.setObjectName("textLabel2_4") self.hboxlayout55.addWidget(self.textLabel2_4) self.vboxlayout38.addLayout(self.hboxlayout55) self.ms_finish_slider = QtGui.QSlider(self.groupBox9_2) self.ms_finish_slider.setMinimum(0) self.ms_finish_slider.setMaximum(100) self.ms_finish_slider.setProperty("value",QtCore.QVariant(50)) self.ms_finish_slider.setOrientation(QtCore.Qt.Horizontal) self.ms_finish_slider.setTickInterval(5) self.ms_finish_slider.setObjectName("ms_finish_slider") self.vboxlayout38.addWidget(self.ms_finish_slider) self.hboxlayout56 = QtGui.QHBoxLayout() self.hboxlayout56.setMargin(0) self.hboxlayout56.setSpacing(4) self.hboxlayout56.setObjectName("hboxlayout56") self.textLabel1_6_2 = QtGui.QLabel(self.groupBox9_2) self.textLabel1_6_2.setObjectName("textLabel1_6_2") self.hboxlayout56.addWidget(self.textLabel1_6_2) spacerItem54 = QtGui.QSpacerItem(16,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout56.addItem(spacerItem54) self.textLabel2_4_2 = QtGui.QLabel(self.groupBox9_2) self.textLabel2_4_2.setObjectName("textLabel2_4_2") self.hboxlayout56.addWidget(self.textLabel2_4_2) self.vboxlayout38.addLayout(self.hboxlayout56) self.ms_shininess_slider = QtGui.QSlider(self.groupBox9_2) self.ms_shininess_slider.setMinimum(15) self.ms_shininess_slider.setMaximum(60) self.ms_shininess_slider.setProperty("value",QtCore.QVariant(15)) self.ms_shininess_slider.setOrientation(QtCore.Qt.Horizontal) self.ms_shininess_slider.setTickInterval(5) self.ms_shininess_slider.setObjectName("ms_shininess_slider") self.vboxlayout38.addWidget(self.ms_shininess_slider) self.hboxlayout57 = QtGui.QHBoxLayout() self.hboxlayout57.setMargin(0) self.hboxlayout57.setSpacing(4) self.hboxlayout57.setObjectName("hboxlayout57") self.textLabel1_6_3 = QtGui.QLabel(self.groupBox9_2) self.textLabel1_6_3.setObjectName("textLabel1_6_3") self.hboxlayout57.addWidget(self.textLabel1_6_3) spacerItem55 = QtGui.QSpacerItem(16,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout57.addItem(spacerItem55) self.textLabel2_4_3 = QtGui.QLabel(self.groupBox9_2) self.textLabel2_4_3.setObjectName("textLabel2_4_3") self.hboxlayout57.addWidget(self.textLabel2_4_3) self.vboxlayout38.addLayout(self.hboxlayout57) self.ms_brightness_slider = QtGui.QSlider(self.groupBox9_2) self.ms_brightness_slider.setMinimum(0) self.ms_brightness_slider.setMaximum(100) self.ms_brightness_slider.setProperty("value",QtCore.QVariant(50)) self.ms_brightness_slider.setOrientation(QtCore.Qt.Horizontal) self.ms_brightness_slider.setTickInterval(5) self.ms_brightness_slider.setObjectName("ms_brightness_slider") self.vboxlayout38.addWidget(self.ms_brightness_slider) self.hboxlayout54.addLayout(self.vboxlayout38) self.hboxlayout53.addLayout(self.hboxlayout54) self.vboxlayout33.addWidget(self.groupBox9_2) spacerItem56 = QtGui.QSpacerItem(20,5,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout33.addItem(spacerItem56) self.gridlayout32.addLayout(self.vboxlayout33,0,0,2,1) self.hboxlayout58 = QtGui.QHBoxLayout() self.hboxlayout58.setMargin(0) self.hboxlayout58.setSpacing(6) self.hboxlayout58.setObjectName("hboxlayout58") spacerItem57 = QtGui.QSpacerItem(20,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout58.addItem(spacerItem57) self.lighting_restore_defaults_btn = QtGui.QPushButton(self.Lighting) self.lighting_restore_defaults_btn.setAutoDefault(False) self.lighting_restore_defaults_btn.setObjectName("lighting_restore_defaults_btn") self.hboxlayout58.addWidget(self.lighting_restore_defaults_btn) self.gridlayout32.addLayout(self.hboxlayout58,1,1,1,1) spacerItem58 = QtGui.QSpacerItem(30,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout32.addItem(spacerItem58,0,1,1,1) self.prefsStackedWidget.addWidget(self.Lighting) self.Plugins = QtGui.QWidget() self.Plugins.setObjectName("Plugins") self.vboxlayout39 = QtGui.QVBoxLayout(self.Plugins) self.vboxlayout39.setMargin(9) self.vboxlayout39.setSpacing(6) self.vboxlayout39.setObjectName("vboxlayout39") self.file_locations_grp = QtGui.QGroupBox(self.Plugins) self.file_locations_grp.setObjectName("file_locations_grp") self.gridlayout34 = QtGui.QGridLayout(self.file_locations_grp) self.gridlayout34.setMargin(9) self.gridlayout34.setSpacing(6) self.gridlayout34.setObjectName("gridlayout34") self.hboxlayout59 = QtGui.QHBoxLayout() self.hboxlayout59.setMargin(0) self.hboxlayout59.setSpacing(0) self.hboxlayout59.setObjectName("hboxlayout59") self.qutemol_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.qutemol_checkbox.setEnabled(True) self.qutemol_checkbox.setObjectName("qutemol_checkbox") self.hboxlayout59.addWidget(self.qutemol_checkbox) self.qutemol_lbl = QtGui.QLabel(self.file_locations_grp) self.qutemol_lbl.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.qutemol_lbl.sizePolicy().hasHeightForWidth()) self.qutemol_lbl.setSizePolicy(sizePolicy) self.qutemol_lbl.setMinimumSize(QtCore.QSize(60,0)) self.qutemol_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.qutemol_lbl.setObjectName("qutemol_lbl") self.hboxlayout59.addWidget(self.qutemol_lbl) self.gridlayout34.addLayout(self.hboxlayout59,0,0,1,1) self.qutemol_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.qutemol_path_lineedit.setEnabled(False) self.qutemol_path_lineedit.setObjectName("qutemol_path_lineedit") self.gridlayout34.addWidget(self.qutemol_path_lineedit,0,1,1,1) self.qutemol_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.qutemol_choose_btn.setObjectName("qutemol_choose_btn") self.gridlayout34.addWidget(self.qutemol_choose_btn,0,2,1,1) self.hboxlayout60 = QtGui.QHBoxLayout() self.hboxlayout60.setMargin(0) self.hboxlayout60.setSpacing(0) self.hboxlayout60.setObjectName("hboxlayout60") self.nanohive_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.nanohive_checkbox.setEnabled(True) self.nanohive_checkbox.setObjectName("nanohive_checkbox") self.hboxlayout60.addWidget(self.nanohive_checkbox) self.nanohive_lbl = QtGui.QLabel(self.file_locations_grp) self.nanohive_lbl.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.nanohive_lbl.sizePolicy().hasHeightForWidth()) self.nanohive_lbl.setSizePolicy(sizePolicy) self.nanohive_lbl.setMinimumSize(QtCore.QSize(60,0)) self.nanohive_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.nanohive_lbl.setObjectName("nanohive_lbl") self.hboxlayout60.addWidget(self.nanohive_lbl) self.gridlayout34.addLayout(self.hboxlayout60,1,0,1,1) self.nanohive_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.nanohive_path_lineedit.setEnabled(False) self.nanohive_path_lineedit.setObjectName("nanohive_path_lineedit") self.gridlayout34.addWidget(self.nanohive_path_lineedit,1,1,1,1) self.nanohive_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.nanohive_choose_btn.setObjectName("nanohive_choose_btn") self.gridlayout34.addWidget(self.nanohive_choose_btn,1,2,1,1) self.hboxlayout61 = QtGui.QHBoxLayout() self.hboxlayout61.setMargin(0) self.hboxlayout61.setSpacing(0) self.hboxlayout61.setObjectName("hboxlayout61") self.povray_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.povray_checkbox.setObjectName("povray_checkbox") self.hboxlayout61.addWidget(self.povray_checkbox) self.povray_lbl = QtGui.QLabel(self.file_locations_grp) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.povray_lbl.sizePolicy().hasHeightForWidth()) self.povray_lbl.setSizePolicy(sizePolicy) self.povray_lbl.setMinimumSize(QtCore.QSize(60,0)) self.povray_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.povray_lbl.setObjectName("povray_lbl") self.hboxlayout61.addWidget(self.povray_lbl) self.gridlayout34.addLayout(self.hboxlayout61,2,0,1,1) self.povray_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.povray_path_lineedit.setEnabled(False) self.povray_path_lineedit.setMaximumSize(QtCore.QSize(32767,32767)) self.povray_path_lineedit.setMaxLength(32767) self.povray_path_lineedit.setObjectName("povray_path_lineedit") self.gridlayout34.addWidget(self.povray_path_lineedit,2,1,1,1) self.povray_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.povray_choose_btn.setObjectName("povray_choose_btn") self.gridlayout34.addWidget(self.povray_choose_btn,2,2,1,1) self.hboxlayout62 = QtGui.QHBoxLayout() self.hboxlayout62.setMargin(0) self.hboxlayout62.setSpacing(0) self.hboxlayout62.setObjectName("hboxlayout62") self.megapov_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.megapov_checkbox.setObjectName("megapov_checkbox") self.hboxlayout62.addWidget(self.megapov_checkbox) self.megapov_lbl = QtGui.QLabel(self.file_locations_grp) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.megapov_lbl.sizePolicy().hasHeightForWidth()) self.megapov_lbl.setSizePolicy(sizePolicy) self.megapov_lbl.setMinimumSize(QtCore.QSize(60,0)) self.megapov_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.megapov_lbl.setObjectName("megapov_lbl") self.hboxlayout62.addWidget(self.megapov_lbl) self.gridlayout34.addLayout(self.hboxlayout62,3,0,1,1) self.megapov_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.megapov_path_lineedit.setEnabled(False) self.megapov_path_lineedit.setMaximumSize(QtCore.QSize(32767,32767)) self.megapov_path_lineedit.setMaxLength(32767) self.megapov_path_lineedit.setObjectName("megapov_path_lineedit") self.gridlayout34.addWidget(self.megapov_path_lineedit,3,1,1,1) self.megapov_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.megapov_choose_btn.setObjectName("megapov_choose_btn") self.gridlayout34.addWidget(self.megapov_choose_btn,3,2,1,1) self.hboxlayout63 = QtGui.QHBoxLayout() self.hboxlayout63.setMargin(0) self.hboxlayout63.setSpacing(2) self.hboxlayout63.setObjectName("hboxlayout63") self.povdir_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.povdir_checkbox.setEnabled(True) self.povdir_checkbox.setMinimumSize(QtCore.QSize(15,15)) self.povdir_checkbox.setMaximumSize(QtCore.QSize(15,15)) self.povdir_checkbox.setObjectName("povdir_checkbox") self.hboxlayout63.addWidget(self.povdir_checkbox) self.povdir_lbl = QtGui.QLabel(self.file_locations_grp) self.povdir_lbl.setEnabled(True) self.povdir_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.povdir_lbl.setObjectName("povdir_lbl") self.hboxlayout63.addWidget(self.povdir_lbl) self.gridlayout34.addLayout(self.hboxlayout63,4,0,1,1) self.povdir_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.povdir_lineedit.setEnabled(False) self.povdir_lineedit.setObjectName("povdir_lineedit") self.gridlayout34.addWidget(self.povdir_lineedit,4,1,1,1) self.povdir_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.povdir_choose_btn.setObjectName("povdir_choose_btn") self.gridlayout34.addWidget(self.povdir_choose_btn,4,2,1,1) self.hboxlayout64 = QtGui.QHBoxLayout() self.hboxlayout64.setMargin(0) self.hboxlayout64.setSpacing(0) self.hboxlayout64.setObjectName("hboxlayout64") self.gamess_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.gamess_checkbox.setObjectName("gamess_checkbox") self.hboxlayout64.addWidget(self.gamess_checkbox) self.gamess_lbl = QtGui.QLabel(self.file_locations_grp) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.gamess_lbl.sizePolicy().hasHeightForWidth()) self.gamess_lbl.setSizePolicy(sizePolicy) self.gamess_lbl.setMinimumSize(QtCore.QSize(60,0)) self.gamess_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.gamess_lbl.setObjectName("gamess_lbl") self.hboxlayout64.addWidget(self.gamess_lbl) self.gridlayout34.addLayout(self.hboxlayout64,5,0,1,1) self.gamess_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.gamess_path_lineedit.setEnabled(False) self.gamess_path_lineedit.setMaximumSize(QtCore.QSize(32767,32767)) self.gamess_path_lineedit.setMaxLength(32767) self.gamess_path_lineedit.setObjectName("gamess_path_lineedit") self.gridlayout34.addWidget(self.gamess_path_lineedit,5,1,1,1) self.gamess_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.gamess_choose_btn.setObjectName("gamess_choose_btn") self.gridlayout34.addWidget(self.gamess_choose_btn,5,2,1,1) self.hboxlayout65 = QtGui.QHBoxLayout() self.hboxlayout65.setMargin(0) self.hboxlayout65.setSpacing(0) self.hboxlayout65.setObjectName("hboxlayout65") self.gromacs_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.gromacs_checkbox.setObjectName("gromacs_checkbox") self.hboxlayout65.addWidget(self.gromacs_checkbox) self.gromacs_label = QtGui.QLabel(self.file_locations_grp) self.gromacs_label.setObjectName("gromacs_label") self.hboxlayout65.addWidget(self.gromacs_label) self.gridlayout34.addLayout(self.hboxlayout65,6,0,1,1) self.gromacs_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.gromacs_path_lineedit.setEnabled(False) self.gromacs_path_lineedit.setObjectName("gromacs_path_lineedit") self.gridlayout34.addWidget(self.gromacs_path_lineedit,6,1,1,1) self.gromacs_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.gromacs_choose_btn.setObjectName("gromacs_choose_btn") self.gridlayout34.addWidget(self.gromacs_choose_btn,6,2,1,1) self.hboxlayout66 = QtGui.QHBoxLayout() self.hboxlayout66.setMargin(0) self.hboxlayout66.setSpacing(0) self.hboxlayout66.setObjectName("hboxlayout66") self.cpp_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.cpp_checkbox.setObjectName("cpp_checkbox") self.hboxlayout66.addWidget(self.cpp_checkbox) self.cpp_label = QtGui.QLabel(self.file_locations_grp) self.cpp_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.cpp_label.setObjectName("cpp_label") self.hboxlayout66.addWidget(self.cpp_label) self.gridlayout34.addLayout(self.hboxlayout66,7,0,1,1) self.cpp_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.cpp_path_lineedit.setEnabled(False) self.cpp_path_lineedit.setObjectName("cpp_path_lineedit") self.gridlayout34.addWidget(self.cpp_path_lineedit,7,1,1,1) self.cpp_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.cpp_choose_btn.setObjectName("cpp_choose_btn") self.gridlayout34.addWidget(self.cpp_choose_btn,7,2,1,1) self.hboxlayout67 = QtGui.QHBoxLayout() self.hboxlayout67.setMargin(0) self.hboxlayout67.setSpacing(0) self.hboxlayout67.setObjectName("hboxlayout67") self.nv1_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.nv1_checkbox.setObjectName("nv1_checkbox") self.hboxlayout67.addWidget(self.nv1_checkbox) self.nv1_label = QtGui.QLabel(self.file_locations_grp) self.nv1_label.setObjectName("nv1_label") self.hboxlayout67.addWidget(self.nv1_label) self.gridlayout34.addLayout(self.hboxlayout67,10,0,1,1) self.nv1_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.nv1_path_lineedit.setEnabled(False) self.nv1_path_lineedit.setObjectName("nv1_path_lineedit") self.gridlayout34.addWidget(self.nv1_path_lineedit,10,1,1,1) self.nv1_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.nv1_choose_btn.setObjectName("nv1_choose_btn") self.gridlayout34.addWidget(self.nv1_choose_btn,10,2,1,1) self.hboxlayout68 = QtGui.QHBoxLayout() self.hboxlayout68.setMargin(0) self.hboxlayout68.setSpacing(0) self.hboxlayout68.setObjectName("hboxlayout68") self.rosetta_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.rosetta_checkbox.setObjectName("rosetta_checkbox") self.hboxlayout68.addWidget(self.rosetta_checkbox) self.rosetta_label = QtGui.QLabel(self.file_locations_grp) self.rosetta_label.setObjectName("rosetta_label") self.hboxlayout68.addWidget(self.rosetta_label) self.gridlayout34.addLayout(self.hboxlayout68,8,0,1,1) self.rosetta_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.rosetta_path_lineedit.setEnabled(False) self.rosetta_path_lineedit.setObjectName("rosetta_path_lineedit") self.gridlayout34.addWidget(self.rosetta_path_lineedit,8,1,1,1) self.rosetta_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.rosetta_choose_btn.setObjectName("rosetta_choose_btn") self.gridlayout34.addWidget(self.rosetta_choose_btn,8,2,1,1) self.hboxlayout69 = QtGui.QHBoxLayout() self.hboxlayout69.setMargin(0) self.hboxlayout69.setSpacing(0) self.hboxlayout69.setObjectName("hboxlayout69") self.rosetta_db_checkbox = QtGui.QCheckBox(self.file_locations_grp) self.rosetta_db_checkbox.setObjectName("rosetta_db_checkbox") self.hboxlayout69.addWidget(self.rosetta_db_checkbox) self.rosetta_db_label = QtGui.QLabel(self.file_locations_grp) self.rosetta_db_label.setObjectName("rosetta_db_label") self.hboxlayout69.addWidget(self.rosetta_db_label) self.gridlayout34.addLayout(self.hboxlayout69,9,0,1,1) self.rosetta_db_path_lineedit = QtGui.QLineEdit(self.file_locations_grp) self.rosetta_db_path_lineedit.setEnabled(False) self.rosetta_db_path_lineedit.setObjectName("rosetta_db_path_lineedit") self.gridlayout34.addWidget(self.rosetta_db_path_lineedit,9,1,1,1) self.rosetta_db_choose_btn = QtGui.QToolButton(self.file_locations_grp) self.rosetta_db_choose_btn.setObjectName("rosetta_db_choose_btn") self.gridlayout34.addWidget(self.rosetta_db_choose_btn,9,2,1,1) self.vboxlayout39.addWidget(self.file_locations_grp) spacerItem59 = QtGui.QSpacerItem(384,71,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout39.addItem(spacerItem59) self.prefsStackedWidget.addWidget(self.Plugins) self.Undo = QtGui.QWidget() self.Undo.setObjectName("Undo") self.gridlayout35 = QtGui.QGridLayout(self.Undo) self.gridlayout35.setMargin(9) self.gridlayout35.setSpacing(6) self.gridlayout35.setObjectName("gridlayout35") spacerItem60 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout35.addItem(spacerItem60,0,1,1,1) self.vboxlayout40 = QtGui.QVBoxLayout() self.vboxlayout40.setMargin(0) self.vboxlayout40.setSpacing(4) self.vboxlayout40.setObjectName("vboxlayout40") self.vboxlayout41 = QtGui.QVBoxLayout() self.vboxlayout41.setMargin(0) self.vboxlayout41.setSpacing(2) self.vboxlayout41.setObjectName("vboxlayout41") self.undo_restore_view_checkbox = QtGui.QCheckBox(self.Undo) self.undo_restore_view_checkbox.setObjectName("undo_restore_view_checkbox") self.vboxlayout41.addWidget(self.undo_restore_view_checkbox) self.undo_automatic_checkpoints_checkbox = QtGui.QCheckBox(self.Undo) self.undo_automatic_checkpoints_checkbox.setObjectName("undo_automatic_checkpoints_checkbox") self.vboxlayout41.addWidget(self.undo_automatic_checkpoints_checkbox) self.hboxlayout70 = QtGui.QHBoxLayout() self.hboxlayout70.setMargin(0) self.hboxlayout70.setSpacing(6) self.hboxlayout70.setObjectName("hboxlayout70") self.undo_stack_memory_limit_label = QtGui.QLabel(self.Undo) self.undo_stack_memory_limit_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.undo_stack_memory_limit_label.setObjectName("undo_stack_memory_limit_label") self.hboxlayout70.addWidget(self.undo_stack_memory_limit_label) self.undo_stack_memory_limit_spinbox = QtGui.QSpinBox(self.Undo) self.undo_stack_memory_limit_spinbox.setMaximum(99999) self.undo_stack_memory_limit_spinbox.setObjectName("undo_stack_memory_limit_spinbox") self.hboxlayout70.addWidget(self.undo_stack_memory_limit_spinbox) self.vboxlayout41.addLayout(self.hboxlayout70) self.vboxlayout40.addLayout(self.vboxlayout41) spacerItem61 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout40.addItem(spacerItem61) self.gridlayout35.addLayout(self.vboxlayout40,0,0,1,1) self.prefsStackedWidget.addWidget(self.Undo) self.Window = QtGui.QWidget() self.Window.setObjectName("Window") self.gridlayout36 = QtGui.QGridLayout(self.Window) self.gridlayout36.setMargin(9) self.gridlayout36.setSpacing(6) self.gridlayout36.setObjectName("gridlayout36") self.hboxlayout71 = QtGui.QHBoxLayout() self.hboxlayout71.setMargin(0) self.hboxlayout71.setSpacing(4) self.hboxlayout71.setObjectName("hboxlayout71") self.groupBox10 = QtGui.QGroupBox(self.Window) self.groupBox10.setObjectName("groupBox10") self.gridlayout37 = QtGui.QGridLayout(self.groupBox10) self.gridlayout37.setMargin(9) self.gridlayout37.setSpacing(6) self.gridlayout37.setObjectName("gridlayout37") self.remember_win_pos_and_size_checkbox = QtGui.QCheckBox(self.groupBox10) self.remember_win_pos_and_size_checkbox.setObjectName("remember_win_pos_and_size_checkbox") self.gridlayout37.addWidget(self.remember_win_pos_and_size_checkbox,1,0,1,3) self.vboxlayout42 = QtGui.QVBoxLayout() self.vboxlayout42.setMargin(0) self.vboxlayout42.setSpacing(6) self.vboxlayout42.setObjectName("vboxlayout42") self.save_current_btn = QtGui.QPushButton(self.groupBox10) self.save_current_btn.setAutoDefault(False) self.save_current_btn.setObjectName("save_current_btn") self.vboxlayout42.addWidget(self.save_current_btn) self.restore_saved_size_btn = QtGui.QPushButton(self.groupBox10) self.restore_saved_size_btn.setAutoDefault(False) self.restore_saved_size_btn.setObjectName("restore_saved_size_btn") self.vboxlayout42.addWidget(self.restore_saved_size_btn) self.gridlayout37.addLayout(self.vboxlayout42,0,2,1,1) self.vboxlayout43 = QtGui.QVBoxLayout() self.vboxlayout43.setMargin(0) self.vboxlayout43.setSpacing(6) self.vboxlayout43.setObjectName("vboxlayout43") self.textLabel1_2 = QtGui.QLabel(self.groupBox10) self.textLabel1_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_2.setObjectName("textLabel1_2") self.vboxlayout43.addWidget(self.textLabel1_2) self.textLabel1_2_2 = QtGui.QLabel(self.groupBox10) self.textLabel1_2_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_2_2.setObjectName("textLabel1_2_2") self.vboxlayout43.addWidget(self.textLabel1_2_2) self.gridlayout37.addLayout(self.vboxlayout43,0,0,1,1) self.gridlayout38 = QtGui.QGridLayout() self.gridlayout38.setMargin(0) self.gridlayout38.setSpacing(6) self.gridlayout38.setObjectName("gridlayout38") self.current_width_spinbox = QtGui.QSpinBox(self.groupBox10) self.current_width_spinbox.setMaximum(2048) self.current_width_spinbox.setMinimum(640) self.current_width_spinbox.setProperty("value",QtCore.QVariant(640)) self.current_width_spinbox.setObjectName("current_width_spinbox") self.gridlayout38.addWidget(self.current_width_spinbox,0,0,1,1) self.saved_height_lineedit = QtGui.QLineEdit(self.groupBox10) self.saved_height_lineedit.setReadOnly(True) self.saved_height_lineedit.setObjectName("saved_height_lineedit") self.gridlayout38.addWidget(self.saved_height_lineedit,1,2,1,1) self.current_height_spinbox = QtGui.QSpinBox(self.groupBox10) self.current_height_spinbox.setMaximum(2000) self.current_height_spinbox.setMinimum(480) self.current_height_spinbox.setProperty("value",QtCore.QVariant(480)) self.current_height_spinbox.setObjectName("current_height_spinbox") self.gridlayout38.addWidget(self.current_height_spinbox,0,2,1,1) self.saved_width_lineedit = QtGui.QLineEdit(self.groupBox10) self.saved_width_lineedit.setReadOnly(True) self.saved_width_lineedit.setObjectName("saved_width_lineedit") self.gridlayout38.addWidget(self.saved_width_lineedit,1,0,1,1) self.textLabel1_2_2_2 = QtGui.QLabel(self.groupBox10) self.textLabel1_2_2_2.setAlignment(QtCore.Qt.AlignCenter) self.textLabel1_2_2_2.setObjectName("textLabel1_2_2_2") self.gridlayout38.addWidget(self.textLabel1_2_2_2,0,1,1,1) self.textLabel1_2_2_2_2 = QtGui.QLabel(self.groupBox10) self.textLabel1_2_2_2_2.setAlignment(QtCore.Qt.AlignCenter) self.textLabel1_2_2_2_2.setObjectName("textLabel1_2_2_2_2") self.gridlayout38.addWidget(self.textLabel1_2_2_2_2,1,1,1,1) self.gridlayout37.addLayout(self.gridlayout38,0,1,1,1) self.hboxlayout71.addWidget(self.groupBox10) spacerItem62 = QtGui.QSpacerItem(70,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout71.addItem(spacerItem62) self.gridlayout36.addLayout(self.hboxlayout71,0,0,1,1) self.hboxlayout72 = QtGui.QHBoxLayout() self.hboxlayout72.setMargin(0) self.hboxlayout72.setSpacing(4) self.hboxlayout72.setObjectName("hboxlayout72") self.groupBox3 = QtGui.QGroupBox(self.Window) self.groupBox3.setObjectName("groupBox3") self.gridlayout39 = QtGui.QGridLayout(self.groupBox3) self.gridlayout39.setMargin(9) self.gridlayout39.setSpacing(6) self.gridlayout39.setObjectName("gridlayout39") self.caption_fullpath_checkbox = QtGui.QCheckBox(self.groupBox3) self.caption_fullpath_checkbox.setObjectName("caption_fullpath_checkbox") self.gridlayout39.addWidget(self.caption_fullpath_checkbox,4,0,1,1) self.caption_suffix_linedit = QtGui.QLineEdit(self.groupBox3) self.caption_suffix_linedit.setMinimumSize(QtCore.QSize(0,0)) self.caption_suffix_linedit.setMaximumSize(QtCore.QSize(32767,32767)) self.caption_suffix_linedit.setObjectName("caption_suffix_linedit") self.gridlayout39.addWidget(self.caption_suffix_linedit,3,0,1,1) self.textLabel2_2 = QtGui.QLabel(self.groupBox3) self.textLabel2_2.setObjectName("textLabel2_2") self.gridlayout39.addWidget(self.textLabel2_2,2,0,1,1) self.caption_prefix_linedit = QtGui.QLineEdit(self.groupBox3) self.caption_prefix_linedit.setMinimumSize(QtCore.QSize(0,0)) self.caption_prefix_linedit.setMaximumSize(QtCore.QSize(32767,32767)) self.caption_prefix_linedit.setObjectName("caption_prefix_linedit") self.gridlayout39.addWidget(self.caption_prefix_linedit,1,0,1,1) self.textLabel2 = QtGui.QLabel(self.groupBox3) self.textLabel2.setObjectName("textLabel2") self.gridlayout39.addWidget(self.textLabel2,0,0,1,1) self.hboxlayout72.addWidget(self.groupBox3) spacerItem63 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout72.addItem(spacerItem63) self.gridlayout36.addLayout(self.hboxlayout72,1,0,1,1) spacerItem64 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.gridlayout36.addItem(spacerItem64,3,0,1,1) self.hboxlayout73 = QtGui.QHBoxLayout() self.hboxlayout73.setMargin(0) self.hboxlayout73.setSpacing(4) self.hboxlayout73.setObjectName("hboxlayout73") self.selectedFontGroupBox = QtGui.QGroupBox(self.Window) self.selectedFontGroupBox.setCheckable(True) self.selectedFontGroupBox.setChecked(False) self.selectedFontGroupBox.setObjectName("selectedFontGroupBox") self.gridlayout40 = QtGui.QGridLayout(self.selectedFontGroupBox) self.gridlayout40.setMargin(9) self.gridlayout40.setSpacing(6) self.gridlayout40.setObjectName("gridlayout40") self.makeDefaultFontPushButton = QtGui.QPushButton(self.selectedFontGroupBox) self.makeDefaultFontPushButton.setAutoDefault(False) self.makeDefaultFontPushButton.setObjectName("makeDefaultFontPushButton") self.gridlayout40.addWidget(self.makeDefaultFontPushButton,1,0,1,2) self.vboxlayout44 = QtGui.QVBoxLayout() self.vboxlayout44.setMargin(0) self.vboxlayout44.setSpacing(6) self.vboxlayout44.setObjectName("vboxlayout44") self.fontComboBox = QtGui.QFontComboBox(self.selectedFontGroupBox) self.fontComboBox.setFontFilters(QtGui.QFontComboBox.AllFonts|QtGui.QFontComboBox.ProportionalFonts|QtGui.QFontComboBox.ScalableFonts) font = QtGui.QFont() font.setFamily("Arial") self.fontComboBox.setCurrentFont(font) self.fontComboBox.setObjectName("fontComboBox") self.vboxlayout44.addWidget(self.fontComboBox) self.hboxlayout74 = QtGui.QHBoxLayout() self.hboxlayout74.setMargin(0) self.hboxlayout74.setSpacing(6) self.hboxlayout74.setObjectName("hboxlayout74") self.fontSizeSpinBox = QtGui.QSpinBox(self.selectedFontGroupBox) self.fontSizeSpinBox.setMaximum(24) self.fontSizeSpinBox.setMinimum(6) self.fontSizeSpinBox.setProperty("value",QtCore.QVariant(9)) self.fontSizeSpinBox.setObjectName("fontSizeSpinBox") self.hboxlayout74.addWidget(self.fontSizeSpinBox) spacerItem65 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout74.addItem(spacerItem65) self.vboxlayout44.addLayout(self.hboxlayout74) self.gridlayout40.addLayout(self.vboxlayout44,0,1,1,1) self.vboxlayout45 = QtGui.QVBoxLayout() self.vboxlayout45.setMargin(0) self.vboxlayout45.setSpacing(6) self.vboxlayout45.setObjectName("vboxlayout45") self.label = QtGui.QLabel(self.selectedFontGroupBox) self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label.setObjectName("label") self.vboxlayout45.addWidget(self.label) self.label_3 = QtGui.QLabel(self.selectedFontGroupBox) self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_3.setObjectName("label_3") self.vboxlayout45.addWidget(self.label_3) self.gridlayout40.addLayout(self.vboxlayout45,0,0,1,1) self.hboxlayout73.addWidget(self.selectedFontGroupBox) spacerItem66 = QtGui.QSpacerItem(280,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout73.addItem(spacerItem66) self.gridlayout36.addLayout(self.hboxlayout73,2,0,1,1) self.prefsStackedWidget.addWidget(self.Window) self.Reports = QtGui.QWidget() self.Reports.setObjectName("Reports") self.gridlayout41 = QtGui.QGridLayout(self.Reports) self.gridlayout41.setMargin(9) self.gridlayout41.setSpacing(6) self.gridlayout41.setObjectName("gridlayout41") self.vboxlayout46 = QtGui.QVBoxLayout() self.vboxlayout46.setMargin(0) self.vboxlayout46.setSpacing(4) self.vboxlayout46.setObjectName("vboxlayout46") self.groupBox17 = QtGui.QGroupBox(self.Reports) self.groupBox17.setObjectName("groupBox17") self.gridlayout42 = QtGui.QGridLayout(self.groupBox17) self.gridlayout42.setMargin(9) self.gridlayout42.setSpacing(6) self.gridlayout42.setObjectName("gridlayout42") self.msg_serial_number_checkbox = QtGui.QCheckBox(self.groupBox17) self.msg_serial_number_checkbox.setObjectName("msg_serial_number_checkbox") self.gridlayout42.addWidget(self.msg_serial_number_checkbox,0,0,1,2) self.msg_timestamp_checkbox = QtGui.QCheckBox(self.groupBox17) self.msg_timestamp_checkbox.setObjectName("msg_timestamp_checkbox") self.gridlayout42.addWidget(self.msg_timestamp_checkbox,1,0,1,2) self.vboxlayout46.addWidget(self.groupBox17) spacerItem67 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout46.addItem(spacerItem67) self.gridlayout41.addLayout(self.vboxlayout46,0,0,1,1) spacerItem68 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout41.addItem(spacerItem68,0,1,1,1) self.prefsStackedWidget.addWidget(self.Reports) self.Tooltips = QtGui.QWidget() self.Tooltips.setObjectName("Tooltips") self.gridlayout43 = QtGui.QGridLayout(self.Tooltips) self.gridlayout43.setMargin(9) self.gridlayout43.setSpacing(6) self.gridlayout43.setObjectName("gridlayout43") spacerItem69 = QtGui.QSpacerItem(90,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout43.addItem(spacerItem69,0,1,1,1) self.vboxlayout47 = QtGui.QVBoxLayout() self.vboxlayout47.setMargin(0) self.vboxlayout47.setSpacing(4) self.vboxlayout47.setObjectName("vboxlayout47") self.atom_dynamic_tooltips_grpbox = QtGui.QGroupBox(self.Tooltips) self.atom_dynamic_tooltips_grpbox.setObjectName("atom_dynamic_tooltips_grpbox") self.vboxlayout48 = QtGui.QVBoxLayout(self.atom_dynamic_tooltips_grpbox) self.vboxlayout48.setMargin(9) self.vboxlayout48.setSpacing(0) self.vboxlayout48.setObjectName("vboxlayout48") self.dynamicToolTipAtomChunkInfo_checkbox = QtGui.QCheckBox(self.atom_dynamic_tooltips_grpbox) self.dynamicToolTipAtomChunkInfo_checkbox.setChecked(False) self.dynamicToolTipAtomChunkInfo_checkbox.setObjectName("dynamicToolTipAtomChunkInfo_checkbox") self.vboxlayout48.addWidget(self.dynamicToolTipAtomChunkInfo_checkbox) self.dynamicToolTipAtomMass_checkbox = QtGui.QCheckBox(self.atom_dynamic_tooltips_grpbox) self.dynamicToolTipAtomMass_checkbox.setObjectName("dynamicToolTipAtomMass_checkbox") self.vboxlayout48.addWidget(self.dynamicToolTipAtomMass_checkbox) self.dynamicToolTipAtomPosition_checkbox = QtGui.QCheckBox(self.atom_dynamic_tooltips_grpbox) self.dynamicToolTipAtomPosition_checkbox.setChecked(False) self.dynamicToolTipAtomPosition_checkbox.setObjectName("dynamicToolTipAtomPosition_checkbox") self.vboxlayout48.addWidget(self.dynamicToolTipAtomPosition_checkbox) self.dynamicToolTipAtomDistanceDeltas_checkbox = QtGui.QCheckBox(self.atom_dynamic_tooltips_grpbox) self.dynamicToolTipAtomDistanceDeltas_checkbox.setObjectName("dynamicToolTipAtomDistanceDeltas_checkbox") self.vboxlayout48.addWidget(self.dynamicToolTipAtomDistanceDeltas_checkbox) self.includeVdwRadiiInAtomDistanceInfo = QtGui.QCheckBox(self.atom_dynamic_tooltips_grpbox) self.includeVdwRadiiInAtomDistanceInfo.setObjectName("includeVdwRadiiInAtomDistanceInfo") self.vboxlayout48.addWidget(self.includeVdwRadiiInAtomDistanceInfo) self.hboxlayout75 = QtGui.QHBoxLayout() self.hboxlayout75.setMargin(0) self.hboxlayout75.setSpacing(4) self.hboxlayout75.setObjectName("hboxlayout75") self.gridlayout44 = QtGui.QGridLayout() self.gridlayout44.setMargin(0) self.gridlayout44.setSpacing(6) self.gridlayout44.setObjectName("gridlayout44") self.atomDistPrecisionLabel = QtGui.QLabel(self.atom_dynamic_tooltips_grpbox) self.atomDistPrecisionLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.atomDistPrecisionLabel.setObjectName("atomDistPrecisionLabel") self.gridlayout44.addWidget(self.atomDistPrecisionLabel,0,0,1,1) self.dynamicToolTipAtomDistancePrecision_spinbox = QtGui.QSpinBox(self.atom_dynamic_tooltips_grpbox) self.dynamicToolTipAtomDistancePrecision_spinbox.setMaximum(5) self.dynamicToolTipAtomDistancePrecision_spinbox.setMinimum(1) self.dynamicToolTipAtomDistancePrecision_spinbox.setProperty("value",QtCore.QVariant(3)) self.dynamicToolTipAtomDistancePrecision_spinbox.setObjectName("dynamicToolTipAtomDistancePrecision_spinbox") self.gridlayout44.addWidget(self.dynamicToolTipAtomDistancePrecision_spinbox,0,1,1,1) self.dynamicToolTipBendAnglePrecision_spinbox = QtGui.QSpinBox(self.atom_dynamic_tooltips_grpbox) self.dynamicToolTipBendAnglePrecision_spinbox.setMaximum(5) self.dynamicToolTipBendAnglePrecision_spinbox.setMinimum(1) self.dynamicToolTipBendAnglePrecision_spinbox.setProperty("value",QtCore.QVariant(3)) self.dynamicToolTipBendAnglePrecision_spinbox.setObjectName("dynamicToolTipBendAnglePrecision_spinbox") self.gridlayout44.addWidget(self.dynamicToolTipBendAnglePrecision_spinbox,1,1,1,1) self.textLabel1_8_3 = QtGui.QLabel(self.atom_dynamic_tooltips_grpbox) self.textLabel1_8_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.textLabel1_8_3.setObjectName("textLabel1_8_3") self.gridlayout44.addWidget(self.textLabel1_8_3,1,0,1,1) self.hboxlayout75.addLayout(self.gridlayout44) spacerItem70 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout75.addItem(spacerItem70) self.vboxlayout48.addLayout(self.hboxlayout75) self.vboxlayout47.addWidget(self.atom_dynamic_tooltips_grpbox) self.groupBox35 = QtGui.QGroupBox(self.Tooltips) self.groupBox35.setObjectName("groupBox35") self.gridlayout45 = QtGui.QGridLayout(self.groupBox35) self.gridlayout45.setMargin(9) self.gridlayout45.setSpacing(6) self.gridlayout45.setObjectName("gridlayout45") self.dynamicToolTipBondChunkInfo_checkbox = QtGui.QCheckBox(self.groupBox35) self.dynamicToolTipBondChunkInfo_checkbox.setObjectName("dynamicToolTipBondChunkInfo_checkbox") self.gridlayout45.addWidget(self.dynamicToolTipBondChunkInfo_checkbox,1,0,1,1) self.dynamicToolTipBondLength_checkbox = QtGui.QCheckBox(self.groupBox35) self.dynamicToolTipBondLength_checkbox.setObjectName("dynamicToolTipBondLength_checkbox") self.gridlayout45.addWidget(self.dynamicToolTipBondLength_checkbox,0,0,1,1) self.vboxlayout47.addWidget(self.groupBox35) spacerItem71 = QtGui.QSpacerItem(20,161,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout47.addItem(spacerItem71) self.gridlayout43.addLayout(self.vboxlayout47,0,0,1,1) self.prefsStackedWidget.addWidget(self.Tooltips) self.hboxlayout.addWidget(self.prefsStackedWidget) self.prefsTabWidget.addTab(self.systemOptionsTab,"") self.gridlayout.addWidget(self.prefsTabWidget,0,0,1,1) self.hboxlayout76 = QtGui.QHBoxLayout() self.hboxlayout76.setMargin(0) self.hboxlayout76.setSpacing(6) self.hboxlayout76.setObjectName("hboxlayout76") self.whatsThisToolButton = QtGui.QToolButton(PreferencesDialog) self.whatsThisToolButton.setObjectName("whatsThisToolButton") self.hboxlayout76.addWidget(self.whatsThisToolButton) spacerItem72 = QtGui.QSpacerItem(321,23,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout76.addItem(spacerItem72) self.okButton = QtGui.QPushButton(PreferencesDialog) self.okButton.setObjectName("okButton") self.hboxlayout76.addWidget(self.okButton) self.gridlayout.addLayout(self.hboxlayout76,1,0,1,1) self.rotationSensitivity_txtlbl.setBuddy(self.mouseSpeedDuringRotation_slider) self.atomDistPrecisionLabel.setBuddy(self.dynamicToolTipAtomDistancePrecision_spinbox) self.textLabel1_8_3.setBuddy(self.dynamicToolTipBendAnglePrecision_spinbox) self.retranslateUi(PreferencesDialog) self.prefsTabWidget.setCurrentIndex(0) self.prefsStackedWidget.setCurrentIndex(3) self.level_of_detail_combox.setCurrentIndex(2) QtCore.QMetaObject.connectSlotsByName(PreferencesDialog) def retranslateUi(self, PreferencesDialog): PreferencesDialog.setWindowTitle(QtGui.QApplication.translate("PreferencesDialog", "Preferences", None, QtGui.QApplication.UnicodeUTF8)) self.categoryTreeWidget.headerItem().setText(0,QtGui.QApplication.translate("PreferencesDialog", "Categories", None, QtGui.QApplication.UnicodeUTF8)) self.categoryTreeWidget.clear() item = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item.setText(0,QtGui.QApplication.translate("PreferencesDialog", "General", None, QtGui.QApplication.UnicodeUTF8)) item1 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item1.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Color", None, QtGui.QApplication.UnicodeUTF8)) item2 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item2.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Graphics Area", None, QtGui.QApplication.UnicodeUTF8)) item3 = QtGui.QTreeWidgetItem(item2) item3.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Zoom, Pan and Rotate", None, QtGui.QApplication.UnicodeUTF8)) item4 = QtGui.QTreeWidgetItem(item2) item4.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Rulers", None, QtGui.QApplication.UnicodeUTF8)) item5 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item5.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Atoms", None, QtGui.QApplication.UnicodeUTF8)) item6 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item6.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Bonds", None, QtGui.QApplication.UnicodeUTF8)) item7 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item7.setText(0,QtGui.QApplication.translate("PreferencesDialog", "DNA", None, QtGui.QApplication.UnicodeUTF8)) item8 = QtGui.QTreeWidgetItem(item7) item8.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Minor Groove Error Indicators", None, QtGui.QApplication.UnicodeUTF8)) item9 = QtGui.QTreeWidgetItem(item7) item9.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Base Orientation Indicators", None, QtGui.QApplication.UnicodeUTF8)) item10 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item10.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Adjust", None, QtGui.QApplication.UnicodeUTF8)) item11 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item11.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Lighting", None, QtGui.QApplication.UnicodeUTF8)) item12 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item12.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Plug-ins", None, QtGui.QApplication.UnicodeUTF8)) item13 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item13.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Undo", None, QtGui.QApplication.UnicodeUTF8)) item14 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item14.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Window", None, QtGui.QApplication.UnicodeUTF8)) item15 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item15.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Reports", None, QtGui.QApplication.UnicodeUTF8)) item16 = QtGui.QTreeWidgetItem(self.categoryTreeWidget) item16.setText(0,QtGui.QApplication.translate("PreferencesDialog", "Tooltips", None, QtGui.QApplication.UnicodeUTF8)) self.sponsorLogosGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Sponsor logos download permission", None, QtGui.QApplication.UnicodeUTF8)) self.logoAlwaysAskRadioBtn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Always ask permission to download sponsor logos from the Nanorex server", None, QtGui.QApplication.UnicodeUTF8)) self.logoAlwaysAskRadioBtn.setText(QtGui.QApplication.translate("PreferencesDialog", "Always ask before downloading", None, QtGui.QApplication.UnicodeUTF8)) self.logoNeverAskRadioBtn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Never ask permission before downloading sponsor logos from the Nanorex server", None, QtGui.QApplication.UnicodeUTF8)) self.logoNeverAskRadioBtn.setText(QtGui.QApplication.translate("PreferencesDialog", "Never ask before downloading", None, QtGui.QApplication.UnicodeUTF8)) self.logoNeverDownLoadRadioBtn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Never download sponsor logos from the Nanorex server", None, QtGui.QApplication.UnicodeUTF8)) self.logoNeverDownLoadRadioBtn.setText(QtGui.QApplication.translate("PreferencesDialog", "Never download", None, QtGui.QApplication.UnicodeUTF8)) self.buildmode_groupbox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Build Chunks settings", None, QtGui.QApplication.UnicodeUTF8)) self.autobond_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Build mode\'s default setting for Autobonding at startup (enabled/disabled)", None, QtGui.QApplication.UnicodeUTF8)) self.autobond_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Autobond", None, QtGui.QApplication.UnicodeUTF8)) self.buildmode_highlighting_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Build mode\'s default setting for Highlighting at startup (enabled/disabled)", None, QtGui.QApplication.UnicodeUTF8)) self.buildmode_highlighting_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Hover highlighting", None, QtGui.QApplication.UnicodeUTF8)) self.water_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Build mode\'s default setting for Water at startup (enabled/disabled)", None, QtGui.QApplication.UnicodeUTF8)) self.water_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Water", None, QtGui.QApplication.UnicodeUTF8)) self.buildmode_select_atoms_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Automatically select atoms when depositing", None, QtGui.QApplication.UnicodeUTF8)) self.buildmode_select_atoms_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Auto select atoms of deposited objects", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Offset factor for pasting objects", None, QtGui.QApplication.UnicodeUTF8)) self.pasteOffsetForDna_lable.setText(QtGui.QApplication.translate("PreferencesDialog", "Dna objects:", None, QtGui.QApplication.UnicodeUTF8)) self.pasteOffsetForChunks_lable.setText(QtGui.QApplication.translate("PreferencesDialog", "Chunk objects:", None, QtGui.QApplication.UnicodeUTF8)) self.backgroundGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Background", None, QtGui.QApplication.UnicodeUTF8)) self.enableFogCheckBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Enable fog", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setText(QtGui.QApplication.translate("PreferencesDialog", "Color scheme:", None, QtGui.QApplication.UnicodeUTF8)) self.hoverHighlightingStyleGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Hover highlighting style", None, QtGui.QApplication.UnicodeUTF8)) self.label_21.setText(QtGui.QApplication.translate("PreferencesDialog", "Color:", None, QtGui.QApplication.UnicodeUTF8)) self.hoverHighlightingColorButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.selectionColorStyleGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Selection style", None, QtGui.QApplication.UnicodeUTF8)) self.label_22.setText(QtGui.QApplication.translate("PreferencesDialog", "Color:", None, QtGui.QApplication.UnicodeUTF8)) self.selectionColorButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.label_25.setText(QtGui.QApplication.translate("PreferencesDialog", "Halo width:", None, QtGui.QApplication.UnicodeUTF8)) self.haloWidthSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pixels", None, QtGui.QApplication.UnicodeUTF8)) self.haloWidthResetButton.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Restore default value", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setText(QtGui.QApplication.translate("PreferencesDialog", "Global display style at start-up:", None, QtGui.QApplication.UnicodeUTF8)) self.compassGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Display compass", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_4.setText(QtGui.QApplication.translate("PreferencesDialog", "Location :", None, QtGui.QApplication.UnicodeUTF8)) self.compass_position_combox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Upper right", None, QtGui.QApplication.UnicodeUTF8)) self.compass_position_combox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Upper left", None, QtGui.QApplication.UnicodeUTF8)) self.compass_position_combox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Lower left", None, QtGui.QApplication.UnicodeUTF8)) self.compass_position_combox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Lower right", None, QtGui.QApplication.UnicodeUTF8)) self.display_compass_labels_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Show/Hide Display Compass", None, QtGui.QApplication.UnicodeUTF8)) self.display_compass_labels_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Display compass labels", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox7_2.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Axes", None, QtGui.QApplication.UnicodeUTF8)) self.display_pov_axis_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Show/Hide Point of View Axis", None, QtGui.QApplication.UnicodeUTF8)) self.display_pov_axis_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Display point of view (POV) axis", None, QtGui.QApplication.UnicodeUTF8)) self.display_origin_axis_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Show/Hide Origin Axis", None, QtGui.QApplication.UnicodeUTF8)) self.display_origin_axis_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Display origin axis", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextGroupBox.setWhatsThis(QtGui.QApplication.translate("PreferencesDialog", "<b>Cursor text</b><p>Display/hide the cursor text. The cursor text displays information next to the cursor during some interactive modeling commands, such as <b>Insert DNA</b></p>", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Cursor text", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Font size:", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextFontSizeSpinBox.setWhatsThis(QtGui.QApplication.translate("PreferencesDialog", "<b>Font size</b><p>Font point size for cursor text.</p>", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextFontSizeSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pt", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextFontSizeResetButton.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Restore default value", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextFontSizeResetButton.setWhatsThis(QtGui.QApplication.translate("PreferencesDialog", "Restore the default font size.", None, QtGui.QApplication.UnicodeUTF8)) self.label_26.setText(QtGui.QApplication.translate("PreferencesDialog", "Color:", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextColorFrame.setWhatsThis(QtGui.QApplication.translate("PreferencesDialog", "Current color of cursor text.", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextColorButton.setWhatsThis(QtGui.QApplication.translate("PreferencesDialog", "Choose cursor text color.", None, QtGui.QApplication.UnicodeUTF8)) self.cursorTextColorButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.display_confirmation_corner_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Show/hide the Confirmation Corner", None, QtGui.QApplication.UnicodeUTF8)) self.display_confirmation_corner_checkbox.setWhatsThis(QtGui.QApplication.translate("PreferencesDialog", "<b>Display confirmation corner</b><p>Displays/hides the Confirmation Corner.</p>", None, QtGui.QApplication.UnicodeUTF8)) self.display_confirmation_corner_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Display confirmation corner", None, QtGui.QApplication.UnicodeUTF8)) self.enable_antialiasing_checkbox.setWhatsThis(QtGui.QApplication.translate("PreferencesDialog", "<b>Enable anti-aliasing</b><p>Enables/disables anti-aliasing. NE1 must be restarted in order for this setting to take effect.</p><p><b>Attention!</b> Enabling anti-aliasing works only on graphics card hardware that supports it. This is likely to slow drawing performance.</p>", None, QtGui.QApplication.UnicodeUTF8)) self.enable_antialiasing_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Enable anti-aliasing (next session)", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox8.setTitle(QtGui.QApplication.translate("PreferencesDialog", "View rotation settings", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_5.setText(QtGui.QApplication.translate("PreferencesDialog", "View animation speed:", None, QtGui.QApplication.UnicodeUTF8)) self.rotationSensitivity_txtlbl.setText(QtGui.QApplication.translate("PreferencesDialog", "Mouse rotation speed:", None, QtGui.QApplication.UnicodeUTF8)) self.resetAnimationSpeed_btn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Restore default value", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel3_4.setText(QtGui.QApplication.translate("PreferencesDialog", "Fast", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel3_4_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Fast", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel2_3_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Slow", None, QtGui.QApplication.UnicodeUTF8)) self.animation_speed_slider.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "View Animation Speed", None, QtGui.QApplication.UnicodeUTF8)) self.resetMouseSpeedDuringRotation_btn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Restore default value", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel2_3.setText(QtGui.QApplication.translate("PreferencesDialog", "Slow", None, QtGui.QApplication.UnicodeUTF8)) self.animate_views_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable/disable animation between current view and a new view", None, QtGui.QApplication.UnicodeUTF8)) self.animate_views_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Animate between views", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_4.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Mouse wheel settings", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_4.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Mouse wheel zoom settings", None, QtGui.QApplication.UnicodeUTF8)) self.label_19.setText(QtGui.QApplication.translate("PreferencesDialog", "Direction:", None, QtGui.QApplication.UnicodeUTF8)) self.label_17.setText(QtGui.QApplication.translate("PreferencesDialog", "Zoom in:", None, QtGui.QApplication.UnicodeUTF8)) self.label_18.setText(QtGui.QApplication.translate("PreferencesDialog", "Zoom out:", None, QtGui.QApplication.UnicodeUTF8)) self.mouseWheelDirectionComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Pull/push wheel to zoom in/out", None, QtGui.QApplication.UnicodeUTF8)) self.mouseWheelDirectionComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Push/pull wheel to zoom in/out", None, QtGui.QApplication.UnicodeUTF8)) self.mouseWheelZoomInPointComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Center about cursor position", None, QtGui.QApplication.UnicodeUTF8)) self.mouseWheelZoomInPointComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Center about screen", None, QtGui.QApplication.UnicodeUTF8)) self.mouseWheelZoomOutPointComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Center about cursor position", None, QtGui.QApplication.UnicodeUTF8)) self.mouseWheelZoomOutPointComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Center about screen", None, QtGui.QApplication.UnicodeUTF8)) self.label_20.setText(QtGui.QApplication.translate("PreferencesDialog", "Hover highlighting timeout interval:", None, QtGui.QApplication.UnicodeUTF8)) self.hhTimeoutIntervalDoubleSpinBox.setWhatsThis(QtGui.QApplication.translate("PreferencesDialog", "The hover highlighting timeout interval, which delays hover highlighting while zooming via the mouse wheel.", None, QtGui.QApplication.UnicodeUTF8)) self.hhTimeoutIntervalDoubleSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " seconds", None, QtGui.QApplication.UnicodeUTF8)) self.panSettingsGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Pan settings", None, QtGui.QApplication.UnicodeUTF8)) self.panArrowKeysDirectionComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "View direction", None, QtGui.QApplication.UnicodeUTF8)) self.panArrowKeysDirectionComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Camera direction", None, QtGui.QApplication.UnicodeUTF8)) self.label_28.setText(QtGui.QApplication.translate("PreferencesDialog", "Arrow keys control:", None, QtGui.QApplication.UnicodeUTF8)) self.rulersGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Rulers", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(QtGui.QApplication.translate("PreferencesDialog", "Opacity:", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel3_2_4.setText(QtGui.QApplication.translate("PreferencesDialog", "Color:", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setText(QtGui.QApplication.translate("PreferencesDialog", "Origin:", None, QtGui.QApplication.UnicodeUTF8)) self.rulerPositionComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Lower left", None, QtGui.QApplication.UnicodeUTF8)) self.rulerPositionComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Upper left", None, QtGui.QApplication.UnicodeUTF8)) self.rulerPositionComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Lower right", None, QtGui.QApplication.UnicodeUTF8)) self.rulerPositionComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Upper right", None, QtGui.QApplication.UnicodeUTF8)) self.ruler_color_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.rulerOpacitySpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", "%", None, QtGui.QApplication.UnicodeUTF8)) self.rulerDisplayComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Both rulers", None, QtGui.QApplication.UnicodeUTF8)) self.rulerDisplayComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Vertical ruler only", None, QtGui.QApplication.UnicodeUTF8)) self.rulerDisplayComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Horizontal ruler only", None, QtGui.QApplication.UnicodeUTF8)) self.label_12.setText(QtGui.QApplication.translate("PreferencesDialog", "Display:", None, QtGui.QApplication.UnicodeUTF8)) self.showRulersInPerspectiveViewCheckBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Show rulers in perspective view", None, QtGui.QApplication.UnicodeUTF8)) self.atom_colors_grpbox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Colors", None, QtGui.QApplication.UnicodeUTF8)) self.change_element_colors_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Change Element Colors...", None, QtGui.QApplication.UnicodeUTF8)) self.atom_hilite_color_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.hotspot_lbl_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Bondpoint highlighting :", None, QtGui.QApplication.UnicodeUTF8)) self.hotspot_color_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel3_2_3.setText(QtGui.QApplication.translate("PreferencesDialog", "Atom highlighting :", None, QtGui.QApplication.UnicodeUTF8)) self.bondpoint_hilite_color_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.hotspot_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "Bondpoint hotspot :", None, QtGui.QApplication.UnicodeUTF8)) self.reset_atom_colors_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Restore Default Colors", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_3_2.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Set Atom Scale factor for Ball and Stick display mode", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_3_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Ball and stick atom scale :", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_3_2_2.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "CPK Atom Scale factor for CPK display mode", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_3_2_2.setText(QtGui.QApplication.translate("PreferencesDialog", "CPK atom scale :", None, QtGui.QApplication.UnicodeUTF8)) self.level_of_detail_combox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Sets graphics quality for atoms (and bonds)", None, QtGui.QApplication.UnicodeUTF8)) self.level_of_detail_combox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Low", None, QtGui.QApplication.UnicodeUTF8)) self.level_of_detail_combox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Medium", None, QtGui.QApplication.UnicodeUTF8)) self.level_of_detail_combox.addItem(QtGui.QApplication.translate("PreferencesDialog", "High", None, QtGui.QApplication.UnicodeUTF8)) self.level_of_detail_combox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Variable", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_7.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Level of detail for atoms (and bonds)", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_7.setText(QtGui.QApplication.translate("PreferencesDialog", "Level of detail :", None, QtGui.QApplication.UnicodeUTF8)) self.reset_cpk_scale_factor_btn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Restore default value", None, QtGui.QApplication.UnicodeUTF8)) self.reset_ballstick_scale_factor_btn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Restore default value", None, QtGui.QApplication.UnicodeUTF8)) self.ballStickAtomScaleFactorSpinBox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Set Atom Scale factor for Ball and Stick display mode", None, QtGui.QApplication.UnicodeUTF8)) self.ballStickAtomScaleFactorSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", "%", None, QtGui.QApplication.UnicodeUTF8)) self.overlappingAtomIndicatorsCheckBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Overlapping atom indicators", None, QtGui.QApplication.UnicodeUTF8)) self.keepBondsTransmuteCheckBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Force to keep bonds during transmute", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox4.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Colors", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel3_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Bond highlighting :", None, QtGui.QApplication.UnicodeUTF8)) self.bond_stretch_color_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.bond_hilite_color_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel3_3.setText(QtGui.QApplication.translate("PreferencesDialog", "Vane/Ribbon :", None, QtGui.QApplication.UnicodeUTF8)) self.ballstick_bondcolor_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel3.setText(QtGui.QApplication.translate("PreferencesDialog", "Ball and stick cylinder :", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel3_2_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Bond stretch :", None, QtGui.QApplication.UnicodeUTF8)) self.bond_vane_color_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.reset_bond_colors_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Restore Default Colors", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_3.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Set scale (size) factor for the cylinder representing bonds in Ball and Stick display mode", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_3.setText(QtGui.QApplication.translate("PreferencesDialog", "Ball and stick bond scale :", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Bond thickness (in pixels) for Lines Display Mode", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1.setText(QtGui.QApplication.translate("PreferencesDialog", "Bond line thickness :", None, QtGui.QApplication.UnicodeUTF8)) self.cpk_cylinder_rad_spinbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Set scale (size) factor for the cylinder representing bonds in Ball and Stick display mode", None, QtGui.QApplication.UnicodeUTF8)) self.cpk_cylinder_rad_spinbox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", "%", None, QtGui.QApplication.UnicodeUTF8)) self.bond_line_thickness_spinbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Bond thickness (in pixels) for Lines Display Mode", None, QtGui.QApplication.UnicodeUTF8)) self.bond_line_thickness_spinbox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pixel", None, QtGui.QApplication.UnicodeUTF8)) self.high_order_bond_display_groupbox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "High Order Bonds", None, QtGui.QApplication.UnicodeUTF8)) self.multCyl_radioButton.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Display high order bonds using multiple cylinders", None, QtGui.QApplication.UnicodeUTF8)) self.multCyl_radioButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Multiple cylinders", None, QtGui.QApplication.UnicodeUTF8)) self.vanes_radioButton.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Display pi systems in high order bonds as Vanes", None, QtGui.QApplication.UnicodeUTF8)) self.vanes_radioButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Vanes", None, QtGui.QApplication.UnicodeUTF8)) self.ribbons_radioButton.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Display pi systems in high order bonds as Ribbons", None, QtGui.QApplication.UnicodeUTF8)) self.ribbons_radioButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Ribbons", None, QtGui.QApplication.UnicodeUTF8)) self.show_bond_labels_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Display Bond Type Label", None, QtGui.QApplication.UnicodeUTF8)) self.show_bond_labels_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Show bond type letters", None, QtGui.QApplication.UnicodeUTF8)) self.show_valence_errors_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable/Disable Valence Error Checker", None, QtGui.QApplication.UnicodeUTF8)) self.show_valence_errors_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Show valence errors", None, QtGui.QApplication.UnicodeUTF8)) self.showBondStretchIndicators_checkBox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable/Disable Display of Bond Stretch Indicators", None, QtGui.QApplication.UnicodeUTF8)) self.showBondStretchIndicators_checkBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Show bond stretch indicators", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "DNA default values", None, QtGui.QApplication.UnicodeUTF8)) self.label_24.setText(QtGui.QApplication.translate("PreferencesDialog", "Strand2 color:", None, QtGui.QApplication.UnicodeUTF8)) self.label_23.setText(QtGui.QApplication.translate("PreferencesDialog", "Strand1 color:", None, QtGui.QApplication.UnicodeUTF8)) self.dnaDefaultStrand1ColorPushButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.dnaConformationComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "B-DNA", None, QtGui.QApplication.UnicodeUTF8)) self.dnaDefaultSegmentColorPushButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("PreferencesDialog", "Rise:", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setText(QtGui.QApplication.translate("PreferencesDialog", "Conformation:", None, QtGui.QApplication.UnicodeUTF8)) self.dnaDefaultStrand2ColorPushButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setText(QtGui.QApplication.translate("PreferencesDialog", "Bases per turn:", None, QtGui.QApplication.UnicodeUTF8)) self.label_7.setText(QtGui.QApplication.translate("PreferencesDialog", "Segment color:", None, QtGui.QApplication.UnicodeUTF8)) self.dnaRiseDoubleSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " Angstroms", None, QtGui.QApplication.UnicodeUTF8)) self.dnaRestoreFactoryDefaultsPushButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Restore Factory Defaults", None, QtGui.QApplication.UnicodeUTF8)) self.dna_reduced_model_options_grpbox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Strand arrowhead display options", None, QtGui.QApplication.UnicodeUTF8)) self.strandFivePrimeArrowheadsCustomColorCheckBox.setText(QtGui.QApplication.translate("PreferencesDialog", "5\' End Custom color:", None, QtGui.QApplication.UnicodeUTF8)) self.strandFivePrimeArrowheadsCustomColorPushButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.strandThreePrimeArrowheadsCustomColorCheckBox.setText(QtGui.QApplication.translate("PreferencesDialog", "3\' End Custom color:", None, QtGui.QApplication.UnicodeUTF8)) self.strandThreePrimeArrowheadsCustomColorPushButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.arrowsOnFivePrimeEnds_checkBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Show arrows on 5\' ends", None, QtGui.QApplication.UnicodeUTF8)) self.arrowsOnThreePrimeEnds_checkBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Show arrows on 3\' ends", None, QtGui.QApplication.UnicodeUTF8)) self.arrowsOnBackBones_checkBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Show arrows on back bones", None, QtGui.QApplication.UnicodeUTF8)) self.dnaDisplayMinorGrooveErrorGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Display minor groove error indicators", None, QtGui.QApplication.UnicodeUTF8)) self.label_15.setText(QtGui.QApplication.translate("PreferencesDialog", "Minimum angle:", None, QtGui.QApplication.UnicodeUTF8)) self.label_16.setText(QtGui.QApplication.translate("PreferencesDialog", "Maximum angle:", None, QtGui.QApplication.UnicodeUTF8)) self.bg1_color_lbl_3.setText(QtGui.QApplication.translate("PreferencesDialog", "Color:", None, QtGui.QApplication.UnicodeUTF8)) self.dnaMinGrooveAngleSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " degrees", None, QtGui.QApplication.UnicodeUTF8)) self.dnaMaxGrooveAngleSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " degrees", None, QtGui.QApplication.UnicodeUTF8)) self.dnaGrooveIndicatorColorButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.dnaMinorGrooveRestoreFactoryDefaultsPushButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Restore Factory Defaults", None, QtGui.QApplication.UnicodeUTF8)) self.dnaDisplayBaseOrientationIndicatorsGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Display base orientation indicators", None, QtGui.QApplication.UnicodeUTF8)) self.dnaBaseIndicatorsPlaneNormalComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "View plane (up)", None, QtGui.QApplication.UnicodeUTF8)) self.dnaBaseIndicatorsPlaneNormalComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "View plane (out)", None, QtGui.QApplication.UnicodeUTF8)) self.dnaBaseIndicatorsPlaneNormalComboBox.addItem(QtGui.QApplication.translate("PreferencesDialog", "View plane (right)", None, QtGui.QApplication.UnicodeUTF8)) self.bg1_color_lbl_6.setText(QtGui.QApplication.translate("PreferencesDialog", "Inverse indicators color:", None, QtGui.QApplication.UnicodeUTF8)) self.dnaChooseBaseOrientationIndicatorsInvColorButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.dnaBaseOrientationIndicatorsInverseCheckBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Enable inverse indicators", None, QtGui.QApplication.UnicodeUTF8)) self.label_35.setText(QtGui.QApplication.translate("PreferencesDialog", "Plane normal:", None, QtGui.QApplication.UnicodeUTF8)) self.label_13.setText(QtGui.QApplication.translate("PreferencesDialog", "Angle threshold:", None, QtGui.QApplication.UnicodeUTF8)) self.dnaChooseBaseOrientationIndicatorsColorButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.label_14.setText(QtGui.QApplication.translate("PreferencesDialog", "Terminal base distance:", None, QtGui.QApplication.UnicodeUTF8)) self.bg1_color_lbl_5.setText(QtGui.QApplication.translate("PreferencesDialog", "Indicators color:", None, QtGui.QApplication.UnicodeUTF8)) self.adjustPhysicsEngineGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Adjust physics engine", None, QtGui.QApplication.UnicodeUTF8)) self.adjustEngineCombobox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Choose the simulation engine with which to minimize energy.", None, QtGui.QApplication.UnicodeUTF8)) self.adjustEngineCombobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "NanoDynamics-1 (Default)", None, QtGui.QApplication.UnicodeUTF8)) self.adjustEngineCombobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "GROMACS with ND1 Force Field", None, QtGui.QApplication.UnicodeUTF8)) self.adjustEngineCombobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "Background GROMACS with ND1 Force Field", None, QtGui.QApplication.UnicodeUTF8)) self.electrostaticsForDnaDuringAdjust_checkBox.setText(QtGui.QApplication.translate("PreferencesDialog", "Enable electrostatics for DNA reduced model", None, QtGui.QApplication.UnicodeUTF8)) self.watch_motion_groupbox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Watch motion in real time", None, QtGui.QApplication.UnicodeUTF8)) self.update_asap_rbtn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Update every 2 seconds, or faster if it doesn\'t slow adjustments by more than 20%", None, QtGui.QApplication.UnicodeUTF8)) self.update_asap_rbtn.setText(QtGui.QApplication.translate("PreferencesDialog", "Update as fast as possible", None, QtGui.QApplication.UnicodeUTF8)) self.update_every_rbtn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Specify how often to update the screen during adjustments", None, QtGui.QApplication.UnicodeUTF8)) self.update_every_rbtn.setText(QtGui.QApplication.translate("PreferencesDialog", "Update every", None, QtGui.QApplication.UnicodeUTF8)) self.update_number_spinbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Specify how often to update the screen during adjustments", None, QtGui.QApplication.UnicodeUTF8)) self.update_units_combobox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Specify how often to update the screen during adjustments", None, QtGui.QApplication.UnicodeUTF8)) self.update_units_combobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "frames", None, QtGui.QApplication.UnicodeUTF8)) self.update_units_combobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "seconds", None, QtGui.QApplication.UnicodeUTF8)) self.update_units_combobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "minutes", None, QtGui.QApplication.UnicodeUTF8)) self.update_units_combobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "hours", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox20.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Convergence criteria", None, QtGui.QApplication.UnicodeUTF8)) self.endrms_lbl.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Target RMS force (pN)", None, QtGui.QApplication.UnicodeUTF8)) self.endrms_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "EndRMS:", None, QtGui.QApplication.UnicodeUTF8)) self.endmax_lbl.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Target max force (pN)", None, QtGui.QApplication.UnicodeUTF8)) self.endmax_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "EndMax:", None, QtGui.QApplication.UnicodeUTF8)) self.cutoverrms_lbl.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Cutover RMS force (pN)", None, QtGui.QApplication.UnicodeUTF8)) self.cutoverrms_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "CutoverRMS:", None, QtGui.QApplication.UnicodeUTF8)) self.cutovermax_lbl.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Cutover max force (pN)", None, QtGui.QApplication.UnicodeUTF8)) self.cutovermax_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "CutoverMax:", None, QtGui.QApplication.UnicodeUTF8)) self.endRmsDoubleSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pN", None, QtGui.QApplication.UnicodeUTF8)) self.endMaxDoubleSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pN", None, QtGui.QApplication.UnicodeUTF8)) self.cutoverRmsDoubleSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pN", None, QtGui.QApplication.UnicodeUTF8)) self.cutoverMaxDoubleSpinBox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pN", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox8_2.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Directional light properties", None, QtGui.QApplication.UnicodeUTF8)) self.light_combobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "1 (On)", None, QtGui.QApplication.UnicodeUTF8)) self.light_combobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "2 (On)", None, QtGui.QApplication.UnicodeUTF8)) self.light_combobox.addItem(QtGui.QApplication.translate("PreferencesDialog", "3 (Off)", None, QtGui.QApplication.UnicodeUTF8)) self.light_color_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.light_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Light :", None, QtGui.QApplication.UnicodeUTF8)) self.on_label.setText(QtGui.QApplication.translate("PreferencesDialog", "On :", None, QtGui.QApplication.UnicodeUTF8)) self.color_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Color :", None, QtGui.QApplication.UnicodeUTF8)) self.ambient_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Ambient :", None, QtGui.QApplication.UnicodeUTF8)) self.diffuse_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Diffuse :", None, QtGui.QApplication.UnicodeUTF8)) self.specularity_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Specular :", None, QtGui.QApplication.UnicodeUTF8)) self.x_label.setText(QtGui.QApplication.translate("PreferencesDialog", "X :", None, QtGui.QApplication.UnicodeUTF8)) self.y_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Y :", None, QtGui.QApplication.UnicodeUTF8)) self.z_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Z :", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox9_2.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Material specular properties", None, QtGui.QApplication.UnicodeUTF8)) self.ms_on_label.setText(QtGui.QApplication.translate("PreferencesDialog", "On:", None, QtGui.QApplication.UnicodeUTF8)) self.ms_finish_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Finish:", None, QtGui.QApplication.UnicodeUTF8)) self.ms_shininess_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Shininess:", None, QtGui.QApplication.UnicodeUTF8)) self.ms_brightness__label.setText(QtGui.QApplication.translate("PreferencesDialog", "Brightness:", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_6.setText(QtGui.QApplication.translate("PreferencesDialog", "Metal", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel2_4.setText(QtGui.QApplication.translate("PreferencesDialog", "Plastic", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_6_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Flat", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel2_4_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Glossy", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_6_3.setText(QtGui.QApplication.translate("PreferencesDialog", "Low", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel2_4_3.setText(QtGui.QApplication.translate("PreferencesDialog", "High", None, QtGui.QApplication.UnicodeUTF8)) self.lighting_restore_defaults_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Restore Defaults", None, QtGui.QApplication.UnicodeUTF8)) self.file_locations_grp.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Location of executables", None, QtGui.QApplication.UnicodeUTF8)) self.qutemol_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable QuteMolX", None, QtGui.QApplication.UnicodeUTF8)) self.qutemol_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "QuteMolX:", None, QtGui.QApplication.UnicodeUTF8)) self.qutemol_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The full path to the QuteMolX executable file.", None, QtGui.QApplication.UnicodeUTF8)) self.qutemol_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.nanohive_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable NanoHive-1", None, QtGui.QApplication.UnicodeUTF8)) self.nanohive_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "NanoHive-1:", None, QtGui.QApplication.UnicodeUTF8)) self.nanohive_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The full path to the NanoHive-1 executable file.", None, QtGui.QApplication.UnicodeUTF8)) self.nanohive_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.povray_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable POV-Ray", None, QtGui.QApplication.UnicodeUTF8)) self.povray_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "POV-Ray:", None, QtGui.QApplication.UnicodeUTF8)) self.povray_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The full path to the POV-Ray executable file.", None, QtGui.QApplication.UnicodeUTF8)) self.povray_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.megapov_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable MegaPOV", None, QtGui.QApplication.UnicodeUTF8)) self.megapov_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "MegaPOV:", None, QtGui.QApplication.UnicodeUTF8)) self.megapov_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The full path to the MegaPOV executable file (megapov.exe).", None, QtGui.QApplication.UnicodeUTF8)) self.megapov_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.povdir_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Custom directory for POV libraries", None, QtGui.QApplication.UnicodeUTF8)) self.povdir_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "POV include dir:", None, QtGui.QApplication.UnicodeUTF8)) self.povdir_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Select custom POV include directory", None, QtGui.QApplication.UnicodeUTF8)) self.povdir_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.gamess_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable GAMESS", None, QtGui.QApplication.UnicodeUTF8)) self.gamess_lbl.setText(QtGui.QApplication.translate("PreferencesDialog", "GAMESS:", None, QtGui.QApplication.UnicodeUTF8)) self.gamess_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The gamess executable file. Usually it\'s called gamess.??.x or ??gamess.exe.", None, QtGui.QApplication.UnicodeUTF8)) self.gamess_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.gromacs_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable GROMACS", None, QtGui.QApplication.UnicodeUTF8)) self.gromacs_label.setText(QtGui.QApplication.translate("PreferencesDialog", "GROMACS:", None, QtGui.QApplication.UnicodeUTF8)) self.gromacs_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The full path to the mdrun executable file for GROMACS.", None, QtGui.QApplication.UnicodeUTF8)) self.gromacs_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.cpp_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable cpp (needed by GROMACS)", None, QtGui.QApplication.UnicodeUTF8)) self.cpp_label.setText(QtGui.QApplication.translate("PreferencesDialog", "cpp:", None, QtGui.QApplication.UnicodeUTF8)) self.cpp_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The full path to the C-preprocessor (cpp) executable file for GROMACS to use.", None, QtGui.QApplication.UnicodeUTF8)) self.cpp_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.nv1_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable NanoVision-1", None, QtGui.QApplication.UnicodeUTF8)) self.nv1_label.setText(QtGui.QApplication.translate("PreferencesDialog", "NanoVision-1:", None, QtGui.QApplication.UnicodeUTF8)) self.nv1_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The full path to the mdrun executable file for NanoVision-1.", None, QtGui.QApplication.UnicodeUTF8)) self.nv1_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.rosetta_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable Rosetta", None, QtGui.QApplication.UnicodeUTF8)) self.rosetta_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Rosetta:", None, QtGui.QApplication.UnicodeUTF8)) self.rosetta_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The full path to Rosetta executable file.", None, QtGui.QApplication.UnicodeUTF8)) self.rosetta_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.rosetta_db_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Enable Rosetta Database", None, QtGui.QApplication.UnicodeUTF8)) self.rosetta_db_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Rosetta DB:", None, QtGui.QApplication.UnicodeUTF8)) self.rosetta_db_path_lineedit.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "The top-level Rosetta database directory.", None, QtGui.QApplication.UnicodeUTF8)) self.rosetta_db_choose_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) self.undo_restore_view_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Undo will switch to the view saved with each structural change.", None, QtGui.QApplication.UnicodeUTF8)) self.undo_restore_view_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Restore view when undoing structural changes", None, QtGui.QApplication.UnicodeUTF8)) self.undo_automatic_checkpoints_checkbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Specify Automatic or Manual Checkpoints at program startup.", None, QtGui.QApplication.UnicodeUTF8)) self.undo_automatic_checkpoints_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Automatic checkpoints", None, QtGui.QApplication.UnicodeUTF8)) self.undo_stack_memory_limit_label.setText(QtGui.QApplication.translate("PreferencesDialog", "Undo stack memory limit:", None, QtGui.QApplication.UnicodeUTF8)) self.undo_stack_memory_limit_spinbox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " MB", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox10.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Window position and size", None, QtGui.QApplication.UnicodeUTF8)) self.remember_win_pos_and_size_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Always save current position and size when quitting", None, QtGui.QApplication.UnicodeUTF8)) self.save_current_btn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Save current window position and size for next startup", None, QtGui.QApplication.UnicodeUTF8)) self.save_current_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Save Current Size", None, QtGui.QApplication.UnicodeUTF8)) self.restore_saved_size_btn.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Save current window position and size for next startup", None, QtGui.QApplication.UnicodeUTF8)) self.restore_saved_size_btn.setText(QtGui.QApplication.translate("PreferencesDialog", "Restore Saved Size", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Current size:", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_2_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Saved size:", None, QtGui.QApplication.UnicodeUTF8)) self.current_width_spinbox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pixels", None, QtGui.QApplication.UnicodeUTF8)) self.current_height_spinbox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " pixels", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_2_2_2.setText(QtGui.QApplication.translate("PreferencesDialog", "x", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_2_2_2_2.setText(QtGui.QApplication.translate("PreferencesDialog", "x", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox3.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Window Border Caption Format", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox3.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Window caption format", None, QtGui.QApplication.UnicodeUTF8)) self.caption_fullpath_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Display full path of part", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel2_2.setText(QtGui.QApplication.translate("PreferencesDialog", "Caption suffix for modified file:", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel2.setText(QtGui.QApplication.translate("PreferencesDialog", "Caption prefix for modified file:", None, QtGui.QApplication.UnicodeUTF8)) self.selectedFontGroupBox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Use custom font", None, QtGui.QApplication.UnicodeUTF8)) self.makeDefaultFontPushButton.setText(QtGui.QApplication.translate("PreferencesDialog", "Make selected font the default font", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(QtGui.QApplication.translate("PreferencesDialog", "Font :", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("PreferencesDialog", "Size :", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox17.setTitle(QtGui.QApplication.translate("PreferencesDialog", "History preferences", None, QtGui.QApplication.UnicodeUTF8)) self.msg_serial_number_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Include message serial number", None, QtGui.QApplication.UnicodeUTF8)) self.msg_timestamp_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Include message timestamp", None, QtGui.QApplication.UnicodeUTF8)) self.atom_dynamic_tooltips_grpbox.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Atom tooltip options", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipAtomChunkInfo_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Chunk information", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipAtomMass_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Mass information", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipAtomPosition_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "XYZ coordinates", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipAtomDistanceDeltas_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "XYZ distance deltas ", None, QtGui.QApplication.UnicodeUTF8)) self.includeVdwRadiiInAtomDistanceInfo.setText(QtGui.QApplication.translate("PreferencesDialog", "Include Vdw radii in atom distance tooltip", None, QtGui.QApplication.UnicodeUTF8)) self.atomDistPrecisionLabel.setText(QtGui.QApplication.translate("PreferencesDialog", "Distance precision:", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipAtomDistancePrecision_spinbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Sets the number of digits after the decimal places", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipAtomDistancePrecision_spinbox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " decimal places", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipBendAnglePrecision_spinbox.setToolTip(QtGui.QApplication.translate("PreferencesDialog", "Sets the number of digits after the decimal places", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipBendAnglePrecision_spinbox.setSuffix(QtGui.QApplication.translate("PreferencesDialog", " decimal places", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1_8_3.setText(QtGui.QApplication.translate("PreferencesDialog", "Angle precision:", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox35.setTitle(QtGui.QApplication.translate("PreferencesDialog", "Bond tooltip options", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipBondChunkInfo_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Chunk information", None, QtGui.QApplication.UnicodeUTF8)) self.dynamicToolTipBondLength_checkbox.setText(QtGui.QApplication.translate("PreferencesDialog", "Distance between atom centers", None, QtGui.QApplication.UnicodeUTF8)) self.prefsTabWidget.setTabText(self.prefsTabWidget.indexOf(self.systemOptionsTab), QtGui.QApplication.translate("PreferencesDialog", "System Options", None, QtGui.QApplication.UnicodeUTF8)) self.okButton.setText(QtGui.QApplication.translate("PreferencesDialog", "OK", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/prefs/PreferencesDialog.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui import ne1_ui.menus.Ui_BuildStructuresMenu as Ui_BuildStructuresMenu import ne1_ui.menus.Ui_BuildToolsMenu as Ui_BuildToolsMenu import ne1_ui.menus.Ui_SelectMenu as Ui_SelectMenu import ne1_ui.menus.Ui_DimensionsMenu as Ui_DimensionsMenu def setupUi(win): """ Populates the "Tools" menu which appears in the main window menu bar. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate all "Tools" submenus. Ui_BuildStructuresMenu.setupUi(win) Ui_BuildToolsMenu.setupUi(win) Ui_DimensionsMenu.setupUi(win) Ui_SelectMenu.setupUi(win) # Populate the "Tools" menu. win.toolsMenu.addAction(win.modifyAdjustSelAction) win.toolsMenu.addAction(win.modifyAdjustAllAction) win.toolsMenu.addAction(win.simMinimizeEnergyAction) win.toolsMenu.addAction(win.checkAtomTypesAction) win.toolsMenu.addSeparator() win.toolsMenu.addMenu(win.buildStructuresMenu) win.toolsMenu.addMenu(win.buildToolsMenu) win.toolsMenu.addSeparator() win.toolsMenu.addAction(win.toolsExtrudeAction) win.toolsMenu.addAction(win.toolsFuseChunksAction) win.toolsMenu.addSeparator() win.toolsMenu.addAction(win.modifyMirrorAction) win.toolsMenu.addAction(win.modifyInvertAction) win.toolsMenu.addAction(win.modifyStretchAction) win.toolsMenu.addSeparator() win.toolsMenu.addMenu(win.dimensionsMenu) win.toolsMenu.addMenu(win.selectionMenu) win.toolsMenu.addSeparator() win.toolsMenu.addAction(win.editPrefsAction) def retranslateUi(win): """ Sets text related attributes for the "Tools" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.toolsMenu.setTitle(QtGui.QApplication.translate( "MainWindow", "&Tools", None, QtGui.QApplication.UnicodeUTF8)) # Set text for the submenus. Ui_BuildStructuresMenu.retranslateUi(win) Ui_BuildToolsMenu.retranslateUi(win) Ui_SelectMenu.retranslateUi(win) Ui_DimensionsMenu.retranslateUi(win)
NanoCAD-master
cad/src/ne1_ui/menus/Ui_ToolsMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui from utilities.debug_prefs import debug_pref, Choice_boolean_True def setupUi(win): """ Populates the "Build Structures" menu, a submenu of the "Tools" menu. @note: This also specifies the default (Build) command toolbar options in the flyout. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Build Structures" menu. # Start with "Builders", then add single shot "Generators". win.buildStructuresMenu.addAction(win.toolsDepositAtomAction) win.buildStructuresMenu.addAction(win.buildDnaAction) win.buildStructuresMenu.addAction(win.buildProteinAction) win.buildStructuresMenu.addAction(win.buildNanotubeAction) win.buildStructuresMenu.addAction(win.buildCrystalAction) win.buildStructuresMenu.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.buildStructuresMenu.addAction(win.insertAtomAction) return def retranslateUi(win): """ Sets text related attributes for the "Build Structures" submenu, which is a submenu of the "Tools" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.buildStructuresMenu.setTitle(QtGui.QApplication.translate( "MainWindow", "Build Structures", None, QtGui.QApplication.UnicodeUTF8)) return
NanoCAD-master
cad/src/ne1_ui/menus/Ui_BuildStructuresMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ Ui_RenderingMenu.py - Menu for Rendering plug-ins like QuteMolX, POV-Ray and others to come (i.e. Sunflow) @author: Mark @version: $Id$ @copyright: 2005-2007 Nanorex, Inc. See LICENSE file for details. """ from PyQt4 import QtGui def setupUi(win): """ Populates the "Rendering" menu which appears in the main window menu bar. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Rendering" menu. win.renderingMenu.addAction(win.viewQuteMolAction) win.renderingMenu.addAction(win.viewRaytraceSceneAction) win.renderingMenu.addSeparator() win.renderingMenu.addAction(win.setStereoViewAction) # piotr 080516 def retranslateUi(win): """ Sets text related attributes for the "Rendering" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.renderingMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Rendering", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_RenderingMenu.py
NanoCAD-master
cad/src/ne1_ui/menus/__init__.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui # Hybrid display is an experimental work. Its action and others need to be # removed. For now, I am just removing it using the following flag as I have # unrelated modifications in other files that need to be changed in order to # remove this option completely. I will do it after commiting those changes. # For now this flag is good enough -- ninad 20070612 SHOW_HYBRID_DISPLAY_MENU = 0 def setupUi(win): """ Populates the "View" menu (including its "Display", "Modify" and "Toolbars" submenus) which appears in the main window menu bar. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Display" submenu. win.displayMenu.addAction(win.dispDefaultAction) #win.displayMenu.addAction(win.dispInvisAction) # removed by mark 2008-02-25 win.displayMenu.addAction(win.dispLinesAction) win.displayMenu.addAction(win.dispTubesAction) win.displayMenu.addAction(win.dispBallAction) win.displayMenu.addAction(win.dispCPKAction) win.displayMenu.addAction(win.dispDnaCylinderAction) win.displayMenu.addAction(win.dispCylinderAction) win.displayMenu.addAction(win.dispSurfaceAction) win.displayMenu.addSeparator() win.displayMenu.addAction(win.dispHideAction) win.displayMenu.addAction(win.dispUnhideAction) win.displayMenu.addSeparator() win.displayMenu.addAction(win.setViewPerspecAction) win.displayMenu.addAction(win.setViewOrthoAction) win.displayMenu.addSeparator() win.displayMenu.addAction(win.viewQuteMolAction) win.displayMenu.addAction(win.viewRaytraceSceneAction) win.displayMenu.addSeparator() win.displayMenu.addAction(win.setStereoViewAction) # Temporary. See comments at top of this file. if SHOW_HYBRID_DISPLAY_MENU: win.displayMenu.addAction(win.dispHybridAction) # Populate the "Modify" submenu. win.modifyMenu.addAction(win.setViewFitToWindowAction) win.modifyMenu.addAction(win.setViewRecenterAction) win.modifyMenu.addAction(win.setViewZoomtoSelectionAction) win.modifyMenu.addAction(win.zoomToAreaAction) win.modifyMenu.addSeparator() win.modifyMenu.addAction(win.zoomInOutAction) win.modifyMenu.addAction(win.rotateToolAction) win.modifyMenu.addAction(win.panToolAction) win.modifyMenu.addSeparator() win.modifyMenu.addAction(win.setViewHomeAction) win.modifyMenu.addAction(win.setViewHomeToCurrentAction) win.modifyMenu.addAction(win.saveNamedViewAction) win.modifyMenu.addAction(win.viewOrientationAction) # Create and populate the "Toolbar" submenu. # This is done here since the main window toolbar widgets must be # created first. Mark 2007-12-27 win.toolbarMenu = win.createPopupMenu() # Populate the "View" menu. win.viewMenu.addMenu(win.displayMenu) win.viewMenu.addMenu(win.modifyMenu) win.viewMenu.addSeparator() win.viewMenu.addAction(win.viewOrientationAction) # Mark 2008-12-03 win.viewMenu.addAction(win.viewSemiFullScreenAction) win.viewMenu.addAction(win.viewFullScreenAction) win.viewMenu.addAction(win.viewRulersAction) win.viewMenu.addAction(win.viewReportsAction) win.viewMenu.addMenu(win.toolbarMenu) def retranslateUi(win): """ Sets text related attributes for the "View", "Display" and "Modify" menus. @param win: NE1's mainwindow object. @type win: Ui_MainWindow """ win.viewMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "&View", None, QtGui.QApplication.UnicodeUTF8)) win.displayMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "&Display", None, QtGui.QApplication.UnicodeUTF8)) win.modifyMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "M&odify", None, QtGui.QApplication.UnicodeUTF8)) win.toolbarMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Toolbars", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_ViewMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui def setupUi(win): """ Populates the "Edit" menu which appears in the main window menu bar. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Edit" menu. win.editMenu.addAction(win.editMakeCheckpointAction) # hidden by default. win.editMenu.addAction(win.editUndoAction) win.editMenu.addAction(win.editRedoAction) win.editMenu.addAction(win.editAutoCheckpointingAction) win.editMenu.addAction(win.editClearUndoStackAction) win.editMenu.addSeparator() win.editMenu.addAction(win.editCutAction) win.editMenu.addAction(win.editCopyAction) win.editMenu.addAction(win.editPasteAction) win.editMenu.addAction(win.pasteFromClipboardAction) win.editMenu.addAction(win.editDeleteAction) win.editMenu.addSeparator() win.editMenu.addAction(win.editDnaDisplayStyleAction) win.editMenu.addAction(win.editProteinDisplayStyleAction) win.editMenu.addSeparator() win.editMenu.addAction(win.dispObjectColorAction) win.editMenu.addAction(win.dispObjectColorAction) win.editMenu.addSeparator() win.editMenu.addAction(win.dispObjectColorAction) win.editMenu.addAction(win.resetChunkColorAction) win.editMenu.addAction(win.colorSchemeAction) win.editMenu.addAction(win.lightingSchemeAction) win.editMenu.addSeparator() win.editMenu.addAction(win.editRenameSelectionAction) win.editMenu.addAction(win.editAddSuffixAction) def retranslateUi(win): """ Sets text related attributes for the "Edit" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.editMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "&Edit", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_EditMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui from utilities.icon_utilities import geticon from utilities.debug_prefs import debug_pref, Choice_boolean_False def setupUi(win): """ Populates the "Simulation" menu (incuding its "Measurement" submenu) which appears in the main window menu bar. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Measurements" submenu. win.measurementsMenu.addAction(win.jigsThermoAction) win.measurementsMenu.addAction(win.jigsDistanceAction) win.measurementsMenu.addAction(win.jigsAngleAction) win.measurementsMenu.addAction(win.jigsDihedralAction) # Populate the "Simulation" menu. win.simulationMenu.addAction(win.simSetupAction) # "Run Dynamics" win.simulationMenu.addAction(win.simMoviePlayerAction) # "Play Movie" # from utilities.GlobalPreferences import ENABLE_PROTEINS # piotr 081908: removed Rosetta from Simulation menu #if ENABLE_PROTEINS: # win.simulationMenu.addSeparator() # win.simulationMenu.addAction(win.rosettaSetupAction) win.simulationMenu.addSeparator() win.simulationMenu.addAction(win.jigsMotorAction) win.simulationMenu.addAction(win.jigsLinearMotorAction) win.simulationMenu.addAction(win.jigsAnchorAction) win.simulationMenu.addAction(win.jigsStatAction) win.simulationMenu.addAction(win.jigsThermoAction) win.simulationMenu.addAction(win.simNanoHiveAction) #NOTE: The GAMESS and ESPImage options are intentionally disabled #Disabling these items from the UI was a rattlesnake backlog item. #see this page for details: #U{<http://www.nanoengineer-1.net/mediawiki/index.php?title=Rattlesnake_Sprint_Backlog>} #See also: UserPrefs.py _hideOrShowTheseWidgetsInUserPreferenceDialog method #where the widgets in the UserPrefernces dialog corresponding to these actions #are hidden. if debug_pref("Show GAMESS and ESP Image UI options", Choice_boolean_False, prefs_key = True): win.simulationMenu.addAction(win.jigsGamessAction) # GAMESS win.simulationMenu.addAction(win.jigsESPImageAction) # ESP Image def retranslateUi(win): """ Sets text related attributes for the "Simulations" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.simulationMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Simulation", None, QtGui.QApplication.UnicodeUTF8)) win.measurementsMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Measurements", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_SimulationMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui from utilities.debug_prefs import debug_pref, Choice_boolean_False def setupUi(win): """ Populates the "Insert" menu (incuding its "Reference Geometry" submenu) which appears in the main window menu bar. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Insert" menu. win.insertMenu.addAction(win.partLibAction) win.insertMenu.addAction(win.fileInsertMmpAction) win.insertMenu.addAction(win.fileInsertPdbAction) win.insertMenu.addSeparator() win.insertMenu.addAction(win.referencePlaneAction) #win.insertMenu.addAction(win.jigsGridPlaneAction) # Grid Plane deprecated at v1.1.1 --Mark 2008-07-09 if debug_pref("Show Insert > Line option", Choice_boolean_False, prefs_key=True): win.insertMenu.addAction(win.referenceLineAction) win.insertMenu.addSeparator() win.insertMenu.addAction(win.insertCommentAction) #Commenting out the following to 'fix' bug 2455 #(we decided to remove this from the UI for alpha9.1 Only commenting it out #so that it can be reimplemented in future if we decide to do so. (and #thus it won't be 'forgotton' completely) -- ninad 20070619 ##win.insertMenu.addSeparator() ##win.insertMenu.addAction(win.insertPovraySceneAction) def retranslateUi(win): """ Sets text related attributes for the "Insert" and "Reference Geometry" menus. @param win: NE1's mainwindow object. @type win: Ui_MainWindow """ win.insertMenu.setTitle(QtGui.QApplication.translate( "MainWindow", "&Insert", None, QtGui.QApplication.UnicodeUTF8)) # Removed by Mark 2008-04-05. #win.referenceGeometryMenu.setTitle(QtGui.QApplication.translate( # "MainWindow", "Reference Geometry", # None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_InsertMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui def setupUi(win): """ Populates the "Build Tools" menu, a submenu of the "Tools" menu. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Build Structures" menu. win.buildToolsMenu.addAction(win.modifyHydrogenateAction) win.buildToolsMenu.addAction(win.modifyDehydrogenateAction) win.buildToolsMenu.addAction(win.modifyPassivateAction) win.buildToolsMenu.addSeparator() win.buildToolsMenu.addAction(win.modifyDeleteBondsAction) win.buildToolsMenu.addAction(win.modifySeparateAction) win.buildToolsMenu.addAction(win.modifyMergeAction) win.buildToolsMenu.addSeparator() win.buildToolsMenu.addAction(win.modifyAlignCommonAxisAction) win.buildToolsMenu.addAction(win.modifyCenterCommonAxisAction) win.buildToolsMenu.addSeparator() win.buildToolsMenu.addAction(win.jigsAtomSetAction) def retranslateUi(win): """ Sets text related attributes for the "Build Tools" submenu, which is a submenu of the "Tools" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.buildToolsMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Build Tools", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_BuildToolsMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui def setupUi(win): """ Populates the "File" menu which appears in the main window menu bar. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Import" submenu. win.importMenu.addAction(win.fileInsertMmpAction) win.importMenu.addAction(win.fileInsertPdbAction) win.importMenu.addAction(win.fileInsertInAction) win.importMenu.addSeparator() win.importMenu.addAction(win.fileImportOpenBabelAction) win.importMenu.addAction(win.fileImportIOSAction) #Populate the Fetch submenu win.fetchMenu.addAction(win.fileFetchPdbAction) # Populate the "Export" submenu. win.exportMenu.addAction(win.fileExportPdbAction) win.exportMenu.addAction(win.fileExportQuteMolXPdbAction) win.exportMenu.addSeparator() win.exportMenu.addAction(win.fileExportJpgAction) win.exportMenu.addAction(win.fileExportPngAction) win.exportMenu.addAction(win.fileExportPovAction) win.exportMenu.addAction(win.fileExportAmdlAction) win.exportMenu.addSeparator() win.exportMenu.addAction(win.fileExportOpenBabelAction) win.exportMenu.addAction(win.fileExportIOSAction) # Populate the "File" menu. win.fileMenu.addAction(win.fileOpenAction) win.fileMenu.addAction(win.fileCloseAction) win.fileMenu.addSeparator() win.fileMenu.addAction(win.fileSaveAction) win.fileMenu.addAction(win.fileSaveAsAction) win.fileMenu.addSeparator() win.fileMenu.addMenu(win.importMenu) win.fileMenu.addMenu(win.exportMenu) from utilities.GlobalPreferences import ENABLE_PROTEINS if ENABLE_PROTEINS: win.fileMenu.addMenu(win.fetchMenu) win.fileMenu.addSeparator() win.fileMenu.addAction(win.fileExitAction) # Create and add the "Open Recent Files" submenu. win.createOpenRecentFilesMenu() def retranslateUi(win): """ Sets text related attributes for the "File" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.fileMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) win.importMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Import", None, QtGui.QApplication.UnicodeUTF8)) win.exportMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Export", None, QtGui.QApplication.UnicodeUTF8)) win.fetchMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Fetch", None, QtGui.QApplication.UnicodeUTF8)) win.openRecentFilesMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "Open Recent Files", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_FileMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui def setupUi(win): """ Populates the "Dimensions" menu, a submenu of the "Tools" menu. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Dimensions" menu. win.dimensionsMenu.addAction(win.jigsDistanceAction) win.dimensionsMenu.addAction(win.jigsAngleAction) win.dimensionsMenu.addAction(win.jigsDihedralAction) def retranslateUi(win): """ Sets text related attributes for the "Dimensions" submenu, which is a submenu of the "Tools" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.dimensionsMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "&Dimensions", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_DimensionsMenu.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui def setupUi(win): """ Populates the "Selection" menu, a submenu of the "Tools" menu. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Select" menu. win.selectionMenu.addAction(win.selectLockAction) win.selectionMenu.addAction(win.selectAllAction) win.selectionMenu.addAction(win.selectNoneAction) win.selectionMenu.addAction(win.selectInvertAction) win.selectionMenu.addAction(win.selectConnectedAction) win.selectionMenu.addAction(win.selectDoublyAction) win.selectionMenu.addAction(win.selectExpandAction) win.selectionMenu.addAction(win.selectContractAction) win.selectionMenu.addAction(win.selectByNameAction) def retranslateUi(win): """ Sets text related attributes for the "Select" submenu, which is a submenu of the "Tools" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.selectionMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "&Selection", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/menus/Ui_SelectMenu.py
# 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): """ 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 retranslateUi(win): """ Assigns the I{window title} property of the "Select" toolbar. The window title of the "Select" toolbar will be displayed in the popup menu under "View > Toolbars". """ win.selectToolBar.setWindowTitle( QtGui.QApplication.translate( "MainWindow", "Select", None, QtGui.QApplication.UnicodeUTF8)) win.selectToolBar.setToolTip( QtGui.QApplication.translate( "MainWindow", "Select Toolbar", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_SelectToolBar.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ Ui_RenderingToolBar.py - Toolbar for Rendering plug-ins like QuteMolX and POV-Ray. @author: Mark @version: $Id$ @copyright: 2005-2007 Nanorex, Inc. See LICENSE file for details. """ from PyQt4 import QtGui from foundation.wiki_help import QToolBar_WikiHelp 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 def retranslateUi(win): """ Assigns the I{window title} property of the "Rendering" toolbar. The window title of these toolbars will be displayed in the popup menu under "View > Toolbars". """ win.renderingToolBar.setWindowTitle( QtGui.QApplication.translate( "MainWindow", "Rendering", None, QtGui.QApplication.UnicodeUTF8)) win.renderingToolBar.setToolTip( QtGui.QApplication.translate( "MainWindow", "Rendering Toolbar", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_RenderingToolBar.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ This class provides the flyout toolbar for ExtrudeMode @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: 2008-09-19: Created during command stack refactoring project TODO: """ from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout from PyQt4.Qt import QAction class ExtrudeFlyout(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. """ return self.win.toolsExtrudeAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit Extrude" def getFlyoutActionList(self): """ 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) 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
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_ExtrudeFlyout.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ TODO: (list copied and kept from Ui_DnaFlyout.py --Mark) - Does the parentWidget for the NanotubeFlyout always needs to be a propertyManager The parentWidget is the propertyManager object of the currentCommand on the commandSequencer. What if the currentCommand doesn't have a PM but it wants its own commandToolbar? Use the mainWindow as its parentWidget? - The implementation may change after Command Manager (Command toolbar) code cleanup. The implementation as of 2007-12-20 is an attempt to define flyouttoolbar object in the 'Command. History: - Mark 2008-03-8: This file created from a copy of Ui_DnaFlyout.py and edited. """ from PyQt4 import QtGui from PyQt4.Qt import SIGNAL from utilities.icon_utilities import geticon from ne1_ui.NE1_QWidgetAction import NE1_QWidgetAction from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout _superclass = Ui_AbstractFlyout class NanotubeFlyout(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. """ return self.win.buildNanotubeAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit NT" def getFlyoutActionList(self): """ Returns a tuple that contains lists of actions used to create the flyout toolbar. Called by CommandToolbar._createFlyoutToolBar(). @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. subControlAreaActionList = [] subControlAreaActionList.append(self.exitModeAction) separator = QtGui.QAction(self.parentWidget) separator.setSeparator(True) subControlAreaActionList.append(separator) subControlAreaActionList.append(self.insertNanotubeAction) allActionsList.extend(subControlAreaActionList) 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 _createActions(self, parentWidget): _superclass._createActions(self, parentWidget) self.subControlActionGroup = QtGui.QActionGroup(self.parentWidget) self.subControlActionGroup.setExclusive(False) self.insertNanotubeAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.insertNanotubeAction.setText("Insert NT") self.insertNanotubeAction.setCheckable(True) self.insertNanotubeAction.setIcon( geticon("ui/actions/Tools/Build Structures/InsertNanotube.png")) self.subControlActionGroup.addAction(self.insertNanotubeAction) def _addWhatsThisText(self): """ Add 'What's This' help text for all actions on toolbar. """ from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForNanotubeCommandToolbar whatsThisTextForNanotubeCommandToolbar(self) return def _addToolTipText(self): """ Add 'Tool tip' help text for all actions on toolbar. """ from ne1_ui.ToolTipText_for_CommandToolbars import toolTipTextForNanotubeCommandToolbar toolTipTextForNanotubeCommandToolbar(self) return def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be overridden in subclasses. By default it does nothing. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean @see: self.activateFlyoutToolbar, self.deActivateFlyoutToolbar """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect _superclass.connect_or_disconnect_signals(self, isConnect) change_connect(self.insertNanotubeAction, SIGNAL("triggered(bool)"), self.activateInsertNanotubeLine_EditCommand) def resetStateOfActions(self): """ Resets the state of actions in the flyout toolbar. Uncheck most of the actions. Basically it unchecks all the actions EXCEPT the ExitCntAction @see: self.deActivateFlyoutToolbar() @see: baseCommand.command_update_flyout() """ #Uncheck all the actions in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action.isChecked(): action.setChecked(False) def activateInsertNanotubeLine_EditCommand(self, isChecked): """ Slot for (Insert) B{Nanotube} action. """ self.win.insertNanotube(isChecked) #IMPORTANT: #For a QAction, the method #setChecked does NOT emmit the 'triggered' SIGNAL. So #we can call self.capCntAction.setChecked without invoking its #slot method! #Otherwise we would have needed to block the signal when action is #emitted ..example we would have called something like : #'if self._block_insertNanotubeAction_event: return' at the beginning of #this method. Why we didn't use QAction group -- We need these actions #to be # a) exclusive as well as #(b) 'toggle-able' (e.g. if you click on a checked action , it should #uncheck) #QActionGroup achieves (a) but can't do (b) #Uncheck all the actions except the dna duplex action #in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action is not self.insertNanotubeAction and action.isChecked(): action.setChecked(False)
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_NanotubeFlyout.py
# Copyright 2007 Nanorex, Inc. See LICENSE file for details. """ Ui_CommandToolbar.py - UI and hardcoded content for the Command Toolbar @author: Ninad @version: $Id$ @copyright: 2007 Nanorex, Inc. See LICENSE file for details. Module classification: [bruce 071228] At present, this hardcodes the set of main toolbuttons ('Build', 'Tools', etc) and at least some of the specific list of subcommands under each one. So clearly it belongs in ne1_ui, even though it ought to be refactored into that part (the specific contents of NE1's CommandToolbar, in ne1_ui) and a more general part (probably for a toplevel 'CommandToolbar' package) which could set up any similar toolbutton hierarchy, given a specification for its content and ordering (or leave some of that to be added later by external calls -- it may do some of that now, but I can't tell from the code or comments). (After this future refactoring, the general part, either a QWidget subclass like now, or owning one, would construct the toolbutton hierarchy semi-automatically from a known set of command modules, either specified to it as a constructor argument or passed to a later setup method (all at once or incrementally).) Accordingly, due to the hardcoded UI layout and contents, this is classified into ne1_ui for now, though its subclass is not (see comments there). History: ninad 070125: created this file, moved and modified relevant code from CommandManager to this file. mark 20071226: renamed from Ui_CommandManager to Ui_CommandToolbar. TODO: Code cleanup planned for Alpha 10 (lower priority) -- Ninad 2007-09-11 """ from PyQt4 import QtGui from PyQt4.Qt import QWidget from PyQt4.Qt import QSizePolicy from PyQt4.Qt import QHBoxLayout from PyQt4.Qt import QButtonGroup from PyQt4.Qt import QToolButton from PyQt4.Qt import QSize from PyQt4.Qt import Qt from PyQt4.Qt import QSpacerItem from PyQt4.Qt import QString from PyQt4.Qt import QPalette from utilities.icon_utilities import geticon from foundation.whatsthis_utilities import fix_QAction_whatsthis from foundation.wiki_help import QToolBar_WikiHelp from commandToolbar.CommandToolbar_Constants import cmdTbarCntrlAreaBtnColor from commandToolbar.CommandToolbar_Constants import cmdTbarSubCntrlAreaBtnColor from commandToolbar.CommandToolbar_Constants import cmdTbarCmdAreaBtnColor from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForCommandToolbarBuildButton from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForCommandToolbarToolsButton from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForCommandToolbarMoveButton from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForCommandToolbarSimulationButton from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForCommandToolbarInsertButton from PM.PM_Colors import getPalette from ne1_ui.toolbars.FlyoutToolbar import FlyoutToolBar #debug flag for bug 2633 (in Qt4.3 all control area buttons collapse into a #single button. The following flag, if True, sets the controlarea as a #QWidget instead of a QToolbar. As of 2008-02-20, we are not using any of the #QToolbar features to make the control area a Qtoolbar. (In future we will #use some features such as adding new actions to the toolbar or autohiding #actions/ items that don't fit the specified width (accessible via '>>' #indicator). The command toolbar code is likely to be revised post FNANO08 #that time, this can be cleaned up further. Till then, the default #implementation will use controlarea as a QWidget object instead of QToolbar DEFINE_CONTROL_AREA_AS_A_QWIDGET = True 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()
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_CommandToolbar.py
NanoCAD-master
cad/src/ne1_ui/toolbars/__init__.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: Ninad 2008-07-15: Created during an initial refactoring of class CommandToolbar Moved the common code out of Ui_CommandToolBar and CommandToolbar into this class. TODO: """ from foundation.wiki_help import QToolBar_WikiHelp from PyQt4.Qt import QMenu from PyQt4.Qt import Qt from PyQt4.Qt import QPalette from PyQt4.Qt import QToolButton from PM.PM_Colors import getPalette from commandToolbar.CommandToolbar_Constants import cmdTbarCmdAreaBtnColor from utilities.icon_utilities import geticon _superclass = QToolBar_WikiHelp class FlyoutToolBar(QToolBar_WikiHelp): def __init__(self, parent): _superclass.__init__(self, parent) self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.addSeparator() self.setAutoFillBackground(True) palette = self.getPalette() self.setPalette(palette) self._setExtensionButtonIcon() def clear(self): """ Clear the actions within this toolbar AND also clear the submenu of the extension popup indicator ('>>") button of this toolbar. NOTE: QToolBar.clear() doesn't automatically clear the latter. (at least in Qt4.3) Because of this, there was a problem in fixing bug 2916. Apparently, the only way to access an extension button widget of a QToolBar is to access its children() and the 3rd button in the list is the extension indicator button, whose menu need to be cleared. """ _superclass.clear(self) extension_menu = self.getExtensionMenu() if extension_menu is not None: extension_menu.clear() def getPalette(self): """ Return a palette for Command Manager 'Commands area'(flyout toolbar) (Palette for Tool Buttons in command toolbar command area) """ return getPalette(None, QPalette.Button, cmdTbarCmdAreaBtnColor ) def _setExtensionButtonIcon(self): """ Sets the icon for the Flyout Toolbar extension button. The PNG image can be 24 (or less) pixels high by 10 pixels wide. """ extension_button = self.getExtensionButton() extension_button.setIcon(geticon( "ui/actions/Command Toolbar/ExtensionButtonImage.png")) def getExtensionButton(self): """ Returns the extension popup indicator toolbutton ">>" """ btn = None clist = self.children() for c in range(0, len(clist)): if isinstance(clist[c], QToolButton): btn = clist[c] break return btn def getExtensionMenu(self): """ Return the extension menu i.e. the submenu of the extension popup indicator button ">>" (if any) """ toolbtn = self.getExtensionButton() if toolbtn is None: return None menu = None # Children of 1st QToolButton (3rd toolbar child) contains a single QMenu toolbtn_clist = toolbtn.children() if toolbtn_clist: extension_menu = toolbtn_clist[0] # The extension menu! if isinstance(extension_menu, QMenu): menu = extension_menu return menu
NanoCAD-master
cad/src/ne1_ui/toolbars/FlyoutToolbar.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: Ninad 2008-08-04: Created during the command stack refactoring project TODO: 2008-08-04 - See the superclass """ from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout class PartLibraryFlyout(Ui_AbstractFlyout): """ Define Flyout toolbar for the Part library command (Insert > Part Library) """ 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 return self.win.partLibAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit Partlib" def getFlyoutActionList(self): """ Returns a tuple that contains mode spcific actionlists in the added in the flyout toolbar of the mode. @return: A tuple that contains 3 lists: subControlAreaActionList, commandActionLists and allActionsList @rtype: tuple @see: L{CommandToolbar._createFlyoutToolBar} which calls this. """ subControlAreaActionList = [] commandActionLists = [] allActionsList = [] subControlAreaActionList.append(self.exitModeAction) lst = [] commandActionLists.append(lst) allActionsList.append(self.exitModeAction) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_PartLibraryFlyout.py
# 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
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_MoveFlyout.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ TODO: - Does the parentWidget for the DnaFlyout always needs to be a propertyManager The parentWidget is the propertyManager object of the currentCommand on the commandSequencer. What if the currentCommand doesn't have a PM but it wants its own commandToolbar? Use the mainWindow as its parentWidget? - The implementation may change after Command Manager (Command toolbar) code cleanup. The implementation as of 2007-12-20 is an attempt to define flyouttoolbar object in the 'Command. """ import foundation.env as env from PyQt4 import QtCore, QtGui from PyQt4.Qt import Qt from PyQt4.Qt import SIGNAL from utilities.icon_utilities import geticon from utilities.Log import greenmsg from ne1_ui.NE1_QWidgetAction import NE1_QWidgetAction from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout _superclass = Ui_AbstractFlyout class DnaFlyout(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. """ return self.win.buildDnaAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit DNA" def getFlyoutActionList(self): """ Returns a tuple that contains lists of actions used to create the flyout toolbar. Called by CommandToolbar._createFlyoutToolBar(). @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. subControlAreaActionList = [] subControlAreaActionList.append(self.exitModeAction) separator = QtGui.QAction(self.parentWidget) separator.setSeparator(True) subControlAreaActionList.append(separator) subControlAreaActionList.append(self.dnaDuplexAction) subControlAreaActionList.append(self.breakStrandAction) subControlAreaActionList.append(self.joinStrandsAction) subControlAreaActionList.append(self.makeCrossoversAction) subControlAreaActionList.append(self.convertDnaAction) subControlAreaActionList.append(self.orderDnaAction) subControlAreaActionList.append(self.editDnaDisplayStyleAction) allActionsList.extend(subControlAreaActionList) 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 _createActions(self, parentWidget): """ Overrides superclass method """ _superclass._createActions(self, parentWidget) # The subControlActionGroup is the parent of all flyout QActions. self.subControlActionGroup = QtGui.QActionGroup(self.parentWidget) # Shouldn't the parent be self.win? # IIRC, parentWidget = BuildDnaPropertyManager. # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroup.setExclusive(False) self.dnaDuplexAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.dnaDuplexAction.setText("Insert DNA") self.dnaDuplexAction.setCheckable(True) self.dnaDuplexAction.setIcon( geticon("ui/actions/Command Toolbar/BuildDna/InsertDna.png")) self.breakStrandAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.breakStrandAction.setText("Break Strand") self.breakStrandAction.setCheckable(True) self.breakStrandAction.setIcon( geticon("ui/actions/Command Toolbar/BuildDna/BreakStrand.png")) self.joinStrandsAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.joinStrandsAction.setText("Join Strands") self.joinStrandsAction.setCheckable(True) self.joinStrandsAction.setIcon( geticon("ui/actions/Command Toolbar/BuildDna/JoinStrands.png")) self.makeCrossoversAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.makeCrossoversAction.setText("Crossovers") self.makeCrossoversAction.setCheckable(True) self.makeCrossoversAction.setIcon( geticon("ui/actions/Command Toolbar/BuildDna/MakeCrossovers.png")) self.dnaOrigamiAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.dnaOrigamiAction.setText("Origami") self.dnaOrigamiAction.setIcon( geticon("ui/actions/Tools/Build Structures/DNA_Origami.png")) self.convertDnaAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.convertDnaAction.setText("Convert") self.convertDnaAction.setIcon( geticon("ui/actions/Command Toolbar/BuildDna/ConvertDna.png")) self.orderDnaAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.orderDnaAction.setText("Order DNA") self.orderDnaAction.setIcon( geticon("ui/actions/Command Toolbar/BuildDna/OrderDna.png")) self.editDnaDisplayStyleAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.editDnaDisplayStyleAction.setText("Edit Style") self.editDnaDisplayStyleAction.setCheckable(True) self.editDnaDisplayStyleAction.setIcon( geticon("ui/actions/Command Toolbar/BuildDna/EditDnaDisplayStyle.png")) # Add the actions. self.subControlActionGroup.addAction(self.dnaDuplexAction) self.subControlActionGroup.addAction(self.breakStrandAction) self.subControlActionGroup.addAction(self.joinStrandsAction) self.subControlActionGroup.addAction(self.makeCrossoversAction) self.subControlActionGroup.addAction(self.editDnaDisplayStyleAction) def _addWhatsThisText(self): """ Add 'What's This' help text for all actions on toolbar. """ from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForDnaCommandToolbar whatsThisTextForDnaCommandToolbar(self) return def _addToolTipText(self): """ Add 'Tool tip' help text for all actions on toolbar. """ from ne1_ui.ToolTipText_for_CommandToolbars import toolTipTextForDnaCommandToolbar toolTipTextForDnaCommandToolbar(self) return def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be overridden in subclasses. By default it does nothing. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean @see: self.activateFlyoutToolbar, self.deActivateFlyoutToolbar """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect _superclass.connect_or_disconnect_signals(self, isConnect) change_connect(self.dnaDuplexAction, SIGNAL("triggered(bool)"), self.activateInsertDna_EditCommand) change_connect(self.breakStrandAction, SIGNAL("triggered(bool)"), self.activateBreakStrands_Command) change_connect(self.joinStrandsAction, SIGNAL("triggered(bool)"), self.activateJoinStrands_Command) change_connect(self.makeCrossoversAction, SIGNAL("triggered(bool)"), self.activateMakeCrossovers_Command) change_connect(self.dnaOrigamiAction, SIGNAL("triggered()"), self.activateDnaOrigamiEditCommand) change_connect(self.convertDnaAction, SIGNAL("triggered()"), self.convertDnaCommand) if 1: # the new way, with the "DNA Order" PM. change_connect(self.orderDnaAction, SIGNAL("triggered(bool)"), self.activateOrderDna_Command) else: # the old way (without the PM) change_connect(self.orderDnaAction, SIGNAL("triggered()"), self.orderDnaCommand) change_connect(self.editDnaDisplayStyleAction, SIGNAL("triggered(bool)"), self.activateDisplayStyle_Command) def ORIGINAL_activateFlyoutToolbar(self): #Unused as of 2008-08-13 (and onwards) #This method can be removed in the near future. Testing has not discovered #any new bugs after Ui_DnaFlyout was inherited from Ui_AbstractFlyout. """ Updates the flyout toolbar with the actions this class provides. """ if self._isActive: return self._isActive = True #Temporary workaround for bug 2600 . #until the Command Toolbar code is revised #When DnaFlyout toolbar is activated, it should switch to (check) the #'Build Button' in the control area. So that the DnaFlyout #actions are visible in the flyout area of the command toolbar. #-- Ninad 2008-01-21. #UPDATE 2008-04-12: There is a better fix available (see bug 2801) #That fix is likely to unnecessiate the following -- but not tested #well. After more testing, the following line of code can be removed #@see: CommandToolbar.check_controlAreaButton_containing_action -- Ninad self.win.commandToolbar.cmdButtonGroup.button(0).setChecked(True) #Now update the command toolbar (flyout area) self.win.commandToolbar.updateCommandToolbar(self.win.buildDnaAction, self) #self.win.commandToolbar._setControlButtonMenu_in_flyoutToolbar( #self.cmdButtonGroup.checkedId()) self.exitDnaAction.setChecked(True) self.connect_or_disconnect_signals(True) def activateInsertDna_EditCommand(self, isChecked): """ Slot for B{Duplex} action. """ self.win.insertDna(isChecked) #IMPORTANT: #For a QAction, the method #setChecked does NOT emmit the 'triggered' SIGNAL. So #we can call self.breakStrandAction.setChecked without invoking its #slot method! #Otherwise we would have needed to block the signal when action is #emitted ..example we would have called something like : #'if self._block_dnaDuplexAction_event: return' at the beginning of this #method. Why we didn't use QAction group -- We need these actions to be # a) exclusive as well as #(b) 'toggle-able' (e.g. if you click on a checked action , it should #uncheck) #QActionGroup achieves (a) but can't do (b) #Uncheck all the actions except the dna duplex action #in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action is not self.dnaDuplexAction and action.isChecked(): action.setChecked(False) def activateBreakStrands_Command(self, isChecked): """ Call the method that enters BreakStrands_Command. (After entering the command) Also make sure that all the other actions on the DnaFlyout toolbar are unchecked AND the BreakStrands Action is checked. """ self.win.enterBreakStrandCommand(isChecked) #Uncheck all the actions except the break strands action #in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action is not self.breakStrandAction and action.isChecked(): action.setChecked(False) def activateJoinStrands_Command(self, isChecked): """ Call the method that enters JoinStrands_Command. (After entering the command) Also make sure that all the other actions on the DnaFlyout toolbar are unchecked AND the JoinStrands Action is checked. """ self.win.enterJoinStrandsCommand(isChecked) #Uncheck all the actions except the join strands action #in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action is not self.joinStrandsAction and action.isChecked(): action.setChecked(False) elif action is self.joinStrandsAction and not action.isChecked(): pass #action.setChecked(True) def activateMakeCrossovers_Command(self, isChecked): """ Call the method that enters JoinStrands_Command. (After entering the command) Also make sure that all the other actions on the DnaFlyout toolbar are unchecked AND the JoinStrands Action is checked. """ self.win.enterMakeCrossoversCommand(isChecked) #Uncheck all the actions except the join strands action #in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action is not self.makeCrossoversAction and action.isChecked(): action.setChecked(False) elif action is self.makeCrossoversAction and not action.isChecked(): pass #action.setChecked(True) def activateDnaOrigamiEditCommand(self): """ Slot for B{Origami} action. """ msg1 = greenmsg("DNA Origami: ") msg2 = "Not implemented yet." final_msg = msg1 + msg2 env.history.message(final_msg) def convertDnaCommand(self): """ Slot for B{Convert DNA} action. """ cs = self.win.commandSequencer cs.userEnterCommand('CONVERT_DNA') return def orderDnaCommand(self): """ Slot for B{Order DNA} action. @see: MWSemantics.orderDna """ self.win.orderDna() return def activateOrderDna_Command(self, isChecked): """ Call the method that enters OrderDna_Command. (After entering the command) Also make sure that all the other actions on the DnaFlyout toolbar are unchecked AND the DisplayStyle Action is checked. """ self.win.enterOrderDnaCommand(isChecked) #Uncheck all the actions except the Order DNA action #in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action is not self.editDnaDisplayStyleAction and action.isChecked(): action.setChecked(False) def activateDisplayStyle_Command(self, isChecked): """ Call the method that enters DisplayStyle_Command. (After entering the command) Also make sure that all the other actions on the DnaFlyout toolbar are unchecked AND the DisplayStyle Action is checked. """ self.win.enterDnaDisplayStyleCommand(isChecked) #Uncheck all the actions except the (DNA) display style action #in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action is not self.editDnaDisplayStyleAction and action.isChecked(): action.setChecked(False) def resetStateOfActions(self): """ See superclass for more documentation. Resets the state of actions in the flyout toolbar. It unchecks all the actions EXCEPT the ExitModeAction. This is called while resuming a command. This is called while resuming a command. Example: If Insert > Dna command is exited and the Build > Dna command is resumed. When this happens, program needs to make sure that the Insert > DNA button in the flyout is unchecked. It is done by using this method. @see: self.deActivateFlyoutToolbar() @see: self.activateBreakStrands_Command() @see: AbstractFlyout.resetStateOfActions() @see: baseCommand.command_update_flyout() which calls this method. """ #Uncheck all the actions in the flyout toolbar (subcontrol area) for action in self.subControlActionGroup.actions(): if action.isChecked(): action.setChecked(False)
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_DnaFlyout.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ This class provides the flyout toolbar for movieMode (Play Movie command) @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: 2008-08-21: Created during command stack refactoring project TODO: """ from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout from PyQt4.Qt import QAction class PlayMovieFlyout(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. """ return self.win.simMoviePlayerAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit Movie" def getFlyoutActionList(self): """ 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.simPlotToolAction) 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
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_PlayMovieFlyout.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ This class provides the flyout toolbar for BuildCrystals command @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: 2008-08-11: Created during command stack refactoring project TODO: """ from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout from PyQt4.Qt import SIGNAL from PyQt4 import QtGui from ne1_ui.NE1_QWidgetAction import NE1_QWidgetAction from utilities.icon_utilities import geticon _superclass = Ui_AbstractFlyout class BuildCrystalFlyout(Ui_AbstractFlyout): """ This class provides the flyout toolbar for BuildCrystals command """ _subControlAreaActionList = [] 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. """ return self.win.buildCrystalAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit Crystal" def activateFlyoutToolbar(self): """ Updates the flyout toolbar with the actions this class provides. @see: Ui_AbstractFlyout.activateFlyoutToolbar() """ _superclass.activateFlyoutToolbar(self) self._setAutoShapeAcclKeys(True) def deActivateFlyoutToolbar(self): """ Updates the flyout toolbar with the actions this class provides. @see: Ui_AbstractFlyout.deActivateFlyoutToolbar() """ self._setAutoShapeAcclKeys(False) _superclass.deActivateFlyoutToolbar(self) def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be overridden in subclasses. By default it does nothing. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean @see: self.activateFlyoutToolbar, self.deActivateFlyoutToolbar """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect _superclass.connect_or_disconnect_signals(self, isConnect) change_connect(self.subControlActionGroup, SIGNAL("triggered(QAction *)"), self.parentWidget.changeSelectionShape) def _createActions(self, parentWidget): _superclass._createActions(self, parentWidget) # The subControlActionGroup is the parent of all flyout QActions. self.subControlActionGroup = QtGui.QActionGroup(parentWidget) self._subControlAreaActionList.append(self.exitModeAction) separator = QtGui.QAction(parentWidget) separator.setSeparator(True) self._subControlAreaActionList.append(separator) self.polygonShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.polygonShapeAction.setObjectName("DEFAULT") self.polygonShapeAction.setText("Polygon") self._subControlAreaActionList.append(self.polygonShapeAction) self.circleShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.circleShapeAction.setObjectName("CIRCLE") self.circleShapeAction.setText("Circle") self._subControlAreaActionList.append(self.circleShapeAction) self.squareShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.squareShapeAction.setObjectName("SQUARE") self.squareShapeAction.setText("Square") self._subControlAreaActionList.append(self.squareShapeAction) self.rectCtrShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.rectCtrShapeAction.setObjectName("RECTANGLE") self.rectCtrShapeAction.setText("RectCenter") self._subControlAreaActionList.append(self.rectCtrShapeAction) self.rectCornersShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.rectCornersShapeAction.setObjectName("RECT_CORNER") self.rectCornersShapeAction.setText("RectCorners") self._subControlAreaActionList.append(self.rectCornersShapeAction) self.triangleShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.triangleShapeAction.setObjectName("TRIANGLE") self.triangleShapeAction.setText("Triangle") self._subControlAreaActionList.append(self.triangleShapeAction) self.diamondShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.diamondShapeAction.setObjectName("DIAMOND") self.diamondShapeAction.setText("Diamond") self._subControlAreaActionList.append(self.diamondShapeAction) self.hexagonShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.hexagonShapeAction.setObjectName("HEXAGON") self.hexagonShapeAction.setText("Hexagon") self._subControlAreaActionList.append(self.hexagonShapeAction) self.lassoShapeAction = NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.lassoShapeAction.setObjectName("LASSO") self.lassoShapeAction.setText("Lasso") self._subControlAreaActionList.append(self.lassoShapeAction) for action in self._subControlAreaActionList[1:]: if isinstance(action, NE1_QWidgetAction): action.setCheckable(True) self.subControlActionGroup.addAction(action) iconpath = "ui/actions/Command Toolbar/BuildCrystal/" + str(action.text()) + ".png" action.setIcon(geticon(iconpath)) if not self.subControlActionGroup.checkedAction(): self.polygonShapeAction.setChecked(True) return def getFlyoutActionList(self): """ 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) subControlAreaActionList.extend(self._subControlAreaActionList) 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 _setAutoShapeAcclKeys(self, on): """ If <on>, then set the acceleration keys for autoshape selection in this command; otherwise, like when exit. set it to empty. """ if on: self.polygonShapeAction.setShortcut('P') self.circleShapeAction.setShortcut('C') self.rectCtrShapeAction.setShortcut('R') self.hexagonShapeAction.setShortcut('H') self.triangleShapeAction.setShortcut('T') self.rectCornersShapeAction.setShortcut('SHIFT+R') self.lassoShapeAction.setShortcut('L') self.diamondShapeAction.setShortcut('D') self.squareShapeAction.setShortcut('S') else: for btn in self.subControlActionGroup.actions(): btn.setShortcut('') def getSelectionShape(self): """ Return the current selection shape that is checked. """ selectionShape = self.subControlActionGroup.checkedAction().objectName() return selectionShape def _addWhatsThisText(self): """ Add 'What's This' help text for all actions on toolbar. """ from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForCrystalCommandToolbar whatsThisTextForCrystalCommandToolbar(self) return def _addToolTipText(self): """ Add 'Tool tip' help text for all actions on toolbar. """ from ne1_ui.ToolTipText_for_CommandToolbars import toolTipTextForCrystalCommandToolbar toolTipTextForCrystalCommandToolbar(self) return
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_BuildCrystalFlyout.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ This class provides the flyout toolbar for Graphene command. @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: 2008-08-26: Created during command stack refactoring project TODO: """ from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout from PyQt4.Qt import QAction class GrapheneFlyout(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. """ return self.win.insertGrapheneAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit Graphene" def getFlyoutActionList(self): """ 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) 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
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_GrapheneFlyout.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui from PyQt4.Qt import Qt from foundation.wiki_help import QToolBar_WikiHelp 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 retranslateUi(win): """ Assigns the I{window title} property of the "Display Styles" toolbar. The window title of these toolbars will be displayed in the popup menu under "View > Toolbars". """ win.displayStylesToolBar.setWindowTitle( QtGui.QApplication.translate( "MainWindow", "Display Styles", None, QtGui.QApplication.UnicodeUTF8)) win.displayStylesToolBar.setToolTip( QtGui.QApplication.translate( "MainWindow", "Display Styles Toolbar", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_DisplayStylesToolBar.py
# 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 "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.editRenameSelectionAction) win.standardToolBar.addAction(win.editAddSuffixAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.editPrefsAction) win.standardToolBar.addSeparator() win.standardToolBar.addAction(win.helpWhatsThisAction) def retranslateUi(win): """ Assigns the I{window title} property of the "Standard" toolbar. The window title of the "Standard" toolbar will be displayed in the popup menu under "View > Toolbars". """ win.standardToolBar.setWindowTitle( QtGui.QApplication.translate( "MainWindow", "Standard", None, QtGui.QApplication.UnicodeUTF8)) win.standardToolBar.setToolTip( QtGui.QApplication.translate( "MainWindow", "Standard Toolbar", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_StandardToolBar.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: - 2008-07-29 created. Moved related code from BuildAtoms_Command to this new class NOTE THAT THIS CLASS IS NOT YET USED ANYWHERE. As of 2008-07-29, BuildAtoms_Command continues to use its own methods to update the flyout toolbar Eventually this class will be used to do that part. TODO: - This may be revised heavily during the command toolbar cleanup project. The current class refactors the related code from class BuildAtoms_Command @Note: The class name is BuildAtomsFlyout -- this provides the flyout toolbar for class BuildAtoms_Command """ from ne1_ui.NE1_QWidgetAction import NE1_QWidgetAction from PyQt4.Qt import SIGNAL from PyQt4.Qt import QAction from PyQt4.Qt import QActionGroup from utilities.icon_utilities import geticon from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout from utilities.debug import print_compact_stack _superclass = Ui_AbstractFlyout class BuildAtomsFlyout(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. """ return self.win.toolsDepositAtomAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit Atoms" def getFlyoutActionList(self): """ 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) """ #ninad070330 This implementation may change in future. #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions. allActionsList = [] #Action List for subcontrol Area buttons. #For now this list is just used to set a different palette to thisaction #buttons in the toolbar subControlAreaActionList =[] #Append subcontrol area actions to subControlAreaActionList #The 'Exit button' althought in the subcontrol area, would #look as if its in the Control area because of the different color #palette #and the separator after it. This is intentional. subControlAreaActionList.append(self.exitModeAction) separator1 = QAction(self.win) separator1.setSeparator(True) subControlAreaActionList.append(separator1) subControlAreaActionList.append(self.atomsToolAction) subControlAreaActionList.append(self.bondsToolAction) separator = QAction(self.win) separator.setSeparator(True) subControlAreaActionList.append(separator) #Also add the subcontrol Area actions to the 'allActionsList' for a in subControlAreaActionList: allActionsList.append(a) ##actionlist.append(self.win.modifyAdjustSelAction) ##actionlist.append(self.win.modifyAdjustAllAction) #Ninad 070330: #Command Actions : These are the actual actions that will respond the #a button pressed in the 'subControlArea (if present). #Each Subcontrol area button can have its own 'command list' #The subcontrol area buuton and its command list form a 'key:value pair #in a python dictionary object #In Build mode, as of 070330 we have 3 subcontrol area buttons #(or 'actions)' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) #Command list for the subcontrol area button 'Atoms Tool' #For others, this list will remain empty for now -- ninad070330 depositAtomsCmdLst = [] depositAtomsCmdLst.append(self.win.modifyHydrogenateAction) depositAtomsCmdLst.append(self.win.modifyDehydrogenateAction) depositAtomsCmdLst.append(self.win.modifyPassivateAction) separatorAfterPassivate = QAction(self.win) separatorAfterPassivate.setSeparator(True) depositAtomsCmdLst.append(separatorAfterPassivate) depositAtomsCmdLst.append(self.transmuteAtomsAction) separatorAfterTransmute = QAction(self.win) separatorAfterTransmute.setSeparator(True) depositAtomsCmdLst.append(separatorAfterTransmute) depositAtomsCmdLst.append(self.win.modifyDeleteBondsAction) depositAtomsCmdLst.append(self.win.modifySeparateAction) depositAtomsCmdLst.append(self.win.makeChunkFromSelectedAtomsAction) commandActionLists[2].extend(depositAtomsCmdLst) ##for action in self.win.buildToolsMenu.actions(): ##commandActionLists[2].append(action) # Command list for the subcontrol area button 'Bonds Tool' # For others, this list will remain empty for now -- ninad070405 bondsToolCmdLst = [] bondsToolCmdLst.append(self.bond1Action) bondsToolCmdLst.append(self.bond2Action) bondsToolCmdLst.append(self.bond3Action) bondsToolCmdLst.append(self.bondaAction) bondsToolCmdLst.append(self.bondgAction) bondsToolCmdLst.append(self.cutBondsAction) commandActionLists[3].extend(bondsToolCmdLst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params def _createActions(self, parentWidget): """ Define flyout toolbar actions for this mode. """ #@NOTE: In Build mode, some of the actions defined in this method are also #used in Build Atoms PM. (e.g. bond actions) So probably better to rename #it as _init_modeActions. Not doing that change in mmkit code cleanup #commit(other modes still implement a method by same name)-ninad20070717 _superclass._createActions(self, parentWidget) # The subControlActionGroup is the parent of all flyout QActions. self.subControlActionGroup = QActionGroup(parentWidget) # Shouldn't the parent be self.win? # Isn't parentWidget = BuildAtomsPropertyManager. # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroup.setExclusive(True) #Following Actions are added in the Flyout toolbar. #Defining them outside that method as those are being used #by the subclasses of deposit mode (testmode.py as of 070410) -- ninad self.atomsToolAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.atomsToolAction.setText("Atoms Tool") self.atomsToolAction.setIcon(geticon( "ui/actions/Command Toolbar/BuildAtoms/AtomsTool.png")) self.atomsToolAction.setCheckable(True) self.atomsToolAction.setChecked(True) self.atomsToolAction.setObjectName('ACTION_ATOMS_TOOL') self.bondsToolAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.bondsToolAction.setText("Bonds Tool") self.bondsToolAction.setIcon(geticon( "ui/actions/Command Toolbar/BuildAtoms/BondsTool.png")) self.bondsToolAction.setCheckable(True) self.bondsToolAction.setObjectName('ACTION_BOND_TOOL') self.subControlActionGroup.addAction(self.atomsToolAction) self.subControlActionGroup.addAction(self.bondsToolAction) self.transmuteAtomsAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.transmuteAtomsAction.setText("Transmute Atoms") self.transmuteAtomsAction.setIcon(geticon( "ui/actions/Command Toolbar/BuildAtoms/TransmuteAtoms.png")) self.transmuteAtomsAction.setCheckable(False) self._createBondToolActions(parentWidget) def _createBondToolActions(self, parentWidget): """ Create the actions to be included in flyout toolbar , when the 'bonds tool' is active. Note that the object names of these action will be be used to find the Bond Tool type to which each action corresponds to. @see: self._createActions() where this is called. """ self.bondToolsActionGroup = QActionGroup(parentWidget) self.bondToolsActionGroup.setExclusive(True) self.bond1Action = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bond1Action.setText("Single") self.bond1Action.setIcon(geticon("ui/actions/Command Toolbar/BuildAtoms/SingleBond.png")) self.bond1Action.setObjectName('ACTION_SINGLE_BOND_TOOL') self.bond2Action = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bond2Action.setText("Double") self.bond2Action.setIcon(geticon("ui/actions/Command Toolbar/BuildAtoms/DoubleBond.png")) self.bond2Action.setObjectName('ACTION_DOUBLE_BOND_TOOL') self.bond3Action = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bond3Action.setText("Triple") self.bond3Action.setIcon(geticon("ui/actions/Command Toolbar/BuildAtoms/TripleBond.png")) self.bond3Action.setObjectName('ACTION_TRIPLE_BOND_TOOL') self.bondaAction = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bondaAction.setText("Aromatic") self.bondaAction.setIcon(geticon("ui/actions/Command Toolbar/BuildAtoms/AromaticBond.png")) self.bondaAction.setObjectName('ACTION_AROMATIC_BOND_TOOL') self.bondgAction = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bondgAction.setText("Graphitic") self.bondgAction.setIcon(geticon("ui/actions/Command Toolbar/BuildAtoms/GraphiticBond.png")) self.bondgAction.setObjectName('ACTION_GRAPHITIC_BOND_TOOL') self.cutBondsAction = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.cutBondsAction.setText("Cut Bonds") self.cutBondsAction.setIcon(geticon("ui/actions/Command Toolbar/BuildAtoms/CutBonds.png")) self.cutBondsAction.setObjectName('ACTION_DELETE_BOND_TOOL') for action in [self.bond1Action, self.bond2Action, self.bond3Action, self.bondaAction, self.bondgAction, self.cutBondsAction ]: self.bondToolsActionGroup.addAction(action) action.setCheckable(True) return def _addWhatsThisText(self): """ Add 'What's This' help text for all actions on toolbar. """ from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForAtomsCommandToolbar whatsThisTextForAtomsCommandToolbar(self) return def _addToolTipText(self): """ Add 'Tool tip' help text for all actions on toolbar. """ from ne1_ui.ToolTipText_for_CommandToolbars import toolTipTextForAtomsCommandToolbar toolTipTextForAtomsCommandToolbar(self) return def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be overridden in subclasses. By default it does nothing. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean @see: self.activateFlyoutToolbar, self.deActivateFlyoutToolbar """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect #Ui_AbstractFlyout connects the self.exitmodeAction, so call it first. _superclass.connect_or_disconnect_signals(self, isConnect) #Atom , Bond Tools Groupbox change_connect(self.bondToolsActionGroup, SIGNAL("triggered(QAction *)"), self.command.changeBondTool) change_connect(self.transmuteAtomsAction, SIGNAL("triggered()"),self.command.transmutePressed) change_connect(self.subControlActionGroup, SIGNAL("triggered(QAction *)"), self.updateCommandToolbar) change_connect(self.bondsToolAction, SIGNAL("triggered()"), self._activateBondsTool) change_connect(self.atomsToolAction, SIGNAL("triggered()"), self._activateAtomsTool) def get_cursor_id_for_active_tool(self): """ Provides a cursor id (int) for updating cursor in graphics mode, based on the checked action in its flyout toolbar. (i.e. based on the active tool) @see: BuildAtoms_GraphicsMode.update_cursor_for_no_MB_selection_filter_disabled """ if self.atomsToolAction.isChecked(): cursor_id = 0 elif self.bond1Action.isChecked(): cursor_id = 1 elif self.bond2Action.isChecked(): cursor_id = 2 elif self.bond3Action.isChecked(): cursor_id = 3 elif self.bondaAction.isChecked(): cursor_id = 4 elif self.bondgAction.isChecked(): cursor_id = 5 elif self.cutBondsAction.isChecked(): cursor_id = 6 else: cursor_id = 0 return cursor_id def _activateAtomsTool(self): """ Activate the atoms tool of the Build Atoms mode hide only the Atoms Tools groupbox in the Build Atoms Property manager and show all others the others. """ self.command.activateAtomsTool() def _activateBondsTool(self): """ Activate the bond tool of the Build Atoms mode Show only the Bond Tools groupbox in the Build Atoms Property manager and hide the others. @see:self._convert_bonds_bet_selected_atoms() """ self.command.activateBondsTool() def getBondToolActions(self): return self.bondToolsActionGroup.actions() def getCheckedBondToolAction(self): return self.bondToolsActionGroup.checkedAction() def resetStateOfActions(self): """ Default implementation does nothing. Overridden in subclasses. R Resets the state of actions in the flyout toolbar. Generally, it unchecks all the actions except the ExitModeAction. This is called while resuming a command. Example: if exits is in Insert > Dna command, the Build > Dna command is resumed. When this happens, program needs to make sure that the Insert > dna button in the flyout is unchecked. It is done by using this method. @see: self.deActivateFlyoutToolbar() @see: self.activateBreakStrands_Command() @see: baseCommand.command_update_flyout() which calls this method. @see: BuildAtoms_Command.command_update_state() @see: BuildAtoms_Command.activateAtomsTool() """ self.atomsToolAction.setChecked(True) ##self.bondsToolAction.setChecked(False) for action in self.bondToolsActionGroup.actions(): action.setChecked(False)
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_BuildAtomsFlyout.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: Ninad 2008-08-04: Created during the command stack refactoring project TODO: 2008-08-04 - See the superclass """ from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout class PasteFromClipboardFlyout(Ui_AbstractFlyout): """ Define Flyout toolbar for the PasteFromClipboard command (PasteFromClipboard_Command) """ 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. """ return self.win.toolsDepositAtomAction def _getExitActionText(self): """ @see: self._createActions() """ return "Exit Paste" def getFlyoutActionList(self): """ Returns a tuple that contains mode spcific actionlists in the added in the flyout toolbar of the mode. @return: A tuple that contains 3 lists: subControlAreaActionList, commandActionLists and allActionsList @rtype: tuple @see: L{CommandToolbar._createFlyoutToolBar} which calls this. """ subControlAreaActionList = [] commandActionLists = [] allActionsList = [] subControlAreaActionList.append(self.exitModeAction) lst = [] commandActionLists.append(lst) allActionsList.append(self.exitModeAction) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_PasteFromClipboardFlyout.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ @author: Urmi @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version: $Id$ History: - 2008-08-05 created by Urmi. - The motivation was to include all protein modeling and simulation features in one place. - Based on the original protein flyout toolbar that mostly supported modeling tools and the new flyout toolbar that combines atom and bonds tool for chunks """ from ne1_ui.NE1_QWidgetAction import NE1_QWidgetAction from PyQt4.Qt import SIGNAL from PyQt4.Qt import QAction from PyQt4.Qt import QActionGroup from utilities.icon_utilities import geticon from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout from processes.Plugins import checkPluginPreferences from utilities.prefs_constants import rosetta_enabled_prefs_key, rosetta_path_prefs_key _superclass = Ui_AbstractFlyout class ProteinFlyout(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. """ return self.win.buildProteinAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit Protein" def getFlyoutActionList(self): """ 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 = [] subControlAreaActionList =[] #Append subcontrol area actions to subControlAreaActionList #The 'Exit button' althought in the subcontrol area, would #look as if its in the Control area because of the different color #palette #and the separator after it. This is intentional. subControlAreaActionList.append(self.exitModeAction) separator1 = QAction(self.win) separator1.setSeparator(True) subControlAreaActionList.append(separator1) subControlAreaActionList.append(self.modelProteinAction) subControlAreaActionList.append(self.simulateProteinAction) separator = QAction(self.win) separator.setSeparator(True) subControlAreaActionList.append(separator) #Also add the subcontrol Area actions to the 'allActionsList' for a in subControlAreaActionList: allActionsList.append(a) commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) #Command list for the subcontrol area button 'Model Proteins Tool' modelProteinsCmdLst = [] modelProteinsCmdLst.append(self.buildPeptideAction) modelProteinsCmdLst.append(self.compareProteinsAction) modelProteinsCmdLst.append(self.displayProteinStyleAction) commandActionLists[2].extend(modelProteinsCmdLst) # Command list for the subcontrol area button 'Simulate Proteins Tool' if self.rosetta_enabled: simulateProteinsCmdLst = [] simulateProteinsCmdLst.append(self.rosetta_fixedbb_design_Action) simulateProteinsCmdLst.append(self.rosetta_backrub_Action) simulateProteinsCmdLst.append(self.editResiduesAction) simulateProteinsCmdLst.append(self.rosetta_score_Action) commandActionLists[3].extend(simulateProteinsCmdLst) else: modelProteinsCmdLst = [] modelProteinsCmdLst.append(self.buildPeptideAction) modelProteinsCmdLst.append(self.compareProteinsAction) modelProteinsCmdLst.append(self.displayProteinStyleAction) commandActionLists[0].extend(modelProteinsCmdLst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params def _createActions(self, parentWidget): """ Define flyout toolbar actions for this mode. """ _superclass._createActions(self, parentWidget) #Urmi 20080814: show this flyout toolbar only when rosetta plugin path # is there #Probably only rosetta_enabled_prefs_key check would have sufficed plugin_name = "ROSETTA" plugin_prefs_keys = (rosetta_enabled_prefs_key, rosetta_path_prefs_key) errorcode, errortext_or_path = \ checkPluginPreferences(plugin_name, plugin_prefs_keys, ask_for_help = False) #print "Error code =", errorcode, errortext_or_path if errorcode == 0: self.rosetta_enabled = True else: self.rosetta_enabled = False # The subControlActionGroup is the parent of all flyout QActions. self.subControlActionGroup = QActionGroup(parentWidget) # Shouldn't the parent be self.win? # Isn't parentWidget = BuildProteinPropertyManager? # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroup.setExclusive(True) self.modelProteinAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.modelProteinAction.setText("Model") self.modelProteinAction.setIcon(geticon( 'ui/actions/Command Toolbar/BuildProtein/ModelProtein.png')) self.modelProteinAction.setCheckable(True) self.modelProteinAction.setChecked(True) self.modelProteinAction.setObjectName('ACTION_MODEL_PROTEINS') self.simulateProteinAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.simulateProteinAction.setText("Simulate") self.simulateProteinAction.setIcon(geticon( "ui/actions/Command Toolbar/BuildProtein/Simulate.png")) self.simulateProteinAction.setCheckable(True) self.simulateProteinAction.setObjectName('ACTION_SIMULATE_PROTEINS') self.subControlActionGroup.addAction(self.modelProteinAction) self.subControlActionGroup.addAction(self.simulateProteinAction) self._createModelProteinsActions(parentWidget) self._createSimulateProteinsActions(parentWidget) #else: # self._createModelProteinsActions(parentWidget) #return def _createModelProteinsActions(self, parentWidget): """ Create the actions to be included in flyout toolbar, when the 'Model Proteins' is active. @see: self._createActions() where this is called. """ self.subControlActionGroupForModelProtein = QActionGroup(parentWidget) # Shouldn't the parent be self.win? # Isn't parentWidget = BuildProteinPropertyManager? # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroupForModelProtein.setExclusive(True) self.buildPeptideAction = \ NE1_QWidgetAction(self.subControlActionGroupForModelProtein, win = self.win) self.buildPeptideAction.setText("Insert Peptide") self.buildPeptideAction.setCheckable(True) self.buildPeptideAction.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/InsertPeptide.png")) self.compareProteinsAction = \ NE1_QWidgetAction(self.subControlActionGroupForModelProtein, win = self.win) self.compareProteinsAction.setText("Compare") self.compareProteinsAction.setCheckable(True) self.compareProteinsAction.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/Compare.png")) self.displayProteinStyleAction = \ NE1_QWidgetAction(self.subControlActionGroupForModelProtein, win = self.win) self.displayProteinStyleAction.setText("Edit Style") self.displayProteinStyleAction.setCheckable(True) self.displayProteinStyleAction.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/EditProteinDisplayStyle.png")) self.subControlActionGroupForModelProtein.addAction(self.buildPeptideAction) self.subControlActionGroupForModelProtein.addAction(self.displayProteinStyleAction) self.subControlActionGroupForModelProtein.addAction(self.compareProteinsAction) return def _createSimulateProteinsActions(self, parentWidget): """ Create the actions to be included in flyout toolbar, when the 'Simulate Proteins' is active. @see: self._createActions() where this is called. """ self.subControlActionGroupForSimulateProtein = QActionGroup(parentWidget) # Shouldn't the parent be self.win? # Isn't parentWidget = BuildProteinPropertyManager? # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroupForSimulateProtein.setExclusive(True) self.rosetta_fixedbb_design_Action = \ NE1_QWidgetAction(self.subControlActionGroupForSimulateProtein, win = self.win) self.rosetta_fixedbb_design_Action.setText("Fixed BB") self.rosetta_fixedbb_design_Action.setCheckable(True) self.rosetta_fixedbb_design_Action.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/FixedBackbone.png")) self.rosetta_backrub_Action = \ NE1_QWidgetAction(self.subControlActionGroupForSimulateProtein, win = self.win) self.rosetta_backrub_Action.setText("Backrub") self.rosetta_backrub_Action.setCheckable(True) self.rosetta_backrub_Action.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/Backrub.png")) self.editResiduesAction = \ NE1_QWidgetAction(self.subControlActionGroupForSimulateProtein, win = self.win) self.editResiduesAction.setText("Residues") self.editResiduesAction.setCheckable(True) self.editResiduesAction.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/Residues.png")) self.rosetta_score_Action = \ NE1_QWidgetAction(self.subControlActionGroupForSimulateProtein, win = self.win) self.rosetta_score_Action.setText("Score") self.rosetta_score_Action.setCheckable(True) self.rosetta_score_Action.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/Score.png")) self.subControlActionGroupForSimulateProtein.addAction(self.rosetta_fixedbb_design_Action) self.subControlActionGroupForSimulateProtein.addAction(self.rosetta_backrub_Action) self.subControlActionGroupForSimulateProtein.addAction(self.editResiduesAction) self.subControlActionGroupForSimulateProtein.addAction(self.rosetta_score_Action) return def _addWhatsThisText(self): """ Add 'What's This' help text for all actions on toolbar. """ from ne1_ui.WhatsThisText_for_CommandToolbars import whatsThisTextForProteinCommandToolbar whatsThisTextForProteinCommandToolbar(self) return def _addToolTipText(self): """ Add 'Tool tip' help text for all actions on toolbar. """ from ne1_ui.ToolTipText_for_CommandToolbars import toolTipTextForProteinCommandToolbar toolTipTextForProteinCommandToolbar(self) return def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be overridden in subclasses. By default it does nothing. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean @see: self.activateFlyoutToolbar, self.deActivateFlyoutToolbar """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect #Ui_AbstractFlyout connects the self.exitmodeAction, so call it first. _superclass.connect_or_disconnect_signals(self, isConnect) change_connect(self.modelProteinAction, SIGNAL("triggered()"),self._activateModelProteins) change_connect(self.subControlActionGroup, SIGNAL("triggered(QAction *)"), self.testRosettaAndUpdateCommandToolbar) change_connect(self.simulateProteinAction, SIGNAL("triggered()"), self._activateSimulateProteins) change_connect(self.buildPeptideAction, SIGNAL("triggered(bool)"), self.activateInsertPeptide_EditCommand) change_connect(self.editResiduesAction, SIGNAL("triggered(bool)"), self.activateEditResidues_EditCommand) change_connect(self.compareProteinsAction, SIGNAL("triggered(bool)"), self.activateCompareProteins_EditCommand) change_connect(self.displayProteinStyleAction, SIGNAL("triggered(bool)"), self.activateProteinDisplayStyle_Command) change_connect(self.rosetta_fixedbb_design_Action, SIGNAL("triggered(bool)"), self.activateRosettaFixedBBDesign_Command) change_connect(self.rosetta_score_Action, SIGNAL("triggered(bool)"), self.activateRosettaScore_Command) change_connect(self.rosetta_backrub_Action, SIGNAL("triggered(bool)"), self.activateRosettaBackrub_Command) return def activateRosettaBackrub_Command(self, isChecked): """ Activate Rosetta sequence design with backrub motion command """ self.win.enterOrExitTemporaryCommand('BACKRUB_PROTEIN_SEQUENCE_DESIGN') for action in self.subControlActionGroupForSimulateProtein.actions(): if action is not self.rosetta_backrub_Action and action.isChecked(): action.setChecked(False) return def activateRosettaScore_Command(self, isChecked): """ Score the current protein sequence """ proteinChunk = self.win.assy.getSelectedProteinChunk() if not proteinChunk: msg = "You must select a single protein to run a Rosetta <i>Score</i> calculation." self.updateMessage(msg) return otherOptionsText = "" numSim = 1 argList = [numSim, otherOptionsText, proteinChunk.name] from simulation.ROSETTA.rosetta_commandruns import rosettaSetup_CommandRun if argList[0] > 0: cmdrun = rosettaSetup_CommandRun(self.win, argList, "ROSETTA_SCORE") cmdrun.run() for action in self.subControlActionGroupForSimulateProtein.actions(): if action is not self.rosetta_score_Action and action.isChecked(): action.setChecked(False) return def activateRosettaFixedBBDesign_Command(self, isChecked): """ Activate fixed backbone rosetta sequence design mode """ self.win.enterOrExitTemporaryCommand('FIXED_BACKBONE_PROTEIN_SEQUENCE_DESIGN') for action in self.subControlActionGroupForSimulateProtein.actions(): if action is not self.rosetta_fixedbb_design_Action and action.isChecked(): action.setChecked(False) return def _activateModelProteins(self): """ Activate the model proteins action of the Proteins mode """ self.command.setCurrentCommandMode('MODEL_PROTEIN') self.command.enterModelOrSimulateCommand('MODEL_PROTEIN') for action in self.subControlActionGroupForModelProtein.actions(): action.setChecked(False) return def _activateSimulateProteins(self): """ Activate the simulation tool of the Build Protein mode """ self.command.setCurrentCommandMode('SIMULATE_PROTEIN') self.command.enterModelOrSimulateCommand('SIMULATE_PROTEIN') for action in self.subControlActionGroupForSimulateProtein.actions(): action.setChecked(False) return def activateInsertPeptide_EditCommand(self, isChecked): """ Slot for inserting a peptide action. """ self.win.insertPeptide(isChecked) for action in self.subControlActionGroupForModelProtein.actions(): if action is not self.buildPeptideAction and action.isChecked(): action.setChecked(False) def activateEditResidues_EditCommand(self, isChecked): """ Slot for B{EditResidues} action. """ self.win.enterEditResiduesCommand(isChecked) for action in self.subControlActionGroupForSimulateProtein.actions(): if action is not self.editResiduesAction and action.isChecked(): action.setChecked(False) def activateCompareProteins_EditCommand(self, isChecked): """ Slot for B{CompareProteins} action. """ self.win.enterCompareProteinsCommand(isChecked) for action in self.subControlActionGroupForModelProtein.actions(): if action is not self.compareProteinsAction and action.isChecked(): action.setChecked(False) def activateProteinDisplayStyle_Command(self, isChecked): """ Call the method that enters DisplayStyle_Command. (After entering the command) Also make sure that all the other actions on the DnaFlyout toolbar are unchecked AND the DisplayStyle Action is checked. """ self.win.enterProteinDisplayStyleCommand(isChecked) #Uncheck all the actions except the (DNA) display style action #in the flyout toolbar (subcontrol area) for action in self.subControlActionGroupForModelProtein.actions(): if action is not self.displayProteinStyleAction and action.isChecked(): action.setChecked(False) def resetStateOfActions(self): """ See superclass for documentation. @see: self.deActivateFlyoutToolbar() """ # Uncheck all the actions in the 'command area' , corresponding to the #'subControlArea button checked. #Note :the attrs self.subControlActionGroupFor* are misnamed. Those #should be somethin like commandAreaActionGroup* # [-- Ninad 2008-09-17 revised this method for USE_CMMAND_STACK] actionGroup = None current_active_tool = self.command.getCurrentActiveTool() if current_active_tool == 'MODEL_PROTEIN': actionGroup = self.subControlActionGroupForModelProtein elif current_active_tool == 'SIMULATE_PROTEIN': actionGroup = self.subControlActionGroupForSimulateProtein if actionGroup is None: return for action in actionGroup.actions(): action.setChecked(False) return def testRosettaAndUpdateCommandToolbar(self, action): if action == self.simulateProteinAction: if not self.rosetta_enabled: #print "Rosetta is not enabled" plugin_name = "ROSETTA" plugin_prefs_keys = (rosetta_enabled_prefs_key, rosetta_path_prefs_key) errorcode, errortext_or_path = \ checkPluginPreferences(plugin_name, plugin_prefs_keys, ask_for_help = True) #print "Error code =", errorcode, errortext_or_path if errorcode == 0: self.rosetta_enabled = True else: self.rosetta_enabled = False self.modelProteinAction.setChecked(True) self.simulateProteinAction.setChecked(False) return self.updateCommandToolbar()
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_ProteinFlyout.py
# 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 "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) #win.buildToolsToolBar.addAction(win.modifyCenterCommonAxisAction) def retranslateUi(win): """ Assigns the I{window title} property of the "Build Tools" toolbar. The window title of the "Build Tools" toolbar will be displayed in the popup menu under "View > Toolbars". """ win.buildToolsToolBar.setWindowTitle( QtGui.QApplication.translate( "MainWindow", "Build Tools", None, QtGui.QApplication.UnicodeUTF8)) win.buildToolsToolBar.setToolTip( QtGui.QApplication.translate( "MainWindow", "Build Tools Toolbar", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_BuildToolsToolBar.py
# 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): """ 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 retranslateUi(win): """ Assigns the I{window title} property of the "View", "Standard Views" and "Display Styles" toolbars. The window title of these toolbars will be displayed in the popup menu under "View > Toolbars". """ win.standardViewsToolBar.setWindowTitle( QtGui.QApplication.translate( "MainWindow", "Standard Views", None, QtGui.QApplication.UnicodeUTF8)) win.standardViewsToolBar.setToolTip( QtGui.QApplication.translate( "MainWindow", "Standard Views Toolbar", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_StandardViewsToolBar.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ This class provides the flyout toolbar for FuseChunks_Command. @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: 2008-08-11: Created during command stack refactoring project TODO: """ from ne1_ui.toolbars.Ui_AbstractFlyout import Ui_AbstractFlyout from PyQt4.Qt import QAction class FuseFlyout(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. """ return self.win.toolsFuseChunksAction def _getExitActionText(self): """ Overrides superclass method. @see: self._createActions() """ return "Exit Fuse" def getFlyoutActionList(self): """ 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) 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
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_FuseFlyout.py
# 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): """ 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 retranslateUi(win): """ Assigns the I{window title} property of the "View", "Standard Views" and "Display Styles" toolbars. The window title of these toolbars will be displayed in the popup menu under "View > Toolbars". """ win.viewToolBar.setWindowTitle( QtGui.QApplication.translate( "MainWindow", "View", None, QtGui.QApplication.UnicodeUTF8)) win.viewToolBar.setToolTip( QtGui.QApplication.translate( "MainWindow", "View Toolbar", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_ViewToolBar.py
# 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-04 Created to aid command stack refactoring. TODO: 2008-08-04 - cleanup after command toolbar refactoring. - more documentation, - have more flyouts use this new superclass @see: Ui_PartLibraryFlyout (a subclass) REVIEW: should this be moved into the widgets package? [bruce 080827 question] -- This doesn't 'create a widget' so it shouldn't. But the current pkg location for all UI_*Flyout modules needs to be reconsidered [Ninad 2008-09-10] """ from utilities.exception_classes import AbstractMethod from ne1_ui.NE1_QWidgetAction import NE1_QWidgetAction from PyQt4.Qt import SIGNAL from utilities.icon_utilities import geticon from utilities.GlobalPreferences import KEEP_SIGNALS_ALWAYS_CONNECTED from utilities.debug import print_compact_stack class Ui_AbstractFlyout(object): def __init__(self, command): """ Create necessary flyout action list and update the flyout toolbar in the command toolbar with the actions provided by the object of this class. """ self.command = command self.command_for_exit_action = self.command #bruce 080827 guess self.parentWidget = self.command.propMgr self.win =self.command.win self._isActive = False self._createActions(self.parentWidget) self._addWhatsThisText() self._addToolTipText() if KEEP_SIGNALS_ALWAYS_CONNECTED: self.connect_or_disconnect_signals(True) def _action_in_controlArea_to_show_this_flyout(self): """ To be cleaned up. The current implementation of command toolbar code needs an action in the 'Control Area' of the command toolbar to be provided as an argument in order to update the Flyout toolbar Example: If its BuildAtoms FlyoutToolbar, in order to display it, the updateCommandToolbar method needs the 'depositAtomsAction' i.e. the action corresponding to BuildAtoms command to be send as an argument (so that it knows to check the Control Area' button under which this action is defined as a subitem. this is confusing and will be cleaned up. Also it is buggy in case of , for example, Paste mode whose action is not present as a submenu in any of the Conteol Area buttons. """ raise AbstractMethod() def _getExitActionText(self): """ Raises AbstractMethod. Subclasses must override this method. @see: self._createActions() @see: attribute, self.command_for_exit_action """ raise AbstractMethod() def _createActions(self, parentWidget): """ Define flyout toolbar actions for this mode. @see: self._getExitActionText() which defines text for exit action. @note: subclasses typically extend this method to define more actions. """ #@NOTE: In Build mode, some of the actions defined in this method are also #used in Build Atoms PM. (e.g. bond actions) So probably better to rename #it as _init_modeActions. Not doing that change in mmkit code cleanup #commit(other modes still implement a method by same name)-ninad20070717 self.exitModeAction = NE1_QWidgetAction(parentWidget, win = self.win) exitActionText = self._getExitActionText() self.exitModeAction.setText(exitActionText) self.exitModeAction.setIcon(geticon('ui/actions/Command Toolbar/ControlArea/Exit.png')) self.exitModeAction.setCheckable(True) self.exitModeAction.setChecked(True) def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be extended in subclasses. By default it handles only self.exitModeAction. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean @see: self.activateFlyoutToolbar, self.deActivateFlyoutToolbar """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect change_connect(self.exitModeAction, SIGNAL("triggered()"), self._exitModeActionSlot) return def _exitModeActionSlot(self): #bruce 080827 split this out, """ Do what's appropriate when self.exitModeAction is triggered. """ self.command_for_exit_action.command_Done() def activateFlyoutToolbar(self): """ Updates the flyout toolbar with the actions this class provides. @see: baseCommand.command_update_flyout() @see: CommandToolbar.updateCommandToolbar() @see: self.deActivateFlyoutToolbar() @see: Commandtoolbar._f_current_flyoutToolbar """ #CommandToolbar._f_current_flyoutToolbar is the current flyout toolbar #that is displayed in the 'flyout area' of the command toolbar. #Example, when Build > Dna command is entered, it sets this attr on the #commandToolbar class to the 'BuildDnaFlyout' object. #When that command is exited, BuildDnaFlyout is first 'deactivated' and #the _f_current_flyoutToolbar is assigned a new value (The flyout #object of the next command entered. This can even be 'None' if the #next command doesn't have a flyoutToolbar) current_flyoutToolbar = self.win.commandToolbar._f_current_flyoutToolbar if self is current_flyoutToolbar: return #We want to assign the _f_current_flyoutToolbar as 'self'. Before doing #that, the 'current' flyout stored in #CommandToolbar._f_current_flyoutToolbar should be deactivated. if current_flyoutToolbar: current_flyoutToolbar.deActivateFlyoutToolbar() self.win.commandToolbar._f_current_flyoutToolbar = self #Always reset the state of action within the flyout to their default #state while 'activating' any flyout toolbar. #Note: This state may be changed further. #See baseCommand.command_update_flyout() where this method is called #first and then, for example, if it is a subcommand, that sub-command #may check the action in the flyout toolbar that invoked it. #Example: Enter Build Atoms command, then enter Bonds Tool, and select #a bond tool from flyout. Now exit BuildAtoms command and reenter it #Upon reentry, it should show the default Atoms Tool in the flyout. #This is acheived by calling the following method. Note that it is #not called in deActivateFlyoutToolbar because there could be some #bugs in how frequently that method is called. So always safe to do it #here. self.resetStateOfActions() #May be check self.exitModeAction in the default implementation of #self.resetStateOfActions() and then extend that method in subclasses? #Okay to do it here. self.exitModeAction.setChecked(True) if not KEEP_SIGNALS_ALWAYS_CONNECTED: self.connect_or_disconnect_signals(True) self.updateCommandToolbar() def deActivateFlyoutToolbar(self): """ Updates the flyout toolbar with the actions this class provides. @see: self.activateFlyoutToolbar() @see: CommandToolbar.resetToDefaultState() @see: baseCommand.command_update_flyout() """ current_flyout = self.win.commandToolbar._f_current_flyoutToolbar previous_flyout = self.win.commandToolbar._f_previous_flyoutToolbar if self not in (current_flyout, previous_flyout): return if not KEEP_SIGNALS_ALWAYS_CONNECTED: self.connect_or_disconnect_signals(False) self.updateCommandToolbar(bool_entering = False) def updateCommandToolbar(self, bool_entering = True): """ Update the command toolbar. """ obj = self self.win.commandToolbar.updateCommandToolbar( self._action_in_controlArea_to_show_this_flyout(), obj, entering = bool_entering) return def resetStateOfActions(self): """ Default implementation does nothing. Resets the state of actions in the flyout toolbar. Generally, it unchecks all the actions except the 'ExitModeAction' (but subclasses can implement it differently) This is overridden in subclasses to ensure that the default state of the flyout is restored. Who overrides this? -- This is overridden in flyout classes of commands that have potential subcommands which care about flyout and may do changes to it. See BuildDnaFlyout, BuildAtomsFlyout for example. In general, it will be called for any command that defines its own FlyoutToolbar_class. In such cases, it is called whenever command is entered or resumed. Example: When its the default DNA command, this method resets all the actions in the flyout toolbar except the 'ExitModeAction'. When it is the 'Build Atoms' command, the default state of the toolbar is such that the 'Atoms tool' button in the subcontrol area is checked along with the 'Exit' button. Example: If Insert > Dna command is exited and the Build > Dna command is resumed. When this happens, program needs to make sure that the Insert > DNA button in the flyout is unchecked. It is done by using this method. @see: self.deActivateFlyoutToolbar() @see: self.activateBreakStrands_Command() @see: baseCommand.command_update_flyout() which calls this method. """ pass def _addWhatsThisText(self): """ Add 'What's This' help text for all actions on toolbar. Default implementation does nothing. Should be overridden in subclasses """ pass def _addToolTipText(self): """ Add 'Tool tip' help text for all actions on toolbar. Default implementation does nothing. Should be overridden in subclasses """ pass
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_AbstractFlyout.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui from foundation.wiki_help import QToolBar_WikiHelp from utilities.debug_prefs import debug_pref, Choice_boolean_True 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 retranslateUi(win): """ Assigns the I{window title} property of the "Build Structures" toolbar. The window title of the "Build Structures" toolbar will be displayed in the popup menu under "View > Toolbars". """ win.buildStructuresToolBar.setWindowTitle( QtGui.QApplication.translate( "MainWindow", "Build Structures", None, QtGui.QApplication.UnicodeUTF8)) win.buildStructuresToolBar.setToolTip( QtGui.QApplication.translate( "MainWindow", "Build Structures Toolbar", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_BuildStructuresToolBar.py
# 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))
NanoCAD-master
cad/src/ne1_ui/toolbars/Ui_SimulationToolBar.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'HelpDialog.ui' # # Created: Tue Mar 04 16:01:31 2008 # by: PyQt4 UI code generator 4.2 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_HelpDialog(object): def setupUi(self, HelpDialog): HelpDialog.setObjectName("HelpDialog") HelpDialog.resize(QtCore.QSize(QtCore.QRect(0,0,600,480).size()).expandedTo(HelpDialog.minimumSizeHint())) self.gridlayout = QtGui.QGridLayout(HelpDialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.help_tab = QtGui.QTabWidget(HelpDialog) self.help_tab.setObjectName("help_tab") self.tab = QtGui.QWidget() self.tab.setObjectName("tab") self.gridlayout1 = QtGui.QGridLayout(self.tab) self.gridlayout1.setMargin(0) self.gridlayout1.setSpacing(6) self.gridlayout1.setObjectName("gridlayout1") self.mouse_controls_textbrowser = QtGui.QTextBrowser(self.tab) self.mouse_controls_textbrowser.setObjectName("mouse_controls_textbrowser") self.gridlayout1.addWidget(self.mouse_controls_textbrowser,0,0,1,1) self.help_tab.addTab(self.tab,"") self.tab1 = QtGui.QWidget() self.tab1.setObjectName("tab1") self.gridlayout2 = QtGui.QGridLayout(self.tab1) self.gridlayout2.setMargin(0) self.gridlayout2.setSpacing(6) self.gridlayout2.setObjectName("gridlayout2") self.keyboard_shortcuts_textbrowser = QtGui.QTextBrowser(self.tab1) self.keyboard_shortcuts_textbrowser.setObjectName("keyboard_shortcuts_textbrowser") self.gridlayout2.addWidget(self.keyboard_shortcuts_textbrowser,0,0,1,1) self.help_tab.addTab(self.tab1,"") self.tab_2 = QtGui.QWidget() self.tab_2.setObjectName("tab_2") self.gridlayout3 = QtGui.QGridLayout(self.tab_2) self.gridlayout3.setMargin(0) self.gridlayout3.setSpacing(6) self.gridlayout3.setObjectName("gridlayout3") self.selection_shortcuts_textbrowser = QtGui.QTextBrowser(self.tab_2) self.selection_shortcuts_textbrowser.setObjectName("selection_shortcuts_textbrowser") self.gridlayout3.addWidget(self.selection_shortcuts_textbrowser,0,0,1,1) self.help_tab.addTab(self.tab_2,"") self.gridlayout.addWidget(self.help_tab,0,0,1,1) self.hboxlayout = QtGui.QHBoxLayout() self.hboxlayout.setMargin(0) self.hboxlayout.setSpacing(6) self.hboxlayout.setObjectName("hboxlayout") spacerItem = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem) self.close_btn = QtGui.QPushButton(HelpDialog) self.close_btn.setObjectName("close_btn") self.hboxlayout.addWidget(self.close_btn) self.gridlayout.addLayout(self.hboxlayout,1,0,1,1) self.retranslateUi(HelpDialog) self.help_tab.setCurrentIndex(2) QtCore.QObject.connect(self.close_btn,QtCore.SIGNAL("clicked()"),HelpDialog.close) QtCore.QMetaObject.connectSlotsByName(HelpDialog) def retranslateUi(self, HelpDialog): HelpDialog.setWindowTitle(QtGui.QApplication.translate("HelpDialog", "NanoEngineer-1 Help", None, QtGui.QApplication.UnicodeUTF8)) self.help_tab.setTabText(self.help_tab.indexOf(self.tab), QtGui.QApplication.translate("HelpDialog", "Mouse Controls", None, QtGui.QApplication.UnicodeUTF8)) self.help_tab.setTabText(self.help_tab.indexOf(self.tab1), QtGui.QApplication.translate("HelpDialog", "Keyboard Shortcuts", None, QtGui.QApplication.UnicodeUTF8)) self.help_tab.setTabText(self.help_tab.indexOf(self.tab_2), QtGui.QApplication.translate("HelpDialog", "Selection Shortcuts", None, QtGui.QApplication.UnicodeUTF8)) self.close_btn.setText(QtGui.QApplication.translate("HelpDialog", "Close", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/help/HelpDialog.py
NanoCAD-master
cad/src/ne1_ui/help/__init__.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ help.py - help dialog used for mouse controls and keyboard shortcuts $Id$ History: Rewritten by Mark as a minimal help facility for Alpha 6. bruce 071214 renamed class Help -> Ne1HelpDialog, so uses are findable by text search. The name HelpDialog was taken (as the module from which we import Ui_HelpDialog). TODO: The module should also be renamed, in case we want to use "help" in a more general way, e.g. as a package name. [bruce 071214 comment] """ __author__ = "Josh" import os, sys from PyQt4.Qt import QWidget from PyQt4.Qt import SIGNAL from ne1_ui.help.HelpDialog import Ui_HelpDialog from utilities.icon_utilities import geticon class Ne1HelpDialog(QWidget, Ui_HelpDialog): """ The Help dialog used for mouse controls and keyboard shortcuts """ def __init__(self): QWidget.__init__(self) self.setupUi(self) self.connect(self.help_tab,SIGNAL("currentChanged(int)"),self.setup_current_page) self.connect(self.close_btn,SIGNAL("clicked()"),self.close) self.setWindowIcon(geticon('ui/border/MainWindow.png')) self._setup_mouse_controls_page() self.help_tab.setCurrentIndex(0) return def showDialog(self, pagenum): """ Display the Help dialog with either the Mouse Controls or Keyboard Shortcuts page pagenum is the page number, where: 0 = Mouse Controls 1 = Keyboard Shortcuts 2 = Selection Shortcuts """ self.help_tab.setCurrentIndex(pagenum) # Sends signal to setup_current_page() # To make sure the Help dialog is displayed on top, we hide, then show it. self.hide() # Mark 2007-06-01 self.show() # Non-modal return ###### Private methods ############################### def _setup_mouse_controls_page(self): """ Setup the Mouse Controls help page. """ filePath = os.path.dirname(os.path.abspath(sys.argv[0])) if sys.platform == 'darwin': htmlDoc = os.path.normpath(filePath + '/../doc/mousecontrols-mac.htm') else: htmlDoc = os.path.normpath(filePath + '/../doc/mousecontrols.htm') # Make sure help document exists. If not, display msg in textbrowser. if os.path.exists(htmlDoc): self.mouse_controls_textbrowser.setHtml(open(htmlDoc).read()) else: msg = "Help file " + htmlDoc + " not found." self.mouse_controls_textbrowser.setPlainText(msg) def _setup_keyboard_shortcuts_page(self): """ Setup the Keyboard Shortcuts help page. """ filePath = os.path.dirname(os.path.abspath(sys.argv[0])) if sys.platform == 'darwin': htmlDoc = os.path.normpath(filePath + '/../doc/keyboardshortcuts-mac.htm') else: htmlDoc = os.path.normpath(filePath + '/../doc/keyboardshortcuts.htm') # Make sure help document exists. If not, display msg in textbrowser. if os.path.exists(htmlDoc): self.keyboard_shortcuts_textbrowser.setHtml(open(htmlDoc).read()) else: msg = "Help file " + htmlDoc + " not found." self.keyboard_shortcuts_textbrowser.setPlainText(msg) def _setup_selection_shortcuts_page(self): """ Setup the Selection Shortcuts help page. """ filePath = os.path.dirname(os.path.abspath(sys.argv[0])) if sys.platform == 'darwin': htmlDoc = os.path.normpath(filePath + '/../doc/selectionshortcuts-mac.htm') else: htmlDoc = os.path.normpath(filePath + '/../doc/selectionshortcuts.htm') # Make sure help document exists. If not, display msg in textbrowser. if os.path.exists(htmlDoc): self.selection_shortcuts_textbrowser.setHtml(open(htmlDoc).read()) else: msg = "Help file " + htmlDoc + " not found." self.selection_shortcuts_textbrowser.setPlainText(msg) def setup_current_page(self, currentTabIndex): pagenumber = currentTabIndex if pagenumber is 0: self._setup_mouse_controls_page() elif pagenumber is 1: self._setup_keyboard_shortcuts_page() elif pagenumber is 2: self._setup_selection_shortcuts_page() else: print 'Error: Help page unknown: ', pagenumber
NanoCAD-master
cad/src/ne1_ui/help/help.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ $Id$ """ from PyQt4 import QtGui def setupUi(win): """ Populates the "Help" menu which appears in the main window menu bar. @param win: NE1's main window object. @type win: Ui_MainWindow """ # Populate the "Help" menu. win.helpMenu.addAction(win.helpTutorialsAction) win.helpMenu.addAction(win.helpKeyboardShortcutsAction) win.helpMenu.addAction(win.helpMouseControlsAction) win.helpMenu.addAction(win.helpSelectionShortcutsAction) win.helpMenu.addAction(win.helpWhatsThisAction) win.helpMenu.addSeparator() win.helpMenu.addAction(win.helpGraphicsCardAction) win.helpMenu.addSeparator() win.helpMenu.addAction(win.helpAboutAction) def retranslateUi(win): """ Sets text related attributes for the "Help" menu. @param win: NE1's mainwindow object. @type win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>} """ win.helpMenu.setTitle( QtGui.QApplication.translate( "MainWindow", "&Help", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/ne1_ui/help/Ui_HelpMenu.py
NanoCAD-master
cad/src/commands/__init__.py
# Copyright 2005-2009 Nanorex, Inc. See LICENSE file for details. """ movieMode.py -- movie player mode. @author: Mark @version: $Id$ @copyright: 2005-2009 Nanorex, Inc. See LICENSE file for details. History: By Mark. bruce 050426 revising it, for Alpha5, mostly to fix bugs and perhaps to generalize it. Adding various comments and revising docstrings; perhaps not signing every such change. (Most movie code revisions will be in other files, and most revisions here will probably just be to adapt this file to the external changes.) ninad20070507: moved Movie Player dashboard to Movie Property Manager. ninad2008-08-21: Cleanup: a) to introduce command_enter/exit_* methods in the new Command API b) Moved flyouttoolbar related code in its own module (Ui_PlayMovieFlyout) """ import os from PyQt4.Qt import Qt from PyQt4.Qt import QDialog, QGridLayout, QPushButton, QTextBrowser, SIGNAL, QCursor from utilities.Log import redmsg, orangemsg import foundation.env as env import foundation.changes as changes import foundation.undo_manager as undo_manager from command_support.modes import basicMode from commands.PlayMovie.MoviePropertyManager import MoviePropertyManager from ne1_ui.toolbars.Ui_PlayMovieFlyout import PlayMovieFlyout # == class _MovieRewindDialog(QDialog): """ Warn the user that a given movie is not rewound, explain why that matters, and offer to rewind it (by calling its _reset method). """ def __init__(self, movie): self.movie = movie QDialog.__init__(self, None) self.setObjectName("movie_warning") self.text_browser = QTextBrowser(self) self.text_browser.setObjectName("movie_warning_textbrowser") self.text_browser.setMinimumSize(400, 40) self.setWindowTitle('Rewind your movie?') self.text_browser.setPlainText( #bruce 080827 revised text "You may want to rewind the movie now. The atoms move as the movie " "progresses, and saving the part without rewinding will save the " "current positions, which is sometimes useful, but will make the " "movie invalid, because .dpb files only store deltas relative to " "the initial atom positions, and don't store the initial positions " "themselves." ) self.ok_button = QPushButton(self) self.ok_button.setObjectName("ok_button") self.ok_button.setText("Rewind movie") self.cancel_button = QPushButton(self) self.cancel_button.setObjectName("cancel_button") self.cancel_button.setText("Exit command without rewinding") #bruce 080827 revised text # Note: this is not, in fact, a cancel button -- # there is no option in the caller to prevent exiting the command. # There is also no option to "forward to final position", # though for a minimize movie, that might be most useful. # [bruce 080827 comment] layout = QGridLayout(self) layout.addWidget(self.text_browser, 0, 0, 0, 1) layout.addWidget(self.ok_button, 1, 0) layout.addWidget(self.cancel_button, 1, 1) self.connect(self.ok_button, SIGNAL("clicked()"), self.rewindMovie) self.connect(self.cancel_button, SIGNAL("clicked()"), self.noThanks) def rewindMovie(self): self.movie._reset() self.accept() def noThanks(self): self.accept() pass # == _superclass = basicMode class movieMode(basicMode): """ This class is used to play movie files. Users know it as "Movie mode". When entered, it might start playing a recently-made movie, or continue playing the last movie it was playing, or do nothing and wait for the user to open a new movie. The movie it is working with (if any) is always stored in assy.current_movie. In general, if assy.current_movie is playable when the mode is entered, it will start playing it. [I don't know the extent to which it will start from where it left off, in not only frame number but direction, etc. - bruce 050426] """ # class constants commandName = 'MOVIE' featurename = "Movie Player Mode" from utilities.constants import CL_MISC_TOPLEVEL command_level = CL_MISC_TOPLEVEL PM_class = MoviePropertyManager #bruce 080909 FlyoutToolbar_class = PlayMovieFlyout flyoutToolbar = None def command_entered(self): """ Extends superclass method. @see: baseCommand.command_entered() for documentation. """ _superclass.command_entered(self) #UPDATE 2008-09-18: Copying old code from self.Enter() # [bruce 050427 comment: I'm skeptical of this effect on selection, # since I can't think of any good reason for it [maybe rendering speed optimization??], # and once we have movies as nodes in the MT it will be a problem [why? #k], # but for now I'll leave it in.] self.o.assy.unpickall_in_GLPane() # was: unpickparts, unpickatoms [bruce 060721] self.o.assy.permit_pick_atoms() def command_will_exit(self): """ Extends superclass method, to offer to rewind the movie if it's not at the beginning. (Doesn't offer to prevent exit, only to rewind or not when exit is done.) """ ask = not self.commandSequencer.exit_is_forced # It's not safe to rewind if exit is forced, # since this might happen *after* the check for whether # to offer to save changes in an old file being closed, # but it creates such changes. # # A possible fix is for Open to first exit all current commands # (by implicit Done, as when changing to some unrelated command), # before even doing the check. There are better, more complex fixes, # e.g. checking for changes to ask about saving (or for the need to # ask other questions before exit) by asking all commands on the stack. # # Note: a related necessary change is calling exit_all_commands when # closing a file, but I think it doesn't fix the same issue mentioned # above. # # [bruce 080806/080908 comments] if ask: self._offer_to_rewind_if_necessary() #bruce 050426 added this [originally in a method called # restore_patches_by_Command, no longer part of command API] # , to hold the side effect formerly # done illegally by haveNontrivialState. # ... but why do we need to do this at all? # the only point of what we'd do here would be to stop # having that movie optimize itself for rapid playing.... movie = self.o.assy.current_movie if movie: movie._close() # note: this assumes this is the only movie which might be "open", # and that redundant _close is ok. _superclass.command_will_exit(self) return def _offer_to_rewind_if_necessary(self): #bruce 080806 split this out # TODO: add an option to the PM to always say yes or no to this, # e.g. a 3-choice combobox for what to do if not rewound on exit # (rewind, don't rewind, or ask). [bruce 080806 suggestion] movie = self.o.assy.current_movie if movie and movie.currentFrame != 0: # note: if the movie file stores absolute atom positions, # there is no need to call this. Currently, we only support # .dpb files, which don't store them. # note: if we entered this on a nonzero frame, it might # be more useful to compare to and offer to rewind to # that frame (perhaps in addition to frame 0). # [bruce 080827 comments] mrd = _MovieRewindDialog(movie) # rewind (by calling movie._reset()), if user desires it # (see text and comments in that class) mrd.exec_() return # see also command_will_exit, elsewhere in this file def command_enter_PM(self): """ Extends superclass method. @see: baseCommand.command_enter_PM() for documentation """ _superclass.command_enter_PM(self) #bruce 080909 call this instead of inlining it #@WARNING: The following code in command_enter_PM was originally in #def init_gui method. Its copied 'as is' from there.-- Ninad 2008-08-21 self.enableMovieControls(False) #bruce 050428 precaution (has no noticable effect but seems safer in theory) #bruce 050428, working on bug 395: I think some undesirable state is left in the dashboard, so let's reinit it # (and down below we might like to init it from the movie if possible, but it's not always possible). self.propMgr._moviePropMgr_reinit() ###e could pass frameno? is max frames avail yet in all playable movies? not sure. # [bruce 050426 comment: probably this should just be a call of an update method, also used during the mode ###e] movie = self.o.assy.current_movie # might be None, but might_be_playable() true implies it's not if self.might_be_playable(): #bruce 050426 added condition frameno = movie.currentFrame else: frameno = 0 #bruce 050426 guessed value self.propMgr.frameNumberSpinBox.setValue(frameno, blockSignals = True) self.propMgr.moviePlayActiveAction.setVisible(0) self.propMgr.moviePlayRevActiveAction.setVisible(0) if self.might_be_playable(): # We have a movie file ready. It's showtime! [bruce 050426 changed .filename -> .might_be_playable()] movie.cueMovie(propMgr = self.propMgr) # Cue movie. self.enableMovieControls(True) self.propMgr.updateFrameInformation() if movie.filename: #k not sure this cond is needed or what to do if not true [bruce 050510] env.history.message( "Movie file ready to play: %s" % movie.filename) #bruce 050510 added this message else: self.enableMovieControls(False) return def command_enter_misc_actions(self): """ Overrides superclass method. @see: baseCommand.command_enter_misc_actions() for documentation """ #@WARNING: The following code in was originally in #def init_gui method. Its copied 'as is' from there.-- Ninad 2008-08-21 self.w.simMoviePlayerAction.setChecked(1) # toggle on the Movie Player icon+ # Disable some action items in the main window. # [bruce 050426 comment: I'm skeptical of disabling the ones marked #k # and suggest for some others (especially "simulator") that they # auto-exit the mode rather than be disabled, # but I won't revise these for now.] self.w.disable_QActions_for_movieMode(True) # Actions marked #k are now in disable_QActions_for_movieMode(). mark 060314) # Disable Undo/Redo actions, and undo checkpoints, during this mode (they *must* be reenabled in restore_gui). # We do this last, so as not to do it if there are exceptions in the rest of the method, # since if it's done and never undone, Undo/Redo won't work for the rest of the session. # [bruce 060414; same thing done in some other modes] undo_manager.disable_undo_checkpoints('Movie Player') undo_manager.disable_UndoRedo('Movie Player', "in Movie Player") # optimizing this for shortness in menu text # this makes Undo menu commands and tooltips look like "Undo (not permitted in Movie Player)" (and similarly for Redo) def command_exit_misc_actions(self): """ Overrides superclass method. @see: baseCommand.command_exit_misc_actions() for documentation """ #@WARNING: The following code in was originally in #def restore_gui method. Its copied 'as is' from there.-- Ninad 2008-08-21 # Reenable Undo/Redo actions, and undo checkpoints #(disabled in command_entered); # do it first to protect it from exceptions in the rest of this method # (since if it never happens, Undo/Redo won't work for the rest of the session) # [bruce 060414; same thing done in some other modes] undo_manager.reenable_undo_checkpoints('Movie Player') undo_manager.reenable_UndoRedo('Movie Player') self.w.simMoviePlayerAction.setChecked(0) # toggle on the Movie Player icon self.set_cmdname('Movie Player') # this covers all changes while we were in the mode # (somewhat of a kluge, and whether this is the best place to do it is unknown; # without this the cmdname is "Done") self.w.disable_QActions_for_movieMode(False) #END new command API methods ============================================= def enableMovieControls(self, enabled = True): self.propMgr.enableMovieControls(enabled) def might_be_playable(self): """ Do we have a current movie which is worth trying to play? """ movie = self.o.assy.current_movie return movie and movie.might_be_playable() def makeMenus(self): self.Menu_spec = [ ('Cancel', self.command_Cancel), ('Reset Movie', self.ResetMovie), ('Done', self.command_Done), None, ('Edit Color Scheme...', self.w.colorSchemeCommand), ] def ResetMovie(self): #bruce 050325 revised or made this, since .current_movie can change if self.o.assy.current_movie: self.o.assy.current_movie._reset() def Draw_model(self): _superclass.Draw_model(self) self.o.assy.draw(self.o) # mouse and key events def keyPress(self, key): # Disable delete key if key == Qt.Key_Delete: return movie = self.o.assy.current_movie if not movie: return # Left or Down arrow keys - advance back one frame if key == Qt.Key_Left or key == Qt.Key_Down: movie._playToFrame(movie.currentFrame - 1) # Right or Up arrow keys - advance forward one frame if key == Qt.Key_Right or key == Qt.Key_Up: movie._playToFrame(movie.currentFrame + 1) _superclass.keyPress(self, key) # So F1 Help key works. mark 060321 return def update_cursor_for_no_MB(self): # Fixes bug 1693. mark 060321 """ Update the cursor for 'Movie Player' mode. """ self.o.setCursor(QCursor(Qt.ArrowCursor)) pass # == def simMoviePlayer(assy): """ Plays a DPB movie file created by the simulator, either the current movie if any, or a previously saved dpb file with the same name as the current part, if one can be found. """ from simulation.movie import find_saved_movie, Movie #bruce 050329 precaution (in case of similar bug to bug 499) win = assy.w if not assy.molecules: # No model, so no movie could be valid for current part. # bruce 050327 comment: even so, a movie file might be valid for some other Part... # not yet considered here. [050427 addendum: note that user can't yet autoload a new Part # just by opening a movie file, so there's no point in going into the mode -- it's only meant # for playing a movie for the *current contents of the current part*, for now.] env.history.message(redmsg("Movie Player: Need a model.")) win.simMoviePlayerAction.setChecked(0) # toggle on the Movie Player icon ninad 061113 return if assy.current_movie and assy.current_movie.might_be_playable(): win.commandSequencer.userEnterCommand('MOVIE', always_update = True) return # no valid current movie, look for saved one with same name as assy ## env.history.message("Plot Tool: No simulation has been run yet.") if assy.filename: if assy.part is not assy.tree.part: msg = "Movie Player: Warning: Looking for saved movie for main part, not for displayed clipboard item." env.history.message(orangemsg(msg)) errorcode, partdir = assy.find_or_make_part_files_directory() if not errorcode: # filename could be an MMP or PDB file. dir, fil = os.path.split(assy.filename) fil, ext = os.path.splitext(fil) mfile = os.path.join(partdir, fil + '.dpb') else: mfile = os.path.splitext(assy.filename)[0] + ".dpb" movie = find_saved_movie( assy, mfile) # checks existence -- should also check validity for current part or main part, but doesn't yet ###e # (neither did the pre-030527 code for this function, unless that's done in moviePlay, which it might be) if movie: # play this movie, and make it the current movie. assy.current_movie = movie #e should we switch to the part for which this movie was made? [might be done in moviePlay; if not:] # No current way to tell how to do that, and this might be done even if it's not valid # for any loaded Part. So let's not... tho we might presume (from filename choice we used) # it was valid for Main Part. Maybe print warning for clip item, and for not valid? #e env.history.message("Movie Player: %s previously saved movie for this part." % ("playing" or "loading")) win.commandSequencer.userEnterCommand('MOVIE', always_update = True) return # else if no assy.filename or no movie found from that: # bruce 050327 comment -- do what the old code did, except for the moviePlay # which seems wrong and tracebacks now. assy.current_movie = Movie(assy) # temporary kluge until bugs in movieMode for no assy.current_movie are fixed win.commandSequencer.userEnterCommand('MOVIE', always_update = True) return # end
NanoCAD-master
cad/src/commands/PlayMovie/movieMode.py
NanoCAD-master
cad/src/commands/PlayMovie/__init__.py
# Copyright 2007-2008 Nanorex, Inc. See LICENSE file for details. """ The Ui_MoviePropertyManager class defines UI elements for the Property Manager of the B{Movie mode}. @author: Mark, Ninad @copyright: 2007-2008 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: ninad 2007-05-07 : Converted movie dashboard into movie Property manager ninad 2007-09-11: Code clean up to use PM module classes #TODO: Ui_MoviePlayerManager uses some Mainwindow widgets and actions #(This is because Movie PM uses most methods originally created for movie #dashboard and Movie dashboard defined them this way -- ninad 2007-05-07 """ from PyQt4 import QtGui from PyQt4.Qt import Qt from PM.PM_GroupBox import PM_GroupBox from PM.PM_CheckBox import PM_CheckBox from PM.PM_Slider import PM_Slider from PM.PM_SpinBox import PM_SpinBox from PM.PM_WidgetRow import PM_WidgetRow from PM.PM_ToolButton import PM_ToolButton from PM.PM_Constants import PM_DONE_BUTTON from PM.PM_Constants import PM_WHATS_THIS_BUTTON from PM.PM_Constants import PM_CANCEL_BUTTON from widgets.NE1ToolBar import NE1ToolBar from utilities.icon_utilities import geticon from command_support.Command_PropertyManager import Command_PropertyManager _superclass = Command_PropertyManager class Ui_MoviePropertyManager(Command_PropertyManager): """ The Ui_MoviePropertyManager class defines UI elements for the Property Manager of the B{Movie mode}. @ivar title: The title that appears in the property manager header. @type title: str @ivar pmName: The name of this property manager. This is used to set the name of the PM_Dialog object via setObjectName(). @type name: str @ivar iconPath: The relative path to the PNG file that contains a 22 x 22 icon image that appears in the PM header. @type iconPath: str """ # The title(s) that appears in the property manager header. title = "Play Movie" # The name of this Property Manager. This will be set to # the name of the PM_Dialog object via setObjectName(). pmName = title # The full path to PNG file(s) that appears in the header. iconPath = "ui/actions/Simulation/PlayMovie.png" def __init__(self, command): """ Constructor for the B{Movie} property manager class that defines its UI. @param command: The parent mode where this Property Manager is used @type command: L{movieMode} """ _superclass.__init__(self, command) self.showTopRowButtons( PM_DONE_BUTTON | \ PM_CANCEL_BUTTON | \ PM_WHATS_THIS_BUTTON) msg = '' self.MessageGroupBox.insertHtmlMessage(msg, setAsDefault=False) def _addGroupBoxes(self): """ Add various group boxes to the Movie Property manager. """ self._createAllActionWidgets() self._addMovieControlsGroupBox() self._addMovieOptionsGroupBox() self._addMovieFilesGroupBox() def _addMovieControlsGroupBox(self): """ Add Movie Controls groupbox """ self.movieControlsGroupBox = PM_GroupBox(self, title = "Movie Controls" ) self._loadMovieControlsGroupBox(self.movieControlsGroupBox) def _addMovieOptionsGroupBox(self): """ Add Movie Options groupbox """ self.movieOptionsGroupBox = PM_GroupBox(self, title = "Movie Options" ) self._loadMovieOptionsGroupBox(self.movieOptionsGroupBox) def _addMovieFilesGroupBox(self): """ Add Open / Save Movie File groupbox """ self.movieFilesGroupBox = PM_GroupBox(self, title = "Open/Save Movie File" ) self._loadMovieFilesGroupBox(self.movieFilesGroupBox) def _loadMovieControlsGroupBox(self, inPmGroupBox): """ Load widgets in the Movie Controls group box. @param inPmGroupBox: The Movie Controls groupbox in the PM @type inPmGroupBox: L{PM_GroupBox} """ #Movie Slider self.frameNumberSlider = \ PM_Slider( inPmGroupBox, currentValue = 0, minimum = 0, maximum = 999999, label = 'Current Frame: 0/900' ) self.movieFrameUpdateLabel = self.frameNumberSlider.labelWidget #Movie Controls self.movieButtonsToolBar = NE1ToolBar(inPmGroupBox) _movieActionList = [self.movieResetAction, self.moviePlayRevActiveAction, self.moviePlayRevAction, self.moviePauseAction, self.moviePlayAction, self.moviePlayActiveAction, self.movieMoveToEndAction ] for _action in _movieActionList: self.movieButtonsToolBar.addAction(_action) self.moviePlayActiveAction.setVisible(0) self.moviePlayRevActiveAction.setVisible(0) WIDGET_LIST = [("PM_", self.movieButtonsToolBar, 0)] self.moviecontrolsWidgetRow = PM_WidgetRow(inPmGroupBox, widgetList = WIDGET_LIST, spanWidth = True) self.movieLoop_checkbox = PM_CheckBox(inPmGroupBox, text = "Loop", widgetColumn = 0, state = Qt.Unchecked) def _loadMovieOptionsGroupBox(self, inPmGroupBox): """ Load widgets in the Movie Options group box. @param inPmGroupBox: The Movie Options groupbox in the PM @type inPmGroupBox: L{PM_GroupBox} """ self.frameNumberSpinBox = PM_SpinBox(inPmGroupBox, label = "Go To Frame:", labelColumn = 0, value = 0, minimum = 1, maximum = 999999) self.frameSkipSpinBox = PM_SpinBox(inPmGroupBox, label = "Skip:", labelColumn = 0, value = 0, minimum = 1, maximum = 9999, suffix = ' Frame(s)') def _loadMovieFilesGroupBox(self, inPmGroupBox): """ Load widgets in the Open/Save Movie Files group box. @param inPmGroupBox: The Open/Save Movie Files groupbox in the PM @type inPmGroupBox: L{PM_GroupBox} """ for action in self.fileOpenMovieAction, self.fileSaveMovieAction: btn = PM_ToolButton(inPmGroupBox, text = str(action.text()), spanWidth = True) btn.setDefaultAction(action) btn.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) def _createAllActionWidgets(self): """ Creates all the QAction widgets that will end up as buttons in the PM. """ self.movieResetAction = QtGui.QAction(self) self.movieResetAction.setObjectName("movieResetAction") self.movieResetAction.setIcon( geticon("ui/actions/Properties Manager/Movie_Reset.png")) self.moviePlayRevActiveAction = QtGui.QAction(self) self.moviePlayRevActiveAction.setObjectName("moviePlayRevActiveAction") self.moviePlayRevActiveAction.setIcon( geticon("ui/actions/Properties Manager/Movie_Play_Reverse_Active.png")) self.moviePlayRevAction = QtGui.QAction(self) self.moviePlayRevAction.setObjectName("moviePlayRevAction") self.moviePlayRevAction.setIcon( geticon("ui/actions/Properties Manager/Movie_Play_Reverse.png")) self.moviePauseAction = QtGui.QAction(self) self.moviePauseAction.setObjectName("moviePauseAction") self.moviePauseAction.setIcon( geticon("ui/actions/Properties Manager/Movie_Pause.png")) self.moviePlayAction = QtGui.QAction(self) self.moviePlayAction.setObjectName("moviePlayAction") self.moviePlayAction.setVisible(True) self.moviePlayAction.setIcon( geticon("ui/actions/Properties Manager/Movie_Play_Forward.png")) self.moviePlayActiveAction = QtGui.QAction(self) self.moviePlayActiveAction.setObjectName("moviePlayActiveAction") self.moviePlayActiveAction.setIcon( geticon("ui/actions/Properties Manager/Movie_Play_Forward_Active.png")) self.movieMoveToEndAction = QtGui.QAction(self) self.movieMoveToEndAction.setObjectName("movieMoveToEndAction") self.movieMoveToEndAction.setIcon( geticon("ui/actions/Properties Manager/Movie_Move_To_End.png")) self.fileOpenMovieAction = QtGui.QAction(self) self.fileOpenMovieAction.setObjectName("fileOpenMovieAction") self.fileOpenMovieAction.setIcon( geticon("ui/actions/Properties Manager/Open.png")) self.fileSaveMovieAction = QtGui.QAction(self) self.fileSaveMovieAction.setObjectName("fileSaveMovieAction") self.fileSaveMovieAction.setIcon( geticon("ui/actions/Properties Manager/Save.png")) self.fileSaveMovieAction.setText( QtGui.QApplication.translate("MainWindow", "Save Movie File...", None, QtGui.QApplication.UnicodeUTF8)) self.fileOpenMovieAction.setText( QtGui.QApplication.translate("MainWindow", "Open Movie File...", None, QtGui.QApplication.UnicodeUTF8)) # This isn't currently in the PM. It's connected and ready to go. self.movieInfoAction = QtGui.QAction(self) self.movieInfoAction.setObjectName("movieInfoAction") self.movieInfoAction.setIcon( geticon("ui/actions/Properties Manager/Movie_Info.png")) def _addWhatsThisText(self): """ What's This text for widgets in this Property Manager. """ from ne1_ui.WhatsThisText_for_PropertyManagers import whatsThis_MoviePropertyManager whatsThis_MoviePropertyManager(self) def _addToolTipText(self): """ Tool Tip text for widgets in this Property Manager. """ from ne1_ui.ToolTipText_for_PropertyManagers import ToolTip_MoviePropertyManager ToolTip_MoviePropertyManager(self)
NanoCAD-master
cad/src/commands/PlayMovie/Ui_MoviePropertyManager.py
# Copyright 2007-2008 Nanorex, Inc. See LICENSE file for details. """ MoviePropertyManager.py @author: Ninad, Bruce, Mark, Huaicai @version: $Id$ @copyright: 2007-2008 Nanorex, Inc. All rights reserved. History: ninad20070507 : Converted movie dashboard into movie Property manager (authors: various) """ from PyQt4 import QtCore, QtGui from commands.PlayMovie.Ui_MoviePropertyManager import Ui_MoviePropertyManager from PyQt4.Qt import Qt, SIGNAL, QFileDialog, QString, QMessageBox import os, foundation.env as env from utilities.Log import redmsg, greenmsg from utilities.constants import filesplit from utilities.prefs_constants import workingDirectory_prefs_key _superclass = Ui_MoviePropertyManager class MoviePropertyManager(Ui_MoviePropertyManager): """ The MoviePropertyManager class provides the Property Manager for the B{Movie mode}. The UI is defined in L{Ui_MoviePropertyManager} """ #see self.connect_or_disconnect_signals for comment about this flag isAlreadyConnected = False def connect_or_disconnect_signals(self, connect): """ Connect the slots in the Property Manager. """ if connect: change_connect = self.w.connect else: change_connect = self.w.disconnect #TODO: This is a temporary fix for a bug. When you invoke a temp mode #such as Line_Command or PanMode, entering such a temporary mode keeps the #PM from the previous mode open (and thus keeps all its signals #connected) but while exiting that temporary mode and reentering the #previous mode, it actually reconnects the signal! This gives rise to #lots of bugs. This needs more general fix in Temporary mode API. # -- Ninad 2007-10-29 if connect and self.isAlreadyConnected: return self.isAlreadyConnected = connect change_connect(self.movieResetAction, SIGNAL("triggered()"), self.movieReset) change_connect(self.moviePlayRevAction, SIGNAL("triggered()"), self.moviePlayRev) change_connect(self.moviePauseAction, SIGNAL("triggered()"), self.moviePause) change_connect(self.moviePlayAction, SIGNAL("triggered()"), self.moviePlay) change_connect(self.movieMoveToEndAction, SIGNAL("triggered()"), self.movieMoveToEnd) change_connect(self.frameNumberSlider, SIGNAL("valueChanged(int)"), self.movieSlider) change_connect(self.frameNumberSpinBox, SIGNAL("valueChanged(int)"), self.moviePlayFrame) change_connect(self.fileOpenMovieAction, SIGNAL("triggered()"), self.fileOpenMovie) change_connect(self.fileSaveMovieAction, SIGNAL("triggered()"), self.fileSaveMovie) change_connect(self.movieInfoAction, SIGNAL("triggered()"), self.movieInfo) def updateMessage(self, msg = ''): """ Updates the message box with an informative message. """ if not msg: msg = "Use movie control buttons in the Property Manager to play " \ "current simulation movie (if it exists). You can also load a" \ "previously saved movie for this model using "\ "<b>'Open Movie File...'</b> option." self.MessageGroupBox.insertHtmlMessage( msg, minLines = 6, setAsDefault = True ) def getOpenMovieFileInfo(self): """ Updates the message groupbox message in the Movie Property Manager """ msg = '' movie = self.w.assy.current_movie if movie: if movie.filename: fileName, numOfFrames, numOfAtoms = movie.getMovieInfo() msg1 = "<b>Movie File:</b> [%s] <br>" % (fileName) msg2 = "<b> Number Of Frames: </b>%s <br>" % (str(numOfFrames)) msg3 = "<b> Number Of Atoms: </b>%s " % (str(numOfAtoms)) msg = msg1 + msg2 + msg3 else: msg1 = redmsg("No movie file opened.<br>") msg2 = " Use <b>'Open movie file'</b> to load any existing"\ " movie for the current part." msg = msg1 + msg2 else: msg = redmsg("No movie file opened.") return msg def show(self): """ Overrides the Ui_MoviePropertyManager.show) method. Updates the message groupbox with movie file information """ msg = self.getOpenMovieFileInfo() self.updateMessage(msg) _superclass.show(self) # == # bruce 050428: these attrs say when we're processing a valueChanged # signal from slider or spinbox _moviePropMgr_in_valuechanged_SL = False _moviePropMgr_in_valuechanged_SB = False # bruce 050428: this says whether to ignore signals from slider and spinbox, # since they're being changed by the program rather than by the user. # (#e The Movie method that sets it should be made a method of this class.) _moviePropMgr_ignore_slider_and_spinbox = False def _moviePropMgr_reinit(self): self._moviePropMgr_ignore_slider_and_spinbox = True try: self.frameNumberSpinBox.setMaximum(999999) # in UI.py code self.frameNumberSlider.setMaximum(999999) # guess self.frameNumberSpinBox.setValue(0) # guess self.frameNumberSlider.setValue(0) # guess finally: self._moviePropMgr_ignore_slider_and_spinbox = False return def moviePlay(self): """ Play current movie foward from current position. """ if self.w.assy.current_movie: #bruce 050427 added this condition in all these slot methods self.w.assy.current_movie._play(1) def moviePause(self): """ Pause movie. """ if self.w.assy.current_movie: self.w.assy.current_movie._pause() def moviePlayRev(self): """ Play current movie in reverse from current position. """ if self.w.assy.current_movie: self.w.assy.current_movie._play(-1) def movieReset(self): """ Move current frame position to frame 0 (beginning) of the movie. """ if self.w.assy.current_movie: self.w.assy.current_movie._reset() def movieMoveToEnd(self): """ Move frame position to the last frame (end) of the movie. """ if self.w.assy.current_movie: self.w.assy.current_movie._moveToEnd() def moviePlayFrame(self, fnum): """ Show frame fnum in the current movie. This slot receives valueChanged(int) signal from self.frameNumberSpinBox. """ if not self.w.assy.current_movie: return if self._moviePropMgr_ignore_slider_and_spinbox: return ## next line is redundant, so I removed it [bruce 050428] ## if fnum == self.w.assy.current_movie.currentFrame: return self._moviePropMgr_in_valuechanged_SB = True try: self.w.assy.current_movie._playToFrame(fnum) finally: self._moviePropMgr_in_valuechanged_SB = False return def movieSlider(self, fnum): """ Show frame fnum in the current movie. This slot receives valueChanged(int) signal from self.frameNumberSlider. """ if not self.w.assy.current_movie: return if self._moviePropMgr_ignore_slider_and_spinbox: return ## next line is redundant, so I removed it [bruce 050428] ## if fnum == self.w.assy.current_movie.currentFrame: return self._moviePropMgr_in_valuechanged_SL = True try: self.w.assy.current_movie._playSlider(fnum) finally: self._moviePropMgr_in_valuechanged_SL = False return def movieInfo(self): """ Prints information about the current movie to the history widget. """ if not self.w.assy.current_movie: return env.history.message(greenmsg("Movie Information")) self.w.assy.current_movie._info() def fileOpenMovie(self): """ Open a movie file to play. """ # bruce 050327 comment: this is not yet updated for "multiple movie objects" # and bugfixing of bugs introduced by that is in progress (only done in a klugy # way so far). ####@@@@ env.history.message(greenmsg("Open Movie File:")) assert self.w.assy.current_movie # (since (as a temporary kluge) we create an empty one, if necessary, before entering # Movie Mode, of which this is a dashboard method [bruce 050328]) if self.w.assy.current_movie and self.w.assy.current_movie.currentFrame != 0: ###k bruce 060108 comment: I don't know if this will happen when currentFrame != 0 due to bug 1273 fix... #####@@@@@ env.history.message(redmsg("Current movie must be reset to frame 0 to load a new movie.")) return # Determine what directory to open. [bruce 050427 comment: if no moviefile, we should try assy.filename's dir next ###e] if self.w.assy.current_movie and self.w.assy.current_movie.filename: odir, fil, ext = filesplit(self.w.assy.current_movie.filename) del fil, ext #bruce 050413 else: odir = self.w.currentWorkingDirectory # Fixes bug 291 (comment #4). Mark 060729. fn = QFileDialog.getOpenFileName( self, "Differential Position Bytes Format (*.dpb)", odir) if not fn: env.history.message("Cancelled.") return fn = str(fn) # Check if file with name fn is a movie file which is valid for the current Part # [bruce 050324 made that a function and made it print the history messages # which I've commented out below.] from simulation.movie import _checkMovieFile r = _checkMovieFile(self.w.assy.part, fn) if r == 1: ## msg = redmsg("Cannot play movie file [" + fn + "]. It does not exist.") ## env.history.message(msg) return elif r == 2: ## msg = redmsg("Movie file [" + fn + "] not valid for the current part.") ## env.history.message(msg) if self.w.assy.current_movie and self.w.assy.current_movie.might_be_playable(): #bruce 050427 isOpen -> might_be_playable() msg = "(Previous movie file [" + self.w.assy.current_movie.filename + "] is still open.)" env.history.message(msg) return #bruce 050427 rewrote the following to use a new Movie object from simulation.movie import find_saved_movie new_movie = find_saved_movie( self.w.assy, fn ) if new_movie: new_movie.set_alist_from_entire_part(self.w.assy.part) # kluge? might need changing... if self.w.assy.current_movie: #bruce 050427 no longer checking isOpen here self.w.assy.current_movie._close() self.w.assy.current_movie = new_movie self.w.assy.current_movie.cueMovie(propMgr = self) #Make sure to enable movie control buttons! self.command.enableMovieControls(True) self.updateFrameInformation() self._updateMessageInModePM() else: # should never happen due to _checkMovieFile call, so this msg is ok # (but if someday we do _checkMovieFile inside find_saved_movie and not here, # then this will happen as an error return from find_saved_movie) msg = redmsg("Internal error in fileOpenMovie") self.command.enableMovieControls(False) self._updateMessageInModePM(msg) env.history.message(msg) return def _updateMessageInModePM(self, msg = ''): """ Updates the message box in the Movie Property Manager with the information about the opened movie file. @WARNING: This is a temporary method. Likely to be moved/ modified when movieMode.py is cleaned up. See bug 2428 for details. """ #@WARNING: Following updates the Movie property manager's message #groupbox. This should be done in a better way. At present there # is no obvious way to tell the Movie Property manager that the # movie has changed. So this is a kludge. # See bug 2428 comment 8 for further details -- Ninad 2007-10-02 currentCommand = self.win.commandSequencer.currentCommand if currentCommand.commandName == "MOVIE": if currentCommand.propMgr: if not msg: msg = currentCommand.propMgr.getOpenMovieFileInfo() currentCommand.propMgr.updateMessage(msg) def fileSaveMovie(self): """ Save a copy of the current movie file loaded in the Movie Player. """ # Make sure there is a moviefile to save. if not self.w.assy.current_movie or not self.w.assy.current_movie.filename \ or not os.path.exists(self.w.assy.current_movie.filename): msg = redmsg("Save Movie File: No movie file to save.") env.history.message(msg) msg = "To create a movie, click on the <b>Simulator</b> <img source=\"simicon\"> icon." #QMimeSourceFactory.defaultFactory().setPixmap( "simicon", # self.simSetupAction.iconSet().pixmap() ) env.history.message(msg) return env.history.message(greenmsg("Save Movie File:")) if self.w.assy.filename: sdir = self.w.assy.filename else: sdir = env.prefs[workingDirectory_prefs_key] sfilter = QString("Differential Position Bytes Format (*.dpb)") # Removed .xyz as an option in the sfilter since the section of code below # to save XYZ files never worked anyway. This also fixes bug 492. Mark 050816. fn = QFileDialog.getSaveFileName( self, "Save As", sdir, "Differential Position Bytes Format (*.dpb);;POV-Ray Series (*.pov)", sfilter) if not fn: env.history.message("Cancelled.") return else: fn = str(fn) dir, fil, ext2 = filesplit(fn) del ext2 #bruce 050413 ext = str(sfilter[-5:-1]) # Get "ext" from the sfilter. It *can* be different from "ext2"!!! - Mark #bruce 050413 comment: the above assumes that len(ext) is always 4 (.xxx). # I'm speculating that this is ok for now since it has to be one of the ones # provided to the getSaveFileName method above. # Changed os.path.join > os.path.normpath to partially fix bug #956. Mark 050911. safile = os.path.normpath(dir + "/" + fil + ext) # full path of "Save As" filename if os.path.exists(safile): # ...and if the "Save As" file exists... # ... confirm overwrite of the existing file. ret = QMessageBox.warning( self, "Confirm overwrite", "The file \"" + fil + ext + "\" already exists.\n"\ "Do you want to overwrite the existing file or cancel?", "&Overwrite", "&Cancel", "", 0, # Enter == button 0 1 ) # Escape == button 1 if ret == 1: # The user cancelled env.history.message( "Cancelled. File not saved." ) return # Cancel clicked or Alt+C pressed or Escape pressed if ext == '.dpb': self.w.assy.current_movie._close() import shutil shutil.copy(self.w.assy.current_movie.filename, safile) # Get the trace file name. tfile1 = self.w.assy.current_movie.get_trace_filename() # Copy the tracefile if os.path.exists(tfile1): fullpath, ext = os.path.splitext(safile) tfile2 = fullpath + "-trace.txt" shutil.copy(tfile1, tfile2) env.history.message("DPB movie file saved: " + safile) # note that we are still playing it from the old file and filename... does it matter? [bruce 050427 question] # Added "hflag=False" to suppress history msg, fixing bug #956. Mark 050911. self.w.assy.current_movie.cueMovie(propMgr = self, hflag = False) # Do not print info to history widget. elif ext == '.pov': self.w.assy.current_movie._write_povray_series( os.path.normpath(dir + "/" + fil)) else: #.xyz (or something unexpected) #bruce 051115 added warning and immediate return, to verify that this code is never called QMessageBox.warning(self, "ERROR", "internal error: unsupported file extension %r" % (ext,) ) # args are title, content return # from fileSaveMovie def updateFrameInformation(self): """ Update movie control widgets in PM to the current movie frames. """ movie = self.w.assy.current_movie self.frameNumberSlider.setMaximum(movie.getTotalFrames()) self.frameNumberSpinBox.setMaximum(movie.getTotalFrames()) self.frameSkipSpinBox.setMaximum(movie.getTotalFrames()) #ninad060928 fixed bug 2285 self.updateCurrentFrame() return def updateCurrentFrame(self): """ Update dashboard controls which show self.currentFrame, except for the ones being used to change it. """ #bruce 050428 split this out too, added all conditions/flags; ##e it should become a method of movieDashboardSlotsMixin if not self.w.assy.current_movie: return movie = self.w.assy.current_movie old = self._moviePropMgr_ignore_slider_and_spinbox # not sure if this is ever True here self._moviePropMgr_ignore_slider_and_spinbox = True try: dont_update_slider = self._moviePropMgr_in_valuechanged_SL # SL = Slider dont_update_spinbox = self._moviePropMgr_in_valuechanged_SB # SB = SpinBox if not dont_update_slider: self.frameNumberSlider.setValue(movie.getCurrentFrame()) currentFrameLbl = str(self.frameNumberSlider.value()) totalFrameLbl = str(movie.getTotalFrames()) flabel = "Current Frame: " + currentFrameLbl + "/" + \ totalFrameLbl self.movieFrameUpdateLabel.setText(flabel) if not dont_update_spinbox: self.frameNumberSpinBox.setValue(movie.getCurrentFrame()) finally: self._moviePropMgr_ignore_slider_and_spinbox = old return def enableMovieControls(self, enabled = True): """ Enable or disable movie control button. """ self.movieResetAction.setEnabled(enabled) self.moviePlayRevAction.setEnabled(enabled) self.moviePauseAction.setEnabled(enabled) self.moviePlayAction.setEnabled(enabled) self.movieMoveToEndAction.setEnabled(enabled) self.frameNumberSlider.setEnabled(enabled) self.frameNumberSpinBox.setEnabled(enabled) self.fileSaveMovieAction.setEnabled(enabled) return pass # end of class movieDashboardSlotsMixin
NanoCAD-master
cad/src/commands/PlayMovie/MoviePropertyManager.py
NanoCAD-master
cad/src/commands/PartProperties/__init__.py
# -*- coding: utf-8 -*- # Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. # Form implementation generated from reading ui file 'PartPropDialog.ui' # # Created: Wed Sep 20 08:20:23 2006 # by: PyQt4 UI code generator 4.0.1 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_PartPropDialog(object): def setupUi(self, PartPropDialog): PartPropDialog.setObjectName("PartPropDialog") PartPropDialog.resize(QtCore.QSize(QtCore.QRect(0,0,396,402).size()).expandedTo(PartPropDialog.minimumSizeHint())) self.gridlayout = QtGui.QGridLayout(PartPropDialog) self.gridlayout.setMargin(11) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.hboxlayout = QtGui.QHBoxLayout() self.hboxlayout.setMargin(4) self.hboxlayout.setSpacing(72) self.hboxlayout.setObjectName("hboxlayout") self.okPushButton = QtGui.QPushButton(PartPropDialog) self.okPushButton.setMinimumSize(QtCore.QSize(0,0)) self.okPushButton.setAutoDefault(True) self.okPushButton.setDefault(True) self.okPushButton.setObjectName("okPushButton") self.hboxlayout.addWidget(self.okPushButton) self.cancelPushButton = QtGui.QPushButton(PartPropDialog) self.cancelPushButton.setMinimumSize(QtCore.QSize(0,0)) self.cancelPushButton.setAutoDefault(True) self.cancelPushButton.setDefault(False) self.cancelPushButton.setObjectName("cancelPushButton") self.hboxlayout.addWidget(self.cancelPushButton) self.gridlayout.addLayout(self.hboxlayout,1,0,1,1) self.tabWidget3 = QtGui.QTabWidget(PartPropDialog) self.tabWidget3.setObjectName("tabWidget3") self.tab = QtGui.QWidget() self.tab.setObjectName("tab") self.gridlayout1 = QtGui.QGridLayout(self.tab) self.gridlayout1.setMargin(0) self.gridlayout1.setSpacing(6) self.gridlayout1.setObjectName("gridlayout1") self.vboxlayout = QtGui.QVBoxLayout() self.vboxlayout.setMargin(0) self.vboxlayout.setSpacing(6) self.vboxlayout.setObjectName("vboxlayout") self.hboxlayout1 = QtGui.QHBoxLayout() self.hboxlayout1.setMargin(0) self.hboxlayout1.setSpacing(6) self.hboxlayout1.setObjectName("hboxlayout1") self.nameLabel = QtGui.QLabel(self.tab) self.nameLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.nameLabel.setObjectName("nameLabel") self.hboxlayout1.addWidget(self.nameLabel) self.nameLineEdit = QtGui.QLineEdit(self.tab) self.nameLineEdit.setAlignment(QtCore.Qt.AlignLeading) self.nameLineEdit.setReadOnly(True) self.nameLineEdit.setObjectName("nameLineEdit") self.hboxlayout1.addWidget(self.nameLineEdit) self.vboxlayout.addLayout(self.hboxlayout1) self.mmpformatLabel = QtGui.QLabel(self.tab) self.mmpformatLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.mmpformatLabel.setObjectName("mmpformatLabel") self.vboxlayout.addWidget(self.mmpformatLabel) self.hboxlayout2 = QtGui.QHBoxLayout() self.hboxlayout2.setMargin(0) self.hboxlayout2.setSpacing(6) self.hboxlayout2.setObjectName("hboxlayout2") self.vboxlayout1 = QtGui.QVBoxLayout() self.vboxlayout1.setMargin(0) self.vboxlayout1.setSpacing(6) self.vboxlayout1.setObjectName("vboxlayout1") self.statsLabel = QtGui.QLabel(self.tab) self.statsLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.statsLabel.setObjectName("statsLabel") self.vboxlayout1.addWidget(self.statsLabel) spacerItem = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout1.addItem(spacerItem) self.hboxlayout2.addLayout(self.vboxlayout1) self.statsView = QtGui.QListWidget(self.tab) self.statsView.setObjectName("statsView") self.hboxlayout2.addWidget(self.statsView) self.vboxlayout.addLayout(self.hboxlayout2) self.gridlayout1.addLayout(self.vboxlayout,0,0,1,1) self.tabWidget3.addTab(self.tab, "") self.gridlayout.addWidget(self.tabWidget3,0,0,1,1) self.retranslateUi(PartPropDialog) QtCore.QObject.connect(self.okPushButton,QtCore.SIGNAL("clicked()"),PartPropDialog.accept) QtCore.QObject.connect(self.cancelPushButton,QtCore.SIGNAL("clicked()"),PartPropDialog.reject) QtCore.QMetaObject.connectSlotsByName(PartPropDialog) PartPropDialog.setTabOrder(self.nameLineEdit,self.statsView) PartPropDialog.setTabOrder(self.statsView,self.okPushButton) PartPropDialog.setTabOrder(self.okPushButton,self.cancelPushButton) PartPropDialog.setTabOrder(self.cancelPushButton,self.tabWidget3) def retranslateUi(self, PartPropDialog): PartPropDialog.setWindowTitle(QtGui.QApplication.translate("PartPropDialog", "Part Properties", None, QtGui.QApplication.UnicodeUTF8)) self.okPushButton.setText(QtGui.QApplication.translate("PartPropDialog", "&OK", None, QtGui.QApplication.UnicodeUTF8)) self.okPushButton.setShortcut(QtGui.QApplication.translate("PartPropDialog", "Alt+O", None, QtGui.QApplication.UnicodeUTF8)) self.cancelPushButton.setText(QtGui.QApplication.translate("PartPropDialog", "&Cancel", None, QtGui.QApplication.UnicodeUTF8)) self.cancelPushButton.setShortcut(QtGui.QApplication.translate("PartPropDialog", "Alt+C", None, QtGui.QApplication.UnicodeUTF8)) self.nameLabel.setText(QtGui.QApplication.translate("PartPropDialog", "Name:", None, QtGui.QApplication.UnicodeUTF8)) self.mmpformatLabel.setText(QtGui.QApplication.translate("PartPropDialog", "MMP File Format:", None, QtGui.QApplication.UnicodeUTF8)) self.statsLabel.setText(QtGui.QApplication.translate("PartPropDialog", "Statistics:", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget3.setTabText(self.tabWidget3.indexOf(self.tab), QtGui.QApplication.translate("PartPropDialog", "General", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/commands/PartProperties/PartPropDialog.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ PartProp.py $Id$ """ from PyQt4.Qt import QDialog, SIGNAL from commands.PartProperties.PartPropDialog import Ui_PartPropDialog class PartProp(QDialog, Ui_PartPropDialog): def __init__(self, assy): QDialog.__init__(self) self.setupUi(self) self.connect(self.okPushButton,SIGNAL("clicked()"),self.accept) self.connect(self.cancelPushButton,SIGNAL("clicked()"),self.reject) self.nameLineEdit.setText(assy.name) self.mmpformatLabel.setText("MMP File Format: " + assy.mmpformat) # Get statistics of part and display them in the statView widget. from commands.GroupProperties.GroupProp import Statistics stats = Statistics(assy.tree) stats.display(self.statsView) def accept(self): QDialog.accept(self) def reject(self): QDialog.reject(self)
NanoCAD-master
cad/src/commands/PartProperties/PartProp.py
# Copyright 2009 Nanorex, Inc. See LICENSE file for details. """ GraphicsTestCase.py - abstract class for a test case for Test Graphics Performance @author: Bruce @version: $Id$ @copyright: 2009 Nanorex, Inc. See LICENSE file for details. todo: refile some or all of this out of this specific command? """ class GraphicsTestCase(object): """ abstract class for a test case for Test Graphics Performance command """ # == setup-like methods def __init__(self, *params): """ @param params: optional, arbitrary parameters to be used by the test case. """ self._params = params # REVIEW: if we insist on passing these to __init__, # do we still need activate/deactivate methods? Guess: yes, # but we simplify their semantics by not worrying about # whether to call them when params changed # (since we always use a new instance then). return def current_params(self): """ Return the test case parameters, as a tuple of the args passed to self.__init__. """ # review: use copy_val? return self._params def __str__(self): shortname = self.__class__.__name__.split('.')[-1] return "%s%r" % (shortname, self._params) def activate(self): """ Make sure this instance is ready to be used immediately. You can assume that this is either called just before self.draw(), or that no other test case's .draw method has been called between when this was called and when self.draw() is called. TBD: whether it is necessarily called when test case parameters change. (Guess: should be, but isn't in initial prototype.) (Note that that means that the subclass API semantics for this method depends on how it's used by the totality of test cases. At present, one thing it can be used for is setting up the global environment for drawing, e.g. the list of DrawingSets to draw, in a way depended on by self.draw.) """ return # == deallocation-like methods def destroy(self): """ """ self.deactivate() return def deactivate(self): """ Optimize for not planning to reuse this instance for awhile. """ self.clear_caches() return def clear_caches(self): """ Deallocate whatever caches this instance owns (which consume nontrivial amounts of CPU or GPU RAM), without preventing further uses of this instance. """ return # == drawing methods def draw_complete(self): """ Do all drawing for self for one frame. @note; it is not usually sensible for this method on a container to call the same method on contained objects. For that, see self.draw(). """ self.draw() self._draw_drawingsets() return def draw(self): # review: rename? this name is """ Run whatever immediate-mode OpenGL code is required, and maintain the global or env-supplied list of DrawingSets and their CSDL membership, in anticipation of their being drawn in the usual way (by _draw_drawingsets, on self or some container self is in) later in the drawing of this frame. """ # note: this name 'draw' is for maximum old-code compatibility. # it may be clear when seen from the point of view of graphics leaf nodes # rather than for rendering loop test cases as this class API is meant for. return def _draw_drawingsets(self): """ subclass API method, for a complete test container (not for individual objects inside it) """ assert 0, "implement in subclass" return pass # end
NanoCAD-master
cad/src/commands/TestGraphics/GraphicsTestCase.py
NanoCAD-master
cad/src/commands/TestGraphics/__init__.py
# Copyright 2009 Nanorex, Inc. See LICENSE file for details. """ test_selection_redraw.py - test case for frequent moving of CSDLs between DrawingSets @author: Bruce @version: $Id$ @copyright: 2009 Nanorex, Inc. See LICENSE file for details. Results, as of 090106: WARNING; these are measured while running Wing IDE; at least one of these results (550 msec) is about 4x faster (140 msec) when NE1 is running directly as a developer. * pure display time can be seen by making _INVERSE_FREQUENCY_OF_REVISION a very large value. for example, about 10 fps for 50k spheres. Not great, but tolerable. No easy way to optimize. * the time to move CSDLS into other DrawingSets and recompute their caches is long -- about 550 msec per frame, for 10k CSDLs. This needs to be optimized. I don't yet know what consumes the time, but since all caches are remade using Python it's not too surprising (and profiling should show the problem). * the initial setup time (in which we make and fill 10k CSDLs) is *very* long (maybe half a minute). (The fps-printing code fails to measure this.) This too needs optimizing, since it will limit any NE1 operation which modifies lots of chunks locally, e.g. loading a file or minimizing. Probably we need to translate some of that code into C or Pyrex. """ import random import foundation.env as env from graphics.drawing.DrawingSet import DrawingSet ## from graphics.drawing.TransformControl import TransformControl from graphics.drawing.ColorSorter import ColorSorter from graphics.drawing.ColorSortedDisplayList import ColorSortedDisplayList from graphics.drawing.CS_draw_primitives import drawsphere from commands.TestGraphics.GraphicsTestCase import GraphicsTestCase # == _NUM_DRAWINGSETS = 5 _PROBABILITY_OF_MOVE = 0.2 ## _NUM_CSDLS_X = 10 # this is now a local variable from a test parameter ## _NUM_CSDLS_Y = 10 _NUM_SPHERES_PER_CSDL = 5 _INVERSE_FREQUENCY_OF_REVISION = 1 # must be an integer; only revise model every nth time; # WARNING: many reported timings predate this (as if it was 1); not settable in UI # == class CSDL_holder(object): """ Represent a CSDL in a particular DrawingSet. (CSDL itself can't be used for this, since a CSDL can be in more than one DrawingSet at a time.) """ drawingset = None def __init__(self, x, y, n): self.csdl = ColorSortedDisplayList() # draw into it, based on x, y, n ColorSorter.start(None, self.csdl) for i in range(n): z = i - (_NUM_SPHERES_PER_CSDL - 1) / 2.0 color = (random.uniform(0.2, 0.8), 0, random.uniform(0.2, 0.8)) pos = (x, y, z) radius = 0.25 # 0.5 would be touching the next ones drawsphere(color, pos, radius, 2 ## DRAWSPHERE_DETAIL_LEVEL ) ColorSorter.finish(draw_now = False) return def change_drawingset(self, drawingset): old = self.drawingset new = drawingset self.drawingset = new if old is not new: if old: old.removeCSDL(self.csdl) #e remove_csdl? if new: new.addCSDL(self.csdl) #e add_csdl? pass return pass class test_selection_redraw(GraphicsTestCase): """ test case for frequent moving of CSDLs between DrawingSets: Exercise graphics similar to selection/deselection, rapid change of highlighting, etc, by moving CSDLs rapidly between several DrawingSets drawn in different styles. If this is too slow per-frame due to setup cost, we can ignore this at first since highlighting can be done differently and selection doesn't change during most frames. But it is still a useful test for correctness, and for speed of selection changes that need to be reasonably responsive even if not occurring on most frames. """ # test results [bruce 090102, usual Mac]: # For my initial parameters of 10 x 10 chunks of 5 spheres, # in 5 drawingsets (one not drawn), changing 20% of styles each time, # I get about 20 msec per frame # (or 44 msec if 'Use batched primitive shaders?' is turned off). # But this is only 500 spheres, far less than realistic. def __init__(self, *params): GraphicsTestCase.__init__(self, *params) ### review: split into __init__ and setup methods? or use activate for the following? _NUM_CSDLS_X = _NUM_CSDLS_Y = self._params[0] # set up a lot of CSDLs, in wrappers that know which DrawingSet they're in (initially None) self._csdls = [ CSDL_holder((i % _NUM_CSDLS_X) - (_NUM_CSDLS_X - 1) / 2.0, ((i / _NUM_CSDLS_X) % _NUM_CSDLS_Y) - (_NUM_CSDLS_Y - 1) / 2.0, _NUM_SPHERES_PER_CSDL) for i in range(_NUM_CSDLS_X * _NUM_CSDLS_Y) ] # set up our two DrawingSets (deselected first) self.drawingsets = [DrawingSet() for i in range(_NUM_DRAWINGSETS)] self.drawingsets[-1] = None # replace the last one with None, for hidden CSDLs # put all the CSDLs in the first one for csdl in self._csdls: csdl.change_drawingset(self.drawingsets[0]) return def activate(self): # make sure the correct two DrawingSets will be drawn pass # implicit in our def of _draw_drawingsets def draw(self): # move some of the CSDLs from one to another DrawingSet # (for now, just put each one into a pseudorandomly chosen DrawingSet, out of all of them) if (env.redraw_counter % _INVERSE_FREQUENCY_OF_REVISION) != 0: return num_sets = len(self.drawingsets) csdls_to_move = self._csdls for csdl in csdls_to_move: if random.random() <= _PROBABILITY_OF_MOVE and num_sets > 1: # move this csdl to a new drawingset (enforced actually different) old = csdl.drawingset # always a DrawingSet (or None, if None is a member of self.drawingsets) new = old while new is old: new = self.drawingsets[ random.randint(0, num_sets - 1) ] csdl.change_drawingset(new) pass continue return def _draw_drawingsets(self): # note: called after .draw for i in range(_NUM_DRAWINGSETS): # choose proper drawing style options = {} # note: default options are: ## options = dict( ## highlighted = False, selected = False, ## patterning = True, highlight_color = None, opacity = 1.0 ) if i == 0: # todo: encapsulate the options with the DrawingSet # plain pass elif i == 1: # selected options = dict( selected = True) elif i == 2: # highlighted options = dict( highlighted = True) elif i == 3: # transparent options = dict( opacity = 0.5 ) else: # default options pass if self.drawingsets[i]: self.drawingsets[i].draw(**options) continue return pass # end
NanoCAD-master
cad/src/commands/TestGraphics/test_selection_redraw.py
# Copyright 2008-2009 Nanorex, Inc. See LICENSE file for details. """ TestGraphics_Command.py -- command to "Test Graphics Performance" (for now, available from the debug menu -> 'other' submenu) @author: Bruce @version: $Id$ @copyright: 2008-2009 Nanorex, Inc. See LICENSE file for details. """ # python library imports import time # for time.time (wall clock time) # NE1 imports from command_support.Command import Command from command_support.GraphicsMode_API import Delegating_GraphicsMode from commands.TestGraphics.TestGraphics_PropertyManager import TestGraphics_PropertyManager from utilities.debug import register_debug_menu_command # module imports, for global flag set/get access import graphics.widgets.GLPane_rendering_methods as GLPane_rendering_methods import prototype.test_drawing as test_drawing from prototype.test_drawing import AVAILABLE_TEST_CASES_ITEMS, test_Draw_model import foundation.env as env from utilities.prefs_constants import hoverHighlightingColor_prefs_key from utilities.prefs_constants import levelOfDetail_prefs_key from geometry.VQT import Q, V # == # globals which can be changed at runtime; only used by TestGraphics_GraphicsMode class test_globals: ALWAYS_GL_UPDATE = True # redraw as often as possible SPIN = True # spin the view on each redraw ... SPINQUAT = Q(V(1,0,0),V(0,0,1))/90.0 # ... by 1 degree per frame printFrames = True # print frames-per-second to console ### REVIEW: TEST_DRAWING too? # other globals frame_count = 0 last_frame_printed = 0 last_time = time.time() # == GraphicsMode part class TestGraphics_GraphicsMode(Delegating_GraphicsMode): """ Graphics mode for TestGraphics command. """ # new feature, bruce 090306: delegate almost everything to # parentGraphicsMode, via our new superclass Delegating_GraphicsMode. if 0: # this can be enabled by individual developers if desired (debug_pref?) # (or just use alt/option key to make left button act like middle) # [bruce 090306 if 0'd this, so delegation can work; didn't test 'if 1'] # The left mouse button is much easier to press and drag than the middle. # Put rotate on Left, pan on LeftShift. [Russ] def leftDown(self, event): self.middleDown(event) def leftDrag(self, event): self.middleDrag(event) def leftUp(self, event): self.middleUp(event) def leftShiftDown(self, event): self.middleShiftDown(event) def leftShiftDrag(self, event): self.middleShiftDrag(event) def leftShiftUp(self, event): self.middleShiftUp(event) # Still want the left-button select functions, bound to the right button. def rightDown(self, event): super(TestGraphics_GraphicsMode, self).leftDown(event) def rightDrag(self, event): super(TestGraphics_GraphicsMode, self).leftDrag(event) def rightUp(self, event): super(TestGraphics_GraphicsMode, self).leftUp(event) # == def gm_start_of_paintGL(self, glpane): """ This is called near the start of every call of glpane.paintGL (but after whatever model updates, etc, are required before redraw), unless the redraw will be skipped for some reason. """ # maybe: if it returns true, skip the rest, including the end call? # maybe: only call it if higher-level skips don't happen? # TODO: store time for single-frame timing (so we know how much of # the frame time implied by printed fps occurs outside of paintGL) if test_globals.SPIN: ## glpane.quat += SPINQUAT # that version has cumulative numerical error, causing an exception every few seconds: ## File "/Nanorex/Working/trunk/cad/src/geometry/VQT.py", line 448, in __iadd__ ## self.normalize() ## File "/Nanorex/Working/trunk/cad/src/geometry/VQT.py", line 527, in normalize ## s = ((1.0 - w**2)**0.5) / length ##ValueError: negative number cannot be raised to a fractional power glpane.quat = glpane.quat + test_globals.SPINQUAT # finally, delegate to parentCommand version self.parentGraphicsMode.gm_start_of_paintGL(glpane) return ## # Use default highlight color. ## def selobj_highlight_color(self, selobj): ## """ ## [GraphicsMode API method] ## """ ## return env.prefs[hoverHighlightingColor_prefs_key] def Draw_model(self): # Redirect Draw_model to test_drawing.py when TEST_DRAWING is set. if GLPane_rendering_methods.TEST_DRAWING: test_Draw_model(self.glpane) else: # delegate to parentCommand version self.parentGraphicsMode.Draw_model() # see also: TemporaryCommand_Overdrawing, # Overdrawing_GraphicsMode_preMixin # (related, but they do nothing besides this that we need here); # see also our superclass Delegating_GraphicsMode return def gm_end_of_paintGL(self, glpane): """ This is called near the end of every call of glpane.paintGL, after all drawing and the glFlush, if gm_start_of_paintGL was called near the start of it. """ # first, delegate to parentCommand version self.parentGraphicsMode.gm_end_of_paintGL(glpane) # then, do our special code # print fps global frame_count, last_frame_printed, last_time # todo: make instance vars? frame_count += 1 now = time.time() if test_globals.printFrames and int(now) > int(last_time): nframes = frame_count - last_frame_printed duration = now - last_time print " %4.1f fps %4.1f msec/frame" % ( nframes / duration, duration * 1000.0 / nframes ) last_frame_printed = frame_count last_time = now pass if test_globals.ALWAYS_GL_UPDATE: glpane.gl_update() return pass # == Command part class TestGraphics_Command(Command): """ """ # class constants GraphicsMode_class = TestGraphics_GraphicsMode PM_class = TestGraphics_PropertyManager commandName = 'TEST_GRAPHICS' featurename = "Test Graphics" from utilities.constants import CL_GLOBAL_PROPERTIES command_level = CL_GLOBAL_PROPERTIES command_should_resume_prevMode = True command_has_its_own_PM = True FlyoutToolbar_class = None # minor bug, when superclass is Build Atoms: the atoms button in the # default flyout remains checked when we enter this command, # probably due to command_enter_misc_actions() not being overridden in # this command. # == def delete_caches(self): test_drawing.delete_caches() # someday: also reset some of our own instance vars return # == # state methods (which mostly don't use self, except for self.glpane.gl_update) # note: these use property rather than State since they are providing access # to externally stored state. This is ok except that it provides no direct # way of usage tracking or change tracking, which means, it's only suitable # when only one external thing at a time wants to provide a UI for displaying # and perhaps changing this state. # bypass_paintgl def _get_bypass_paintgl(self): print "bypass_paintgl starts out as %r" % (GLPane_rendering_methods.TEST_DRAWING,) # return GLPane_rendering_methods.TEST_DRAWING def _set_bypass_paintgl(self, enabled): print "bypass_paintgl = %r" % (enabled,) # GLPane_rendering_methods.TEST_DRAWING = enabled if enabled: # BUG in test_drawing.py as of 081008 # on systems with not enough shader constant memory: # even in a test case that doesn't use shaders, eg testCase 1, # an error in setting up shaders makes the test fail; # trying again gets past this somehow. Print warning about this: print "\n*** advice about a possible bug: if shader error traceback occurs below, disable and reenable to retry ***\n" ### self.glpane.gl_update() bypass_paintgl = property( _get_bypass_paintgl, _set_bypass_paintgl, doc = "bypass paintGL normal code" "(draw specific test cases instead)" ) # redraw_continuously def _get_redraw_continuously(self): return test_globals.ALWAYS_GL_UPDATE def _set_redraw_continuously(self, enabled): test_globals.ALWAYS_GL_UPDATE = enabled self.glpane.gl_update() redraw_continuously = property( _get_redraw_continuously, _set_redraw_continuously, doc = "call paintGL continuously" "(cpu can get hot!)" ) # spin_model def _get_spin_model(self): return test_globals.SPIN def _set_spin_model(self, enabled): test_globals.SPIN = enabled spin_model = property( _get_spin_model, _set_spin_model, doc = "spin model whenever it's redrawn" ) # print_fps def _get_print_fps(self): return test_globals.printFrames def _set_print_fps(self, enabled): test_globals.printFrames = enabled print_fps = property( _get_print_fps, _set_print_fps, doc = "print frames-per-second to console every second" ) # testCaseIndex, testCaseChoicesText def _get_testCaseIndex(self): for testCase, desc in AVAILABLE_TEST_CASES_ITEMS: if test_drawing.testCase == testCase: return AVAILABLE_TEST_CASES_ITEMS.index((testCase, desc)) print "bug in _get_testCaseIndex" return 0 # fallback to first choice def _set_testCaseIndex(self, index): # BUG: doesn't yet work well when done during a test run testCase, desc_unused = AVAILABLE_TEST_CASES_ITEMS[index] test_drawing.testCase = testCase self.delete_caches() self.glpane.gl_update() testCaseIndex = property( _get_testCaseIndex, _set_testCaseIndex, doc = "which testCase to run" ) testCaseChoicesText = [] for testCase, desc in AVAILABLE_TEST_CASES_ITEMS: testCaseChoicesText.append( "%s: %s" % (testCase, desc) ) # fix format # nSpheres def _get_nSpheres(self): return test_drawing.nSpheres def _set_nSpheres(self, value): test_drawing.nSpheres = value self.delete_caches() self.glpane.gl_update() nSpheres = property( _get_nSpheres, _set_nSpheres, doc = "number on a side of a square of spheres" ) _NSPHERES_CHOICES = map(str, [1, 2, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 132, 200, 300, 400, 500, 600]) # detailLevel def _get_detailLevel(self): # note: this might not agree, initially, with env.prefs[levelOfDetail_prefs_key]; # doesn't matter for now, since nothing calls this getter return test_drawing.DRAWSPHERE_DETAIL_LEVEL def _set_detailLevel(self, detailLevel): if detailLevel not in (0, 1, 2, -1): print "bug: illegal detailLevel", detailLevel detailLevel = -1 env.prefs[levelOfDetail_prefs_key] = detailLevel if detailLevel != -1: ### kluges/bugs: # maybe not synced at init; # -1 should be disallowed in combobox when test_drawing is used; # not known for sure how this works in test_drawing -- # maybe it doesn't work for all testCases; conceivably it depends on env.prefs too test_drawing.DRAWSPHERE_DETAIL_LEVEL = detailLevel self.delete_caches() self.glpane.gl_update() # when not bypassing paintGL: # this gl_update is redundant with the prefs change; # the redraw this causes will (as of tonight) always recompute the # correct drawLevel (in Part._recompute_drawLevel), # and chunks will invalidate their display lists as needed to # accomodate the change. [bruce 060215] # otherwise, explicit gl_update iight be needed. return detailLevel = property( _get_detailLevel, _set_detailLevel, doc = "detail level of spheres (when made of triangles)" ) pass # == UI for entering this command def _enter_test_graphics_command(glpane): glpane.assy.w.enterOrExitTemporaryCommand('TEST_GRAPHICS') register_debug_menu_command( "Test Graphics Performance ...", _enter_test_graphics_command ) # or for entering at startup due to debug_pref: def enter_TestGraphics_Command_at_startup(win): """ Meant to be called only from startup_misc.just_before_event_loop(). To cause this to be called then (in current code as of 081006), set the debug_pref "startup in Test Graphics command (next session)?". """ # set properties the way we want them (from globals in test_drawing module). # KLUGE: this has to be done before entering command, so UI in # command.propMgr is set up properly. from prototype import test_drawing cached_command_instance = win.commandSequencer._find_command_instance( 'TEST_GRAPHICS') cached_command_instance.bypass_paintgl = True cached_command_instance.nSpheres = test_drawing.nSpheres win.commandSequencer.userEnterCommand('TEST_GRAPHICS') currentCommand = win.commandSequencer.currentCommand if currentCommand.commandName == 'TEST_GRAPHICS': win.update() # try to make sure new PM becomes visible (BUG: doesn't # work, requires click to make PM show up; don't know why ###) print "\n*** bug workaround: click in GLPane to show Test Graphics PM ***" ### else: print "bug: tried to startup in %r, but currentCommand.commandName == %r" % \ ('TEST_GRAPHICS', currentCommand.commandName) return # end
NanoCAD-master
cad/src/commands/TestGraphics/TestGraphics_Command.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ TestGraphics_PropertyManager.py @author: Bruce @version: $Id$ @copyright: 2008 Nanorex, Inc. See LICENSE file for details. """ import foundation.env as env from PyQt4.Qt import SIGNAL from PM.PM_GroupBox import PM_GroupBox from PM.PM_ComboBox import PM_ComboBox from PM.PM_CheckBox import PM_CheckBox from PM.PM_Constants import PM_DONE_BUTTON from PM.PM_Constants import PM_WHATS_THIS_BUTTON from utilities.prefs_constants import levelOfDetail_prefs_key from command_support.Command_PropertyManager import Command_PropertyManager # == _superclass = Command_PropertyManager class TestGraphics_PropertyManager(Command_PropertyManager): """ The TestGraphics_PropertyManager class provides a Property Manager for the Test Graphics command. @ivar title: The title that appears in the property manager header. @type title: str @ivar pmName: The name of this property manager. This is used to set the name of the PM_Dialog object via setObjectName(). @type name: str @ivar iconPath: The relative path to the PNG file that contains a 22 x 22 icon image that appears in the PM header. @type iconPath: str """ title = "Test Graphics" pmName = title iconPath = None ###k "ui/actions/View/Stereo_View.png" ### FIX - use some generic or default icon def __init__( self, command ): """ Constructor for the property manager. """ _superclass.__init__(self, command) self.showTopRowButtons( PM_DONE_BUTTON | PM_WHATS_THIS_BUTTON) msg = "Test the performance effect of graphics settings below. " \ "(To avoid bugs, choose testCase before bypassing paintGL.)" self.updateMessage(msg) def _addGroupBoxes( self ): """ Add the Property Manager group boxes. """ self._pmGroupBox1 = PM_GroupBox( self, title = "Settings") ### fix title self._loadGroupBox1( self._pmGroupBox1 ) def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box. """ from widgets.prefs_widgets import ObjAttr_StateRef ### toplevel self._cb2 = \ PM_CheckBox(pmGroupBox, text = "redraw continuously", ) self._cb2.connectWithState( ObjAttr_StateRef( self.command, 'redraw_continuously' )) self._cb3 = \ PM_CheckBox(pmGroupBox, text = "spin model", ) self._cb3.connectWithState( ObjAttr_StateRef( self.command, 'spin_model' )) self._cb4 = \ PM_CheckBox(pmGroupBox, text = "print fps to console", ) self._cb4.connectWithState( ObjAttr_StateRef( self.command, 'print_fps' )) self._cb1 = \ PM_CheckBox(pmGroupBox, text = "replace paintGL with testCase", ) self._cb1.connectWithState( ObjAttr_StateRef( self.command, 'bypass_paintgl' )) # note: this state (unlike the highest-quality staterefs) # is not change-tracked [as of 081003], so nothing aside from # user clicks on this checkbox should modify it after this runs, # or our UI state will become out of sync with the state. self.testCase_ComboBox = PM_ComboBox(pmGroupBox, label = "testCase:", labelColumn = 0, choices = self.command.testCaseChoicesText, setAsDefault = False ) self.testCase_ComboBox.setCurrentIndex(self.command.testCaseIndex) self.nSpheres_ComboBox = PM_ComboBox(pmGroupBox, label = "n x n spheres:", labelColumn = 0, choices = self.command._NSPHERES_CHOICES, setAsDefault = False ) nSpheres_index = self.command._NSPHERES_CHOICES.index( str( self.command.nSpheres) ) self.nSpheres_ComboBox.setCurrentIndex( nSpheres_index) self._set_nSpheresIndex( nSpheres_index) self.detail_level_ComboBox = PM_ComboBox(pmGroupBox, label = "Level of detail:", labelColumn = 0, choices = ["Low", "Medium", "High", "Variable"], setAsDefault = False ) lod = env.prefs[levelOfDetail_prefs_key] if lod > 2: lod = 2 if lod < 0: # only lod == -1 is legal here lod = 3 self.detail_level_ComboBox.setCurrentIndex(lod) self.set_level_of_detail_index(lod) self._updateWidgets() ## def updateUI(self): # BUG: this is not being called -- I guess the bypassed paintGL doesn't call it. ## self._updateWidgets() ### will this be too slow? def _addWhatsThisText( self ): """ What's This text for widgets in the Stereo Property Manager. """ pass def _addToolTipText(self): """ Tool Tip text for widgets in the Stereo Property Manager. """ pass def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be overridden in subclasses. By default it does nothing. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect change_connect(self.testCase_ComboBox, SIGNAL("currentIndexChanged(int)"), self.command._set_testCaseIndex ) change_connect(self.nSpheres_ComboBox, SIGNAL("currentIndexChanged(int)"), self._set_nSpheresIndex ) change_connect(self.detail_level_ComboBox, SIGNAL("currentIndexChanged(int)"), # in current code, SIGNAL("activated(int)") self.set_level_of_detail_index ) return # == def _set_nSpheresIndex(self, index): self.command.nSpheres = int( self.command._NSPHERES_CHOICES[index] ) def set_level_of_detail_index(self, level_of_detail_index): # copied from other code, renamed, revised """ Change the level of detail, where <level_of_detail_index> is a value between 0 and 3 where: - 0 = low - 1 = medium - 2 = high - 3 = variable (based on number of atoms in the part) @note: the prefs db value for 'variable' is -1, to allow for higher LOD levels in the future. """ lod = level_of_detail_index if lod == 3: lod = -1 self.command.detailLevel = lod def _updateWidgets(self): """ Update widget configuration based on state of prior widgets. """ ## # presently, the LOD is not noticed by the test cases... oops, not true! ## self.detail_level_ComboBox.setEnabled( not self.command.bypass_paintgl ) return pass # end
NanoCAD-master
cad/src/commands/TestGraphics/TestGraphics_PropertyManager.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ @version: $Id$ @copyright: 2004-2009 Nanorex, Inc. See LICENSE file for details. History: Ninad 2008-01-25: Split modifyMode into Command and GraphicsMode classes and also refactored the GraphicsMode to create individual classes for rotating and translating selected entities (called RotateChunks_GraphicsMode and TranslateChunks_GraphicsMode) """ import math from Numeric import dot from PyQt4.Qt import QMouseEvent from PyQt4.Qt import Qt import foundation.env as env from geometry.VQT import V, Q, A, vlen, norm from commands.SelectChunks.SelectChunks_GraphicsMode import SelectChunks_GraphicsMode from utilities.constants import SUBTRACT_FROM_SELECTION from utilities.constants import ADD_TO_SELECTION from utilities.constants import START_NEW_SELECTION from utilities.constants import DELETE_SELECTION _superclass = SelectChunks_GraphicsMode #Contains common code of both Rotate and Translate GraphicsModes. class Move_GraphicsMode(SelectChunks_GraphicsMode): """ """ # class constants gridColor = 52/255.0, 128/255.0, 26/255.0 # class variables moveOption = 'MOVEDEFAULT' rotateOption = 'ROTATEDEFAULT' axis = 'X' RotationOnly = False TranslationOnly = False isConstrainedDragAlongAxis = False #The following variable stores a string. It is used in leftDrag related #methods to handle cases where the user may do a keypress *while* left #dragging, which would change the move type. This variable is assigned a #string value.See self.leftDownForTranslatation for an example. leftDownType = None def Enter_GraphicsMode(self): """ Things needed while entering the GraphicsMode (e.g. updating cursor, setting some attributes etc). This method is called in self.command.command_entered() @see: B{GraphicsMode.Enter_GraphicsMode} """ _superclass.Enter_GraphicsMode(self) #Initialize the flag for Constrained translation and rotation #along the axis of the chunk to False. This flag is set #to True whenever keyboard key 'A' is pressed #while in Translate/Rotate mode. See methods keyPress, keyRelease, #leftDown, Drag and leftADown, Drag for details. self.isConstrainedDragAlongAxis = False self.dragdist = 0.0 self.clear_leftA_variables() #bruce 070605 precaution self.o.assy.selectChunksWithSelAtoms() def keyPress(self,key): _superclass.keyPress(self, key) # For these key presses, we toggle the Action item, which will send # an event to changeMoveMode, where the business is done. # Mark 050410 # If Key 'A' is pressed, set the flag for Constrained translation and #rotation along the axis of the chunk; otherwise reset that flag # [REVIEW: is that resetting good, for any key at all?? #If so, document why. bruce comment 071012] if key == Qt.Key_A: self.isConstrainedDragAlongAxis = True else: self.isConstrainedDragAlongAxis = False self.update_cursor() def keyRelease(self,key): _superclass.keyRelease(self, key) if key in [Qt.Key_X, Qt.Key_Y, Qt.Key_Z, Qt.Key_A]: self.movingPoint = None # Fixes bugs 583 and 674 along with change ##in leftDrag(). Mark 050623 elif key == Qt.Key_R: self.RotationOnly = False # Unconstrain translation. elif key == Qt.Key_T: self.TranslationOnly = False # Unconstrain rotation. #Set the flag for Constrained translation and rotation #along the axis of the chunk to False self.isConstrainedDragAlongAxis = False self.update_cursor() def update_cursor_for_no_MB(self): """ Update the cursor for 'Move Chunks' mode. Overridden in subclasses. @see: RotateChunks_GraphicsMode.update_cursor_for_no_MB @see: TranslateChunks_GraphicsMode.update_cursor_for_no_MB """ _superclass.update_cursor_for_no_MB(self) def leftDown(self, event): """ Handle left down event. Preparation for dragging and/or selection @param event: The mouse left down event. @type event: QMouseEvent instance @see: self._leftDown_preparation_for_dragging """ #The following variable stores a string. It is used in leftDrag related #methods to handle cases where the user may do a keypress *while* left #dragging, which would change the move type. This variable is assigned a #string value.See self.leftDownForTranslatation for an example. self.leftDownType = None self.clear_leftA_variables() #bruce 070605 added this #(guess at what's needed) env.history.statusbar_msg("") self.reset_drag_vars() self.LMB_press_event = QMouseEvent(event) # Make a copy of this event #and save it. # We will need it later if we change our mind and start selecting a 2D # region in leftDrag().Copying the event in this way is necessary #because Qt will overwrite <event> later (in # leftDrag) if we simply set self.LMB_press_event = event. mark 060220 self.LMB_press_pt_xy = (event.pos().x(), event.pos().y()) # <LMB_press_pt_xy> is the position of the mouse in window coordinates #when the LMB was pressed. #Used in mouse_within_stickiness_limit (called by leftDrag() and other #methods). # We don't bother to vertically flip y using self.height #(as mousepoints does), # since this is only used for drag distance within single drags. # If keyboard key 'A' is pressed OR if the corresponding toolbutton # in the propMgr is pressed, set it up for constrained translation # and rotation along the axis and return. # @TODO: Should reuse the flag self.isConstrainedDragAlongAxis instead # of checking move/ rotate options independently. Better to associate # key 'A' with the appropriate option in the PM. Also, the # propMgr sets the moveOption flags of the graphics mode. PropMgr should # be prevented from using graphicsmode object for clarity. This is # one of the code cleanup and refactoring projects related to this command # (this is one of the things that hasn't completely cleanued up # during refactoring and major cleanup of the old modifyMode class code. # --Ninad 2008-04-09 # Permit movable object picking upon left down. obj = self.get_obj_under_cursor(event) if self.isConstrainedDragAlongAxis or \ self.moveOption == 'ROT_TRANS_ALONG_AXIS' or \ self.rotateOption == 'ROT_TRANS_ALONG_AXIS': self.leftADown(obj, event) return # If highlighting is turned on, get_obj_under_cursor() returns atoms, # singlets, bonds, jigs, # or anything that can be highlighted and end up in glpane.selobj. # [bruce revised this comment, 060725]If highlighting is turned off, # get_obj_under_cursor() returns atoms and singlets (not bonds or jigs). # [not sure if that's still true -- probably not. bruce 060725 addendum] if obj is None: # Cursor over empty space. self.emptySpaceLeftDown(event) return self.doObjectSpecificLeftDown(obj, event) #Subclasses should override one of the following method if they need #to do additional things to prepare for dragging. self._leftDown_preparation_for_dragging(obj, event) self.w.win_update() return def _leftDown_preparation_for_dragging(self, objectUnderMouse, event): """ Subclasses should override this (AND ALSO CALLING THIS method in the overridden method) if they need additional things to be done in self.leftDown, to prepare for left dragging the selection. @see: TranslateChunks_GraphicsMode._leftDown_preparation_for_dragging @see: RotateChunks_GraphicsMode._leftDown_preparation_for_dragging """ self._leftDrag_movables = self.getMovablesForLeftDragging() def leftDrag(self, event): """ Drag the selected object(s): - in the plane of the screen following the mouse, - or slide and rotate along the an axis Overridden in subclasses @param event: The mouse left drag event. @type event: QMouseEvent instance @see: TranslateChunks.leftDrag @see: RotateChunks.leftDrag """ if self.cursor_over_when_LMB_pressed == 'Empty Space': ##self.continue_selection_curve(event) self.emptySpaceLeftDrag(event) return if self.o.modkeys is not None: #@see: comment related to this condition in _superclass.leftDrag self.emptySpaceLeftDown(self.LMB_press_event) return if not self.picking: return if not self._leftDrag_movables: return if self.isConstrainedDragAlongAxis: try: self.leftADrag(event) return except: # this might be obsolete, since leftADrag now tries to handle #this (untested) [bruce 070605 comment] print "Key A pressed after Left Down. controlled "\ "translation will not be performed" # end of leftDrag def leftUp(self, event): """ Overrides leftdrag method of _superclass """ if self.cursor_over_when_LMB_pressed == 'Empty Space': #@@ needed? self.emptySpaceLeftUp(event) elif self.dragdist < 2: _superclass.leftUp(self,event) def EndPick(self, event, selSense): """ Pick if click """ #Don't select anything if the selection is locked. #see self.selection_locked() for more comments. if self.selection_locked(): return if not self.picking: return self.picking = False deltaMouse = V(event.pos().x() - self.o.MousePos[0], self.o.MousePos[1] - event.pos().y(), 0.0) self.dragdist += vlen(deltaMouse) if self.dragdist < 7: # didn't move much, call it a click has_jig_selected = False if self.o.jigSelectionEnabled and self.jigGLSelect(event, selSense): has_jig_selected = True if not has_jig_selected: # Note: this code is similar to def end_selection_curve # in Select_GraphicsMode.py. See comment there # about why it handles jigs separately and # how to clean that up (which mentions findAtomUnderMouse # and jigGLSelect). [bruce 080917 comment] if selSense == SUBTRACT_FROM_SELECTION: self.o.assy.unpick_at_event(event) if selSense == ADD_TO_SELECTION: self.o.assy.pick_at_event(event) if selSense == START_NEW_SELECTION: self.o.assy.onlypick_at_event(event) if selSense == DELETE_SELECTION: self.o.assy.delete_at_event(event) #Call graphics mode API method self.end_selection_from_GLPane() self.w.win_update() def clear_leftA_variables(self): # bruce 070605 #k should it clear sbar too? # Clear variables that only leftADown can set. This needs to be done #for every mousedown and mouseup ###DOIT. # (more precisely for any call of Down that if A is then pressed might #start calling leftADrag ####) # Then, if they're not properly set during leftADrag, it will show a #statusbar error and do nothing. # This should fix bugs caused by 'A' keypress during drag or 'A' #keypress not noticed by NE1 (in wrong widget or app). # [bruce 070605 bugfix; also added all these variables] self._leftADown = False # whether we're doing a leftA-style drag at all self._leftADown_rotateAsUnit = None self._leftADown_movables = None # list of movables for leftADrag # WARNING: some code (rotsel calls) assumes this is also the movable #selected objects self._leftADown_indiv_axes = None self._leftADown_averaged_axis = None self._leftADown_error = False # whether an error should cause subsequent #leftADrags to be noops self._leftADown_dragcounter = 0 self._leftADown_total_dx_dy = V(0.0, 0.0) return def leftAError(self, msg): env.history.statusbar_msg( msg) #bruce 070605 self._leftADown_error = True # prevent more from happening in leftADrag return def leftADown(self, objectUnderMouse, event): """ Set up for sliding and/or rotating the selected chunk(s) along/around its own axis when left mouse and key 'A' is pressed. Overriden in subclasses @see: TranslateChunks_GraphicsMode.leftADown @seE: RotateChunks_GraphicsMode.leftADown """ self._leftADown = True if self.command and \ self.command.propMgr and \ hasattr(self.command.propMgr, 'rotateAsUnitCB'): self._leftADown_rotateAsUnit = self.command.propMgr.rotateAsUnitCB.isChecked() else: self._leftADown_rotateAsUnit = True obj = objectUnderMouse if obj is None: # Cursor over empty space. self.emptySpaceLeftDown(event) #Left A drag is not possible unless the cursor is over a #selected object. So make sure to let self.leftAError method sets #proper flag so that left-A drag won't be done in this case. self.leftAError("") return self.doObjectSpecificLeftDown(obj, event) movables = self.getMovablesForLeftDragging() self._leftADown_movables = movables if not movables: self.leftAError("(nothing movable is selected)") return self.o.SaveMouse(event) #bruce 070605 questions (about code that was here before I did #anything to it today): # - how are self.Zmat, self.picking, self.dragdist used during leftADrag? # - Why is the axis recomputed in each leftADrag? I think that's a bug, #for "rotate as a unit", since it varies! # And it's slow, either way, since it should not vary (once bugs are #fixed) but .getaxis will always have to recompute it. # So I'll change this to compute the axes or axis only once, here in #leftADown, and use it in each leftADrag. # - Why is the "averaged axis" computed here at all, when not "rotate #as a unit"? ma = V(0,0,0) # accumulate "average axis" (only works well if all axes #similar in direction, except perhaps for sign) self._leftADown_indiv_axes = [] #bruce 070605 optim for mol in movables: axis = mol.getaxis() if dot(ma, axis) < 0.0: #bruce 070605 bugfix, in case axis happens #to point the opposite way as ma axis = - axis self._leftADown_indiv_axes.append(axis) # not sure it's best to put #sign-corrected axes here, but I'm guessing it is ma += axis self._leftADown_averaged_axis = norm(ma) #bruce 070605 optim/bugfix if vlen(self._leftADown_averaged_axis) < 0.5: # ma was too small # The pathological case of zero ma is probably possible, #but should be rare; # consequences not reviewed; so statusbar message and refusal #seems safest: self.leftAError("(axes can't be averaged, doing nothing)") return ma = norm(V(dot(ma,self.o.right),dot(ma,self.o.up))) self.Zmat = A([ma,[-ma[1],ma[0]]]) self.picking = True self.dragdist = 0.0 farQ_junk, self.movingPoint = self.dragstart_using_GL_DEPTH( event) # Following is in leftDrag() to compute move offset during drag op. self.startpt = self.movingPoint self._leftADown_total_dx_dy = V(0.0, 0.0) if 0: # looks ok; axis for 3-strand n=10 DNA is reasonably close to #axis of Axis strand [bruce 070605] print "\nleftADown gets",self._leftADown_averaged_axis print self._leftADown_indiv_axes print movables print self.Zmat return # from leftADown def leftADrag(self, event): """ Move selected chunk(s) along its axis (mouse goes up or down) and rotate around its axis (left-right) while left dragging the selection with keyboard key 'A' pressed """ ##See comments of leftDrag()--Huaicai 3/23/05 if not self.picking: return if self._leftADown_error: return if not self._leftADown: self.leftAError("(doing nothing -- 'A' pressed after drag already started)") return movables = self._leftADown_movables assert movables # otherwise error flag was set during leftADown [bruce 070605] self._leftADown_dragcounter += 1 counter = self._leftADown_dragcounter # mainly useful for debugging w = self.o.width + 0.0 h = self.o.height + 0.0 deltaMouse = V(event.pos().x() - self.o.MousePos[0], self.o.MousePos[1] - event.pos().y()) a = dot(self.Zmat, deltaMouse) dx,dy = a * V(self.o.scale/(h*0.5), 2*math.pi/w) self._leftADown_total_dx_dy += V(dx,dy) tot_dx, tot_dy = self._leftADown_total_dx_dy env.history.statusbar_msg("this 'A'-drag: translation: %f; rotation: %f" % (tot_dx, tot_dy)) #bruce 070605; format might need cleanup if not self._leftADown_rotateAsUnit: # move/rotate individually ###UNTESTED since rewrite [bruce 070605] for mol, ma in zip(movables, self._leftADown_indiv_axes): mol.move(dx*ma) mol.rot(Q(ma,-dy)) else: # move/rotate selection as a unit #find out resultant axis, translate and rotate the specified #movables along this axis -- ninad 20070605 # (modified/optimized by bruce 070605) resAxis = self._leftADown_averaged_axis for mol in movables: mol.move(dx*resAxis) self.win.assy.rotateSpecifiedMovables( Q(resAxis,-dy), movables = movables) # this assumes movables are exactly the selected movable objects # (as they are) # [could this be slow, or could something in here have a memory # leak?? (maybe redrawing selected chunks?) # interaction is way too slow, and uneven, and I hear swapping # in the bg. Aha, I bet it's all those Undo checkpoints, which we #should not be collecting during drags at all!! # --bruce 070605 Q] #Implementation change note: the movables are computed only in #self.leftADown or self._leftDown_preparation_for_dragging() #the movables needen't necessarily be the selected objects #see self.getMovablesForLeftDragging() for details. #--Ninad 2008-04-08 self.dragdist += vlen(deltaMouse) #k needed?? [bruce 070605 comment] self.o.SaveMouse(event) self.o.assy.changed() #ninad060924 fixed bug 2278 self.o.gl_update() return def leftShiftUp(self, event): """ Handle Left mouse up event when shift key is pressed. """ if self.cursor_over_when_LMB_pressed == 'Empty Space': self.emptySpaceLeftUp(event) return if self.o.modkeys == 'Shift+Control': self.end_selection_curve(event) return self.EndPick(event, ADD_TO_SELECTION) def leftDouble(self, event): """ Do nothing upon double click , while in move mode (pre Alpha9 - experimental) """ return
NanoCAD-master
cad/src/commands/Move/Move_GraphicsMode.py
NanoCAD-master
cad/src/commands/Move/__init__.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ Move_Command.py The 'Command' part of the Move Mode (Move_Command and Move_GraphicsMode are the two split classes of the old modifyMode) It provides the command object for its GraphicsMode class. The Command class defines anything related to the 'command half' of the mode -- For example: - Anything related to its current Property Manager, its settings or state - The model operations the command does (unless those are so simple that the mouse event bindings in the _GM half can do them directly and the code is still clean, *and* no command-half subclass needs to override them). @version: $Id$ @copyright: 2004-2009 Nanorex, Inc. See LICENSE file for details. History: See Move_GraphicsMode.py TODO as of 2008-09-09: -refactor update ui related code. Example some methods call propMgr.updateMessage() etc. this needs to be in a central place... either in this callls or in PM._update_UI_do_updates() """ import foundation.env as env import math from commands.Move.MovePropertyManager import MovePropertyManager from commands.SelectChunks.SelectChunks_Command import SelectChunks_Command from command_support.GraphicsMode_API import GraphicsMode_interface from geometry.BoundingBox import BBox from utilities.Log import redmsg from geometry.VQT import V, Q from utilities.debug import print_compact_traceback from commands.Translate.TranslateChunks_GraphicsMode import TranslateChunks_GraphicsMode from commands.Rotate.RotateChunks_GraphicsMode import RotateChunks_GraphicsMode from ne1_ui.toolbars.Ui_MoveFlyout import MoveFlyout class Move_Command(SelectChunks_Command): """ """ _pointRequestCommand_pivotPoint = None GraphicsMode_class = TranslateChunks_GraphicsMode #The class constant PM_class defines the class for the Property Manager of #this command. See Command.py for more infor about this class constant PM_class = MovePropertyManager #Flyout Toolbar FlyoutToolbar_class = MoveFlyout commandName = 'MODIFY' featurename = "Move Chunks Mode" from utilities.constants import CL_EDIT_GENERIC command_level = CL_EDIT_GENERIC pw = None command_should_resume_prevMode = False command_has_its_own_PM = True flyoutToolbar = None #START command API methods ============================================= def command_entered(self): """ Overrides superclass method. @see: baseCommand.command_enter_PM() for documentation """ super(Move_Command, self).command_entered() self.propMgr.set_move_xyz(0, 0, 0) # Init X, Y, and Z to zero self.propMgr.set_move_delta_xyz(0,0,0) # Init DelX,DelY, DelZ to zero def command_enter_misc_actions(self): """ Overrides superclass method. @see: baseCommand.command_enter_misc_actions() for documentation """ pass def command_exit_misc_actions(self): """ Overrides superclass method. @see: baseCommand.command_exit_misc_actions() for documentation """ self.w.toolsMoveMoleculeAction.setChecked(False) self.w.rotateComponentsAction.setChecked(False) #END new command API methods ============================================== def _acceptLineModePoints(self, params): #bruce 080801, revises acceptParamsFromTemporaryMode """ Accept returned points from the Line_Command request command. """ ### REVIEW: can this be called with params == None, # and/or never called, if Line_Command is terminated early? # In current code, it must always be called, # and is always called regardless of how Line_Command exits # and probably in the old other case as well). # [bruce 080904 comment] (points,) = params del params #Usually points will contain 2 items. But if user abruptly terminates #the temporary mode, this might not be true. So move the chunk by offset #only when you have got 2 points! Ninad 2007-10-16 if len(points) == 2: startPoint = points[0] endPoint = points[1] offset = endPoint - startPoint movables = self.graphicsMode.getMovablesForLeftDragging() self.assy.translateSpecifiedMovables(offset, movables = movables) self.o.gl_update() self.propMgr.moveFromToButton.setChecked(False) return def _acceptRotateAboutPointResults(self, params): #bruce 080801, revises acceptParamsFromTemporaryMode """ Accept results (empty tuple) from the RotateAboutPoint request command. (This exists in order to perform a side effect, and since callRequestCommand requires a results callback.) """ ### REVIEW: can this be called with params == None # if RotateAboutPoint is terminated early? del params self.propMgr.rotateAboutPointButton.setChecked(False) return def _acceptPointRequestCommand_pivotPoint(self, params): self._pointRequestCommand_pivotPoint = params def EXPERIMENTAL_rotateAboutPointTemporaryCommand(self, isChecked = False): #@ATTENTION: THIS IS NOT USED AS OF NOV 28, 2008 SCHEDULED FOR REMOVAL """ @see: self.moveFromToTemporaryMode """ #@TODO: clean this up. This was written just after Rattlesnake rc2 #for FNANO presentation -- Ninad 2008-04-17 if self.commandSequencer._f_command_stack_is_locked: # This is normal when the command is exiting on its own # and changes the state of its action programmatically. # In this case, redundant exit causes bugs, so skip it. # It might be better to avoid sending the signal when # programmatically changing the action state. # See similar code and comment in ops_view.py. # [bruce 080905] return if isChecked: # invoke the RotateAboutPoint command self.propMgr.rotateStartCoordLineEdit.setEnabled(isChecked) msg = "Click inside the 3D workspace to define two points " \ "of a line. The selection will be rotated about the first point "\ "in the direction specified by that line" self.propMgr.updateMessage(msg) cs = self.commandSequencer # following was revised by bruce 080801 mouseClickLimit = 1 planeAxis = None planePoint = None cs.callRequestCommand( 'Point_RequestCommand', arguments = (mouseClickLimit, planeAxis, planePoint), # number of mouse click points to accept accept_results = self._acceptPointRequestCommand_pivotPoint ) ###Next step: define reference vector ##mouseClickLimit = 1 ##planeAxis = self.glpane.lineOfSight ##planePoint = self._pointRequestCommand_pivotPoint ##print "**** planePoint = ", planePoint ##cs.callRequestCommand( 'Point_RequestCommand', ##arguments = (mouseClickLimit, planeAxis, planePoint), # number of mouse click points to accept ##accept_results = self. _acceptRotateAboutPointResults ##) else: # exit the RotateAboutPoint command currentCommand = self.commandSequencer.currentCommand if currentCommand.commandName == "RotateAboutPoint": currentCommand.command_Cancel() self.propMgr.rotateStartCoordLineEdit.setEnabled(False) self.propMgr.updateMessage() def rotateAboutPointTemporaryCommand(self, isChecked = False): """ @see: self.moveFromToTemporaryMode """ #@TODO: clean this up. This was written just after Rattlesnake rc2 #for FNANO presentation -- Ninad 2008-04-17 if self.commandSequencer._f_command_stack_is_locked: # This is normal when the command is exiting on its own # and changes the state of its action programmatically. # In this case, redundant exit causes bugs, so skip it. # It might be better to avoid sending the signal when # programmatically changing the action state. # See similar code and comment in ops_view.py. # [bruce 080905] return if isChecked: # invoke the RotateAboutPoint command self.propMgr.rotateStartCoordLineEdit.setEnabled(isChecked) msg = "Define 3 points. The <b>1st point</b> is the rotation point "\ "(i.e. the rotation axis perpendicular to the view). "\ "The <b>2nd</b> point is the starting angle. "\ "The <b>3rd</b> point is the ending angle." self.propMgr.updateMessage(msg) # following was revised by bruce 080801 self.commandSequencer.callRequestCommand( 'RotateAboutPoint', arguments = (3,), # number of mouse click points to accept accept_results = self._acceptRotateAboutPointResults ) else: # exit the RotateAboutPoint command currentCommand = self.commandSequencer.currentCommand if currentCommand.commandName == "RotateAboutPoint": currentCommand.command_Cancel() self.propMgr.rotateStartCoordLineEdit.setEnabled(False) self.propMgr.updateMessage() def moveFromToTemporaryMode(self, isChecked = False): """ Move the selected entities by the offset vector specified by the endpoints of a line. To use this feature, click on 'Move From/To button' in the PM and specify the two endpoints from GLPane. The program enters a temporary mode while you do that and then uses the data collected while in temporary mode (i.e. two endpoints) to move the selection. TODO: Note that the endpoints always assume GLPane depth. As of today, the temporary mode API knows nothing about the highlighting. Once it is implemented, we can then specify atom centers etc as reference points. See comments in Line_Command for further details. """ if isChecked: self.propMgr.startCoordLineEdit.setEnabled(isChecked) msg = "Define the offset vector by clicking two points. "\ "The <b>1st</b> point is the 'from' point. "\ "The <b>2nd</b> point is the 'to' point." self.propMgr.updateMessage(msg) # following was revised by bruce 080801 self.commandSequencer.callRequestCommand( 'Line_Command', arguments = (2,), # number of mouse click points to accept accept_results = self._acceptLineModePoints ) else: self.propMgr.startCoordLineEdit.setEnabled(False) self.propMgr.updateMessage() def rotateThetaPlus(self): """ Rotate the selected chunk(s) by theta (plus) """ button = self.propMgr.rotateAroundAxisButtonRow.checkedButton() if button: rotype = str(button.text()) else: env.history.message(redmsg("Rotate By Specified Angle:" "Please press the button "\ "corresponding to the axis of rotation")) return theta = self.propMgr.rotateThetaSpinBox.value() self.rotateTheta( rotype, theta) def rotateThetaMinus(self): """ Rotate the selected chunk(s) by theta (minus) """ button = self.propMgr.rotateAroundAxisButtonRow.checkedButton() if button: rotype = str(button.text()) else: env.history.message(redmsg("Rotate By Specified Angle:"\ " Please press the button "\ "corresponding to the axis of rotation")) return theta = self.propMgr.rotateThetaSpinBox.value() * -1.0 self.rotateTheta( rotype, theta) def rotateTheta(self, rotype, theta): """ Rotate the selected chunk(s) /jig(s) around the specified axis by theta (degrees) """ movables = self.graphicsMode.getMovablesForLeftDragging() if not movables: env.history.message(redmsg("No chunks or movable jigs selected.")) return if rotype == 'ROTATEX': ma = V(1,0,0) # X Axis elif rotype == 'ROTATEY': ma = V(0,1,0) # Y Axis elif rotype == 'ROTATEZ': ma = V(0,0,1) # Z Axis else: print 'modifyMody.rotateTheta: Error. rotype = ', rotype, ', which is undefined.' return # wware 20061214: I don't know where the need arose for this factor of 100, # but it's necessary to get correct angles. #ninad 070322: #Will's above comment was for "dy = 100.0 * (pi / 180.0) * theta # Convert to radians" #I agree with this. In fact if I enter angle of 1 degree, it multiplies it by 100! #May be it was necessary in Qt3 branch. I am modifying this formula #to remove this multiplication factor of 100 as its giving wrong results dy = (math.pi / 180.0) * theta # Convert to radians qrot = Q(ma,dy) # Quat for rotation delta. if self.propMgr.rotateAsUnitCB.isChecked(): # Rotate the selection as a unit. self.assy.rotateSpecifiedMovables(qrot, movables) else: for item in movables: try: item.rot(qrot) except AssertionError: print_compact_traceback("Selected movable doesn't have"\ "rot method?") self.o.gl_update() def transDeltaPlus(self): """ Add X, Y, and Z to the selected chunk(s) current position """ movables = self.graphicsMode.getMovablesForLeftDragging() if not movables: env.history.message(redmsg("No chunks or movable jigs selected.")) return offset = self.propMgr.get_move_delta_xyz() self.assy.translateSpecifiedMovables(offset, movables = movables) self.o.gl_update() def transDeltaMinus(self): """ Subtract X, Y, and Z from the selected chunk(s) current position """ movables = self.graphicsMode.getMovablesForLeftDragging() if not movables: env.history.message(redmsg("No chunks or movable jigs selected.")) return offset = self.propMgr.get_move_delta_xyz(Plus=False) self.assy.translateSpecifiedMovables(offset, movables = movables) self.o.gl_update() def moveAbsolute(self): """ Move selected chunk(s), jig(s) to absolute X, Y, and Z by computing the bbox center of everything as if they were one big chunk, then move everything as a unit. """ movables = self.graphicsMode.getMovablesForLeftDragging() if not movables: env.history.message(redmsg("No chunks or movable jigs selected.")) return ## Compute bbox for selected chunk(s). bbox = BBox() for m in movables: if hasattr(m, "bbox"): # Fixes bug 1990. Mark 060702. bbox.merge(m.bbox) pt1 = bbox.center() # pt1 = center point for bbox of selected chunk(s). pt2 = self.propMgr.get_move_xyz() # pt2 = X, Y, Z values from PM offset = pt2 - pt1 # Compute offset for translating the selection self.assy.translateSpecifiedMovables(offset, movables = movables) # Print history message about what happened. if len(movables) == 1: msg = "[%s] moved to [X: %.2f] [Y: %.2f] [Z: %.2f]" % (movables[0].name, pt2[0], pt2[1], pt2[2]) else: msg = "Selected chunks/jigs moved by offset [X: %.2f] [Y: %.2f] [Z: %.2f]" % (offset[0], offset[1], offset[2]) env.history.message(msg) self.o.gl_update() return def _create_GraphicsMode(self): GM_class = self.GraphicsMode_class assert issubclass(GM_class, GraphicsMode_interface) args = [self] kws = {} self.graphicsMode = GM_class(*args, **kws) self.translate_graphicsMode = TranslateChunks_GraphicsMode(*args, **kws) self.rotate_graphicsMode = RotateChunks_GraphicsMode(*args, **kws) def switchGraphicsModeTo(self, newGraphicsMode = 'TRANSLATE_CHUNKS'): """ Switch graphics mode of self to the one specified by the client. Changing graphics mode while remaining in the same command has certain advantages and it also bypasses some code related to entering a new command. @param newGraphicsMode: specifies the new graphics mode to switch to @type newGraphicsMode: string @see: B{MovePropertyManager.activate_translateGroupBox} """ #TODO: Make this a general API method if need arises - Ninad 2008-01-25 assert newGraphicsMode in ['TRANSLATE_CHUNKS', 'ROTATE_CHUNKS'] if newGraphicsMode == 'TRANSLATE_CHUNKS': if self.graphicsMode is self.translate_graphicsMode: return self.graphicsMode = self.translate_graphicsMode self.graphicsMode.Enter_GraphicsMode() self.glpane.update_after_new_graphicsMode() elif newGraphicsMode == 'ROTATE_CHUNKS': if self.graphicsMode is self.rotate_graphicsMode: return self.graphicsMode = self.rotate_graphicsMode self.graphicsMode.Enter_GraphicsMode() self.glpane.update_after_new_graphicsMode()
NanoCAD-master
cad/src/commands/Move/Move_Command.py
# Copyright 2004-2008 Nanorex, Inc. See LICENSE file for details. """ @author: Ninad @copyright: 2004-2008 Nanorex, Inc. See LICENSE file for details. @version: $Id$ History: ninad 2007-02-07: Created to implement new UI for Move and Rotate chunks mode. ninad 2007-08-20: Code cleanup to use new PM module classes. """ from commands.Move.Ui_MovePropertyManager import Ui_MovePropertyManager from PyQt4.Qt import SIGNAL class MovePropertyManager(Ui_MovePropertyManager): """ The MovePropertyManager class provides a Property Manager for the "Move > Translate / Rotate Components commands. It also serves as a superclass for FusePropertyManager """ def __init__(self, command): #see self.connect_or_disconnect_signals for comment about this flag self.isAlreadyConnected = False self.lastCheckedRotateButton = None self.lastCheckedTranslateButton = None Ui_MovePropertyManager.__init__(self, command) self.updateMessage() def connect_or_disconnect_signals(self, isConnect): """ Connect the slots in Move Property Manager. @see: Move_Command.connect_or_disconnect_signals. """ if isConnect: change_connect = self.w.connect else: change_connect = self.w.disconnect #TODO: This is a temporary fix for a bug. When you invoke a temporary mode #such as Line_Command or PanMode, entering such a temporary mode keeps the #PM from the previous mode open (and theus keeps all its signals #connected) but while exiting that temporary mode and reentering the #previous mode, it atucally reconnects the signal! This gives rise to #lots of bugs. This needs more general fix in Temporary mode API. # -- Ninad 2007-10-29 if isConnect and self.isAlreadyConnected: return self.isAlreadyConnected = isConnect change_connect(self.translateGroupBox.titleButton, SIGNAL("clicked()"), self.activate_translateGroupBox_using_groupButton) change_connect(self.rotateGroupBox.titleButton, SIGNAL("clicked()"), self.activate_rotateGroupBox_using_groupButton) change_connect(self.translateComboBox, SIGNAL("currentIndexChanged(int)"), self.updateTranslateGroupBoxes) change_connect(self.rotateComboBox, SIGNAL("currentIndexChanged(int)"), self.updateRotateGroupBoxes) change_connect( self.freeDragTranslateButtonGroup.buttonGroup, SIGNAL("buttonClicked(QAbstractButton *)"), self.changeMoveOption ) change_connect( self.freeDragRotateButtonGroup.buttonGroup, SIGNAL("buttonClicked(QAbstractButton *)"), self.changeRotateOption ) change_connect(self.transDeltaPlusButton, SIGNAL("clicked()"), self.command.transDeltaPlus) change_connect(self.transDeltaMinusButton, SIGNAL("clicked()"), self.command.transDeltaMinus) change_connect(self.moveAbsoluteButton, SIGNAL("clicked()"), self.command.moveAbsolute) change_connect(self.rotateThetaPlusButton, SIGNAL("clicked()"), self.command.rotateThetaPlus) change_connect(self.rotateThetaMinusButton, SIGNAL("clicked()"), self.command.rotateThetaMinus) change_connect(self.moveFromToButton, SIGNAL("toggled(bool)"), self.command.moveFromToTemporaryMode) change_connect(self.rotateAboutPointButton, SIGNAL("toggled(bool)"), self.command.rotateAboutPointTemporaryCommand) def activate_translateGroupBox_using_groupButton(self): """Show contents of this groupbox, deactivae the other groupbox. Also check the button that was checked when this groupbox was active last time. (if applicable). This method is called only when move groupbox button is clicked. See also activate_translateGroupBox method. """ self.toggle_translateGroupBox() if not self.w.toolsMoveMoleculeAction.isChecked(): self.w.toolsMoveMoleculeAction.setChecked(True) self.command.switchGraphicsModeTo(newGraphicsMode = 'TRANSLATE_CHUNKS') # Update the title and icon. self.setHeaderIcon(self.translateIconPath) self.setHeaderTitle(self.translateTitle) self.deactivate_rotateGroupBox() buttonToCheck = self.getTranslateButtonToCheck() if buttonToCheck: buttonToCheck.setChecked(True) else: transButtonGroup = self.freeDragTranslateButtonGroup buttonToCheck = transButtonGroup.getButtonByText('MOVEDEFAULT') buttonToCheck.setChecked(True) self.changeMoveOption(buttonToCheck) self.command.graphicsMode.update_cursor() self.updateMessage() def activate_rotateGroupBox_using_groupButton(self): """ Show contents of this groupbox, deactivae the other groupbox. Also check the button that was checked when this groupbox was active last time. (if applicable). This method is called only when rotate groupbox button is clicked. See also activate_rotateGroupBox method. """ self.toggle_rotateGroupBox() if not self.w.rotateComponentsAction.isChecked(): self.w.rotateComponentsAction.setChecked(True) self.command.switchGraphicsModeTo(newGraphicsMode = 'ROTATE_CHUNKS') # Update the title and icon. self.setHeaderIcon(self.rotateIconPath) self.setHeaderTitle(self.rotateTitle) self.deactivate_translateGroupBox() #Following implements NFR bug 2485. #Earlier, it used to remember the last checked button #so this wasn't necessary buttonToCheck = self.getRotateButtonToCheck() if buttonToCheck: buttonToCheck.setChecked(True) else: rotButtonGroup = self.freeDragRotateButtonGroup buttonToCheck = rotButtonGroup.getButtonByText('ROTATEDEFAULT') buttonToCheck.setChecked(True) self.changeRotateOption(buttonToCheck) self.command.graphicsMode.update_cursor() self.updateMessage() def activate_translateGroupBox(self): """ Show contents of this groupbox, deactivae the other groupbox. Also check the button that was checked when this groupbox was active last time. (if applicable) This button is called when toolsMoveMoleculeAction is checked from the toolbar or command toolbar. see also: activate_translateGroupBox_using_groupButton """ self.command.switchGraphicsModeTo(newGraphicsMode = 'TRANSLATE_CHUNKS') #Update the icon and the title self.setHeaderIcon(self.translateIconPath) self.setHeaderTitle(self.translateTitle) self.toggle_translateGroupBox() self.deactivate_rotateGroupBox() #Following implements NFR bug 2485. #Earlier, it used to remember the last checked button #so this wasn't necessary buttonToCheck = self.getTranslateButtonToCheck() if buttonToCheck: buttonToCheck.setChecked(True) else: transButtonGroup = self.freeDragTranslateButtonGroup buttonToCheck = transButtonGroup.getButtonByText('MOVEDEFAULT') buttonToCheck.setChecked(True) self.changeMoveOption(buttonToCheck) self.command.graphicsMode.update_cursor() self.updateMessage() def activate_rotateGroupBox(self): """Show contents of this groupbox, deactivae the other groupbox. Also check the button that was checked when this groupbox was active last time. (if applicable). This button is called when rotateComponentsAction is checked from the toolbar or command toolbar. @see: L{self.activate_rotateGroupBox_using_groupButton} """ self.command.switchGraphicsModeTo(newGraphicsMode = 'ROTATE_CHUNKS') #Update the icon and the title. self.setHeaderIcon(self.rotateIconPath) self.setHeaderTitle(self.rotateTitle) self.toggle_rotateGroupBox() self.deactivate_translateGroupBox() buttonToCheck = self.getRotateButtonToCheck() if buttonToCheck: buttonToCheck.setChecked(True) else: rotButtonGroup = self.freeDragRotateButtonGroup buttonToCheck = rotButtonGroup.getButtonByText('ROTATEDEFAULT') buttonToCheck.setChecked(True) self.changeRotateOption(buttonToCheck) self.command.graphicsMode.update_cursor() self.updateMessage() def deactivate_rotateGroupBox(self): """ Hide the items in the groupbox, Also store the current checked button which will be checked again when user activates this groupbox again. After storing the checked button, uncheck it (so that other active groupbox button can operate easily). """ self.rotateGroupBox.collapse() #Store the last checked button of the groupbox you are about to close #(in this case Rotate Groupbox is the groupbox that will be deactivated #and Move groupbox will be activated (opened) ) lastCheckedRotateButton = self.freeDragRotateButtonGroup.checkedButton() self.setLastCheckedRotateButton(lastCheckedRotateButton) #Disconnect checked button in Rotate Components groupbox #bruce 070613 added condition if self.freeDragRotateButtonGroup.checkedButton(): self.freeDragRotateButtonGroup.checkedButton().setChecked(False) def deactivate_translateGroupBox(self): """ Hide the items in the groupbox, Also store the current checked button which will be checked again when user activates this groupbox again. After storing the checked button, uncheck it (so that other active groupbox button can operate easily). """ self.translateGroupBox.collapse() #Store the last checked button of the groupbox you are about to close #(in this case Move Groupbox is the groupbox that will be deactivated # and 'Rotate groupbox will be activated (opened) ) buttonGroup = self.freeDragTranslateButtonGroup lastCheckedTranslateButton = buttonGroup.checkedButton() self.setLastCheckedMoveButton(lastCheckedTranslateButton) #Disconnect checked button in Move groupbox if self.freeDragTranslateButtonGroup.checkedButton(): self.freeDragTranslateButtonGroup.checkedButton().setChecked(False) def toggle_translateGroupBox(self): """ Toggles the item display in the parent groupbox of the button and hides the other groupbox also disconnecting the actions in the other groupbox Example: If user clicks on Move groupbox button, it will toggle the display of the groupbox, connect its actions and Hide the other groupbox i.e. Rotate Components groupbox and also disconnect actions inside it. """ self.translateGroupBox.toggleExpandCollapse() def toggle_rotateGroupBox(self): """ Toggles the item display in the parent groupbox of the button and hides the other groupbox also disconnecting the actions in the other groupbox. Example: If user clicks on Move groupbox button, it will toggle the display of the groupbox, connect its actions and Hide the other groupbox i.e. Rotate Components groupbox and also disconnect actions inside it """ self.rotateGroupBox.toggleExpandCollapse() def setLastCheckedRotateButton(self, lastCheckedButton): """" Sets the 'last checked button value' Program remembers the last checked button in a groupbox (either Translate or rotate (components)) . When that groupbox is displayed, it checks this last button again (see get method) """ self.lastCheckedRotateButton = lastCheckedButton def setLastCheckedMoveButton(self, lastCheckedButton): """" Sets the 'last checked button value' Program remembers the last checked button in a groupbox (either Translate components or rotate components) . When that groupbox is displayed, it checks this last button again (see get method) """ self.lastCheckedTranslateButton = lastCheckedButton def getLastCheckedRotateButton(self): """returns the last checked button in a groupbox.""" if self.lastCheckedRotateButton: return self.lastCheckedRotateButton else: return None def getLastCheckedMoveButton(self): """returns the last checked button in a groupbox.""" if self.lastCheckedTranslateButton: return self.lastCheckedTranslateButton else: return None def getRotateButtonToCheck(self): """ Decide which rotate group box button to check based on the last button that was checked in *translate* groupbox @return <buttonToCheck>:rotate button to be checked when rotate groupbox is active (and when free drag rotate is chosen from the combo box)""" lastMoveButton = self.getLastCheckedMoveButton() rotateButtonToCheck = None if lastMoveButton in \ self.freeDragTranslateButtonGroup.buttonGroup.buttons(): transButtonGroup = self.freeDragTranslateButtonGroup.buttonGroup buttonId = transButtonGroup.id(lastMoveButton) rotButtonGroup = self.freeDragRotateButtonGroup rotateButtonToCheck = rotButtonGroup.getButtonById(buttonId) return rotateButtonToCheck def getTranslateButtonToCheck(self): """ Decide which translate group box button to check based on the last button that was checked in *rotate* groupbox. @return <buttonToCheck>:translate button to be checked when translate grpbx is active (and when free drag translate is chosen from the combo box)""" lastRotateButton = self.getLastCheckedRotateButton() translateButtonToCheck = None if lastRotateButton in \ self.freeDragRotateButtonGroup.buttonGroup.buttons(): rotButtonGroup = self.freeDragRotateButtonGroup.buttonGroup buttonId = rotButtonGroup.id(lastRotateButton) transButtonGroup = self.freeDragTranslateButtonGroup translateButtonToCheck = transButtonGroup.getButtonById(buttonId) return translateButtonToCheck def updateRotationDeltaLabels(self, rotateOption, rotDelta): """ Updates the Rotation Delta labels in the Rotate combobox while rotating the selection around an axis """ if rotateOption == 'ROTATEX': listx = [self.rotateXLabelRow] listyz = [self.rotateYLabelRow, self.rotateZLabelRow] for lbl in listx: lbl.setBold(isBold = True) lbl.show() txt = str(round(rotDelta, 2)) self.deltaThetaX_lbl.setText(txt) for lbl in listyz: lbl.setBold(isBold = False) lbl.show() elif rotateOption == 'ROTATEY': listy = [self.rotateYLabelRow] listxz = [self.rotateXLabelRow, self.rotateZLabelRow] for lbl in listy : lbl.setBold(True) lbl.show() txt = str(round(rotDelta, 2)) self.deltaThetaY_lbl.setText(txt) for lbl in listxz: lbl.setBold(False) lbl.show() elif rotateOption == 'ROTATEZ': listz = [self.rotateZLabelRow] listxy = [ self.rotateXLabelRow, self.rotateYLabelRow] for lbl in listz: lbl.setBold(True) lbl.show() txt = str(round(rotDelta, 2)) self.deltaThetaZ_lbl.setText(txt) for lbl in listxy: lbl.setBold(False) lbl.show() else: print "MovePropertyManager.updateRotationDeltaLabels:\ Error - unknown rotateOption value :", self.rotateOption def toggleRotationDeltaLabels(self, show = False): """ Hide all the rotation delta labels when rotateFreeDragAction is checked """ lst = [self.rotateXLabelRow, self.rotateYLabelRow, self.rotateZLabelRow] if not show: for lbl in lst: lbl.hide() else: for lbl in lst: lbl.show() def changeMoveOption(self, button): """ Change the translate option. @param button: QToolButton that decides the type of translate operation to be set. @type button: QToolButton U{B{QToolButton} <http://doc.trolltech.com/4.2/qtoolbutton.html>} """ buttonText = str(button.text()) assert buttonText in ['TRANSX', 'TRANSY', 'TRANSZ', 'ROT_TRANS_ALONG_AXIS', 'MOVEDEFAULT' ] self.command.graphicsMode.moveOption = buttonText #commandSequencer = self.win.commandSequencer #if commandSequencer.currentCommand.commandName == 'TRANSLATE_CHUNKS': #commandSequencer.currentCommand.graphicsMode.moveOption = buttonText ##self.command.moveOption = buttonText def changeRotateOption(self, button): """ Change the rotate option. @param button: QToolButton that decides the type of rotate operation to be set. @type button: QToolButton U{B{QToolButton} <http://doc.trolltech.com/4.2/qtoolbutton.html>} """ buttonText = str(button.text()) assert buttonText in ['ROTATEX', 'ROTATEY', 'ROTATEZ', 'ROT_TRANS_ALONG_AXIS', 'ROTATEDEFAULT' ] if buttonText in ['ROTATEDEFAULT', 'ROT_TRANS_ALONG_AXIS']: self.toggleRotationDeltaLabels(show = False) else: self.toggleRotationDeltaLabels(show = True) self.command.graphicsMode.rotateOption = buttonText #commandSequencer = self.win.commandSequencer #if commandSequencer.currentCommand.commandName == 'ROTATE_CHUNKS': #commandSequencer.currentCommand.graphicsMode.rotateOption = buttonText ##self.command.rotateOption = buttonText def set_move_xyz(self, x, y, z): """ Set values of X, Y and Z coordinates in the Move Property Manager. @param x: X coordinate of the common center of the selected objects @param y: Y coordinate of the common center of the selected objects @param z: Z coordinate of the common center of the selected objects """ self.moveXSpinBox.setValue(x) self.moveYSpinBox.setValue(y) self.moveZSpinBox.setValue(z) def get_move_xyz(self): """ Returns the xyz coordinate in the Move Property Manager. @return: the coordinate @rtype: tuple (x, y, z) """ x = self.moveXSpinBox.value() y = self.moveYSpinBox.value() z = self.moveZSpinBox.value() return (x, y, z) def set_move_delta_xyz(self, delX, delY, delZ): """ Sets the values for 'move by distance delta' spinboxes These are the values by which the selection will be translated along the specified axes. @param delX: Delta X value @param delY: Delta Y value @param delZ: Delta Z value """ self.moveDeltaXSpinBox.setValue(delX) self.moveDeltaYSpinBox.setValue(delY) self.moveDeltaZSpinBox.setValue(delZ) def get_move_delta_xyz(self, Plus = True): """ Returns the values for 'move by distance delta' spinboxes @param Plus : Boolean that decides the sign of the return values. (True returns positive values) @return : A tuple containing delta X, delta Y and delta Z values """ delX = self.moveDeltaXSpinBox.value() delY = self.moveDeltaYSpinBox.value() delZ = self.moveDeltaZSpinBox.value() if Plus: return (delX, delY, delZ) # Plus else: return (-delX, -delY, -delZ) # Minus def close(self): """ Closes this Property Manager. @see: L{PM_GroupBox.close()} (overrides this method) @Note: Before calling close method of its superclass, it collapses the translate and rotate groupboxes. This is necessary as it calls the activate groupbox method which also toggles the current state of the current groupbox. Earlier, explicitely collapsing groupboxes while closing the PM was not needed as a new PM object was created each time you enter move mode. (and L{Ui_MovePropertyManager} used to call collapse method of these groupboxes to acheive the desired effect. """ self.translateGroupBox.collapse() self.rotateGroupBox.collapse() Ui_MovePropertyManager.close(self) def updateMessage(self, msg = ''): # Mark 2007-06-23 """ Updates the message box with an informative message. """ graphicsModeName = '' #Question: should we define a new attr in Graphicsmode classes #suchs as graphicsModeName ? (or a method that returns the GM name # and which falls backs to graphicsMode.__class__.__name__ if name is # not defined ? -- Ninad 2008-01-25 if hasattr(self.command, 'graphicsMode'): graphicsModeName = self.command.graphicsMode.__class__.__name__ if msg: self.MessageGroupBox.insertHtmlMessage( msg, setAsDefault = True ) return from operations.ops_select import objectSelected if objectSelected(self.o.assy): msg = "" else: msg = "Click on objects to select them. " if graphicsModeName: if graphicsModeName == 'TranslateChunks_GraphicsMode': currentIndex = self.translateComboBox.currentIndex() if currentIndex == 0: msg += "To <b>translate</b> the selection, <b>highlight</b> "\ "any of the selected items and <b>drag</b> while " \ "holding down the <b>LMB</b>. "\ "Translate options are available below." elif currentIndex == 1: msg += "<b>Translate</b> the selection by specified offset, "\ "using the <b>'+Delta'</b> and <b> '-Delta'</b> "\ "buttons." elif currentIndex == 2: msg += "Use the <b>Move Selection</b> button to translate "\ "the selection to the specified absolute XYZ coordinate." else: currentIndex = self.rotateComboBox.currentIndex() if currentIndex == 0: msg += "To <b>rotate</b> the selection, <b>highlight</b> "\ "any of the selected items and <b>drag</b> while " \ "holding down the <b>LMB</b>. "\ "Translate options are available below." elif currentIndex == 1: msg += "<b>Rotate</b> the selection by the specified "\ "angle (around the specified axis) using the "\ " <b>'+Theta'</b> and <b>'-Theta'</b> buttons." self.MessageGroupBox.insertHtmlMessage( msg, setAsDefault = True )
NanoCAD-master
cad/src/commands/Move/MovePropertyManager.py
# Copyright 2004-2008 Nanorex, Inc. See LICENSE file for details. """ Ui_MovePropertyManager.py @author: Ninad @copyright: 2004-2008 Nanorex, Inc. See LICENSE file for details. $Id$ History: ninad 2007-08-20: code cleanup to use new PM module classes. """ from PyQt4.Qt import Qt from PM.PM_GroupBox import PM_GroupBox from PM.PM_DoubleSpinBox import PM_DoubleSpinBox from PM.PM_ComboBox import PM_ComboBox from PM.PM_PushButton import PM_PushButton from PM.PM_CheckBox import PM_CheckBox from PM.PM_ToolButtonRow import PM_ToolButtonRow from PM.PM_ToolButton import PM_ToolButton from PM.PM_LineEdit import PM_LineEdit from PM.PM_LabelRow import PM_LabelRow from PM.PM_CoordinateSpinBoxes import PM_CoordinateSpinBoxes from PM.PM_Constants import PM_DONE_BUTTON from PM.PM_Constants import PM_WHATS_THIS_BUTTON from command_support.Command_PropertyManager import Command_PropertyManager _superclass = Command_PropertyManager class Ui_MovePropertyManager(Command_PropertyManager): # The title that appears in the Property Manager header title = "Move" # The name of this Property Manager. This will be set to # the name of the PM_Dialog object via setObjectName(). pmName = title # The relative path to the PNG file that appears in the header iconPath = "ui/actions/Properties Manager/Translate_Components.png" # The title(s) that appear in the property manager header. # (these are changed depending on the active group box) translateTitle = "Translate" rotateTitle = "Rotate" # The full path to PNG file(s) that appears in the header. translateIconPath = "ui/actions/Properties Manager/Translate_Components.png" rotateIconPath = "ui/actions/Properties Manager/Rotate_Components.png" def __init__(self, command): _superclass.__init__(self, command) self.showTopRowButtons(PM_DONE_BUTTON | PM_WHATS_THIS_BUTTON) def _addGroupBoxes(self): """ Add groupboxes to the Property Manager dialog. """ self.translateGroupBox = PM_GroupBox( self, title = "Translate", connectTitleButton = False) self.translateGroupBox.titleButton.setShortcut('T') self._loadTranslateGroupBox(self.translateGroupBox) self.rotateGroupBox = PM_GroupBox( self, title = "Rotate", connectTitleButton = False) self.rotateGroupBox.titleButton.setShortcut('R') self._loadRotateGroupBox(self.rotateGroupBox) self.translateGroupBox.collapse() self.rotateGroupBox.collapse() # == Begin Translate Group Box ===================== def _loadTranslateGroupBox(self, inPmGroupBox): """ Load widgets in the Translate group box. @param inPmGroupBox: The Translate group box in the PM @type inPmGroupBox: L{PM_GroupBox} """ translateChoices = [ "Free Drag", "By Delta XYZ", "To XYZ Position" ] self.translateComboBox = \ PM_ComboBox( inPmGroupBox, label = '', choices = translateChoices, index = 0, setAsDefault = False, spanWidth = True ) self.freeDragTranslateGroupBox = PM_GroupBox( inPmGroupBox ) self._loadFreeDragTranslateGroupBox(self.freeDragTranslateGroupBox) self.byDeltaGroupBox = PM_GroupBox( inPmGroupBox ) self._loadByDeltaGroupBox(self.byDeltaGroupBox) self.toPositionGroupBox = PM_GroupBox( inPmGroupBox ) self._loadToPositionGroupBox(self.toPositionGroupBox) self.updateTranslateGroupBoxes(0) def _loadFreeDragTranslateGroupBox(self, inPmGroupBox): """ Load widgets in the Free Drag Translate group box, which is present within the Translate groupbox. @param inPmGroupBox: The Free Drag Translate group box in the Translate group box. @type inPmGroupBox: L{PM_GroupBox} """ # Button list to create a toolbutton row. # Format: # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BUTTON_LIST = [ ( "QToolButton", 1, "MOVEDEFAULT", "ui/actions/Properties Manager/Move_Free.png", "", "F", 0), ( "QToolButton", 2, "TRANSX", "ui/actions/Properties Manager/TranslateX.png", "", "X", 1), ( "QToolButton", 3, "TRANSY", "ui/actions/Properties Manager/TranslateY.png", "", "Y", 2), ( "QToolButton", 4, "TRANSZ", "ui/actions/Properties Manager/TranslateZ.png", "", "Z", 3), ( "QToolButton", 5, "ROT_TRANS_ALONG_AXIS", "ui/actions/Properties Manager/translate+rotate-A.png", "", \ "A", 4) ] self.freeDragTranslateButtonGroup = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = BUTTON_LIST, checkedId = 1, setAsDefault = True, ) self.transFreeButton =self.freeDragTranslateButtonGroup.getButtonById(1) self.transXButton = self.freeDragTranslateButtonGroup.getButtonById(2) self.transYButton = self.freeDragTranslateButtonGroup.getButtonById(3) self.transZButton = self.freeDragTranslateButtonGroup.getButtonById(4) self.transAlongAxisButton = \ self.freeDragTranslateButtonGroup.getButtonById(5) self.moveFromToButton = PM_ToolButton( inPmGroupBox, text = "Translate from/to", iconPath = "ui/actions/Properties Manager"\ "/Translate_Components.png", spanWidth = True ) self.moveFromToButton.setCheckable(True) self.moveFromToButton.setAutoRaise(True) self.moveFromToButton.setToolButtonStyle( Qt.ToolButtonTextBesideIcon) self.startCoordLineEdit = PM_LineEdit( inPmGroupBox, label = "ui/actions/Properties Manager"\ "/Move_Start_Point.png", text = "Define 'from' and 'to' points", setAsDefault = False, ) self.startCoordLineEdit.setReadOnly(True) self.startCoordLineEdit.setEnabled(False) def _loadByDeltaGroupBox(self, inPmGroupBox): """ Load widgets in the translate By Delta group box, which is present within the Translate groupbox. @param inPmGroupBox: The Translate By Delta group box in the translate group box. @type inPmGroupBox: L{PM_GroupBox} """ self.moveDeltaXSpinBox = \ PM_DoubleSpinBox( inPmGroupBox, label = "ui/actions/Properties Manager/Delta_X.png", value = 0.0, setAsDefault = True, minimum = -100.0, maximum = 100.0, singleStep = 1.0, decimals = 3, suffix = ' Angstroms', spanWidth = False ) self.moveDeltaYSpinBox = \ PM_DoubleSpinBox( inPmGroupBox, label = "ui/actions/Properties Manager/Delta_Y.png", value = 0.0, setAsDefault = True, minimum = -100.0, maximum = 100.0, singleStep = 1.0, decimals = 3, suffix = ' Angstroms', spanWidth = False ) self.moveDeltaZSpinBox = \ PM_DoubleSpinBox( inPmGroupBox, label = "ui/actions/Properties Manager/Delta_Z.png", value = 0.0, setAsDefault = True, minimum = -100.0, maximum = 100.0, singleStep = 1.0, decimals = 3, suffix = ' Angstroms', spanWidth = False ) DELTA_BUTTONS = [ ("QToolButton",1, "Delta Plus", "ui/actions/Properties Manager/Move_Delta_Plus.png", "", "+", 0 ), ( "QToolButton", 2, "Delta Minus", "ui/actions/Properties Manager/Move_Delta_Minus.png", "", "-", 1 ) ] self.translateDeltaButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = DELTA_BUTTONS, label = 'Translate:', isAutoRaise = True, isCheckable = False ) self.transDeltaPlusButton = \ self.translateDeltaButtonRow.getButtonById(1) self.transDeltaMinusButton = \ self.translateDeltaButtonRow.getButtonById(2) def _loadToPositionGroupBox(self, inPmGroupBox): """ Load widgets in the Translate To a given Position group box, which is present within the Translate groupbox. @param inPmGroupBox: Translate To Position group box in the Translate group box. @type inPmGroupBox: L{PM_GroupBox} """ self.toPositionspinboxes = PM_CoordinateSpinBoxes(inPmGroupBox) self.moveXSpinBox = self.toPositionspinboxes.xSpinBox self.moveYSpinBox = self.toPositionspinboxes.ySpinBox self.moveZSpinBox = self.toPositionspinboxes.zSpinBox self.moveAbsoluteButton = \ PM_PushButton( inPmGroupBox, label = "", text = "Move Selection", spanWidth = True ) # == Begin Rotate Group Box ===================== def _loadRotateGroupBox(self, inPmGroupBox): """ Load widgets in the Rotate group box, @param inPmGroupBox: The Rotate GroupBox in the PM @type inPmGroupBox: L{PM_GroupBox} """ rotateChoices = [ "Free Drag", "By Specified Angle"] self.rotateComboBox = \ PM_ComboBox( inPmGroupBox, label = '', choices = rotateChoices, index = 0, setAsDefault = False, spanWidth = True ) self.rotateAsUnitCB = \ PM_CheckBox( inPmGroupBox, text = 'Rotate as a unit' , widgetColumn = 0, state = Qt.Checked ) self.freeDragRotateGroupBox = PM_GroupBox( inPmGroupBox ) self._loadFreeDragRotateGroupBox(self.freeDragRotateGroupBox) self.bySpecifiedAngleGroupBox = PM_GroupBox( inPmGroupBox ) self._loadBySpecifiedAngleGroupBox(self.bySpecifiedAngleGroupBox) self.updateRotateGroupBoxes(0) def _loadFreeDragRotateGroupBox(self, inPmGroupBox): """ Load widgets in the Free Drag Rotate group box, which is present within the Rotate groupbox. @param inPmGroupBox: The Free Drag Rotate group box in the Rotate group box. @type inPmGroupBox: L{PM_GroupBox} """ # Button list to create a toolbutton row. # Format: # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BUTTON_LIST = [ ( "QToolButton", 1, "ROTATEDEFAULT", "ui/actions/Properties Manager/Rotate_Free.png", "", "F", 0 ), ( "QToolButton", 2, "ROTATEX", "ui/actions/Properties Manager/RotateX.png", "", "X", 1 ), ( "QToolButton", 3, "ROTATEY", "ui/actions/Properties Manager/RotateY.png", "", "Y", 2 ), ( "QToolButton", 4, "ROTATEZ", "ui/actions/Properties Manager/RotateZ.png", "", "Z", 3 ), ( "QToolButton", 5, "ROT_TRANS_ALONG_AXIS", "ui/actions/Properties Manager/translate+rotate-A.png", "", \ "A", 4 ) ] self.freeDragRotateButtonGroup = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = BUTTON_LIST, spanWidth = True, checkedId = 1, setAsDefault = True, ) self.rotateFreeButton = self.freeDragRotateButtonGroup.getButtonById(1) self.rotateXButton = self.freeDragRotateButtonGroup.getButtonById(2) self.rotateYButton = self.freeDragRotateButtonGroup.getButtonById(3) self.rotateZButton = self.freeDragRotateButtonGroup.getButtonById(4) self.rotAlongAxisButton = \ self.freeDragRotateButtonGroup.getButtonById(5) inPmGroupBox.setStyleSheet( self.freeDragRotateButtonGroup._getStyleSheet()) X_ROW_LABELS = [("QLabel", "Delta Theta X:", 0), ("QLabel", "", 1), ("QLabel", "0.00", 2), ("QLabel", "Degrees", 3)] Y_ROW_LABELS = [("QLabel", "Delta Theta Y:", 0), ("QLabel", "", 1), ("QLabel", "0.00", 2), ("QLabel", "Degrees", 3)] Z_ROW_LABELS = [("QLabel", "Delta Theta Z:", 0), ("QLabel", "", 1), ("QLabel", "0.00", 2), ("QLabel", "Degrees", 3)] self.rotateXLabelRow = PM_LabelRow( inPmGroupBox, title = "", labelList = X_ROW_LABELS ) self.deltaThetaX_lbl = self.rotateXLabelRow.labels[2] self.rotateYLabelRow = PM_LabelRow( inPmGroupBox, title = "", labelList = Y_ROW_LABELS ) self.deltaThetaY_lbl = self.rotateYLabelRow.labels[2] self.rotateZLabelRow = PM_LabelRow( inPmGroupBox, title = "", labelList = Z_ROW_LABELS ) self.deltaThetaZ_lbl = self.rotateZLabelRow.labels[2] self.rotateAboutPointButton = PM_ToolButton( inPmGroupBox, text = "Rotate selection about a point", iconPath = "ui/actions/Properties Manager"\ "/Rotate_Components.png", spanWidth = True ) self.rotateAboutPointButton.setCheckable(True) self.rotateAboutPointButton.setAutoRaise(True) self.rotateAboutPointButton.setToolButtonStyle( Qt.ToolButtonTextBesideIcon) self.rotateStartCoordLineEdit = PM_LineEdit( inPmGroupBox, label = "ui/actions/Properties Manager"\ "/Move_Start_Point.png", text = "Define 3 points", setAsDefault = False, ) self.rotateStartCoordLineEdit.setReadOnly(True) self.rotateStartCoordLineEdit.setEnabled(False) def _loadBySpecifiedAngleGroupBox(self, inPmGroupBox): """ Load widgets in the Rotate By Specified Angle group box, which is present within the Rotate groupbox. @param inPmGroupBox: Rotate By Specified Angle group box in the Rotate group box. @type inPmGroupBox: L{PM_GroupBox} """ # Button list to create a toolbutton row. # Format: # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BUTTON_LIST = [ ( "QToolButton", 1, "ROTATEX", "ui/actions/Properties Manager/RotateX.png", "Rotate about X axis", "X", 0 ), ( "QToolButton", 2, "ROTATEY", "ui/actions/Properties Manager/RotateY.png", "Rotate about Y axis", "Y", 1 ), ( "QToolButton", 3, "ROTATEZ", "ui/actions/Properties Manager/RotateZ.png", "Rotate about Z axis","Z", 2 ), ] self.rotateAroundAxisButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = BUTTON_LIST, alignment = 'Right', label = 'Rotate Around:' ) self.rotXaxisButton = \ self.rotateAroundAxisButtonRow.getButtonById(1) self.rotYaxisButton = \ self.rotateAroundAxisButtonRow.getButtonById(2) self.rotZaxisButton = \ self.rotateAroundAxisButtonRow.getButtonById(3) self.rotateThetaSpinBox = \ PM_DoubleSpinBox(inPmGroupBox, label = "Rotate By:", value = 0.0, setAsDefault = True, minimum = 0, maximum = 360.0, singleStep = 1.0, decimals = 2, suffix = ' Degrees') THETA_BUTTONS = [ ( "QToolButton", 1, "Theta Plus", "ui/actions/Properties Manager/Move_Theta_Plus.png", "", "+", 0 ), ( "QToolButton", 2, "Theta Minus", "ui/actions/Properties Manager/Move_Theta_Minus.png", "", "-", 1 ) ] self.rotateThetaButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = THETA_BUTTONS, label = 'Direction:', isAutoRaise = True, isCheckable = False ) self.rotateThetaPlusButton = self.rotateThetaButtonRow.getButtonById(1) self.rotateThetaMinusButton = self.rotateThetaButtonRow.getButtonById(2) # == End Rotate Group Box ===================== # == Slots for Translate group box def _hideAllTranslateGroupBoxes(self): """ Hides all Translate group boxes. """ self.toPositionGroupBox.hide() self.byDeltaGroupBox.hide() self.freeDragTranslateGroupBox.hide() def updateTranslateGroupBoxes(self, id): """ Update the translate group boxes displayed based on the translate option selected. @param id: Integer value corresponding to the combobox item in the Translate group box. @type id: int """ self._hideAllTranslateGroupBoxes() if id is 0: self.freeDragTranslateGroupBox.show() if id is 1: self.byDeltaGroupBox.show() if id is 2: self.toPositionGroupBox.show() self.updateMessage() def changeMoveOption(self, button): """ Subclasses should reimplement this method. @param button: QToolButton that decides the type of translate operation to be set. @type button: QToolButton L{http://doc.trolltech.com/4.2/qtoolbutton.html} @see: B{MovePropertyManager.changeMoveOption} which overrides this method """ pass # == Slots for Rotate group box def updateRotateGroupBoxes(self, id): """ Update the translate group boxes displayed based on the translate option selected. @param id: Integer value corresponding to the combobox item in the Rotate group box. @type id: int """ if id is 0: self.bySpecifiedAngleGroupBox.hide() self.freeDragRotateGroupBox.show() if id is 1: self.freeDragRotateGroupBox.hide() self.bySpecifiedAngleGroupBox.show() self.updateMessage() def changeRotateOption(self, button): """ Subclasses should reimplement this method. @param button: QToolButton that decides the type of rotate operation to be set. @type button: QToolButton L{http://doc.trolltech.com/4.2/qtoolbutton.html} @see: B{MovePropertyManage.changeRotateOption} which overrides this method """ pass def _addWhatsThisText(self): """ What's This text for some of the widgets in this Property Manager. """ from ne1_ui.WhatsThisText_for_PropertyManagers import whatsThis_MovePropertyManager whatsThis_MovePropertyManager(self) def _addToolTipText(self): """ Tool Tip text for widgets in this Property Manager. """ from ne1_ui.ToolTipText_for_PropertyManagers import ToolTip_MovePropertyManager ToolTip_MovePropertyManager(self)
NanoCAD-master
cad/src/commands/Move/Ui_MovePropertyManager.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ LightingScheme_PropertyManager.py The LightingScheme_PropertyManager class provides a Property Manager for controlling light settings and creating favorites. @author: Kyle @version: $Id$ @copyright: 2008 Nanorex, Inc. See LICENSE file for details. """ import os, time, fnmatch import foundation.env as env from utilities.prefs_constants import getDefaultWorkingDirectory from utilities.Log import greenmsg from PyQt4.Qt import SIGNAL from PyQt4.Qt import QFileDialog, QString, QMessageBox from PM.PM_GroupBox import PM_GroupBox from PM.PM_ComboBox import PM_ComboBox from PM.PM_CheckBox import PM_CheckBox from PM.PM_ToolButtonRow import PM_ToolButtonRow from PM.PM_ColorComboBox import PM_ColorComboBox from PM.PM_DoubleSpinBox import PM_DoubleSpinBox from PM.PM_Constants import PM_DONE_BUTTON from PM.PM_Constants import PM_WHATS_THIS_BUTTON from utilities.debug import print_compact_traceback from utilities.prefs_constants import material_specular_highlights_prefs_key from utilities.prefs_constants import material_specular_shininess_prefs_key from utilities.prefs_constants import material_specular_brightness_prefs_key from utilities.prefs_constants import material_specular_finish_prefs_key from utilities.prefs_constants import light1Color_prefs_key from utilities.prefs_constants import light2Color_prefs_key from utilities.prefs_constants import light3Color_prefs_key from utilities.prefs_constants import glpane_lights_prefs_key import foundation.preferences as preferences lightingSchemePrefsList = \ [light1Color_prefs_key, light2Color_prefs_key, light3Color_prefs_key, material_specular_highlights_prefs_key, material_specular_finish_prefs_key, material_specular_shininess_prefs_key, material_specular_brightness_prefs_key ] # = # Lighting Scheme Favorite File I/O functions. def writeLightingSchemeToFavoritesFile( basename ): """ Writes a "favorite file" (with a .txt extension) to store all the lighting scheme settings (pref keys and their current values). @param base: The filename (without the .txt extension) to write. @type basename: string @note: The favorite file is written to the directory $HOME/Nanorex/Favorites/LightingScheme. """ if not basename: return 0, "No name given." # Get filename and write the favorite file. favfilepath = getFavoritePathFromBasename(basename) writeLightingSchemeFavoriteFile(favfilepath) # msg = "Problem writing file [%s]" % favfilepath return 1, basename def getFavoritePathFromBasename( basename ): """ Returns the full path to the favorite file given a basename. @param basename: The favorite filename (without the .txt extension). @type basename: string @note: The (default) directory for all favorite files is $HOME/Nanorex/Favorites/LightingScheme. """ _ext = "txt" # Make favorite filename (i.e. ~/Nanorex/Favorites/LightingScheme/basename.txt) from platform_dependent.PlatformDependent import find_or_make_Nanorex_subdir _dir = find_or_make_Nanorex_subdir('Favorites/LightingScheme') return os.path.join(_dir, "%s.%s" % (basename, _ext)) def getFavoriteTempFilename(): """ Returns the full path to the single Lighting Scheme favorite temporary file. @note: The fullpath returned is $HOME/Nanorex/temp/LightingSchemeTempfile.txt. """ _basename = "LightingSchemeTempfile" _ext = "txt" # Make favorite filename (i.e. ~/Nanorex/Favorites/LightingScheme/basename.txt) from platform_dependent.PlatformDependent import find_or_make_Nanorex_subdir _dir = find_or_make_Nanorex_subdir('temp') return os.path.join(_dir, "%s.%s" % (_basename, _ext)) def getLights(): """ return lighting values from the standard preferences database, if possible; if correct values were loaded, start using them, and do gl_update unless option for that is False; return True if you loaded new values, False if that failed """ # code below copied from GLPane.loadLighting() try: prefs = preferences.prefs_context() key = glpane_lights_prefs_key try: val = prefs[key] except KeyError: # none were saved; not an error and not even worthy of a message # since this is called on startup and it's common for nothing to be saved. # Return with no changes. return False # At this point, you have a saved prefs val, and if this is wrong it's an error. # val format is described (partly implicitly) in saveLighting method. res = [] # will become new argument to pass to self.setLighting method, if we succeed for name in ['light0','light1','light2']: params = val[name] # a dict of ambient, diffuse, specular, x, y, z, enabled color = params['color'] # light color (r,g,b) a = params['ambient_intensity'] # ambient intensity d = params['diffuse_intensity'] # diffuse intensity s = params['specular_intensity'] # specular intensity x = params['xpos'] # X position y = params['ypos'] # Y position z = params['zpos'] # Z position e = params['enabled'] # boolean res.append( (color,a,d,s,x,y,z,e) ) return True, res except: print_compact_traceback("bug: exception in getLights: ") #e redmsg? return False, res pass def writeLightingSchemeFavoriteFile( filename ): """ Writes a favorite file to I{filename}. """ f = open(filename, 'w') # Write header f.write ('!\n! Lighting Scheme favorite file') f.write ('\n!Created by NanoEngineer-1 on ') timestr = "%s\n!\n" % time.strftime("%Y-%m-%d at %H:%M:%S") f.write(timestr) # get the current three lights ok, lights = getLights() if not ok: print "error getting lights" return # write lights to the favorites file for (i, light) in zip(range(3),lights): name = "light%d" % i print name, light f.write("%s = %s\n" % (name, light)) #write preference list in file without the NE version for pref_key in lightingSchemePrefsList: val = env.prefs[pref_key] pref_keyArray = pref_key.split("/") pref_key = pref_keyArray[1] if isinstance(val, int): f.write("%s = %d\n" % (pref_key, val)) #tuples written as string for now elif isinstance(val, tuple): f.write("%s = %s\n" % (pref_key, val)) elif isinstance(val, str): f.write("%s = %s\n" % (pref_key, val)) elif isinstance(val, bool): f.write("%s = %d\n" % (pref_key, val)) elif isinstance(val, float): f.write("%s = %f\n" % (pref_key, val)) else: print "Not sure what pref_key '%s' is." % pref_key f.close() def loadFavoriteFile( filename ): """ Loads a favorite file from anywhere in the disk. @param filename: The full path for the favorite file. @type filename: string """ if os.path.exists(filename): favoriteFile = open(filename, 'r') else: env.history.message("Favorite file to be loaded does not exist.") return 0 # do syntax checking on the file to figure out whether this is a valid # favorite file line = favoriteFile.readline() line = favoriteFile.readline() if line != "! Lighting Scheme favorite file\n": env.history.message(" Not a proper favorite file") favoriteFile.close() return 0 while 1: line = favoriteFile.readline() # marks the end of file if line == "": break # process each line to obtain pref_keys and their corresponding values if line[0] != '!': keyValuePair = line.split('=') pref_keyString = keyValuePair[0].strip() pref_value=keyValuePair[1].strip() try: if light1Color_prefs_key.endswith(pref_keyString): pref_valueToStore = tuple(map(float, pref_value[1:-1].split(','))) elif light2Color_prefs_key.endswith(pref_keyString): pref_valueToStore = tuple(map(float, pref_value[1:-1].split(','))) elif light3Color_prefs_key.endswith(pref_keyString): pref_valueToStore = tuple(map(float, pref_value[1:-1].split(','))) elif material_specular_highlights_prefs_key.endswith(pref_keyString): pref_valueToStore = int(pref_value) elif material_specular_finish_prefs_key.endswith(pref_keyString): pref_valueToStore = float(pref_value) elif material_specular_shininess_prefs_key.endswith(pref_keyString): pref_valueToStore = float(pref_value) elif material_specular_brightness_prefs_key.endswith(pref_keyString): pref_valueToStore = float(pref_value) else: print "Not sure what pref_key '%s' is." % pref_keyString continue except: msg = "\npref_key = '%s'\nvalue = %s" \ % (pref_keyString, pref_value) print_compact_traceback(msg) pref_key = findPrefKey( pref_keyString ) #add preference key and its corresponding value to the dictionary if pref_key: env.prefs[pref_key] = pref_valueToStore favoriteFile.close() #check if a copy of this file exists in the favorites directory. If not make # a copy of it in there favName = os.path.basename(str(filename)) name = favName[0:len(favName)-4] favfilepath = getFavoritePathFromBasename(name) if not os.path.exists(favfilepath): saveFavoriteFile(favfilepath, filename) return 1 def findPrefKey( pref_keyString ): """ Matches prefence key in the lightingSchemePrefsList with pref_keyString from the favorte file that we intend to load. @param pref_keyString: preference from the favorite file to be loaded. @type pref_keyString: string @note: very inefficient since worst case time taken is proportional to the size of the list. If original preference strings are in a dictionary, access can be done in constant time """ for keys in lightingSchemePrefsList: #split keys in lightingSchemePrefsList into version number and pref_key pref_array= keys.split("/") if pref_array[1] == pref_keyString: return keys return None def saveFavoriteFile( savePath, fromPath ): """ Save favorite file to anywhere in the disk @param savePath: full path for the location where the favorite file is to be saved. @type savePath: string @param fromPath: ~/Nanorex/Favorites/LightingScheme/$FAV_NAME.txt @type fromPath: string """ fromPath = getFavoriteTempFilename() writeLightingSchemeFavoriteFile(fromPath) if savePath: saveFile = open(savePath, 'w') if fromPath: fromFile = open(fromPath, 'r') lines=fromFile.readlines() saveFile.writelines(lines) saveFile.close() fromFile.close() return # = from command_support.Command_PropertyManager import Command_PropertyManager _superclass = Command_PropertyManager class LightingScheme_PropertyManager(Command_PropertyManager): """ The LightingScheme_PropertyManager class provides a Property Manager for changing light properties as well as material properties. @ivar title: The title that appears in the property manager header. @type title: str @ivar pmName: The name of this property manager. This is used to set the name of the PM_Dialog object via setObjectName(). @type name: str @ivar iconPath: The relative path to the PNG file that contains a 22 x 22 icon image that appears in the PM header. @type iconPath: str """ title = "Lighting Scheme" pmName = title iconPath = "ui/actions/View/LightingScheme.png" def __init__( self, command ): """ Constructor for the property manager. """ _superclass.__init__(self, command) self.showTopRowButtons( PM_DONE_BUTTON | \ PM_WHATS_THIS_BUTTON) msg = "Edit the lighting scheme for NE1. Includes turning lights on and off, "\ "changing light colors, changing the position of lights as well as,"\ "changing the ambient, diffuse, and specular properites." self.updateMessage(msg) def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. This can be overridden in subclasses. By default it does nothing. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean """ if isConnect: change_connect = self.win.connect else: change_connect = self.win.disconnect # Favorite buttons signal-slot connections. change_connect( self.applyFavoriteButton, SIGNAL("clicked()"), self.applyFavorite) change_connect( self.addFavoriteButton, SIGNAL("clicked()"), self.addFavorite) change_connect( self.deleteFavoriteButton, SIGNAL("clicked()"), self.deleteFavorite) change_connect( self.saveFavoriteButton, SIGNAL("clicked()"), self.saveFavorite) change_connect( self.loadFavoriteButton, SIGNAL("clicked()"), self.loadFavorite) # Directional Lighting Properties change_connect(self.ambientDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) change_connect(self.lightColorComboBox, SIGNAL("editingFinished()"), self.changeLightColor) change_connect(self.enableLightCheckBox, SIGNAL("toggled(bool)"), self.toggle_light) change_connect(self.lightComboBox, SIGNAL("activated(int)"), self.change_active_light) change_connect(self.diffuseDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) change_connect(self.specularDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) change_connect(self.xDoubleSpinBox, SIGNAL("editingFinished()"), self.save_lighting) change_connect(self.yDoubleSpinBox, SIGNAL("editingFinished()"), self.save_lighting) change_connect(self.zDoubleSpinBox, SIGNAL("editingFinished()"), self.save_lighting) # Material Specular Properties change_connect(self.brightnessDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_material_brightness) change_connect(self.finishDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_material_finish) change_connect(self.enableMaterialPropertiesComboBox, SIGNAL("toggled(bool)"), self.toggle_material_specularity) change_connect(self.shininessDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_material_shininess) self._setup_material_group() return def _updatePage_Lighting(self, lights = None): #mark 051124 """ Setup widgets to initial (default or defined) values on the Lighting page. """ if not lights: self.lights = self.original_lights = self.win.glpane.getLighting() else: self.lights = lights light_num = self.lightComboBox.currentIndex() # Move lc_prefs_keys upstairs. Mark. lc_prefs_keys = [light1Color_prefs_key, light2Color_prefs_key, light3Color_prefs_key] self.current_light_key = lc_prefs_keys[light_num] # Get prefs key for current light color. self.lightColorComboBox.setColor(env.prefs[self.current_light_key]) self.light_color = env.prefs[self.current_light_key] # These sliders generate signals whenever their 'setValue()' slot is called (below). # This creates problems (bugs) for us, so we disconnect them temporarily. self.disconnect(self.ambientDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) self.disconnect(self.diffuseDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) self.disconnect(self.specularDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) # self.lights[light_num][0] contains 'color' attribute. # We already have it (self.light_color) from the prefs key (above). a = self.lights[light_num][1] # ambient intensity d = self.lights[light_num][2] # diffuse intensity s = self.lights[light_num][3] # specular intensity g = self.lights[light_num][4] # xpos h = self.lights[light_num][5] # ypos k = self.lights[light_num][6] # zpos self.ambientDoubleSpinBox.setValue(a)# generates signal self.diffuseDoubleSpinBox.setValue(d) # generates signal self.specularDoubleSpinBox.setValue(s) # generates signal self.xDoubleSpinBox.setValue(g) # generates signal self.yDoubleSpinBox.setValue(h) # generates signal self.zDoubleSpinBox.setValue(k) # generates signal self.enableLightCheckBox.setChecked(self.lights[light_num][7]) # Reconnect the slots to the light sliders. self.connect(self.ambientDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) self.connect(self.diffuseDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) self.connect(self.specularDoubleSpinBox, SIGNAL("valueChanged(double)"), self.change_lighting) self.update_light_combobox_items() self.save_lighting() self._setup_material_group() return def _setup_material_group(self, reset = False): """ Setup Material Specularity widgets to initial (default or defined) values on the Lighting page. If reset = False, widgets are reset from the prefs db. If reset = True, widgets are reset from their previous values. """ if reset: self.material_specularity = self.original_material_specularity self.whiteness = self.original_whiteness self.shininess = self.original_shininess self.brightness = self.original_brightness else: self.material_specularity = self.original_material_specularity = \ env.prefs[material_specular_highlights_prefs_key] self.whiteness = self.original_whiteness = \ env.prefs[material_specular_finish_prefs_key] self.shininess = self.original_shininess = \ env.prefs[material_specular_shininess_prefs_key] self.brightness = self.original_brightness= \ env.prefs[material_specular_brightness_prefs_key] # Enable/disable material specularity properites. self.enableMaterialPropertiesComboBox.setChecked(self.material_specularity) # For whiteness, the stored range is 0.0 (Plastic) to 1.0 (Metal). self.finishDoubleSpinBox.setValue(self.whiteness) # generates signal # For shininess, the range is 15 (low) to 60 (high). Mark. 051129. self.shininessDoubleSpinBox.setValue(self.shininess) # generates signal # For brightness, the range is 0.0 (low) to 1.0 (high). Mark. 051203. self.brightnessDoubleSpinBox.setValue(self.brightness) # generates signal return def toggle_material_specularity(self, val): """ This is the slot for the Material Specularity Enabled checkbox. """ env.prefs[material_specular_highlights_prefs_key] = val def change_material_finish(self, finish): """ This is the slot for the Material Finish spin box. 'finish' is between 0.0 and 1.0. Saves finish parameter to pref db. """ # For whiteness, the stored range is 0.0 (Metal) to 1.0 (Plastic). env.prefs[material_specular_finish_prefs_key] = finish def change_material_shininess(self, shininess): """ This is the slot for the Material Shininess spin box. 'shininess' is between 15 (low) and 60 (high). """ env.prefs[material_specular_shininess_prefs_key] = shininess def change_material_brightness(self, brightness): """ This is the slot for the Material Brightness sping box. 'brightness' is between 0.0 (low) and 1.0 (high). """ env.prefs[material_specular_brightness_prefs_key] = brightness def toggle_light(self, on): """ Slot for light 'On' checkbox. It updates the current item in the light combobox with '(On)' or '(Off)' label. """ if on: txt = "%d (On)" % (self.lightComboBox.currentIndex()+1) else: txt = "%d (Off)" % (self.lightComboBox.currentIndex()+1) self.lightComboBox.setItemText(self.lightComboBox.currentIndex(),txt) self.save_lighting() def change_lighting(self, specularityValueJunk = None): """ Updates win.glpane lighting using the current lighting parameters from the light checkboxes and sliders. This is also the slot for the light spin boxes. @param specularityValueJunk: This value from the spin box is not used We are interested in valueChanged signal only @type specularityValueJunk = int or None """ light_num = self.lightComboBox.currentIndex() light1, light2, light3 = self.win.glpane.getLighting() a = self.ambientDoubleSpinBox.value() d = self.diffuseDoubleSpinBox.value() s = self.specularDoubleSpinBox.value() g = self.xDoubleSpinBox.value() h = self.yDoubleSpinBox.value() k = self.zDoubleSpinBox.value() new_light = [ self.light_color, a, d, s, g, h, k,\ self.enableLightCheckBox.isChecked()] # This is a kludge. I'm certain there is a more elegant way. Mark 051204. if light_num == 0: self.win.glpane.setLighting([new_light, light2, light3]) elif light_num == 1: self.win.glpane.setLighting([light1, new_light, light3]) elif light_num == 2: self.win.glpane.setLighting([light1, light2, new_light]) else: print "Unsupported light # ", light_num,". No lighting change made." def change_active_light(self, currentIndexJunk = None): """ Slot for the Light number combobox. This changes the current light. @param currentIndexJunk: This index value from the combobox is not used We are interested in 'activated' signal only @type currentIndexJunk = int or None """ self._updatePage_Lighting() def reset_lighting(self): """ Slot for Reset button. """ # This has issues. # I intend to remove the Reset button for A7. Confirm with Bruce. Mark 051204. self._setup_material_group(reset = True) self._updatePage_Lighting(self.original_lights) self.win.glpane.saveLighting() def save_lighting(self): """ Saves lighting parameters (but not material specularity parameters) to pref db. This is also the slot for light sliders (only when released). """ self.change_lighting() self.win.glpane.saveLighting() def restore_default_lighting(self): """ Slot for Restore Defaults button. """ self.win.glpane.restoreDefaultLighting() # Restore defaults for the Material Specularity properties env.prefs.restore_defaults([ material_specular_highlights_prefs_key, material_specular_shininess_prefs_key, material_specular_finish_prefs_key, material_specular_brightness_prefs_key, #bruce 051203 bugfix ]) self._updatePage_Lighting() self.save_lighting() def show(self): """ Shows the Property Manager. extends superclass method. """ _superclass.show(self) self._updateAllWidgets() def _addGroupBoxes( self ): """ Add the Property Manager group boxes. """ self._pmGroupBox1 = PM_GroupBox( self, title = "Favorites") self._loadGroupBox1( self._pmGroupBox1 ) self._pmGroupBox2 = PM_GroupBox( self, title = "Directional Lights") self._loadGroupBox2( self._pmGroupBox2 ) self._pmGroupBox3 = PM_GroupBox( self, title = "Material Properties") self._loadGroupBox3( self._pmGroupBox3 ) def _loadGroupBox1(self, pmGroupBox): """ Load widgets in group box. """ favoriteChoices = ['Factory default settings'] #look for all the favorite files in the favorite folder and add them to # the list from platform_dependent.PlatformDependent import find_or_make_Nanorex_subdir _dir = find_or_make_Nanorex_subdir('Favorites/LightingScheme') for file in os.listdir(_dir): fullname = os.path.join( _dir, file) if os.path.isfile(fullname): if fnmatch.fnmatch( file, "*.txt"): # leave the extension out favoriteChoices.append(file[0:len(file)-4]) self.favoritesComboBox = \ PM_ComboBox( pmGroupBox, choices = favoriteChoices, spanWidth = True) # PM_ToolButtonRow =============== # Button list to create a toolbutton row. # Format: # - QToolButton, buttonId, buttonText, # - iconPath, # - tooltip, shortcut, column BUTTON_LIST = [ ( "QToolButton", 1, "APPLY_FAVORITE", "ui/actions/Properties Manager/ApplyLightingSchemeFavorite.png", "Apply Favorite", "", 0), ( "QToolButton", 2, "ADD_FAVORITE", "ui/actions/Properties Manager/AddFavorite.png", "Add Favorite", "", 1), ( "QToolButton", 3, "DELETE_FAVORITE", "ui/actions/Properties Manager/DeleteFavorite.png", "Delete Favorite", "", 2), ( "QToolButton", 4, "SAVE_FAVORITE", "ui/actions/Properties Manager/SaveFavorite.png", "Save Favorite", "", 3), ( "QToolButton", 5, "LOAD_FAVORITE", "ui/actions/Properties Manager/LoadFavorite.png", "Load Favorite", \ "", 4) ] self.favsButtonGroup = \ PM_ToolButtonRow( pmGroupBox, title = "", buttonList = BUTTON_LIST, spanWidth = True, isAutoRaise = False, isCheckable = False, setAsDefault = True, ) self.favsButtonGroup.buttonGroup.setExclusive(False) self.applyFavoriteButton = self.favsButtonGroup.getButtonById(1) self.addFavoriteButton = self.favsButtonGroup.getButtonById(2) self.deleteFavoriteButton = self.favsButtonGroup.getButtonById(3) self.saveFavoriteButton = self.favsButtonGroup.getButtonById(4) self.loadFavoriteButton = self.favsButtonGroup.getButtonById(5) def _loadGroupBox2(self, pmGroupBox): """ Load widgets in group box. """ self.lightComboBox = \ PM_ComboBox( pmGroupBox, choices = ["1", "2", "3"], label = "Light:") self.enableLightCheckBox = \ PM_CheckBox( pmGroupBox, text = "On" ) self.lightColorComboBox = \ PM_ColorComboBox(pmGroupBox) self.ambientDoubleSpinBox = \ PM_DoubleSpinBox(pmGroupBox, maximum = 1.0, minimum = 0.0, decimals = 2, singleStep = .1, label = "Ambient:") self.diffuseDoubleSpinBox = \ PM_DoubleSpinBox(pmGroupBox, maximum = 1.0, minimum = 0.0, decimals = 2, singleStep = .1, label = "Diffuse:") self.specularDoubleSpinBox = \ PM_DoubleSpinBox(pmGroupBox, maximum = 1.0, minimum = 0.0, decimals = 2, singleStep = .1, label = "Specular:") self.positionGroupBox = \ PM_GroupBox( pmGroupBox, title = "Position:") self.xDoubleSpinBox = \ PM_DoubleSpinBox(self.positionGroupBox, maximum = 1000, minimum = -1000, decimals = 1, singleStep = 10, label = "X:") self.yDoubleSpinBox = \ PM_DoubleSpinBox(self.positionGroupBox, maximum = 1000, minimum = -1000, decimals = 1, singleStep = 10, label = "Y:") self.zDoubleSpinBox = \ PM_DoubleSpinBox(self.positionGroupBox, maximum = 1000, minimum = -1000, decimals = 1, singleStep = 10, label = "Z:") return def _loadGroupBox3(self, pmGroupBox): """ Load widgets in group box. """ self.enableMaterialPropertiesComboBox = \ PM_CheckBox( pmGroupBox, text = "On") self.finishDoubleSpinBox = \ PM_DoubleSpinBox(pmGroupBox, maximum = 1.0, minimum = 0.0, decimals = 2, singleStep = .1, label = "Finish:") self.shininessDoubleSpinBox = \ PM_DoubleSpinBox(pmGroupBox, maximum = 60, minimum = 15, decimals = 2, label = "Shininess:") self.brightnessDoubleSpinBox = \ PM_DoubleSpinBox(pmGroupBox, maximum = 1.0, minimum = 0.0, decimals = 2, singleStep = .1, label = "Brightness:") return def _updateAllWidgets(self): """ Update all the PM widgets. This is typically called after applying a favorite. """ self._updatePage_Lighting() return def update_light_combobox_items(self): """ Updates all light combobox items with '(On)' or '(Off)' label. """ for i in range(3): if self.lights[i][7]: txt = "%d (On)" % (i+1) else: txt = "%d (Off)" % (i+1) self.lightComboBox.setItemText(i, txt) return def changeLightColor(self): """ Slot method for the ColorComboBox """ color = self.lightColorComboBox.getColor() env.prefs[self.current_light_key] = color self.light_color = env.prefs[self.current_light_key] self.save_lighting() return def applyFavorite(self): """ Apply the lighting scheme settings stored in the current favorite (selected in the combobox) to the current lighting scheme settings. """ # Rules and other info: # The user has to press the button related to this method when he loads # a previously saved favorite file current_favorite = self.favoritesComboBox.currentText() if current_favorite == 'Factory default settings': #env.prefs.restore_defaults(lightingSchemePrefsList) self.restore_default_lighting() else: favfilepath = getFavoritePathFromBasename(current_favorite) loadFavoriteFile(favfilepath) self._updateAllWidgets() self.win.glpane.gl_update() return def addFavorite(self): """ Adds a new favorite to the user's list of favorites. """ # Rules and other info: # - The new favorite is defined by the current lighting scheme # settings. # - The user is prompted to type in a name for the new # favorite. # - The lighting scheme settings are written to a file in a special # directory on the disk # (i.e. $HOME/Nanorex/Favorites/LightingScheme/$FAV_NAME.txt). # - The name of the new favorite is added to the list of favorites in # the combobox, which becomes the current option. # Existence of a favorite with the same name is checked in the above # mentioned location and if a duplicate exists, then the user can either # overwrite and provide a new name. # Prompt user for a favorite name to add. from widgets.simple_dialogs import grab_text_line_using_dialog ok1, name = \ grab_text_line_using_dialog( title = "Add new favorite", label = "favorite name:", iconPath = "ui/actions/Properties Manager/AddFavorite.png", default = "" ) if ok1: # check for duplicate files in the # $HOME/Nanorex/Favorites/LightingScheme/ directory fname = getFavoritePathFromBasename( name ) if os.path.exists(fname): #favorite file already exists! _ext= ".txt" ret = QMessageBox.warning( self, "Warning!", "The favorite file \"" + name + _ext + "\"already exists.\n" "Do you want to overwrite the existing file?", "&Overwrite", "&Cancel", "", 0, # Enter == button 0 1) # Escape == button 1 if ret == 0: #overwrite favorite file ok2, text = writeLightingSchemeToFavoritesFile(name) indexOfDuplicateItem = self.favoritesComboBox.findText(name) self.favoritesComboBox.removeItem(indexOfDuplicateItem) print "Add Favorite: removed duplicate favorite item." else: env.history.message("Add Favorite: cancelled overwriting favorite item.") return else: ok2, text = writeLightingSchemeToFavoritesFile(name) else: # User cancelled. return if ok2: self.favoritesComboBox.addItem(name) _lastItem = self.favoritesComboBox.count() self.favoritesComboBox.setCurrentIndex(_lastItem - 1) msg = "New favorite [%s] added." % (text) else: msg = "Can't add favorite [%s]: %s" % (name, text) # text is reason why not env.history.message(msg) return def deleteFavorite(self): """ Deletes the current favorite from the user's personal list of favorites (and from disk, only in the favorites folder though). @note: Cannot delete "Factory default settings". """ currentIndex = self.favoritesComboBox.currentIndex() currentText = self.favoritesComboBox.currentText() if currentIndex == 0: msg = "Cannot delete '%s'." % currentText else: self.favoritesComboBox.removeItem(currentIndex) # delete file from the disk deleteFile= getFavoritePathFromBasename( currentText ) os.remove(deleteFile) msg = "Deleted favorite named [%s].\n" \ "and the favorite file [%s.txt]." \ % (currentText, currentText) env.history.message(msg) return def saveFavorite(self): """ Writes the current favorite (selected in the combobox) to a file, any where in the disk that can be given to another NE1 user (i.e. as an email attachment). """ cmd = greenmsg("Save Favorite File: ") env.history.message(greenmsg("Save Favorite File:")) current_favorite = self.favoritesComboBox.currentText() favfilepath = getFavoritePathFromBasename(current_favorite) formats = \ "Favorite (*.txt);;"\ "All Files (*.*)" fn = QFileDialog.getSaveFileName( self, "Save Favorite As", # caption favfilepath, #where to save formats, # file format options QString("Favorite (*.txt)") # selectedFilter ) if not fn: env.history.message(cmd + "Cancelled") else: saveFavoriteFile(str(fn), favfilepath) return def loadFavorite(self): """ Prompts the user to choose a "favorite file" (i.e. *.txt) from disk to be added to the personal favorites list. """ # If the file already exists in the favorites folder then the user is # given the option of overwriting it or renaming it env.history.message(greenmsg("Load Favorite File:")) formats = \ "Favorite (*.txt);;"\ "All Files (*.*)" directory= getDefaultWorkingDirectory() fname = QFileDialog.getOpenFileName(self, "Choose a file to load", directory, formats) if not fname: env.history.message("User cancelled loading file.") return else: canLoadFile=loadFavoriteFile(fname) if canLoadFile == 1: #get just the name of the file for loading into the combobox favName = os.path.basename(str(fname)) name = favName[0:len(favName)-4] indexOfDuplicateItem = self.favoritesComboBox.findText(name) #duplicate exists in combobox if indexOfDuplicateItem != -1: ret = QMessageBox.warning( self, "Warning!", "The favorite file \"" + name + "\"already exists.\n" "Do you want to overwrite the existing file?", "&Overwrite", "&Rename", "&Cancel", 0, # Enter == button 0 1 # button 1 ) if ret == 0: self.favoritesComboBox.removeItem(indexOfDuplicateItem) self.favoritesComboBox.addItem(name) _lastItem = self.favoritesComboBox.count() self.favoritesComboBox.setCurrentIndex(_lastItem - 1) ok2, text = writeLightingSchemeToFavoritesFile(name) msg = "Overwrote favorite [%s]." % (text) env.history.message(msg) elif ret == 1: # add new item to favorites folder as well as combobox self.addFavorite() else: #reset the display setting values to factory default factoryIndex = self.favoritesComboBox.findText( 'Factory default settings') self.favoritesComboBox.setCurrentIndex(factoryIndex) env.prefs.restore_defaults(lightingSchemePrefsList) self.win.glpane.gl_update() env.history.message("Cancelled overwriting favorite file.") return else: self.favoritesComboBox.addItem(name) _lastItem = self.favoritesComboBox.count() self.favoritesComboBox.setCurrentIndex(_lastItem - 1) msg = "Loaded favorite [%s]." % (name) env.history.message(msg) self.win.glpane.gl_update() return def _addWhatsThisText( self ): """ What's This text for widgets in the Lighting Scheme Property Manager. """ from ne1_ui.WhatsThisText_for_PropertyManagers import WhatsThis_LightingScheme_PropertyManager WhatsThis_LightingScheme_PropertyManager(self) return def _addToolTipText(self): """ Tool Tip text for widgets in the Lighting Scheme Property Manager. """ #modify this for lighting schemes from ne1_ui.ToolTipText_for_PropertyManagers import ToolTip_LightingScheme_PropertyManager ToolTip_LightingScheme_PropertyManager(self) return
NanoCAD-master
cad/src/commands/LightingScheme/LightingScheme_PropertyManager.py
# 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 commands.LightingScheme.LightingScheme_PropertyManager import LightingScheme_PropertyManager # == GraphicsMode part _superclass_for_GM = SelectChunks_GraphicsMode class LightingScheme_GraphicsMode( SelectChunks_GraphicsMode ): """ Graphics mode for (DNA) Display Style command. """ pass # == Command part class LightingScheme_Command(EditCommand): """ """ # class constants #@TODO: may be it should inherit Select_Command. Check. commandName = 'LIGHTING_SCHEME' featurename = "Lighting Scheme" from utilities.constants import CL_GLOBAL_PROPERTIES command_level = CL_GLOBAL_PROPERTIES GraphicsMode_class = LightingScheme_GraphicsMode PM_class = LightingScheme_PropertyManager command_should_resume_prevMode = True command_has_its_own_PM = True
NanoCAD-master
cad/src/commands/LightingScheme/LightingScheme_Command.py
NanoCAD-master
cad/src/commands/LightingScheme/__init__.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ @version: $Id$ @copyright: 2004-2009 Nanorex, Inc. See LICENSE file for details. History: Ninad 2008-01-25: Split the former 'modifyMode ' into Commmand and GraphicsMode classes and also refactored the GraphicsMode to create indiviudal classes for rotating and translating selected entities. (called RotateChunks_GraphicsMode and TranslateChunks_GraphicsMode) TODO: [as of 2008-01-25] The class RotateChunks_GraphicsMode may be renamed to something like Rotate_GraphicsMode or RotateComponents_GraphicsMode. The former name conflicts with the 'RotateMode'. """ from utilities import debug_flags import math from Numeric import dot, sign import foundation.env as env from utilities.Log import redmsg from utilities.debug import print_compact_stack from utilities.debug import print_compact_traceback from geometry.VQT import V, Q, A, vlen, norm from commands.Move.Move_GraphicsMode import Move_GraphicsMode _superclass = Move_GraphicsMode class RotateChunks_GraphicsMode(Move_GraphicsMode): """ Provides Graphics Mode forrotating objects such as chunks. """ def update_cursor_for_no_MB(self): """ Update the cursor for 'Rotate Chunks' Graphics mode """ if self.o.modkeys is None: if self.isConstrainedDragAlongAxis: self.o.setCursor(self.w.AxisTranslateRotateSelectionCursor) else: self.o.setCursor(self.w.RotateSelectionCursor) elif self.o.modkeys == 'Shift': self.o.setCursor(self.w.RotateSelectionAddCursor) elif self.o.modkeys == 'Control': self.o.setCursor(self.w.RotateSelectionSubtractCursor) elif self.o.modkeys == 'Shift+Control': self.o.setCursor(self.w.DeleteCursor) else: print "Error in update_cursor_for_no_MB(): Invalid modkey=", self.o.modkeys return def _leftDown_preparation_for_dragging(self, objectUnderMouse, event): """ Handle left down event. Preparation for rotation and/or selection This method is called inside of self.leftDown. @param event: The mouse left down event. @type event: QMouseEvent instance @see: self.leftDown @see: self.leftDragRotation Overrides _superclass._leftDown_preparation_for_dragging """ _superclass._leftDown_preparation_for_dragging(self, objectUnderMouse, event) self.o.SaveMouse(event) self.picking = True self.dragdist = 0.0 # delta for constrained rotations. self.rotDelta = 0 if self.rotateOption == 'ROTATEDEFAULT': self.o.trackball.start(self.o.MousePos[0],self.o.MousePos[1]) else: if self.rotateOption == 'ROTATEX': ma = V(1,0,0) # X Axis self.axis = 'X' elif self.rotateOption == 'ROTATEY': ma = V(0,1,0) # Y Axis self.axis = 'Y' elif self.rotateOption == 'ROTATEZ': ma = V(0,0,1) # Z Axis self.axis = 'Z' elif self.rotateOption == 'ROT_TRANS_ALONG_AXIS': #The method 'self._leftDown_preparation_for_dragging should #never be reached if self.rotateOption is 'ROT_TRANS_ALONG_AXIS' #If this code is reached, it indicates a bug. So fail gracefully #by calling self.leftADown() if debug_flags.atom_debug: print_compact_stack("bug: _leftDown_preparation_for_dragging"\ " called for rotate option"\ "'ROT_TRANS_ALONG_AXIS'") self.leftADown(objectUnderMouse, event) return else: print "Move_Command: Error - unknown rotateOption value =", \ self.rotateOption return ma = norm(V(dot(ma,self.o.right),dot(ma,self.o.up))) # When in the front view, right = 1,0,0 and up = 0,1,0, so ma will # be computed as 0,0.This creates a special case problem when the # user wants to constrain rotation around the Z axis because Zmat # will be zero. So we have to test for this case (ma = 0,0) and # fix ma to -1,0. This was needed to fix bug 537. Mark 050420 if ma[0] == 0.0 and ma[1] == 0.0: ma = [-1.0, 0.0] self.Zmat = A([ma,[-ma[1],ma[0]]]) self.leftDownType = 'ROTATE' return def leftDrag(self, event): """ Rotate the selected object(s): - in the plane of the screen following the mouse, - or slide and rotate along the an axis @param event: The mouse left drag event. @type event: QMouseEvent instance """ _superclass.leftDrag(self, event) if self.cursor_over_when_LMB_pressed == 'Empty Space': #The _superclass.leftDrag considers this condition. #So simply return and don't go further. Fixes bug 2607 return if self.leftDownType in ['ROTATE', 'A_ROTATE']: try: self.leftDragRotation(event) return except: msg1 = "Controlled rotation not allowed. " msg2 = "Key must be pressed before starting the drag" env.history.statusbar_msg(msg1 + msg2) if debug_flags.atom_debug: msg3 = "Error occured in Move_Command.leftDragRotation." msg4 = "Possibly due to a key press that activated. " msg5 = "Translate groupbox. Aborting drag operation" print_compact_traceback(msg3 + msg4 + msg5) def leftDragRotation(self, event): """ Rotate the selected object(s) or slide and rotate along the an axis @param event: The mouse left drag event. @type event: QMouseEvent object @see: self.leftDrag """ if self.command and self.command.propMgr and \ hasattr(self.command.propMgr, 'rotateComboBox'): if self.command.propMgr.rotateComboBox.currentText() != "Free Drag": return if self.rotateOption == 'ROTATEDEFAULT': self.leftDragFreeRotation(event) return if self.rotateOption == 'ROT_TRANS_ALONG_AXIS': try: self.leftADrag(event) except: print_compact_traceback(" error doing leftADrag") return #Rotate section w=self.o.width+0.0 h=self.o.height+0.0 deltaMouse = V(event.pos().x() - self.o.MousePos[0], self.o.MousePos[1] - event.pos().y()) a = dot(self.Zmat, deltaMouse) dx,dy = a * V(self.o.scale/(h*0.5), 2*math.pi/w) if self.rotateOption == 'ROTATEX': ma = V(1,0,0) # X Axis elif self.rotateOption == 'ROTATEY': ma = V(0,1,0) # Y Axis elif self.rotateOption == 'ROTATEZ': ma = V(0,0,1) # Z Axis else: print "rotateChunks_GraphicsMode.leftDrag Error: unknown rotateOption value:",\ self.rotateOption return qrot = Q(ma,-dy) # Quat for rotation delta. # Increment rotation delta (and convert to degrees) self.rotDelta += qrot.angle *180.0/math.pi * sign(dy) if self.command and self.command.propMgr and \ hasattr(self.command.propMgr, 'updateRotationDeltaLabels'): self.command.propMgr.updateRotationDeltaLabels(self.rotateOption, self.rotDelta) self.win.assy.rotateSpecifiedMovables(qrot, movables = self._leftDrag_movables) # Print status bar msg indicating the current rotation delta. if self.o.assy.selmols: msg = "%s delta: [0 Angstroms] [%.2f Degrees]" % (self.axis, self.rotDelta) env.history.statusbar_msg(msg) # common finished code self.dragdist += vlen(deltaMouse) self.o.SaveMouse(event) self.o.gl_update() #End of Rotate Section return def leftDragFreeRotation(self, event): """ Does an incremental trackball action (free drag rotation)on all selected movables. @param event: The mouse left drag event. @type event: QMouseEvent instance @see: self.leftDragRotation """ selectedMovables = self._leftDrag_movables if not selectedMovables: # This should never happen (i.e. the method self._leftDragFreeRotation # should be called only when movable entities are selected) # This is just a safety check. env.history.message(redmsg("No chunks or movable jigs selected.")) return #Note: In Alpha 9.1 and before, this operation was done by leftCntlDrag #Now, leftCntlDrag is used for 'subtract from selection' which is #consistent with the default mode (selectMols mode)- ninad 20070802 w = self.o.width + 0.0 h = self.o.height + 0.0 deltaMouse = V(event.pos().x() - self.o.MousePos[0], self.o.MousePos[1] - event.pos().y(), 0.0) self.dragdist += vlen(deltaMouse) self.o.SaveMouse(event) q = self.o.trackball.update(self.o.MousePos[0],self.o.MousePos[1], self.o.quat) if self.command and self.command.propMgr and \ hasattr(self.command.propMgr, 'rotateComboBox'): if self.command.propMgr.rotateAsUnitCB.isChecked(): self.win.assy.rotateSpecifiedMovables(q, movables = self._leftDrag_movables) # Rotate the selection as a unit. else: #Following fixes bug 2521 for item in selectedMovables: try: item.rot(q) except AssertionError: print_compact_traceback("Selected movable doesn't have"\ "rot method?") self.o.gl_update() return #By default always rotate the selection as a unit (this code will #never be reached if the command's propMgr has a 'rotateAsaUnit' #checkbox ) self.win.assy.rotateSpecifiedMovables(q, movables = self._leftDrag_movables) self.o.gl_update() def leftADown(self, objectUnderMouse, event): """ Set up for sliding and/or rotating the selected chunk(s) along/around its own axis when left mouse and key 'A' is pressed. Overrides _sperclass.leftADown @see: Move_GraphicsMode.leftADown """ _superclass.leftADown(self, objectUnderMouse, event) self.leftDownType = 'A_ROTATE'
NanoCAD-master
cad/src/commands/Rotate/RotateChunks_GraphicsMode.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ RotateChunks_Command.py @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version: $Id$ History: Created while splitting class modifyMode into Command and GraphicsMode. NOTE: As of 2008-01-25, this command is not yet used, however its graphics mode class (RotateChunks_GraphicsMode) is used as an alternative graphics mode in Move_Command. """ from commands.Move.Move_Command import Move_Command from commands.Rotate.RotateChunks_GraphicsMode import RotateChunks_GraphicsMode _superclass = Move_Command class RotateChunks_Command(Move_Command): commandName = 'ROTATE_CHUNKS' featurename = "Rotate Chunks" from utilities.constants import CL_EDIT_GENERIC command_level = CL_EDIT_GENERIC command_should_resume_prevMode = True command_has_its_own_PM = False GraphicsMode_class = RotateChunks_GraphicsMode def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean As of 2008-01-25, this method does nothing. """ pass
NanoCAD-master
cad/src/commands/Rotate/RotateChunks_Command.py
NanoCAD-master
cad/src/commands/Rotate/__init__.py
# Copyright 2004-2008 Nanorex, Inc. See LICENSE file for details. """ SelectAtoms_Command.py The 'Command' part of the SelectAtoms Mode (SelectAtoms_basicCommand and SelectAtoms_basicGraphicsMode are the two split classes of the old selectAtomsMode) It provides the command object for its GraphicsMode class. The Command class defines anything related to the 'command half' of the mode -- For example: - Anything related to its current Property Manager, its settings or state - The model operations the command does (unless those are so simple that the mouse event bindings in the _GM half can do them directly and the code is still clean, *and* no command-half subclass needs to override them). @version: $Id$ @copyright: 2004-2008 Nanorex, Inc. See LICENSE file for details. TODO: - Items mentioned in Select_GraphicsMode.py - Other items listed in Select_Command.py History: Ninad & Bruce 2007-12-13: Created new Command and GraphicsMode classes from the old class selectAtomsMode and moved the Command related methods into this class from selectAtomsMode.py """ from utilities import debug_flags from utilities.debug import print_compact_traceback from utilities.debug import reload_once_per_event from commands.Select.Select_Command import Select_Command from commands.SelectAtoms.SelectAtoms_GraphicsMode import SelectAtoms_GraphicsMode _superclass = Select_Command class SelectAtoms_Command(Select_Command): """ SelectAtoms_basicCommand The 'Command' part of the SelectAtoms Mode (SelectAtoms_basicCommand and SelectAtoms_basicGraphicsMode are the two split classes of the old selectAtomsMode) It provides the command object for its GraphicsMode class. The Command class defines anything related to the 'command half' of the mode -- For example: - Anything related to its current Property Manager, its settings or state - The model operations the command does (unless those are so simple that the mouse event bindings in the _GM half can do them directly and the code is still clean, *and* no command-half subclass needs to override them). """ GraphicsMode_class = SelectAtoms_GraphicsMode commandName = 'SELECTATOMS' featurename = "Select Atoms Mode" from utilities.constants import CL_ABSTRACT command_level = CL_ABSTRACT #?? # Don't highlight singlets in SelectAtoms_Command. Fixes bug 1540.mark 060220. highlight_singlets = False call_makeMenus_for_each_event = True def makeMenus(self): selatom, selobj = self.graphicsMode.update_selatom_and_selobj(None) self.Menu_spec = [] # Local minimize [now called Adjust Atoms in history/Undo, #Adjust <what> here and in selectMode -- mark & bruce 060705] # WARNING: This code is duplicated in depositMode.makeMenus(). #--mark 060314. if selatom is not None and \ not selatom.is_singlet() and \ self.w.simSetupAction.isEnabled(): # see comments in depositMode version self.Menu_spec.append(( "Adjust atom %s" % selatom, lambda e1 = None, a = selatom: self.localmin(a, 0) )) self.Menu_spec.append(( "Adjust 1 layer", lambda e1 = None, a = selatom: self.localmin(a, 1) )) self.Menu_spec.append(( "Adjust 2 layers", lambda e1 = None, a = selatom: self.localmin(a, 2) )) # selobj-specific menu items. [revised by bruce 060405; #for more info see the same code in depositMode] if selobj is not None and hasattr(selobj, 'make_selobj_cmenu_items'): try: selobj.make_selobj_cmenu_items(self.Menu_spec) except: print_compact_traceback("bug: exception (ignored) in " "make_selobj_cmenu_items " "for %r: " % selobj) # separator and other mode menu items. if self.Menu_spec: self.Menu_spec.append(None) # Enable/Disable Jig Selection. # This is duplicated in depositMode.makeMenus() and # SelectChunks_Command.makeMenus(). if self.o.jigSelectionEnabled: self.Menu_spec.extend( [("Enable Jig Selection", self.graphicsMode.toggleJigSelection, 'checked')]) else: self.Menu_spec.extend( [("Enable Jig Selection", self.graphicsMode.toggleJigSelection, 'unchecked')]) self.Menu_spec.extend( [ # mark 060303. added the following: None, ("Edit Color Scheme...", self.w.colorSchemeCommand), ]) return # from makeMenus # Local minimize [now called Adjust Atoms in history/Undo, Adjust <what> #in menu commands -- mark & bruce 060705] def localmin(self, atom, nlayers): #bruce 051207 #e might generalize to #take a list or pair of atoms, other #options if debug_flags.atom_debug: print "debug: reloading sim_commandruns on each use, for development"\ "[localmin %s, %d]" % (atom, nlayers) import simulation.sim_commandruns as sim_commandruns reload_once_per_event(sim_commandruns) #bruce 060705 revised this if 1: # this does not work, #I don't know why, should fix sometime: [bruce 060705] self.set_cmdname("Adjust Atoms") # for Undo (should we be more #specific, like the menu text was? #why didn't that get used?) from simulation.sim_commandruns import LocalMinimize_function # should not be toplevel LocalMinimize_function( [atom], nlayers ) return def drag_selected_atom(self, a, delta, computeBaggage = False): """ Delegates this to self's GraphicsMode @param computeBaggage: If this is true, the baggage and non-baggage of the atom to be dragged will be computed in this method before dragging the atom. Otherwise it assumes that the baggage and non-baggage atoms are up-to-date and are computed elsewhere , for example in 'atomSetUp' See a comment in the method that illustrates an example use. @type recompueBaggage: boolean @see: SelectAtoms_GraphicsMode.drag_selected_atom() """ self.graphicsMode.drag_selected_atom(a, delta, computeBaggage = computeBaggage)
NanoCAD-master
cad/src/commands/SelectAtoms/SelectAtoms_Command.py
NanoCAD-master
cad/src/commands/SelectAtoms/__init__.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ SelectAtoms_GraphicsMode.py The GraphicsMode part of the SelectAtoms_Command. It provides the graphicsMode object for its Command class. The GraphicsMode class defines anything related to the *3D Graphics Area* -- For example: - Anything related to graphics (Draw method), - Mouse events - Cursors, - Key bindings or context menu @version: $Id$ @copyright: 2004-2009 Nanorex, Inc. See LICENSE file for details. TODO: - Items mentioned in Select_GraphicsMode.py - Other items listed in Select_Command.py History: Ninad & Bruce 2007-12-13: Created new Command and GraphicsMode classes from the old class selectAtomsMode and moved the GraphicsMode related methods into this class from selectAtomsMode.py """ from analysis.ESP.ESPImage import ESPImage from PyQt4.Qt import QMouseEvent import foundation.env as env from foundation.state_utils import transclose from utilities import debug_flags from geometry.VQT import V, Q, norm, vlen, ptonline from model.chem import Atom from model.jigs import Jig from model.bonds import Bond from model.elements import Singlet from utilities.debug import print_compact_traceback, print_compact_stack from foundation.Group import Group from commands.Select.Select_GraphicsMode import DRAG_STICKINESS_LIMIT from utilities.debug_prefs import debug_pref, Choice_boolean_True, Choice_boolean_False from utilities.prefs_constants import bondHighlightColor_prefs_key from utilities.prefs_constants import bondpointHighlightColor_prefs_key from utilities.prefs_constants import atomHighlightColor_prefs_key from utilities.prefs_constants import deleteBondHighlightColor_prefs_key from utilities.prefs_constants import deleteAtomHighlightColor_prefs_key from utilities.prefs_constants import reshapeAtomsSelection_prefs_key from utilities.constants import average_value from utilities.Log import orangemsg from commands.Select.Select_GraphicsMode import Select_basicGraphicsMode _superclass = Select_basicGraphicsMode class SelectAtoms_basicGraphicsMode(Select_basicGraphicsMode): """ The GraphicsMode part of the SelectAtoms_Command. It provides the graphicsMode object for its Command class. The GraphicsMode class defines anything related to the 3D graphics area -- For example: - Anything related to graphics (Draw method), - Mouse events, cursors (for use in graphics area), - Key bindings or context menu (for use in graphics area). @see: cad/doc/splitting_a_mode.py that gives a detailed explanation about how this is implemented. @see: B{SelectAtoms_GraphicsMode} @see: B{SelectAtoms_Command}, B{SelectAtoms_basicCommand}, @see: B{Select_basicGraphicsMode} """ eCCBtab1 = [1, 2, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 32, 33, 34, 35, 36, 51, 52, 53, 54] def __init__(self, glpane): """ """ _superclass.__init__(self, glpane) self.get_use_old_safe_drag_code() # ditto def Enter_GraphicsMode(self): """ Things needed while entering the GraphicsMode (e.g. updating cursor, setting some attributes etc). This method is called in self.command.command_entered() @see: B{Select_basicGraphicsMode.Enter_GraphicsMode()} """ _superclass.Enter_GraphicsMode(self) #also calls self.reset_drag_vars() #etc self.o.assy.permit_pick_atoms() # Reinitialize previously picked atoms (ppas). self.o.assy.ppa2 = self.o.assy.ppa3 = None self.o.selatom = None def getMovablesForLeftDragging(self): """ Returns a list of movables that will be moved during this gaphics mode's left drag. In SelectChunks_GraphicsMode it is the selected movables in the assembly. However, some subclasses can override this method to provide a custom list of objects it wants to move during the left drag Example: In buildDna_GraphicsMode, it moving a dnaSegment axis chunk will move all the axischunk members of the dna segment and also its logical content chunks. @see: self._leftDrag_movables #attr @see: self._leftDown_preparation_for_dragging() @see: self.leftDragTranslation() @see:BuildDna_GraphicsMode.getMovablesForLeftDragging() @Note: Not implemented in SelectAtoms_GraphicsMode """ movables = [] return movables def reset_drag_vars(self): """ Overrides L{Select_basicGraphicsMode.reset_drag_vars} """ _superclass.reset_drag_vars(self) self.dragatoms = [] # dragatoms is constructed in get_dragatoms_and_baggage() and # contains all the selected atoms (except selected baggage atoms) # that are dragged around # as part of the current selection in drag_selected_atoms(). # Selected atoms that are baggage are placed in self.baggage # along with non-selected baggage atoms connected to dragatoms. # See atomSetup() for more information. #bruce 060410 note: self.dragatoms is only set along with # self.baggage,and the atoms in these lists are only moved together # (in all cases involving self.dragatoms, # though not in all cases involving self.baggage), # so it doesn't matter which atoms are in which lists # (in those cases), # and probably the code should be revised to use only the # self.dragatoms list (in those cases). #bruce 060410 optimization and change: when all atoms in existing # chunks are being dragged # (or if new chunks could be temporarily and transparently made for # which all their atoms were being dragged), # then we can take advantage of chunk display lists to get a big # speedup in dragging the atoms. # We do this by listing such chunks in self.dragchunks and excluding # their atoms from self.dragatoms and self.baggage. self.baggage = [] # baggage contains singlets and/or monovalent atoms #(i.e. H, O(sp2), F, Cl, Br) # which are connected to a dragged atom and get dragged around with #it.Also, no atom which has baggage can also be baggage. self.nonbaggage = [] # nonbaggage contains atoms which are bonded to a dragged atom but # are not dragged around with it. Their own baggage atoms are moved # when a single atom is dragged in atomDrag(). self.dragchunks = [] self.dragjigs = [] # dragjigs is constructed in jigSetup() and contains all the # selected jigs that are dragged around as part of the current # selection in jigDrag(). self.drag_offset = V(0,0,0) #bruce 060316 # default value of offset from object reference point # (e.g. atom center) to dragpoint (used by some drag methods) self.maybe_use_bc = False # whether to use the BorrowerChunk optimization for the current # drag (experimental) [bruce 060414] self.drag_multiple_atoms = False # set to True when we are dragging a movable unit of 2 or more # atoms. self.smooth_reshaping_drag = False # set to True when we're going to do a "smooth-reshaping drag" in # the current drag. [bruce 070412] self.only_highlight_singlets = False # When set to True, only singlets get highlighted when dragging a # singlet. (Note: the mechanism for that effect is that methods # in this class can return the highlight color as None to disable # highlighting for a particular selobj.) # depositMode.singletSetup() sets this to True while dragging a # singlet around. self.neighbors_of_last_deleted_atom = [] # list of the real atom neighbors connected to a deleted atom. # Used by atomLeftDouble() # to find the connected atoms to a recently deleted atom when # double clicking with 'Shift+Control' # modifier keys pressed together. #==START Highlighting related methods================================ def _getAtomHighlightColor(self, selobj): """ Return the Atom highlight color to use for selobj which is the object under the mouse, or None to disable highlighting for that object. @note: ok to make use of self.only_highlight_singlets, and when it's set, self.current_obj. See code comments for details. @return: Highlight color to use for the object (Atom or Singlet), or None """ assert isinstance(selobj, Atom) if selobj.is_singlet(): return self._getSingletHighlightColor() else: # selobj is a real atom if self.only_highlight_singlets: # Above is True only when dragging a bondpoint (in Build mode) # (namely, we are dragging self.current_obj, a bondpoint). # Highlight this atom (selobj) if it has bondpoints # (but only if it's not the base atom of self.current_obj, # to fix bug 1522 -- mark 060301). if selobj.singNeighbors(): if self.current_obj in selobj.singNeighbors(): # Do not highlight the atom that the current # singlet (self.current_obj) belongs to. return None return env.prefs[atomHighlightColor_prefs_key] # Possible bug: bruce 070413 seems to observe this not # working except when the mouse goes over # the end of a bond attached to that atom # (which counts as the atom for highlighting), # or when the atom is already highlighted. # (Could it be the cursor going over the rubberband # line? Not always. But it might be intermittent.) else: return None if self.o.modkeys == 'Shift+Control': return env.prefs[deleteAtomHighlightColor_prefs_key] else: return env.prefs[atomHighlightColor_prefs_key] def _getSingletHighlightColor(self): """ Return the Singlet (bondpoint) highlight color. @return: Highlight color to use for any bondpoint (specific bondpoint is not passed) """ # added highlight_singlets to fix bug 1540. mark 060220. if self.highlight_singlets: #bruce 060702 part of fixing bug 833 item 1 likebond = self.command.isBondsToolActive() if likebond: # clicks in this tool-state modify the bond, # not the bondpoint, so let the color hint at that return env.prefs[bondHighlightColor_prefs_key] else: return env.prefs[bondpointHighlightColor_prefs_key] else: return None def _getBondHighlightColor(self, selobj): """ Return the highlight color for selobj (a Bond), or None to disable highlighting for that object. @return: Highlight color to use for this bond (selobj), or None """ assert isinstance(selobj, Bond) # Following might be an outdated or 'not useful anymore' comment. # Keeping it for now -- Ninad 2007-10-14 #bruce 050822 experiment: debug_pref to control whether to highlight # bonds # (when False they'll still obscure other things -- need to see if # this works for Mark ###@@@) # ###@@@ PROBLEM with this implem: they still have a cmenu and #can be deleted by cmd-del (since still in selobj); # how would we *completely* turn this off? Need to see how # GLPane decides whether a drawn thing is highlightable -- # maybe just by whether it can draw_with_abs_coords? # Maybe by whether it has a glname (not toggleable instantly)? # ... now i've modified GLPane to probably fix that... highlight_bonds = debug_pref("highlight bonds", Choice_boolean_True) if not highlight_bonds: return None ###@@@ use checkbox to control this; when false, return None if selobj.atom1.is_singlet() or selobj.atom2.is_singlet(): # this should never happen, since singlet-bond is part of # singlet for selobj purposes [bruce 050708] print "bug: selobj is a bond to a bondpoint, should have " \ "borrowed glname from that bondpoint", selobj return None # precaution else: if self.only_highlight_singlets: return None if self.o.modkeys == 'Shift+Control': return env.prefs[deleteBondHighlightColor_prefs_key] else: return env.prefs[bondHighlightColor_prefs_key] #==END Highlighting related methods================================ # == LMB event handling methods ==================================== # # The following sections include all the LMB event handling methods for # this class. The section includes the following methods: # # - LMB down-click (button press) methods # leftShiftDown() # leftCntlDown() # leftDown() # # - LMB drag methods # leftShiftDrag() # leftDrag() # # - LMB up-click (button release) methods # leftShiftUp() # leftCntlUp() # leftUp() # # - LMB double-click method (only one) # leftDouble() # # For more information about the LMB event handling scheme, go to # http://www.nanoengineer-1.net/ and click on the "Build Mode UI # Specification" link. # == LMB down-click (button press) methods def leftDown(self, event): """ Event handler for all LMB press events. """ # Note: the code of SelectAtoms_GraphicsMode and SelectChunks_GraphicsMode # .leftDown methods is very similar, so I'm removing the redundant #comments the other one (SelectChunks_GraphicsMode); #i.e. some of this method's comments # also apply to the same code in the same method in SelectChunks_GraphicsMode. # [bruce 071022] self.set_cmdname('BuildClick') # TODO: this should be set again later (during the same drag) # to a more specific command name. self.o.assy.permit_pick_atoms() # Fixes bug 1413, 1477, 1478 and 1479. Mark 060218. self.reset_drag_vars() env.history.statusbar_msg(" ") # get rid of obsolete msg from bareMotion [bruce 050124; imperfect] self.LMB_press_event = QMouseEvent(event) # Make a copy of this event and save it. # We will need it later if we change our mind and start selecting # a 2D region in leftDrag(). Copying the event in this way is # necessary because Qt will overwrite <event> later (in leftDrag) # if we simply set self.LMB_press_event = event. mark 060220. self.LMB_press_pt_xy = (event.pos().x(), event.pos().y()) # <LMB_press_pt_xy> is the position of the mouse in window # coordinates when the LMB was pressed. Used in # mouse_within_stickiness_limit (called by leftDrag() and other # methods). We don't bother to vertically flip y using self.height # (as mousepoints does), since this is only used for drag distance # within single drags. obj = self.get_obj_under_cursor(event) # If highlighting is turned on, get_obj_under_cursor() returns # atoms, singlets, bonds, jigs, or anything that can be highlighted # and end up in glpane.selobj. [bruce revised this comment, 060725] # (It can also return a "background object" from testmode, as of # bruce 070322.) # If highlighting is turned off, get_obj_under_cursor() returns # atoms and singlets (not bonds or jigs). # [not sure if that's still true -- # probably not. bruce 060725 addendum] if obj is None: # Cursor over empty space. self.emptySpaceLeftDown(event) return #bruce 060725 new feature. Any selobj can decide how clicks/drags # on it should behave, if it wants to. Normally this will not apply # to an Atom, Bond, or Jig, but there's no reason it couldn't in # theory (except that some code may check for those classes first, # before checking for selobj using this API). # WARNING: API is experimental and is very likely to be modified. # (But note that testmode and the exprs module do depend on it.) # For example, we're likely to tell it some modkeys, something # about this mode, the mousepoints, etc, and to respond more # fundamentally to whatever is returned. # (see also mouseover_statusbar_message, used in GLPane.set_selobj) method = getattr(obj, 'leftClick', None) if method: done = self.call_leftClick_method(method, obj, event) if done: return self.doObjectSpecificLeftDown(obj, event) self.w.win_update() #k (is this always desirable? note, a few cases above return # early just so they can skip it.) return # from SelectAtoms_GraphicsMode.leftDown def call_leftClick_method(self, method, obj, event):#bruce 071022 split this #out """ ###doc [return True if nothing more should be done to handle this event, False if it should be handled in the usual way] """ gl_event_info = self.dragstart_using_GL_DEPTH( event, more_info = True) self._drag_handler_gl_event_info = gl_event_info farQ_junk, hitpoint, wX, wY, depth, farZ = gl_event_info del wX, wY, depth, farZ try: retval = method(hitpoint, event, self) ##e more args later -- mouseray? modkeys? # or use callbacks to get them? #bruce 061120 changed args from (hitpoint, self) to # (hitpoint, event, self) [where self is the mode object] # a new part of the drag_handler API is access by method to # self._drag_handler_gl_event_info [bruce 061206] #e (we might decide to change that to a dict so it's easily # extendable after that, or we might add more attrs # or methods of self which the method call is specifically # allowed to access as part of that API #e) except: print_compact_traceback("exception ignored "\ "in %r.leftClick: " % (obj,)) return True # If retval is None, the object just wanted to know about the click, # and now we handle it normally (including the usual special cases for # Atom, etc). # If retval is a drag handler (#doc), we let that object handle # everything about the drag. (Someday, all of our object/modkey-specific # code should be encapsulated into drag handlers.) # If retval is something else... not sure, so nevermind for now, just # assume it's a drag handler. ###@@@ self.drag_handler = retval # needed even if this is None ##e should wrap with something which exception-protects all method # calls if self.drag_handler is not None: # We're using a drag_handler to override most of our behavior for # this drag. self.dragHandlerSetup(self.drag_handler, event) # does updates if needed return True return False # == LMB drag methods def leftDrag(self, event): """ Event handler for all LMB+Drag events. """ # Do not change the order of the following conditionals unless you know # what you're doing. mark 060208. if self.mouse_within_stickiness_limit(event, DRAG_STICKINESS_LIMIT): # [let this happen even for drag_handlers -- bruce 060728] return if self.cursor_over_when_LMB_pressed == 'Empty Space': if self.drag_handler is not None: ## print "possible bug (fyi): self.drag_handler is not None, "\ ## "but cursor_over_when_LMB_pressed == 'Empty Space'", \ ## self.drag_handler #bruce 060728 # bruce 070322: this is permitted now, and we let the # drag_handler handle it (for testmode & exprs module)... # however, I don't think this new feature will be made use of # yet, since testmode will instead sometimes override # get_obj_under_cursor to make it return a background object # rather than None, so this code will not set # cursor_over_when_LMB_pressed to 'Empty Space'. self.dragHandlerDrag(self.drag_handler, event) # does updates if needed else: self.emptySpaceLeftDrag(event) return if self.o.modkeys is not None: # If a drag event has happened after the cursor was over an atom # and a modkey is pressed, do a 2D region selection as if the # atom were absent. # [let this happen even for drag_handlers -- bruce 060728] self.emptySpaceLeftDown(self.LMB_press_event) #bruce 060721 question: why don't we also do emptySpaceLeftDrag # at this point? return if self.drag_handler is not None: #bruce 060728 self.dragHandlerDrag(self.drag_handler, event) # does updates if needed return obj = self.current_obj if obj is None: # Nothing dragged (or clicked); return. return self.doObjectSpecificLeftDrag(obj, event) # No gl_update() needed. Already taken care of. return def doObjectSpecificLeftDrag(self, object, event): """ Call objectLeftDrag methods depending on the object instance. Overrides Select_basicGraphicsMode.doObjectSpecificLeftDrag @param object: object under consideration. @type object: instance @param event: Left drag mouse event @type event: QMouseEvent instance """ #current object is not clicked but is dragged. Important to set this #flag. See Select_basicGraphicsMode.doObjectSpecificLeftUp for more # comments self.current_obj_clicked = False obj = object if isinstance(obj, Atom): if obj.is_singlet(): # Bondpoint self.singletDrag(obj, event) else: # Real atom self.atomDrag(obj, event) elif isinstance(obj, Bond): # Bond self.bondDrag(obj, event) elif isinstance(obj, Jig): # Jig self.jigDrag(obj, event) else: # Something else pass def posn_str(self, atm): #bruce 041123 """ Return the position of an atom as a string for use in our status messages. (Also works if given an atom's position vector itself -- kluge, sorry.) """ try: x,y,z = atm.posn() except AttributeError: x,y,z = atm # kluge to accept either arg type return "(%.2f, %.2f, %.2f)" % (x,y,z) # == LMB up-click (button release) methods def leftUp(self, event): """ Event handler for all LMB release events. """ env.history.flush_saved_transients() if self.ignore_next_leftUp_event: # This event is the second leftUp of a double click, so ignore it. # [REVIEW: will resetting this flag here cause trouble for a triple # click? I guess/hope not, since that also calls leftDouble and # sets this. bruce comment 071022] self.ignore_next_leftUp_event = False self.update_selobj(event) # Fixes bug 1467. mark 060307. return if self.cursor_over_when_LMB_pressed == 'Empty Space': self.emptySpaceLeftUp(event) return if self.mouse_within_stickiness_limit(event, DRAG_STICKINESS_LIMIT): event = self.LMB_press_event # pretend the mouse didn't move -- this replaces our argument # event, for passing to *leftUp methods [bruce 060728 comment] if self.drag_handler: #bruce 060728 # does updates if needed self.dragHandlerLeftUp(self.drag_handler, event) self.leftUp_reset_a_few_drag_vars() #k needed?? return obj = self.current_obj if obj is None: # Nothing dragged (or clicked); return. return self.doObjectSpecificLeftUp(obj, event) self.leftUp_reset_a_few_drag_vars() #bruce 041130 comment: it forgets selatom, but doesn't repaint, # so selatom is still visible; then the next event will probably # set it again; all this seems ok for now, so I'll leave it alone. #bruce 041206: I changed my mind, since it seems dangerous to leave # it visible (seemingly active) but not active. So I'll repaint here. # In future we can consider first simulating a update_selatom at the # current location (to set selatom again, if appropriate), but it's # not clear this would be good, so *this* is what I won't do for now. #self.o.gl_update() #& Now handled in modkey*() methods. mark 060210. return # from SelectAtoms_GraphicsMode.leftUp def leftUp_reset_a_few_drag_vars(self): """ reset a few drag vars at the end of leftUp -- might not be safe to reset them all (e.g. if some are used by leftDouble) """ #bruce 060728 split this out, guessed docstring self.baggage = [] self.current_obj = None #bruce 041130 fix bug 230 # later: i guess this attr had a different name then [bruce 060721] self.o.selatom = None #bruce 041208 for safety in case it's killed return # ===== START: Atom selection and dragging helper methods ========== drag_offset = V(0,0,0) # avoid tracebacks from lack of leftDown def atomSetup(self, a, event): #bruce 060316 added <event> argument, #for bug 1474 """ Setup for a click, double-click or drag event for real atom <a>. """ #bruce 060316 set self.drag_offset to help fix bug 1474 #(this should be moved into a method so singlets can call it too)-- farQ, dragpoint = self.dragstart_using_GL_DEPTH( event) apos0 = a.posn() if farQ or vlen( dragpoint - apos0 ) > a.max_pixel_radius(): # dragpoint is not realistic -- find a better one (using code #similar to innards of dragstart_using_GL_DEPTH) # [following comment appears to be obs, since +0.2 is no longer here # [bruce 080605 comment]:] ###@@@ Note: + 0.2 is purely a guess (probably too big) -- ###what it should be is a new method a.max_drawn_radius(), # which gives max distance from center of a drawn pixel, including #selatom, highlighting, wirespheres, # and maybe even the depth offset added by GLPane when it draws in # highlighted form (not sure, it might not draw # into depth buffer then...) Need to fix this sometime. Not high # priority, since it seems to work with 0.2, # and since higher than needed values would be basically ok anyway. #[bruce 060316] if env.debug(): # leave this in until we see it printed sometime print "debug: fyi: atomSetup dragpoint try1 was bad, %r "\ "for %r, reverting to ptonline" % (dragpoint, apos0) p1, p2 = self.o.mousepoints(event) dragpoint = ptonline(apos0, p1, norm(p2-p1)) del p1,p2 del farQ, event self.drag_offset = dragpoint - apos0 # some subclass drag methods can #use this with #self.dragto_with_offset() self.objectSetup(a) if len(self.o.assy.selatoms_list()) == 1: #bruce 060316 question: does it matter, in this case, whether <a> #is the single selected atom? is it always?? self.baggage, self.nonbaggage = a.baggage_and_other_neighbors() self.drag_multiple_atoms = False else: #bruce 070412 self.smooth_reshaping_drag = self.get_smooth_reshaping_drag() self.dragatoms, self.baggage, self.dragchunks = \ self.get_dragatoms_and_baggage() # if no atoms in alist, dragatoms and baggage are empty lists, #which is good. self.drag_multiple_atoms = True self.maybe_use_bc = debug_pref("use bc to drag mult?", Choice_boolean_False) #bruce 060414 # dragjigs contains all the selected jigs. self.dragjigs = self.o.assy.getSelectedJigs() def atomLeftDown(self, a, event): if not self.selection_locked(): if not a.picked and self.o.modkeys is None: self.o.assy.unpickall_in_GLPane() a.pick() if not a.picked and self.o.modkeys == 'Shift': a.pick() if a.picked: self.cursor_over_when_LMB_pressed = 'Picked Atom' else: self.cursor_over_when_LMB_pressed = 'Unpicked Atom' self.atomSetup(a, event) def atomLeftUp(self, a, event): # Was atomClicked(). mark 060220. """ Real atom <a> was clicked, so select, unselect or delete it based on the current modkey. - If no modkey is pressed, clear the selection and pick atom <a>. - If Shift is pressed, pick <a>, adding it to the current selection. - If Ctrl is pressed, unpick <a>, removing it from the current selection. - If Shift+Control (Delete) is pressed, delete atom <a>. """ if self.selection_locked(): return self.deallocate_bc_in_use() if not self.current_obj_clicked: # Atom was dragged. Nothing to do but return. if self.drag_multiple_atoms: self.set_cmdname('Move Atoms') #bruce 060412 added plural #variant else: self.set_cmdname('Move Atom') ##e note about command names: if jigs were moved too, ##"Move Selected Objects" might be better... [bruce 060412 comment] self.o.assy.changed() # mark 060227 return nochange = False if self.o.modkeys is None: # isn't this redundant with the side effects in atomLeftDown?? #[bruce 060721 question] self.o.assy.unpickall_in_GLPane() # was unpickatoms only; # I think unpickall makes more # sense [bruce 060721] if a.picked: nochange = True #bruce 060331 comment: nochange = True is wrong, since #the unpick might have changed something. # For some reason the gl_update occurs anyway, so I don't know # if this causes a real bug, so I didn't change it. else: a.pick() self.set_cmdname('Select Atom') env.history.message(a.getinfo()) elif self.o.modkeys == 'Shift': if a.picked: nochange = True else: a.pick() self.set_cmdname('Select Atom') env.history.message(a.getinfo()) elif self.o.modkeys == 'Control': if a.picked: a.unpick() self.set_cmdname('Unselect Atom') #bruce 060331 comment: I think a better term (in general) # would be "Deselect". #bruce 060331 bugfix: if filtering prevents the unpick, #don't print the message saying we unpicked it. # I also fixed the message to not use the internal jargon #'unpicked'. # I also added an orangemsg when filtering prevented #the unpick, as we have when it prevents a delete. if not a.picked: # the unpick worked (was not filtered) env.history.message("Deselected atom %r" % a) else: msg = "Can't deselect atom %r due to selection filter."\ " Hit Escape to clear the filter." % (a) env.history.message(orangemsg(msg)) else: # Already unpicked. nochange = True elif self.o.modkeys == 'Shift+Control': result = self.delete_atom_and_baggage(event) env.history.message_no_html(result) self.set_cmdname('Delete Atom') return # delete_atom_and_baggage() calls win_update. else: print_compact_stack('Invalid modkey = "' + \ str(self.o.modkeys) + '" ') return if nochange: return self.o.gl_update() def atomLeftDouble(self): # mark 060308 """ Atom double click event handler for the left mouse button. """ if self.selection_locked(): return if self.o.modkeys == 'Control': self.o.assy.unselectConnected( [ self.obj_doubleclicked ] ) elif self.o.modkeys == 'Shift+Control': self.o.assy.deleteConnected( self.neighbors_of_last_deleted_atom ) else: self.o.assy.selectConnected( [ self.obj_doubleclicked ] ) # the assy.xxxConnected routines do their own win_update or gl_update #as needed. [bruce 060412 comment] ##e set_cmdname would be useful here, conditioned on whether ##they did anything [bruce 060412 comment] return #===Drag related methods. def atomDrag(self, a, event): """ Drag real atom <a> and any other selected atoms and/or jigs. @param event: is a drag event. """ apos0 = a.posn() #bruce 060316 fixing bug 1474 -- apos1 = self.dragto_with_offset(apos0, event, self.drag_offset ) # xyz delta between new and current position of <a>. delta = apos1 - apos0 if self.drag_multiple_atoms: self.drag_selected_atoms(delta) else: self.drag_selected_atom(a, delta) #bruce 060316 revised API #[##k could this case be handled # by the multiatom case??] self.drag_selected_jigs(delta) self.atomDragUpdate(a, apos0) return def atomDragUpdate(self, a, apos0): """ Updates the GLPane and status bar message when dragging atom <a> around. <apos0> is the previous x,y,z position of <a>. """ apos1 = a.posn() if apos1 - apos0: if debug_pref( #bruce 060316 made this optional, to see if it causes #lagging drags of C "show drag coords continuously", # non_debug needed for testing, for now [bruce comment] Choice_boolean_True, non_debug = True, prefs_key = "A7/Show Continuous Drag Coordinates"): msg = "dragged atom %r to %s" % (a, self.posn_str(a)) this_drag_id = (self.current_obj_start, self.__class__.leftDrag) env.history.message(msg, transient_id = this_drag_id) self.current_obj_clicked = False # atom was dragged. mark 060125. self.o.gl_update() def drag_selected_atom(self, a, delta, computeBaggage = False): # bruce 060316 revised API for # uniformity and no redundant # dragto, re bug 1474 """ Drag real atom <a> by the xyz offset <delta>, adjusting its baggage atoms accordingly(how that's done depends on its other neighbor atoms). @param computeBaggage: If this is true, the baggage and non-baggage of the atom to be dragged will be computed in this method before dragging the atom. Otherwise it assumes that the baggage and non-baggage atoms are up-to-date and are computed elsewhere , for example in 'atomSetUp' See a comment in the method that illustrates an example use. @type recompueBaggage: boolean @see: BuildAtomsPropertyManager._moveSelectedAtom() @see: SelectAtoms_Command.drag_selected_atom() """ apo = a.posn() ## delta = px - apo px = apo + delta #Example use of flag 'computeBaggage': If this method is called as a #result of a value change in a UI element, the methods such as #self.atomLeftDown or self.atomSetUp are not called. Those methods do #the job of computing baggage etc. So a workaround is to instruct this #method to recompute the baggage and non baggage before proceeding. if computeBaggage: self.baggage, self.nonbaggage = a.baggage_and_other_neighbors() n = self.nonbaggage # n = real atoms bonded to <a> that are not singlets or # monovalent atoms. # they need to have their own baggage adjusted below. old = V(0,0,0) new = V(0,0,0) # old and new are used to compute the delta quat for the average # non-baggage bond [in a not-very-principled way, # which doesn't work well -- bruce 060629] # and apply it to <a>'s baggage for at in n: # Since adjBaggage() doesn't change at.posn(), #I switched the order for readability. # It is now more obvious that <old> and <new> have no impact # on at.adjBaggage(). # mark 060202. at.adjBaggage(a, px) # Adjust the baggage of nonbaggage atoms. old += at.posn()-apo new += at.posn()-px # Handle baggage differently if <a> has nonbaggage atoms. if n: # If <a> has nonbaggage atoms, move and rotate its baggage atoms. # slight safety tweaks to old code, though we're about to add new #code to second-guess it [bruce 060629] old = norm(old) #k not sure if these norms make any difference new = norm(new) if old and new: q = Q(old,new) for at in self.baggage: at.setposn(q.rot(at.posn()-apo)+px) # similar to adjBaggage, #but also has a translation else: for at in self.baggage: at.setposn(at.posn()+delta) #bruce 060629 for "bondpoint problem": treat that as an # initial guess -- # now fix them better (below, after we've also moved <a> itself.) else: # If <a> has no nonbaggage atoms, just move each baggage atom # (no rotation). for at in self.baggage: at.setposn(at.posn()+delta) a.setposn(px) # [bruce 041108 writes:] # This a.setposn(px) can't be done before the at.adjBaggage(a, px) # in the loop before it, or adjBaggage (which compares a.posn() to # px) would think atom <a> was not moving. if n: #bruce 060629 for bondpoint problem a.reposition_baggage(self.baggage) return maybe_use_bc = False # precaution def drag_selected_atoms(self, offset): # WARNING: this (and quite a few other methods) is probably only called # (ultimately) from event handlers in SelectAtoms_GraphicsMode, # and probably uses some attrs of self that only exist in that mode. # [bruce 070412 comment] if self.maybe_use_bc and self.dragatoms and self.bc_in_use is None: #bruce 060414 move selatoms optimization (unfinished); # as of 060414 this never happens unless you set a debug_pref. # See long comment above for more info. bc = self.allocate_empty_borrowerchunk() self.bc_in_use = bc other_chunks, other_atoms = bc.take_atoms_from_list( self.dragatoms) self.dragatoms = other_atoms # usually [] self.dragchunks.extend(other_chunks) # usually [] self.dragchunks.append(bc) # Move dragatoms. for at in self.dragatoms: at.setposn(at.posn()+offset) # Move baggage (or slow atoms, in smooth-reshaping drag case) if not self.smooth_reshaping_drag: for at in self.baggage: at.setposn(at.posn() + offset) else: # kluge: in this case, the slow-moving atoms are the ones in # self.baggage. # We should probably rename self.baggage or not use the same # attribute for those. for at in self.baggage: f = self.offset_ratio(at, assert_slow = True) at.setposn(at.posn() + f * offset) # Move chunks. [bruce 060410 new feature, for optimizing moving of # selected atoms, re bugs 1828 / 1438] # Note, these might be chunks containing selected atoms (and no # unselected atoms, except baggage), not selected chunks. # All that matters is that we want to move them as a whole (as an # optimization of moving their atoms individually). # Note, as of 060414 one of them might be a BorrowerChunk. for ch in self.dragchunks: ch.move(offset) return # ===== END: Atom selection and dragging helper methods ========== #Various Drag related methods (some are experimental methods created #and maintained by Bruce. #@TODO: Bruce will be renaming/cleaningup method # OLD_get_dragatoms_and_baggage def get_dragatoms_and_baggage(self): """ #doc... return dragatoms, baggage, dragchunks; look at self.smooth_reshaping_drag [nim]; how atoms are divided between dragatoms & baggage is arbitrary and is not defined. [A rewrite of callers would either change them to treat those differently and change this to care how they're divided up (requiring a decision about selected baggage atoms), or remove self.baggage entirely.] """ #bruce 060410 optimized this; it had a quadratic algorithm (part of the #cause of bugs 1828 / 1438), and other slownesses. # The old code was commented out for comparison [and later, 070412, # was removed]. # [Since then, it was totally rewritten by bruce 070412.] # # Note: as of 060410, it looks like callers only care about the total # set of atoms in the two returned lists, # not about which atom is in which list, so the usefulness of having two # lists is questionable. # The old behavior was (by accident) that selected baggage atoms end up # only in the baggage list, not in dragatoms. # This was probably not intended but did not matter at the time. # The dragchunks optimization at the end [060410] changes this by # returning all atoms in dragatoms or dragchunks, # none in baggage. The new smooth reshaping feature [070412] may change # this again. if not self.smooth_reshaping_drag and self.get_use_old_safe_drag_code(): # by default, for now: for safety, use the old drag code, if we're #not doing a smooth_reshaping_drag. # After FNANO I'll change the default for use_old_safe_drag_code # to False. [bruce 070413] return self.OLD_get_dragatoms_and_baggage() print "fyi: using experimental code for get_dragatoms_and_baggage;"\ "smooth_reshaping_drag = %r" % self.smooth_reshaping_drag # Remove this print after FNANO when this code becomes standard, #at least for non-smooth_reshaping_drag case. # But consider changing the Undo cmdname, drag -> smooth drag or #reshaping drag. #e # rewrite, bruce 070412, for smooth reshaping and also for general # simplification: # [this comment and the partly redundant ones in the code will be # merged later] # - treat general case as smooth reshaping with different (trivial) # motion-function (though we'll optimize for that) # -- gather the same setup data either way. That will reduce # bug-differences between smooth reshaping and plain drags, and it might # help with other features in the future, like handling baggage better # when there are multiple selected atoms. - any baggage atom B has # exactly one neighbor S, and if that neighbor is selected(which is the # only time we might think of B as baggage here), we want B to move # with S, regardless of smooth reshaping which might otherwise move # them differently. # This is true even if B itself is selected. So, for baggage atoms # (even if selected) make a dict which points them to other selected # atoms. If we find cycles in that, those atoms must be closed for # selection (ie not indirectly bonded to unselected atoms, which is what # matters for smooth reshaping alg) or can be treated that way, so move # those atoms into a third dict for moving atoms which are not connected # to unmoving atoms.(These never participate in smooth reshaping # -- they always move # with the drag.) # - the other atoms which move with the drag are the ones we find # later with N == N_max, # and the other ones not bonded to unselected nonbaggage atoms, # and all of them if # we're not doing reshaping drag. # - then for all atoms which move with the drag (including some of # the baggage, # so rescan it to find those), we do the dragchunk optim; # for the ones which move, but not with the drag, we store their # motion-offset-ratio # in a dict to be used during the drag (or maybe return it and let # caller store it #k). # # - I think all the above can be simplified to the following: # - expand selatoms to include baggage (then no need to remember # which was which, since "monovalent" is good enough to mean # "drag with neighbor", even for non-baggage) # - point monovalent atoms in that set, whose neighbors are in it, # to those neighbors(removing them from that set) # (permitting cycles, which are always length 2)(during the drag, # we'll move them with neighbors, then in future correct # their posn for the motion of other atoms around those neighbors, # as is now only done in single-atom dragging) # - analyze remaining atoms in set for closeness (across bonds) to # unselected atoms(permitting infinite dist == no connection to # them) # - then sort all the atoms into groups that move with the same # offset, and find whole chunks in those groups (or at least in the # group that moves precisely with the drag). (In future we'd use the # whole-chunk and borrowerchunk optims (or equiv) for the # slower-moving groups too. Even now, it'd be easy to use # whole-chunk optim then, but only very rarely useful, so don't # bother.) # # - finally, maybe done in another routine, selected movable jigs move # in a way that depends on how # their atoms move -- maybe their offset-ratio is the average of # that of their atoms. # Ok, here we go: # - expand selatoms to include baggage (then no need to remember # which was which, since "monovalent" is good enough to mean # "drag with neighbor", even for non-baggage) selatoms = self.o.assy.selatoms # maps atom.key -> atom # note: after this, we care only which atoms are in selatoms, # not whether they're selected -- # in other words, you could pass some other dict in place of # selatoms if we modified the API for that, # and no code after this point would need to change. atoms_todo = dict(selatoms) # a copy which we'll modify in the # following loop,and later; # in general it contains all moving atoms we didn't yet decide how # to handle. monovalents = {} # maps a monvalent atom -> its neighbor, #starting with baggage atoms we find boundary = {} # maps boundary atoms (selected, with unselected #nonbaggage neighbor) to themselves ## unselected = {} # maps an unselected nonbaggage atom ##(next to one or more selected ones) to an arbitrary selected one for atom in selatoms.itervalues(): baggage, nonbaggage = atom.baggage_and_other_neighbors() for b in baggage: monovalents[b] = atom # note: b (I mean b.key) might #also be in atoms_todo for n in nonbaggage: if n.key not in selatoms: ## unselected[n] = atom boundary[atom] = atom break continue del selatoms # note: monovalents might overlap atoms_todo; we'll fix that later. # also it is not yet complete, we'll extend it later. # - point monovalent atoms in that set (atoms_todo), whose neighbors # are in it, to those neighbors # (removing them from that set) (permitting cycles, which are # always length 2 -- handled later ###DOIT) for atom in atoms_todo.itervalues(): if len(atom.bonds) == 1: bond = atom.bonds[0] if bond.atom1.key in atoms_todo and bond.atom2.key in atoms_todo: monovalents[atom] = bond.other(atom) for b in monovalents: atoms_todo.pop(b.key, None) # make sure b is not in atoms_todo, #if it ever was len_total = len(monovalents) + len(atoms_todo) # total number of atoms #considered, used in assertions # - analyze remaining atoms in set (atoms_todo) for closeness # (across bonds) to unselected atoms # (permitting infinite dist == no connection to them) # Do this by transclosing boundary across bonds to atoms in atoms_todo. layers = {} # will map N to set-of-atoms-with-N (using terminology of #smooth-reshaping drag proposal) def collector( atom, dict1): """ Add neighbors of atom which are in atoms_todo (which maps atom keys to atoms)to dict1 (which maps atoms to atoms). """ for n in atom.neighbors(): if n.key in atoms_todo: dict1[n] = n return def layer_collector( counter, set): layers[counter] = set ## max_counter = counter # calling order is guaranteed by transclose # no good namespace to store this in -- grab it later return layers_union = transclose( boundary, collector, layer_collector) max_counter = len(layers) # Now layers_union is a subset of atoms_todo, and is the union of all # the layers; the other atoms in atoms_todo are the ones not connected # to unselected nonbaggage atoms. # And that's all moving atoms except the ones in monovalents. for atom in layers_union: atoms_todo.pop(atom.key) # this has KeyError if atom is not there, #which is a good check of the above alg. unconnected = {} # this will map atoms to themselves, which are not # connected to unselected atoms. # note that we can't say "it's atoms_todo", since that maps atom #keys to atoms. # (perhaps a mistake.) for atom in atoms_todo.itervalues(): unconnected[atom] = atom ## del atoms_todo ## SyntaxError: can not delete variable 'atoms_todo' referenced ##in nested scope # not even if I promise I'll never use one of those references # again? (they're only in the local function defs above) atoms_todo = -1111 # error if used as a dict; recognizable/searchable #value in a debugger assert len(monovalents) + len(layers_union) + len(unconnected) == \ len_total assert len(layers_union) == sum(map(len, layers.values())) # Warning: most sets at this point map atoms to themselves, but # monovalents maps them to their neighbors # (which may or may not be monovalents). # Now sort all the atoms into groups that move with the same offset, # and find whole chunks # in those groups (or at least in the group that moves precisely # with the drag). # First, sort monovalents into unconnected ones (2-cycles, moved into # unconnected)and others (left in monovalents). cycs = {} for m in monovalents: if monovalents[m] in monovalents: assert monovalents[monovalents[m]] is m cycs[m] = m unconnected[m] = m for m in cycs: monovalents.pop(m) del cycs assert len(monovalents) + len(layers_union) + len(unconnected) == \ len_total # again, now that we moved them around # Now handle the non-smooth_reshaping_drag case by expressing our # results from above # in terms of the smooth_reshaping_drag case. if not self.smooth_reshaping_drag: # throw away all the work we did above! (but help to catch bugs #in the above code, even so) unconnected.update(layers_union) for atom in monovalents: unconnected[atom] = atom assert len(unconnected) == len_total layers_union = {} layers = {} monovalents = {} max_counter = 0 # Now we'll move unconnected and the highest layer (or layers?) with the # drag, move the other layers lesser amounts, and move monovalents with # their neighbors. Let's label all the atoms with their N, then pull # that back onto the monovalents, and add them to a layer or unconnected # as we do that, also adding a layer to unconnected if it moves the same # But the code is simpler if we move unconnected into the highest layer # instead of the other way around (noting that maybe max_counter == 0 # and layers is empty). (unconnected can be empty too, but that is not # hard to handle.) labels = {} self.smooth_Max_N = max_counter # for use during the drag self.smooth_N_dict = labels # ditto (though we'll modify it below) if not max_counter: assert not layers layers[max_counter] = {} layers[max_counter].update(unconnected) del unconnected assert max_counter in layers for N, layer in layers.iteritems(): assert N <= max_counter for atom in layer: labels[atom] = N N = layer = None del N, layer for m, n in monovalents.iteritems(): where = labels[n] labels[m] = where layers[where][m] = m del monovalents # Now every atom is labelled and in a layer. Move the fast ones out, #keep the slower ones in layers. # (Note that labels itself is a dict of all the atoms, with their N #-- probably it could be our sole output # except for the dragchunks optim. But we'll try to remain compatible #with the old API. Hmm, why not return # the slow atoms in baggage and the fast ones in dragatoms/dragchunks?) fastatoms = layers.pop(max_counter) slowatoms = {} for layer in layers.itervalues(): slowatoms.update(layer) layer = None del layer layers = -1112 # slowatoms is not further used here, just returned assert len_total == len(fastatoms) + len(slowatoms) # Now find whole chunks in the group that moves precisely with the drag #(fastatoms). # This is a slightly modified version of: #bruce 060410 new code: optimize when all atoms in existing chunks are #being dragged. # (##e Soon we hope to extend this to all cases, by making new temporary # chunks to contain dragged atoms, invisibly to the user, taking steps #to not mess up existing chunks re their hotspot, display mode, etc.) atomsets = {} # id(mol) -> (dict from atom.key -> atom) for dragged #atoms in that mol def doit(at): mol = at.molecule atoms = atomsets.setdefault(id(mol), {}) # dragged atoms which are #in this mol, so far, #as atom.key -> atom atoms[at.key] = at # atoms serves later to count them, to let us #make fragments, and to identify the source mol for at in fastatoms: doit(at) dragatoms = [] dragchunks = [] for atomset in atomsets.itervalues(): assert atomset mol = None # to detect bugs for key, at in atomset.iteritems(): mol = at.molecule break # i.e. pick an arbitrary item... is there an easier way? #is this way efficient? if len(mol.atoms) == len(atomset): # all mol's atoms are being dragged dragchunks.append(mol) else: # some but not all of mol's atoms are being dragged ##e soon we can optimize this case too by separating those ##atoms into a temporary chunk, # but for now, just drag them individually as before: dragatoms.extend(atomset.itervalues()) #k itervalues ok here? Should be, and seems to work ok. #Faster than .values? Might be, in theory; not tested. continue assert len(fastatoms) == \ len(dragatoms) + sum([len(chunk.atoms) for chunk in dragchunks]) res = (dragatoms, slowatoms.values(), dragchunks) # these are all lists return res # from (NEW) get_dragatoms_and_baggage # By mark. later optimized and extended by bruce, 060410. # Still used 2007-11-15. [OLD_get_dragatoms_and_baggage] def OLD_get_dragatoms_and_baggage(self): """ #doc... return dragatoms, baggage, dragchunks; look at self.smooth_reshaping_drag [nim]; how atoms are divided between dragatoms & baggage is arbitrary and is not defined. [A rewrite of callers would either change them to treat those differently and change this to care how they're divided up (requiring a decision about selected baggage atoms), or remove self.baggage entirely.] """ #bruce 060410 optimized this; it had a quadratic algorithm #(part of the cause of bugs 1828 / 1438), and other slownesses. # The old code was commented out for comparison #[and later, 070412, was removed]. # # Note: as of 060410, it looks like callers only care about the total #set of atoms in the two returned lists, not about which atom is in # which list, so the usefulness of having two lists is questionable. # The old behavior was (by accident) that selected baggage atoms end up # only in the baggage list, not in dragatoms. This was probably not # intended but did not matter at the time. The dragchunks optimization # at the end [060410] changes this by returning all atoms in dragatoms # or dragchunks, none in baggage. The new smooth reshaping feature #[070412] may change this again. # WARNING: THIS IS NOT USED for smooth reshaping; see (non-OLD) #get_dragatoms_and_baggage for that. dragatoms = [] baggage = [] selatoms = self.o.assy.selatoms # Accumulate all the baggage from the selected atoms, which can include # selected atoms if a selected atom is another selected atom's baggage. # BTW, it is not possible for an atom to end up in self.baggage twice. for at in selatoms.itervalues(): bag, nbag_junk = at.baggage_and_other_neighbors() baggage.extend(bag) # the baggage we'll keep. bagdict = dict([(at.key, None) for at in baggage]) # dragatoms should contain all the selected atoms minus atoms that # are also baggage. # It is critical that dragatoms does not contain any baggage atoms or #they # will be moved twice in drag_selected_atoms(), so we remove them here. for key, at in selatoms.iteritems(): if key not in bagdict: # no baggage atoms in dragatoms. dragatoms.append(at) # Accumulate all the nonbaggage bonded to the selected atoms. # We also need to keep a record of which selected atom belongs to # each nonbaggage atom. This is not implemented yet, but will be needed # to get drag_selected_atoms() to work properly. I'm commenting it out #for now. # mark 060202. ## [code removed, 070412] #bruce 060410 new code: optimize when all atoms in existing chunks #are being dragged. # (##e Soon we hope to extend this to all cases, by making new #temporary chunks to contain dragged atoms, # invisibly to the user, taking steps to not mess up existing chunks re #their hotspot, display mode, etc.) atomsets = {} # id(mol) -> (dict from atom.key -> atom) for dragged #atoms in that mol def doit(at): mol = at.molecule atoms = atomsets.setdefault(id(mol), {}) # dragged atoms which are #in this mol, so far, as #atom.key -> atom atoms[at.key] = at # atoms serves later to count them, to let #us make fragments, and to identify the source #mol for at in dragatoms: doit(at) for at in baggage: doit(at) dragatoms = [] baggage = [] # no longer used dragchunks = [] for atomset in atomsets.itervalues(): assert atomset mol = None # to detect bugs for key, at in atomset.iteritems(): mol = at.molecule break # i.e. pick an arbitrary item... is there an easier way? #is this way efficient? if len(mol.atoms) == len(atomset): # all mol's atoms are being dragged dragchunks.append(mol) else: # some but not all of mol's atoms are being dragged ##e soon we can optimize this case too by separating those atoms ##into a temporary chunk, # but for now, just drag them individually as before: dragatoms.extend(atomset.itervalues()) #k itervalues ok here? Should be, and seems to work ok. #Faster than .values? Might be, in theory; not tested. continue return dragatoms, baggage, dragchunks # return from #OLD_get_dragatoms_and_baggage; #this routine will be removed #later def offset_ratio(self, atom, assert_slow = False): #bruce 070412 """ When self.smooth_reshaping_drag, return the drag_offset_ratio for any atom (0 if we're not dragging it). """ N = float(self.smooth_N_dict.get(atom, 0)) # If found: from 1 to Max_N Max_N = self.smooth_Max_N # 0 or more (integer) if Max_N == 0: R = 0; f = 1 else: R = (Max_N - N)/Max_N # ranges from just above 0 to just below 1, # in slow case, or can be exact 0 or 1 in # general f = (1-R**2)**2 # could be precomputed for each N, but that's #probably not a big optim if assert_slow: assert 1 <= N < Max_N assert 0 < R < 1, "why is R == %r not strictly between 0 and 1?" \ "N = %r, Max_N = %r, atom = %r" % \ (R, N, Max_N, atom) assert 0 < f < 1 else: assert 0 <= N <= Max_N assert 0 <= R <= 1 assert 0 <= f <= 1 return f #bruce 070525 shortened text (it made entire menu too wide) #@ Leaving this here before removing it. I'd like to discuss the proper # way for this method should get the state of the "Reshape drag" checkbox # in the "Build Atoms" Property Manager. --Mark 2008-04-06 def get_smooth_reshaping_drag_OBSOLETE(self): res = debug_pref( "Drag reshapes selected atoms?", Choice_boolean_False, prefs_key = '_debug_pref_key:Drag reshapes selected atoms when \ bonded to unselected atoms?', non_debug = True ) return res def get_smooth_reshaping_drag(self): """ Returns the state of the "Dragging reshapes selection" checkbox. @return: The state of the checkbox (True or False). @rtype: boolean """ return env.prefs[reshapeAtomsSelection_prefs_key] def get_use_old_safe_drag_code(self): #bruce 070413 res = debug_pref("use old safe drag code, when not reshaping?", Choice_boolean_True, # asap, try changing this to False, and if all is well, remove the old code; # but meanwhile, I'm removing non_debug [bruce 080416] ## non_debug = True, prefs_key = True ) return res # ===== START: Bond selection, deletion and dragging helper methods ======= def bondDrag(self, obj, event): # [bruce 060728 added obj arg, for uniformity; probably needed even more # in other Bond methods ##e] # If a LMB+Drag event has happened after selecting a bond in left*Down() # do a 2D region selection as if the bond were absent. This takes care # of both Shift and Control mod key cases. self.cursor_over_when_LMB_pressed = 'Empty Space' self.select_2d_region(self.LMB_press_event) # [i suspect this inlines # something in another # method -- bruce 060728] self.current_obj_clicked = False self.current_obj = None return def bondLeftDouble(self): # mark 060308. """ Bond double click event handler for the left mouse button. """ if self.o.modkeys == 'Control': self.o.assy.unselectConnected( [ self.obj_doubleclicked.atom1 ] ) elif self.o.modkeys == 'Shift+Control': self.o.assy.deleteConnected( [ self.obj_doubleclicked.atom1, self.obj_doubleclicked.atom2 ] ) else: self.o.assy.selectConnected( [ self.obj_doubleclicked.atom1 ] ) # the assy.xxxConnected routines do their own win_update or gl_update #as needed. [bruce 060412 comment] return def bondLeftUp(self, b, event): """ Bond <b> was clicked, so select or unselect its atoms or delete bond <b> based on the current modkey. - If no modkey is pressed, clear the selection and pick <b>'s two atoms. - If Shift is pressed, pick <b>'s two atoms, adding them to the current selection. - If Ctrl is pressed, unpick <b>'s two atoms, removing them from the current selection. - If Shift+Control (Delete) is pressed, delete bond <b>. <event> is a LMB release event. """ if self.selection_locked(): return #& To do: check if anything changed (picked/unpicked) before #calling gl_update(). mark 060210. if self.o.modkeys is None: self.o.assy.unpickall_in_GLPane() # was unpickatoms() [bruce 060721] b.atom1.pick() b.atom2.pick() self.set_cmdname('Select Atoms') elif self.o.modkeys == 'Shift': b.atom1.pick() b.atom2.pick() self.set_cmdname('Select Atoms') #Bond class needs a getinfo() method to be called here. mark 060209. elif self.o.modkeys == 'Control': b.atom1.unpick() b.atom2.unpick() self.set_cmdname('Unselect Atoms') elif self.o.modkeys == 'Shift+Control': self.bondDelete(event) # <b> is the bond the cursor was over when the LMB was pressed. # use <event> to delete bond <b> to ensure that the cursor # is still over it. else: print_compact_stack('Invalid modkey = "' + str(self.o.modkeys) + '" ') return self.o.gl_update() def bondDelete(self, event): """ If the object under the cursor is a bond, delete it. @param event: A left mouse up event. @type event: U{B{QMouseEvent}<http://doc.trolltech.com/4/qmouseevent.html>} """ # see also: bond_utils.delete_bond #bruce 041130 in case no update_selatom happened yet self.update_selatom(event) # see warnings about update_selatom's delayed effect, # in its docstring or in leftDown. [bruce 050705 comment] selobj = self.o.selobj if isinstance( selobj, Bond) and not selobj.is_open_bond(): _busted_strand_bond = False if selobj.isStrandBond(): _busted_strand_bond = True msg = "breaking strand %s" % selobj.getStrandName() else: msg = "breaking bond %s" % selobj env.history.message_no_html(msg) # note: %r doesn't show bond type, but %s needs _no_html # since it contains "<-->" which looks like HTML. self.o.selobj = None # without this, the bond remains highlighted # even after it's broken (visible if it's toolong) ###e shouldn't we use set_selobj instead?? ##[bruce 060726 question] x1, x2 = selobj.bust() # this fails to preserve the bond type on the open bonds # -- not sure if that's bad, but probably it is if 1: # Note: this should be removed once the dna updater becomes # turned on by default. (It will cause no harm, but will be a slowdown # since everything it does will be undone or redone differently # by the updater.) [bruce 080228 comment] # After bust() selobj.isStrandBond() is too fragile, so I set # <_busted_strand_bond> and test it instead. - Mark 2007-10-23. if _busted_strand_bond: # selobj.isStrandBond(): self.o.assy.makeStrandChunkFromBrokenStrand(x1, x2) self.set_cmdname('Delete Bond') self.o.assy.changed() #k needed? self.w.win_update() #k wouldn't gl_update be enough? #[bruce 060726 question] # ===== END: Bond selection and dragging helper methods ========== def jigSetup(self, j): """ Setup for a click, double-click or drag event for jig <j>. """ self.objectSetup(j) #bruce 070412 self.smooth_reshaping_drag = self.get_smooth_reshaping_drag() self.dragatoms, self.baggage, self.dragchunks = \ self.get_dragatoms_and_baggage() # if no atoms are selected, dragatoms and baggage #are empty lists, which is good. # dragjigs contains all the selected jigs. self.dragjigs = self.o.assy.getSelectedJigs() def drag_selected_jigs(self, offset): for j in self.dragjigs: if self.smooth_reshaping_drag: # figure out a modified offset by averaging the offset-ratio for #this jig's atoms ratio = average_value(map(self.offset_ratio, j.atoms), default = 1.0) offset = offset * ratio # not *=, since it's a mutable Numeric #array! j.move(offset) def jigDrag(self, j, event): """ Drag jig <j> and any other selected jigs or atoms. <event> is a drag event. """ #bruce 060316 commented out deltaMouse since it's not used in this #routine ##deltaMouse = V(event.pos().x() - self.o.MousePos[0], ## self.o.MousePos[1] - event.pos().y(), 0.0) #bruce 060316 replaced old code with dragto (equivalent) jig_NewPt = self.dragto( self.jig_MovePt, event) # Print status bar msg indicating the current move offset. if 1: self.moveOffset = jig_NewPt - self.jig_StartPt msg = "Offset: [X: %.2f] [Y: %.2f] [Z: %.2f]" % (self.moveOffset[0], self.moveOffset[1], self.moveOffset[2]) env.history.statusbar_msg(msg) offset = jig_NewPt - self.jig_MovePt self.drag_selected_atoms(offset) self.drag_selected_jigs(offset) self.jig_MovePt = jig_NewPt self.current_obj_clicked = False # jig was dragged. self.o.gl_update() # == LMB double-click method def leftDouble(self, event): # mark 060126. """ Double click event handler for the left mouse button. @note: Also called for a triple click event. These can be distinguished using the flag self.glpane.tripleClick. """ self.ignore_next_leftUp_event = True if isinstance(self.obj_doubleclicked, Atom): if self.obj_doubleclicked.is_singlet(): self.singletLeftDouble() return else: self.atomLeftDouble() if isinstance(self.obj_doubleclicked, Bond): self.bondLeftDouble() if isinstance(self.obj_doubleclicked, Jig): self.jigLeftDouble() # == end of LMB event handler methods def update_cursor_for_no_MB(self): """ Update the cursor for 'Select Atoms' mode (SelectAtoms_GraphicsMode) """ ## print "SelectAtoms_GraphicsMode.update_cursor_for_no_MB(): button=",\ ## self.o.button, ", modkeys=", self.o.modkeys if self.w.selection_filter_enabled: self.update_cursor_for_no_MB_selection_filter_enabled() else: self.update_cursor_for_no_MB_selection_filter_disabled() def update_cursor_for_no_MB_selection_filter_disabled(self): """ Update the cursor for when the Selection Filter is disabled (default). """ if self.o.modkeys is None: self.o.setCursor(self.w.SelectAtomsCursor) elif self.o.modkeys == 'Shift': self.o.setCursor(self.w.SelectAtomsAddCursor) elif self.o.modkeys == 'Control': self.o.setCursor(self.w.SelectAtomsSubtractCursor) elif self.o.modkeys == 'Shift+Control': self.o.setCursor(self.w.DeleteCursor) else: print "Error in update_cursor_for_no_MB():"\ "Invalid modkey = ", self.o.modkeys return def update_cursor_for_no_MB_selection_filter_enabled(self): """ Update the cursor for when the Selection Filter is enabled. """ if self.o.modkeys is None: self.o.setCursor(self.w.SelectAtomsFilterCursor) elif self.o.modkeys == 'Shift': self.o.setCursor(self.w.SelectAtomsAddFilterCursor) elif self.o.modkeys == 'Control': self.o.setCursor(self.w.SelectAtomsSubtractFilterCursor) elif self.o.modkeys == 'Shift+Control': # Fixes bug 1604. mark 060303. self.o.setCursor(self.w.DeleteAtomsFilterCursor) else: print "Error in update_cursor_for_no_MB(): "\ "Invalid modkey = ", self.o.modkeys return def rightShiftDown(self, event): _superclass.rightShiftDown(self, event) self.o.setCursor(self.w.SelectAtomsCursor) def rightCntlDown(self, event): _superclass.rightCntlDown(self, event) self.o.setCursor(self.w.SelectAtomsCursor) def update_selatom(self, event, singOnly = False, resort_to_prior = True): """ Keep glpane.selatom up-to-date, as atom under mouse based on <event>; When <singOnly> is True, only keep singlets up-to-date. [not sure what that phrase means -- bruce 060726] Note: this method changes glpane.selatom but it never changes glpane.selobj. It is deprecated in favor of using update_selobj and glpane.selobj alone. When <resort_to_prior> is true (the default), then if selobj is not presently known, use the prior value; otherwise use None. (As of 071025 no callers change the default behavior.) Warning: glpane.selobj is not updated except by paintGL, and glpane.selatom is based on it, so after a mouse motion it will not become correct until after the next repaint. """ #bruce 050124 split this out of bareMotion so options can vary #bruce 071025 revised docstring, removed msg_about_click option glpane = self.o if event is None: # event (and thus its x,y position) is not known # [bruce 050612 added this possibility] known = False else: known = self.update_selobj(event) # this might do gl_update (but the paintGL triggered by that # only happens later!), # and (when it does) might not know the correct obj... # so it returns True iff it did know the correct obj (or None) to #store into glpane.selobj, False if not. assert known in [False, True], \ "known should be False or True, not %r" % (known,) # If not known, use None or use the prior one? This is up to the caller # since the best policy varies. Default is resort_to_prior = True since # some callers need this and I did not yet scan them all and fix them. # [bruce circa 050610] # Update: it might be that resort_to_prior = True is the only # correct value for any caller. Not sure. For now, leave in the code # for both ways. [bruce 071025] selobj = glpane.selobj if not known: if resort_to_prior: pass # stored one is what this says to use, and is what we'll # use ## print "resort_to_prior using",glpane.selobj # [this is rare, I guess since paintGL usually has time # to run after bareMotion before clicks] else: selobj = None oldselatom = glpane.selatom atm = selobj if not isinstance(atm, Atom): atm = None if atm is not None and (atm.element is Singlet or not singOnly): pass # we'll use this atm as the new selatom else: atm = None # otherwise we'll use None glpane.selatom = atm if glpane.selatom is not oldselatom: # update display (probably redundant with side effect of # update_selobj; ok if it is, and I'm not sure it always is #k) glpane.gl_update_highlight() # draws selatom too, since its chunk # is not hidden [comment might be obs, as of 050610] return # from update_selatom def update_selatom_and_selobj(self, event = None): #bruce 050705 """ update_selatom (or cause this to happen with next paintGL); return consistent pair (selatom, selobj); atom_debug warning if inconsistent """ #e should either use this more widely, or do it in selatom itself, #or convert entirely to using only selobj. self.update_selatom( event) # bruce 050612 added this -- #not needed before since bareMotion did it #(I guess). ##e It might be better to let set_selobj callback (NIM, but needed ##for sbar messages) keep it updated. # # See warnings about update_selatom's delayed effect, in its #docstring or in leftDown. [bruce 050705 comment] selatom = self.o.selatom selobj = self.o.selobj #bruce 050705 -- #e it might be better to use #selobj alone (selatom should be derived from it) if selatom is not None: if selobj is not selatom: if debug_flags.atom_debug: print "atom_debug: selobj %r not consistent with" \ "selatom %r -- using selobj = selatom" % (selobj, selatom) selobj = selatom # just for our return value, not changed in #GLPane (self.o) else: pass #e could check that selobj is reflected in selatom if an atom, #but might as well let update_selatom do that, #esp. since it behaves differently for singlets return selatom, selobj def get_real_atom_under_cursor(self, event): """ If the object under the cursor is a real atom, return it. Otherwise, return None. """ obj = self.get_obj_under_cursor(event) if isinstance(obj, Atom): if not obj.is_singlet(): return obj return None def set_selection_filter(self, enabled): """ Set/ Unset selection filter. Subclasses should override this @param: enabled: boolean that decides whether to turn selection filter on or off. """ #REVIEW: Need to be in SelectAtoms_basicCommand class? pass def delete_atom_and_baggage(self, event): """ If the object under the cursor is an atom, delete it and any baggage. Return the result of what happened. """ a = self.get_real_atom_under_cursor(event) if a is None: return None if a.filtered(): # mark 060304. # note: bruce 060331 thinks refusing to delete filtered atoms, #as this does, is a bad UI design; # fo details, see longer comment on similar code in #delete_at_event (ops_select.py). # (Though when highlighting is disabled, it's arguable that this #is more desirable than bad -- conceivably.) #bruce 060331 adding orangemsg, since we should warn user we didn't #do what they asked. msg = "Cannot delete " + str(a) + " since it is being filtered."\ " Hit Escape to clear the selection filter." env.history.message(orangemsg(msg)) return None a.deleteBaggage() result = "deleted %r" % a self.neighbors_of_last_deleted_atom = a.realNeighbors() a.kill() self.o.selatom = None #bruce 041130 precaution self.o.assy.changed() self.w.win_update() return result pass # == class SelectAtoms_GraphicsMode(SelectAtoms_basicGraphicsMode): """ @see: Select_GraphicsMode """ def __init__(self, command): self.command = command glpane = self.command.glpane SelectAtoms_basicGraphicsMode.__init__(self, glpane) return # (the rest would come from GraphicsMode if post-inheriting it worked, # or we could split it out of GraphicsMode as a post-mixin to use there # and here) def _get_commandSequencer(self): return self.command.commandSequencer commandSequencer = property( _get_commandSequencer) def set_cmdname(self, name): self.command.set_cmdname(name) return def _get_highlight_singlets(self): return self.command.highlight_singlets def _set_highlight_singlets(self, val): self.command.highlight_singlets = val highlight_singlets = property( _get_highlight_singlets, _set_highlight_singlets ) pass # end
NanoCAD-master
cad/src/commands/SelectAtoms/SelectAtoms_GraphicsMode.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ BuildAtoms_GraphicsMode.py The GraphicsMode part of the BuildAtoms_Command. It provides the graphicsMode object for its Command class. The GraphicsMode class defines anything related to the *3D Graphics Area* -- For example: - Anything related to graphics (Draw method), - Mouse events - Cursors, - Key bindings or context menu @version: $Id$ @copyright: 2004-2009 Nanorex, Inc. See LICENSE file for details. TODO: [as of 2008-01-04] - Items mentioned in Select_GraphicsMode.py - Some items mentioned in BuildAtoms_Command.py History: Originally as 'depositMode.py' by Josh Hall and then significantly modified by several developers. In January 2008, the old depositMode class was split into new Command and GraphicsMode parts and the these classes were moved into their own module [ See BuildAtoms_Command.py and BuildAtoms_GraphicsMode.py] """ import math from Numeric import dot from OpenGL.GL import GL_FALSE from OpenGL.GL import glDepthMask from OpenGL.GL import GL_TRUE from OpenGL.GL import GL_LIGHTING from OpenGL.GL import glColor4fv from OpenGL.GL import GL_BLEND from OpenGL.GL import GL_ONE_MINUS_SRC_ALPHA from OpenGL.GL import GL_SRC_ALPHA from OpenGL.GL import glBlendFunc from OpenGL.GL import glTranslatef from OpenGL.GL import glRotatef from OpenGL.GL import GL_QUADS from OpenGL.GL import glBegin from OpenGL.GL import glVertex from OpenGL.GL import glEnd from OpenGL.GL import glDisable from OpenGL.GL import glEnable from OpenGL.GL import glPushMatrix from OpenGL.GL import glPopMatrix from OpenGL.GLU import gluUnProject from PyQt4.Qt import Qt import foundation.env as env from utilities import debug_flags from platform_dependent.PlatformDependent import fix_plurals from model.chunk import Chunk from model.chem import Atom from model.elements import Singlet from geometry.VQT import Q, A, norm, twistor from graphics.drawing.CS_draw_primitives import drawline from foundation.Group import Group from foundation.Utility import Node from commands.Select.Select_GraphicsMode import DRAG_STICKINESS_LIMIT from graphics.behaviors.shape import get_selCurve_color from model.bonds import bond_atoms, bond_at_singlets from model.bond_constants import V_SINGLE from utilities.debug import print_compact_stack from utilities.constants import elemKeyTab from utilities.constants import diINVISIBLE from utilities.constants import diTUBES from model.bond_constants import btype_from_v6 from model.bond_constants import V_DOUBLE from model.bond_constants import V_GRAPHITE from model.bond_constants import V_TRIPLE from model.bond_constants import V_AROMATIC from utilities.prefs_constants import buildModeSelectAtomsOfDepositedObjEnabled_prefs_key from utilities.prefs_constants import buildModeWaterEnabled_prefs_key from utilities.Log import orangemsg, redmsg from commands.SelectAtoms.SelectAtoms_GraphicsMode import SelectAtoms_basicGraphicsMode _superclass = SelectAtoms_basicGraphicsMode class BuildAtoms_basicGraphicsMode(SelectAtoms_basicGraphicsMode): """ """ bondclick_v6 = None gridColor = 74/255.0, 186/255.0, 226/255.0 #Command will be set in BuildAtoms_GraphicsMode.__init__ . command = None def reset_drag_vars(self): # called in Enter and at start of (super's) leftDown _superclass.reset_drag_vars(self) self.pivot = None self.pivax = None self.line = None # endpoints of the white line drawn between the cursor and a bondpoint when # dragging a singlet. self.transdepositing = False # used to suppress multiple win_updates and history msgs when #trans-depositing. def getCoords(self, event): """ Retrieve the object coordinates of the point on the screen with window coordinates(int x, int y) """ # bruce 041207 comment: only called for BuildAtoms_GraphicsMode leftDown in empty # space, to decide where to place a newly deposited chunk. # So it's a bit weird that it calls findpick at all! # In fact, the caller has already called a similar method indirectly # via update_selatom on the same event. BUT, that search for atoms might # have used a smaller radius than we do here, so this call of findpick # might sometimes cause the depth of a new chunk to be the same as an # existing atom instead of at the water surface. So I will leave it # alone for now, until I have a chance to review it with Josh [bug 269]. # bruce 041214: it turns out it's intended, but only for atoms nearer # than the water! Awaiting another reply from Josh for details. # Until then, no changes and no reviews/bugfixes (eg for invisibles). # BTW this is now the only remaining call of findpick # [still true 060316]. # Best guess: this should ignore invisibles and be limited by water # and near clipping; but still use 2.0 radius. ###@@@ # bruce 041214 comment: this looks like an inlined mousepoints... # but in fact [060316 addendum] it shares initial code with mousepoints, # but not all of mousepoints's code, so it makes sense to leave it as a # separate code snippet for now. x = event.pos().x() y = self.o.height - event.pos().y() p1 = A(gluUnProject(x, y, 0.0)) p2 = A(gluUnProject(x, y, 1.0)) at = self.o.assy.findpick(p1,norm(p2-p1),2.0) if at: pnt = at.posn() else: pnt = - self.o.pov k = (dot(self.o.lineOfSight, pnt - p1) / dot(self.o.lineOfSight, p2 - p1)) return p1+k*(p2-p1) # always return a point on the line from p1 to p2 # == LMB event handling methods ==================================== def leftDouble(self, event): # mark 060126. """ Double click event handler for the left mouse button. """ self.ignore_next_leftUp_event = True # Fixes bug 1467. mark 060307. if self.cursor_over_when_LMB_pressed == 'Empty Space': if self.o.tripleClick: # Fixes bug 2568. mark 2007-10-21 return if self.o.modkeys != 'Shift+Control': # Fixes bug 1503. mark 060224. deposited_obj = self.deposit_from_MMKit(self.getCoords(event)) # does win_update(). if deposited_obj: self.set_cmdname('Deposit ' + deposited_obj) return _superclass.leftDouble(self, event) return # == end of LMB event handler methods #====KeyPress ================= def keyPress(self, key): for sym, code, num in elemKeyTab: # Set the atom type in the MMKit and combobox. if key == code: self.command.setElement(num) # = REVIEW: should we add a 'return' here, to prevent the # superclass from taking more actions from the same keyPress? #[bruce question 071012] # Pressing Escape does the following: # 1. If a Bond Tool or the Atom Selection Filter is enabled, # pressing Escape will activate the Atom Tool # and disable the Atom Selection Filter. The current selection remains #unchanged, however. # 2. If the Atom Tool is enabled and the Atom Selection Filter is # disabled, Escape will clear the # current selection (when it's handled by our superclass's # keyPress method). # Fixes bug (nfr) 1770. mark 060402 if key == Qt.Key_Escape and self.w.selection_filter_enabled: if hasattr(self.command, 'disable_selection_filter'): self.command.disable_selection_filter() return _superclass.keyPress(self, key) return def bond_change_type(self, b, allow_remake_bondpoints = True, suppress_history_message = False): #bruce 050727; revised 060703 """ Change bondtype of bond <b> to new bondtype determined by the dashboard (if allowed). @see: BuildAtoms_Command._convert_bonds_bet_selected_atoms() """ #This value is later changed based on what apply_btype_to_bond returns #the caller of this function can then use this further to determine #various things. #@see: BuildAtoms_Command._convert_bonds_bet_selected_atoms() bond_type_changed = True # renamed from clicked_on_bond() mark 060204. v6 = self.bondclick_v6 if v6 is not None: self.set_cmdname('Change Bond') btype = btype_from_v6( v6) from operations.bond_utils import apply_btype_to_bond bond_type_changed = apply_btype_to_bond( btype, b, allow_remake_bondpoints = allow_remake_bondpoints, suppress_history_message = suppress_history_message ) # checks whether btype is ok, and if so, new; emits history #message; does [#e or should do] needed invals/updates ###k not sure if that subr does gl_update when needed... this method ##does it, but not sure how # [or maybe only its caller does?] return bond_type_changed def bond_singlets(self, s1, s2): """ Bond singlets <s1> and <s2> unless they are the same singlet. """ #bruce 050429: it'd be nice to highlight the involved bonds and atoms, # too... # incl any existing bond between same atoms. (by overdraw, for speed, #or by more lines) ####@@@@ tryit #bruce 041119 split this out and added checks to fix bugs #203 # (for bonding atom to itself) and #121 (atoms already bonded). # I fixed 121 by doing nothing to already-bonded atoms, but in # the future we might want to make a double bond. #e if s1.singlet_neighbor() is s2.singlet_neighbor(): # this is a bug according to the subroutine [i.e. bond_at_singlets, #i later guess], but not to us print_error_details = 0 else: # for any other error, let subr print a bug report, # since we think we caught them all before calling it print_error_details = 1 flag, status = bond_at_singlets(s1, s2, move = False, \ print_error_details = print_error_details, increase_bond_order = True) # we ignore flag, which says whether it's ok, warning, or error env.history.message("%s: %s" % (self.command.get_featurename(), status)) return def setBond1(self, state): "Slot for Bond Tool Single button." self.setBond(V_SINGLE, state) def setBond2(self, state): "Slot for Bond Tool Double button." self.setBond(V_DOUBLE, state) def setBond3(self, state): "Slot for Bond Tool Triple button." self.setBond(V_TRIPLE, state ) def setBonda(self, state): "Slot for Bond Tool Aromatic button." self.setBond(V_AROMATIC, state) def setBondg(self, state): #mark 050831 "Slot for Bond Tool Graphitic button." self.setBond(V_GRAPHITE, state) def setBond(self, v6, state, button = None): """ #doc; v6 might be None, I guess, though this is not yet used """ if state: if self.bondclick_v6 == v6 and button is not None and v6 is not None: # turn it off when clicked twice -- BUG: this never happens, #maybe due to QButtonGroup.setExclusive behavior self.bondclick_v6 = None button.setChecked(False) # doesn't work? else: self.bondclick_v6 = v6 if self.bondclick_v6: name = btype_from_v6(self.bondclick_v6) env.history.statusbar_msg("click bonds to make them %s" % name) if self.command.propMgr: self.command.propMgr.updateMessage() # Mark 2007-06-01 else: # this never happens (as explained above) #####@@@@@ see also setAtom, which runs when Atom Tool is ##clicked (ideally this might run as well, but it doesn't) # (I'm guessing that self.bondclick_v6 is not relied on for # action effects -- maybe the button states are??) # [bruce 060702 comment] env.history.statusbar_msg(" ") # clicking bonds now does nothing ## print "turned it off" else: pass # print "toggled(false) for",btype_from_v6(v6) # happens for the one that was just on,unless you click sameone self.update_cursor() return #== Draw methods def Draw_other(self): """ @see: Draw_after_highlighting (draws water surface) """ _superclass.Draw_other(self) if self.line: color = get_selCurve_color(0, self.o.backgroundColor) # Make sure line color has good contrast with bg. [mark 060305] ### REVIEW: # this makes the line light orange (when bg is sky blue), # which is harder to see than the white it used to be. # [bruce 090310 comment] drawline(color, self.line[0], self.line[1]) # todo: if this is for a higher-order bond, draw differently pass return def Draw_after_highlighting(self, pickCheckOnly = False): #bruce 050610 # added pickCheckOnly arg. mark 060207. """ Do more drawing, after the main drawing code has completed its highlighting/stenciling for selobj.Caller will leave glstate in standard form for Draw. Implems are free to turn off depth buffer read or write. Warning: anything implems do to depth or stencil buffers will affect the standard selobj-check in bareMotion. [New method in mode API as of bruce 050610. General form not yet defined -- just a hack for Build mode's water surface. Could be used for transparent drawing in general.] """ res = _superclass.Draw_after_highlighting(self, pickCheckOnly) #Draw possible other translucent objects. [huaicai 9/28/05] glDepthMask(GL_FALSE) # disable writing the depth buffer, so bareMotion selobj check measures depths behind it, # so it can more reliably compare them to water's constant depth. (This way, roundoff errors # only matter where the model hits the water surface, rather than over all the visible # water surface.) # (Note: before bruce 050608, depth buffer remained writable here -- untypical for transparent drawing, # but ok then, since water was drawn last and bareMotion had no depth-buffer pixel check.) self.surface() glDepthMask(GL_TRUE) return res def surface(self): """ Draw the water's surface -- a sketch plane to indicate where the new atoms will sit by default, which also prevents (some kinds of) selection of objects behind it. """ if not env.prefs[buildModeWaterEnabled_prefs_key]: return glDisable(GL_LIGHTING) glColor4fv(self.gridColor + (0.6,)) ##e bruce 050615 comment: if this equalled bgcolor, some bugs would go away; # we'd still want to correct the surface-size to properly fit the window (bug 264, just now fixed below), # but the flicker to bgcolor bug (bug number?) would be gone (defined and effective bgcolor would be same). # And that would make sense in principle, too -- the water surface would be like a finite amount of fog, # concentrated into a single plane. glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) # the grid is in eyespace glPushMatrix() q = self.o.quat glTranslatef(-self.o.pov[0], -self.o.pov[1], -self.o.pov[2]) glRotatef(- q.angle*180.0/math.pi, q.x, q.y, q.z) ## # The following is wrong for wide windows (bug 264). ## # To fix it requires looking at how scale is set (differently ## # and perhaps wrongly (related to bug 239) for tall windows), ## # so I'll do it later, after fixing bug 239. ## # Warning: correctness of use of x vs y below has not been verified. ## # [bruce 041214] ###@@@ ## # ... but for Alpha let's just do a quick fix by replacing 1.5 by 4.0. ## # This should work except for very wide (or tall??) windows. ## # [bruce 050120] ## ## ## x = y = 4.0 * self.o.scale # was 1.5 before bruce 050120; still a kluge #bruce 050615 to fix bug 264 (finally! but it will only last until someone changes what self.o.scale means...): # here are presumably correct values for the screen boundaries in this "plane of center of view": y = self.o.scale # always fits height, regardless of aspect ratio (as of 050615 anyway) x = y * (self.o.width + 0.0) / self.o.height # (#e Ideally these would be glpane attrs so we wouldn't have to know how to compute them here.) # By test, these seem exactly right (tested as above and after x,y *= 0.95), # but for robustness (in case of roundoff errors restoring eyespace matrices) # I'll add an arbitrary fudge factor (both small and overkill at the same time!): x *= 1.1 y *= 1.1 x += 5 y += 5 glBegin(GL_QUADS) glVertex(-x,-y,0) glVertex(x,-y,0) glVertex(x,y,0) glVertex(-x,y,0) glEnd() glPopMatrix() glDisable(GL_BLEND) glEnable(GL_LIGHTING) return # == Singlet helper methods def singletLeftDown(self, s, event): if self.o.modkeys == 'Shift+Control': self.cursor_over_when_LMB_pressed = 'Empty Space' self.select_2d_region(event) else: self.cursor_over_when_LMB_pressed = 'Singlet' self.singletSetup(s) def singletSetup(self, a): """ Setup for a click, double-click or drag event for singlet <a>. """ self.objectSetup(a) self.only_highlight_singlets = True self.singlet_list = self.o.assy.getConnectedSinglets([a]) # get list of all singlets that we can reach from any sequence of bonds to <a>. # used in doubleLeft() if the user clicks on # note: it appears that self.singlet_list is never used, tho another routine computes it # locally under the same name and uses that. [bruce 070411 comment, examining Qt3 branch] pivatom = a.neighbors()[0] self.baggage, self.nonbaggage = pivatom.baggage_and_other_neighbors() #bruce 051209 neigh = self.nonbaggage self.baggage.remove(a) # always works since singlets are always baggage if neigh: if len(neigh)==2: self.pivot = pivatom.posn() self.pivax = norm(neigh[0].posn()-neigh[1].posn()) self.baggage = [] #####@@@@@ revise nonbaggage too?? #bruce suspects this might be a bug, looks like it prevents other singlets from moving, eg in -CX2- drag X elif len(neigh)>2: self.pivot = None self.pivax = None self.baggage = []#####@@@@@ revise nonbaggage too?? else: # atom on a single stalk self.pivot = pivatom.posn() self.pivax = norm(self.pivot-neigh[0].posn()) else: # no non-baggage neighbors self.pivot = pivatom.posn() self.pivax = None def singletDrag(self, bondpoint, event): """ Drag a bondpoint. @param bondpoint: a bondpoint to drag @type bondpoint: some instances of class Atom @param event: a drag event """ if bondpoint.element is not Singlet: return apos0 = bondpoint.posn() px = self.dragto_with_offset(bondpoint.posn(), event, self.drag_offset ) #bruce 060316 attempt to fix bug 1474 analogue; # untested and incomplete since nothing is setting drag_offset # when this is called (except to its default value V(0,0,0))! if self.pivax: # continue pivoting around an axis quat = twistor(self.pivax, bondpoint.posn() - self.pivot, px - self.pivot) for at in [bondpoint] + self.baggage: at.setposn(quat.rot(at.posn() - self.pivot) + self.pivot) elif self.pivot: # continue pivoting around a point quat = Q(bondpoint.posn() - self.pivot, px - self.pivot) for at in [bondpoint] + self.baggage: at.setposn(quat.rot(at.posn() - self.pivot) + self.pivot) # highlight bondpoints we might bond this one to self.update_selatom(event, singOnly = True) #bruce 051209: to fix an old bug, don't call update_selatom # when dragging a real atom -- only call it here in this method, # when dragging a bondpoint. (Related: see warnings about # update_selatom's delayed effect, in its docstring or in leftDown.) # Q: when dragging a real atom, in some other method, # do we need to reset selatom instead? # [bruce 071025 rewrote that comment for its new context and for # clarity, inferring meaning from other code & comments here; # also rewrote the old comments below, in this method] #bruce 060726 question: why does trying singOnly = False here # have no visible effect? The only highlightings during drag # are the singlets, and real atoms that have singlets. # Where is the cause of this? I can't find any code resetting # selobj then. The code in update_selatom also looks like it # won't refrain from storing anything in selobj, based on # singOnly -- this only affects what it stores in selatom. # [later, 071025: wait, I thought it never stored anything in # selobj at all. Is its doc wrong, does it call update_selobj # and do that?] # Guesses about what code could be doing that (REVIEW): # selobj_still_ok? hicolor/selobj_highlight_color? # Also, note that not all drag methods call update_selobj at all. # (I think they then leave the old selobj highlighted -- # dragging a real atom seems to do that.) # # My motivations for wanting to understand this: a need to let # self.drag_handler control what gets highlighted (and its color), # and unexplained behavior of testdraw.py after leftDown. # update the endpoints of the white rubberband line self.line = [bondpoint.posn(), px] apos1 = bondpoint.posn() if apos1 - apos0: msg = "pulling bondpoint %r to %s" % (bondpoint, self.posn_str(bondpoint)) this_drag_id = (self.current_obj_start, self.__class__.leftDrag) env.history.message(msg, transient_id = this_drag_id) self.o.gl_update() return def singletLeftUp(self, s1, event): """ Finish operation on singlet <s1> based on where the cursor is when the LMB was released: - If the cursor is still on <s1>, deposit an object from the MMKit on it [or as of 060702, use a bond type changing tool if one is active, to fix bug 833 item 1 ###implem unfinished?] - If the cursor is over a different singlet, bond <s1> to it. - If the cursor is over empty space, do nothing. <event> is a LMB release event. @see:self._singletLeftUp_joinDnaStrands() """ self.line = None # required to erase white rubberband line on next # gl_update. [bruce 070413 moved this before tests] if not s1.is_singlet(): return if len(s1.bonds) != 1: return #bruce 070413 precaution neighbor = s1.singlet_neighbor() s2 = self.get_singlet_under_cursor( event, reaction_from = neighbor.element.symbol, desired_open_bond_direction = s1.bonds[0].bond_direction_from(s1) #bruce 080403 bugfix ) ####@@@@ POSSIBLE BUG: s2 is not deterministic if cursor is over a ##real atom w/ >1 singlets (see its docstring); # this may lead to bond type changer on singlet sometimes but not # always working, if cursor goes up over its base atom; or it may #lead to nondeterministic remaining bondpoint # position or bondorder when bonding s1 to another atom. # When it doesn't work (for bond type changer), it'll try to # create a bond between singlets on the same base atom; the code # below indicates it won't really do it, but may erroneously # set_cmdname then (but if nothing changes this may not cause a bug # in Undo menu text). # I tried to demo the basic bug (sometime-failure of bond type # changer) but forgot to activate that tool. # But I found that debug prints and behavior make it look like # something prevents highlighting s1's base atom, # [later: presumably that was the only_highlight_singlets feature] # but permits highlighting of other real atoms, during s1's drag. # Even if that means this bug can't happen, the code needs to be # clarified. [bruce 060721 comment] #update 080403: see also new desired_open_bond_direction code in # get_singlet_under_cursor. if s2: if s2 is s1: # If the same singlet is highlighted... if self.command.isBondsToolActive(): #bruce 060702 fix bug 833 item 1 (see also bondLeftUp) b = s1.bonds[0] self.bond_change_type(b, allow_remake_bondpoints = False) # does set_cmdname self.o.gl_update() # (probably good for highlighting, even # if bond_change_type refused) # REVIEW (possible optim): can we use gl_update_highlight # when only highlighting was changed? [bruce 070626] else: # ...deposit an object (atom, chunk or library part) from # MMKit on the singlet <s1>. if self.mouse_within_stickiness_limit( event, DRAG_STICKINESS_LIMIT): # Fixes bug 1448. mark 060301. deposited_obj = self.deposit_from_MMKit(s1) # does its own win_update(). if deposited_obj: self.set_cmdname('Deposit ' + deposited_obj) else: # A different singlet is highlighted... # If the singlets s1 & s2 are 3' and 5' or 5' and 3' bondpoints # of DNA strands, merge their strand chunks... open_bond1 = s1.bonds[0] open_bond2 = s2.bonds[0] # Cannot DND 3' open bonds onto 3' open bonds. if open_bond1.isThreePrimeOpenBond() and \ open_bond2.isThreePrimeOpenBond(): if self.command.propMgr: msg = redmsg("Cannot join strands on 3' ends.") self.command.propMgr.updateMessage(msg) return # Cannot DND 5' open bonds onto 5' open bonds. if open_bond1.isFivePrimeOpenBond() and \ open_bond2.isFivePrimeOpenBond(): if self.command.propMgr: msg = redmsg("Cannot join strands on 5' ends.") self.command.propMgr.updateMessage(msg) return # Ok to DND 3' onto 5' or 5' onto 3'. if (open_bond1.isThreePrimeOpenBond() and \ open_bond2.isFivePrimeOpenBond()) or \ (open_bond1.isFivePrimeOpenBond() and \ open_bond2.isThreePrimeOpenBond()): self._singletLeftUp_joinDnaStrands(s1,s2, open_bond1, open_bond2) return #don't proceed further # ... now bond the highlighted singlet <s2> to the first # singlet <s1> self.bond_singlets(s1, s2) self.set_cmdname('Create Bond') self.o.gl_update() if self.command.propMgr: self.command.propMgr.updateMessage() else: # cursor on empty space self.o.gl_update() # get rid of white rubber band line. # REVIEW (possible optim): can we make # gl_update_highlight cover this? [bruce 070626] self.only_highlight_singlets = False def _singletLeftUp_joinDnaStrands(self, s1, s2, open_bond1, open_bond2 ): """ Only to be called from self.singletLeftUp """ #This was split out of self.singletLeftUp() # Ok to DND 3' onto 5' or 5' onto 3' . We already check the #if condition in self if (open_bond1.isThreePrimeOpenBond() and \ open_bond2.isFivePrimeOpenBond()) or \ (open_bond1.isFivePrimeOpenBond() and \ open_bond2.isThreePrimeOpenBond()): a1 = open_bond1.other(s1) a2 = open_bond2.other(s2) # We rely on merge() to check that mols are not the same. # merge also results in making the strand colors the same. #The following fixes bug 2770 #Set the color of the whole dna strandGroup to the color of the #strand, whose bondpoint, is dropped over to the bondboint of the #other strandchunk (thus joining the two strands together into #a single dna strand group) - Ninad 2008-04-09 color = a1.molecule.color if color is None: color = a1.element.color strandGroup1 = a1.molecule.parent_node_of_class(self.win.assy.DnaStrand) #Temporary fix for bug 2829 that Damian reported. #Bruce is planning to fix the underlying bug in the dna updater #code. Once its fixed, The following block of code under #"if DEBUG_BUG_2829" can be deleted -- Ninad 2008-05-01 DEBUG_BUG_2829 = True if DEBUG_BUG_2829: strandGroup2 = a2.molecule.parent_node_of_class( self.win.assy.DnaStrand) if strandGroup2 is not None: #set the strand color of strandGroup2 to the one for #strandGroup1. strandGroup2.setStrandColor(color) strandChunkList = strandGroup2.getStrandChunks() for c in strandChunkList: if hasattr(c, 'invalidate_ladder'): c.invalidate_ladder() if not DEBUG_BUG_2829: #merging molecules is not required if you invalidate the ladders #in DEBUG_BUG_2829 block a1.molecule.merge(a2.molecule) # ... now bond the highlighted singlet <s2> to the first # singlet <s1> self.bond_singlets(s1, s2) if not DEBUG_BUG_2829: #No need to call update_parts() if you invalidate ladders #of strandGroup2 as done in DEBUG_BUG_2829 fix (Tested) #Run the dna updater -- important to do it otherwise it won't update #the whole strand group color self.win.assy.update_parts() self.set_cmdname('Create Bond') if strandGroup1 is not None: strandGroup1.setStrandColor(color) self.o.gl_update() if self.command.propMgr: self.command.propMgr.updateMessage() self.only_highlight_singlets = False return def get_singlet_under_cursor(self, event, reaction_from = None, desired_open_bond_direction = 0 ): """ If the object under the cursor is a singlet, return it. If the object under the cursor is a real atom with one or more singlets, return one of its singlets, preferring one with the desired_open_bond_direction (measured from base atom to singlet) if it's necessary to choose. Otherwise, return None. """ del reaction_from # not yet used atom = self.get_obj_under_cursor(event) if isinstance(atom, Atom): if atom.is_singlet(): return atom # Update, bruce 071121, about returning singlets bonded to real # atoms under the cursor, but not themselves under it: # Note that this method affects what happens # on leftup, but is not used to determine what gets highlighted # during mouse motion. A comment below mentions that # selobj_highlight_color is related to that. It looks like it has # code for this in SelectAtoms_Command._getAtomHighlightColor. # There is also a call # to update_selatom with singOnly = True, which doesn't have this # special case for non-bondpoints, but I don't know whether it's # related to what happens here. # All this may or may not relate to bug 2587. #update, bruce 080320: removed nonworking code that used # element symbols 'Pl' and 'Sh' (with no '5' appended). # (Obsolete element symbols may also appear elsewhere in *Mode.py.) # #revised, bruce 080403 (bugfix): use desired_open_bond_direction # to choose the best bondpoint to return. candidates = [] for bond in atom.bonds: other = bond.other(atom) if other.is_singlet(): dir_to_other = bond.bond_direction_from(atom) # -1, 0, or 1 badness = abs(desired_open_bond_direction - dir_to_other) # this means: for directional bond-source, # prefer same direction, then none, then opposite. # for non-directional source, prefer no direction, then either direction. # But we'd rather be deterministic, so in latter case we'll prefer # direction -1 to 1, accomplished by including dir_to_other in badness: badness = (badness, dir_to_other) candidates.append( (badness, other.key, other) ) # include key to sort more deterministically continue if candidates: candidates.sort() return candidates[0][-1] # least badness pass ## if atom.singNeighbors(): ## if len(atom.singNeighbors()) > 1: ## if env.debug(): ## #bruce 060721, cond revised 071121, text revised 080403 ## print "debug warning: get_singlet_under_cursor returning an arbitrary bondpoint of %r" % (atom,) ## return atom.singNeighbors()[0] return None #========== def _createBond(self, s1, a1, s2, a2): """ Create bond between atom <a1> and atom <a2>, <s1> and <s2> are their singlets. No rotation/movement involved. """ # Based on method actually_bond() in bonds.py--[Huaicai 8/25/05] ### REVIEW: the code this is based on has, since then, been modified -- # perhaps bugfixed, perhaps just cleaned up. This code ought to be fixed # in the same way, or (better) common helper code factored out and used. # Not urgent, but keep in mind if this code might have any bugs. # [bruce 080320 comment] try: # use old code until new code works and unless new code is needed; # CHANGE THIS SOON #####@@@@@ v1, v2 = s1.singlet_v6(), s2.singlet_v6() # new code available assert v1 != V_SINGLE or v2 != V_SINGLE # new code needed except: # old code can be used for now s1.kill() s2.kill() bond_atoms(a1,a2) return vnew = min(v1, v2) bond = bond_atoms(a1, a2, vnew, s1, s2) # tell it the singlets to replace or # reduce; let this do everything now, incl updates return def transdepositPreviewedItem(self, singlet): """ Trans-deposit the current object in the preview groupbox of the property manager on all singlets reachable through any sequence of bonds to the singlet <singlet>. """ if not singlet.is_singlet(): return singlet_list = self.o.assy.getConnectedSinglets([singlet]) modkeys = self.o.modkeys # save the modkeys state if self.o.modkeys is None and \ env.prefs[buildModeSelectAtomsOfDepositedObjEnabled_prefs_key]: # Needed when 'Select Atoms of Deposited Object' pref is enabled. # mark 060314. self.o.modkeys = 'Shift' self.o.assy.unpickall_in_GLPane() # [was unpickatoms; this (including Nodes) might be an # undesirable change -- bruce 060721] self.transdepositing = True nobjs = 0 ntried = 0 msg_deposited_obj = None for s in singlet_list: # singlet_list built in singletSetup() #[not true; is that a bug?? bruce 060412 question] if not s.killed(): # takes care of self.obj_doubleclicked, too. deposited_obj = self.deposit_from_MMKit(s) ntried += 1 if deposited_obj is not None: #bruce 060412 -- fix part of bug 1677 # -- wrong histmsg 'Nothing Transdeposited' and lack of # mt_update msg_deposited_obj = deposited_obj # I think these will all be the same, so we just use the # last one nobjs += 1 self.transdepositing = False self.o.modkeys = modkeys # restore the modkeys state to real state. del deposited_obj if msg_deposited_obj is None: # Let user know nothing was trandeposited. Fixes bug 1678. # mark 060314. # (This was incorrect in bug 1677 since it assumed all deposited_obj # return values were the same, # but in that bug (as one of several problems in it) the first # retval was not None but the last one was,so this caused a wrong # message and a failure to update the MT. Fixed those parts of # bug 1677 by introducing msg_deposited_obj and using that here # instead of deposited_obj. Fixed other parts of it # in MMKit and elsewhere in this method. [bruce 060412]) env.history.message('Nothing Transdeposited') return self.set_cmdname('Transdeposit ' + msg_deposited_obj) msg_deposited_obj += '(s)' info = fix_plurals( "%d %s deposited." % (nobjs, msg_deposited_obj) ) if ntried > nobjs: # Note 1: this will be true in bug 1677 (until it's entirely fixed) # [bruce 060412] # Note 2: this code was tested and worked, before I fully fixed # bug 1677; # now that bug is fully fixed above (in the same commit as this # code), # so this code is not known to ever run, # but I'll leave it in in case it mitigates any undiscovered bugs. info += " (%d not deposited due to a bug)" % (ntried - nobjs) info = orangemsg(info) env.history.message(info) self.w.win_update() #=======Deposit Atom helper methods def deposit_from_MMKit(self, atom_or_pos): #mark circa 051200; revised by bruce 051227 """ Deposit a new object based on the current selection in the MMKit/dashboard, which is either an atom, a chunk on the clipboard, or a part from the library. If 'atom_or_pos' is a singlet, then it will bond the object to that singlet if it can. If 'atom_or_pos' is a position, then it will deposit the object at that coordinate. Return string <deposited_obj>, where: 'Atoms' - an atom from the Atoms page was deposited. 'Chunk' - a chunk from the Clipboard page was deposited. 'Part' - a library part from the Library page was deposited. Note: This is overridden in some subclasses (e.g. PasteFromClipboard_Command, PartLibrary_Command), but the default implementation is also still used [as of 071025]. """ deposited_obj = None #& deposited_obj is probably misnamed, since it is a string, not an object. #& Would be nice if this could be an object. Problem is that clipboard and library #& both deposit chunks. mark 060314. # no Shift or Ctrl modifier key , also make sure that 'selection lock' #is not ON. if self.o.modkeys is None and not self.selection_locked(): self.o.assy.unpickall_in_GLPane() # Clear selection. [was unpickatoms -- bruce 060721] if self.w.depositState == 'Atoms': deposited_stuff, status = self.deposit_from_Atoms_page(atom_or_pos) # deposited_stuff is a chunk deposited_obj = 'Atom' else: print_compact_stack('Invalid depositState = "' + str(self.w.depositState) + '" ') return self.o.selatom = None ##k could this be moved earlier, or does one of those submethods use it? [bruce 051227 question] # now fix bug 229 part B (as called in comment #2), # by making this new chunk (or perhaps multiple chunks, in # deposited_stuff) visible if it otherwise would not be. # [bruce 051227 is extending this fix to depositing Library parts, whose # initial implementation reinstated the bug. # Note, Mark says the following comment is in 2 places but I can't find # the other place, so not removing it yet.] ## We now have bug 229 again when we deposit a library part while in ##"invisible" display mode. ## Ninad is reopening bug 229 and assigning it to me. This comment is ##in 2 places. Mark 051214. ##if not library_part_deposited: ##Added the condition [Huaicai 8/26/05] [bruce 051227 removed it, ##added a different one] if self.transdepositing: if not deposited_stuff: # Nothing was transdeposited. Needed to fix bug 1678. #mark 060314. return None return deposited_obj if deposited_stuff: self.w.win_update() #& should we differentimate b/w win_update (when deposited_stuff #is a new chunk added) vs. #& gl_update (when deposited_stuff is added to existing chunk). #Discuss with Bruce. mark 060210. status = self.ensure_visible( deposited_stuff, status) #bruce 041207 env.history.message(status) else: env.history.message(orangemsg(status)) # nothing deposited return deposited_obj def deposit_from_Atoms_page(self, atom_or_pos): """ Deposits an atom of the selected atom type from the MMKit Atoms page, or the Clipboard (atom and hybridtype) comboboxes on the dashboard, which are the same atom. If 'atom_or_pos' is a singlet, bond the atom to the singlet. Otherwise, set up the atom at position 'atom_or_pos' to be dragged around. Returns (chunk, status) """ assert hasattr(self.command, 'pastable_atomtype') atype = self.command.pastable_atomtype() # Type of atom to deposit if isinstance(atom_or_pos, Atom): a = atom_or_pos if a.element is Singlet: # bond an atom of type atype to the singlet a0 = a.singlet_neighbor() # do this before <a> (the singlet) #is killed!(revised by bruce 050511) # if 1: # during devel, at least from commands.BuildAtoms.build_utils import AtomTypeDepositionTool deptool = AtomTypeDepositionTool( atype) if hasattr(self.command, 'isAutoBondingEnabled'): autobond = self.command.isAutoBondingEnabled() else: # we're presumably a subclass with no propMgr or # a different one autobond = True a1, desc = deptool.attach_to(a, autobond = autobond) #e this might need to take over the generation of the #following status msg... ## a1, desc = self.attach(el, a) if a1 is not None: if self.pickit(): a1.pick() #self.o.gl_update() #bruce 050510 moved this here from #inside what's now deptool. The only callers, # deposit_from_MMKit() and transdepositPreviewedItem() are #responsible for callinggl_update()/win_update(). #mark 060314. status = "replaced bondpoint on %r with new atom %s at %s" % (a0, desc, self.posn_str(a1)) chunk = a1.molecule #bruce 041207 else: status = desc chunk = None #bruce 041207 del a1, desc else: # Deposit atom at the cursor position and prep it for dragging cursorPos = atom_or_pos a = self.o.assy.make_Atom_and_bondpoints(atype.element, cursorPos, atomtype = atype ) self.o.selatom = a self.objectSetup(a) self.baggage, self.nonbaggage = a.baggage_and_other_neighbors() if self.pickit(): self.o.selatom.pick() status = "made new atom %r at %s" % (self.o.selatom, self.posn_str(self.o.selatom)) chunk = self.o.selatom.molecule #bruce 041207 return chunk, status def ensure_visible(self, stuff, status): """ If any chunk in stuff (a node, or a list of nodes) is not visible now, make it visible by changing its display mode, and append a warning about this to the given status message, which is returned whether or not it's modified. Suggested revision: if some chunks in a library part are explicitly invisible and some are visible, I suspect this behavior is wrong and it might be better to require only that some of them are visible, and/or to only do this when overall display mode was visible. [bruce 051227] Suggested revision: maybe the default display mode for deposited stuff should also be user-settable. [bruce 051227] """ # By bruce 041207, to fix bug 229 part B (as called in comment #2), # by making each deposited chunk visible if it otherwise would not be. # Note that the chunk is now (usually?) the entire newly deposited # thing, but after future planned changes to the code, it might instead # be a preexisting chunk which was extended. Either way, we'll make the # entire chunk visible if it's not. #bruce 051227 revising this to handle more general deposited_stuff, #for deposited library parts. n = self.ensure_visible_0( stuff) if n: status += " (warning: gave it Tubes display mode)" #k is "it" correct even for library parts? even when not all #deposited chunks were changed? return status def ensure_visible_0(self, stuff): """ [private recursive worker method for ensure_visible; returns number of things whose display mode was modified] """ if not stuff: return 0 #k can this happen? I think so, #since old code could handle it. [bruce] if isinstance(stuff, Chunk): chunk = stuff if chunk.get_dispdef(self.o) == diINVISIBLE: # Build mode's own default display mode-- chunk.setDisplayStyle(diTUBES) return 1 return 0 elif isinstance(stuff, Group): return self.ensure_visible_0( stuff.members) elif isinstance(stuff, type([])): res = 0 for m in stuff: res += self.ensure_visible_0( m) return res else: assert isinstance(stuff, Node) # presumably Jig ##e not sure how to handle this or whether we need to ##[bruce 051227]; leave it out and await bug report? # [this will definitely occur once there's a partlib part which # deposits a Jig or Comment or Named View; # for Jigs should it Unhide them? For that matter, what about for # Chunks? What if the hiddenness or invisibility came from the #partlib?] if debug_flags.atom_debug: print "atom_debug: ignoring object of unhandled type (Jig? Comment? Named View?) in ensure_visible_0", stuff return 0 pass def pickit(self): """ Determines if the a deposited object should have its atoms automatically picked. Returns True or False based on the current modkey state. If modkey is None (no modkey is pressed), it will unpick all currently picked atoms. """ if self.selection_locked(): return False if self.o.modkeys is None: self.o.assy.unpickall_in_GLPane() # [was unpickatoms; this is a guess, #I didn't review the calls -- bruce 060721] if env.prefs[buildModeSelectAtomsOfDepositedObjEnabled_prefs_key]: # Added NFR 1504. mark 060304. return True return False if self.o.modkeys == 'Shift': return True if self.o.modkeys == 'Control': return False else: # Delete return False #===HotSpot related methods def setHotSpot_clipitem(self): #bruce 050416; duplicates some code from setHotSpot_mainPart """ Set or change hotspot of a chunk in the clipboard """ selatom = self.o.selatom if selatom and selatom.element is Singlet: selatom.molecule.set_hotspot( selatom) ###e add history message?? self.o.set_selobj(None) #bruce 050614-b: fix bug703-related older #bug (need to move mouse to see new-hotspot color) self.o.gl_update() #bruce 050614-a: fix bug 703 (also required #having hotspot-drawing code in chunk.py ignore selatom) # REVIEW (possible optim): can gl_update_highlight cover this? # It doesn't now cover chunk.selatom drawing, # but (1) it could be made to do so, and (2) we're not always #drawing chunk.selatom anyway. [bruce 070626] ###e also set this as the pastable?? return def setHotSpot_mainPart(self): """ Set hotspot on a main part chunk and copy it (with that hotspot) into clipboard """ # revised 041124 to fix bug 169, by mark and then by bruce selatom = self.o.selatom if selatom and selatom.element is Singlet: selatom.molecule.set_hotspot( selatom) new = selatom.molecule.copy_single_chunk(None) # None means no dad yet #bruce 050531 removing centering: ## new.move(-new.center) # perhaps no longer needed [bruce 041206] # now add new to the clipboard # bruce 041124 change: add new after the other members, not before. # [bruce 050121 adds: see cvs for history (removed today from this # code)of how this code changed as the storage order of # Group.members changed(but out of sync,so that bugs often existed)] self.o.assy.shelf.addchild(new) # adds at the end self.o.assy.update_parts() # bruce 050316; needed when adding clipboard items. # bruce 050121 don't change selection anymore; it causes too many # bugs to have clipboard items selected. Once my new model tree code # is committed, we could do this again and/or highlight the pastable # there in some other way. ##self.o.assy.shelf.unpick() # unpicks all shelf items too ##new.pick() #Keep the depositState to 'Atoms'. Earlier the depositState was #changed to 'Clipboard' because 'Set hotspot and copy' used to #open the clipboard tab in the 'MMKit'. This implementation has #been replaced with a separate 'Paste Mode' to handle Pasting #components. So always keep depositState to Atoms while in #BuildAtoms_GraphicsMode. (this needs further cleanup) -- ninad 2007-09-04 self.w.depositState = 'Atoms' self.w.mt.mt_update() # since clipboard changed #bruce 050614 comment: in spite of bug 703 # (fixed in setHotSpot_mainPart), # I don't think we need gl_update now in this method, # since I don't think main glpane shows hotspots and since the # user's intention here is mainly to make one in the clipboard copy, # not in the main model; and in case it's slow, we shouldn't # repaint if we don't need to.Evidently I thought the same thing in # this prior comment, when I removed a glpane update # (this might date from before hotspots were ever visible # -- not sure): ## also update glpane if we show pastable someday; not needed now ## [and removed by bruce 050121] return # cursor update methods def update_cursor_for_no_MB_selection_filter_disabled(self): """ Update the cursor for 'Build Atoms' mode, when no mouse button is pressed. """ cursor_id = 0 if hasattr(self.w, "current_bondtool_button") and \ self.w.current_bondtool_button is not None: cursor_id = self.w.current_bondtool_button.index if hasattr(self.command, 'get_cursor_id_for_active_tool' ): cursor_id = self.command.get_cursor_id_for_active_tool() if self.o.modkeys is None: self.o.setCursor(self.w.BondToolCursor[cursor_id]) elif self.o.modkeys == 'Shift': self.o.setCursor(self.w.BondToolAddCursor[cursor_id]) elif self.o.modkeys == 'Control': self.o.setCursor(self.w.BondToolSubtractCursor[cursor_id]) elif self.o.modkeys == 'Shift+Control': self.o.setCursor(self.w.DeleteCursor) else: print "Error in update_cursor_for_no_MB(): Invalid modkey=", self.o.modkeys return class BuildAtoms_GraphicsMode(BuildAtoms_basicGraphicsMode): """ @see: SelectAtoms_GraphicsMode """ ##### START of code copied from SelectAtoms_GraphicsMode (except that the ##### superclass name is different. def __init__(self, command): self.command = command glpane = self.command.glpane BuildAtoms_basicGraphicsMode.__init__(self, glpane) return # (the rest would come from GraphicsMode if post-inheriting it worked, # or we could split it out of GraphicsMode as a post-mixin to use there # and here) def _get_commandSequencer(self): return self.command.commandSequencer commandSequencer = property(_get_commandSequencer) def set_cmdname(self, name): self.command.set_cmdname(name) return def _get_highlight_singlets(self): return self.command.highlight_singlets def _set_highlight_singlets(self, val): self.command.highlight_singlets = val highlight_singlets = property(_get_highlight_singlets, _set_highlight_singlets) ##### END of code copied from SelectAtoms_GraphicsCommand
NanoCAD-master
cad/src/commands/BuildAtoms/BuildAtoms_GraphicsMode.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version: $Id$ History: 2008-07-30: Created to refactor Build Atoms command (currently called BuildAtoms_Command). TODO: - Classes created to refactor BuildAtoms_Command to be revised further. - document - REVIEW: _reusePropMgr_of_parentCommand -- this is an experimental method that will fit in the NEW command API (2008-07-30) . to be revised/ renamed. e.g. command_reuse_PM etc. - Update methods (e.g. self.propMgr.updateMessage() need to be called by a central method such as command_update_* or PM._update_UI_*. """ from commands.BuildAtoms.BuildAtoms_Command import BuildAtoms_Command from model.bond_constants import V_SINGLE, V_DOUBLE, V_TRIPLE, V_AROMATIC, V_CARBOMERIC, V_GRAPHITE from utilities.constants import CL_SUBCOMMAND _superclass = BuildAtoms_Command class AtomsTool_Command(BuildAtoms_Command): FlyoutToolbar_class = None featurename = 'Build Atoms Mode/AtomsTool' commandName = 'ATOMS_TOOL' command_should_resume_prevMode = False command_has_its_own_PM = False currentActiveTool = 'ATOMS_TOOL' #class constants for the NEW COMMAND API -- 2008-07-30 command_level = CL_SUBCOMMAND command_parent = 'DEPOSIT' #TEMPORARILY override the is*ToolActive methods in BuildAtoms_Command. #These methods will go away when BuildAtoms command starts treating #each tool as a subcommand. def isAtomsToolActive(self): """ Tells whether the Atoms Tool is active (boolean) """ return True def isBondsToolActive(self): """ Tells whether the Bonds Tool is active (boolean) """ return False def isDeletBondsToolActive(self): """ Tells whether the Delete Bonds Tool is active (boolean) """ return False
NanoCAD-master
cad/src/commands/BuildAtoms/AtomsTool_Command.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ Ui_BuildAtomsPropertyManager.py The Ui_BuildAtomsPropertyManager class defines UI elements for the Property Manager of the B{Build Atoms mode}. @author: Ninad @copyright: 2004-2007 Nanorex, Inc. See LICENSE file for details. @version:$Id$ History: Before Alpha9, (code that used Qt3 framework) Build Atoms mode had a 'Molecular Modeling Kit' (MMKit) and a dashboard. Starting Alpha 9, this functionality was integrated into a Property Manager. Since then several changes have been made. ninad 2007-08-29: Created: Rewrote all UI to make it use the 'PM' module classes. This deprecates class MMKitDialog. Split out old 'clipboard' functionality into new L{PasteFromClipboard_Command} """ from PyQt4.Qt import Qt from PM.PM_GroupBox import PM_GroupBox from PM.PM_CheckBox import PM_CheckBox from PM.PM_ComboBox import PM_ComboBox from PM.PM_LineEdit import PM_LineEdit from PM.PM_CoordinateSpinBoxes import PM_CoordinateSpinBoxes from PM.PM_ToolButtonRow import PM_ToolButtonRow from PM.PM_ElementChooser import PM_ElementChooser from PM.PM_PAM5_AtomChooser import PM_PAM5_AtomChooser from PM.PM_PAM3_AtomChooser import PM_PAM3_AtomChooser from PM.PM_PreviewGroupBox import PM_PreviewGroupBox from PM.PM_Constants import PM_DONE_BUTTON from PM.PM_Constants import PM_WHATS_THIS_BUTTON from widgets.prefs_widgets import connect_checkbox_with_boolean_pref import foundation.env as env from utilities.prefs_constants import reshapeAtomsSelection_prefs_key from command_support.Command_PropertyManager import Command_PropertyManager _superclass = Command_PropertyManager class Ui_BuildAtomsPropertyManager(Command_PropertyManager): """ The Ui_BuildAtomsPropertyManager class defines UI elements for the Property Manager of the B{Build Atoms mode}. @ivar title: The title that appears in the property manager header. @type title: str @ivar pmName: The name of this property manager. This is used to set the name of the PM_Dialog object via setObjectName(). @type name: str @ivar iconPath: The relative path to the PNG file that contains a 22 x 22 icon image that appears in the PM header. @type iconPath: str """ # The title that appears in the Property Manager header title = "Build Atoms" # The name of this Property Manager. This will be set to # the name of the PM_Dialog object via setObjectName(). pmName = title # The relative path to the PNG file that appears in the header iconPath = "ui/actions/Tools/Build Structures/BuildAtoms.png" def __init__(self, command): """ Constructor for the B{Build Atoms} property manager class that defines its UI. @param command: The parent mode where this Property Manager is used @type command: L{depositMode} """ self.previewGroupBox = None self.regularElementChooser = None self.PAM5Chooser = None self.PAM3Chooser = None self.elementChooser = None self.advancedOptionsGroupBox = None self.bondToolsGroupBox = None self.selectionFilterCheckBox = None self.filterlistLE = None self.selectedAtomInfoLabel = None #Initialize the following to None. (subclasses may not define this) #Make sure you initialize it before adding groupboxes! self.selectedAtomPosGroupBox = None self.showSelectedAtomInfoCheckBox = None _superclass.__init__(self, command) self.showTopRowButtons(PM_DONE_BUTTON | PM_WHATS_THIS_BUTTON) msg = '' self.MessageGroupBox.insertHtmlMessage(msg, setAsDefault=False) def _addGroupBoxes(self): """ Add various group boxes to the Build Atoms Property manager. """ self._addPreviewGroupBox() self._addAtomChooserGroupBox() self._addBondToolsGroupBox() #@@@TODO HIDE the bonds tool groupbox initially as the #by default, the atoms tool is active when BuildAtoms command is #finist invoked. self.bondToolsGroupBox.hide() self._addSelectionOptionsGroupBox() self._addAdvancedOptionsGroupBox() def _addPreviewGroupBox(self): """ Adde the preview groupbox that shows the element selected in the element chooser. """ self.previewGroupBox = PM_PreviewGroupBox( self, glpane = self.o ) def _addAtomChooserGroupBox(self): """ Add the Atom Chooser groupbox. This groupbox displays one of the following three groupboxes depending on the choice selected in the combobox: a) Periodic Table Elements L{self.regularElementChooser} b) PAM5 Atoms L{self.PAM5Chooser} c) PAM3 Atoms L{self.PAM3Chooser} @see: L{self.__updateAtomChooserGroupBoxes} """ self.atomChooserGroupBox = \ PM_GroupBox(self, title = "Atom Chooser") self._loadAtomChooserGroupBox(self.atomChooserGroupBox) self._updateAtomChooserGroupBoxes(currentIndex = 0) def _addElementChooserGroupBox(self, inPmGroupBox): """ Add the 'Element Chooser' groupbox. (present within the Atom Chooser Groupbox) """ if not self.previewGroupBox: return elementViewer = self.previewGroupBox.elementViewer self.regularElementChooser = \ PM_ElementChooser( inPmGroupBox, parentPropMgr = self, elementViewer = elementViewer) def _add_PAM5_AtomChooserGroupBox(self, inPmGroupBox): """ Add the 'PAM5 Atom Chooser' groupbox (present within the Atom Chooser Groupbox) """ if not self.previewGroupBox: return elementViewer = self.previewGroupBox.elementViewer self.PAM5Chooser = \ PM_PAM5_AtomChooser( inPmGroupBox, parentPropMgr = self, elementViewer = elementViewer) def _add_PAM3_AtomChooserGroupBox(self, inPmGroupBox): """ Add the 'PAM3 Atom Chooser' groupbox (present within the Atom Chooser Groupbox) """ if not self.previewGroupBox: return elementViewer = self.previewGroupBox.elementViewer self.PAM3Chooser = \ PM_PAM3_AtomChooser( inPmGroupBox, parentPropMgr = self, elementViewer = elementViewer) def _hideAllAtomChooserGroupBoxes(self): """ Hides all Atom Chooser group boxes. """ if self.regularElementChooser: self.regularElementChooser.hide() if self.PAM5Chooser: self.PAM5Chooser.hide() if self.PAM3Chooser: self.PAM3Chooser.hide() def _addBondToolsGroupBox(self): """ Add the 'Bond Tools' groupbox. """ self.bondToolsGroupBox = \ PM_GroupBox( self, title = "Bond Tools") self._loadBondToolsGroupBox(self.bondToolsGroupBox) def _addSelectionOptionsGroupBox(self): """ Add 'Selection Options' groupbox """ self.selectionOptionsGroupBox = \ PM_GroupBox( self, title = "Selection Options" ) self._loadSelectionOptionsGroupBox(self.selectionOptionsGroupBox) def _loadAtomChooserGroupBox(self, inPmGroupBox): """ Load the widgets inside the Atom Chooser groupbox. @param inPmGroupBox: The Atom Chooser box in the PM @type inPmGroupBox: L{PM_GroupBox} """ atomChooserChoices = [ "Periodic Table Elements", "PAM5 Atoms", "PAM3 Atoms" ] self.atomChooserComboBox = \ PM_ComboBox( inPmGroupBox, label = '', choices = atomChooserChoices, index = 0, setAsDefault = False, spanWidth = True ) #Following fixes bug 2550 self.atomChooserComboBox.setFocusPolicy(Qt.NoFocus) self._addElementChooserGroupBox(inPmGroupBox) self._add_PAM5_AtomChooserGroupBox(inPmGroupBox) self._add_PAM3_AtomChooserGroupBox(inPmGroupBox) def _loadSelectionOptionsGroupBox(self, inPmGroupBox): """ Load widgets in the Selection Options group box. @param inPmGroupBox: The Selection Options box in the PM @type inPmGroupBox: L{PM_GroupBox} """ self.selectionFilterCheckBox = \ PM_CheckBox( inPmGroupBox, text = "Enable atom selection filter", widgetColumn = 0, state = Qt.Unchecked ) self.selectionFilterCheckBox.setDefaultValue(False) self.filterlistLE = PM_LineEdit( inPmGroupBox, label = "", text = "", setAsDefault = False, spanWidth = True ) self.filterlistLE.setReadOnly(True) if self.selectionFilterCheckBox.isChecked(): self.filterlistLE.setEnabled(True) else: self.filterlistLE.setEnabled(False) self.showSelectedAtomInfoCheckBox = \ PM_CheckBox( inPmGroupBox, text = "Show Selected Atom Info", widgetColumn = 0, state = Qt.Unchecked) self.selectedAtomPosGroupBox = \ PM_GroupBox( inPmGroupBox, title = "") self._loadSelectedAtomPosGroupBox(self.selectedAtomPosGroupBox) self.toggle_selectedAtomPosGroupBox(show = 0) self.enable_or_disable_selectedAtomPosGroupBox( bool_enable = False) self.reshapeSelectionCheckBox = \ PM_CheckBox( inPmGroupBox, text = 'Dragging reshapes selection', widgetColumn = 0, state = Qt.Unchecked ) connect_checkbox_with_boolean_pref( self.reshapeSelectionCheckBox, reshapeAtomsSelection_prefs_key ) env.prefs[reshapeAtomsSelection_prefs_key] = False self.waterCheckBox = \ PM_CheckBox( inPmGroupBox, text = "Z depth filter (water surface)", widgetColumn = 0, state = Qt.Unchecked ) def _loadSelectedAtomPosGroupBox(self, inPmGroupBox): """ Load the selected Atoms position groupbox It is a sub-gropbox of L{self.selectionOptionsGroupBox) @param inPmGroupBox: 'The Selected Atom Position Groupbox' @type inPmGroupBox: L{PM_GroupBox} """ self.selectedAtomLineEdit = PM_LineEdit( inPmGroupBox, label = "Selected Atom:", text = "", setAsDefault = False, spanWidth = False ) self.selectedAtomLineEdit.setReadOnly(True) self.selectedAtomLineEdit.setEnabled(False) self.coordinateSpinboxes = PM_CoordinateSpinBoxes(inPmGroupBox) # User input to specify x-coordinate self.xCoordOfSelectedAtom = self.coordinateSpinboxes.xSpinBox # User input to specify y-coordinate self.yCoordOfSelectedAtom = self.coordinateSpinboxes.ySpinBox # User input to specify z-coordinate self.zCoordOfSelectedAtom = self.coordinateSpinboxes.zSpinBox def _addAdvancedOptionsGroupBox(self): """ Add 'Advanced Options' groupbox """ self.advancedOptionsGroupBox = \ PM_GroupBox( self, title = "Advanced Options" ) self._loadAdvancedOptionsGroupBox(self.advancedOptionsGroupBox) def _loadAdvancedOptionsGroupBox(self, inPmGroupBox): """ Load widgets in the Advanced Options group box. @param inPmGroupBox: The Advanced Options box in the PM @type inPmGroupBox: L{PM_GroupBox} """ self.autoBondCheckBox = \ PM_CheckBox( inPmGroupBox, text = 'Auto bond', widgetColumn = 0, state = Qt.Checked ) self.highlightingCheckBox = \ PM_CheckBox( inPmGroupBox, text = "Hover highlighting", widgetColumn = 0, state = Qt.Checked ) def _loadBondToolsGroupBox(self, inPmGroupBox): """ Load widgets in the Bond Tools group box. @param inPmGroupBox: The Bond Tools box in the PM @type inPmGroupBox: L{PM_GroupBox} """ # Button list to create a toolbutton row. # Format: # - buttonId, # - buttonText , # - iconPath # - tooltip # - shortcut # - column BOND_TOOL_BUTTONS = \ [ ( "QToolButton", 0, "SINGLE", "", "", None, 0), ( "QToolButton", 1, "DOUBLE", "", "", None, 1), ( "QToolButton", 2, "TRIPLE", "", "", None, 2), ( "QToolButton", 3, "AROMATIC", "", "", None, 3), ( "QToolButton", 4, "GRAPHITIC", "", "", None, 4), ( "QToolButton", 5, "CUTBONDS", "", "", None, 5) ] self.bondToolButtonRow = \ PM_ToolButtonRow( inPmGroupBox, title = "", buttonList = BOND_TOOL_BUTTONS, checkedId = None, setAsDefault = True ) def _addWhatsThisText(self): """ "What's This" text for widgets in this Property Manager. """ from ne1_ui.WhatsThisText_for_PropertyManagers import whatsThis_BuildAtomsPropertyManager whatsThis_BuildAtomsPropertyManager(self) def _addToolTipText(self): """ Tool Tip text for widgets in this Property Manager. """ from ne1_ui.ToolTipText_for_PropertyManagers import ToolTip_BuildAtomsPropertyManager ToolTip_BuildAtomsPropertyManager(self) def toggle_selectedAtomPosGroupBox(self, show = 0): """ Show or hide L{self.selectedAtomPosGroupBox} depending on the state of the checkbox (L{self.showSelectedAtomInfoCheckBox}) @param show: Flag that shows or hides the groupbox (can have values 0 or 1 @type show: int """ if show: self.selectedAtomPosGroupBox.show() else: self.selectedAtomPosGroupBox.hide() def enable_or_disable_selectedAtomPosGroupBox(self, bool_enable = False): """ Enable or disable Selected AtomPosGroupBox present within 'selection options' and also the checkbox that shows or hide this groupbox. These two widgets are enabled when only a single atom is selected from the 3D workspace. @param bool_enable: Flag that enables or disables widgets @type bool_enable: boolean """ if self.showSelectedAtomInfoCheckBox: self.showSelectedAtomInfoCheckBox.setEnabled(bool_enable) if self.selectedAtomPosGroupBox: self.selectedAtomPosGroupBox.setEnabled(bool_enable) def _updateAtomChooserGroupBoxes(self, currentIndex): """ Updates the Atom Chooser Groupbox. It displays one of the following three groupboxes depending on the choice selected in the combobox: a) Periodic Table Elements L{self.regularElementChooser} b) PAM5 Atoms L{self.PAM5Chooser} c) PAM3 Atoms L{self.PAM3Chooser} It also sets self.elementChooser to the current active Atom chooser and updates the display accordingly in the Preview groupbox. """ self._hideAllAtomChooserGroupBoxes() if currentIndex is 0: self.elementChooser = self.regularElementChooser self.regularElementChooser.show() if currentIndex is 1: self.elementChooser = self.PAM5Chooser self.PAM5Chooser.show() if currentIndex is 2: self.elementChooser = self.PAM3Chooser self.PAM3Chooser.show() if self.elementChooser: self.elementChooser.updateElementViewer() self.updateMessage() def updateMessage(self): """ Update the Message groupbox with informative message. Subclasses should override this. """ pass
NanoCAD-master
cad/src/commands/BuildAtoms/Ui_BuildAtomsPropertyManager.py
from commands.BuildAtoms.BuildAtoms_GraphicsMode import BuildAtoms_GraphicsMode ##from commands.SelectAtoms.SelectAtoms_GraphicsMode import SelectAtoms_GraphicsMode from model.bond_constants import V_SINGLE from utilities.prefs_constants import buildModeHighlightingEnabled_prefs_key import foundation.env as env _superclass = BuildAtoms_GraphicsMode class BondTool_GraphicsMode(BuildAtoms_GraphicsMode): """ """ def Enter_GraphicsMode(self): _superclass.Enter_GraphicsMode(self) self.setBond(self.command.getBondType(), True) def bondLeftUp(self, b, event): # was bondClicked(). mark 060220. #[WARNING: docstring appears to be out of date -- bruce 060702] """ Bond <b> was clicked, so select or unselect its atoms or delete bond <b> based on the current modkey. - If no modkey is pressed, clear the selection and pick <b>\'s two atoms. - If Shift is pressed, pick <b>\'s two atoms, adding them to the current selection. - If Ctrl is pressed, unpick <b>\'s two atoms, removing them from the current selection. - If Shift+Control (Delete) is pressed, delete bond <b>. <event> is a LMB release event. """ if self.o.modkeys is None: self.bond_change_type(b, allow_remake_bondpoints = True) self.o.gl_update() return _superclass.bondLeftUp(self, b, event) if self.o.modkeys is None: if self.command.isBondsToolActive(): #Following fixes bug 2425 (implements single click bond deletion #in Build Atoms. -- ninad 20070626 if self.command.isDeleteBondsToolActive(): self.bondDelete(event) #@ self.o.gl_update() # Not necessary since win_update() # is called in bondDelete(). # Mark 2007-10-19 return self.bond_change_type(b, allow_remake_bondpoints = True) self.o.gl_update() return _superclass.bondLeftUp(self, b, event) pass class DeleteBondTool_GraphicsMode(BuildAtoms_GraphicsMode): def bondLeftUp(self, b, event): if self.o.modkeys is None: self.bondDelete(event) #@ self.o.gl_update() # Not necessary since win_update() # is called in bondDelete(). # Mark 2007-10-19 return _superclass.bondLeftUp(self, b, event)
NanoCAD-master
cad/src/commands/BuildAtoms/BondTool_GraphicsMode.py
# Copyright 2007 Nanorex, Inc. See LICENSE file for details. """ BuildAtomsPropertyManager.py The BuildAtomsPropertyManager class provides the Property Manager for the B{Build Atoms mode}. The UI is defined in L{Ui_BuildAtomsPropertyManager} @author: Bruce, Huaicai, Mark, Ninad @version: $Id$ @copyright: 2007 Nanorex, Inc. See LICENSE file for details. History: Before Alpha9, (code that used Qt3 framework) Build Atoms mode had a 'Molecular Modeling Kit' (MMKit) and a dashboard. Starting Alpha 9, this functionality was integrated into a Property Manager. Since then several changes have been made. ninad 2007-08-29: Created to use PM module classes, thus deprecating old Property Manager class MMKit. Split out old 'clipboard' functionality into new L{PasteFromClipboard_Command} """ import foundation.env as env from PyQt4.Qt import SIGNAL from commands.BuildAtoms.Ui_BuildAtomsPropertyManager import Ui_BuildAtomsPropertyManager from geometry.VQT import V from utilities.Comparison import same_vals from utilities.prefs_constants import buildModeHighlightingEnabled_prefs_key from utilities.prefs_constants import buildModeWaterEnabled_prefs_key from widgets.prefs_widgets import connect_checkbox_with_boolean_pref from utilities import debug_flags from utilities.debug import print_compact_stack NOBLEGASES = ("He", "Ne", "Ar", "Kr") PAMATOMS = ("Gv5", "Ax3") ALL_PAM_ATOMS = ("Gv5", "Ss5", "Pl5", "Ax3", "Ss3", "Ub3", "Ux3", "Uy3") _superclass = Ui_BuildAtomsPropertyManager class BuildAtomsPropertyManager(Ui_BuildAtomsPropertyManager): """ The BuildAtomsPropertyManager class provides the Property Manager for the B{Build Atoms mode}. The UI is defined in L{Ui_BuildAtomsPropertyManager} """ def __init__(self, command): """ Constructor for the B{Build Atoms} property manager. @param command: The parent mode where this Property Manager is used @type command: L{BuildAtoms_Command} """ self.previousSelectionParams = None self.isAlreadyConnected = False self.isAlreadyDisconnected = False _superclass.__init__(self, command) # It is essential to make the following flag 'True' instead of False. # Program enters self._moveSelectedAtom method first after init, and # there and this flag ensures that it returns from that method # immediately. It is not clear why self.model_changed is not called # before the it enters that method. This flag may not be needed after # implementing connectWithState. self.model_changed_from_glpane = True def show(self): _superclass.show(self) self.updateMessage() def connect_or_disconnect_signals(self, isConnect): """ Connect or disconnect widget signals sent to their slot methods. @param isConnect: If True the widget will send the signals to the slot method. @type isConnect: boolean @see: L{BuildAtoms_Command.connect_or_disconnect_signals} where this is called """ if isConnect and self.isAlreadyConnected: if debug_flags.atom_debug: print_compact_stack("warning: attempt to connect widgets"\ "in this PM that are already connected." ) return if not isConnect and self.isAlreadyDisconnected: if debug_flags.atom_debug: print_compact_stack("warning: attempt to disconnect widgets"\ "in this PM that are already disconnected.") return self.isAlreadyConnected = isConnect self.isAlreadyDisconnected = not isConnect if isConnect: change_connect = self.w.connect else: change_connect = self.w.disconnect change_connect(self.atomChooserComboBox, SIGNAL("currentIndexChanged(int)"), self._updateAtomChooserGroupBoxes) change_connect(self.selectionFilterCheckBox, SIGNAL("stateChanged(int)"), self.set_selection_filter) change_connect(self.showSelectedAtomInfoCheckBox, SIGNAL("stateChanged(int)"), self.toggle_selectedAtomPosGroupBox) change_connect(self.xCoordOfSelectedAtom, SIGNAL("valueChanged(double)"), self._moveSelectedAtom) change_connect(self.yCoordOfSelectedAtom, SIGNAL("valueChanged(double)"), self._moveSelectedAtom) change_connect(self.zCoordOfSelectedAtom, SIGNAL("valueChanged(double)"), self._moveSelectedAtom) connect_checkbox_with_boolean_pref(self.waterCheckBox, buildModeWaterEnabled_prefs_key) connect_checkbox_with_boolean_pref(self.highlightingCheckBox, buildModeHighlightingEnabled_prefs_key) #New command API method -- implemented on 2008-08-27 def _update_UI_do_updates(self): """ Overrides superclass method @warning: This is called frequently, even when nothing has changed. It's used to respond to other kinds of changes as well (e.g. to the selection). So it needs to be fast when nothing has changed. (It will be renamed accordingly in the API.) @see: Command_PropertyManager._updateUI_do_updates() """ newSelectionParams = self._currentSelectionParams() if same_vals(newSelectionParams, self.previousSelectionParams): return self.previousSelectionParams = newSelectionParams #subclasses of BuildAtomsPM may not define self.selectedAtomPosGroupBox #so do the following check. if self.selectedAtomPosGroupBox: self._updateSelectedAtomPosGroupBox(newSelectionParams) def _currentSelectionParams(self): """ Returns a tuple containing current selection parameters. These parameters are then used to decide whether updating widgets in this property manager is needed when L{self.model_changed} method is called. In this case, the Seletion Options groupbox is updated when atom selection changes or when the selected atom is moved. @return: A tuple that contains following selection parameters - Total number of selected atoms (int) - Selected Atom if a single atom is selected, else None - Position vector of the single selected atom or None @rtype: tuple @NOTE: The method may be renamed in future. It's possible that there are other groupboxes in the PM that need to be updated when something changes in the glpane. """ #use selected atom dictionary which is already made by assy. #use this dict for length tests below. Don't create list from this #dict yet as that would be a slow operation to do at this point. selectedAtomsDictionary = self.win.assy.selatoms if len(selectedAtomsDictionary) == 1: #self.win.assy.selatoms_list() is same as # selectedAtomsDictionary.values() except that it is a sorted list #it doesn't matter in this case, but a useful info if we decide # we need a sorted list for multiple atoms in future. # -- ninad 2007-09-27 (comment based on Bruce's code review) selectedAtomList = self.win.assy.selatoms_list() selectedAtom = selectedAtomList[0] posn = selectedAtom.posn() return (len(selectedAtomsDictionary), selectedAtom, posn) elif len(selectedAtomsDictionary) > 1: #All we are interested in, is to check if multiple atoms are #selected. So just return a number greater than 1. This makes sure #that parameter difference test in self.model_changed doesn't # succeed much more often (i.e. whenever user changes the number of # selected atoms, but still keeping that number > 1 aNumberGreaterThanOne = 2 return (aNumberGreaterThanOne, None, None) else: return (0, None, None) def set_selection_filter(self, enabled): """ Slot for Atom Selection Filter checkbox that enables or disables the selection filter and updates the cursor. @param enabled: Checked state of L{self.selectionFilterStateBox} If checked, the selection filter will be enabled @type enabled: bool @see: L{self.update_selection_filter_list} """ #TODO: To be revised and moved to the Command or GM part. #This can be done when Bruce implements connectWithState API # -- Ninad 2008-01-03 if enabled != self.w.selection_filter_enabled: if enabled: env.history.message("Atom Selection Filter enabled.") else: env.history.message("Atom Selection Filter disabled.") self.w.selection_filter_enabled = enabled self.filterlistLE.setEnabled(enabled) self.update_selection_filter_list() self.command.graphicsMode.update_cursor() def update_selection_filter_list(self): """ Adds/removes the element selected in the Element Chooser to/from Atom Selection Filter based on what modifier key is pressed (if any). @see: L{self.set_selection_filter} @see: L{self.update_selection_filter_list_widget} """ #Don't update the filter list if selection filter checkbox is not active if not self.filterlistLE.isEnabled(): self.w.filtered_elements = [] self.update_selection_filter_list_widget() return element = self.elementChooser.element if self.o.modkeys is None: self.w.filtered_elements = [] self.w.filtered_elements.append(element) if self.o.modkeys == 'Shift': if not element in self.w.filtered_elements[:]: self.w.filtered_elements.append(element) elif self.o.modkeys == 'Control': if element in self.w.filtered_elements[:]: self.w.filtered_elements.remove(element) self.update_selection_filter_list_widget() return def update_selection_filter_list_widget(self): """ Updates the list of elements displayed in the Atom Selection Filter List. @see: L{self.update_selection_filter_list}. (Should only be called from this method) """ filtered_syms = '' for e in self.w.filtered_elements[:]: if filtered_syms: filtered_syms += ", " filtered_syms += e.symbol self.filterlistLE.setText(filtered_syms) return def setElement(self, elementNumber): """ Set the current element in the MMKit to I{elementNumber}. @param elementNumber: Element number. (i.e. 6 = Carbon) @type elementNumber: int """ self.regularElementChooser.setElement(elementNumber) return def updateMessage(self, msg = ""): """ Updates the message box with an informative message based on the current page and current selected atom type. @param msg: The message to display in the Property Manager message box. If called with an empty string (the default), a strandard message is displayed. @type msg: str """ if msg: self.MessageGroupBox.insertHtmlMessage(msg) return if not self.elementChooser: return element = self.elementChooser.element if element.symbol in ALL_PAM_ATOMS: atom_or_PAM_atom_string = ' pseudoatom' else: atom_or_PAM_atom_string = ' atom' if self.elementChooser.isVisible(): msg = "Double click in empty space to insert a single " \ + element.name + atom_or_PAM_atom_string + "." if not element.symbol in NOBLEGASES: msg += "Click on an atom's <i>red bondpoint</i> to attach a " \ + element.name + atom_or_PAM_atom_string +" to it." if element.symbol in PAMATOMS: msg ="Note: this pseudoatom can only be deposited onto a strand sugar"\ " and will disappear if deposited in free space" else: # Bonds Tool is selected if self.command.isDeleteBondsToolActive(): msg = "<b> Cut Bonds </b> tool is active. " \ "Click on bonds in order to delete them." self.MessageGroupBox.insertHtmlMessage(msg) return # Post message. self.MessageGroupBox.insertHtmlMessage(msg) def _updateSelectedAtomPosGroupBox(self, selectionParams): """ Update the Selected Atoms Position groupbox present within the B{Selection GroupBox" of this PM. This groupbox shows the X, Y, Z coordinates of the selected atom (if any). This groupbox is updated whenever selection in the glpane changes or a single atom is moved. This groupbox is enabled only when exactly one atom in the glpane is selected. @param selectionParams: A tuple that provides following selection parameters - Total number of selected atoms (int) - Selected Atom if a single atom is selected, else None - Position vector of the single selected atom or None @type: tuple @see: L{self._currentSelectionParams} @see: L{self.model_changed} """ totalAtoms, selectedAtom, atomPosn = selectionParams text = "" if totalAtoms == 1: self.enable_or_disable_selectedAtomPosGroupBox(bool_enable = True) text = str(selectedAtom.getInformationString()) text += " (" + str(selectedAtom.element.name) + ")" self._updateAtomPosSpinBoxes(atomPosn) elif totalAtoms > 1: self.enable_or_disable_selectedAtomPosGroupBox(bool_enable = False) text = "Multiple atoms selected" else: self.enable_or_disable_selectedAtomPosGroupBox(bool_enable = False) text = "No Atom selected" if self.selectedAtomLineEdit: self.selectedAtomLineEdit.setText(text) def _moveSelectedAtom(self, spinBoxValueJunk = None): """ Move the selected atom position based on the value in the X, Y, Z coordinate spinboxes in the Selection GroupBox. @param spinBoxValueJunk: This is the Spinbox value from the valueChanged signal. It is not used. We just want to know that the spinbox value has changed. @type spinBoxValueJunk: double or None """ if self.model_changed_from_glpane: #Model is changed from glpane ,do nothing. Fixes bug 2545 print "bug: self.model_changed_from_glpane seen; should never happen after bug 2564 was fixed." #bruce 071015 return totalAtoms, selectedAtom, atomPosn_junk = self._currentSelectionParams() if not totalAtoms == 1: return #@NOTE: This is important to determine baggage and nobaggage atoms. #Otherwise the bondpoints won't move! See also: # selectMode.atomSetup where this is done. # But that method gets called only when during atom left down. #Its not useful here as user may select that atom using selection lasso #or using other means (ctrl + A if only one atom is present) . Also, #the lists command.baggage and command.nonbaggage seem to get #cleared during left up. So that method is not useful. #There needs to be a method in parentmode (Select_Command or #BuildAtoms_Command) #to do the following (next code cleanup?) -- ninad 2007-09-27 self.command.baggage, self.command.nonbaggage = \ selectedAtom.baggage_and_other_neighbors() xPos= self.xCoordOfSelectedAtom.value() yPos = self.yCoordOfSelectedAtom.value() zPos = self.zCoordOfSelectedAtom.value() newPosition = V(xPos, yPos, zPos) delta = newPosition - selectedAtom.posn() #Don't do selectedAtom.setposn() because it needs to handle #cases where atom has bond points and/or monovalent atoms . It also #needs to modify the neighboring atom baggage. This is already done in #the following method in command so use that. self.command.drag_selected_atom(selectedAtom, delta, computeBaggage = True) self.o.gl_update() def _updateAtomPosSpinBoxes(self, atomCoords): """ Updates the X, Y, Z values in the Selection Options Groupbox. This method is called whenever the selected atom in the glpane is dragged. @param atomCoords: X, Y, Z coordinate position vector @type atomCoords: Vector """ self.model_changed_from_glpane = True #block signals while making setting values in these spinboxes self.xCoordOfSelectedAtom.setValue(atomCoords[0], blockSignals = True) self.yCoordOfSelectedAtom.setValue(atomCoords[1], blockSignals = True) self.zCoordOfSelectedAtom.setValue(atomCoords[2], blockSignals = True) self.model_changed_from_glpane = False return pass # TODO: setValue_with_signals_blocked is a useful helper function which should be refiled. def setValue_with_signals_blocked(widget, value): # bruce 071015 """ Call widget.setValue(value) while temporarily blocking all Qt signals sent from widget. (If they were already blocked, doesn't change that.) @param widget: a QDoubleSpinBox, or any Qt widget with a compatible setValue method @type widget: a Qt widget with a setValue method compatible with that of QDoubleSpinBox @param value: argument for setValue @type value: whatever is needed by setValue (depends on widget type) """ was_blocked = widget.blockSignals(True) try: widget.setValue(value) finally: widget.blockSignals(was_blocked) return # end
NanoCAD-master
cad/src/commands/BuildAtoms/BuildAtomsPropertyManager.py
NanoCAD-master
cad/src/commands/BuildAtoms/__init__.py
# Copyright 2008 Nanorex, Inc. See LICENSE file for details. """ @author: Ninad @copyright: 2008 Nanorex, Inc. See LICENSE file for details. @version: $Id$ History: 2008-07-30: Created to refactor Build Atoms command (currently called BuildAtoms_Command). TODO: - Classes created to refactor BuildAtoms_Command (rather 'BuildChunks' command) to be revised further. - document - REVIEW: _reusePropMgr_of_parentCommand -- this is an experimental method that will fit in the NEW command API (2008-07-30) . to be revised/ renamed. e.g. command_reuse_PM etc. - Update methods (e.g. self.propMgr.updateMessage() need to be called by a central method such as command_update_* or PM._update_UI_*. """ from commands.BuildAtoms.BuildAtoms_Command import BuildAtoms_Command from commands.BuildAtoms.BondTool_GraphicsMode import DeleteBondTool_GraphicsMode from commands.BuildAtoms.BondTool_GraphicsMode import BondTool_GraphicsMode from model.bond_constants import V_SINGLE, V_DOUBLE, V_TRIPLE, V_AROMATIC, V_CARBOMERIC, V_GRAPHITE from utilities.constants import CL_SUBCOMMAND from model.elements import Singlet import foundation.env as env from utilities.Log import orangemsg class BondTool_Command(BuildAtoms_Command): """ Each of the subclass of this class represent a temporary command that will act like 'activating a tool'. Example: when user clicks on single Bonds tool, it will enter Single Bond Tool command. , suspending the Build Atoms default command. """ GraphicsMode_class = BondTool_GraphicsMode FlyoutToolbar_class = None featurename = 'Build Atoms Mode/BondTool' commandName = 'BOND_TOOL' command_should_resume_prevMode = False command_has_its_own_PM = False currentActiveTool = 'BONDS_TOOL' _suppress_apply_bondTool_on_selected_atoms = False #class constants for the NEW COMMAND API -- 2008-07-30 command_level = CL_SUBCOMMAND command_parent = 'DEPOSIT' def command_entered(self): """ Overrides superclass method. @see: baseCommand.command_entered() for documentation """ super(BondTool_Command, self).command_entered() self._apply_bondTool_on_selected_atoms() name = self.getBondTypeString() if name: msg = "Click bonds or bondpoints to make them %ss." % name else: msg = "Select a bond tool and then click on bonds or "\ "bondpoints to convert them to a specific bond type." self.propMgr.updateMessage(msg) def getBondType(self): return V_SINGLE def getBondTypeString(self): """ Overridden in subclasses. """ return '' def _apply_bondTool_on_selected_atoms(self): """ Converts the bonds between the selected atoms to one specified by self.graphicsMode..bondclick_v6. Example: When user selects all atoms in a nanotube and clicks 'graphitic' bond button, it converts all the bonds between the selected atoms to graphitic bonds. @see: self.activateBondsTool() @see: self.changeBondTool() @see: bond_utils.apply_btype_to_bond() @see: BuildAtoms_GraphicsMode.bond_change_type() """ #Method written on 2008-05-04 to support NFR bug 2832. This need to #be reviewed for further optimization (not urgent) -- Ninad #This flag is set while activating the bond tool. #see self.activateBondsTool() if self._suppress_apply_bondTool_on_selected_atoms: return bondTypeString = self.getBondTypeString() #For the history message converted_bonds = 0 non_converted_bonds = 0 deleted_bonds = 0 #We wil check the bond dictionary to see if a bond between the #selected atoms is already operated on. bondDict = {} bondList = [] #all selected atoms atoms = self.win.assy.selatoms.values() for a in atoms: for b in a.bonds[:]: #If bond 'b' is already in the bondDict, skip this #iteration. if bondDict.has_key(id(b)): continue else: bondDict[id(b)] = b #neigbor atom of the atom 'a' neighbor = b.other(a) if neighbor.element != Singlet and neighbor.picked: bond_type_changed = self.graphicsMode.bond_change_type( b, allow_remake_bondpoints = True, suppress_history_message = True ) if bond_type_changed: converted_bonds += 1 else: non_converted_bonds += 1 msg = "%d bonds between selected atoms "\ "converted to %s" %(converted_bonds, bondTypeString) msg2 = '' if non_converted_bonds: msg2 = orangemsg(" [Unable to convert %d "\ "bonds to %s]"%(non_converted_bonds, bondTypeString)) if msg2: msg += msg2 if msg: env.history.message(msg) self.glpane.gl_update() #TEMPORARILY override the is*ToolActive methods in BuildAtoms_Command. #These methods will go away when BuildAtoms command starts treating #each tool as a subcommand. def isAtomsToolActive(self): """ Tells whether the Atoms Tool is active (boolean) """ return False def isBondsToolActive(self): """ Tells whether the Bonds Tool is active (boolean) """ return True def isDeletBondsToolActive(self): """ Tells whether the Delete Bonds Tool is active (boolean) """ return False ##################### #classes need to be in their own module class SingleBondTool(BondTool_Command): featurename = 'Build Atoms Mode/SingleBondTool' commandName = 'SINGLE_BOND_TOOL' command_should_resume_prevMode = True def getBondType(self): return V_SINGLE def getBondTypeString(self): """ Overrides superclass method. """ return 'Single Bond' class DoubleBondTool(BondTool_Command): featurename = 'Build Atoms Mode/DoubleBondTool' commandName = 'DOUBLE_BOND_TOOL' command_should_resume_prevMode = True def getBondType(self): return V_DOUBLE def getBondTypeString(self): """ Overridden in subclasses. """ return 'Double Bond' class TripleBondTool(BondTool_Command): featurename = 'Build Atoms Mode/TripleBondTool' commandName = 'TRIPLE_BOND_TOOL' command_should_resume_prevMode = True def getBondType(self): return V_TRIPLE def getBondTypeString(self): """ Overridden in subclasses. """ return 'Triple Bond' class AromaticBondTool(BondTool_Command): featurename = 'Build Atoms Mode/AromaticBondTool' commandName = 'AROMATIC_BOND_TOOL' command_should_resume_prevMode = True def getBondType(self): return V_AROMATIC def getBondTypeString(self): """ Overridden in subclasses. """ return 'Aromatic Bond' class GraphiticBondTool(BondTool_Command): featurename = 'Build Atoms Mode/GraphiticBondTool' commandName = 'GRAPHITIC_BOND_TOOL' command_should_resume_prevMode = True def getBondType(self): return V_GRAPHITE def getBondTypeString(self): """ Overridden in subclasses. """ return 'Graphitic Bond' class DeleteBondTool(BondTool_Command): GraphicsMode_class = DeleteBondTool_GraphicsMode featurename = 'Build Atoms Mode/DeleteBondTool' commandName = 'DELETE_BOND_TOOL' command_should_resume_prevMode = True def _apply_bondTool_on_selected_atoms(self): """ Converts the bonds between the selected atoms to one specified by self.graphicsMode..bondclick_v6. Example: When user selects all atoms in a nanotube and clicks 'graphitic' bond button, it converts all the bonds between the selected atoms to graphitic bonds. @see: self.activateBondsTool() @see: self.changeBondTool() @see: bond_utils.apply_btype_to_bond() @see: BuildAtoms_GraphicsMode.bond_change_type() """ #Method written on 2008-05-04 to support NFR bug 2832. This need to #be reviewed for further optimization (not urgent) -- Ninad #This flag is set while activating the bond tool. #see self.activateBondsTool() if self._suppress_apply_bondTool_on_selected_atoms: return deleted_bonds = 0 #We wil check the bond dictionary to see if a bond between the #selected atoms is already operated on. bondDict = {} bondList = [] #all selected atoms atoms = self.win.assy.selatoms.values() for a in atoms: for b in a.bonds[:]: #If bond 'b' is already in the bondDict, skip this #iteration. if bondDict.has_key(id(b)): continue else: bondDict[id(b)] = b #neigbor atom of the atom 'a' neighbor = b.other(a) if neighbor.element != Singlet and neighbor.picked: b.bust() deleted_bonds += 1 msg = "Deleted %d bonds between selected atoms"%deleted_bonds env.history.message(msg) self.glpane.gl_update()
NanoCAD-master
cad/src/commands/BuildAtoms/BondTool_Command.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ build_utils.py -- some utilities for Build mode. @author: Josh @version: $Id$ @copyright: 2004-2009 Nanorex, Inc. See LICENSE file for details. History: Original code written by Josh in depositMode.py. Bruce moved it into this separate file, 050510, and added superstructure, in preparation for extending it to atom types with new bonding patterns. And did some of that extension, 050511. [It's ongoing.] """ from geometry.VQT import norm from model.chem import Atom from utilities.debug import print_compact_traceback class DepositionTool: "#doc" pass class PastableDepositionTool(DepositionTool): # not yet filled in (with code from depositMode.py) or used def __init__(self, pastable): self.pastable = pastable return def attach_to(self, singlet, autobond = True): # NIM (in PastableDepositionTool) assert 0, "nim" pass class AtomTypeDepositionTool(DepositionTool): """ DepositionTool for depositing atoms of a given type (element and bonding pattern). """ #bruce 050510 made this from some methods in depositMode, and extended it for atomtypes. def __init__(self, atomtype): self.atomtype = atomtype return ################################################################### # Oh, ye acolytes of klugedom, feast your eyes on the following # ################################################################### # [comment initially by josh, revised by bruce circa 041115-041215, 050510] # singlet is supposedly the lit-up singlet we're pointing to. # make a new atom of [our atomtype]. # bond the new atom to singlet, and to any other singlets around which you'd # expect it to form bonds with (for now this might be based solely on nearness ###@@@). # Also make new singlets to reach desired total number of bonds. # Note that these methods don't use self except to # find each other... so they could be turned into functions for general use. #e # To help fix bug 131 I'm [bruce circa 041215] splitting each of the old code's methods # bond1 - bond4 into a new method to position and make the new atom (for any number of bonds) # and methods moved to class atom to add more singlets as needed. # bruce 041123 new features: # return the new atom and a description of it, or None and the reason we made nothing. def attach_to( self, singlet, autobond = True, autobond_msg = True): # in AtomTypeDepositionTool # [bruce 050831 added autobond option; 050901 added autobond_msg] """ [public method] Deposit a new atom of self.atomtype onto the given singlet, and (if autobond is true) make other bonds (to other near-enough atoms with singlets) as appropriate. (But never more than one bond per other real atom.) @return: a 2-tuple consisting of either the new atom and a description of it, or None and the reason we made nothing. ###@@@ should worry about bond direction! at least as a filter! If autobond_msg is true, mention the autobonding done or not done (depending on autobond option), in the returned message, if any atoms were near enough for autobonding to be done. This option is independent from the autobond option. [As of 050901 not all combos of these options have been tested. ###@@@] """ atype = self.atomtype if not atype.numbonds: whynot = "%s makes no bonds; can't attach one to an open bond" % atype.fullname_for_msg() return None, whynot if not atype.can_bond_to(singlet.singlet_neighbor(), singlet): #bruce 080502 new feature whynot = "%s bond to %r is not allowed" % (atype.fullname_for_msg(), singlet.singlet_neighbor()) # todo: return whynot from same routine return None, whynot spot = self.findSpot(singlet) pl = [(singlet, spot)] # will grow to a list of pairs (s, its spot) # bruce change 041215: always include this one in the list # (probably no effect, but gives later code less to worry about; # before this there was no guarantee singlet was in the list # (tho it probably always was), or even that the list was nonempty, # without analyzing the subrs in more detail than I'd like!) if autobond or autobond_msg: #bruce 050831 added this condition; 050901 added autobond_msg # extend pl to make additional bonds, by adding more (singlet, spot) pairs rl = [singlet.singlet_neighbor()] # list of real neighbors of singlets in pl [for bug 232 fix] ## mol = singlet.molecule cr = atype.rcovalent # bruce 041215: might as well fix the bug about searching for open bonds # in other mols too, since it's easy; search in this one first, and stop # when you find enough atoms to bond to. searchmols = list(singlet.molecule.part.molecules) #bruce 050510 revised this searchmols.remove(singlet.molecule) searchmols.insert(0, singlet.molecule) # max number of real bonds we can make (now this can be more than 4) maxpl = atype.numbonds for mol in searchmols: for s in mol.nearSinglets(spot, cr * 1.9): #bruce 041216 changed 1.5 to 1.9 above (it's a heuristic); # see email discussion (ninad, bruce, josh) #bruce 041203 quick fix for bug 232: # don't include two singlets on the same real atom! # (It doesn't matter which one we pick, in terms of which atom we'll # bond to, but it might affect the computation in the bonding # method of where to put the new atom, so ideally we'd do something # more principled than just using the findSpot output from the first # singlet in the list for a given real atom -- e.g. maybe we should # average the spots computed for all singlets of the same real atom. # But this is good enough for now.) #bruce 050510 adds: worse, the singlets are in an arb position... # really we should just ask if it makes sense to bond to each nearby *atom*, # for the ones too near to comfortably *not* be bonded to. ###@@@ ###@@@ bruce 050221: bug 372: sometimes s is not a singlet. how can this be?? # guess: mol.singlets is not always invalidated when it should be. But even that theory # doesn't seem to fully explain the bug report... so let's find out a bit more, at least: try: real = s.singlet_neighbor() except: print_compact_traceback("bug 372 caught red-handed: ") print "bug 372-related data: mol = %r, mol.singlets = %r" % (mol, mol.singlets) continue if real not in rl and atype.can_bond_to(real, s, auto = True): # checking can_bond_to is bruce 080502 new feature pl += [(s, self.findSpot(s))] rl += [real] # after we're done with each mol (but not in the middle of any mol), # stop if we have as many open bonds as we can use if len(pl) >= maxpl: break del mol, s, real n = min(atype.numbonds, len(pl)) # number of real bonds to make (if this was computed above); always >= 1 pl = pl[0:n] # discard the extra pairs (old code did this too, implicitly) if autobond_msg and not autobond: pl = pl[0:1] # don't actually make the bonds we only wanted to tell the user we *might* have made # now pl tells which bonds to actually make, and (if autobond_msg) n tells how many we might have made. # bruce 041215 change: for n > 4, old code gave up now; # new code makes all n bonds for any n, tho it won't add singlets # for n > 4. (Both old and new code don't know how to add enough # singlets for n >= 3 and numbonds > 4. They might add some, tho.) # Note: _new_bonded_n uses len(pl) as its n. As of 050901 this might differ from the variable n. atm = self._new_bonded_n( pl) atm.make_enough_bondpoints() # (tries its best, but doesn't always make enough) desc = "%r (in %r)" % (atm, atm.molecule.name) #e what if caller renames atm.molecule?? if n > 1: #e really: if n > (number of singlets clicked on at once) if autobond: msg = " (%d bond(s) made)" % n else: msg = " (%d bond(s) NOT made, since autobond is off)" % (n-1) #bruce 050901 new feature from platform_dependent.PlatformDependent import fix_plurals msg = fix_plurals(msg) desc += msg return atm, desc # given self.atomtype and a singlet, find the place an atom of that type # would like to be if bonded at that singlet, # assuming the bond direction should not change. #e (Should this be an AtomType method?) def findSpot(self, singlet): obond = singlet.bonds[0] a1 = obond.other(singlet) cr = self.atomtype.rcovalent pos = singlet.posn() + cr*norm(singlet.posn()-a1.posn()) return pos def _new_bonded_n( self, lis): """ [private method] Make and return an atom (of self.atomtype) bonded to the base atoms of the n bondpoints in lis, in place of those bondpoints, which is a list of n pairs (singlet, pos), where each pos is the ideal position for a new atom bonded to its singlet alone. The new atom will always have n real bonds and no bondpoints, and be positioned at the average of the positions passed as pos. We don't check whether n is too many bonds for self.atomtype, nor do we care what kind of bond positions it would prefer. (This is up to the caller, if it matters; since the bondpoints typically already existed, there's not a lot that could be done about the bonding pattern, anyway, though we could imagine finding a position that better matched it. #e) """ # bruce 041215 made this from the first parts of the older methods bond1 # through bond4; the rest of each of those have become atom methods like # make_bondpoints_when_2_bonds. # The caller (self.attach [now renamed self.attach_to]) has been revised # to use these, and the result is (I think) equivalent to the old code, # except when el.numbonds > 4 [later: caller's new subrs now use atomtype not el], # when it does what it can rather than # doing nothing. The purpose was to fix bug 131 by using the new atom # methods by themselves. s1, p1 = lis[0] mol = s1.molecule # (same as its realneighbor's mol) totpos = + p1 # (copy it, so += can be safely used below) for sk, pk in lis[1:]: # 0 or more pairs after the first totpos += pk # warning: += can modify a mutable totpos pos = totpos / (0.0 + len(lis)) # use average of ideal positions atm = Atom(self.atomtype, pos, mol) for sk, pk in lis: sk.bonds[0].rebond(sk, atm) return atm pass # end of class AtomTypeDepositionTool # end
NanoCAD-master
cad/src/commands/BuildAtoms/build_utils.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ BuildAtoms_Command.py @version: $Id$ @copyright: 2004-2009 Nanorex, Inc. See LICENSE file for details. The 'Command' part of the BuildAtoms Mode (BuildAtoms_Command and BuildAtoms_basicGraphicsMode are the two split classes of the old depositMode). It provides the command object for its GraphicsMode class. The Command class defines anything related to the 'command half' of the mode -- For example: - Anything related to its current Property Manager, its settings or state - The model operations the command does (unless those are so simple that the mouse event bindings in the _GM half can do them directly and the code is still clean, *and* no command-half subclass needs to override them). TODO: [as of 2008-09-25] - Items mentioned in Build_GraphicsMode.py History: Originally as 'depositMode.py' by Josh Hall and then significantly modified by several developers. In January 2008, the old depositMode class was split into new Command and GraphicsMode parts and the these classes were moved into their own module [ See BuildAtoms_Command.py and BuildAtoms_GraphicsMode.py] """ from PyQt4.Qt import QSize import foundation.env as env import foundation.changes as changes from utilities.debug import print_compact_traceback from utilities.prefs_constants import buildModeHighlightingEnabled_prefs_key from utilities.prefs_constants import buildModeWaterEnabled_prefs_key from utilities.prefs_constants import keepBondsDuringTransmute_prefs_key from commands.BuildAtoms.BuildAtomsPropertyManager import BuildAtomsPropertyManager from commands.SelectAtoms.SelectAtoms_Command import SelectAtoms_Command from commands.BuildAtoms.BuildAtoms_GraphicsMode import BuildAtoms_GraphicsMode from ne1_ui.toolbars.Ui_BuildAtomsFlyout import BuildAtomsFlyout _superclass = SelectAtoms_Command class BuildAtoms_Command(SelectAtoms_Command): """ As of 2008-09-16, the BuildAtoms_Command has two tools : Atoms tool and Bonds tool. At any point of time, user is using either of those tools. so, the user is never in the default 'BuildAtoms_Command'. When user clicks on Build > Atoms button, he/she invokes BuildAtoms_Command. As soon as this command is entered, program invokes one of the two tools (subcommand). By default, we always invoke 'Atoms Tool'. @see: command_update_state() @see: B{AtomsTool_Command} , B{BondsTool_command} """ #GraphicsMode GraphicsMode_class = BuildAtoms_GraphicsMode #The class constant PM_class defines the class for the Property Manager of #this command. See Command.py for more infor about this class constant PM_class = BuildAtomsPropertyManager #Flyout Toolbar FlyoutToolbar_class = BuildAtomsFlyout commandName = 'DEPOSIT' featurename = "Build Atoms Mode" from utilities.constants import CL_ENVIRONMENT_PROVIDING command_level = CL_ENVIRONMENT_PROVIDING highlight_singlets = True #graphicsMode will be set in BuildAtoms_Command.__init__ . graphicsMode = None flyoutToolbar = None _currentActiveTool = 'ATOMS_TOOL' def __init__(self, commandSequencer): _superclass.__init__(self, commandSequencer) #Initialize some more attributes. self._pastable_atomtype = None #The following flag, if set to True, doesn't allow converting #bonds between the selected atoms to the bondtyp specified in the #flyout toolbar. This is used only while activating the #bond tool. See self._convert_bonds_bet_selected_atoms() for details self._suppress_convert_bonds_bet_selected_atoms = False def command_enter_misc_actions(self): """ Overrides superclass method. @see: baseCommand.command_enter_misc_actions() for documentation """ self.w.toolsDepositAtomAction.setChecked(True) def command_exit_misc_actions(self): """ Overrides superclass method. @see: baseCommand.command_exit_misc_actions() for documentation """ self.w.toolsDepositAtomAction.setChecked(False) def command_update_state(self): """ See superclass for documentation. Note that this method is called only when self is the currentcommand on the command stack. @see: BuildAtomsFlyout.resetStateOfActions() @see: self.activateAtomsTool() """ _superclass.command_update_state(self) #Make sure that the command Name is DEPOSIT. (because subclasses #of BuildAtoms_Command might be using this method). #As of 2008-09-16, the BuildAtoms_Command has two tools : #Atoms tool and Bonds tool. At any point of time, user is using either #of those tools. so, the user is never in the default #'BuildAtoms_Command'. When user clicks on Build > Atoms button, #he/she invokes BuildAtoms_Command. As soon as this command is entered, #we need to invoke one of the two tools (subcommand). #By default, we always invoke 'Atoms Tool'. if self.commandName == 'DEPOSIT': ## print "**** in BuildAtoms.command_update_state" self.activateAtomsTool() def enterToolsCommand(self, commandName = ''): #REVIEW """ Enter the given tools subcommand (e.g. Atoms tool or one of the bond tools) """ if not commandName: return commandSequencer = self.win.commandSequencer commandSequencer.userEnterCommand( commandName) def getBondTypeString(self): """ Overridden in subclasses. """ return '' def viewing_main_part(self): #bruce 050416 ###e should refile into assy return self.o.assy.current_selgroup_iff_valid() is self.o.assy.tree def select_chunk_of_highlighted_atom(self): """Select the chunk containing the highlighted atom or singlet""" if self.o.selatom: self.o.assy.permit_pick_parts() # was unpickparts; I think this is the intent (and the effect, # before now) [bruce 060721] self.o.assy.unpickall_in_GLPane() self.o.selatom.molecule.pick() self.w.win_update() def toggleShowOverlayText(self): if (self.o.selatom): chunk = self.o.selatom.molecule chunk.showOverlayText = not chunk.showOverlayText self.w.win_update() def makeMenus(self): #bruce 050705 revised this to support bond menus """ Create context menu for this command. (Build Atoms mode) """ selatom, selobj = self.graphicsMode.update_selatom_and_selobj( None) # bruce 050612 added this [as an update_selatom call] -- #not needed before since bareMotion did it (I guess). # [replaced with update_selatom_and_selobj, bruce 050705] self.Menu_spec = [] ###e could include disabled chunk & selatom name at the top, whether ##selatom is singlet, hotspot, etc. # figure out which Set Hotspot menu item to include, and whether to #disable it or leave it out if self.viewing_main_part(): text, meth = ('Set Hotspot and Copy', self.graphicsMode.setHotSpot_mainPart) # bruce 050121 renamed this from "Set Hotspot" to "Set Hotspot # and Copy as Pastable". # bruce 050511 shortened that to "Set Hotspot and Copy". # If you want the name to be shorter, then change the method # to do something simpler! Note that the locally set hotspot # matters if we later drag this chunk to the clipboard. # IMHO, the complexity is a sign that the design # should not yet be considered finished! else: text, meth = ('Set Hotspot of clipboard item', self.graphicsMode.setHotSpot_clipitem) ###e could check if it has a hotspot already, if that one is ## different, etc ###e could include atom name in menu text... Set Hotspot to X13 if selatom is not None and selatom.is_singlet(): item = (text, meth) elif selatom is not None: item = (text, meth, 'disabled') else: item = None if item: self.Menu_spec.append(item) # Add the trans-deposit menu item. if selatom is not None and selatom.is_singlet(): self.Menu_spec.append(( 'Trans-deposit previewed item', lambda dragatom=selatom: self.graphicsMode.transdepositPreviewedItem(dragatom) )) # figure out Select This Chunk item text and whether to include it ##e (should we include it for internal bonds, too? not for now, maybe ## not ever. [bruce 050705]) if selatom is not None: name = selatom.molecule.name item = ('Select Chunk %r' % name, self.select_chunk_of_highlighted_atom) #e maybe should disable this or change to checkmark item (with #unselect action) if it's already selected?? self.Menu_spec.append(item) chunk = selatom.molecule if (chunk.chunkHasOverlayText): # note: this is only a hint, but since it's updated whenever # chunk is drawn, I suspect it will always be up to date at # this point. (If not, that's ok -- these commands will just # be noops.) [bruce 090112 comment] if (chunk.showOverlayText): item = ('Hide overlay text on %r' % name, self.toggleShowOverlayText) else: item = ('Show overlay text on %r' % name, self.toggleShowOverlayText) self.Menu_spec.append(item) ##e add something similar for bonds, displaying their atoms, and the ##bonded chunk or chunks? if selatom is not None: #k is 2nd cond redundant with is_singlet()? is_singlet = selatom.is_singlet() and len(selatom.bonds) == 1 else: is_singlet = False # add submenu to change atom hybridization type [initial kluge] atomtypes = (selatom is None) and ['fake'] or selatom.element.atomtypes # kluge: ['fake'] is so the idiom "x and y or z" can pick y; # otherwise we'd use [] for 'y', but that doesn't work since it's #false. ## if selatom is not None and not selatom.is_singlet(): ## self.Menu_spec.append(( '%s' % selatom.atomtype.fullname_for_msg(), ##noop, 'disabled' )) if len(atomtypes) > 1: # i.e. if elt has >1 atom type available! #(then it must not be Singlet, btw) # make a submenu for the available types, checkmarking the current #one, disabling if illegal to change, sbartext for why # (this code belongs in some more modular place... where exactly? #it's part of an atom-type-editor for use in a menu... # put it with Atom, or with AtomType? ###e) submenu = [] for atype in atomtypes: submenu.append(( atype.fullname_for_msg(), lambda arg1=None, arg2=None, atype=atype: atype.apply_to(selatom), # Notes: the atype=atype is required # -- otherwise each lambda refers to the same # localvar 'atype' -- effectively by reference, # not by value -- # even though it changes during this loop! # Also at least one of the arg1 and arg2 are required, # otherwise atype ends up being an int, # at least acc'd to exception we get here. Why is Qt passing # this an int? Nevermind for now. ###k (atype is selatom.atomtype) and 'checked' or None, (not atype.ok_to_apply_to(selatom)) and 'disabled' or None )) self.Menu_spec.append(( 'Atom Type: %s' % selatom.atomtype.fullname_for_msg(), submenu )) ## self.Menu_spec.append(( 'Atom Type', submenu )) ###e offer to change element, too (or should the same submenu be used, ##with a separator? not sure) # for a highlighted bond, add submenu to change bond type, if atomtypes # would permit that; # or a menu item to just display the type, if not. Also add summary info # about the bond... # all this is returned (as a menu_spec sublist) by one external helper # method. if is_singlet: selbond = selatom.bonds[0] else: selbond = selobj # might not be a Bond (could be an Atom or None) try: method = selbond.bond_menu_section except AttributeError: # selbond is not a Bond pass else: glpane = self.o quat = glpane.quat try: menu_spec = method(quat = quat) #e pass some options?? except: print_compact_traceback("exception in bond_menu_section for %r, ignored: " % (selobj,)) else: if menu_spec: self.Menu_spec.extend(menu_spec) pass pass # Local minimize [now called Adjust Atoms in history/Undo, Adjust <what> #here and in selectMode -- mark & bruce 060705] # WARNING: This code is duplicated in selectMode.makeMenus(). # mark 060314. if selatom is not None and not selatom.is_singlet() and \ self.w.simSetupAction.isEnabled(): # if simSetupAction is not enabled, a sim process is running. #Fixes bug 1283. mark 060314. ## self.Menu_spec.append(( 'Adjust atom %s' % selatom, ##selatom.minimize_1_atom )) # older pseudocode # experimental. if we leave in these options, some of them might # want a submenu. # or maybe the layer depth is a dashboard control? or have buttons # instead of menu items? self.Menu_spec.append(( 'Adjust atom %s' % selatom, lambda e1=None, a = selatom: self.localmin(a,0) )) self.Menu_spec.append(( 'Adjust 1 layer', lambda e1=None, a = selatom: self.localmin(a,1) )) self.Menu_spec.append(( 'Adjust 2 layers', lambda e1=None, a = selatom: self.localmin(a,2) )) # offer to clean up singlet positions (not sure if this item should be # so prominent) if selatom is not None and not selatom.is_singlet(): sings = selatom.singNeighbors() #e when possible, use #baggageNeighbors() here and remake_baggage below. [bruce 051209] if sings or selatom.bad(): if sings: text = 'Reposition bondpoints' # - this might be offered even if they don't need # repositioning; # not easy to fix, but someday we'll always reposition # them whenever needed # and this menu command can be removed then. # - ideally we'd reposition H's too (i.e. # call remake_baggage below) else: text = 'Add bondpoints' # this text is only used if it #doesn't have enough cmd = (lambda a = selatom: self.RepositionBondpoints_command(a)) self.Menu_spec.append(( text, cmd )) ##e should finish and use remake_baggage (and baggageNeighbors) # selobj-specific menu items. # This is duplicated in selectMode.makeMenus(). # [bruce 060405 added try/except, and generalized this from Jig-specific # to selobj-specific items, # by replacing isinstance(selobj, Jig) with hasattr(selobj, # 'make_selobj_cmenu_items'), # so any kind of selobj can provide more menu items using this API. # Note that the only way selobj could customize its menu items to the # calling command or its graphicsMode # would be by assuming that was the currentCommand or its graphicsMode. # Someday we might extend the API # to pass it glpane, so we can support multiple glpanes, each in a # different command and/or graphicsMode. #e] if selobj is not None and hasattr(selobj, 'make_selobj_cmenu_items'): try: selobj.make_selobj_cmenu_items(self.Menu_spec) except: print_compact_traceback("bug: exception (ignored) in make_selobj_cmenu_items for %r: " % selobj) # separator and other mode menu items. if self.Menu_spec: self.Menu_spec.append(None) # Enable/Disable Jig Selection. # This is duplicated in selectMode.makeMenus() and s # electMolsMode.makeMenus(). if self.o.jigSelectionEnabled: self.Menu_spec.extend( [('Enable Jig Selection', self.graphicsMode.toggleJigSelection, 'checked')]) else: self.Menu_spec.extend( [('Enable Jig Selection', self.graphicsMode.toggleJigSelection, 'unchecked')]) self.Menu_spec.extend( [ # mark 060303. added the following: None, ('Edit Color Scheme...', self.w.colorSchemeCommand), ]) self.Menu_spec_shift = list(self.Menu_spec) #bruce 060721 experiment; # if it causes no harm, we can # replace the self.select item in the copy with one for #shift-selecting the chunk, to fix a bug/NFR 1833 ####@@@@ # (we should also rename self.select) return # from makeMenus def RepositionBondpoints_command(self, atom): del self atom.remake_bondpoints() atom.molecule.assy.glpane.gl_update() #bruce 080216 bugfix return def isHighlightingEnabled(self): """ overrides superclass method. @see: anyCommand.isHighlightingEnabled() """ return env.prefs[buildModeHighlightingEnabled_prefs_key] def isWaterSurfaceEnabled(self): """ overrides superclass method. @see: BuildAtoms_Command.isWaterSurfaceEnabled() """ return env.prefs[buildModeWaterEnabled_prefs_key] def isAtomsToolActive(self): """ Tells whether the Atoms Tool is active (boolean) @return: The checked state of B{self.depositAtomsAction} """ #TODO: It relies on self.depositAtomsAction to see if the tool is active #There needs to be a better way to tell this. One idea is to #test which graphicsMode / Command is currently being used. #But for that, Bond Tools needs to be a separate command on the #command stack instead of a part of Build Atoms Command. So, in the #near future, we need to refactor Build Atoms command to separate out # Atoms and Bonds tools. -- Ninad 2008-01-03 [commented while splitting # legacy depositMode class into Command/GM classes] ##return self.depositAtomsAction.isChecked() return self._currentActiveTool == 'ATOMS_TOOL' def isBondsToolActive(self): """ Tells whether the Bonds Tool is active (boolean) @return: The opposite of the checked state of B{self.depositAtomsAction} @see: comment in self.isAtomsToolActive() """ # Note: the intent of self.bondclick_v6 was to be true only when this # should return true, # but the Atom tool does not yet conform to that, # and the existing code as of 060702 appears to use this condition, # so for now [bruce 060702] it's deemed the official condition. # But I can't tell for sure whether the other conditions (modkeys, or # commented out access to another button) # belong here, so I didn't copy them here but left the code in #bondLeftUp unchanged (at least for A8). ##return not self.depositAtomsAction.isChecked() return self._currentActiveTool == 'BONDS_TOOL' def isDeleteBondsToolActive(self): """ Overridden in subclasses. Tells whether the Delete Bonds tool is active (boolean) @see: comment in self.isAtomsToolActive() """ #Note: this method will be removed soon. return False def activateAtomsTool(self): """ Activate the atoms tool of the Build Atoms mode hide only the Atoms Tools groupbox in the Build Atoms Property manager and show all others the others. @see: self.command_update_state() @see: BuildAtomsFlyout.resetStateOfActions() """ self._currentActiveTool = 'ATOMS_TOOL' self.propMgr.bondToolsGroupBox.hide() for grpbox in self.propMgr.previewGroupBox, self.propMgr.elementChooser: grpbox.show() #Not sure if the following is needed. pw is None when this method is #called from self.command_update_state() .. cause unknown as #of 2008-09-16. Commenting out this line [-- Ninad] ##self.propMgr.pw.propertyManagerScrollArea.ensureWidgetVisible( ##self.propMgr.headerFrame) self.graphicsMode.update_cursor() self.w.depositState = 'Atoms' self.propMgr.updateMessage() self.enterToolsCommand('ATOMS_TOOL') self.win.win_update() def activateBondsTool(self): """ Activate the bond tool of the Build Atoms mode Show only the Bond Tools groupbox in the Build Atoms Property manager and hide the others. @see:self._convert_bonds_bet_selected_atoms() """ self._currentActiveTool = 'BONDS_TOOL' for widget in (self.propMgr.previewGroupBox, self.propMgr.elementChooser, self.propMgr.atomChooserComboBox): widget.hide() self.propMgr.bondToolsGroupBox.show() self.propMgr.pw.propertyManagerScrollArea.ensureWidgetVisible( self.propMgr.headerFrame) #note: its okay if the check_action is None checked_action = self.flyoutToolbar.getCheckedBondToolAction() self.changeBondTool(action = checked_action) bondToolActions = self.flyoutToolbar.getBondToolActions() for btn in self.propMgr.bondToolButtonRow.buttonGroup.buttons(): btnId = self.propMgr.bondToolButtonRow.buttonGroup.id(btn) action = bondToolActions[btnId] btn.setIconSize(QSize(24,24)) btn.setDefaultAction(action) self.win.win_update() def changeBondTool(self, action): """ Change the bond tool (e.g. single, double, triple, aromatic and graphitic) depending upon the checked action. @param: action is the checked bond tool action in the bondToolsActionGroup """ bondTool_commandName = 'BOND_TOOL' if action is not None: objectName = action.objectName() prefix = 'ACTION_' #Note: objectName is a QString to convert it to a python string #first objectName = str(objectName) if objectName and objectName.startswith(prefix): objectName = ''.join(objectName) bondTool_commandName = objectName[len(prefix):] self.enterToolsCommand(bondTool_commandName) #=== Cursor id def get_cursor_id_for_active_tool(self): """ Provides a cursor id (int) for updating cursor in graphics mode, based on the checked action in its flyout toolbar. (i.e. based on the active tool) @see: BuildAtoms_GraphicsMode.update_cursor_for_no_MB_selection_filter_disabled """ if hasattr(self.flyoutToolbar, 'get_cursor_id_for_active_tool'): return self.flyoutToolbar.get_cursor_id_for_active_tool() return 0 #== Transmute helper methods ======================= def get_atomtype_from_MMKit(self): """ Return the current atomtype selected in the MMKit. Note: This appears to be very similar (if not completely redundant) to pastable_atomtype() in this file. """ elm = self.propMgr.elementChooser.getElement() atomtype = None if len(elm.atomtypes) > 1: try: # Obtain the hybrid index from the hybrid button group, not # the obsolete hybrid combobox. Fixes bug 2304. Mark 2007-06-20 hybrid_name = self.propMgr.elementChooser.atomType atype = elm.find_atomtype(hybrid_name) if atype is not None: atomtype = atype except: print_compact_traceback("exception (ignored): ") pass if atomtype is not None and atomtype.element is elm: return atomtype # For element that doesn't support hybridization return elm.atomtypes[0] def transmutePressed(self): """ Slot for "Transmute" button. """ forceToKeepBonds = env.prefs[keepBondsDuringTransmute_prefs_key] atomType = self.get_atomtype_from_MMKit() self.w.assy.modifyTransmute( self.propMgr.elementChooser.getElementNumber(), force = forceToKeepBonds, atomType=atomType) def isAutoBondingEnabled(self): if self.propMgr and hasattr(self.propMgr, 'autoBondCheckBox'): autoBondingEnabled = self.propMgr.autoBondCheckBox.isChecked() else: autoBondingEnabled = True return autoBondingEnabled def pastable_element(self): if self.propMgr and hasattr(self.propMgr, 'elementChooser'): return self.propMgr.elementChooser.getElement() else: # we're presumably a subclass with no propMgr or a different one from model.elements import Carbon return Carbon def pastable_atomtype(self): """ Return the current pastable atomtype. [REVIEW: This appears to be very similar (if not completely redundant) to get_atomtype_from_MMKit() in this file. This is still used as of 071025; that one is called only by the slot transmutePressed -- can that still be called?] """ #e we might extend this to remember a current atomtype per element #... not sure if useful current_element = self.pastable_element() if len(current_element.atomtypes) > 1: if self.propMgr and hasattr(self.propMgr, 'elementChooser'): try: hybrid_name = self.propMgr.elementChooser.atomType atype = current_element.find_atomtype(hybrid_name) if atype is not None: self._pastable_atomtype = atype except: print_compact_traceback("exception (ignored): ") pass else: # we're presumably a subclass with no propMgr or a different one pass if self._pastable_atomtype is not None and self._pastable_atomtype.element is current_element: return self._pastable_atomtype self._pastable_atomtype = current_element.atomtypes[0] return self._pastable_atomtype def disable_selection_filter(self): """ Disables the selection filter (if it is active) @see: The comment in BuildAtomsPropertyManager.set_selection_filter for things to be done when connectWithState API is functional This method is a temporary implementation @see: BuildAtoms_GraphicsMode.keyPress() which calls this method when Escape key is pressed. """ if self.w.selection_filter_enabled: # Uncheck (disable) the Atom Selection Filter and activate the # Atom Tool. if self.propMgr.selectionFilterCheckBox: self.propMgr.selectionFilterCheckBox.setChecked(False) return return def setElement(self, elementNumber): """ Set the current (active) element to I{elementNumber}. @param elementNumber: Element number. (i.e. 6 = Carbon) @type elementNumber: int """ self.propMgr.setElement(elementNumber) return
NanoCAD-master
cad/src/commands/BuildAtoms/BuildAtoms_Command.py
# Copyright 2004-2009 Nanorex, Inc. See LICENSE file for details. """ elementSelector.py $Id$ """ from PyQt4.Qt import QDialog from PyQt4.Qt import SIGNAL from PyQt4.Qt import QVBoxLayout from commands.ElementSelector.ElementSelectorDialog import Ui_ElementSelectorDialog from graphics.widgets.ThumbView import ElementView from model.elements import PeriodicTable from utilities.constants import diTUBES class elementSelector(QDialog, Ui_ElementSelectorDialog): def __init__(self, win): QDialog.__init__(self, win) self.setupUi(self) self.connect(self.closePTableButton,SIGNAL("clicked()"),self.close) self.connect(self.TransmuteButton,SIGNAL("clicked()"),self.transmutePressed) self.connect(self.elementButtonGroup,SIGNAL("clicked(int)"),self.setElementInfo) self.w = win self.elemTable = PeriodicTable self.displayMode = diTUBES self.elemGLPane = ElementView(self.elementFrame, "element glPane", self.w.glpane) # Put the GL widget inside the frame flayout = QVBoxLayout(self.elementFrame,1,1,'flayout') flayout.addWidget(self.elemGLPane,1) self.elementFrame.setWhatsThis("""3D view of current atom type""") self.TransmuteButton.setWhatsThis("""Transmutes selected atoms in the 3D workspace to current atom above.""") self.transmuteCheckBox.setWhatsThis("""Check if transmuted atoms should keep all existing bonds, even if chemistry is wrong.""") def setElementInfo(self,value): """ Called as a slot from button push of the element Button Group """ self.w.setElement(value) def update_dialog(self, elemNum): """ Update non user interactive controls display for current selected element: element label info and element graphics info """ self.color = self.elemTable.getElemColor(elemNum) elm = self.elemTable.getElement(elemNum) self.elemGLPane.resetView() self.elemGLPane.refreshDisplay(elm, self.displayMode) def transmutePressed(self): force = self.transmuteCheckBox.isChecked() self.w.assy.modifyTransmute(self.w.Element, force = force) # bruce 041216: renamed elemSet to modifyTransmute, added force option
NanoCAD-master
cad/src/commands/ElementSelector/elementSelector.py
NanoCAD-master
cad/src/commands/ElementSelector/__init__.py
# -*- coding: utf-8 -*- # Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. # Form implementation generated from reading ui file 'ElementSelectorDialog.ui' # # Created: Wed Sep 20 10:12:41 2006 # by: PyQt4 UI code generator 4.0.1 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_ElementSelectorDialog(object): def setupUi(self, ElementSelectorDialog): ElementSelectorDialog.setObjectName("ElementSelectorDialog") ElementSelectorDialog.resize(QtCore.QSize(QtCore.QRect(0,0,214,426).size()).expandedTo(ElementSelectorDialog.minimumSizeHint())) ElementSelectorDialog.setMinimumSize(QtCore.QSize(200,150)) palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(0),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(1),QtGui.QColor(230,231,230)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(2),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(3),QtGui.QColor(242,243,242)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(4),QtGui.QColor(115,115,115)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(5),QtGui.QColor(153,154,153)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(6),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(7),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(8),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(9),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(10),QtGui.QColor(230,231,230)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(11),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(12),QtGui.QColor(0,0,128)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(13),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(14),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(15),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Active,QtGui.QPalette.ColorRole(16),QtGui.QColor(232,232,232)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(0),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(1),QtGui.QColor(230,231,230)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(2),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(3),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(4),QtGui.QColor(115,115,115)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(5),QtGui.QColor(153,154,153)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(6),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(7),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(8),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(9),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(10),QtGui.QColor(230,231,230)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(11),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(12),QtGui.QColor(0,0,128)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(13),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(14),QtGui.QColor(0,0,255)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(15),QtGui.QColor(255,0,255)) palette.setColor(QtGui.QPalette.Inactive,QtGui.QPalette.ColorRole(16),QtGui.QColor(232,232,232)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(0),QtGui.QColor(128,128,128)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(1),QtGui.QColor(230,231,230)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(2),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(3),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(4),QtGui.QColor(115,115,115)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(5),QtGui.QColor(153,154,153)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(6),QtGui.QColor(128,128,128)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(7),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(8),QtGui.QColor(128,128,128)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(9),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(10),QtGui.QColor(230,231,230)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(11),QtGui.QColor(0,0,0)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(12),QtGui.QColor(0,0,128)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(13),QtGui.QColor(255,255,255)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(14),QtGui.QColor(0,0,255)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(15),QtGui.QColor(255,0,255)) palette.setColor(QtGui.QPalette.Disabled,QtGui.QPalette.ColorRole(16),QtGui.QColor(232,232,232)) ElementSelectorDialog.setPalette(palette) self.vboxlayout = QtGui.QVBoxLayout(ElementSelectorDialog) self.vboxlayout.setMargin(2) self.vboxlayout.setSpacing(2) self.vboxlayout.setObjectName("vboxlayout") self.elementFrame = QtGui.QFrame(ElementSelectorDialog) self.elementFrame.setMinimumSize(QtCore.QSize(200,150)) self.elementFrame.setFrameShape(QtGui.QFrame.Box) self.elementFrame.setFrameShadow(QtGui.QFrame.Raised) self.elementFrame.setObjectName("elementFrame") self.vboxlayout.addWidget(self.elementFrame) self.elementButtonGroup = QtGui.QGroupBox(ElementSelectorDialog) self.elementButtonGroup.setMinimumSize(QtCore.QSize(0,126)) self.elementButtonGroup.setObjectName("elementButtonGroup") self.gridlayout = QtGui.QGridLayout(self.elementButtonGroup) self.gridlayout.setMargin(2) self.gridlayout.setSpacing(0) self.gridlayout.setObjectName("gridlayout") self.toolButton1 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton1.setMinimumSize(QtCore.QSize(30,30)) self.toolButton1.setCheckable(True) self.toolButton1.setObjectName("toolButton1") self.gridlayout.addWidget(self.toolButton1,0,4,1,1) self.toolButton2 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton2.setMinimumSize(QtCore.QSize(30,30)) self.toolButton2.setCheckable(True) self.toolButton2.setObjectName("toolButton2") self.gridlayout.addWidget(self.toolButton2,0,5,1,1) self.toolButton6 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton6.setMinimumSize(QtCore.QSize(30,30)) self.toolButton6.setCheckable(True) self.toolButton6.setObjectName("toolButton6") self.gridlayout.addWidget(self.toolButton6,1,1,1,1) self.toolButton7 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton7.setMinimumSize(QtCore.QSize(30,30)) self.toolButton7.setCheckable(True) self.toolButton7.setObjectName("toolButton7") self.gridlayout.addWidget(self.toolButton7,1,2,1,1) self.toolButton8 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton8.setMinimumSize(QtCore.QSize(30,30)) self.toolButton8.setCheckable(True) self.toolButton8.setObjectName("toolButton8") self.gridlayout.addWidget(self.toolButton8,1,3,1,1) self.toolButton10 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton10.setMinimumSize(QtCore.QSize(30,30)) self.toolButton10.setCheckable(True) self.toolButton10.setObjectName("toolButton10") self.gridlayout.addWidget(self.toolButton10,1,5,1,1) self.toolButton9 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton9.setMinimumSize(QtCore.QSize(30,30)) self.toolButton9.setCheckable(True) self.toolButton9.setObjectName("toolButton9") self.gridlayout.addWidget(self.toolButton9,1,4,1,1) self.toolButton13 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton13.setMinimumSize(QtCore.QSize(30,30)) self.toolButton13.setCheckable(True) self.toolButton13.setObjectName("toolButton13") self.gridlayout.addWidget(self.toolButton13,2,0,1,1) self.toolButton17 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton17.setMinimumSize(QtCore.QSize(30,30)) self.toolButton17.setCheckable(True) self.toolButton17.setObjectName("toolButton17") self.gridlayout.addWidget(self.toolButton17,2,4,1,1) self.toolButton5 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton5.setMinimumSize(QtCore.QSize(30,30)) self.toolButton5.setCheckable(True) self.toolButton5.setObjectName("toolButton5") self.gridlayout.addWidget(self.toolButton5,1,0,1,1) self.toolButton10_2 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton10_2.setMinimumSize(QtCore.QSize(30,30)) self.toolButton10_2.setCheckable(True) self.toolButton10_2.setObjectName("toolButton10_2") self.gridlayout.addWidget(self.toolButton10_2,2,5,1,1) self.toolButton15 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton15.setMinimumSize(QtCore.QSize(30,30)) self.toolButton15.setCheckable(True) self.toolButton15.setObjectName("toolButton15") self.gridlayout.addWidget(self.toolButton15,2,2,1,1) self.toolButton16 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton16.setMinimumSize(QtCore.QSize(30,30)) self.toolButton16.setCheckable(True) self.toolButton16.setObjectName("toolButton16") self.gridlayout.addWidget(self.toolButton16,2,3,1,1) self.toolButton14 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton14.setMinimumSize(QtCore.QSize(30,30)) self.toolButton14.setCheckable(True) self.toolButton14.setObjectName("toolButton14") self.gridlayout.addWidget(self.toolButton14,2,1,1,1) self.toolButton33 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton33.setMinimumSize(QtCore.QSize(30,30)) self.toolButton33.setCheckable(True) self.toolButton33.setObjectName("toolButton33") self.gridlayout.addWidget(self.toolButton33,3,2,1,1) self.toolButton34 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton34.setMinimumSize(QtCore.QSize(30,30)) self.toolButton34.setCheckable(True) self.toolButton34.setObjectName("toolButton34") self.gridlayout.addWidget(self.toolButton34,3,3,1,1) self.toolButton35 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton35.setMinimumSize(QtCore.QSize(30,30)) self.toolButton35.setCheckable(True) self.toolButton35.setObjectName("toolButton35") self.gridlayout.addWidget(self.toolButton35,3,4,1,1) self.toolButton36 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton36.setMinimumSize(QtCore.QSize(30,30)) self.toolButton36.setCheckable(True) self.toolButton36.setObjectName("toolButton36") self.gridlayout.addWidget(self.toolButton36,3,5,1,1) self.toolButton32 = QtGui.QToolButton(self.elementButtonGroup) self.toolButton32.setMinimumSize(QtCore.QSize(30,30)) self.toolButton32.setCheckable(True) self.toolButton32.setObjectName("toolButton32") self.gridlayout.addWidget(self.toolButton32,3,1,1,1) self.vboxlayout.addWidget(self.elementButtonGroup) spacerItem = QtGui.QSpacerItem(20,16,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Fixed) self.vboxlayout.addItem(spacerItem) self.vboxlayout1 = QtGui.QVBoxLayout() self.vboxlayout1.setMargin(0) self.vboxlayout1.setSpacing(6) self.vboxlayout1.setObjectName("vboxlayout1") self.hboxlayout = QtGui.QHBoxLayout() self.hboxlayout.setMargin(0) self.hboxlayout.setSpacing(6) self.hboxlayout.setObjectName("hboxlayout") self.TransmuteButton = QtGui.QPushButton(ElementSelectorDialog) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(1),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.TransmuteButton.sizePolicy().hasHeightForWidth()) self.TransmuteButton.setSizePolicy(sizePolicy) self.TransmuteButton.setObjectName("TransmuteButton") self.hboxlayout.addWidget(self.TransmuteButton) spacerItem1 = QtGui.QSpacerItem(16,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem1) self.vboxlayout1.addLayout(self.hboxlayout) self.transmuteCheckBox = QtGui.QCheckBox(ElementSelectorDialog) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(1),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.transmuteCheckBox.sizePolicy().hasHeightForWidth()) self.transmuteCheckBox.setSizePolicy(sizePolicy) self.transmuteCheckBox.setObjectName("transmuteCheckBox") self.vboxlayout1.addWidget(self.transmuteCheckBox) self.vboxlayout.addLayout(self.vboxlayout1) spacerItem2 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout.addItem(spacerItem2) self.hboxlayout1 = QtGui.QHBoxLayout() self.hboxlayout1.setMargin(0) self.hboxlayout1.setSpacing(6) self.hboxlayout1.setObjectName("hboxlayout1") spacerItem3 = QtGui.QSpacerItem(106,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout1.addItem(spacerItem3) self.closePTableButton = QtGui.QPushButton(ElementSelectorDialog) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(1),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.closePTableButton.sizePolicy().hasHeightForWidth()) self.closePTableButton.setSizePolicy(sizePolicy) self.closePTableButton.setDefault(True) self.closePTableButton.setObjectName("closePTableButton") self.hboxlayout1.addWidget(self.closePTableButton) spacerItem4 = QtGui.QSpacerItem(10,20,QtGui.QSizePolicy.Fixed,QtGui.QSizePolicy.Minimum) self.hboxlayout1.addItem(spacerItem4) self.vboxlayout.addLayout(self.hboxlayout1) spacerItem5 = QtGui.QSpacerItem(20,16,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Fixed) self.vboxlayout.addItem(spacerItem5) self.retranslateUi(ElementSelectorDialog) QtCore.QObject.connect(self.closePTableButton,QtCore.SIGNAL("clicked()"),ElementSelectorDialog.close) QtCore.QMetaObject.connectSlotsByName(ElementSelectorDialog) ElementSelectorDialog.setTabOrder(self.TransmuteButton,self.transmuteCheckBox) ElementSelectorDialog.setTabOrder(self.transmuteCheckBox,self.closePTableButton) def retranslateUi(self, ElementSelectorDialog): ElementSelectorDialog.setWindowTitle(QtGui.QApplication.translate("ElementSelectorDialog", "Element Selector", None, QtGui.QApplication.UnicodeUTF8)) self.elementFrame.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "3D thumbnail view", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton1.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Hydrogen", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton1.setText(QtGui.QApplication.translate("ElementSelectorDialog", "H", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton1.setShortcut(QtGui.QApplication.translate("ElementSelectorDialog", "H", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton2.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Helium", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton2.setText(QtGui.QApplication.translate("ElementSelectorDialog", "He", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton6.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Carbon", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton6.setText(QtGui.QApplication.translate("ElementSelectorDialog", "C", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton6.setShortcut(QtGui.QApplication.translate("ElementSelectorDialog", "C", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton7.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Nitrogen", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton7.setText(QtGui.QApplication.translate("ElementSelectorDialog", "N", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton7.setShortcut(QtGui.QApplication.translate("ElementSelectorDialog", "N", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton8.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Oxygen", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton8.setText(QtGui.QApplication.translate("ElementSelectorDialog", "O", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton8.setShortcut(QtGui.QApplication.translate("ElementSelectorDialog", "O", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton10.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Neon", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton10.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Ne", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton9.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Fluorine", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton9.setText(QtGui.QApplication.translate("ElementSelectorDialog", "F", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton9.setShortcut(QtGui.QApplication.translate("ElementSelectorDialog", "F", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton13.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Aluminum", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton13.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Al", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton17.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Chlorine", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton17.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Cl", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton5.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Boron", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton5.setText(QtGui.QApplication.translate("ElementSelectorDialog", "B", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton5.setShortcut(QtGui.QApplication.translate("ElementSelectorDialog", "B", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton10_2.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Argon", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton10_2.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Ar", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton15.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Phosphorus", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton15.setText(QtGui.QApplication.translate("ElementSelectorDialog", "P", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton15.setShortcut(QtGui.QApplication.translate("ElementSelectorDialog", "P", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton16.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Sulfur", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton16.setText(QtGui.QApplication.translate("ElementSelectorDialog", "S", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton16.setShortcut(QtGui.QApplication.translate("ElementSelectorDialog", "S", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton14.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Silicon", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton14.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Si", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton33.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Arsenic", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton33.setText(QtGui.QApplication.translate("ElementSelectorDialog", "As", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton34.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Selenium", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton34.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Se", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton35.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Bromine", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton35.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Br", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton36.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Krypton", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton36.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Kr", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton32.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Germanium", None, QtGui.QApplication.UnicodeUTF8)) self.toolButton32.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Ge", None, QtGui.QApplication.UnicodeUTF8)) self.TransmuteButton.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Transmute Selected Atoms", None, QtGui.QApplication.UnicodeUTF8)) self.TransmuteButton.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Transmute", None, QtGui.QApplication.UnicodeUTF8)) self.transmuteCheckBox.setToolTip(QtGui.QApplication.translate("ElementSelectorDialog", "Check if transmuted atoms should keep all existing bonds, even if chemistry is wrong", None, QtGui.QApplication.UnicodeUTF8)) self.transmuteCheckBox.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Force to Keep Bonds", None, QtGui.QApplication.UnicodeUTF8)) self.closePTableButton.setText(QtGui.QApplication.translate("ElementSelectorDialog", "Close", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/commands/ElementSelector/ElementSelectorDialog.py
# -*- coding: utf-8 -*- # Copyright 2005-2007 Nanorex, Inc. See LICENSE file for details. # Form implementation generated from reading ui file 'ThermoPropDialog.ui' # # Created: Wed Sep 20 08:56:21 2006 # by: PyQt4 UI code generator 4.0.1 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_ThermoPropDialog(object): def setupUi(self, ThermoPropDialog): ThermoPropDialog.setObjectName("ThermoPropDialog") ThermoPropDialog.resize(QtCore.QSize(QtCore.QRect(0,0,307,170).size()).expandedTo(ThermoPropDialog.minimumSizeHint())) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(7),QtGui.QSizePolicy.Policy(7)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(ThermoPropDialog.sizePolicy().hasHeightForWidth()) ThermoPropDialog.setSizePolicy(sizePolicy) ThermoPropDialog.setSizeGripEnabled(True) self.vboxlayout = QtGui.QVBoxLayout(ThermoPropDialog) self.vboxlayout.setMargin(11) self.vboxlayout.setSpacing(6) self.vboxlayout.setObjectName("vboxlayout") self.hboxlayout = QtGui.QHBoxLayout() self.hboxlayout.setMargin(0) self.hboxlayout.setSpacing(6) self.hboxlayout.setObjectName("hboxlayout") self.vboxlayout1 = QtGui.QVBoxLayout() self.vboxlayout1.setMargin(0) self.vboxlayout1.setSpacing(6) self.vboxlayout1.setObjectName("vboxlayout1") self.nameTextLabel = QtGui.QLabel(ThermoPropDialog) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(5),QtGui.QSizePolicy.Policy(5)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.nameTextLabel.sizePolicy().hasHeightForWidth()) self.nameTextLabel.setSizePolicy(sizePolicy) self.nameTextLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.nameTextLabel.setObjectName("nameTextLabel") self.vboxlayout1.addWidget(self.nameTextLabel) self.molnameTextLabel = QtGui.QLabel(ThermoPropDialog) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(5),QtGui.QSizePolicy.Policy(5)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.molnameTextLabel.sizePolicy().hasHeightForWidth()) self.molnameTextLabel.setSizePolicy(sizePolicy) self.molnameTextLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.molnameTextLabel.setObjectName("molnameTextLabel") self.vboxlayout1.addWidget(self.molnameTextLabel) self.colorTextLabel = QtGui.QLabel(ThermoPropDialog) self.colorTextLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.colorTextLabel.setObjectName("colorTextLabel") self.vboxlayout1.addWidget(self.colorTextLabel) self.hboxlayout.addLayout(self.vboxlayout1) self.vboxlayout2 = QtGui.QVBoxLayout() self.vboxlayout2.setMargin(0) self.vboxlayout2.setSpacing(6) self.vboxlayout2.setObjectName("vboxlayout2") self.nameLineEdit = QtGui.QLineEdit(ThermoPropDialog) self.nameLineEdit.setEnabled(True) self.nameLineEdit.setAlignment(QtCore.Qt.AlignLeading) self.nameLineEdit.setObjectName("nameLineEdit") self.vboxlayout2.addWidget(self.nameLineEdit) self.molnameLineEdit = QtGui.QLineEdit(ThermoPropDialog) self.molnameLineEdit.setEnabled(True) self.molnameLineEdit.setAlignment(QtCore.Qt.AlignLeading) self.molnameLineEdit.setReadOnly(True) self.molnameLineEdit.setObjectName("molnameLineEdit") self.vboxlayout2.addWidget(self.molnameLineEdit) self.hboxlayout1 = QtGui.QHBoxLayout() self.hboxlayout1.setMargin(0) self.hboxlayout1.setSpacing(6) self.hboxlayout1.setObjectName("hboxlayout1") self.hboxlayout2 = QtGui.QHBoxLayout() self.hboxlayout2.setMargin(0) self.hboxlayout2.setSpacing(6) self.hboxlayout2.setObjectName("hboxlayout2") self.jig_color_pixmap = QtGui.QLabel(ThermoPropDialog) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(5),QtGui.QSizePolicy.Policy(5)) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.jig_color_pixmap.sizePolicy().hasHeightForWidth()) self.jig_color_pixmap.setSizePolicy(sizePolicy) self.jig_color_pixmap.setMinimumSize(QtCore.QSize(40,0)) self.jig_color_pixmap.setScaledContents(True) self.jig_color_pixmap.setObjectName("jig_color_pixmap") self.hboxlayout2.addWidget(self.jig_color_pixmap) self.choose_color_btn = QtGui.QPushButton(ThermoPropDialog) self.choose_color_btn.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(1),QtGui.QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.choose_color_btn.sizePolicy().hasHeightForWidth()) self.choose_color_btn.setSizePolicy(sizePolicy) self.choose_color_btn.setAutoDefault(False) self.choose_color_btn.setObjectName("choose_color_btn") self.hboxlayout2.addWidget(self.choose_color_btn) self.hboxlayout1.addLayout(self.hboxlayout2) spacerItem = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout1.addItem(spacerItem) self.vboxlayout2.addLayout(self.hboxlayout1) self.hboxlayout.addLayout(self.vboxlayout2) self.vboxlayout.addLayout(self.hboxlayout) spacerItem1 = QtGui.QSpacerItem(20,25,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout.addItem(spacerItem1) self.hboxlayout3 = QtGui.QHBoxLayout() self.hboxlayout3.setMargin(0) self.hboxlayout3.setSpacing(6) self.hboxlayout3.setObjectName("hboxlayout3") spacerItem2 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout3.addItem(spacerItem2) self.ok_btn = QtGui.QPushButton(ThermoPropDialog) self.ok_btn.setMinimumSize(QtCore.QSize(0,0)) self.ok_btn.setAutoDefault(False) self.ok_btn.setDefault(False) self.ok_btn.setObjectName("ok_btn") self.hboxlayout3.addWidget(self.ok_btn) self.cancel_btn = QtGui.QPushButton(ThermoPropDialog) self.cancel_btn.setMinimumSize(QtCore.QSize(0,0)) self.cancel_btn.setAutoDefault(False) self.cancel_btn.setDefault(False) self.cancel_btn.setObjectName("cancel_btn") self.hboxlayout3.addWidget(self.cancel_btn) self.vboxlayout.addLayout(self.hboxlayout3) self.retranslateUi(ThermoPropDialog) QtCore.QObject.connect(self.cancel_btn,QtCore.SIGNAL("clicked()"),ThermoPropDialog.reject) QtCore.QObject.connect(self.ok_btn,QtCore.SIGNAL("clicked()"),ThermoPropDialog.accept) QtCore.QMetaObject.connectSlotsByName(ThermoPropDialog) ThermoPropDialog.setTabOrder(self.nameLineEdit,self.molnameLineEdit) ThermoPropDialog.setTabOrder(self.molnameLineEdit,self.choose_color_btn) ThermoPropDialog.setTabOrder(self.choose_color_btn,self.ok_btn) ThermoPropDialog.setTabOrder(self.ok_btn,self.cancel_btn) def retranslateUi(self, ThermoPropDialog): ThermoPropDialog.setWindowTitle(QtGui.QApplication.translate("ThermoPropDialog", "Thermometer Properties", None, QtGui.QApplication.UnicodeUTF8)) self.nameTextLabel.setText(QtGui.QApplication.translate("ThermoPropDialog", "Name:", None, QtGui.QApplication.UnicodeUTF8)) self.molnameTextLabel.setText(QtGui.QApplication.translate("ThermoPropDialog", "Attached to:", None, QtGui.QApplication.UnicodeUTF8)) self.colorTextLabel.setText(QtGui.QApplication.translate("ThermoPropDialog", "Color:", None, QtGui.QApplication.UnicodeUTF8)) self.choose_color_btn.setToolTip(QtGui.QApplication.translate("ThermoPropDialog", "Change color", None, QtGui.QApplication.UnicodeUTF8)) self.choose_color_btn.setText(QtGui.QApplication.translate("ThermoPropDialog", "Choose...", None, QtGui.QApplication.UnicodeUTF8)) self.ok_btn.setText(QtGui.QApplication.translate("ThermoPropDialog", "&OK", None, QtGui.QApplication.UnicodeUTF8)) self.ok_btn.setShortcut(QtGui.QApplication.translate("ThermoPropDialog", "Alt+O", None, QtGui.QApplication.UnicodeUTF8)) self.cancel_btn.setText(QtGui.QApplication.translate("ThermoPropDialog", "&Cancel", None, QtGui.QApplication.UnicodeUTF8)) self.cancel_btn.setShortcut(QtGui.QApplication.translate("ThermoPropDialog", "Alt+C", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/commands/ThermometerProperties/ThermoPropDialog.py
NanoCAD-master
cad/src/commands/ThermometerProperties/__init__.py
# Copyright 2004-2007 Nanorex, Inc. See LICENSE file for details. """ ThermoProp.py - edit properties of Thermometer jig $Id$ """ from PyQt4 import QtGui from PyQt4.Qt import QDialog from PyQt4.Qt import SIGNAL from PyQt4.Qt import QColorDialog from commands.ThermometerProperties.ThermoPropDialog import Ui_ThermoPropDialog from widgets.widget_helpers import RGBf_to_QColor, QColor_to_RGBf, get_widget_with_color_palette class ThermoProp(QDialog, Ui_ThermoPropDialog): def __init__(self, thermo, glpane): QDialog.__init__(self) self.setupUi(self) self.connect(self.cancel_btn, SIGNAL("clicked()"), self.reject) self.connect(self.ok_btn, SIGNAL("clicked()"), self.accept) self.connect(self.choose_color_btn, SIGNAL("clicked()"), self.change_jig_color) self.jig = thermo self.glpane = glpane jigtype_name = self.jig.__class__.__name__ self.setWindowIcon(QtGui.QIcon("ui/border/"+ jigtype_name)) def setup(self): self.jig_attrs = self.jig.copyable_attrs_dict() # Save the jig's attributes in case of Cancel. # Jig color self.jig_QColor = RGBf_to_QColor(self.jig.normcolor) # Used as default color by Color Chooser self.jig_color_pixmap = get_widget_with_color_palette( self.jig_color_pixmap, self.jig_QColor) # Jig name self.nameLineEdit.setText(self.jig.name) self.molnameLineEdit.setText(self.jig.atoms[0].molecule.name) def change_jig_color(self): """ Slot method to change the jig's color. """ color = QColorDialog.getColor(self.jig_QColor, self) if color.isValid(): self.jig_QColor = color self.jig_color_pixmap = get_widget_with_color_palette( self.jig_color_pixmap, self.jig_QColor) self.jig.color = self.jig.normcolor = QColor_to_RGBf(color) self.glpane.gl_update() def accept(self): """ Slot for the 'OK' button """ self.jig.try_rename(self.nameLineEdit.text()) self.jig.assy.w.win_update() # Update model tree self.jig.assy.changed() QDialog.accept(self) def reject(self): """ Slot for the 'Cancel' button """ self.jig.attr_update(self.jig_attrs) # Restore attributes of the jig. self.glpane.gl_update() QDialog.reject(self)
NanoCAD-master
cad/src/commands/ThermometerProperties/ThermoProp.py
# -*- coding: utf-8 -*- # Copyright 2005-2007 Nanorex, Inc. See LICENSE file for details. # Form implementation generated from reading ui file 'PlotToolDialog.ui' # # Created: Wed Sep 20 07:07:09 2006 # by: PyQt4 UI code generator 4.0.1 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_PlotToolDialog(object): def setupUi(self, PlotToolDialog): PlotToolDialog.setObjectName("PlotToolDialog") PlotToolDialog.resize(QtCore.QSize(QtCore.QRect(0,0,264,150).size()).expandedTo(PlotToolDialog.minimumSizeHint())) self.gridlayout = QtGui.QGridLayout(PlotToolDialog) self.gridlayout.setMargin(11) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.vboxlayout = QtGui.QVBoxLayout() self.vboxlayout.setMargin(0) self.vboxlayout.setSpacing(6) self.vboxlayout.setObjectName("vboxlayout") self.gridlayout1 = QtGui.QGridLayout() self.gridlayout1.setMargin(0) self.gridlayout1.setSpacing(6) self.gridlayout1.setObjectName("gridlayout1") self.hboxlayout = QtGui.QHBoxLayout() self.hboxlayout.setMargin(0) self.hboxlayout.setSpacing(6) self.hboxlayout.setObjectName("hboxlayout") self.plot_btn = QtGui.QPushButton(PlotToolDialog) self.plot_btn.setObjectName("plot_btn") self.hboxlayout.addWidget(self.plot_btn) self.done_btn = QtGui.QPushButton(PlotToolDialog) self.done_btn.setObjectName("done_btn") self.hboxlayout.addWidget(self.done_btn) self.gridlayout1.addLayout(self.hboxlayout,2,0,1,1) self.plot_combox = QtGui.QComboBox(PlotToolDialog) self.plot_combox.setObjectName("plot_combox") self.gridlayout1.addWidget(self.plot_combox,1,0,1,1) self.textLabel1 = QtGui.QLabel(PlotToolDialog) self.textLabel1.setObjectName("textLabel1") self.gridlayout1.addWidget(self.textLabel1,0,0,1,1) self.vboxlayout.addLayout(self.gridlayout1) spacerItem = QtGui.QSpacerItem(20,16,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout.addItem(spacerItem) self.hboxlayout1 = QtGui.QHBoxLayout() self.hboxlayout1.setMargin(0) self.hboxlayout1.setSpacing(6) self.hboxlayout1.setObjectName("hboxlayout1") self.open_trace_file_btn = QtGui.QPushButton(PlotToolDialog) self.open_trace_file_btn.setObjectName("open_trace_file_btn") self.hboxlayout1.addWidget(self.open_trace_file_btn) self.open_gnuplot_btn = QtGui.QPushButton(PlotToolDialog) self.open_gnuplot_btn.setObjectName("open_gnuplot_btn") self.hboxlayout1.addWidget(self.open_gnuplot_btn) self.vboxlayout.addLayout(self.hboxlayout1) self.gridlayout.addLayout(self.vboxlayout,0,0,1,1) self.retranslateUi(PlotToolDialog) QtCore.QObject.connect(self.done_btn,QtCore.SIGNAL("clicked()"),PlotToolDialog.close) QtCore.QMetaObject.connectSlotsByName(PlotToolDialog) PlotToolDialog.setTabOrder(self.plot_combox,self.plot_btn) PlotToolDialog.setTabOrder(self.plot_btn,self.done_btn) PlotToolDialog.setTabOrder(self.done_btn,self.open_trace_file_btn) PlotToolDialog.setTabOrder(self.open_trace_file_btn,self.open_gnuplot_btn) def retranslateUi(self, PlotToolDialog): PlotToolDialog.setWindowTitle(QtGui.QApplication.translate("PlotToolDialog", "Make Graphs", None, QtGui.QApplication.UnicodeUTF8)) self.plot_btn.setText(QtGui.QApplication.translate("PlotToolDialog", "Make Graph", None, QtGui.QApplication.UnicodeUTF8)) self.done_btn.setText(QtGui.QApplication.translate("PlotToolDialog", "Done", None, QtGui.QApplication.UnicodeUTF8)) self.textLabel1.setText(QtGui.QApplication.translate("PlotToolDialog", "Select jig to graph:", None, QtGui.QApplication.UnicodeUTF8)) self.open_trace_file_btn.setText(QtGui.QApplication.translate("PlotToolDialog", "Open Trace File", None, QtGui.QApplication.UnicodeUTF8)) self.open_gnuplot_btn.setText(QtGui.QApplication.translate("PlotToolDialog", "Open GNUplot File", None, QtGui.QApplication.UnicodeUTF8))
NanoCAD-master
cad/src/commands/Plot/PlotToolDialog.py
NanoCAD-master
cad/src/commands/Plot/__init__.py
# Copyright 2005-2007 Nanorex, Inc. See LICENSE file for details. """ PlotTool.py @author: Mark @version: $Id$ @copyright: 2005-2007 Nanorex, Inc. See LICENSE file for details. bruce 060105 revised trace file header parsing to fix bug 1266 and make it more likely to keep working with future revisions to trace file format. """ import sys, os, string from PyQt4.Qt import QWidget from PyQt4.Qt import SIGNAL from PyQt4.Qt import QStringList from commands.Plot.PlotToolDialog import Ui_PlotToolDialog from utilities.Log import redmsg, greenmsg, orangemsg from simulation.movie import find_saved_movie from platform_dependent.PlatformDependent import open_file_in_editor import foundation.env as env from utilities.debug import print_compact_traceback debug_gnuplot = False debug_plottool = False cmd = greenmsg("Make Graphs: ") #### this is bad, needs to be removed, but that's hard to do safely [bruce 060105 comment] #ninad060807 renamed Plot Tool to 'Make Graphs' class PlotTool(QWidget, Ui_PlotToolDialog): # Bug 1484, wware 060317 - PlotTool requires a trace file and a plot file. def __init__(self, assy, basefilename): QWidget.__init__(self) self.setupUi(self) self.connect(self.done_btn,SIGNAL("clicked()"),self.close) self.connect(self.plot_btn,SIGNAL("clicked()"),self.genPlot) self.connect(self.open_gnuplot_btn,SIGNAL("clicked()"),self.openGNUplotFile) self.connect(self.open_trace_file_btn,SIGNAL("clicked()"),self.openTraceFile) try: tracefilename = assy.current_movie.get_trace_filename() plotfilename = tracefilename[:-13] + "-plot.txt" #tracefilename = basefilename[:-4] + "-xyztrace.txt" inf = open(tracefilename) inf.close() except IOError: tracefilename = assy.current_movie.get_trace_filename() plotfilename = tracefilename[:-10] + "-plot.txt" #tracefilename = basefilename[:-4] + "-trace.txt" self.traceFile = tracefilename self.plotFile = plotfilename self.setup() self.show() # Fixed bug 440-1. Mark 050802. def setup(self): """Setup the Plot Tool dialog, including populating the combobox with plotting options. """ # To setup the Plot Tool, we need to do the following: # 1. Read the header from the trace file to obtain: # - Date and time # - Trajectory (DPB) filename. This is redundant now, but will be necessary when # Plot Tool allows the user to open and plot any trace file. # - The number of columns of data in the trace file so we can... # 2. Populate the plot combobox with the graph names # Make sure the tracefile exists if not os.path.exists(self.traceFile): msg = redmsg("Trace file [" + self.traceFile + "] is missing. Plot aborted.") env.history.message(cmd + msg) return 1 # Now we read specific lines of the traceFile to read parts of the header we need. # I will change this soon so that we can find this header info without knowing what line they are on. # Mark 050310 #bruce 060105: changing this now, to fix bug 1266. # If we've opened the tracefile once during this session, we # must check to see if the trace file has changed on disk. # To avoid this issue we reopen it every time and make sure to close it # and don't use any sort of line cache. # Mark had a comment about this but I [bruce 060105] am not sure what he meant by it: # Doesn't appear to be an issue calling checkcache before getline. #linecache.checkcache() # He also had some commented out code such as "#linecache.getline(self.traceFile, 5)" # which I've removed (as of rev 1.32). #Open trace file to read. traceFile = open(self.traceFile, 'rU') #bruce 060105 added 'rU' traceLines = traceFile.readlines() #e could optim by reading only the first XXX lines (100 or 1000) traceFile.close() headerLines = [] # all lines of header (used to count line numbers and for column headings) field_to_content = {} # maps fieldname to content, # where entire line is "#" + fieldname + ":" + content, but we strip outer whitespace on field and content columns_lineno = -1 # line number (0-based) of "%d columns" (-1 == not yet known) number_of_columns = 0 # will be changed to correct value when that's found for line in traceLines: # loop over lines, but stop when we find end of header, and partly stop when we find "%d columns". if not line.startswith("#"): # note: most start with "# ", but some are just "#" and nothing more. break # first non-comment line ends the header # header line headerLines.append(line) if ":" in line and columns_lineno == -1: # not all of these contain ": " field, content = line.split(":", 1) field = field[1:].strip() # get rid of "#" before stripping field content = content.strip() # (note: zaps final newline as well as blanks) if field.endswith(" columns"): # assume we found "# <nnn> columns:" and column-header lines will follow (but no more field:content lines) columns_lineno = len(headerLines) - 1 # 0-based, since purpose is internal indexing # note: this assignment also makes this loop stop looking for field:content lines number_of_columns = int(field.split()[0]) else: field_to_content[field] = content pass pass del traceLines if debug_plottool: print "columns_lineno (0-based) =", columns_lineno print " that line is:", headerLines[columns_lineno] print "number_of_columns =", number_of_columns print "field_to_content = %r" % (field_to_content,) # figure out column headers all at once column_header = {} for i in range(number_of_columns): column_header[i] = headerLines[columns_lineno + 1 + i][2:-1] # strip off "# " and final newline (would .strip be better or worse??) if debug_plottool: print "column header %d is %r" % (i, column_header[i],) pass # use the parsed header # (the code above depends only on the trace file format; # the code below depends only on our use of it here) self.date = field_to_content["Date and Time"] # Mark's code had [:-1] after that -- I'm guessing it was to zap final newline, now done by .strip(), # so I'm leaving it out for now. [bruce 060105] # Get trajectory file name self.dpbname = field_to_content["Output File"] ncols = number_of_columns self.ncols = ncols #bruce 060425 part of traceback bugfix # Populate the plot combobox with plotting options. if ncols: for i in range(ncols): self.plot_combox.insertItem( i, column_header[i] ) else: # No jigs in the part, so nothing to plot. Revised msgs per bug 440-2. Mark 050731. msg = redmsg("The part contains no jigs that write data to the trace file. Nothing to plot.") env.history.message(cmd + msg) msg = "The following jigs write output to the tracefile: Measurement jigs, Rotary Motors, Linear Motors, Anchors, Thermostats and Thermometers." env.history.message(msg) return 1 self.lastplot = 0 #bruce 060425 guesses this is no longer needed after my bugfix below for when this returned 1 above, # and also wonders if 0 was indeed an illegal column number (if not, it was incorrect, but I don't know). # But, not knowing, I will leave it in. return lastplot = "impossible value for a column number" #bruce 060425 part of fixing traceback bug when the first plot you try (by pressing Plot button) # was for an mmp file with no plottable jigs. This commit comes after A7 tag and release, # but will probably make it into a remade A7 or A7.0.1. ncols = 0 #bruce 060425 part of fixing traceback bug def genPlot(self): """Generates GNUplot plotfile, then calls self.runGNUplot. """ if self.ncols < 1: #bruce 060425 part of fixing traceback bug msg = redmsg("Nothing to plot.") # more details not needed, they were already printed when plot tool came up. env.history.message(cmd + msg) return col = self.plot_combox.currentIndex() + 2 # Column number to plot # If this plot was the same as the last plot, just run GNUplot on the plotfile. # This allows us to edit the current plotfile in a text editor via "Open GNUplot File" # and replot without overwriting it. if col == self.lastplot: self.runGNUplot(self.plotFile) return else: self.lastplot = col title = str(self.plot_combox.currentText()) # Plot title tlist = string.split(title, ":") ytitle = str(tlist[1]) # Y Axis title # Write GNUplot file f = open(self.plotFile,"w") if sys.platform == 'darwin': f.write("set terminal aqua\n") # GNUplot for Mac needs this. # On Windows, self.traceFile can have backward slashes (\) as separators. # GNUplot does C-like backslash processing within double quoted strings. This requires # two backslash characters in place of one as a separator. This is only a problem on # Windows since Linux and MacOS always use forward slashes for file separators. # If a backslash were to appear in a Linux/MacOS tracefile name, GNUplot would very # likely puke on it, too. For this reason, let's always replace a single backslash # with double backslashes. # Fixes bug 1894. Mark 060424. traceFile = self.traceFile.replace('\\','\\\\') f.write("set title \"%s\\n Trace file: %s\\n Created: %s\"\n"%(title, traceFile, self.date)) f.write("set key left box\n") f.write("set xlabel \"time (picoseconds)\"\n") f.write("set ylabel \"%s\"\n"%(ytitle)) f.write("plot \"%s\" using 1:%d title \"Data Points\" with lines lt 2,\\\n"%(traceFile, col)) f.write(" \"%s\" using 1:%d:(0.5) smooth acsplines title \"Average\" lt 3\n"%(traceFile, col)) # Fixed bug 712 by swapping single quote (') with double quote(") around traceFile (%s). if sys.platform == 'win32': # The plot will stay up until the OK or Cancel button is clicked. f.write("pause mouse \"Click OK or Cancel to Quit\"\n") #bruce 060425 added \n at end (probably doesn't matter, not sure) elif sys.platform == 'darwin': #bruce 060425 added this case, since on Mac the pause is useless (AquaTerm stays up without it) # and perhaps undesirable (causes AquaTerm dialog warning when user quits it). # Maybe a quit at the end is never needed, or maybe it's also useful on non-Macs -- I don't know. # I tried without the quit and the gnuplot process terminated anyway, so I won't include the quit. if debug_gnuplot: f.write("pause 120\n") # just long enough to see it in ps output for debugging # Note: during this pause, if user tries to quit AquaTerm, they get a warning dialog about clients still connected, # but after this pause elapses, the gnuplot process is not running, and the user can quit AquaTerm with no dialog. pass # or could do f.write("quit\n") else: # "pause mouse" doesn't work on Linux as it does on Windows. # I suspect this is because QProcess doesn't spawn a child, but forks a sibling process. # The workaround is thus: plot will stick around for 3600 seconds (1 hr). # Mark 050310 f.write("pause 3600\n") #bruce 060425 added \n at end (probably doesn't matter, not sure) f.close() self.runGNUplot(self.plotFile) def runGNUplot(self, plotfile): """Sends plotfile to GNUplot. """ # Make sure plotfile exists if not os.path.exists(plotfile): msg = redmsg("Plotfile [" + plotfile + "] is missing. Plot aborted.") env.history.message(cmd + msg) return # filePath = the current directory NE-1 is running from. filePath = os.path.dirname(os.path.abspath(sys.argv[0])) # "program" is the full path to the GNUplot executable. if sys.platform == 'win32': program = os.path.normpath(filePath + '/../bin/wgnuplot.exe') else: program = os.path.normpath('/usr/bin/gnuplot') # Set environment variables to make gnuplot use a specific AquaTerm on # Mac. Originally "Huaicai 3/18", fixed by Brian Helfrich May 23, 2007. # if sys.platform == 'darwin': aquaPath = os.path.normpath(filePath + '/../bin/AquaTerm.app') os.environ['AQUATERM_PATH'] = aquaPath aquaPath = \ os.path.normpath(filePath + '/../Frameworks/AquaTerm.framework') os.environ['DYLD_LIBRARY_PATH'] = aquaPath # Note: I tried using: # environment.append(QString('AQUATERM_PATH=%s' % aquaPath)) # environment.append(QString('DYLD_LIBRARY_PATH=%s' % aquaPath)) # followed by plotProcess.setEnvironment(environment), but it just # wouldn't see the AquaTerm library. So, although the above is more # heavy-handed than just changing the Process environment, at least # it works. # Make sure GNUplot executable exists if not os.path.exists(program): msg = redmsg("GNUplot executable [" + program + "] is missing. Plot aborted.") env.history.message(cmd + msg) return plotProcess = None try: from processes.Process import Process plotProcess = Process() # Run gnuplot as a new, separate process. started = plotProcess.startDetached(program, QStringList(plotfile)) ###e It might also be good to pass gnuplot some arg to tell it to ignore ~/.gnuplot. [bruce 060425 guess] if not started: env.history.message(redmsg("gnuplot failed to run!")) else: env.history.message("Running gnuplot file: " + plotfile) if debug_gnuplot: try: #bruce 060425 debug code; Qt assistant for QProcess says this won't work on Windows (try it there anyway). pid = plotProcess.pid() # This should work on Windows in Qt 4.2 [mark 2007-05-03] pid = int(pid) # this is what is predicted to fail on Windows env.history.message("(debug: gnuplot is %r, its process id is %d)" % (program, pid)) except: print_compact_traceback("debug: exception printing processIdentifier (might be normal on Windows): ") pass pass except: # We had an exception. print"exception in GNUplot; continuing: " if plotProcess: print ">>> %d" % plotProcess.error() print "Killing process" plotProcess.kill() plotProcess = None def openTraceFile(self): """Opens the current tracefile in an editor. """ open_file_in_editor(self.traceFile) def openGNUplotFile(self): """Opens the current GNUplot file in an editor. """ open_file_in_editor(self.plotFile) # == def simPlot(assy): # moved here from MWsemantics method, bruce 050327 """Opens the "Make Graphs" dialog (and waits until it's dismissed), for the current movie if there is one, otherwise for a previously saved dpb file with the same name as the current part, if one can be found. Returns the dialog, after it's dismissed (probably useless), or None if no dialog was shown. """ #bruce 050326 inferred docstring from code, then revised to fit my recent changes # to assy.current_movie, but didn't yet try to look for alternate dpb file names # when the current part is not the main part. (I'm sure that we'll soon have a wholly # different scheme for letting the user look around for preexisting related files to use, # like movie files applicable to the current part.) # I did reorder the code, and removed the check on the current part having atoms # (since plotting from an old file shouldn't require movie to be valid for current part). # This method should be moved into some other file. if assy.current_movie and assy.current_movie.filename: return PlotTool(assy, assy.current_movie.filename) else: msg = redmsg("There is no current movie file loaded.") env.history.message(cmd + msg) return None # wware 060317, bug 1484 if assy.filename: return PlotTool(assy, assy.filename) # no valid current movie, look for saved one with same name as assy msg = redmsg("No simulation has been run yet.") env.history.message(cmd + msg) if assy.filename: if assy.part is not assy.tree.part: msg = redmsg("Warning: Looking for saved movie for main part, not for displayed clipboard item.") env.history.message(cmd + msg) mfile = assy.filename[:-4] + ".dpb" movie = find_saved_movie( assy, mfile) # just checks existence, not validity for current part or main part if movie: #e should we set this as current_movie? I don't see a good reason to do that, # user can open it if they want to. But I'll do it if we don't have one yet. if not assy.current_movie: assy.current_movie = movie #e should we switch to the part for which this movie was made? # No current way to tell how to do that, and this might be done even if it's not valid # for any loaded Part. So let's not... tho we might presume (from filename choice we used) # it was valid for Main Part. Maybe print warning for clip item, and for not valid? #e msg = "Using previously saved movie for this part." env.history.message(cmd + msg) return PlotTool(assy, movie) else: msg = redmsg("Can't find previously saved movie for this part.") env.history.message(cmd + msg) return # end
NanoCAD-master
cad/src/commands/Plot/PlotTool.py