rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
('startup_mode', 'string', startupMode_prefs_key, 'SELECTMOLS' ), | ('startup_mode', 'string', startupMode_prefs_key, '$DEFAULT_MODE' ), | def _compute_default_bondVaneColor(): ord_pi_for_color = 0.5 # was ord_pi, when we let the color vary with ord_pi; # if we later want that, then define two colors here and use them as endpoints of a range color = ave_colors(ord_pi_for_color, blue, gray) return ave_colors(0.8, color, black) |
print "pref key =", env.prefs[ dynamicToolTipAtomDistancePrecision_prefs_key ] print "self.dynamicToolTipAtomDistancePrecision_spinbox.value() = ", self.dynamicToolTipAtomDistancePrecision_spinbox.value() | self.dynamicToolTipAtomDistancePrecision_spinbox.setValue(env.prefs[ dynamicToolTipAtomDistancePrecision_prefs_key ] ) self.dynamicToolTipBendAnglePrecision_spinbox.setValue(env.prefs[ dynamicToolTipBendAnglePrecision_prefs_key ] ) | def _setup_tooltips_page(self): #Ninad 060830 ''' Setup widgets to initialize (default or defined) values on the tooltips page.''' #Atom related Dynamic tooltip preferences connect_checkbox_with_boolean_pref(self.dynamicToolTipAtomChunkInfo_checkbox, dynamicToolTipAtomChunkInfo_prefs_key) connect_checkbox_with_boolean_... |
def change_dynamicToolTipAtomDistancePrecision(self): | def change_dynamicToolTipAtomDistancePrecision(self, value): | def change_dynamicToolTipAtomDistancePrecision(self): '''Update the atom distance precision for the dynamic tool tip.''' env.prefs[ dynamicToolTipAtomDistancePrecision_prefs_key ] = self.dynamicToolTipAtomDistancePrecision_spinbox.value() |
env.prefs[ dynamicToolTipAtomDistancePrecision_prefs_key ] = self.dynamicToolTipAtomDistancePrecision_spinbox.value() def change_dynamicToolTipBendAnglePrecision(self): | env.prefs[ dynamicToolTipAtomDistancePrecision_prefs_key ] = value def change_dynamicToolTipBendAnglePrecision(self, value): | def change_dynamicToolTipAtomDistancePrecision(self): '''Update the atom distance precision for the dynamic tool tip.''' env.prefs[ dynamicToolTipAtomDistancePrecision_prefs_key ] = self.dynamicToolTipAtomDistancePrecision_spinbox.value() |
env.prefs[ dynamicToolTipBendAnglePrecision_prefs_key ] = self.dynamicToolTipBendAnglePrecision_spinbox.value() | env.prefs[ dynamicToolTipBendAnglePrecision_prefs_key ] = value | def change_dynamicToolTipBendAnglePrecision(self): '''Update the bend angle precision for the dynamic tool tip.''' env.prefs[ dynamicToolTipBendAnglePrecision_prefs_key ] = self.dynamicToolTipBendAnglePrecision_spinbox.value() |
tree = Group("tree", assy, None, grouplist[0]) | tree = Group("tree", assy, None, grouplist) | def _readmmp(assy, filename, isInsert = False): #bruce 050405 revised code & docstring """Read an mmp file, print errors and warnings to assy.history, modify assy in various ways (a bad design, see comment in insertmmp) (but don't actually add file contents to assy -- let caller do that if and where it prefers), and re... |
def close(self): 'Slot for the Cancel button' QDialog.accept(self) | def close(self, e=None): """When the user closes dialog by clicking the 'X' button on the dialog title bar, this method is called. """ try: QDialog.accept(self) return True except: return False | def close(self): 'Slot for the Cancel button' # End the dialog without saying or doing anything. QDialog.accept(self) |
def selectAllorig(self): | def selectAll(self): | #def selectAll(self): |
def selectAll(self): "Selects all atoms present in a chunk" self.begin_select_cmd() for m in self.selmols: for a in m.atoms.itervalues(): a.pick() self.w.toolsBuildAtoms() self.unpickchunks() self.w.win_update() | #def selectAtomsInChunk(self): | |
if TEST_PYREX_OPENGL: | if quux_module_import_succeeded: use_c_renderer = env.prefs[use_c_renderer_key] else: use_c_renderer = False if use_c_renderer: | def update(self): #bruce 051126 added this method """Update attributes from current drawing-related prefs stored in prefs db cache. This should be called at the start of each complete redraw, or whenever the user changes these global prefs values (whichever is more convenient). (Note: When this is called during redraw,... |
if TEST_PYREX_OPENGL and ColorSorter.sorting: | if use_c_renderer and ColorSorter.sorting: | def schedule_sphere(color, pos, radius, detailLevel): """\ Schedule a sphere for rendering whenever ColorSorter thinks is appropriate. """ if TEST_PYREX_OPENGL and ColorSorter.sorting: if len(color) == 3: lcolor = (color[0], color[1], color[2], 1.0) else: lcolor = color ColorSorter._cur_shapelist.add_sphere(lcolor, pos... |
if TEST_PYREX_OPENGL and ColorSorter.sorting: | if use_c_renderer and ColorSorter.sorting: | def schedule_cylinder(color, pos1, pos2, radius, capped=0): """\ Schedule a cylinder for rendering whenever ColorSorter thinks is appropriate. """ if TEST_PYREX_OPENGL and ColorSorter.sorting: if len(color) == 3: lcolor = (color[0], color[1], color[2], 1.0) else: lcolor = color ColorSorter._cur_shapelist.add_cylinder(l... |
if TEST_PYREX_OPENGL and ColorSorter.sorting: | if use_c_renderer and ColorSorter.sorting: | def start(): """\ Start sorting - objects provided to "schedule", "schedule_sphere", and "schedule_cylinder" will be stored for a sort at the time "finish" is called. """ assert not ColorSorter.sorting, "Called ColorSorter.start but already sorting?!" ColorSorter.sorting = True if TEST_PYREX_OPENGL and ColorSorter.sort... |
if TEST_PYREX_OPENGL: | if use_c_renderer: | def finish(): """\ Finish sorting - objects recorded since "start" will be sorted and invoked now. """ if TEST_PYREX_OPENGL: quux.shapeRendererInit() # print "VBO %s enabled" % (('is not', 'is')[quux.shapeRendererGetInteger(quux.IS_VBO_ENABLED)]) quux.shapeRendererSetUseDynamicLOD(0) if ColorSorter.sphereLevel != -1: q... |
for i in range(self.currentFrame, self.totalFramesActual+1, self.win.skipSB.value()+1): | for i in range(self.currentFrame, self.totalFramesActual+1, self.win.skipSB.value()): | 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.displayCompass = env.prefs.get(displayCompass_prefs_key, True) self.compassPosition = env.prefs.get(compassPosition_prefs_key, UPPER_RIGHT) self.displayOriginAxis = env.prefs.get(displayOriginAxis_prefs_key, True) self.displayPOVAxis = env.prefs.get(displayPOVAxis_prefs_key, True) self.ortho = env.prefs.get(defaul... | self.displayCompass = env.prefs[displayCompass_prefs_key] self.compassPosition = env.prefs[compassPosition_prefs_key] self.displayOriginAxis = env.prefs[displayOriginAxis_prefs_key] self.displayPOVAxis = env.prefs[displayPOVAxis_prefs_key] self.ortho = env.prefs[defaultProjection_prefs_key] | def __init__(self, assy, master=None, name=None, win=None): self.win = win |
self.display = env.prefs.get(defaultDisplayMode_prefs_key, default_display_mode) | self.display = env.prefs[defaultDisplayMode_prefs_key] | def __init__(self, assy, master=None, name=None, win=None): self.win = win |
from jigs import RectGadget, Motor | from jigs import RectGadget | def getSelectedJigs(self): '''Find all selected jigs in current part. Currently only 'RectGadget' and 'Motor' are supported. [Huaicai 9/15/05]''' selJigs = [] from jigs import RectGadget, Motor def addSelectedJig(obj, jigs=selJigs): if isinstance(obj, RectGadget): #or isinstance(obj, Motor): ##***I'll comment out th... |
msg = greenmsg(cmd) + str(num_picked) + " atom(s) selected." | def selectExpand(self): """Select any atom that is bonded to any currently selected atom. """ # Eric really needed this. Added by Mark 050923. cmd = "Expand Selection: " if not self.selatoms: env.history.message(greenmsg(cmd) + redmsg("No atoms selected.")) return num_picked = 0 # Number of atoms picked in the expa... | |
env.history.message(fix_plurals(msg)) | msg = greenmsg(cmd) + fix_plurals(str(num_picked) + " atom(s) selected.") env.history.message(msg) | def selectExpand(self): """Select any atom that is bonded to any currently selected atom. """ # Eric really needed this. Added by Mark 050923. cmd = "Expand Selection: " if not self.selatoms: env.history.message(greenmsg(cmd) + redmsg("No atoms selected.")) return num_picked = 0 # Number of atoms picked in the expa... |
msg = greenmsg(cmd) + str(len(contract_list)) + " atom(s) unselected." | def selectContract(self): """Unselect any atom which has a bond to an unselected atom. """ # Added by Mark 050923. cmd = "Contract Selection: " if not self.selatoms: env.history.message(greenmsg(cmd) + redmsg("No atoms selected.")) return contract_list = [] # Contains list of atoms to be unselected. assert self.sel... | |
env.history.message(fix_plurals(msg)) | msg = greenmsg(cmd) + fix_plurals(str(len(contract_list)) + " atom(s) unselected.") env.history.message(msg) | def selectContract(self): """Unselect any atom which has a bond to an unselected atom. """ # Added by Mark 050923. cmd = "Contract Selection: " if not self.selatoms: env.history.message(greenmsg(cmd) + redmsg("No atoms selected.")) return contract_list = [] # Contains list of atoms to be unselected. assert self.sel... |
def connect_controls(self): "connect the dashboard controls to their slots in this method" self.w.connect(self.w.extrudeSpinBox_n,SIGNAL("valueChanged(int)"),self.spinbox_value_changed) self.w.connect(self.w.extrudeSpinBox_x,SIGNAL("valueChanged(int)"),self.spinbox_value_changed) self.w.connect(self.w.extrud... | def connect_or_disconnect_signals(self, connect): "connect or disconnect the dashboard controls to their slots in this method" if connect: change_connect = self.w.connect else: change_connect = self.w.disconnect change_connect(self.w.extrudeSpinBox_n,SIGNAL("valueChanged(int)"),self.spinbox_value_changed) change... | def set_controls_minimal(win): #e would be better to try harder to preserve xyz ratio ll = 0.1 # kluge, but prevents ZeroDivisionError x = y = 0.0 z = ll self = win call_while_suppressing_valuechanged( lambda: set_extrude_controls_xyz_nolength( win, (x, y, z) ) ) call_while_suppressing_valuechanged( lambda: self.extrud... |
self.w.connect(toggle, SIGNAL("stateChanged(int)"), self.toggle_value_changed) | change_connect(toggle, SIGNAL("stateChanged(int)"), self.toggle_value_changed) | def connect_controls(self): ###@@@ josh has some disconnect code in cookieMode, now; should be imitated here "connect the dashboard controls to their slots in this method" #k i call this from Enter; depositMode calls the equivalent from init_gui -- which is better? ###e we'll need to disconnect these when we're done, ... |
self.w.connect(slider, SIGNAL("valueChanged(int)"), self.slider_value_changed) | change_connect(slider, SIGNAL("valueChanged(int)"), self.slider_value_changed) | def connect_controls(self): ###@@@ josh has some disconnect code in cookieMode, now; should be imitated here "connect the dashboard controls to their slots in this method" #k i call this from Enter; depositMode calls the equivalent from init_gui -- which is better? ###e we'll need to disconnect these when we're done, ... |
self.w.connect(self.w.extrudeSpinBox_circle_n,SIGNAL("valueChanged(int)"),self.circle_n_value_changed) self.w.connect(self.w.extrude_productTypeComboBox,SIGNAL("activated(int)"), self.ptype_value_changed) | change_connect(self.w.extrudeSpinBox_circle_n,SIGNAL("valueChanged(int)"),self.circle_n_value_changed) change_connect(self.w.extrude_productTypeComboBox,SIGNAL("activated(int)"), self.ptype_value_changed) | def connect_controls(self): ###@@@ josh has some disconnect code in cookieMode, now; should be imitated here "connect the dashboard controls to their slots in this method" #k i call this from Enter; depositMode calls the equivalent from init_gui -- which is better? ###e we'll need to disconnect these when we're done, ... |
self.connect_controls() | self.connect_or_disconnect_signals(True) | def Enter(self): self.status_msg("preparing to enter %s..." % self.msg_modename) # this msg won't last long enough to be seen, if all goes well self.clear() ##e see comment there self.initial_down = self.o.down self.initial_out = self.o.out reinit_extrude_controls(self.w, self.o, length = 7.0, attr_target = self) basic... |
elif isinstance( mode, selectAtomsMode): | elif isinstance( mode, selectAtomsMode) and mode.modename == selectAtomsMode.modename: | def update_select_mode(self): #bruce 050124; should generalize and refile; should be used for more or for all events ###@@@ """This should be called at the end of event handlers which might have changed the current internal selection mode (atoms vs chunks), to resolve disagreements between that and the visible selectio... |
print "bug, fyi: there are both atoms and chunks selected. Deselecting some of them to fit current mode or internal code." | if platform.atom_debug: print "atom_debug: bug, fyi: there are both atoms and chunks selected. Deselecting some of them to fit current mode or internal code." | def update_select_mode(self): #bruce 050124; should generalize and refile; should be used for more or for all events ###@@@ """This should be called at the end of event handlers which might have changed the current internal selection mode (atoms vs chunks), to resolve disagreements between that and the visible selectio... |
def sim_frame_callback(self): | def sim_frame_callback(self, last_frame): | 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... |
if self.__frame_number == self.totalFramesRequested or debug_all_frames: | if last_frame or debug_all_frames: | 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... |
mol.shakedown() | def attach(self, el, singlet): if not el.numbonds: return (None, "%s makes no bonds; can't attach one to an open bond" % el.name) spot = self.findSpot(el, singlet) pl = [] rl = [] # real neighbors of singlets in pl [for bug 232 fix] mol = singlet.molecule cr = el.rcovalent | |
opos = pos + el.rcovalent*norm(pos-opos) x = atom('X', opos, mol) mol.bond(a,x) return a | if el.numbonds > 3: opos = pos + el.rcovalent*norm(pos-opos) x = atom('X', opos, mol) mol.bond(a,x) return a | def bond3(self, el, lis): s1, p1 = lis[0] s2, p2 = lis[1] s3, p3 = lis[2] pos = (p1+p2+p3)/3.0 opos = (s1.posn() + s2.posn() + s3.posn())/3.0 |
self.addColumn("Name", width=150) | self.addColumn("Name", 150) | def __init__(self, parent=None, name=None): QListView.__init__(self, parent, name) global folderClosedIcon, folderLockedIcon, folderOpenIcon, fileIcon |
return | self.w.win_update() return | def jigLeftUp(self, j, event): '''Jig <j> was clicked, so select, unselect or delete it based on the current modkey. - If no modkey is pressed, clear the selection and pick jig <j>. - If Shift is pressed, pick <j>, adding it to the current selection. - If Ctrl is pressed, unpick <j>, removing it from the current selec... |
atm.pick() | if atm.molecule.part == jig.part: atm.pick() did_these[atm.key] = atm else: otherpart[atm.key] = atm | def cm_select_jigs_atoms(self): #bruce 050504 nodeset = self.topmost_selected_nodes() for jig in nodeset: assert isinstance( jig, Jig) # caller guarantees they are all jigs for atm in jig.atoms: atm.pick() jig.unpick() # not done by picking atoms self.win.win_update() # note: caller (which puts up context menu) does se... |
drawsphere(color, pos, drawrad, level) | if self.element is not Singlet or not debug_pref("draw bondpoints as stubs", Choice_boolean_False): drawsphere(color, pos, drawrad, level) | def draw(self, glpane, dispdef, col, level): """Draw this atom depending on whether it is picked and its display mode (possibly inherited from dispdef). An atom's display mode overrides the inherited one from the molecule or glpane, but a molecule's color overrides the atom's element-dependent one. No longer treats glp... |
rad = self.element.rvdw * env.prefs[cpkScaleFactor_prefs_key] if disp != diVDW: rad = rad * CPKvdW if disp == diCPK: rad = rad * env.prefs[cpkAtomRadius_prefs_key] | dispdef = default_display_mode # silently work around that bug [bruce 041206] | |
_n_sv = _n_svh = 0 | def scan_val(val, func): """Efficiently scan a general Python value, and call func on all InstanceType objects encountered (or in the future, on objects of certain other types, like registered new-style classes or extension classes). No need to descend inside any values unless they might contain InstanceType objects. N... | |
if 1: global _n_sv _n_sv += 1 | def same_vals(v1, v2): #060303 """Efficiently scan v1 and v2 in parallel to determine whether they're the same, for purposes of undoable state or saved state. The only reason we really need this (as opposed to just using Python '==' or '!=' and our own __eq__ methods) is because Numeric.array.__eq__ is erroneously defi... | |
if env.debug() and not (v1 != v2): print "debug warning: same_vals says False but 'not !=' says True, for",v1,v2 | if debug_same_vals and not (v1 != v2): print "debug_same_vals: same_vals says False but 'not !=' says True, for",v1,v2 | def same_vals(v1, v2): #060303 """Efficiently scan v1 and v2 in parallel to determine whether they're the same, for purposes of undoable state or saved state. The only reason we really need this (as opposed to just using Python '==' or '!=' and our own __eq__ methods) is because Numeric.array.__eq__ is erroneously defi... |
if env.debug() and (v1 != v2): print "debug warning: same_vals says True but '!=' also says True, for",v1,v2 | if debug_same_vals and (v1 != v2): print "debug_same_vals: same_vals says True but '!=' also says True, for",v1,v2 | def same_vals(v1, v2): #060303 """Efficiently scan v1 and v2 in parallel to determine whether they're the same, for purposes of undoable state or saved state. The only reason we really need this (as opposed to just using Python '==' or '!=' and our own __eq__ methods) is because Numeric.array.__eq__ is erroneously defi... |
if 1: global _n_svh _n_svh += 1 | def _same_vals_helper(v1, v2): #060303 """[private recursive helper for same_vals] raise _NotTheSame if v1 is not the same as v2 (i.e. if their type or structure differs, or if any corresponding parts are not the same) """ if 1: global _n_svh _n_svh += 1 typ = type(v1) if typ is not type(v2): raise _NotTheSame same_hel... | |
USE_OVERRIDER = True | USE_OVERRIDER = env.prefs.get("A9 devel/testdraw/use GLPane_Overrider?", True) | def leftDown(mode, event, glpane, super): # called from testmode.leftDown, just after it reloads this module (on empty-space clicks only) ###@@@ move reload condition into another func in this module? make it wait for leftUp and only if it didn't move, in empty space? "[mode is needed to call super.leftDown]" ####@@@@ ... |
if 1 and 'draw_model': | if env.prefs.get("A9 devel/testdraw/super.Draw?", True): | def Draw(mode, glpane, super): # called by testmode.Draw init_glpane_vars(glpane) vv.counter += 1 # glpane.part.draw(glpane) # this doesn't draw the model in any different place as when done below... [061211] glPushMatrix() try: drawtest0(glpane) # this does all our special drawing, and sometimes puts some of it into... |
items = timing_data.items() items.sort() msg = "" for flags, (redraw_counter, timesofar) in items: try: fps = int(1/timesofar) except: fps = -1 if msg: msg += '\n' msg += "%s %4d (%4d fps)" % (flags, redraw_counter, fps) drawfont2(glpane, msg, charwidth = 18) | if env.prefs.get("A9 devel/testdraw/show old timing data?", False): items = timing_data.items() items.sort() msg = "" for flags, (redraw_counter, timesofar) in items: try: fps = int(1/timesofar) except: fps = -1 if msg: msg += '\n' msg += "%s %4d (%4d fps)" % (flags, redraw_counter, fps) drawfont2(glpane, msg, charwi... | def drawtest2(glpane): # last stuff drawn, never put into global displist [for redraw stats] # draw some more useful and pretty text [used to show me redraw stats] #e should be more flexible text, at an abs location on screen; warning: slow if lots of text # get some timing stats timesofar = time.time() - vv.start_tim... |
glTranslate(0,1,0) we = displist_expr we.draw() | if env.prefs.get("A9 devel/testdraw/show old use displist?", False): glTranslate(0,1,0) we = displist_expr we.draw() | def drawtest2(glpane): # last stuff drawn, never put into global displist [for redraw stats] # draw some more useful and pretty text [used to show me redraw stats] #e should be more flexible text, at an abs location on screen; warning: slow if lots of text # get some timing stats timesofar = time.time() - vv.start_tim... |
glTranslatef(-9, 7, 0) dy = - 0.5 drawline(red, V(0,0,0),V(1,0,0),width = 2) glTranslatef( 0, dy, 0) drawline(green, V(0,0,0),V(2,0,0),width = 2) glTranslatef( 0, dy, 0) drawline(yellow,V(0,0,0),V(1,0,0),width = 2) dothis = 0 glTranslatef( 0, dy, 0) if dothis: drawtext("hi! (@[fg])", blue, V(0,0,0), 12, glpan... | if env.prefs.get("A9 devel/testdraw/draw test graphics?", False): glTranslatef(-9, 7, 0) dy = - 0.5 drawline(red, V(0,0,0),V(1,0,0),width = 2) glTranslatef( 0, dy, 0) drawline(green, V(0,0,0),V(2,0,0),width = 2) glTranslatef( 0, dy, 0) drawline(yellow,V(0,0,0),V(1,0,0),width = 2) dothis = 0 glTranslatef( 0, d... | def drawtest1(glpane): # main special drawing; if a global flag is set, it's all put into a global displist by caller (tho it doesn't all work there) vv.when_drawtest1_last_ran = env.redraw_counter # so we see when displist gets updated glTranslatef(-9, 7, 0) dy = - 0.5 # draw some lines ## drawline(color, pos1, po... |
glTranslatef( 0, -4, 0 ) if debug_pref("drawtest in old way", Choice_boolean_True, prefs_key = True): | if debug_pref("drawtest in old way", Choice_boolean_False, prefs_key = "A9 devel/testdraw/drawtest in old way?"): | ## def drawtext(text, color, pt, size, glpane) |
glTranslatef( 0, -8, -1 ) | if env.prefs.get("A9 devel/testdraw/draw test graphics?", False): glTranslatef( 0, -8, -1 ) | ## def drawtext(text, color, pt, size, glpane) |
theta = acos(min(1.0,max(-1.0,dot(x, y)))) if dot(y, cross(x, v)) > 0.0: theta = 2.0 * pi - theta w=cos(theta*0.5) | def __init__(self, x, y=None, z=None, w=None): if w is not None: # 4 numbers # [bruce comment 050518: note than ints are not turned to floats, # and no checking (of types or values) or normalization is done, # and that these arg names don't correspond to their meanings, # which are W,x,y,z (as documented) rather tha... | |
if w==1.0: self.vec=V(1, 0, 0, 0) elif vl<0.000001: ax1 = cross(x,V(1,0,0)) ax2 = cross(x,V(0,1,0)) if vlen(ax1)>vlen(ax2): self.vec = norm(V(0, ax1[0],ax1[1],ax1[2])) | if vl<0.000001: if dotxy < 0: ax1 = cross(x,V(1,0,0)) ax2 = cross(x,V(0,1,0)) if vlen(ax1)>vlen(ax2): self.vec = norm(V(0, ax1[0],ax1[1],ax1[2])) else: self.vec = norm(V(0, ax2[0],ax2[1],ax2[2])) | def __init__(self, x, y=None, z=None, w=None): if w is not None: # 4 numbers # [bruce comment 050518: note than ints are not turned to floats, # and no checking (of types or values) or normalization is done, # and that these arg names don't correspond to their meanings, # which are W,x,y,z (as documented) rather tha... |
self.vec = norm(V(0, ax2[0],ax2[1],ax2[2])) | xyz = v/2.0 sintheta2 = vl/2.0 costheta2 = sqrt(1-sintheta2**2) self.vec = V(costheta2, xyz[0], xyz[1], xyz[2]) | def __init__(self, x, y=None, z=None, w=None): if w is not None: # 4 numbers # [bruce comment 050518: note than ints are not turned to floats, # and no checking (of types or values) or normalization is done, # and that these arg names don't correspond to their meanings, # which are W,x,y,z (as documented) rather tha... |
elif self.errcode != _FAILURE_ALREADY_DOCUMENTED: | elif not self.pyrexSimInterrupted and 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... |
if not self.donecount: | if not self.donecount and not owner.pyrexSimInterrupted: | def finish(self): if not self.donecount: self.owner.said_we_are_done = False # not needed unless other code has bugs # Note [bruce 050415]: this happens when user presses Abort, # since we don't abort the sim process gently enough. This should be fixed. #bruce 051230 changed following from redmsg to orangemsg env.histo... |
env.history.message( "Writing file: " + filename ) | 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 ... | |
msg = platform.fix_plurals("%d file(s) written. Done." % nfiles) env.history.message( greenmsg( msg)) | self.alist_and_moviefile.play_frame(self.currentFrame) msg = platform.fix_plurals("%d file(s) written." % nfiles) env.history.message(msg) filenames = "%s.%06d.pov - %06d.pov" % (name, self.currentFrame, self.totalFramesActual+1) msg = "Files are named %s." % filenames env.history.message(msg) | 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 ... |
elem("Cl", "Chlorine", 58.867, 2.03, [0.34, 0.68, 0.0], | elem("Cl", "Chlorine", 58.867, 2.03, [0.25, 0.35, 0.0], | def __repr__(self): return "<Element: " + self.symbol + "(" + self.name + ")>" |
elem("Br", "Bromine", 132.674, 2.0, [0.0, 0.5, 0.0], | elem("Br", "Bromine", 132.674, 2.0, [0.0, 0.4, 0.3], | def __repr__(self): return "<Element: " + self.symbol + "(" + self.name + ")>" |
self.dad.addmember(self) | self.dad.addchild(self) | def __init__(self, assembly, parent, name=None): ###@@@ fix inconsistent arg order self.assy = assembly self.name = name or "" # assumed to be a string by some code self.picked = False # whether it's selected # (for highlighting in all views, and being affected by operations) self.hidden = False # whether to make it te... |
def select_enabled(self): """Whether model tree should permit selection of this node (and all its members). [To be overridden by Nodes it would be unsafe for the user to *ever* select. Warning: internal code should not select them either, but this might not be enforced.] """ return True | def select_enabled(self): #bruce 050131 for Alpha ###@@@ use it """Whether model tree should permit selection of this node (and all its members). [To be overridden by Nodes it would be unsafe for the user to *ever* select. Warning: internal code should not select them either, but this might not be enforced.] """ return... | |
m = self.dad.members if before: i = m.index(self) else: i = m.index(self) + 1 m.insert(i, node) node.dad = self.dad node.maintain_invariants_after_new_dad() node.dad.changed_members() return | def addsibling(self, node, before = False): """Add the given node after (default) or before self, in self's Group. Node should not already be in any Group, since it is not removed from one. (Some existing code violates this; this is probably ok if node's old Group is never again used, but that practice should be deprec... | |
def maintain_invariants_after_new_dad(self): | _old_dad = None def in_clipboard(self): """For a leaf node: Are we definitely inside some clipboard item? For a Group node: Would new members added to us be, or be inside, a clipboard item? (I.e., in both cases, are we the Clipboard or in its tree?) [This only works as long as self.assy.shelf is the Clipboard and work... | def maintain_invariants_after_new_dad(self): #bruce 050131 for Alpha node = self assert node.dad node.assy = node.dad.assy # this will change after Alpha if node.picked: # bruce 050131 for Alpha: # worry about whether node is in a different selection group than before; # don't know if this ever happens, but let's try t... |
if node == self: return if self.is_ascendant(node): return if self.dad: self.dad.delmember(self) node.addmember(self, before) | node.addmember(self, before_or_top = before) | def moveto(self, node, before=False): #e should be renamed for d&d, and cleaned up; has several external calls """Move self to a new location in the model tree, before or after node, or if node is a Group, somewhere inside it (reinterpreting 'before' flag as 'top' flag, to decide where inside it). Special case: if self... |
def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): """Add the given node to the end (aka. bottom) of this Group's members list, | def addchild(self, newchild, _guard_ = 050201, top = False, after = None, before = None): """Add the given node, newchild, to the end (aka. bottom) of this Group's members list, | ## def setopen(self): |
(Behavior with more than one named argument is undefined.) Other details (some of which need revision): The existence of this method (as an attribute) might be used as a check | Ok even if newchild is already a member of self, in same or different location than requested (it will be moved), or a member of some other Group (it will be removed). (Behavior with more than one named argument is undefined.) Note: the existence of this method (as an attribute) might be used as a check | def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): # [renamed from addmember - bruce 050113] """Add the given node to the end (aka. bottom) of this Group's members list, or to the specified place (top aka. beginning, or after some child or index, or before some child or index) if one ... |
[node should not already be in another Group, since it's not removed from one] [special case: legal and no effect if node is None or 0 (or anything false); this turns out to be needed by assy.copy/Group.copy or Jig.copy! [050131 comment]] | Special case: legal and no effect if newchild is None or 0 (or anything false); this turns out to be needed by assy.copy/Group.copy or Jig.copy! [050131 comment] | def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): # [renamed from addmember - bruce 050113] """Add the given node to the end (aka. bottom) of this Group's members list, or to the specified place (top aka. beginning, or after some child or index, or before some child or index) if one ... |
if not node: | if not newchild: | def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): # [renamed from addmember - bruce 050113] """Add the given node to the end (aka. bottom) of this Group's members list, or to the specified place (top aka. beginning, or after some child or index, or before some child or index) if one ... |
self.members.insert(0, node) | self.members.insert(0, newchild) | def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): # [renamed from addmember - bruce 050113] """Add the given node to the end (aka. bottom) of this Group's members list, or to the specified place (top aka. beginning, or after some child or index, or before some child or index) if one ... |
self.members += [node] | self.members += [newchild] | def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): # [renamed from addmember - bruce 050113] """Add the given node to the end (aka. bottom) of this Group's members list, or to the specified place (top aka. beginning, or after some child or index, or before some child or index) if one ... |
self.members.insert(after+1, node) | self.members.insert(after+1, newchild) | def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): # [renamed from addmember - bruce 050113] """Add the given node to the end (aka. bottom) of this Group's members list, or to the specified place (top aka. beginning, or after some child or index, or before some child or index) if one ... |
self.members.insert(before, node) | self.members.insert(before, newchild) | def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): # [renamed from addmember - bruce 050113] """Add the given node to the end (aka. bottom) of this Group's members list, or to the specified place (top aka. beginning, or after some child or index, or before some child or index) if one ... |
self.members += [node] node.dad = self node.maintain_invariants_after_new_dad() node.dad.changed_members() | self.members.append(newchild) newchild.dad = self newchild.changed_dad() newchild.dad.changed_members() | def addchild(self, node, _guard_ = 050201, top = False, after = None, before = None): # [renamed from addmember - bruce 050113] """Add the given node to the end (aka. bottom) of this Group's members list, or to the specified place (top aka. beginning, or after some child or index, or before some child or index) if one ... |
print "atom_debug: fyi: delmember finds obj not in members list" pass | print_compact_stack( "atom_debug: fyi: delmember finds obj not in members list: ") return obj.dad = None | def delmember(self, obj): obj.unpick() #bruce 041029 fix bug 145 # [bruce 050203 review: still needed, to keep killed obj out of selmols, # unless we revise things enough to let us invalidate selmols here, or the like.] ## self.assy.changed() # now done by changed_members below try: self.members.remove(obj) except: # ... |
def select_enabled(self): return False | def select_enabled(self): return False #bruce 050131 for Alpha -- not yet used, maybe not needed | |
def select_enabled(self): return False | def select_enabled(self): return False #bruce 050131 for Alpha -- should never matter | |
def modflag_asserts(self): if platform.atom_debug: if self._change_counter and (not ((not self._modified) == (self._change_counter % 2 == 0))): | def modflag_asserts(self): "check invariants related to self._modified" if 1: hopetrue = ( (not self._modified) == (self._change_counter == self._change_counter_when_reset_changed) ) if not hopetrue: | def modflag_asserts(self): #bruce 060123 ####@@@@ PROBABLY WRONG if you undo back to a prior save-point before the last one if platform.atom_debug: #bruce 060123 guess -- _change_counter being even reports whether assy is saved, could serve to recompute self._modified if self._change_counter and (not ((not self._modifi... |
"atom_debug: bug? ((not self._modified) == (self._change_counter %% 2 == 0)), selfmod %r, selfcc %r: " % \ (self._modified, self._change_counter) | "bug? (%r.modflag_asserts() failed; %r %r %r): " % \ (self, self._modified, self._change_counter, self._change_counter_when_reset_changed) | def modflag_asserts(self): #bruce 060123 ####@@@@ PROBABLY WRONG if you undo back to a prior save-point before the last one if platform.atom_debug: #bruce 060123 guess -- _change_counter being even reports whether assy is saved, could serve to recompute self._modified if self._change_counter and (not ((not self._modifi... |
_change_counter_when_reset_changed = -2 | _change_counter_when_reset_changed = -1 | def end_suspend_noticing_changes(self, oldmod): """Call this sometime after every call of begin_suspend_noticing_changes. These begin/end pairs can be nested, but see the caveat below about the oldmod argument in that case. The argument should be the begin method's return value, unless you know you want the new situati... |
self._change_counter_when_reset_changed = self._change_counter = env.change_counter_checkpoint() | self._change_counter_when_reset_changed = self._change_counter | def reset_changed(self): # bruce 050107 """[private method] #doc this... see self.changed() docstring... """ #bruce 060123 assuming all calls are like File->Save call... # actual calls are from MWsem.__init__, File->Open, # File->Save (actually saved_main_file; does its own update_mainwindow_caption), File->Close if se... |
self.plotCB.insertItem(gname[2:-1]) | self.plot_combox.insertItem(gname[2:-1]) | def setup(self): """Setup the Plot Tool dialog, including populating the combobox with plotting options. """ # To setup the Plot Tool, we need to do the following: # 1. Make sure there is a valid DPB file. This is temporary since the Plot Tool will # soon allow the user to open and plot any trace file. # 2. From th... |
col = self.plotCB.currentItem() + 2 | col = self.plot_combox.currentItem() + 2 | def genPlot(self): """Generates GNUplot plotfile, then calls self.runGNUplot. """ col = self.plotCB.currentItem() + 2 # Column number to plot |
title = str(self.plotCB.currentText()) | title = str(self.plot_combox.currentText()) | def genPlot(self): """Generates GNUplot plotfile, then calls self.runGNUplot. """ col = self.plotCB.currentItem() + 2 # Column number to plot |
f.write("set title \"Trace file: %s\\n Created: %s\"\n"%(self.traceFile,self.date)) | f.write("set title \"%s\\n Trace file: %s\\n Created: %s\"\n"%(title, self.traceFile,self.date)) | def genPlot(self): """Generates GNUplot plotfile, then calls self.runGNUplot. """ col = self.plotCB.currentItem() + 2 # Column number to plot |
f.write("plot '%s' using 1:%d title \"%s\" with lines lt 2,\\\n"%(self.traceFile,col,title)) f.write(" '%s' using 1:%d:(0.5) smooth acsplines title \"%s\" lt 3\n"%(self.traceFile,col,title)) | f.write("plot '%s' using 1:%d title \"Data Points\" with lines lt 2,\\\n"%(self.traceFile,col)) f.write(" '%s' using 1:%d:(0.5) smooth acsplines title \"Average\" lt 3\n"%(self.traceFile,col)) | def genPlot(self): """Generates GNUplot plotfile, then calls self.runGNUplot. """ col = self.plotCB.currentItem() + 2 # Column number to plot |
self.openPlotFile(self.traceFile) | open_file_in_editor(self.traceFile) | def openTraceFile(self): """Opens the current tracefile in an editor. """ self.openPlotFile(self.traceFile) |
self.openPlotFile(self.plotFile) def openPlotFile(self, file): """Opens a file in a standard text editor. """ if not os.path.exists(file): msg = "File does not exist: " + file self.history.message(redmsg(msg)) return editor = self.get_text_editor() if os.path.exists(editor): args = [editor, file] try: kid = os.s... | open_file_in_editor(self.plotFile) | def openGNUplotFile(self): """Opens the current GNUplot file in an editor. """ self.openPlotFile(self.plotFile) |
print " MWsemantics.py: fileInsert(): inserting MMP file: ", fn insertmmp(self.assy, fn) if fn[-3:] == "pdb": print " MWsemantics.py: fileInsert(): inserting PDB file: ", fn readpdb(self.assy, fn) self.assy.modified = 1 | try: insertmmp(self.assy, fn) except: print "MWsemantics.py: fileInsert(): error inserting file" + fn self.msgbarLabel.setText( "Problem inserting MMP file: " + fn ) else: self.assy.modified = 1 self.msgbarLabel.setText( "MMP file inserted: " + fn ) if fn[-3:] in ["pdb","PDB"]: try: readpdb(self.assy, fn) except: prin... | def fileInsert(self): wd = globalParms['WorkingDirectory'] fn = QFileDialog.getOpenFileName(wd, "Molecular machine parts (*.mmp);;Protein Data Bank (*.pdb);;All of the above (*.pdb *.mmp)", self ) if fn: |
if isinstance(jig, RectGadget): return res natoms = len(nodeset[0].atoms) myatoms = fix_plurals( "this jig's %d atom(s)" % natoms ) | if isinstance(jig, RectGadget): want_select_item = False else: natoms = len(nodeset[0].atoms) myatoms = fix_plurals( "this jig's %d atom(s)" % natoms ) | def make_cmenuspec_for_set(self, nodeset): # [see also the term Menu_spec] "#doc... see superclass docstring" |
res.append(('Select ' + myatoms, self.cm_select_jigs_atoms )) | if want_select_item: res.append(('Select ' + myatoms, self.cm_select_jigs_atoms )) | def make_cmenuspec_for_set(self, nodeset): # [see also the term Menu_spec] "#doc... see superclass docstring" |
self.esp_window = esp_window | self.jig = esp_window | def __init__(self, esp_window, glpane): |
self.oldNormColor = self.esp_window.normcolor self.oldFillColor = self.esp_window.fill_color | def setup(self): self.oldNormColor = self.esp_window.normcolor # Border color self.oldFillColor = self.esp_window.fill_color self.name_linedit.setText(self.esp_window.name) self.fill_color = RGBf_to_QColor(self.esp_window.fill_color) self.border_color = RGBf_to_QColor(self.esp_window.normcolor) self.width_spinbox.se... | |
self.name_linedit.setText(self.esp_window.name) | self.original_jig = copy.copy(self.jig) | def setup(self): self.oldNormColor = self.esp_window.normcolor # Border color self.oldFillColor = self.esp_window.fill_color self.name_linedit.setText(self.esp_window.name) self.fill_color = RGBf_to_QColor(self.esp_window.fill_color) self.border_color = RGBf_to_QColor(self.esp_window.normcolor) self.width_spinbox.se... |
self.fill_color = RGBf_to_QColor(self.esp_window.fill_color) self.border_color = RGBf_to_QColor(self.esp_window.normcolor) | self.fill_QColor = RGBf_to_QColor(self.jig.fill_color) self.border_QColor = RGBf_to_QColor(self.jig.normcolor) self.fill_color_pixmap.setPaletteBackgroundColor(self.fill_QColor) self.border_color_pixmap.setPaletteBackgroundColor(self.border_QColor) | def setup(self): self.oldNormColor = self.esp_window.normcolor # Border color self.oldFillColor = self.esp_window.fill_color self.name_linedit.setText(self.esp_window.name) self.fill_color = RGBf_to_QColor(self.esp_window.fill_color) self.border_color = RGBf_to_QColor(self.esp_window.normcolor) self.width_spinbox.se... |
self.width_spinbox.setValue(self.esp_window.width) self.window_offset_spinbox.setValue(self.esp_window.window_offset) self.edge_offset_spinbox.setValue(self.esp_window.edge_offset) self.resolution_spinbox.setValue(self.esp_window.resolution) | self.name_linedit.setText(self.jig.name) self.width_spinbox.setValue(self.jig.width) self.window_offset_spinbox.setValue(self.jig.window_offset) self.edge_offset_spinbox.setValue(self.jig.edge_offset) self.resolution_spinbox.setValue(self.jig.resolution) | def setup(self): self.oldNormColor = self.esp_window.normcolor # Border color self.oldFillColor = self.esp_window.fill_color self.name_linedit.setText(self.esp_window.name) self.fill_color = RGBf_to_QColor(self.esp_window.fill_color) self.border_color = RGBf_to_QColor(self.esp_window.normcolor) self.width_spinbox.se... |
self.fill_color_pixmap.setPaletteBackgroundColor(self.fill_color) self.border_color_pixmap.setPaletteBackgroundColor(self.border_color) self.show_esp_bbox_checkbox.setChecked(self.esp_window.show_esp_bbox) self.opacity_spinbox.setValue(int(self.esp_window.opacity*255)) | self.show_esp_bbox_checkbox.setChecked(self.jig.show_esp_bbox) self.opacity_spinbox.setValue(int(self.jig.opacity*255)) | def setup(self): self.oldNormColor = self.esp_window.normcolor # Border color self.oldFillColor = self.esp_window.fill_color self.name_linedit.setText(self.esp_window.name) self.fill_color = RGBf_to_QColor(self.esp_window.fill_color) self.border_color = RGBf_to_QColor(self.esp_window.normcolor) self.width_spinbox.se... |
color = QColorDialog.getColor(self.fill_color, self, "ColorDialog") | color = QColorDialog.getColor(self.fill_QColor, self, "ColorDialog") | def change_fill_color(self): '''Slot method to change fill color.''' color = QColorDialog.getColor(self.fill_color, self, "ColorDialog") |
self.esp_window.fill_color = QColor_to_RGBf(color) | self.fill_QColor = color self.jig.fill_color = QColor_to_RGBf(color) | def change_fill_color(self): '''Slot method to change fill color.''' color = QColorDialog.getColor(self.fill_color, self, "ColorDialog") |
color = QColorDialog.getColor(self.border_color, self, "ColorDialog") | color = QColorDialog.getColor(self.border_QColor, self, "ColorDialog") | def change_border_color(self): '''Slot method change border color.''' color = QColorDialog.getColor(self.border_color, self, "ColorDialog") |
self.esp_window.color = self.esp_window.normcolor = QColor_to_RGBf(color) | self.border_QColor = color self.jig.color = self.jig.normcolor = QColor_to_RGBf(color) | def change_border_color(self): '''Slot method change border color.''' color = QColorDialog.getColor(self.border_color, self, "ColorDialog") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.