rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
'test_motors_027_two_rotarymotors_applying_equal_and_opposite_torque', 'test_floppy_organics_C5H10', 'test_floppy_organics_C5H12d', 'test_jigs_to_several_atoms_007_rotarymotor_and_anchors_to_100_atoms', 'test_jigs_to_several_atoms_002_rotarymotor_to_100_atoms', 'test_heteroatom_organics_ADAM_NH2_Cs', | 'test_floppy_organics_C5H12e', | def lastLineOfReadings(f): lines = readlines(f) n = None for i in range(len(lines)): if lines[i].startswith("# Done:"): n = i - 1 break if n == None: return None return map(string.atof, lines[n].split()) |
'test_floppy_organics_C6H14a', 'test_minimize_0008', 'test_heteroatom_organics_C5H10BH', 'test_amino_acids_ala_l_aminoacid', 'test_heteroatom_organics_CH3BHCH3', 'test_floppy_organics_C7H14b', 'test_floppy_organics_C6H14c', 'test_heteroatom_organics_ADAM_PH2_Cs', | 'test_floppy_organics_C6H14e', 'test_heteroatom_organics_C_CH3_3_AlH2', 'test_heteroatom_organics_CH3SiH3', | def lastLineOfReadings(f): lines = readlines(f) n = None for i in range(len(lines)): if lines[i].startswith("# Done:"): n = i - 1 break if n == None: return None return map(string.atof, lines[n].split()) |
'test_floppy_organics_C6H14b', | 'test_rigid_organics_C14H24', 'test_amino_acids_pro_l_aminoacid', 'test_heteroatom_organics_ADAM_SiH3_C3v', 'test_floppy_organics_C5H12b', 'test_floppy_organics_C4H10b', 'test_amino_acids_cys_l_aminoacid', 'test_amino_acids_thr_l_aminoacid', 'test_amino_acids_ile_l_aminoacid', 'test_amino_acids_val_l_aminoacid', 'test_... | def lastLineOfReadings(f): lines = readlines(f) n = None for i in range(len(lines)): if lines[i].startswith("# Done:"): n = i - 1 break if n == None: return None return map(string.atof, lines[n].split()) |
'test_floppy_organics_C6H14e', 'test_floppy_organics_C5H12c', 'test_amino_acids_asp_l_aminoacid', 'test_floppy_organics_C5H12a', 'test_heteroatom_organics_C_CH3_3_AlH2', 'test_heteroatom_organics_C_CH3_3_OH', 'test_amino_acids_cys_l_aminoacid', 'test_rigid_organics_C14H24', 'test_floppy_organics_C4H10b', 'test_amino_ac... | 'test_amino_acids_asn_l_aminoacid', | def lastLineOfReadings(f): lines = readlines(f) n = None for i in range(len(lines)): if lines[i].startswith("# Done:"): n = i - 1 break if n == None: return None return map(string.atof, lines[n].split()) |
'test_amino_acids_thr_l_aminoacid', 'test_heteroatom_organics_ADAM_SiH3_C3v', 'test_amino_acids_val_l_aminoacid', | 'test_amino_acids_met_l_aminoacid', | def lastLineOfReadings(f): lines = readlines(f) n = None for i in range(len(lines)): if lines[i].startswith("# Done:"): n = i - 1 break if n == None: return None return map(string.atof, lines[n].split()) |
'test_amino_acids_leu_l_aminoacid', 'test_amino_acids_asn_l_aminoacid', 'test_amino_acids_met_l_aminoacid', | 'test_amino_acids_arg_l_aminoacid', | def lastLineOfReadings(f): lines = readlines(f) n = None for i in range(len(lines)): if lines[i].startswith("# Done:"): n = i - 1 break if n == None: return None return map(string.atof, lines[n].split()) |
'test_amino_acids_arg_l_aminoacid' | 'test_amino_acids_leu_l_aminoacid', 'test_amino_acids_phe_l_aminoacid' | def lastLineOfReadings(f): lines = readlines(f) n = None for i in range(len(lines)): if lines[i].startswith("# Done:"): n = i - 1 break if n == None: return None return map(string.atof, lines[n].split()) |
if key == Qt.Key_X or key == Qt.Key_Y or key == Qt.Key_Z: | elif key == Qt.Key_X or key == Qt.Key_Y or key == Qt.Key_Z: | def keyRelease(self,key): basicMode.keyRelease(self, key) |
if key == Qt.Key_R: | self.movingPoint = None elif key == Qt.Key_R: | def keyRelease(self,key): basicMode.keyRelease(self, key) |
if key == Qt.Key_T: | elif key == Qt.Key_T: | def keyRelease(self,key): basicMode.keyRelease(self, key) |
self.moveOffset += norm(point - self.movingPoint) | self.moveOffset = point - self.startpt | 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.moviePlayerDashboard.setGeometry(QRect(0,58,1033,29)) | self.moviePlayerDashboard.setGeometry(QRect(0,58,1036,29)) | def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.statusBar() |
if errorcode: return "filename_does_not_exist" | 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... | |
if self.assy.filename: | if self.assy.filename and not errorcode: | 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... |
if not mol.hidden or mol.disp != diINVISIBLE: natoms += len(mol.atoms) | if (not mol.hidden) and (mol.disp != diINVISIBLE): natoms += len(mol.atoms) | def writemdl(assy, filename): assy.alist = [] natoms = 0 # Specular values keyed by atom color # Only Carbon, Hydrogen and Silicon supported here specValues = {(117,117,117):((183, 183, 183), 16, 44), \ (256,256,256):((183, 183, 183), 15, 44), \ (111,93,133):((187,176,200), 16, 44)} # Determine the number of visible a... |
self.__last_3dupdate_time = now | def sim_frame_callback(self, last_frame): #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.PRE... | |
self.__last_3dupdate_time = now_start = now | def sim_frame_callback(self, last_frame): #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.PRE... | |
pytime = self.__last_3dupdate_time - now self.__last_pytime = pytime if debug_pyrex_prints: print "python stuff took", pytime if debug_timing_loop_on_sbar: msg = "sim took %0.3f, hit frame %03d, py took %0.3f" % \ (simtime, self.__frame_number, pytime) env.history.statusbar_msg(msg) | def sim_frame_callback(self, last_frame): #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.PRE... | |
self.glpane.paintGL() def setViewRight(self): self.glpane.quat = Q(V(0,1,0),pi/2) | def setViewLeft(self): self.glpane.quat = Q(V(0,1,0),-pi/2) self.glpane.paintGL() | |
PlotToolDialog.__init__(self, modal=False) | parent = assy.w PlotToolDialog.__init__(self, parent) | def __init__(self, assy, movie): #bruce 050326 added movie arg PlotToolDialog.__init__(self, modal=False) ## self.assy = assy self.history = assy.w.history #bruce 050326 self.movie = movie # before bruce 050326 was assy.current_movie if self.setup(): return #self.exec_loop() self.show() # Fixed bug 440-1. Added "modal... |
if self.setup(): return self.show() | self.setup() self.show() | def __init__(self, assy, movie): #bruce 050326 added movie arg PlotToolDialog.__init__(self, modal=False) ## self.assy = assy self.history = assy.w.history #bruce 050326 self.movie = movie # before bruce 050326 was assy.current_movie if self.setup(): return #self.exec_loop() self.show() # Fixed bug 440-1. Added "modal... |
self.__tooltip = QToolTip(vp) | self.__tooltip = MyToolTip(vp) | def fillInToolTip(self): """Step through the nodes for this tree, and fill in the QToolTip for the QListViewItems in the viewport of the QlistView for the tree.""" if self.__tooltipInvalid: self.__tooltipInvalid = False vp = self.viewport() try: self.__tooltip.remove(vp) del self.__tooltip except AttributeError: pass s... |
self.modelTreeView.setMinimumSize(150, 480) | self.modelTreeView.setMinimumSize(150, 0) | def __init__(self,parent = None, name = None, fl = 0): |
self.glpane.setMinimumSize(800, 780) | def __init__(self,parent = None, name = None, fl = 0): | |
The caller is responsible for adding the POV-Ray Scene node to the model tree. Returns errorcode and errortext. """ | The caller is responsible for adding the POV-Ray Scene node (self) to the model tree, if desired. Prints any necessary error messages to history; returns nothing. """ cmd = greenmsg("Raytrace Scene: ") | def raytrace_scene(self, tmpscene=False): """Render scene. If tmpscene is False, the INI and pov files are written to the 'POV-Ray Scene Files' directory. If tmpscene is True, the INI and pov files are written to a temporary directory (~/Nanorex/POV-Ray). Callers should set <tmpscene> = True when they want to render th... |
return 1, "Problem getting POV-Ray filename trio." cmd = greenmsg("Raytrace Scene: ") | env.history.message(cmd + redmsg("Problem getting POV-Ray filename trio.")) return | def raytrace_scene(self, tmpscene=False): """Render scene. If tmpscene is False, the INI and pov files are written to the 'POV-Ray Scene Files' directory. If tmpscene is True, the INI and pov files are written to a temporary directory (~/Nanorex/POV-Ray). Callers should set <tmpscene> = True when they want to render th... |
frame_repr = _std_frame_repr, | def standard_inval(self): """This is used to receive the invalidation signal, and call self.invalidator after some bookkeeping. See class docstring for more info. It also removes all cyclic or large attrs of self, to prevent memory leaks. """ # this needs to remove every subs except the one which is being fulfilled by ... | |
self.graphene_parameters_grpbtn.setAutoDefault(0) | def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) | |
return | def setup(): global CylList, diamondGridList, CapList, CubeList, solidCubeList global sphereList, rotSignList, linearLineList, linearArrowList global circleList, lonsGridList, lonsEdges, lineCubeList, SiCGridList listbase = glGenLists(numSphereSizes + 21) for i in range(numSphereSizes): sphereList += [listbase+i] glN... | |
return | def drawCircle(color, center, radius, normal): """Scale, rotate/translate the unit circle properly """ glMatrixMode(GL_MODELVIEW) glPushMatrix() glColor3fv(color) glDisable(GL_LIGHTING) glTranslatef(center[0], center[1], center[2]) rQ = Q(V(0, 0, 1), normal) rotAngle = rQ.angle*180.0/pi #This may cause problems as pr... | |
return | def drawLinearArrows(longScale): glCallList(linearArrowList) newPos = halfHeight*longScale glPushMatrix() glTranslate(0.0, 0.0, -newPos) glCallList(linearArrowList) glPopMatrix() glPushMatrix() glTranslate(0.0, 0.0, newPos -2.0*halfEdge) glCallList(linearArrowList) glPopMatrix() | |
depthOffset = 0.005 glPushMatrix() glColor3fv(color) glDisable(GL_LIGHTING) glTranslatef(center[0], center[1], center[2]) 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) glPushMatrix() glTranslate(h/2.0 + depthOffset, 0.0, 0.0... | depthOffset = 0.005 glPushMatrix() glColor3fv(color) glDisable(GL_LIGHTING) glTranslatef(center[0], center[1], center[2]) 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) glPushMatrix() glTranslate(h/2.0 + depthOffset, 0.0, 0.0... | def drawLinearSign(color, center, axis, l, h, w): """Linear motion sign on the side of squa-linder """ depthOffset = 0.005 glPushMatrix() glColor3fv(color) glDisable(GL_LIGHTING) glTranslatef(center[0], center[1], center[2]) ##Huaicai 1/17/05: To avoid rotate around (0, 0, 0), which causes ## display problem on some p... |
glPushMatrix() glColor3fv(color) vec = pos2-pos1 axis = norm(vec) glTranslatef(pos1[0], pos1[1], pos1[2]) 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) glRotate(rotation, 0.0, 0.0, 1.0) glScale(radius,radius,vlen(vec)) glLin... | glPushMatrix() glColor3fv(color) vec = pos2-pos1 axis = norm(vec) glTranslatef(pos1[0], pos1[1], pos1[2]) 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) glRotate(rotation, 0.0, 0.0, 1.0) glScale(radius,radius,vlen(vec)) glLin... | def drawRotateSign(color, pos1, pos2, radius, rotation = 0.0): """Rotate sign on top of the caps of the cylinder """ glPushMatrix() glColor3fv(color) vec = pos2-pos1 axis = norm(vec) glTranslatef(pos1[0], pos1[1], pos1[2]) ##Huaicai 1/17/05: To avoid rotate around (0, 0, 0), which causes ## display problem on some pla... |
return | def drawsphere(color, pos, radius, detailLevel): glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color) glPushMatrix() glTranslatef(pos[0], pos[1], pos[2]) glScale(radius,radius,radius) glCallList(sphereList[detailLevel]) glPopMatrix() | |
return | def drawwiresphere(color, pos, radius, detailLevel=1): glColor3fv(color) glDisable(GL_LIGHTING) glPolygonMode(GL_FRONT, GL_LINE) glPushMatrix() glTranslatef(pos[0], pos[1], pos[2]) glScale(radius,radius,radius) glCallList(sphereList[detailLevel]) glEnable(GL_LIGHTING) glPopMatrix() glPolygonMode(GL_FRONT, GL_FILL) | |
return | def drawLineCube(color, pos, radius): cubeVertices = [-1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, -1.0, -1.0] vtIndices = [0,1,2,3, 0,4,5,1, 5,4,7,6, 6,7,3,2] glEnableClientState(GL_VERTEX_ARRAY) glVertexPointer(3, GL_FLOAT, 0, cubeVertices) gl... | |
return | def drawGrid(scale, center, latticeType): """Construct the grid model and show as position references for cookies. The model is build around "pov" and has size of 2*"scale" on each of the (x, y, z) directions. This should be optimized latter. For "scale = 200", it takes about 1479623 loops. ---Huaicai """ glDisable(G... | |
glBegin(GL_LINE_LOOP) glVertex(pt1[0],pt1[1],pt1[2]) glVertex(c2[0],c2[1],c2[2]) glVertex(pt2[0],pt2[1],pt2[2]) glVertex(c3[0],c3[1],c3[2]) glEnd() | glBegin(GL_LINE_LOOP) glVertex(pt1[0],pt1[1],pt1[2]) glVertex(c2[0],c2[1],c2[2]) glVertex(pt2[0],pt2[1],pt2[2]) glVertex(c3[0],c3[1],c3[2]) glEnd() return | def drawRubberBand(pt1, pt2, c2, c3, color): """Huaicai: depth test should be disabled to make the xor work """ glBegin(GL_LINE_LOOP) glVertex(pt1[0],pt1[1],pt1[2]) glVertex(c2[0],c2[1],c2[2]) glVertex(pt2[0],pt2[1],pt2[2]) glVertex(c3[0],c3[1],c3[2]) glEnd() |
return | def drawLonsdaleiteGrid(scale, center): """This function is obsolete. Call dragGrid() and pass approriate parameter to draw the Lonsdaleite Lattice """ glDisable(GL_LIGHTING) bblo = center- scale bbhi = center + scale i1 = int(floor(bblo[0]/XLen)) i2 = int(ceil(bbhi[0]/XLen)) j1 = int(floor(bblo[1]/YLen)) j2 = int(ce... | |
glEnable(GL_LIGHTING) | glEnable(GL_LIGHTING) return | def drawDiamondCubic(color): glDisable(GL_LIGHTING) glColor3fv(color) glBegin(GL_LINES) for jj in range(5): for kk in range(5): glVertex3f(sp0, sp1*jj, sp1*kk) glVertex3f(sp4, sp1*jj, sp1*kk) for jj in range(5): for ii in range(5): glVertex3f(sp1*ii, sp1*jj, sp0) glVertex3f(sp1*ii, sp1*jj, sp4) for kk in range(5): fo... |
return | def drawCubeCell(color): vs = [[sp0, sp0, sp0], [sp4, sp0, sp0], [sp4, sp4, sp0], [sp0, sp4, sp0], [sp0, sp0, sp4], [sp4, sp0, sp4], [sp4, sp4, sp4], [sp0, sp4, sp4]] glDisable(GL_LIGHTING) glColor3fv(color) glBegin(GL_LINE_LOOP) for ii in range(4): glVertex3fv(vs[ii]) glEnd() glBegin(GL_LINE_LOOP) for ii in range(4,... | |
return | def drawPlane(color, w, h, textureReady, opacity, SOLID=False, pickCheckOnly=False): '''Draw polygon with size of <w>*<h> and with color <color>. Optionally, it could be texuture mapped, translucent. @pickCheckOnly This is used to draw the geometry only, used for OpenGL pick selection purpose.''' vs = [[-0.5, 0.5, 0.0]... | |
return | def drawGPGrid(color, line_type, w, h, uw, uh): '''Draw grid lines for a Grid Plane, where: color = grid line color line_type is: 0=None, 1=Solid, 2=Dashed" or 3=Dotted w = width h = height uw = width spacing between grid lines uh = height spacing between grid lines ''' from prefs_constants import NO_LINE, SOLID_LINE,... | |
return | def drawSiCGrid(color, line_type, w, h): '''Draw SiC grid. ''' from prefs_constants import NO_LINE, SOLID_LINE, DASHED_LINE, DOTTED_LINE if line_type == NO_LINE: return XLen = sic_uLen * 3.0 YLen = sic_yU * 2.0 hw = w/2.0; hh = h/2.0 xx = (-hw, hw) yy = (-hh, hh) i1 = int(floor(xx[0]/XLen)) i2 = int(ceil(xx[1]/XLen))... | |
return | def drawFullWindow(vtColors): """Draw gradient background color. <vtColors> is a 4 element list specifying colors for the left-down, right-down, right-up, left-up window corners. To draw the full window, the modelview and projection should be set in identity. """ from constants import GL_FAR_Z glDisable(GL_LIGHTING) g... | |
def keyPress(self,key): basicMode.keyPress(self, key) if key == Qt.Key_Shift: print "fyi: treating that as Qt.Key_Shift" | def restore_gui(self): self.w.selectMolDashboard.hide() | |
self.w.toolsSelectMoleculesAction.setOn(1) | self.w.toolsSelectAtomsAction.setOn(1) | def init_gui(self): selectMode.init_gui(self) self.o.setCursor(self.w.SelectAtomsCursor) self.w.toolsSelectMoleculesAction.setOn(1) # toggle on the "Select Molecule" tools icon self.w.selectMolDashboard.show() |
global MMKitWin if MMKitWin: MMKitWin.setup_current_page(MMKitWin.clipboardPage) | def editCopy(self): self.assy.copy_sel() self.win_update() global MMKitWin if MMKitWin: MMKitWin.setup_current_page(MMKitWin.clipboardPage) # Updates the MMKit clipboard page with the new clipboard object. mark 060223. | |
nonbaggage = [] selatoms = self.o.assy.selatoms_list() | selatoms = self.o.assy.selatoms | def get_dragatoms_and_baggage(self): dragatoms = [] baggage = [] nonbaggage = [] selatoms = self.o.assy.selatoms_list() # Accumulate all the baggage from the selected atoms, which can include # selected atoms if a selected atom is another selected atom's baggage. # BTW, it is not possible for an atom to end up in se... |
for at in selatoms[:]: | for at in selatoms.itervalues(): | def get_dragatoms_and_baggage(self): dragatoms = [] baggage = [] nonbaggage = [] selatoms = self.o.assy.selatoms_list() # Accumulate all the baggage from the selected atoms, which can include # selected atoms if a selected atom is another selected atom's baggage. # BTW, it is not possible for an atom to end up in se... |
baggage += bag | baggage.extend(bag) | def get_dragatoms_and_baggage(self): dragatoms = [] baggage = [] nonbaggage = [] selatoms = self.o.assy.selatoms_list() # Accumulate all the baggage from the selected atoms, which can include # selected atoms if a selected atom is another selected atom's baggage. # BTW, it is not possible for an atom to end up in se... |
bagdict = dict([(at.key, None) for at in baggage]) | def get_dragatoms_and_baggage(self): dragatoms = [] baggage = [] nonbaggage = [] selatoms = self.o.assy.selatoms_list() # Accumulate all the baggage from the selected atoms, which can include # selected atoms if a selected atom is another selected atom's baggage. # BTW, it is not possible for an atom to end up in se... | |
for at in selatoms[:]: if not at in baggage: | for key, at in selatoms.iteritems(): if key not in bagdict: | def get_dragatoms_and_baggage(self): dragatoms = [] baggage = [] nonbaggage = [] selatoms = self.o.assy.selatoms_list() # Accumulate all the baggage from the selected atoms, which can include # selected atoms if a selected atom is another selected atom's baggage. # BTW, it is not possible for an atom to end up in se... |
if self.renaming_this_item: self.renaming_this_item.okRename(0) self.done_renaming() | self.click_elsewhere_finishes_renaming() | def contentsMousePressEvent(self, event, dblclick = 0): "[called by Qt, or by our own contentsMouseDoubleClickEvent]" # figure out position and item of click (before doing any side effects) #e this might be split into a separate routine if it's useful during drag cpos = event.pos() # this is in contents coords; # y=1... |
self.statusbar_msg( sbar_text + " [not yet implemented]") | desc = sbar_text + " [not yet implemented]" self.drag_handler.describe_drag = desc self.statusbar_msg( desc + " <this suffix should not be seen>" ) | def advise_starting_drag_and_get_dragobj(self, drag_type, nodes): """Our current drag_handler can call this to advise us that it started a drag of given type on given nodes, and that we should highlight the original nodes to indicate this, and that if we get any drop-related events (e.g. dragEnter, dragMove, dragLeave)... |
if debug_dragstuff: print_compact_stack("contentsDragEnterEvent stack (fyi): ") | def contentsDragEnterEvent(self, event): # warning: for unknown reasons, this is sometimes called twice when i'd expect it to be called once. if debug_dragstuff: print_compact_stack("contentsDragEnterEvent stack (fyi): ") ok = QTextDrag.canDecode(event) # this code is duplicated elsewhere event.accept(ok) self.last_dra... | |
if debug_dragstuff: print "enter: ok = %r" % ok | def contentsDragEnterEvent(self, event): # warning: for unknown reasons, this is sometimes called twice when i'd expect it to be called once. if debug_dragstuff: print_compact_stack("contentsDragEnterEvent stack (fyi): ") ok = QTextDrag.canDecode(event) # this code is duplicated elsewhere event.accept(ok) self.last_dra... | |
do_update_drop_point_highlighting_in_next_viewportPaintEvent = False | def dragEnterEvent(self,event): if debug_dragstuff: print "dragEnterEvent happened too! SHOULD NOT HAPPEN" # unless we are not accepting drops on the viewport | |
self.update_drop_point_highlighting( undo_only = True) | def slot_contentsMoving(self, x, y): """[Called by the Qt signal whose doc says: "This signal is emitted just before the contents are moved to position (x, y)." But this wording is misleading -- it's actually the position of the topleft visible part of the contents (in contents coords), as determined by the scrollbars.... | |
self.do_update_drop_point_highlighting_in_next_viewportPaintEvent = True | self.last_dragMove_ok = False self.last_dragMove_cpos = None self.drop_disabled_because = "drop disabled by autoscroll, until mouse moves" self.update_drop_point_highlighting() | def slot_contentsMoving(self, x, y): """[Called by the Qt signal whose doc says: "This signal is emitted just before the contents are moved to position (x, y)." But this wording is misleading -- it's actually the position of the topleft visible part of the contents (in contents coords), as determined by the scrollbars.... |
if debug_dragstuff: print "contentsDragLeaveEvent, event == %r" % event | def contentsDragLeaveEvent(self, event): if debug_dragstuff: print "contentsDragLeaveEvent, event == %r" % event # the following code is similar in dragLeave and Drop, not sure if identical self.last_dragMove_ok = False # not needed right now, but might matter # after the next dragEnter but before the next dragMove sel... | |
if not debug_dragstuff: return | substatus = " -- " + self.drop_disabled_because if self.drag_handler: desc = self.drag_handler.describe_your_drag_and_drop() else: desc = "drag from outside tree widget" self.statusbar_msg( desc + substatus ) if not debug_dragstuff: return | def update_drop_point_highlighting(self, undo_only = False): #k undo_only might not be needed once a clipping issue is solved -- see call that uses/used it, comments near it """Maintain highlighting of possible drop points, which should exist whenever self.last_dragMove_cpos and self.last_dragMove_ok, based on a drag p... |
def blotbluething(self, painter, pos = (0,0), color = Qt.white): "[for debugging] blot out what drawbluething drew, with 1 pixel margin as well" p = painter p.setPen(QPen(color, 6)) w,h = 100,9 w += 1 w += 2; h += 2 x,y = pos x -= 1; y -= 1 p.drawRect(x,y,h,h) | def blotbluething(self, painter, pos = (0,0), color = Qt.white): #k doesn't work "[for debugging] blot out what drawbluething drew, with 1 pixel margin as well" p = painter # caller should have called begin on the widget, assuming that works p.setPen(QPen(color, 6)) # 6 is pen thickness, at least half of 11, our height... | |
if self.do_update_drop_point_highlighting_in_next_viewportPaintEvent: self.do_update_drop_point_highlighting_in_next_viewportPaintEvent = False self.update_drop_point_highlighting() | def viewportPaintEvent(self, event): "[overrides TreeView.viewportPaintEvent]" | |
self.win.history.message("NIM: do the op %r on %d nodes, first/last names %r, %r" % ( | self.redmsg("NIM: do the op %r on %d nodes, first/last names %r, %r" % ( | def contentsDropEvent(self, event): if debug_dragstuff: print "contentsDropEvent, event == %r" % event |
self.win.history.message(errmsg) | self.redmsg(errmsg) | def contentsDropEvent(self, event): if debug_dragstuff: print "contentsDropEvent, event == %r" % event |
self.win.history.message("fyi (nim feature): refused dropped object which could not provide text") | self.redmsg("fyi (nim feature): refused dropped object which could not provide text") self.statusbar_msg(" ") | def contentsDropEvent(self, event): if debug_dragstuff: print "contentsDropEvent, event == %r" % event |
def redmsg(self, errmsg): "put an error message into the History" from HistoryWidget import redmsg self.win.history.message( redmsg(errmsg)) self.statusbar_msg(" ") return | def contentsDropEvent(self, event): if debug_dragstuff: print "contentsDropEvent, event == %r" % event | |
formats, self, "Export File dialog", "Select file to Export" ) if platform.atom_debug: linenum() print 'fn', repr(str(fn)) | formats, self, "Export File dialog", "Select file to Export", sfilter) | def fileExport(self): # Code copied from fileInsert() slot method. Mark 060731. """Slot method for 'File > Export'. """ if platform.atom_debug: from debug import linenum linenum() print 'start fileExport()' cmd = greenmsg("Export File: ") # This format list generated from the Open Babel wiki page: # http://openbabel.s... |
def blaberr(text=text): text[0] = str(proc.readStderr()) QObject.connect(proc, SIGNAL("readyReadStderr()"), blaberr) | def blaberr(text=text): text[0] = str(proc.readStderr()) | |
stderr = text[0] | stderr = str(proc.readLineStderr()) | def blaberr(text=text): text[0] = str(proc.readStderr()) |
return exitStatus == 0 and stderr == "1 molecule converted\n" | return exitStatus == 0 and stderr == "1 molecule converted" | def blaberr(text=text): text[0] = str(proc.readStderr()) |
self.selecttestAction = QAction(self,"selecttestAction") | def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.statusBar() | |
self.selectAllAction.setToolTip(self.__tr("Select All (Ctrl+A)")) | self.selectAllAction.setToolTip(self.__tr("Select All")) | def languageChange(self): self.setCaption(self.__tr("nanoENGINEER-1")) self.fileOpenAction.setText(self.__tr("Open")) self.fileOpenAction.setMenuText(self.__tr("&Open...")) self.fileOpenAction.setAccel(self.__tr("Ctrl+O")) self.fileSaveAction.setText(self.__tr("Save")) self.fileSaveAction.setMenuText(self.__tr("&Save")... |
self.selectInvertAction.setToolTip(self.__tr("Select Invert (Ctrl+Shift+I)")) | self.selectInvertAction.setToolTip(self.__tr("Select Invert")) | def languageChange(self): self.setCaption(self.__tr("nanoENGINEER-1")) self.fileOpenAction.setText(self.__tr("Open")) self.fileOpenAction.setMenuText(self.__tr("&Open...")) self.fileOpenAction.setAccel(self.__tr("Ctrl+O")) self.fileSaveAction.setText(self.__tr("Save")) self.fileSaveAction.setMenuText(self.__tr("&Save")... |
self.selecttestAction.setText(self.__tr("test")) self.selecttestAction.setMenuText(self.__tr("test")) | def languageChange(self): self.setCaption(self.__tr("nanoENGINEER-1")) self.fileOpenAction.setText(self.__tr("Open")) self.fileOpenAction.setMenuText(self.__tr("&Open...")) self.fileOpenAction.setAccel(self.__tr("Ctrl+O")) self.fileSaveAction.setText(self.__tr("Save")) self.fileSaveAction.setMenuText(self.__tr("&Save")... | |
cmd = ('FreezePython --include-modules=libsip,dbhash --exclude-modules=OpenGL --install-dir=' + os.path.join(self.buildSourcePath, 'program') + ' --target-name=' + self.appName + ' atom.py') | cmd = ('FreezePython --include-modules=libsip,dbhash' + ' --exclude-modules=OpenGL' + ' --install-dir=' + self.progPath + ' --target-name=' + self.appName + ' atom.py') | def freezePythonExecutable(self): # Mandrake calls it 'libsip', not 'sip' ... when did this happen? wware 051212 try: cmd = ('FreezePython --include-modules=libsip,dbhash --exclude-modules=OpenGL --install-dir=' + os.path.join(self.buildSourcePath, 'program') + ' --target-name=' + self.appName + ' atom.py') system(cm... |
cmd = ('FreezePython --include-modules=sip,dbhash --exclude-modules=OpenGL --install-dir=' + os.path.join(self.buildSourcePath, 'program') + ' --target-name=' + self.appName + ' atom.py') | cmd = ('FreezePython --include-modules=sip,dbhash' + ' --exclude-modules=OpenGL' + ' --install-dir=' + self.progPath + ' --target-name=' + self.appName + ' atom.py') | def freezePythonExecutable(self): # Mandrake calls it 'libsip', not 'sip' ... when did this happen? wware 051212 try: cmd = ('FreezePython --include-modules=libsip,dbhash --exclude-modules=OpenGL --install-dir=' + os.path.join(self.buildSourcePath, 'program') + ' --target-name=' + self.appName + ' atom.py') system(cm... |
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... | |
spf.write("Release: 0\n") | fields = version.split(".") earlyVersion = ".".join(fields[:-1]) lateVersion = fields[-1] spf.write("Version: %s\n" % earlyVersion) spf.write("Release: %s\n" % lateVersion) | 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... |
insertlabel(" length ") | insertlabel(" Length ") | def do_what_MainWindowUI_should_do(self): "self should be the main MWSemantics object -- at the moment this is a function, not a method" ### for now we must set up dashboards for both extrude and revolve. at first they are just the same one. # and when we show it we should patch the label... from qt import SIGNAL, QT... |
insertlabel("show: ") | insertlabel("Show: ") | def do_what_MainWindowUI_should_do(self): "self should be the main MWSemantics object -- at the moment this is a function, not a method" ### for now we must set up dashboards for both extrude and revolve. at first they are just the same one. # and when we show it we should patch the label... from qt import SIGNAL, QT... |
self.extrudePref1 = TogglePrefCheckBox("whole model", parent_now(), "extrudePref1", | self.extrudePref1 = TogglePrefCheckBox("Whole Model", parent_now(), "extrudePref1", | def do_what_MainWindowUI_should_do(self): "self should be the main MWSemantics object -- at the moment this is a function, not a method" ### for now we must set up dashboards for both extrude and revolve. at first they are just the same one. # and when we show it we should patch the label... from qt import SIGNAL, QT... |
self.extrudePref2 = TogglePrefCheckBox("bond-offset spheres", parent_now(), "extrudePref2", | self.extrudePref2 = TogglePrefCheckBox("Bond-offset Spheres", parent_now(), "extrudePref2", | def do_what_MainWindowUI_should_do(self): "self should be the main MWSemantics object -- at the moment this is a function, not a method" ### for now we must set up dashboards for both extrude and revolve. at first they are just the same one. # and when we show it we should patch the label... from qt import SIGNAL, QT... |
insertlabel("when done: ") | insertlabel("When Done: ") | def do_what_MainWindowUI_should_do(self): "self should be the main MWSemantics object -- at the moment this is a function, not a method" ### for now we must set up dashboards for both extrude and revolve. at first they are just the same one. # and when we show it we should patch the label... from qt import SIGNAL, QT... |
self.extrudePref3 = TogglePrefCheckBox("make bonds", parent_now(), "extrudePref3", attr = 'whendone_make_bonds') self.extrudePref4 = TogglePrefCheckBox("merge parts", parent_now(), "extrudePref4", attr = 'whendone_all_one_part') | self.extrudePref3 = TogglePrefCheckBox("Make Bonds", parent_now(), "extrudePref3", attr = 'whendone_make_bonds') self.extrudePref4 = TogglePrefCheckBox("Merge Chunks", parent_now(), "extrudePref4", attr = 'whendone_all_one_part') | def do_what_MainWindowUI_should_do(self): "self should be the main MWSemantics object -- at the moment this is a function, not a method" ### for now we must set up dashboards for both extrude and revolve. at first they are just the same one. # and when we show it we should patch the label... from qt import SIGNAL, QT... |
return "tolerance: %s => %s bonds" % (tol_str,nbonds_str) | return "Tolerance: %s => %s bonds" % (tol_str,nbonds_str) | def lambda_tol_nbonds(tol, nbonds): if nbonds == -1: nbonds_str = "?" else: nbonds_str = "%d" % (nbonds,) 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 "tolerance: %s => %s... |
print "fileIO: natoms =", natoms | def writemdl(assy, filename): assy.alist = [] natoms = 0 # Specular values keyed by atom color # Only Carbon, Hydrogen and Silicon supported here specValues = {(117,117,117):((183, 183, 183), 16, 44), \ (256,256,256):((183, 183, 183), 15, 44), \ (111,93,133):((187,176,200), 16, 44)} # Determine the number of visible a... | |
def dragto(self, point, event, perp = None): """Return the point to which we should drag the given point, if event is the drag-motion event and we want to drag the point parallel to the screen (or perpendicular to the given direction "perp" if one is passed in). (Only correct for points, not extended objects, unless yo... | def leftDown(self, event): """If there's nothing nearby, deposit a new atom. If cursor is on a singlet, deposit an atom bonded to it. If it is a real atom, drag it around. """ a = self.o.selatom el = PeriodicTable[self.w.Element] self.modified = 1 self.o.assy.modified = 1 if a: # if something was "lit up" if a.element... | |
p1, p2 = self.o.mousepoints(event) px = ptonline(a.posn(), p1, norm(p2-p1)) | px = self.dragto(a.posn(), event) | def leftDrag(self, event): """ drag the new atom around |
p1, p2 = self.o.mousepoints(event) v2 = norm(p2-p1) px = ptonline(a.posn(), p1, v2) | px = self.dragto(a.posn(), event) | def leftShiftDrag(self, event): """ drag the new atom around |
if el.base: | if len(el.quats): | def bond1(self, el, singlet, pos): obond = singlet.bonds[0] a1 = obond.other(singlet) mol = a1.molecule a = atom(el.symbol, pos, mol) obond.rebond(singlet, a) if el.base: # There is at least one other bond # this rotates the atom to match the bond formed above r = singlet.posn() - pos rq = Q(r,el.base) # if the other a... |
self ) | self, "Insert File dialog", "Select file to insert" ) | 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 ) if not fn: env.history.message("Cancelled") return ... |
self.currentFrame = self.totalFramesActual | def _setup(self, hflag = True): #bruce 060112 revised retval documentation and specific values """Setup this movie for playing; return False if this worked, True if it failed (warning: reverse of common boolean retvals). [#doc whether it always prints error msg to history if it failed.] """ # bruce 050427 comment: # wh... | |
v12 = self.atoms[1].posn()-self.atoms[2].posn() from math import acos return acos(dot(v01, v12) / (vlen(v01) * vlen(12))) | v21 = self.atoms[2].posn()-self.atoms[1].posn() from math import acos return (180/pi) * acos(dot(v01, v21) / (vlen(v01) * vlen(v21))) | def get_angle(self): '''Returns the angle between two atoms (nuclei)''' v01 = self.atoms[0].posn()-self.atoms[1].posn() v12 = self.atoms[1].posn()-self.atoms[2].posn() from math import acos return acos(dot(v01, v12) / (vlen(v01) * vlen(12))) |
from math import acos return acos(dot(u, v) / (vlen(u) * vlen(v))) | sign = 1.0 if dot(zy, u) < 0: sign = -1.0 from math import acos return (180/pi) * sign * acos(dot(u, v) / (vlen(u) * vlen(v))) | def get_dihedral(self): '''Returns the dihedral between two atoms (nuclei)''' wx = self.atoms[0].posn()-self.atoms[1].posn() yx = self.atoms[2].posn()-self.atoms[1].posn() xy = -yx zy = self.atoms[3].posn()-self.atoms[2].posn() u = cross(wx, yx) v = cross(xy, zy) from math import acos return acos(dot(u, v) / (vlen(u) *... |
print "fyi: bug in after option, this is its value:",after | print "fyi: exception in QListViewItem (or subclass) constructed with this after option:", after | def make_new_item_for_node(self, node, parent, display_prefs = {}, after = None): """build and return a single new tree item in this tree widget (as part of building the entire tree from scratch, or maybe an entire subtree) corresponding to node; the args are: self, this tree widget; not sure if this was avail to the o... |
item = item_class(parent, node.name) | try: item = item_class(parent, node.name) except: print "fyi: exception in QListViewItem (or subclass) constructed with this text:", node.name raise | def make_new_item_for_node(self, node, parent, display_prefs = {}, after = None): """build and return a single new tree item in this tree widget (as part of building the entire tree from scratch, or maybe an entire subtree) corresponding to node; the args are: self, this tree widget; not sure if this was avail to the o... |
if a1.atomtype.spX != 1: | if not (a1.atomtype.spX == 1 and atype.spX < 3): | def make_singlets_when_1_bond(self): # by josh, with some comments and mods by bruce "[private method; see docstring for make_singlets_when_2_bonds]" ## print "what the heck is this global variable named a doing here? %r" % (a,) ## its value is 0.85065080835203999; where does it come from? it hide bugs. ###@@@ assert l... |
modifyCenterCommonAxisActionText= " <u><b>Center On common Axis</b></u><br>"\ "<p><b> Moves</b> all selected chunks to the center of the <b> first </b> selected chunk "\ "and also <b>aligns</b> them to the axis of the first one ."\ "You must select two or more chunks before using this feature. </p>" self.modifyCen... | def createWhatsThis(self): # # File Toolbar # # Open File fileOpenText = "<u><b>Open File</b></u> (Ctrl + O)<br> "\ "<p><img source=\"fileopen\"><br> "\ "Opens a new file."\ "</p>" QMimeSourceFactory.defaultFactory().setPixmap( "fileopen", self.fileOpenAction.iconSet().pixmap() ) self.fileOpenAction.setWhatsThi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.