rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
"Reorients the model so that it is viewed from the top."\
"Orients the view to the Top View."\
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...
"Reorients the model so that it is viewed from the bottom."\
"Orients the view to the Bottom View."\
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...
"Reorients the model so that it is viewed from the left side."\
"Orients the view to the Left View."\
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...
"Reorients the model so that it is viewed from the right side."\
"Orients the view to the Right View."\
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...
"Reorients the model so that it is viewed from the opposite side of the current view."\
"Rotates the view 180 degrees."\
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...
"<b>Fuse Chunks</b> creates bonds between two or more chunks.</p>"
"<b>Fuse Chunks</b> can be used to interactively join two or more "\ "chunks by dragging chunks around and fusing them together. "\ "Two types of fusing are supported:<br><br>"\ "<b>Make Bonds</b> creates bonds between the existing open bonds) "\ "of two or more chunks. Bonds are drawn (and undrawn) as chunks "\ "are...
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...
spf.write("Version: %s\n" % version)
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...
fields = version.split(".") earlyVersion = ".".join(fields[:-1]) lateVersion = fields[-1] spf.write("Version: %s\n" % earlyVersion) spf.write("Release: %s\n" % lateVersion)
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...
self.mirrorDistance = self.getMirrorDistance(m.center, jigs[0].center) mirrorChunk.move(2*(self.mirrorDistance))
self.mirrorDistance, self.wid = orthodist(m.center, self.mirrorAxis, jigs[0].center) mirrorChunk.move(2*(self.mirrorDistance)*self.mirrorAxis)
#def Invert(self): "Mirror the selected chunk(s) about a selected grid plane." #ninad060812--: As of 060812 (11 PM EST) it creates mirror chunks about a selected grid plane #This has some known bugs. listed below ninad060812: #What it does: #- Mirrors selected chunks about a selected Grid plane but keeps the mirrored c...
def getMirrorDistance(self, chunkCenter, mirrorPlaneCenter): "return the distance between the chunk center and the mirror plane center" return vlen(chunkCenter - mirrorPlaneCenter)
def getMirrorDistance(self, chunkCenter, mirrorPlaneCenter): "return the distance between the chunk center and the mirror plane center" return vlen(chunkCenter - mirrorPlaneCenter)
((a0,d0,s0,x0,y0,z0,e0), \ (a1,d1,s1,x1,y1,z1,e1), \ (a2,d2,s2,x2,y2,z2,e2)) = glpane.getLighting()
(((r0,g0,b0),a0,d0,s0,x0,y0,z0,e0), \ ( (r1,g1,b1),a1,d1,s1,x1,y1,z1,e1), \ ( (r2,g2,b2),a2,d2,s2,x2,y2,z2,e2)) = glpane.getLighting()
def writepovlighting(f, glpane): '''Writes a light source record for each light (if enabled) and the 'Atomic' finish record. These records impact the lighting affect. ''' # Get the lighting parameters for the 3 lights. ((a0,d0,s0,x0,y0,z0,e0), \ (a1,d1,s1,x1,y1,z1,e1), \ (a2,d2,s2,x2,y2,z2,e2)) = glpane.getLighting() ...
"\n color <" + str(d0) + ", " + str(d0) + ", " + str(d0) + ">" +
"\n color <" + str(r0*d0) + ", " + str(g0*d0) + ", " + str(b0*d0) + ">" +
def writepovlighting(f, glpane): '''Writes a light source record for each light (if enabled) and the 'Atomic' finish record. These records impact the lighting affect. ''' # Get the lighting parameters for the 3 lights. ((a0,d0,s0,x0,y0,z0,e0), \ (a1,d1,s1,x1,y1,z1,e1), \ (a2,d2,s2,x2,y2,z2,e2)) = glpane.getLighting() ...
"\n color <" + str(d1) + ", " + str(d1) + ", " + str(d1) + ">" +
"\n color <" + str(r1*d1) + ", " + str(g1*d1) + ", " + str(b1*d1) + ">" +
def writepovlighting(f, glpane): '''Writes a light source record for each light (if enabled) and the 'Atomic' finish record. These records impact the lighting affect. ''' # Get the lighting parameters for the 3 lights. ((a0,d0,s0,x0,y0,z0,e0), \ (a1,d1,s1,x1,y1,z1,e1), \ (a2,d2,s2,x2,y2,z2,e2)) = glpane.getLighting() ...
"\n color <" + str(d2) + ", " + str(d2) + ", " + str(d2) + ">" +
"\n color <" + str(r2*d2) + ", " + str(g2*d2) + ", " + str(b2*d2) + ">" +
def writepovlighting(f, glpane): '''Writes a light source record for each light (if enabled) and the 'Atomic' finish record. These records impact the lighting affect. ''' # Get the lighting parameters for the 3 lights. ((a0,d0,s0,x0,y0,z0,e0), \ (a1,d1,s1,x1,y1,z1,e1), \ (a2,d2,s2,x2,y2,z2,e2)) = glpane.getLighting() ...
assert item
if not item: if platform.atom_debug: print "atom_debug: fyi: MT node with no item (still waiting for MT.update Qt event?)" try: item.text(0) except: if platform.atom_debug: print "atom_debug: fyi: MT node with invalid item (still waiting for MT.update Qt event?)"
def update_items_from_nodes_open_selected(self, node, _guard_ = None, do_setOpen = True, do_invisible_nodes = True): # bruce 050110 temporary; deprecated, only call from above method and not for long! ###@@@ """set the properties in the model tree widget to match those in the tree datastructure #redoc """ assert _guard...
self._insert(line1)
self._append(line1)
def __init__(self, parent, line1 = None): """###doc this; optional arg line1 should be a string, generally not ending in '\n' """ ###stub -- we'll likely turn this widget into a frame with buttons self.widget = QTextEdit(parent) # public member, private value (except that it's a Qt widget) if line1 == None: line1 = tim...
def _insert(self, something): "Insert some text. We might deprecate this interface!" self.widget.insert(something)
def _append(self, something): "Append some text. We might deprecate this interface!" self.widget.append(something) self.widget.scrollToBottom()
def _insert(self, something): "Insert some text. We might deprecate this interface!" self.widget.insert(something)
self._insert("\n") self._insert(line)
self._append(line)
def _print(self, line): self._insert("\n") self._insert(line)
self._print(text.replace('\r','\n'))
self._print(text)
def set_status_text(self, text, **options): """Compatibility method -- pretend we're a statusbar and this is its "set text" call. [The following is not yet implemented as of the initial commit:] In reality, make sure the new end of the history looks basically like the given text, but use semi-heuristics to decide how t...
except: print_compact_traceback("problem removing old tracefile, continuing anyway: ") env.history.message(orangemsg("problem removing old tracefile, continuing anyway")) try:
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...
raise Exception, "Cannot find a web browser for wiki help"
env.history.message(redmsg("Wiki Help cannot find a web browser")) try: webbrowser.open(url) except webbrowser.Error: pass
def register(pathname, key): webbrowser._tryorder += [ key ] webbrowser.register(key, None, webbrowser.GenericBrowser("%s '%%s'" % pathname))
webbrowser.open( url)
webbrowser_open( url)
def open_wiki_help_URL(url, whosdoingthis = "Wiki help"): #bruce 051229 split this out of open_wiki_help_page (which is misnamed) """Try to open the given url in the user's browser (unless they've set preferences to prevent this (NIM)), first emitting a history message containing the url (which is described as coming f...
webbrowser.open(name)
webbrowser_open(name)
def data(self, name, context=None): # [obs comment:] You'll always get a warning like this: # QTextBrowser: no mimesource for http://.... # This could be avoided with QApplication.qInstallMsgHandler, # but I don't think that's supported until PyQt 3.15. Also this falls # victim to all the problems swarming around webbr...
def _readpdb(assy, filename, isInsert = False): f=open(filename,"rU").readlines() dir, nodename = os.path.split (filename) if not isInsert: assy.filename=filename ndix={} mol=molecule(assy, nodename) for card in f: key=card[:6].lower().replace(" ", "")
def _readpdb(assy, filename, isInsert = False): """Read a Protein DataBank-format file into a single new chunk, which is returned, unless there are no atoms in the file, in which case a warning is printed and None is returned. (The new chunk (if returned) is in assy, but is not yet added into any Group or Part in assy ...
def getname(str, default): x= nampat.search(str) if x: return x.group(1) return gensym(default)
try: PeriodicTable.getElement(sym) except KeyError: print 'unknown element "',sym,'" in: ',card
try: PeriodicTable.getElement(sym) except: assy.w.history.message( redmsg( "Warning: Pdb file: unknown element %s in: %s" % (sym,card) ))
def _readpdb(assy, filename, isInsert = False): f=open(filename,"rU").readlines() dir, nodename = os.path.split (filename) if not isInsert: assy.filename=filename ndix={} mol=molecule(assy, nodename) for card in f: key=card[:6].lower().replace(" ", "") if key in ["atom", "hetatm"]: sym = capitalize(card[12:14].repla...
a1=ndix[int(card[6:11])] for i in range(11, 70, 5): try: a2=ndix[int(card[i:i+5])] except ValueError: break mol.bond(a1, a2)
try: a1 = ndix[int(card[6:11])] except: assy.w.history.message( redmsg( "Warning: Pdb file: can't find atom at column %d in: %s" % (6,card) )) else: for i in range(11, 70, 5): try: a2 = ndix[int(card[i:i+5])] except: assy.w.history.message( redmsg( "Warning: Pdb file: can't find atom at column %d in: %s" % (i,card)...
def _readpdb(assy, filename, isInsert = False): f=open(filename,"rU").readlines() dir, nodename = os.path.split (filename) if not isInsert: assy.filename=filename ndix={} mol=molecule(assy, nodename) for card in f: key=card[:6].lower().replace(" ", "") if key in ["atom", "hetatm"]: sym = capitalize(card[12:14].repla...
assy.addmol(mol)
if mol: assy.addmol(mol) return
def readpdb(assy,filename): """Reads a pdb file""" mol = _readpdb(assy, filename, isInsert = False) assy.addmol(mol)
assy.addmol(mol)
if mol: assy.addmol(mol) return
def insertpdb(assy,filename): """Reads a pdb file and inserts it into the existing model """ mol = _readpdb(assy, filename, isInsert = True) assy.addmol(mol)
self.glplane.setViewProjection(1)
self.glpane.setViewProjection(ORTHOGRAPHIC)
def setViewOrtho(self): self.glplane.setViewProjection(1)
self.glplane.setViewProjection(0)
self.glpane.setViewProjection(PERSPECTIVE)
def setViewPerspec(self): self.glplane.setViewProjection(0)
msg = redmsg("Movie file [" + self.filename + "] not valid for the current part")
msg = redmsg("Movie file [" + self.filename + "] not valid for the current part.")
def _setup(self, hflag = True): """Setup this movie for playing """ if DEBUG1: print "movie._setup() called. filename = [" + self.filename + "]" r = self._checkMovieFile() if r == 1: msg = redmsg("Cannot play movie file [" + self.filename + "]. It does not exist.") self.assy.w.history.message(msg) return r elif r ==...
self.fileobj.close() self.assy.movend()
self._pause(0) self.fileobj.close() self.assy.movend()
def _close(self): """Close movie file and adjust atom positions. """ if DEBUG1: print "movie._close() called. self.isOpen =", self.isOpen if not self.isOpen: return # Close the movie file. self.fileobj.close() # Unfreeze atoms. self.assy.movend() # Delete the array containing the original atom positions for the mode...
"<p><img source=\"setViewOrtho\"><br> "\ "Sets nonperspective (or parallel) projection, with no foreshortening."\
"<p>Sets nonperspective (or parallel) projection, with no foreshortening."\
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><img source=\"setViewPerspec\"><br> "\ "Set perspective projection, drawing objects slightly larger "\
"<p>Set perspective projection, drawing objects slightly larger "\
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.water_enabled = False
def Enter(self): basicMode.Enter(self) self.water_enabled = False # mark 060219. self.o.assy.selectAtoms() self.w.elemFilterComboBox.setCurrentItem(0) ## Disable filter by default # Reinitialize previously picked atoms (ppas). self.o.assy.ppa2 = self.o.assy.ppa3 = None #self.o.assy.permit_pick_atoms() #bruce 050517 ...
self.w.elemFilterComboBox.setCurrentItem(0)
self.set_selection_filter(0)
def Enter(self): basicMode.Enter(self) self.water_enabled = False # mark 060219. self.o.assy.selectAtoms() self.w.elemFilterComboBox.setCurrentItem(0) ## Disable filter by default # Reinitialize previously picked atoms (ppas). self.o.assy.ppa2 = self.o.assy.ppa3 = None #self.o.assy.permit_pick_atoms() #bruce 050517 ...
self.w.elemFilterComboBox.setCurrentItem(line)
self.set_selection_filter(line)
def keyPress(self,key): '''keypress event handler for selectAtomsMode. ''' from MWsemantics import eCCBtab2 basicMode.keyPress(self, key)
self.do('rm -rf ' + self.workdir + '/*')
self.do('rm -rf ' + self.workdir) self.do('mkdir -p ' + self.workdir)
def run(self): global all_workers_stop self.do('mkdir -p ' + self.workdir) while not all_workers_stop: job = self.jobqueue.get() if job is None: return try: job.go(self) self.do('rm -rf ' + self.workdir + '/*') except: all_workers_stop = True raise
for ch in sequence: if ch not in 'GACT': raise UserError('Unknown DNA base (not G, A, C, or T): ' + ch)
def insertmmp(filename, subgroup, tfm, position=position): try: grouplist = _readmmp(assy, filename, isInsert=True) except IOError: raise PluginBug("Cannot read file: " + filename) if not grouplist: raise PluginBug("No atoms in DNA base? " + filename) viewdata, mainpart, shelf = grouplist for member in mainpart.member...
env.history.message(redmsg('Bogus DNA base: ' + ch + ' (should be C, G, A, or T)')) return ''
raise UserError('Bogus DNA base: ' + ch + ' (should be C, G, A, or T)')
def get_sequence(self, reverse=False, complement=False, cdict={'C':'G', 'G':'C', 'A':'T', 'T':'A'}): seq = '' for ch in str(self.base_textedit.text()).upper(): if ch in 'CGAT': if complement: ch = cdict[ch] seq += ch elif ch in '\ \t\r\n': pass else: env.history.message(redmsg('Bogus DNA base: ' + ch + ' (should be C, ...
"<p>Specify the bond length between carbon atoms in angstroms.</p>"))
"<p>Specify the bond length between atoms in angstroms.</p>"))
def languageChange(self): self.setCaption(self.__tr("Nanotube")) self.heading_label.setText(self.__tr("Nanotube")) self.sponsor_btn.setText(QString.null) self.done_btn.setText(QString.null) QToolTip.add(self.done_btn,self.__tr("OK")) self.abort_btn.setText(QString.null) QToolTip.add(self.abort_btn,self.__tr("Cancel")) ...
"""create an atom of element sym (e.g. 'C')
"""Create an atom of element sym (e.g. 'C')
def __init__(self, sym, where, mol): """create an atom of element sym (e.g. 'C') at location where (e.g. V(36, 24, 36)) belonging to molecule mol, which is part of assembly assy """ # unique key for hashing self.key = atKey.next() # element-type object self.element = PeriodicTable.getElement(sym) # 'where' is atom's ab...
belonging to molecule mol, which is part of assembly assy
belonging to molecule mol (can be None). Atom initially has no bonds and default hybridization type.
def __init__(self, sym, where, mol): """create an atom of element sym (e.g. 'C') at location where (e.g. V(36, 24, 36)) belonging to molecule mol, which is part of assembly assy """ # unique key for hashing self.key = atKey.next() # element-type object self.element = PeriodicTable.getElement(sym) # 'where' is atom's ab...
self.molecule.assy.changed()
self.changed()
def setDisplay(self, disp): self.display = disp self.molecule.changeapp(1) self.molecule.assy.changed() # bruce 041206 bugfix (unreported bug) # bruce 041109 comment: # atom.setDisplay changes appearance of this atom's bonds, # so: do we need to invalidate the bonds? No, they don't store display # info, and the geometr...
self.cookieCutterToolbar.setGeometry(QRect(0,0,532,29))
self.cookieCutterToolbar.setGeometry(QRect(0,0,533,29))
def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.statusBar()
self.unnamed.setAccel(QString.null,self.unnamed.insertItem(self.viewDefviewAction.iconSet(),self.__tr("&Default Views"),self.popupMenu_32))
self.unnamed.setAccel(QString.null,self.unnamed.insertItem(self.viewDefviewAction.iconSet(),self.__tr("Orientations"),self.popupMenu_32))
def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.statusBar()
self.resize(QSize(1062,835).expandedTo(self.minimumSizeHint()))
self.resize(QSize(1062,838).expandedTo(self.minimumSizeHint()))
def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.statusBar()
self.viewDefviewAction.setText(self.__tr("&Default Views")) self.viewDefviewAction.setMenuText(self.__tr("&Default Views"))
self.viewDefviewAction.setText(self.__tr("Orientations")) self.viewDefviewAction.setMenuText(self.__tr("Orientations"))
def languageChange(self): self.setCaption(self.__tr("Atom")) self.fileNewAction.setText(self.__tr("New")) self.fileNewAction.setMenuText(self.__tr("&New")) self.fileNewAction.setAccel(self.__tr("Ctrl+N")) self.fileOpenAction.setText(self.__tr("Open")) self.fileOpenAction.setMenuText(self.__tr("&Open...")) self.fileOpen...
self.setViewFrontAction.setText(self.__tr("Front View")) self.setViewFrontAction.setMenuText(self.__tr("&Front View")) self.setViewFrontAction.setToolTip(self.__tr("Front View")) self.setViewBackAction.setText(self.__tr("Back View")) self.setViewBackAction.setMenuText(self.__tr("&Back View")) self.setViewTopAction.setT...
self.setViewFrontAction.setText(self.__tr("&Front")) self.setViewFrontAction.setMenuText(self.__tr("&Front")) self.setViewFrontAction.setToolTip(self.__tr("Front")) self.setViewBackAction.setText(self.__tr("Back")) self.setViewBackAction.setMenuText(self.__tr("&Back")) self.setViewTopAction.setText(self.__tr("Top")) se...
def languageChange(self): self.setCaption(self.__tr("Atom")) self.fileNewAction.setText(self.__tr("New")) self.fileNewAction.setMenuText(self.__tr("&New")) self.fileNewAction.setAccel(self.__tr("Ctrl+N")) self.fileOpenAction.setText(self.__tr("Open")) self.fileOpenAction.setMenuText(self.__tr("&Open...")) self.fileOpen...
self.unnamed.changeItem(self.unnamed.idAt(7),self.__tr("&Default Views"))
self.unnamed.changeItem(self.unnamed.idAt(7),self.__tr("Orientations"))
def languageChange(self): self.setCaption(self.__tr("Atom")) self.fileNewAction.setText(self.__tr("New")) self.fileNewAction.setMenuText(self.__tr("&New")) self.fileNewAction.setAccel(self.__tr("Ctrl+N")) self.fileOpenAction.setText(self.__tr("Open")) self.fileOpenAction.setMenuText(self.__tr("&Open...")) self.fileOpen...
self.win.enableViews(False)
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.win.enableViews(False)
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....
deltap = p2 - self.pov pf = int(vlen(deltap)*.2) deltas = abs(s2 - self.scale)
pf = int(deltap * .2)
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....
deltaz = abs(z2 - self.zoomFactor)
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....
debug_menu = None
def debug_runpycode_from_a_dialog( source = "some debug menu??"): title = "debug: run py code" label = "one line of python to exec in debug.py's globals()\n(or use @@@ to fake \\n for more lines)\n(or use execfile)" from qt import QInputDialog # bruce 041216 bugfix text, ok = QInputDialog.getText(title, label) if ok: #...
self.debug_menu = self.makemenu( self.debug_menu_items() )
def _init1(self, win = None): # figure out this mixin's idea of main window if not win: try: self.win # no need: assert isinstance( self.win, QWidget) except AttributeError: pass else: win = self.win self._debug_win = win # figure out classname for #doc try: self._debug_classname = "class " + self.__class__.__name__ ex...
"[subclasses can in theory override this, but probably needn't and shouldn't]"
def debug_menu_items(self): "[subclasses can in theory override this, but probably needn't and shouldn't]" import debug res = [ ('(debugging menu)', noop, 'disabled'), # None, # separator ] if self._debug_win: res.extend( [ ('load window layout', self._debug_load_window_layout ), ('save window layout', self._debug_save...
('enable ATOM_DEBUG', self._debug_enable_atom_debug ), ('disable ATOM_DEBUG', self._debug_disable_atom_debug ),
def debug_menu_items(self): "[subclasses can in theory override this, but probably needn't and shouldn't]" import debug res = [ ('(debugging menu)', noop, 'disabled'), # None, # separator ] if self._debug_win: res.extend( [ ('load window layout', self._debug_load_window_layout ), ('save window layout', self._debug_save...
menu = self.debug_menu self.current_event = event
menu = None try: lis = self.debug_menu_items() menu = self.makemenu( lis ) except: print_compact_traceback("bug in do_debug_menu ignored; menu_spec is %r" % (lis,) ) menu = None
def do_debug_menu(self, event): "[public method for subclasses] #doc" menu = self.debug_menu self.current_event = event # (so debug commands can see it) # this code written from Qt/PyQt docs... note that some Atom # modules use menu.exec_loop() but others use menu.popup(); I # don't know for sure whether this matters ...
menu.exec_loop(event.globalPos(), 1) self.current_event = None
if menu: menu.exec_loop(event.globalPos(), 1)
def do_debug_menu(self, event): "[public method for subclasses] #doc" menu = self.debug_menu self.current_event = event # (so debug commands can see it) # this code written from Qt/PyQt docs... note that some Atom # modules use menu.exec_loop() but others use menu.popup(); I # don't know for sure whether this matters ...
seq = self.get_sequence(complement=True) self.base_textedit.setText(seq)
def thunk(): seq = self.get_sequence(complement=True) self.base_textedit.setText(seq) self.handlePluginExceptions(thunk)
def complement_btn_clicked(self): seq = self.get_sequence(complement=True) self.base_textedit.setText(seq)
seq = self.get_sequence(reverse=True) self.base_textedit.setText(seq)
def thunk(): seq = self.get_sequence(reverse=True) self.base_textedit.setText(seq) self.handlePluginExceptions(thunk)
def reverse_btn_clicked(self): seq = self.get_sequence(reverse=True) self.base_textedit.setText(seq)
self.setTabOrder(self.display_compass_checkbox,self.display_origin_axis_checkbox)
self.setTabOrder(self.display_compass_checkbox,self.display_compass_labels_checkbox) self.setTabOrder(self.display_compass_labels_checkbox,self.display_origin_axis_checkbox)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.upper_right_btn,self.radioButton12) self.setTabOrder(self.radioButton12,self.animate_views_checkbox) self.setTabOrder(self.animate_views_checkbox,self.atom_hilite_color_btn) self.setTabOrder(self.atom_hilite_color_btn,self.hotspot_color_btn)
self.setTabOrder(self.upper_right_btn,self.watch_min_in_realtime_checkbox) self.setTabOrder(self.watch_min_in_realtime_checkbox,self.radioButton12) self.setTabOrder(self.radioButton12,self.high_quality_graphics_checkbox) self.setTabOrder(self.high_quality_graphics_checkbox,self.animate_views_checkbox) self.setTabOrder(...
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.cpk_atom_rad_spinbox,self.vwd_rbtn) self.setTabOrder(self.vwd_rbtn,self.cpk_rbtn) self.setTabOrder(self.cpk_rbtn,self.tubes_rbtn) self.setTabOrder(self.tubes_rbtn,self.lines_rbtn) self.setTabOrder(self.lines_rbtn,self.bond_hilite_color_btn)
self.setTabOrder(self.cpk_atom_rad_spinbox,self.cpk_scale_factor_linedit) self.setTabOrder(self.cpk_scale_factor_linedit,self.cpk_scale_factor_slider) self.setTabOrder(self.cpk_scale_factor_slider,self.level_of_detail_combox) self.setTabOrder(self.level_of_detail_combox,self.bond_hilite_color_btn)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.reset_bond_colors_btn,self.bond_line_thickness_spinbox) self.setTabOrder(self.bond_line_thickness_spinbox,self.cpk_cylinder_rad_spinbox) self.setTabOrder(self.cpk_cylinder_rad_spinbox,self.radioButton11)
self.setTabOrder(self.reset_bond_colors_btn,self.cpk_cylinder_rad_spinbox) self.setTabOrder(self.cpk_cylinder_rad_spinbox,self.bond_line_thickness_spinbox) self.setTabOrder(self.bond_line_thickness_spinbox,self.radioButton11)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.show_valence_errors_checkbox,self.default_mode_combox) self.setTabOrder(self.default_mode_combox,self.startup_mode_combox) self.setTabOrder(self.startup_mode_combox,self.mode_combox) self.setTabOrder(self.mode_combox,self.fill_type_combox)
self.setTabOrder(self.show_valence_errors_checkbox,self.startup_mode_combox) self.setTabOrder(self.startup_mode_combox,self.default_mode_combox) self.setTabOrder(self.default_mode_combox,self.mode_combox) self.setTabOrder(self.mode_combox,self.display_mode_combox) self.setTabOrder(self.display_mode_combox,self.fill_typ...
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.restore_bgcolor_btn,self.light_checkbox)
self.setTabOrder(self.restore_bgcolor_btn,self.vwd_rbtn) self.setTabOrder(self.vwd_rbtn,self.cpk_rbtn) self.setTabOrder(self.cpk_rbtn,self.tubes_rbtn) self.setTabOrder(self.tubes_rbtn,self.lines_rbtn) self.setTabOrder(self.lines_rbtn,self.autobond_checkbox) self.setTabOrder(self.autobond_checkbox,self.buildmode_highlig...
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.light_z_linedit,self.lighting_restore_defaults_btn)
self.setTabOrder(self.light_z_linedit,self.ms_on_checkbox) self.setTabOrder(self.ms_on_checkbox,self.ms_finish_linedit) self.setTabOrder(self.ms_finish_linedit,self.ms_finish_slider) self.setTabOrder(self.ms_finish_slider,self.ms_shininess_linedit) self.setTabOrder(self.ms_shininess_linedit,self.ms_shininess_slider) se...
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.nanohive_choose_btn,self.msg_serial_number_checkbox)
self.setTabOrder(self.nanohive_choose_btn,self.undo_restore_view_checkbox) self.setTabOrder(self.undo_restore_view_checkbox,self.undo_automatic_checkpoints_checkbox) self.setTabOrder(self.undo_automatic_checkpoints_checkbox,self.undo_stack_memory_limit_spinbox) self.setTabOrder(self.undo_stack_memory_limit_spinbox,self...
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.msg_timestamp_checkbox,self.caption_prefix_linedit)
self.setTabOrder(self.msg_timestamp_checkbox,self.current_width_spinbox) self.setTabOrder(self.current_width_spinbox,self.current_height_spinbox) self.setTabOrder(self.current_height_spinbox,self.save_current_btn) self.setTabOrder(self.save_current_btn,self.saved_width_lineedit) self.setTabOrder(self.saved_width_lineed...
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
self.setTabOrder(self.caption_fullpath_checkbox,self.ok_btn)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
bytes = self.process.readStdout() if bytes: self.fwThread.putData(bytes)
def processTimeout(self): if self.process.isRunning(): if not self.progressDialog.isShown() or self.progressDialog.Rejected: return msgLabel = self.progressDialog.getMsgLabel() duration = time.time() - self.stime elapmsg = "Elasped Time: " + self.progressDialog.hhmmss_str(int(duration)) msgLabel.setText(elapmsg) byte...
self.fwThread.stop()
def processDone(self): self.fwThread.stop() self.jobTimer.stop() if self.process.normalExit(): print "The process is done!" self.retValue = 0 self.progressDialog.accept() else: print "The process is cancelled!" self.retValue = 1 ###Don't know why I can't call reject() here. self.progressDialog.accept()#reject()
self.retValue = 0 self.progressDialog.accept()
QDialog.accept(self.progressDialog)
def processDone(self): self.fwThread.stop() self.jobTimer.stop() if self.process.normalExit(): print "The process is done!" self.retValue = 0 self.progressDialog.accept() else: print "The process is cancelled!" self.retValue = 1 ###Don't know why I can't call reject() here. self.progressDialog.accept()#reject()
self.retValue = 1 self.progressDialog.accept()
QDialog.reject(self.progressDialog)
def processDone(self): self.fwThread.stop() self.jobTimer.stop() if self.process.normalExit(): print "The process is done!" self.retValue = 0 self.progressDialog.accept() else: print "The process is cancelled!" self.retValue = 1 ###Don't know why I can't call reject() here. self.progressDialog.accept()#reject()
self.outputFile = QFile(self.job_outputfile) self.outputFile.open( IO_WriteOnly | IO_Append )
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 #DATfile = os.path.join(jobDir, "PUNCH") #if os.path.exists(DATfile): # Remove any previous DAT (PU...
args = [self.server.program, jobInputFile]
jobOutputfile = self.job_outputfile args = [self.server.program, jobInputFile, jobOutputfile]
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 #DATfile = os.path.join(jobDir, "PUNCH") #if os.path.exists(DATfile): # Remove any previous DAT (PU...
self.process.setCommunication(QProcess.Stdout) self.fwThread = FileWriting(self.outputFile)
print "The params for the QProcess run are: ", args
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 #DATfile = os.path.join(jobDir, "PUNCH") #if os.path.exists(DATfile): # Remove any previous DAT (PU...
self.fwThread.start()
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 #DATfile = os.path.join(jobDir, "PUNCH") #if os.path.exists(DATfile): # Remove any previous DAT (PU...
self.progressDialog.exec_loop() retValue = self.retValue self.fwThread.wait() bytes = self.process.readStdout() if bytes: self.outputFile.writeBlock(bytes) self.outputFile.flush()
ret = self.progressDialog.exec_loop() if ret == QDialog.Accepted: retValue = 0 else: retValue = 1
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 #DATfile = os.path.join(jobDir, "PUNCH") #if os.path.exists(DATfile): # Remove any previous DAT (PU...
self.outputFile.close()
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 #DATfile = os.path.join(jobDir, "PUNCH") #if os.path.exists(DATfile): # Remove any previous DAT (PU...
title = "debug: run py code" label = "one line of python to exec in GLPane.py's globals()\n(or use @@@ to fake \\n for more lines)\n(or use execfile)" text, ok = QInputDialog.getText(title, label) if ok: command = str(text) command = command.replace("@@@",'\n') debug_run_command(command, source = "debug menu") else: p...
from debug import debug_runpycode_from_a_dialog debug_runpycode_from_a_dialog( source = "GLPane debug menu")
def _debug_runpycode(self): title = "debug: run py code" label = "one line of python to exec in GLPane.py's globals()\n(or use @@@ to fake \\n for more lines)\n(or use execfile)" text, ok = QInputDialog.getText(title, label) if ok: # fyi: type(text) == <class '__main__.qt.QString'> command = str(text) #k not yet well t...
def debug_run_command(command, source = "user debug input"): """Execute a python command, supplied by the user via some sort of debugging interface (named by source), in GLPane.py's globals. Return 1 for ok (incl empty command), 0 for any error. Caller should not print diagnostics -- this function should be extended to...
def debug_run_command(command, source = "user debug input"): #bruce 040913-16 #e move this to somewhere more general? """Execute a python command, supplied by the user via some sort of debugging interface (named by source), in GLPane.py's globals. Return 1 for ok (incl empty command), 0 for any error. Caller should not...
mol.changeapp(0)
def _stateDoneOrCancel(self, cancelling = 0): #e rename? revise? #bruce 050228 to help fix bug 314 and unreported bugs "common method for StateDone and StateCancel" ## self.update_from_controls() #k 041017 night - will this help or hurt? since hard to know, not adding it now. # restore normal appearance for mol in self...
if self.alter_name:
if alter_name:
def deepcopy(self, alter_name = True): #bruce 051003 added alter_name, but I don't know if passing False is ever legal. ###@@@ #bruce 050704; don't know whether this is complete [needs review by Mark; is it ok it only sets .ui?] "Make a copy of self (a gamessParms object), which shares no mutable state with self. (Used...
if not os.path.exists(env.prefs[nanohive_path_prefs_key]):
if not os.path.exists(env.prefs[povray_path_prefs_key]):
def raytrace_scene_using_povray(assy, pov, width, height, output_type="png"): '''Render the POV-Ray scene file <pov>. The output image is placed next to <pov> with the extension based on <output_type>. <width>, <height> are the width and height of the rendered image. (int) <output_type> is the extension of the output i...
program = "\""+povray_exe+"\""
if sys.platform == 'win32': program = "\""+povray_exe+"\"" else: program = povray_exe
def raytrace_scene_using_povray(assy, pov, width, height, output_type="png"): '''Render the POV-Ray scene file <pov>. The output image is placed next to <pov> with the extension based on <output_type>. <width>, <height> are the width and height of the rendered image. (int) <output_type> is the extension of the output i...
self.resize(QSize(212,544).expandedTo(self.minimumSizeHint()))
self.resize(QSize(255,591).expandedTo(self.minimumSizeHint()))
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl)
def __init__(self):
def __init__(self, debug_name = None): self.debug_name = debug_name
def __init__(self): self._subs = {} # map from id(func) to list of (zero or more identical elements) func (which are of course strongrefs to func). # (We need the dict for efficient removal, and multiple copies of func in case duplicate funcs are provided # (which is quite possible), but that doesn't need to be optimi...
print "atom_debug: fyi: %r's event already occurred, fulfilling new subs %r immediately" % (self, func)
print_compact_stack( "atom_debug: fyi: %r's event already occurred, fulfilling new subs %r immediately: " % (self, func))
def subscribe(self, func): try: subs = self._subs except AttributeError: # our event already occurred (as indicated by fulfill_all removing this attribute). # [not sure if this ever happens in initial uses of this class] # (note: if subscribe could come before __init__, e.g. due to some sort of bug # in which this obj...
subslist = self.__subslist = OneTimeSubsList()
debug_name = platform.atom_debug and ("%r" % self) or None subslist = self.__subslist = OneTimeSubsList(debug_name)
def track_use(self): """#doc [some callers might inline this method] [must be called on every use, not just first one after a change, in case env.track points to different objects for different uses] """ try: subslist = self.__subslist except AttributeError: # this is the only way self.__subslist gets created; # it mea...
obj = usage_tracker_obj()
debug_name = platform.atom_debug and ("%r" % self) or None obj = usage_tracker_obj(debug_name)
def begin_tracking_usage(self): #e there's a docstring for this in an outtakes file, if one is needed obj = usage_tracker_obj() match_checking_code = usage_tracker.begin( obj) # don't store match_checking_code in self -- that would defeat the error-checking # for bugs in how self's other code matches up these begin and...
comCenter = V(0.0, 0.0, 0.0)
def setViewZoomToSelection(self, fast = False): #Nnad 60903 '''Change the view so that only selected atoms, chunks and Jigs fit in the GLPane. (i.e. Zoom to the selection) If <fast> is True, then snap to the view ''' #ninad060903: # I am not using bounding box object as used in fit to selection. I am using only self.sc...
numMovables = len(movables)
pointList = []
def setViewZoomToSelection(self, fast = False): #Nnad 60903 '''Change the view so that only selected atoms, chunks and Jigs fit in the GLPane. (i.e. Zoom to the selection) If <fast> is True, then snap to the view ''' #ninad060903: # I am not using bounding box object as used in fit to selection. I am using only self.sc...
comCenter += atm.posn() comCenter /= len(self.assy.selatoms_list())
pointList += [atm.posn()]
def setViewZoomToSelection(self, fast = False): #Nnad 60903 '''Change the view so that only selected atoms, chunks and Jigs fit in the GLPane. (i.e. Zoom to the selection) If <fast> is True, then snap to the view ''' #ninad060903: # I am not using bounding box object as used in fit to selection. I am using only self.sc...
comCenter += obj.center if self.assy.selatoms_list(): comCenter /= (numMovables + 1) else: comCenter /= numMovables
pointList += [obj.center]
def setViewZoomToSelection(self, fast = False): #Nnad 60903 '''Change the view so that only selected atoms, chunks and Jigs fit in the GLPane. (i.e. Zoom to the selection) If <fast> is True, then snap to the view ''' #ninad060903: # I am not using bounding box object as used in fit to selection. I am using only self.sc...
center = comCenter
bbox = BBox(pointList) center = bbox.center() scale = float( bbox.scale() * 0.85) aspect = float(self.width) / self.height if aspect < 1.0: scale /= aspect
def setViewZoomToSelection(self, fast = False): #Nnad 60903 '''Change the view so that only selected atoms, chunks and Jigs fit in the GLPane. (i.e. Zoom to the selection) If <fast> is True, then snap to the view ''' #ninad060903: # I am not using bounding box object as used in fit to selection. I am using only self.sc...
self.snapToView(self.quat, self.scale, pov, 1.0)
self.snapToView(self.quat, scale, pov, 1.0)
def setViewZoomToSelection(self, fast = False): #Nnad 60903 '''Change the view so that only selected atoms, chunks and Jigs fit in the GLPane. (i.e. Zoom to the selection) If <fast> is True, then snap to the view ''' #ninad060903: # I am not using bounding box object as used in fit to selection. I am using only self.sc...
self.animateToView(self.quat, self.scale, pov, 1.0)
self.animateToView(self.quat, scale, pov, 1.0)
def setViewZoomToSelection(self, fast = False): #Nnad 60903 '''Change the view so that only selected atoms, chunks and Jigs fit in the GLPane. (i.e. Zoom to the selection) If <fast> is True, then snap to the view ''' #ninad060903: # I am not using bounding box object as used in fit to selection. I am using only self.sc...