rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
layout10_4.addWidget(self.pushButton54) LayoutWidget_5 = QWidget(self.elementGroupBox,"layout8") LayoutWidget_5.setGeometry(QRect(20,130,524,60)) layout8 = QHBoxLayout(LayoutWidget_5,11,6,"layout8") self.pushButton13 = QPushButton(LayoutWidget_5,"pushButton13") pushButton13_font = QFont(self.pushButton13.font()) push...
layout26.addWidget(self.pushButton54)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.resize(QSize(680,693).expandedTo(self.minimumSizeHint()))
self.resize(QSize(489,740).expandedTo(self.minimumSizeHint()))
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.pushButton32.setText(self.__tr("32\n" "Ge")) self.pushButton33.setText(self.__tr("33\n" "As")) self.pushButton34.setText(self.__tr("34\n" "Se")) self.pushButton35.setText(self.__tr("35\n" "Br")) self.pushButton36.setText(self.__tr("36\n" "Kr")) self.pushButton51.setText(self.__tr("51\n" "Sb")) self.pushButton52.se...
def languageChange(self): self.setCaption(self.__tr("Element Selector")) self.elemInfoLabel.setText(QString.null) self.elemColorLabel.setText(QString.null) self.textLabel2.setText(QString.null) self.textLabel2_2.setText(QString.null) self.textLabel2_3.setText(QString.null) self.elementGroupBox.setTitle(QString.null) se...
self.history.message(redmsg("Linear Motor: " + str(nsa) + " atoms selected. The limit is 30. Try again."))
self.history.message(redmsg("Rotary Motor: " + str(nsa) + " atoms selected. The limit is 30. Try again."))
def makeMotor(self): if not self.assy.selatoms: self.history.message(redmsg("Rotary Motor: You must first select an atom(s) to create a rotary motor.")) return # Make sure that no more than 30 atoms are selected. nsa = len(self.assy.selatoms) if nsa > 30: self.history.message(redmsg("Linear Motor: " + str(nsa) + " ato...
assy.alist += [a] ndix[n]=a
if AddAtoms: assy.alist += [a] ndix[n]=a
def _readmmp(assy, filnam, isInsert = False): """The routine to actually reading a mmp file and save data into data structure""" #bruce 041011: added 'U' to file mode, for universal newline support. l=open(filnam,"rU").readlines() if not isInsert: assy.filename=filnam mol = None ndix={} assy.alist = [] #assy.tree = Gro...
if platform.atom_debug:
if 0 and platform.atom_debug:
def set_value(self, val): #e should coerce that to self.type, or add glue code... prefs_key = self.prefs_key assert type(prefs_key) == type("") #k redundant? import env env.prefs[prefs_key] = val if platform.atom_debug: print "fyi: %r set env.prefs[%r] = %r" % (self, prefs_key, val) return
def invalidate_selection(self): "[debugging method] invalidate all aspects of selected atoms or mols" for atm in self.o.assy.selatoms.values(): atm.invalidate_everything() for mol in self.o.assy.selmols: mol.invalidate_everything() def update_selection(self): """[debugging method] update all aspects of selected atoms ...
def makeMenus(self): # menus modified by bruce 041103 self.Menu_spec = [ ('Cancel', self.Cancel), ('Separate', self.o.assy.modifySeparate), ('Stretch', self.o.assy.Stretch), ('Kill', self.o.assy.kill), ('Hide', self.o.assy.Hide) ] self.Menu_spec_control = [ ('Invisible', self.w.dispInvis), None, ('Default', self.w.di...
ordiff = " or different atomtypes"
ordiff = " or different atomtype"
def bad_valence_explanation(self): #bruce 050806; revised 060703 ####@@@@ use more widely """Return the reason self's valence is bad (as a short text string), or '' if it's not bad. [#e Some callers might want an even shorter string; if so, we'll add an option to ask for that, and perhaps implement it by stripping off ...
w.fuse_mode_combox.insertItem("Make Bonds") w.fuse_mode_combox.insertItem("Fuse Atoms") MAKEBONDS = 0 FUSEATOMS = 1
w.fuse_mode_combox.insertItem(MAKEBONDS) w.fuse_mode_combox.insertItem(FUSEATOMS)
def do_what_MainWindowUI_should_do(w): 'Populate the Fuse Chunks dashboard' w.fuseChunksDashboard.clear() w.fuseChunksLabel = QLabel(w.fuseChunksDashboard) w.fuseChunksLabel.setText(" Fuse Chunks ") w.fuseChunksDashboard.addSeparator() # moveFreeAction, transXAction, transYAction, and transZAction are shared with m...
"Allows user to move one chunk and fuse it to other chunks in the part"
def fusechunks_lambda_tol_natoms(tol, natoms): if natoms < 0: natoms_str = "?" else: natoms_str = "%d" % (natoms,) tol_str = (" %d" % int(tol*100.0))[-3:] # fixed-width (3 digits) but using initial spaces # (doesn't have all of desired effect, due to non-fixed-width font) tol_str = tol_str + "%" return "%s => %s...
tol = 1.0 fuse_mode = ''
tol = 1.0 fuse_mode = '' recompute_fusables = True
def fusechunks_lambda_tol_natoms(tol, natoms): if natoms < 0: natoms_str = "?" else: natoms_str = "%d" % (natoms,) tol_str = (" %d" % int(tol*100.0))[-3:] # fixed-width (3 digits) but using initial spaces # (doesn't have all of desired effect, due to non-fixed-width font) tol_str = tol_str + "%" return "%s => %s...
self.change_fuse_mode(self.w.fuse_mode_combox.currentText())
self.recompute_fusables = True self.change_fuse_mode(self.w.fuse_mode_combox.currentText())
def Enter(self): modifyMode.Enter(self) self.change_fuse_mode(self.w.fuse_mode_combox.currentText()) # Syncs the dashboard and glpane.
self.find_fusables()
def tolerance_changed(self, val): self.tol = val * .01 if self.o.assy.selmols: self.find_fusables() # This will update the slider automatically self.o.gl_update() else: # Since no chunks are selected, there are no bonds, but the slider tolerance label still needs # updating. This fixed bug 502-14. Mark 050407 self.r...
if self.w.fuse_mode_combox.currentItem() == MAKEBONDS:
if self.fuse_mode == MAKEBONDS:
def reset_tolerance_label(self): 'Reset the tolerance label to 0 bonds or 0 overlapping atoms' if self.w.fuse_mode_combox.currentItem() == MAKEBONDS: tol_str = fusechunks_lambda_tol_nbonds(self.tol, 0, 0, 0) # 0 bonds else: tol_str = fusechunks_lambda_tol_natoms(self.tol, 0) # 0 overlapping atoms self.w.toleranceLB.set...
if self.w.fuse_mode_combox.currentItem() == MAKEBONDS:
if self.fuse_mode == MAKEBONDS:
def find_fusables(self): 'Finds bondable pairs or overlapping atoms, based on the Fuse Action combo box' if self.w.fuse_mode_combox.currentItem() == MAKEBONDS: self.find_bondable_pairs() else: self.find_overlapping_atoms()
self.find_fusables()
def Backup(self): '''Undo any bonds made between chunks. ''' # This undoes only the last fused chunks. Will work on supporting # multiple undos when we get a single undo working. Mark 050326
self.bondable_pairs = [] self.ways_of_bonding = {} self.overlapping_atoms = [] if self.o.assy.selmols: self.find_fusables() if not self.something_was_picked: self.something_was_picked = True
if self.o.is_animating or self.o.button == 'MMB': self.recompute_fusables = False if self.recompute_fusables: self.bondable_pairs = [] self.ways_of_bonding = {} self.overlapping_atoms = [] if self.o.assy.selmols: self.find_fusables() if not self.something_was_picked: self.something_was_picked = True else:...
def Draw(self): # This Draw method lack some basic optimization. For example, if the user # only rotates the view or zooms in/out, we shouldn't to call find_bondable_pairs # since the last of of bondable_pairs is unchanged. This severly impacts # performance unnecessarily. # Mark 050902.
if self.something_was_picked: self.reset_tolerance_label() self.something_was_picked = False
self.recompute_fusables = True
def Draw(self): # This Draw method lack some basic optimization. For example, if the user # only rotates the view or zooms in/out, we shouldn't to call find_bondable_pairs # since the last of of bondable_pairs is unchanged. This severly impacts # performance unnecessarily. # Mark 050902.
bondline_color = get_selCurve_color(0,self.backgroundColor) for s1,s2 in self.bondable_pairs: color = (self.ways_of_bonding[s1.key] > 1) and magenta or green s1.overdraw_with_special_color(color) color = (self.ways_of_bonding[s2.key] > 1) and magenta or blue s2.overdraw_with_special_color(color) drawline(bondline_...
self.draw_bondable_pairs() elif self.overlapping_atoms: self.draw_overlapping_atoms() def draw_bondable_pairs(self): '''Draws bondable pairs of singlets and the bond lines between them. Singlets in the selected chunk(s) are colored green. Singlets in the unselected chunk(s) are colored blue. Singlets with more than o...
def Draw(self): # This Draw method lack some basic optimization. For example, if the user # only rotates the view or zooms in/out, we shouldn't to call find_bondable_pairs # since the last of of bondable_pairs is unchanged. This severly impacts # performance unnecessarily. # Mark 050902.
if mol.hidden: continue
if mol.hidden or mol.display == diINVISIBLE: continue
def find_bondable_pairs(self, chunk_list = None): '''Checks the bondpoints of the selected chunk to see if they are close enough to bond with any other bondpoints in a list of chunks. Hidden chunks are skipped. ''' self.bondable_pairs = [] self.ways_of_bonding = {} if not chunk_list: chunk_list = self.o.assy.molecule...
if self.w.fuse_mode_combox.currentItem() == MAKEBONDS:
if self.fuse_mode == MAKEBONDS:
def fuse_something(self): if self.w.fuse_mode_combox.currentItem() == MAKEBONDS: self.make_bonds() else: self.fuse_atoms()
self.reset_tolerance_label()
def make_bonds(self): "Make bonds between all bondable pairs of singlets" self.bondable_pairs_atoms = [] self.merged_chunks = [] singlet_found_with_multiple_bonds = False # True when there are singlets with multiple bonds. total_bonds_made = 0 # The total number of bondpoint pairs that formed bonds. singlets_not_bonde...
self.reset_tolerance_label()
def make_bonds(self): "Make bonds between all bondable pairs of singlets" self.bondable_pairs_atoms = [] self.merged_chunks = [] singlet_found_with_multiple_bonds = False # True when there are singlets with multiple bonds. total_bonds_made = 0 # The total number of bondpoint pairs that formed bonds. singlets_not_bonde...
if mol.hidden: continue
if mol.hidden or mol.display == diINVISIBLE: continue
def find_overlapping_atoms(self): '''Checks atoms of the selected chunk to see if they overlap atoms in other chunks of the same type (element). Hidden chunks are skipped. ''' # Future versions should allow more flexible rules for overlapping atoms, # but this needs to be discussed with others before implementing anyt...
self.overlapping_atoms = []
def fuse_atoms(self): '''Deletes overlapping atoms found with the selected chunk(s). Only the overlapping atoms from the unselected chunk(s) are deleted. If the "Merge Chunks" checkbox is checked, then find_bondable_pairs() and make_bonds() is called, resulting in the merging of chunks. ''' total_atoms_fused = 0 # Th...
self.ok_btn.setAutoDefault(0) self.ok_btn.setDefault(0)
self.ok_btn.setDefault(1)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.cancel_btn.setAutoDefault(0)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
if self.lastHotspotChunk: self.lastHotspotChunk.set_hotspot(None) self.lastHotspotChunk = mol
if self.lastHotspotChunk: if mol.part is self.lastHotspotChunk.part and mol.part is not None: if env.debug() and self.lastHotspotChunk.hotspot: print "debug: unsetting hotspot of %r (was %r)" % \ (self.lastHotspotChunk, self.lastHotspotChunk.hotspot) self.lastHotspotChunk.set_hotspot(None) else: if env.deb...
def leftDown(self, event): '''When in clipboard mode, set hotspot if a Singlet is highlighted. ''' if self.elementMode: return obj = self.selectedObj if isinstance(obj, atom) and (obj.element is Singlet): mol = obj.molecule if not mol is self.lastHotspotChunk: if self.lastHotspotChunk: # Unset previous hotspot self.la...
('Separate', self.o.assy.modifySeparate),
def makeMenus(self): # menus modified by bruce 041103, 041217 self.Menu_spec = [ ('Separate', self.o.assy.modifySeparate), ('Stretch', self.o.assy.Stretch), ('Delete Del', self.o.assy.kill), ('Hide', self.o.assy.Hide), None, # bruce 041217 added the following (rather than just Done) #bruce 051213 added 'checked' a...
fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\
fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)<br> "\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
fileSaveText = "<u><b>Save File</b></u> (Ctrl + S)</b></p><br> "\
fileSaveText = "<u><b>Save File</b></u> (Ctrl + S)<br> "\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
editUndoText = "<u><b>Undo</b></u> (Ctrl + Z)</b></p><br> "\
editUndoText = "<u><b>Undo</b></u> (Ctrl + Z)<br> "\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
editRedoText = "<u><b>Redo</b></u> %s</b></p><br> "\
editRedoText = "<u><b>Redo</b></u> %s<br> "\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
editCutText = "<u><b>Cut</b></u> (Ctrl + X)</b></p><br> "\
editCutText = "<u><b>Cut</b></u> (Ctrl + X)<br> "\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
editCopyText = "<u><b>Copy</b></u> (Ctrl + C)</b></p><br> "\
editCopyText = "<u><b>Copy</b></u> (Ctrl + C)<br> "\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
editPasteText = "<u><b>Paste</b></u> (Ctrl + V)</b></p><br> "\
editPasteText = "<u><b>Paste</b></u> (Ctrl + V)<br> "\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
editDeleteText = "<u><b>Delete</b></u> (DEL)</b></p><br> "\
editDeleteText = "<u><b>Delete</b></u> (DEL)<br> "\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
insertNanotubeActionText = "<u><b>Nanotube</b></u><br>"\ "<p><img source=\"insertNanotubeAction\"><br> "\ "Inserts a nanotube provided with chirality (M, N) and length parameters. "\ "</p>" QMimeSourceFactory.defaultFactory().setPixmap( "insertNanotubeAction", self.insertNanotubeAction.iconSet().pixmap() ) self.inser...
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
selectAllActionText = "<u><b>Select All</b></u> (Ctrl + A)</b></p><br>"\
selectAllActionText = "<u><b>Select All</b></u> (Ctrl + A)<br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
selectInvertActionText = "<u><b>Invert Selection</b></u> <br> (Ctrl + Shift + I)</b></p><br>"\
selectInvertActionText = "<u><b>Invert Selection</b></u> (Ctrl + Shift + I)<br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
selectConnectedActionText = "<u><b>Select Connected</b></u> (Ctrl + Shift + C)</b></p><br>"\
selectConnectedActionText = "<u><b>Select Connected</b></u> (Ctrl + Shift + C)<br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
"<p>To use this feature, you must first be in "\ "<b>Select Atoms</b> mode and select at least one atom.</p>"
"<p>You can also select all connected atoms by double clicking on an atom or bond "\ "while in <b>Select Atoms</b> or <b>Build</b> modes.</p>"
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
selectDoublyActionText = "<u><b>Select Doubly</b></u></b></p><br>"\
selectDoublyActionText = "<u><b>Select Doubly</b></u><br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
"included in the selection.</p>"\ "<p>To use this feature, you must first be in "\ "<b>Select Atoms</b> mode and select at least one atom.</p>"
"included in the selection."\ "</p>"
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
selectExpandActionText = "<u><b>Expand Selection</b></u> (Ctrl + D)</b></p><br>"\
selectExpandActionText = "<u><b>Expand Selection</b></u> (Ctrl + D)<br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
selectContractActionText = "<u><b>Contract Selection</b></u> (Ctrl + Shift + D)</b></p><br>"\
selectContractActionText = "<u><b>Contract Selection</b></u> (Ctrl + Shift + D)<br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
modifyMinimizeSelActionText = "<u><b>Minimize Selection</b></u> (Ctrl + M)</b></p><br>"\
modifyMinimizeSelActionText = "<u><b>Minimize Selection</b></u> (Ctrl + M)<br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
modifyHydrogenateActionText = "<u><b>Hydrogenate</b></u> </b></p><br>"\
modifyHydrogenateActionText = "<u><b>Hydrogenate</b></u> <br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
modifyPassivateActionText = "<u><b>Passivate</b></u> (Ctrl + P)</b></p><br>"\
modifyPassivateActionText = "<u><b>Passivate</b></u> (Ctrl + P)<br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
jigsESPImageActionText = "<u><b>ESP Image</b></u></b></p><br>"\
jigsESPImageActionText = "<u><b>ESP Image</b></u><br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
jigsAtomSetActionText = "<u><b>Atom Set</b></u></b></p><br>"\
jigsAtomSetActionText = "<u><b>Atom Set</b></u><br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
jigsDistanceActionText = "<u><b>Measure Distance Jig</b></u></b></p><br>"\
jigsDistanceActionText = "<u><b>Measure Distance Jig</b></u><br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
jigsAngleActionText = "<u><b>Measure Angle Jig</b></u></b></p><br>"\
jigsAngleActionText = "<u><b>Measure Angle Jig</b></u><br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
jigsDihedralActionText = "<u><b>Measure Dihedral Jig</b></u></b></p><br>"\
jigsDihedralActionText = "<u><b>Measure Dihedral Jig</b></u><br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
jigsGamessActionText = "<u><b>GAMESS Jig</b></u></b></p><br>"\
jigsGamessActionText = "<u><b>GAMESS Jig</b></u><br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
jigsGridPlaneActionText = "<u><b>Grid Plane</b></u></b></p><br>"\
jigsGridPlaneActionText = "<u><b>Grid Plane</b></u><br>"\
def createWhatsThis(self): ############################################## # File Toolbar ############################################## #### Open File #### fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)</b></p><br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.default...
self.image0 = QPixmap(image0_data)
self.image0 = QPixmap() self.image0.loadFromData(image0_data,"PNG")
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.MovieButton.setText(self.__tr("Create Movie"))
self.MovieButton.setText(self.__tr("Run Simulation"))
def languageChange(self): self.setCaption(self.__tr("Simulator Setup")) self.textLabel5.setText(self.__tr("Total frames:")) self.textLabel2.setText(self.__tr("Steps per Frame (0.1 femtosecond):")) self.textLabel3.setText(self.__tr("Temperature (Kelvins):")) self.MovieButton.setText(self.__tr("Create Movie")) self.Cance...
enable_testbed = False
enable_testbed = True
# I think ExprsMeta scanner makes choiceref_21g symbolic -- but, too late to help? YES, ###BUG, unless we wrap the def above with something
return Overlay(expr, testexpr_20a)
return Overlay(expr, DrawInCorner( top_left_corner, (-1,1)), DrawInCorner( bottom_left_corner, (-1,-1)), )
def testbed(expr): "this turns the current testexpr into the actual expr to render" ## return Overlay(expr, Closer(Rect(1,1,black), 3.4)) #stub ## return Overlay(expr, If(1,DrawInCorner1,Closer)(Highlightable(Rect(1,1,black),Rect(1,1,green),projection=True))) ## return Overlay(expr, DrawInCorner(Highlightable(Rect(1,1,...
else: dir, fil = "./", self.assy.name
sdir = self.assy.filename else: dir, fil = "./", self.assy.name sdir = globalParms['WorkingDirectory']
def fileSaveAs(self): if self.assy: if self.assy.filename: dir, fil, ext = fileparse(self.assy.filename) else: dir, fil = "./", self.assy.name else: print "MWsemantics.py: fileSaveAs(): Part is Empty - nothing to save" return
fn = QFileDialog.getSaveFileName(self.assy.filename,
fn = QFileDialog.getSaveFileName(sdir,
def fileSaveAs(self): if self.assy: if self.assy.filename: dir, fil, ext = fileparse(self.assy.filename) else: dir, fil = "./", self.assy.name else: print "MWsemantics.py: fileSaveAs(): Part is Empty - nothing to save" return
print "playing", dir+fil+'.dpb'
def toolsMovie(self): if not self.assy.filename: self.assy.filename="simulate.mmp" dir, fil, ext = fileparse(self.assy.filename) print "playing", dir+fil+'.dpb' self.glpane.startmovie(dir+fil+'.dpb')
if len(neigh)>2:
elif len(neigh)>2:
def leftShiftDown(self, event): """If there's nothing nearby, do nothing If cursor is on a singlet, drag it around, rotating the atom it's bonded to if possible. If it is a real atom, drag it around. """ a = self.o.selatom if not a: return # now, if something was "lit up" self.modified = 1 self.o.assy.modified = 1 if ...
print "modifyMode.keyPress: Z key pressed"
def keyPress(self,key): basicMode.keyPress(self, key) if key == Qt.Key_Shift: self.o.setCursor(self.w.MoveAddCursor) elif key == Qt.Key_Control: self.o.setCursor(self.w.MoveSubtractCursor)
self.transDelta += dx
if self.moveOption == 'TRANSX': ma = V(1,0,0) elif self.moveOption == 'TRANSY': ma = V(0,1,0) elif self.moveOption == 'TRANSZ': ma = V(0,0,1) else: print "modifyMode.leftDrag: Error - unknown moveOption value =", self.moveOption return self.transDelta += dx qrot = Q(ma,-dy) self.rotDelta += qrot.angle *180.0/pi * sign...
def leftDrag(self, event): """Move the selected object(s): - in the plane of the screen following the mouse, - or slide and rotate along the an axis """ #Huaicai 3/23/05: This following line will fix bugs like 460. But #the root of the serials of bugs including a lot of cursor bugs is # the mouse event processing funct...
if self.moveOption == 'TRANSX': ma = V(1,0,0) elif self.moveOption == 'TRANSY': ma = V(0,1,0) elif self.moveOption == 'TRANSZ': ma = V(0,0,1) else: print "modifyMode.leftDrag: Error - unknown moveOption value =", self.moveOption continue mol.move(dx*ma) mol.rot(Q(ma,-dy))
mol.move(dx*ma) mol.rot(qrot)
def leftDrag(self, event): """Move the selected object(s): - in the plane of the screen following the mouse, - or slide and rotate along the an axis """ #Huaicai 3/23/05: This following line will fix bugs like 460. But #the root of the serials of bugs including a lot of cursor bugs is # the mouse event processing funct...
msg = "%s delta: %.2f Angstroms" % (self.axis, self.transDelta)
msg = "%s delta: [%.2f Angstroms] [%.2f Degrees]" % (self.axis, self.transDelta, self.rotDelta)
def leftDrag(self, event): """Move the selected object(s): - in the plane of the screen following the mouse, - or slide and rotate along the an axis """ #Huaicai 3/23/05: This following line will fix bugs like 460. But #the root of the serials of bugs including a lot of cursor bugs is # the mouse event processing funct...
self.endrms_linedit.setText(self.endrms)
self.endrms_linedit.setText(str(self.endrms))
def _setup_general_page(self): ''' Setup widgets to initial (default or defined) values on the General page. ''' connect_checkbox_with_boolean_pref( self.display_compass_checkbox, displayCompass_prefs_key ) connect_checkbox_with_boolean_pref( self.display_compass_labels_checkbox, displayCompassLabels_prefs_key ) connec...
self.endmax_linedit.setText(self.endmax)
self.endmax_linedit.setText(str(self.endmax))
def _setup_general_page(self): ''' Setup widgets to initial (default or defined) values on the General page. ''' connect_checkbox_with_boolean_pref( self.display_compass_checkbox, displayCompass_prefs_key ) connect_checkbox_with_boolean_pref( self.display_compass_labels_checkbox, displayCompassLabels_prefs_key ) connec...
self.cutoverrms_linedit.setText(self.cutoverrms)
self.cutoverrms_linedit.setText(str(self.cutoverrms))
def _setup_general_page(self): ''' Setup widgets to initial (default or defined) values on the General page. ''' connect_checkbox_with_boolean_pref( self.display_compass_checkbox, displayCompass_prefs_key ) connect_checkbox_with_boolean_pref( self.display_compass_labels_checkbox, displayCompassLabels_prefs_key ) connec...
self.cutovermax_linedit.setText(self.cutovermax)
self.cutovermax_linedit.setText(str(self.cutovermax))
def _setup_general_page(self): ''' Setup widgets to initial (default or defined) values on the General page. ''' connect_checkbox_with_boolean_pref( self.display_compass_checkbox, displayCompass_prefs_key ) connect_checkbox_with_boolean_pref( self.display_compass_labels_checkbox, displayCompassLabels_prefs_key ) connec...
drawwiresphere(color, pos, pickedrad) from GLPane import GLPane if isinstance(glpane, GLPane) and self.bad_valence() and env.prefs[ showValenceErrors_prefs_key ]: drawwiresphere(pink, pos, pickedrad * 1.08)
drawwiresphere(color, pos, pickedrad) if disp != diINVISIBLE: from GLPane import GLPane if isinstance(glpane, GLPane) and self.bad_valence() and env.prefs[ showValenceErrors_prefs_key ]: drawwiresphere(pink, pos, pickedrad * 1.08)
def draw(self, glpane, dispdef, col, level): """Draw this atom depending on whether it is picked and its display mode (possibly inherited from dispdef). An atom's display mode overrides the inherited one from the molecule or glpane, but a molecule's color overrides the atom's element-dependent one. No longer treats glp...
self.connect(self.remember_win_pos_and_size_checkbox,SIGNAL("toggled(bool)"),self.change_remember_win_pos_and_size)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.connect(self.light_specularity_slider,SIGNAL("valueChanged(int)"),self.change_lighting)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.connect(self.ms_brightness_slider,SIGNAL("sliderReleased()"),self.change_material_brightness_stop)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.connect(self.ms_shininess_slider,SIGNAL("sliderReleased()"),self.change_material_shininess_stop)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.o.assy.modified = 1 for mol in fixmols.values(): if mol.atoms: mol.shakedown() else: mol.kill()
self.o.assy.modified = 1
def modifyDehydrogenate(self): self.status_msg("Dehydrogenating...") from platform import fix_plurals fixmols = {} if self.o.assy.selmols: counta = countm = 0 for m in self.o.assy.selmols: changed = m.Dehydrogenate() # note: this might have removed all atoms from m! Fixed below. if changed: counta += changed countm += ...
self.u = u = N**2 * [ (0.0, 0.0) ] self.u_old = N**2 * [ (0.0, 0.0) ] self.u_new = N**2 * [ (0.0, 0.0) ] self.x = x = [ ] for i in range(N): for j in range(N): x.append((1. * j / N, 1. * i / N)) if GOT_PYREX: comp._setup(self, N)
if GOT_PYREX: comp._setup(N)
def __init__(self, owner): self.owner = owner # replace all these with Numeric arrays? Use Pyrex? self.u = u = N**2 * [ (0.0, 0.0) ] self.u_old = N**2 * [ (0.0, 0.0) ] self.u_new = N**2 * [ (0.0, 0.0) ] self.x = x = [ ] # nominal positions for i in range(N): for j in range(N): x.append((1. * j / N, 1. * i / N)) if GOT...
def positions(self):
def draw(self, cb, h, w): if GOT_PYREX: return comp._draw(cb, h, w)
def positions(self): # x is nominal position # u is displacement p = [ ] for i in range(N**2): xvec = self.x[i] uvec = self.u[i] p.append((xvec[0] + uvec[0], xvec[1] + uvec[1])) return p
p.append((xvec[0] + uvec[0], xvec[1] + uvec[1])) return p
cb((h * (a * (xvec[0] + uvec[0]) + b), w * (a * (xvec[1] + uvec[1]) + b)))
def positions(self): # x is nominal position # u is displacement p = [ ] for i in range(N**2): xvec = self.x[i] uvec = self.u[i] p.append((xvec[0] + uvec[0], xvec[1] + uvec[1])) return p
ANIMATION_DELAY = 20
def rotate(self): tmp = self.u_old self.u_old = self.u self.u = self.u_new self.u_new = tmp
self.timer.start(self.ANIMATION_DELAY) self.firstPush = self.comp.zeroForces() self.firstPush[0] = (A, -A) self.firstPush[N-1] = (A, A) self.secondPush = self.comp.zeroForces() self.secondPush[N*(N-1)] = (-A, -A) self.secondPush[N**2-1] = (-A, A)
self.timer.start(ANIMATION_DELAY) self.push = self.comp.zeroForces() for i in range(N/2): f = A * (.5*N - i) / (.5*N) self.push[i] = (-f, f) self.push[N*N-1 - i] = (f, -f) self.painter = QPainter()
def __init__(self): JelloGui.__init__(self, parent=None, name=None, modal=0, fl=0) size = self.frame1.size() self.width, self.height = size.width(), size.height() self.comp = Computronium(self)
self.timer.start(self.ANIMATION_DELAY)
if self.simTime > MAXTIME: self.app.quit()
def timeout(self): try: self.oneFrame() except AssertionError, e: import traceback traceback.print_exc() self.quit() self.timer.start(self.ANIMATION_DELAY)
for i in range(20):
for i in range(int(TIME_STEP / DT)):
def oneFrame(self): # On each step we do verlet, using u_old and u to compute # u_new. Then we move each particle from u to u_new. Then # we move u to u_old, and u_new to u. for i in range(20): self.equationsOfMotion() self.paintEvent(None)
p = QPainter()
p = self.painter
def paintEvent(self, e): """Draw a colorful collection of lines and circles. """ p = QPainter() w, h = self.width, self.height w3, h3 = w / 3, h / 3 radius = 10 p.begin(self.frame1) p.eraseRect(0, 0, w, h) p.setPen(QPen(Qt.black)) p.setBrush(QBrush(Qt.blue)) i = 0 for x, y in self.comp.positions(): if x**2 + y**2 > 5.0...
w3, h3 = w / 3, h / 3 radius = 10
def paintEvent(self, e): """Draw a colorful collection of lines and circles. """ p = QPainter() w, h = self.width, self.height w3, h3 = w / 3, h / 3 radius = 10 p.begin(self.frame1) p.eraseRect(0, 0, w, h) p.setPen(QPen(Qt.black)) p.setBrush(QBrush(Qt.blue)) i = 0 for x, y in self.comp.positions(): if x**2 + y**2 > 5.0...
i = 0 for x, y in self.comp.positions(): if x**2 + y**2 > 5.0: self.app.quit() p.end() return x = h3 * (x + 1) y = h3 * (y + 1) i += 1 p.drawEllipse(x, y, radius, radius)
def draw(x, y, de=p.drawEllipse, r=RADIUS): de(x, y, r, r) self.comp.draw(draw, h, h)
def paintEvent(self, e): """Draw a colorful collection of lines and circles. """ p = QPainter() w, h = self.width, self.height w3, h3 = w / 3, h / 3 radius = 10 p.begin(self.frame1) p.eraseRect(0, 0, w, h) p.setPen(QPen(Qt.black)) p.setBrush(QBrush(Qt.blue)) i = 0 for x, y in self.comp.positions(): if x**2 + y**2 > 5.0...
comp = self.comp
def equationsOfMotion(self): #print "move" t = self.simTime forceTime = 0.1 comp = self.comp comp.verletMomentum() self.simTime += DT if t > 0 and t < forceTime: comp.applyForces(self.firstPush) elif t > 2.0 and t < 2.0 + forceTime: comp.applyForces(self.secondPush) comp.internalForces() comp.rotate()
forceTime = 0.1 comp = self.comp
self.simTime += DT pushTime = 1.0
def equationsOfMotion(self): #print "move" t = self.simTime forceTime = 0.1 comp = self.comp comp.verletMomentum() self.simTime += DT if t > 0 and t < forceTime: comp.applyForces(self.firstPush) elif t > 2.0 and t < 2.0 + forceTime: comp.applyForces(self.secondPush) comp.internalForces() comp.rotate()
self.simTime += DT if t > 0 and t < forceTime: comp.applyForces(self.firstPush) elif t > 2.0 and t < 2.0 + forceTime: comp.applyForces(self.secondPush)
def equationsOfMotion(self): #print "move" t = self.simTime forceTime = 0.1 comp = self.comp comp.verletMomentum() self.simTime += DT if t > 0 and t < forceTime: comp.applyForces(self.firstPush) elif t > 2.0 and t < 2.0 + forceTime: comp.applyForces(self.secondPush) comp.internalForces() comp.rotate()
def main():
def main(n, maxTime=1.0e20): global N, RADIUS, MAXTIME N = n RADIUS = 15 / n**.5 MAXTIME = maxTime
def main(): app = QApplication(sys.argv) cr = Jello() cr.app = app app.setMainWidget(cr) cr.show() cr.update() app.exec_loop()
if "profile" in sys.argv[1:]:
if False:
def main(): app = QApplication(sys.argv) cr = Jello() cr.app = app app.setMainWidget(cr) cr.show() cr.update() app.exec_loop()
profile.run('main()') else: main()
profile.run('main(4, maxTime=30.0)') sys.exit(0) try: n = string.atoi(sys.argv[1]) except: n = 10 main(n)
def main(): app = QApplication(sys.argv) cr = Jello() cr.app = app app.setMainWidget(cr) cr.show() cr.update() app.exec_loop()
if vlen(self.o.pov): drawer.drawaxes(5, -self.o.pov)
if vlen(self.o.pov): drawer.drawaxes(5, -self.o.pov) else: if not self.o.displayOriginAxis: drawer.drawaxes(5, -self.o.pov)
def Draw(self): """Generic Draw method, with drawing code common to all modes. Specific modes should call this within their own Draw method, unless they have a good reason not to. """ # Draw the Origin axis. if self.o.displayOriginAxis: drawer.drawaxes(5, (0.0,0.0,0.0), coloraxes=True) # Draw the Point of View axis i...
if logic==1: return aqua
if logic==1: return navy
def logicColor(logic): if logic==0: return orange if logic==1: return aqua if logic==2: return yellow
printlines.append("[%s:%r]" % ( os.path.basename(filename), lineno ))
extra = "" if STACKFRAME_IDS: count = frame.f_locals.get('_CS_seencount', 0) count += 1 frame.f_locals['_CS_seencount'] = count if count > 1: extra = "|%d" % count printlines.append("[%s:%r%s]" % ( os.path.basename(filename), lineno, extra ))
def compact_stack( skip_innermost_n = 1 ): printlines = [] frame = sys._getframe( skip_innermost_n) while frame is not None: # innermost first filename = frame.f_code.co_filename lineno = frame.f_lineno printlines.append("[%s:%r]" % ( os.path.basename(filename), lineno )) frame = frame.f_back printlines.reverse() # mak...
self.deposit_from_MMKit(self.getCoords(event))
if self.modkey is None: self.deposit_from_MMKit(self.getCoords(event))
def leftDouble(self, event): # mark 060126. '''Double click event handler for the left mouse button. ''' if self.cursor_over_when_LMB_pressed == 'Empty Space': self.deposit_from_MMKit(self.getCoords(event)) # does win_update(). return self.ignore_next_leftUp_event = True if isinstance(self.obj_doubleclicked, Atom): ...
class curve:
class simple_shape_2d: "common code for selection curve and selection rectangle" def __init__(self, shp, ptlist, origin, logic, opts): """ptlist is a list of 3d points describing a selection (in a subclass-specific manner). origin is the center of view, and shp.normal gives the direction of the line of light. """ self...
def fill(mat,p,dir): """ Fill a curve drawn in matrix mat in 1's on 0's with 1's. p is V(i,j) of a point to fill from. dir is 1 or -1 for the standard recursive fill algorithm """ if mat[p]: return up = dn = 0 o1 = array([1,0]) od = array([0, dir]) while not mat[p-od]: p -= od while not mat[p]: mat[p] = 1 if mat[p-o1]:...
def __init__(self, shp, ptlist, point, logic, **xx):
def __init__(self, shp, ptlist, origin, logic, **opts):
def __init__(self, shp, ptlist, point, logic, **xx): """ptlist is a list of 3d points describing a selection. point is the center of view, and normal gives the direction of the line of light. Form a structure for telling whether arbitrary points fall inside the curve from the point of view. """ normal = shp.normal c=su...