rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.esp_window.width = float(val)
self.jig.width = float(val)
def change_width(self, val): "Slot for Width spinbox" self.esp_window.width = float(val) self.glpane.gl_update()
self.esp_window.window_offset = float(val)
self.jig.window_offset = float(val)
def change_window_offset(self, val): "Slot for Width spinbox" self.esp_window.window_offset = float(val) self.glpane.gl_update()
self.esp_window.edge_offset = float(val)
self.jig.edge_offset = float(val)
def change_edge_offset(self, val): "Slot for Width spinbox" self.esp_window.edge_offset = float(val) self.glpane.gl_update()
self.esp_window.show_esp_bbox = val
self.jig.show_esp_bbox = val
def show_esp_bbox(self, val): "Slot for Show ESP Window Volume checkbox" self.esp_window.show_esp_bbox = val self.glpane.gl_update()
self.esp_window.opacity = val/255.0
self.jig.opacity = val/255.0
def opacityChanged(self, val): '''Slot for opacity spin box ''' self.esp_window.opacity = val/255.0 self.glpane.gl_update()
self.esp_window.selectAtoms()
self.jig.selectAtoms()
def select_atoms_inside_esp_bbox(self): "Slot for Select Atoms Inside Volume button, which selects all the atoms inside the bbox" self.esp_window.selectAtoms() self.glpane.gl_update()
self.esp_window.cancelled = False
self.jig.cancelled = False
def accept(self): '''Slot for the 'OK' button ''' self.esp_window.cancelled = False text = QString(self.name_linedit.text()) text = text.stripWhiteSpace() # make sure name is not just whitespaces if text: self.esp_window.name = str(text) self.esp_window.width = float(self.width_spinbox.value()) self.esp_window.resol...
if text: self.esp_window.name = str(text)
if text: self.jig.name = str(text)
def accept(self): '''Slot for the 'OK' button ''' self.esp_window.cancelled = False text = QString(self.name_linedit.text()) text = text.stripWhiteSpace() # make sure name is not just whitespaces if text: self.esp_window.name = str(text) self.esp_window.width = float(self.width_spinbox.value()) self.esp_window.resol...
self.esp_window.width = float(self.width_spinbox.value()) self.esp_window.resolution = float(self.resolution_spinbox.value())
self.jig.width = float(self.width_spinbox.value()) self.jig.resolution = float(self.resolution_spinbox.value())
def accept(self): '''Slot for the 'OK' button ''' self.esp_window.cancelled = False text = QString(self.name_linedit.text()) text = text.stripWhiteSpace() # make sure name is not just whitespaces if text: self.esp_window.name = str(text) self.esp_window.width = float(self.width_spinbox.value()) self.esp_window.resol...
self.esp_window.assy.w.win_update() self.esp_window.assy.changed()
self.jig.assy.w.win_update() self.jig.assy.changed()
def accept(self): '''Slot for the 'OK' button ''' self.esp_window.cancelled = False text = QString(self.name_linedit.text()) text = text.stripWhiteSpace() # make sure name is not just whitespaces if text: self.esp_window.name = str(text) self.esp_window.width = float(self.width_spinbox.value()) self.esp_window.resol...
self.esp_window.fill_color = self.oldFillColor self.esp_window.color = self.esp_window.normcolor = self.oldNormColor
self.jig.color = self.jig.normcolor = self.original_jig.normcolor self.jig.fill_color = self.original_jig.fill_color self.jig.name = self.original_jig.name self.jig.width = self.original_jig.width self.jig.window_offset = self.original_jig.window_offset self.jig.edge_offset = self.original_jig.edge_offset self.jig.reso...
def reject(self): '''Slot for the 'Cancel' button ''' self.esp_window.fill_color = self.oldFillColor self.esp_window.color = self.esp_window.normcolor = self.oldNormColor # Border color
mfile = assy.filename[:-4] + ".dpb"
errorcode, partdir = assy.find_or_make_part_files_directory() if not errorcode: 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"
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. """ # moved here from MWsemantics method, and fixed bugs I recently put into it # (by rewriting it from original and ...
duration = time.time() - start_time if duration > 1.5: break
def rotateView(self, q2): "Rotate current view to quat (viewpoint) q2" # Check User Preference "General | Standard Views: Animate" if not env.prefs[animateStandardViews_prefs_key]: self.quat = Q(q2) self.gl_update() return wxyz1 = V(self.quat.w, self.quat.x, self.quat.y, self.quat.z) wxyz2 = V(q2.w, q2.x, q2.y, q2.z)...
self.fps = nsteps / (end_time - start_time + .001 )
duration = min (1.5, end_time - start_time + .001) self.fps = nsteps / duration
def rotateView(self, q2): "Rotate current view to quat (viewpoint) q2" # Check User Preference "General | Standard Views: Animate" if not env.prefs[animateStandardViews_prefs_key]: self.quat = Q(q2) self.gl_update() return wxyz1 = V(self.quat.w, self.quat.x, self.quat.y, self.quat.z) wxyz2 = V(q2.w, q2.x, q2.y, q2.z)...
duration = time.time() - start_time if duration > 1.5: break
def animateView(self, q2, s2, p2, z2, animate=True): "Animate current view to quat (viewpoint) q2, scale s2, pov p2, and zoom factor z2" # Check User Preference "General | Standard Views: Animate" if not animate or not env.prefs[animateStandardViews_prefs_key]: self.quat = Q(q2) self.pov = V(p2[0], p2[1], p2[2]) self....
self.fps = nsteps / (end_time - start_time + .001 )
duration = min(1.5, time.time() - start_time + .001) self.fps = nsteps / duration
def animateView(self, q2, s2, p2, z2, animate=True): "Animate current view to quat (viewpoint) q2, scale s2, pov p2, and zoom factor z2" # Check User Preference "General | Standard Views: Animate" if not animate or not env.prefs[animateStandardViews_prefs_key]: self.quat = Q(q2) self.pov = V(p2[0], p2[1], p2[2]) self....
if fnum == self.currentFrame: self._pause(0)
self._pause(0)
def _playFrame(self, fnum): """Show a specific frame of the movie. If "isPlaying" is true, it will show each frame between "fnum" and "currentFrame". fnum - frame number to display in the movie. """ self.isPaused = False # Don't let movie run out of bounds. if fnum < 0 or fnum > self.totalFrames or fnum == self.curre...
spf.write("Release: %s\n" % releaseNo)
if releaseNo: spf.write("Release: %s\n" % releaseNo) else: spf.write("Release: 0\n")
def createSpecFile(self, specFile, appName, version, releaseNo, sourceDir): """Create the spec file to build rpm package on Linux. Here is some information about what goes inside a RPM spec file: http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html http://www.rpm.org/max-rpm/s1-rpm-inside-scripts.html """ sp...
PMMT += "%d.%d.%d" % (VERSION.major, VERSION.minor, VERSION.tiny)
PMMT += "%d.%d" % (VERSION.major, VERSION.minor)
def main(): shortargs = 'ho:i:s:t:v:p' longargs = ['help', 'outdir=', 'iconfile=', 'sourcedir=', 'tag=', 'version=', 'premature-exit'] try: opts, args = getopt.getopt(sys.argv[1:], shortargs, longargs) except getopt.GetoptError: usage() sys.exit(2) currentDir = os.getcwd() appName = "nanoENGINEER-1" rootDir = None if...
"%d" % VERSION.tiny, VERSION.releaseType, cvsTag)
relNo, VERSION.releaseType, cvsTag)
def main(): shortargs = 'ho:i:s:t:v:p' longargs = ['help', 'outdir=', 'iconfile=', 'sourcedir=', 'tag=', 'version=', 'premature-exit'] try: opts, args = getopt.getopt(sys.argv[1:], shortargs, longargs) except getopt.GetoptError: usage() sys.exit(2) currentDir = os.getcwd() appName = "nanoENGINEER-1" rootDir = None if...
for frame in range(1, total_frames): wxyz1 += rot_inc self.quat = Q(norm(wxyz1)) self.pov += pov_inc self.zoomFactor += zoom_inc self.scale += scale_inc self.gl_update_duration() self.snapToView(q2, s2, p2, z2, update_duration = True)
try: for frame in range(1, total_frames): wxyz1 += rot_inc self.quat = Q(norm(wxyz1)) self.pov += pov_inc self.zoomFactor += zoom_inc self.scale += scale_inc self.gl_update_duration() self.snapToView(q2, s2, p2, z2, update_duration = True) except: print_compact_traceback("bug: exception (ignored)...
def animateToView(self, q2, s2, p2, z2, animate=True): '''Animate from the current view to the destination view defined by quat q2, scale s2, pov p2, and zoom factor z2. If animate is False *or* the user pref "Animate between views" is not selected, then do not animate; just snap to the destination view. ''' # Caller...
name = params[0]
self.name = params[0]
def build_struct(self, params): 'Create or update PVS.' if not self.struct: name = params[0] pvs_params = params[1:] from PovrayScene import PovrayScene self.struct = PovrayScene(self.win.assy, name, pvs_params) #bruce 060620 revised this else: self.set_params( self.struct, params) self.struct.write_pvs_file() return s...
self.struct = PovrayScene(self.win.assy, name, pvs_params)
self.struct = PovrayScene(self.win.assy, self.name, pvs_params)
def build_struct(self, params): 'Create or update PVS.' if not self.struct: name = params[0] pvs_params = params[1:] from PovrayScene import PovrayScene self.struct = PovrayScene(self.win.assy, name, pvs_params) #bruce 060620 revised this else: self.set_params( self.struct, params) self.struct.write_pvs_file() return s...
self.recentFilePopupMenu.insertItem(qApp.translate("Main Window", "&" + str(ii+1) + " " + str(fileList[ii]), None), ii)
recentFilename = os.path.normpath(str(fileList[ii])) self.recentFilePopupMenu.insertItem(qApp.translate("Main Window", "&" + str(ii+1) + " " + recentFilename, None), ii)
def _createRecentFilesList(self): '''Dynamically construct the list of recently opened files submenus ''' from MWsemantics import recentfiles_use_QSettings #bruce 050919 debug code #####@@@@@ if recentfiles_use_QSettings: prefsSetting = QSettings() fileList = prefsSetting.readListEntry('/Nanorex/nE-1/recentFiles')[0] ...
"</p>"
"<br><font color=\" "Known bug: the link to wiki help for Undo "\ "only works if you got this popup from the Edit menu item for Undo, "\ "not from the Undo toolbutton."\ "</font>"\ "</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...
_tmpmode = None ):
_tmpmode = None, _debug = False):
def __init__(self, imageName, ideal_width = None, ideal_height = None, rescale = True, ##e filter = ... convert = False, _tmpmode = None ): #bruce 061127 added options, self attrs, docstring; some are marked [untested] in docstring [###k need to test them]; ##e add options for resize filter choice, whether to use im.co...
if old_data != new_data and platform.atom_debug:
if old_data != new_data and platform.atom_debug and self.debug:
def __init__(self, imageName, ideal_width = None, ideal_height = None, rescale = True, ##e filter = ... convert = False, _tmpmode = None ): #bruce 061127 added options, self attrs, docstring; some are marked [untested] in docstring [###k need to test them]; ##e add options for resize filter choice, whether to use im.co...
if platform.atom_debug:
if platform.atom_debug and self.debug:
def __init__(self, imageName, ideal_width = None, ideal_height = None, rescale = True, ##e filter = ... convert = False, _tmpmode = None ): #bruce 061127 added options, self attrs, docstring; some are marked [untested] in docstring [###k need to test them]; ##e add options for resize filter choice, whether to use im.co...
if platform.atom_debug:
if platform.atom_debug and self.debug:
def resize(self, wd, ht, filter = Image.BICUBIC): #e should self.rescale also come in as an arg? """Resize image and filter it (or pad it if self.rescale is false and neither dimension needs to shrink).""" #e sometime try Image.ANTIALIAS to see if it's better quality; there are also faster choices. # For doc, see http:...
if oldmode != newmode and platform.atom_debug:
if oldmode != newmode and platform.atom_debug and self.debug:
def update(self): '''Update the image object.''' #Without saving/openning, 'tostring()' is not working right. # [bruce guess 061127 about the cause: maybe related to ops that don't work before or after image is loaded. # The docs mentioned elsewhere are not very clear about this.] import os from platform import find_o...
self.movie.filename = os.path.normpath(os.path.join(partdir, self.assy.filename[:-4] + suffix + '.dpb')) self.movie.origfile = os.path.normpath(os.path.join(partdir, self.assy.filename[:-4] + '.orig' + self.assy.filename[-4:]))
dir, fil = os.path.split(self.assy.filename) fil, ext = os.path.splitext(fil) self.movie.filename = os.path.join(partdir, fil + suffix + '.dpb') self.movie.origfile = os.path.join(partdir, fil + '.orig' + ext)
def createMoviePressed(self): """Creates a DPB (movie) file of the current part. [Actually only saves the params and filename which should be used by the client code (in writemovie?) to create that file.] The part does not have to be saved as an MMP file first, as it used to. """ ###@@@ bruce 050324 comment: Not sure i...
env.history.message( "MMP file inserted: " + fn )
env.history.message( "MMP file inserted: " + os.path.normpath(fn) )
def fileInsert(self): env.history.message(greenmsg("Insert File:")) wd = globalParms['WorkingDirectory'] fn = QFileDialog.getOpenFileName(wd, "Molecular machine parts (*.mmp);;Protein Data Bank (*.pdb);;GAMESS (*.out);;All of the above (*.pdb *.mmp *.out)", self, "Insert File dialog", "Select file to insert" ) # This...
env.history.message( "PDB file inserted: " + fn )
env.history.message( "PDB file inserted: " + os.path.normpath(fn) )
def fileInsert(self): env.history.message(greenmsg("Insert File:")) wd = globalParms['WorkingDirectory'] fn = QFileDialog.getOpenFileName(wd, "Molecular machine parts (*.mmp);;Protein Data Bank (*.pdb);;GAMESS (*.out);;All of the above (*.pdb *.mmp *.out)", self, "Insert File dialog", "Select file to insert" ) # This...
env.history.message( "GAMESS file inserted: " + fn )
env.history.message( "GAMESS file inserted: " + os.path.normpath(fn) )
def fileInsert(self): env.history.message(greenmsg("Insert File:")) wd = globalParms['WorkingDirectory'] fn = QFileDialog.getOpenFileName(wd, "Molecular machine parts (*.mmp);;Protein Data Bank (*.pdb);;GAMESS (*.out);;All of the above (*.pdb *.mmp *.out)", self, "Insert File dialog", "Select file to insert" ) # This...
env.history.message("MMP file opened: [" + fn + "]")
env.history.message("MMP file opened: [" + os.path.normpath(fn) + "]")
def fileOpen(self, recentFile = None): '''By default, users open a file through 'Open File' dialog. If <recentFile> is provided, it means user is opening a file named <recentFile> through the 'Recent Files' menu list. The file may or may not exist. ''' env.history.message(greenmsg("Open File:")) mmkit_was_hidden = sel...
env.history.message("PDB file opened: [" + fn + "]")
env.history.message("PDB file opened: [" + os.path.normpath(fn) + "]")
def fileOpen(self, recentFile = None): '''By default, users open a file through 'Open File' dialog. If <recentFile> is provided, it means user is opening a file named <recentFile> through the 'Recent Files' menu list. The file may or may not exist. ''' env.history.message(greenmsg("Open File:")) mmkit_was_hidden = sel...
env.history.message( "MMP file saved: " + self.assy.filename )
env.history.message( "MMP file saved: " + os.path.normpath(self.assy.filename) )
def save_mmp_file(self, safile): #bruce 050907 split this out of saveFile; maybe some of it should be moved back into caller ###@@@untested dir, fil, extjunk = fileparse(safile) try: tmpname = os.path.join(dir, '~' + fil + '.m~') self.assy.writemmpfile(tmpname) except: #bruce 050419 revised printed error message print_...
w.moveXLabel = QLabel(" Y ", w.moveChunksDashboard)
w.moveYLabel = QLabel(" Y ", w.moveChunksDashboard)
def do_what_MainWindowUI_should_do(w): 'Populate the Move Chunks dashboard' w.moveChunksDashboard.clear() w.moveChunksLabel = QLabel(w.moveChunksDashboard,"Move Chunks") w.moveChunksLabel.setText(" Move Chunks ") w.moveChunksDashboard.addSeparator() w.moveFreeAction.addTo(w.moveChunksDashboard) w.moveChunksDashboar...
w.moveXLabel = QLabel(" Z ", w.moveChunksDashboard)
w.moveZLabel = QLabel(" Z ", w.moveChunksDashboard)
def do_what_MainWindowUI_should_do(w): 'Populate the Move Chunks dashboard' w.moveChunksDashboard.clear() w.moveChunksLabel = QLabel(w.moveChunksDashboard,"Move Chunks") w.moveChunksLabel.setText(" Move Chunks ") w.moveChunksDashboard.addSeparator() w.moveFreeAction.addTo(w.moveChunksDashboard) w.moveChunksDashboar...
set_move_xyz(self.w, 0, 0, 0)
self.w.connect(self.w.moveThetaPlusAction, SIGNAL("activated()"), self.moveThetaPlus) self.w.connect(self.w.moveThetaMinusAction, SIGNAL("activated()"), self.moveThetaMinus) self.w.connect(self.w.movetype_combox, SIGNAL("activated(const QString&)"), self.setup_movetype) set_move_xyz(self.w, 0, 0, 0) self.w.moveThetaSp...
def init_gui(self): self.o.setCursor(self.w.MoveSelectCursor) # load default cursor for MODIFY mode self.w.toolsMoveMoleculeAction.setOn(1) # toggle on the Move Chunks icon self.w.moveChunksDashboard.show() # show the Move Molecules dashboard self.w.connect(self.w.MoveOptionsGroup, SIGNAL("selected(QAction *)"), self....
partname = self.assy.filename
partname = os.path.normpath(self.assy.filename)
def update_mainwindow_caption(self, Changed=False): #by mark; bruce 050810 revised this in several ways, fixed bug 785 '''Update the caption at the top of the of the main window. Example: "NanoEngineer-1 - [partname.mmp]" Changed=True will add the prefix and suffix to the caption denoting the part has been changed. ''...
(cd $2/instPath; find . -type d -exec chmod ugo+rx {} \;) (cd $2/instPath; find . -type f -exec chmod ugo+r {} \;)
(cd $2/%s; find . -type d -exec chmod ugo+rx {} \;) (cd $2/%s; find . -type f -exec chmod ugo+r {} \;)
def _writePostFlightFile(self, pfFile): """Write the postflight file Mac Package Installer """ instPath = os.path.basename(self.buildSourcePath) # "nanoENGINEER-1-0.0.6" appname = self.appName + '.app' cf = os.path.join(instPath, appname, 'Contents/Frameworks') # $2/instPath --> /Applications/nanoENGINEER-1-0.0.6 # $...
""" % (instPath, cf))
""" % (instPath, cf, instPath, instPath))
def _writePostFlightFile(self, pfFile): """Write the postflight file Mac Package Installer """ instPath = os.path.basename(self.buildSourcePath) # "nanoENGINEER-1-0.0.6" appname = self.appName + '.app' cf = os.path.join(instPath, appname, 'Contents/Frameworks') # $2/instPath --> /Applications/nanoENGINEER-1-0.0.6 # $...
self.update_items_from_nodes_open_selected(self, item.object, do_setOpen = do_setOpen, do_invisible_nodes = do_invisible_nodes) def update_items_from_nodes_open_selected(self, node, do_setOpen = True, do_invisible_nodes = True):
self.update_items_from_nodes_open_selected(item.object, do_setOpen = do_setOpen, do_invisible_nodes = do_invisible_nodes) def update_items_from_nodes_open_selected(self, node, _guard_ = None, do_setOpen = True, do_invisible_nodes = True):
def update_open_selected_in_itemtree(self, item, do_setOpen = True, do_invisible_nodes = True): ###@@@ change to also update text, icon? anything but structure... rename?? ###@@@ this implem is temporary and wrong: self.update_items_from_nodes_open_selected(self, item.object, do_setOpen = do_setOpen, do_invisible_nodes...
tooltip.add(vp, qrect, node.name)
tooltip.add(self.viewport(), qrect, node.name)
def tooltip_nodeItems(self, tooltip): """Step through the nodes for this tree, and fill in the QToolTip for the QListViewItems in the viewport of the QlistView for the tree.""" _node_items = self._node_items for node in _node_items.keys(): name = node.name if len(name) > 12: item = _node_items[node] try: qrect = self.i...
if ii == 2: print "down",down print "out",out print "axis",axis
def want_center_and_quat(self, ii, ptype = None): offset = self.offset cn = self.circle_n basemol = self.basemol if not ptype: ptype = self.product_type if ptype == "straight rod": # default for Extrude centerii = basemol.center + ii * offset # quatii = Q(1,0,0,0) quatii = basemol.quat elif ptype == "corkscrew": # not ...
self.circle_n = self.ncopies
def update_from_controls(self): """make the number and position of the copies of basemol what they should be, based on current control values. Never modify the control values! (That would infloop.) This should be called in Enter and whenever relevant controls might change. It's also called during a mousedrag event if t...
(want_x, want_y, want_z) = get_extrude_controls_xyz(self.w)
our_dashboard_has_extrudeSpinBox_circle_n = 0 if self.w.extrudeSpinBox_circle_n and our_dashboard_has_extrudeSpinBox_circle_n: want_cn = self.w.extrudeSpinBox_circle_n.value() else: want_cn = 0
def update_from_controls(self): """make the number and position of the copies of basemol what they should be, based on current control values. Never modify the control values! (That would infloop.) This should be called in Enter and whenever relevant controls might change. It's also called during a mousedrag event if t...
ncopies_common = min(ncopies_wanted,self.ncopies) if offset_wanted != self.offset or ptype_changed: self.have_offset_specific_data = 0
ncopies_common = min( ncopies_wanted, self.ncopies) if offset_wanted != self.offset or cn_changed or ptype_changed: self.have_offset_specific_data = 0
def update_from_controls(self): """make the number and position of the copies of basemol what they should be, based on current control values. Never modify the control values! (That would infloop.) This should be called in Enter and whenever relevant controls might change. It's also called during a mousedrag event if t...
hset.special_pos = self.offset
hset.special_pos = self.offset_for_bonds
def redo_look_of_bond_offset_spheres(self): # call to us moved from recompute_offset_specific_data to recompute_bonds "#doc; depends on offset and tol and len(bonds)" # kluge: try: # teensy purple ball usually shows position of offset rel to the white balls (it's also draggable btw) if len( self.bonds_for_current_offse...
self.redo_look_of_bond_offset_spheres()
if self.product_type == "straight rod": self.offset_for_bonds = self.offset else: if not self.offset_for_bonds: msg = "bond-offsets not yet computed, but computing them for %r is NIM, sorry" % self.product_type self.status_msg(msg) return else: msg = """note: using bond-offsets computed for "rod", at last offset of the...
def recompute_bonds(self): "call this whenever offset or tol changes" self.redo_look_of_bond_offset_spheres() # recompute what singlets to show in diff color, what bonds to make... # basic idea: see which nice-offset-handles contain the offset, count them, and recolor singlets they come from. hset = self.nice_offset...
hh = hset.findHandles_containing(self.offset)
hh = hset.findHandles_containing(self.offset_for_bonds)
def recompute_bonds(self): "call this whenever offset or tol changes" self.redo_look_of_bond_offset_spheres() # recompute what singlets to show in diff color, what bonds to make... # basic idea: see which nice-offset-handles contain the offset, count them, and recolor singlets they come from. hset = self.nice_offset...
def status_msg(self, text, suppress_rapidfire_repeats = None):
def status_msg(self, text, suppress_rapidfire_repeats = None, suppress_print = 0):
def status_msg(self, text, suppress_rapidfire_repeats = None): import time now = time.asctime() suppress_print = 0 if suppress_rapidfire_repeats: # consider not printing it (or using \r rather than \n??), but always put it into the statusbar! if self._last_status_text.startswith(suppress_rapidfire_repeats) and self._la...
suppress_print = 0
if suppress_print: self._last_status_counter = 1
def status_msg(self, text, suppress_rapidfire_repeats = None): import time now = time.asctime() suppress_print = 0 if suppress_rapidfire_repeats: # consider not printing it (or using \r rather than \n??), but always put it into the statusbar! if self._last_status_text.startswith(suppress_rapidfire_repeats) and self._la...
self.circle_n = 20
self.circle_n = 30
def clear(self): ###e should modes.py also call this before calling Enter? until it does, call it in Enter ourselves self.mergeables = {} self.moused_over = None #k? self.dragdist = 0.0 self.have_offset_specific_data = 0 #### also clear that data itself... self.bonds_for_current_offset_and_tol = (17,) # impossible valu...
else: msg = "" tp = self.tracefileProcessor if tp: msg = tp.progress_text() if msg: env.history.statusbar_msg(self.cmdname + ": " + msg)
msg = None tp = self.tracefileProcessor if tp: pt = tp.progress_text() if pt: msg = self.cmdname + ": " + pt if msg is not None: env.history.statusbar_msg(msg)
def sim_frame_callback(self): #bruce 060102 "Per-frame callback function for simulator object." # Note: this was called 3550 times for minimizing a small C3 sp3 hydrocarbon... better check the elapsed time quickly. #e Maybe we should make this into a lambda, or even code it in C, to optimize it. if self.PREPARE_TO_CLOS...
members.reverse()
def update_gui(self): """can be called many times during the mode; should be called only by code in modes.py """
self.pastable = self.o.assy.shelf.members[-1-cx]
self.pastable = self.o.assy.shelf.members[cx]
def setPaste(self): "called from radiobutton presses and spinbox changes" self.w.pasteP = True self.w.depositAtomDashboard.pasteRB.setOn(True) cx = self.w.pasteComboBox.currentItem() if self.o.assy.shelf.members: try: self.pastable = self.o.assy.shelf.members[-1-cx] # bruce 041124 - changed [cx] to [-1-cx] (should just...
if self.o.assy.shelf.members: self.o.assy.shelf.members[0].addmember(new)
if 1: self.o.assy.shelf.addmember(new)
def setHotSpot(self): # revised 041124 to fix bug 169, by mark and then by bruce """if called on a singlet, make that singlet the hotspot for the molecule. (if there's only one, it's automatically the hotspot) [... and copy mol onto the clipboard...] """ if self.o.selatom and self.o.selatom.element == Singlet: self.o....
self.o.assy.shelf.addmember(new)
if self.o.assy.shelf.members: self.o.assy.shelf.members[0].addmember(new) else: self.o.assy.shelf.addmember(new)
def setHotSpot(self): # revised 041124 to fix bug 169, by mark and then by bruce """if called on a singlet, make that singlet the hotspot for the molecule. (if there's only one, it's automatically the hotspot) [... and copy mol onto the clipboard...] """ if self.o.selatom and self.o.selatom.element == Singlet: self.o....
else:
elif self.errcode != _FAILURE_ALREADY_DOCUMENTED:
def run_using_old_movie_obj_to_hold_sim_params(self, movie): #bruce 051115 removed unused 'options' arg self._movie = movie # general kluge for old-code compat (lots of our methods still use this and modify it) # note, this movie object (really should be a simsetup object?) does not yet know a proper alist (or any alis...
self.errcode = -1
type, value, traceback = sys.exc_info() msg = redmsg("%s: %s" % (type, value)) env.history.message(msg) self.errcode = _FAILURE_ALREADY_DOCUMENTED abortbutton.finish() return
def sim_loop_using_dylib(self): #bruce 051231; compare to sim_loop_using_standalone_executable # 051231 6:29pm: works, except no trace file is written so results in history come from prior one (if any) """#doc """ movie = self._movie if platform.atom_debug and movie.duration: print "atom_debug: possible bug: movie.dura...
if print_sim_warnings:
if print_sim_warnings and simrun.errcode != _FAILURE_ALREADY_DOCUMENTED:
def writemovie(part, movie, mflag = 0, simaspect = None, print_sim_warnings = False, cmdname = "Simulator"): #bruce 060106 added cmdname """Write an input file for the simulator, then run the simulator, in order to create a moviefile (.dpb file), or an .xyz file containing all frames(??), or an .xyz file containing wha...
env.history.message(self.cmdname + ": " + "Cancelled.")
if r == _FAILURE_ALREADY_DOCUMENTED: env.history.message(self.cmdname + ": " + "Cancelled.")
def run(self): #bruce 050324 made this method from the body of MWsemantics.simSetup # and cleaned it up a bit in terms of how it finds the movie to use. if not self.part.molecules: # Nothing in the part to simulate. msg = redmsg("Nothing to simulate.") env.history.message(self.cmdname + ": " + msg) return env.history....
def populate(self, mol, length, posns):
def populate(self, mol, length):
def populate(self, mol, length, posns): def add(element, x, y, z, mol=mol): atm = Atom(element, chem.V(x, y, z), mol) atm.set_atomtype("sp2") posns.append((x, y, z)) for n in range(self.n): mmin, mmax = self.mlimits(-.5 * length, .5 * length, n) for m in range(mmin-1, mmax+1): x, y, z = self.xyz(n, m) if -.5 * length <...
posns.append((x, y, z))
def add(element, x, y, z, mol=mol): atm = Atom(element, chem.V(x, y, z), mol) atm.set_atomtype("sp2") posns.append((x, y, z))
positions = [ ]
def buildChunk(self): length = self.length maxLen = 1.2 * Chirality.BONDLENGTH maxLenSq = maxLen ** 2 positions = [ ] # populate the tube with some extra carbons on the ends # so that we can trim them later self.chirality.populate(self.mol, length + 3 * maxLen, positions)
self.chirality.populate(self.mol, length + 3 * maxLen, positions)
self.chirality.populate(self.mol, length + 3 * maxLen)
def buildChunk(self): length = self.length maxLen = 1.2 * Chirality.BONDLENGTH maxLenSq = maxLen ** 2 positions = [ ] # populate the tube with some extra carbons on the ends # so that we can trim them later self.chirality.populate(self.mol, length + 3 * maxLen, positions)
N = len(positions)
def buildChunk(self): length = self.length maxLen = 1.2 * Chirality.BONDLENGTH maxLenSq = maxLen ** 2 positions = [ ] # populate the tube with some extra carbons on the ends # so that we can trim them later self.chirality.populate(self.mol, length + 3 * maxLen, positions)
for i in range(N): x1, y1, z1 = positions[i] for j in range(i+1, N): x2, y2, z2 = positions[j]
for i in range(len(akeys)): a = atoms[akeys[i]] x1, y1, z1 = map(float, a.posn()) for j in range(i+1, len(akeys)): b = atoms[akeys[j]] x2, y2, z2 = map(float, b.posn())
def buildChunk(self): length = self.length maxLen = 1.2 * Chirality.BONDLENGTH maxLenSq = maxLen ** 2 positions = [ ] # populate the tube with some extra carbons on the ends # so that we can trim them later self.chirality.populate(self.mol, length + 3 * maxLen, positions)
dx2 = (x1 - x2) ** 2 if dx2 < maxLenSq: dy2 = (y1 - y2) ** 2 if dy2 < maxLenSq: dz2 = (z1 - z2) ** 2 if dz2 < maxLenSq: if (dx2 + dy2 + dz2) < maxLenSq: a = atoms[akeys[i]] b = atoms[akeys[j]]
if x1 - maxLen <= x2 <= x1 + maxLen: if y1 - maxLen <= y2 <= y1 + maxLen: if z1 - maxLen <= z2 <= z1 + maxLen: if ((x1 - x2) ** 2 + (y1 - y2) ** 2 + (z1 - z2) ** 2) < maxLenSq:
def buildChunk(self): length = self.length maxLen = 1.2 * Chirality.BONDLENGTH maxLenSq = maxLen ** 2 positions = [ ] # populate the tube with some extra carbons on the ends # so that we can trim them later self.chirality.populate(self.mol, length + 3 * maxLen, positions)
vecn = norm(vec)
axis = norm(vec)
def drawcylinder(color, pos1, pos2, radius, capped=0): global CylList, CapList glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color) glPushMatrix() vec = pos2-pos1 vecn = norm(vec) glTranslatef(pos1[0], pos1[1], pos1[2]) glRotate(-acos(vecn[2])*180.0/pi,vecn[1],-vecn[0], 0.0) glScale(radius,radius,vlen(vec)) glCallList...
glRotate(-acos(vecn[2])*180.0/pi,vecn[1],-vecn[0], 0.0)
angle = -acos(axis[2])*180.0/pi if (axis[2]*axis[2] >= 1.0): glRotate(angle, 0.0, 1.0, 0.0) else: glRotate(angle, axis[1], -axis[0], 0.0)
def drawcylinder(color, pos1, pos2, radius, capped=0): global CylList, CapList glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color) glPushMatrix() vec = pos2-pos1 vecn = norm(vec) glTranslatef(pos1[0], pos1[1], pos1[2]) glRotate(-acos(vecn[2])*180.0/pi,vecn[1],-vecn[0], 0.0) glScale(radius,radius,vlen(vec)) glCallList...
glRotate(-acos(axis[2])*180.0/pi, axis[1], -axis[0], 0.0)
angle = -acos(axis[2])*180.0/pi if (axis[2]*axis[2] >= 1.0): glRotate(angle, 0.0, 1.0, 0.0) else: glRotate(angle, axis[1], -axis[0], 0.0)
def drawbrick(color, center, axis, l, h, w): glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color) glPushMatrix() glTranslatef(center[0], center[1], center[2]) glRotate(-acos(axis[2])*180.0/pi, axis[1], -axis[0], 0.0) glScale(h, w, l) ###Huaicai 1/15/05: to fix the linear motor display problem. glFrontFace(GL_CW) #glut...
glFrontFace(GL_CW)
def drawbrick(color, center, axis, l, h, w): glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color) glPushMatrix() glTranslatef(center[0], center[1], center[2]) glRotate(-acos(axis[2])*180.0/pi, axis[1], -axis[0], 0.0) glScale(h, w, l) ###Huaicai 1/15/05: to fix the linear motor display problem. glFrontFace(GL_CW) #glut...
glFrontFace(GL_CCW)
def drawbrick(color, center, axis, l, h, w): glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color) glPushMatrix() glTranslatef(center[0], center[1], center[2]) glRotate(-acos(axis[2])*180.0/pi, axis[1], -axis[0], 0.0) glScale(h, w, l) ###Huaicai 1/15/05: to fix the linear motor display problem. glFrontFace(GL_CW) #glut...
class WikiHelpBrowser(qt.QTextBrowser):
class WikiHelpBrowser(QTextBrowser):
def wiki_help_menuspec_for_featurename( featurename): menutext = wiki_help_menutext( featurename) command = wiki_help_lambda( featurename) return [( menutext, command )]
class MimeFactory(qt.QMimeSourceFactory):
class MimeFactory(QMimeSourceFactory):
def __init__(self,text,parent=None): class MimeFactory(qt.QMimeSourceFactory): def data(self,name,context=None): # You'll always get a warning like this: # QTextBrowser: no mimesource for http://.... # This could be avoided with QApplication.qInstallMsgHandler, # but I don't that's supported until PyQt 3.15. Also this ...
webbrowser.open(name)
webbrowser.open(str(name))
def data(self,name,context=None): # You'll always get a warning like this: # QTextBrowser: no mimesource for http://.... # This could be avoided with QApplication.qInstallMsgHandler, # but I don't that's supported until PyQt 3.15. Also this falls # victim to all the problems swarming around webbrowser.open(). import we...
qt.QTextBrowser.__init__(self,parent)
QTextBrowser.__init__(self,parent)
def data(self,name,context=None): # You'll always get a warning like this: # QTextBrowser: no mimesource for http://.... # This could be avoided with QApplication.qInstallMsgHandler, # but I don't that's supported until PyQt 3.15. Also this falls # victim to all the problems swarming around webbrowser.open(). import we...
jobInputfile = os.path.basename(self.job_inputfile) jobInputFile = jobInputfile[:-4] jobOutputfile = self.job_outputfile filePath = os.path.dirname(os.path.abspath(sys.argv[0])) program = os.path.normpath(filePath + '/../bin/rungms')
def _launch_gamess(self): oldir = os.getcwd() # Save current directory jobDir = os.path.dirname(self.job_batfile) os.chdir(jobDir) # Change directory to the GAMESS temp directory. print "Current directory is: ", jobDir ####self.outputFile = QFile(self.job_outputfile) ####self.outputFile.open( IO_WriteOnly | IO_Append...
if False: try: self.buildChunk() env.history.message(cmd + "Done.") except Exception, e: env.history.message(cmd + redmsg(str(e.args[0]))) else:
try:
def accept(self): 'Slot for the OK button'
except Exception, e: env.history.message(cmd + redmsg(" - ".join(map(str, e.args))))
def accept(self): 'Slot for the OK button'
self.o.setCursor(self.w.MoveRotateMolCursor)
self.o.setCursor(self.w.MoveAxisRotateMolCursor)
def update_cursor_for_no_MB(self): '''Update the cursor for 'Move Chunks' mode. ''' if self.o.modkeys is None: self.o.setCursor(self.w.MoveSelectCursor) elif self.o.modkeys == 'Shift': #self.o.setCursor(self.w.MoveAddCursor) self.o.setCursor(self.w.MoveRotateMolCursor) elif self.o.modkeys == 'Control': #self.o.setCurso...
self.o.setCursor(self.w.RotateMolCursor)
self.o.setCursor(self.w.MoveFreeRotateMolCursor)
def update_cursor_for_no_MB(self): '''Update the cursor for 'Move Chunks' mode. ''' if self.o.modkeys is None: self.o.setCursor(self.w.MoveSelectCursor) elif self.o.modkeys == 'Shift': #self.o.setCursor(self.w.MoveAddCursor) self.o.setCursor(self.w.MoveRotateMolCursor) elif self.o.modkeys == 'Control': #self.o.setCurso...
self.o.assy.rotsel(q)
if self.w.moveChunksDashboard.rotateAsUnitCB.isChecked(): self.o.assy.rotsel(q) else: for mol in self.o.assy.selmols: mol.rot(q)
def leftCntlDrag(self, event): """Do an incremental trackball action on all selected chunks(s). """ ##See comments of leftDrag()--Huaicai 3/23/05 if not self.picking: return if not self.o.assy.getSelectedMovables(): return w=self.o.width+0.0 h=self.o.height+0.0 deltaMouse = V(event.pos().x() - self.o.MousePos[0], sel...
self.o.assy.rotsel(qrot)
if self.w.moveChunksDashboard.rotateAsUnitCB.isChecked(): self.o.assy.rotsel(qrot) else: for mol in self.o.assy.selmols: mol.rot(qrot)
def moveTheta(self, rotype, theta): "Rotate the selected chunk(s) /jig(s) around the specified axis by theta (degrees)" if not self.o.assy.getSelectedMovables(): env.history.message(redmsg("No chunks or movable jigs selected.")) return if rotype == 'Rotate X': ma = V(1,0,0) # X Axis elif rotype == 'Rotate Y': ma = V(0...
def writepov_bond(self, file, dispdef, col):
def writepov(self, file, dispdef, col):
def writepov_bond(self, file, dispdef, col): #bruce 050727 moving implem to separate file "Write this bond to a povray file (always using absolute coords, even for internal bonds)." from bond_drawer import writepov_bond writepov_bond(self, file, dispdef, col) return
filenames = "%s.%06d.pov - %06d.pov" % (name, self.currentFrame, self.totalFramesActual)
filenames = "%s.%06d.pov - %06d.pov" % (name, self.currentFrame, self.framecounter)
def _write_povray_series(self, name): """Writes the movie out as a series of POV-Ray files, starting with the current frame until the last frame, skipping frames using the "Skip" value from the dashboard. If your trajectory file was foobar.dpb, this will write, e.g., foobar.000000.pov thru foobar.000999.pov (assuming ...
self.image_mods.do_to( self.image_obj) return
def _create_PIL_image_obj_from_espimage_file(self): '''Creates a PIL image object from the jig's ESP image (png) file. ''' if self.espimage_file: self.image_obj = nEImageOps(self.espimage_file)
if val: if os.path.exists(val): self.espimage_file = val self.load_espimage_file()
if key[0] == 'espimage_file': if val: if os.path.exists(val): self.espimage_file = val self.image_mods.reset() self.load_espimage_file() else: msg = redmsg("info espimage espimage_file = " + val + ". File does not exist. No image loaded.") env.history.message(msg) pass elif key[0] == 'image_mods': try: self.image_mo...
def readmmp_info_espimage_setitem( self, key, val, interp ): """This is called when reading an mmp file, for each "info espimage" record which occurs right after this node is read and no other (espimage jig) node has been read. Key is a list of words, val a string; the entire record format is presently [060108] "info e...
msg = redmsg("info espimage espimage_file = " + val + ". File does not exist. No image loaded.") env.history.message(msg)
if self.image_obj: self.image_mods.do_to( self.image_obj) self._loadTexture() pass
def readmmp_info_espimage_setitem( self, key, val, interp ): """This is called when reading an mmp file, for each "info espimage" record which occurs right after this node is read and no other (espimage jig) node has been read. Key is a list of words, val a string; the entire record format is presently [060108] "info e...
self.w.setViewOppositeAction.setEnabled(enableFlag)
def enableViewChanges(self, enableFlag): """Turn on or off view changes depending on <param> 'enableFlag'. Turn off view changes is needed during the cookie-cutting stage. """ self.orientButtonGroup.setEnabled(enableFlag) self.gridRotateAngle.setEnabled(enableFlag) self.antiRotateButton.setEnabled(enableFlag) self.ro...
if ob is self.assy.o.selobj: self.assy.o.selobj = None
def cut_sel(self, use_selatoms = True): #bruce 050505 added use_selatoms = True option, so MT ops can pass False (bugfix) #bruce 050419 renamed this from cut to avoid confusion with Node method and follow new _sel convention mc = env.begin_op("Cut") #bruce 050908 for Undo try: cmd = greenmsg("Cut: ") if use_selatoms an...
print "MOVIEMODE: keyPressEvent called"
def keyPressEvent(self, e): "some modes will need to override this in the future" print "MOVIEMODE: keyPressEvent called" self.keyPress(e.key())
return self.quat.rot(V(1, 0, 0))
return self.planeNorm
def getaxis(self): return self.quat.rot(V(1, 0, 0))#norm(self.planeNorm))
def _getinfo(self): c = self.center * 1e-10 ctr_pt = (float(c[0]), float(c[1]), float(c[2])) centerPoint = '%1.1e %1.1e %1.1e' % ctr_pt n = c + (self.planeNorm * 1e-10) np = (float(n[0]), float(n[1]), float(n[2])) normalPoint = '%1.1e %1.1e %1.1e' % np return "[Object: ESP Window] [Name: " + str(self.name) + "] " +...
def setProps(self, name, border_color, width, height, resolution, center, wxyz, trans, fill_color,show_bbox, win_offset, edge_offset): '''Set the properties for a ESP Window read from a (MMP) file. ''' self.name = name; self.color = self.normcolor = border_color; self.width = width; self.height = height; self.resolutio...
self.connect(self, SIGNAL("currentChanged(QListViewItem *)"), self.whatCurrentItem)
def __init__(self, parent, win): QListView.__init__(self,parent,"modelTreeView") self.addColumn("Model Tree") self.win = win
def setTreeFocus(self, item): """ Set keyboard focus on items has been last clicked""" if item: self.setCurrentItem(item) def whatCurrentItem(self, item): print "Current item changes to: ", item.object pass
def setTreeFocus(self, item): """ Set keyboard focus on items has been last clicked""" if item: self.setCurrentItem(item)
global CHANGE_FROM_TREE if CHANGE_FROM_TREE:
def select(self): global CHANGE_FROM_TREE if CHANGE_FROM_TREE: #CHANGE_FROM_TREE = False items = self.selectedItems() self.disconnect(self, SIGNAL("selectionChanged()"), self.select)