def setAtoms(self, atomlist): #bruce 080208 split this out of __init__ so copy is simpler Jig.setAtoms(self, atomlist) if len(atomlist) == _NUMBER_OF_MARKER_ATOMS: marked_atom, next_atom = atomlist self.marked_atom = marked_atom self.next_atom = next_atom assert not self._length_1_chain elif len(atomlist) == 1 and self._length_1_chain: #bruce 080216, for 1-atom wholechains # (the flag test is to make sure it's only used then) self.marked_atom = self.next_atom = atomlist[0] else: # We are probably being called by _copy_fixup_at_end # with fewer or no atoms, or by __init__ in first stage of copy # (Jig.copy_full_in_mapping) with no atoms. # todo: would be better to make those callers tell us for sure. # for now: print bug warning if fewer atoms but not none # (i don't know if that can happen), and assert not too many atoms. assert len(atomlist) <= _NUMBER_OF_MARKER_ATOMS if atomlist: print "bug? %r.setAtoms(%r), len != _NUMBER_OF_MARKER_ATOMS or 0" % \ (self, atomlist) self.marked_atom = self.next_atom = None #bruce 080216 self._check_atom_order() #bruce 080216 do in all cases, was just main one return
def setAtoms( self, atomlist ): #bruce 080208 split this out of __init__ so copy is simpler Jig.setAtoms(self, atomlist) if len(atomlist) == _NUMBER_OF_MARKER_ATOMS: marked_atom, next_atom = atomlist self.marked_atom = marked_atom self.next_atom = next_atom assert not self._length_1_chain elif len(atomlist) == 1 and self._length_1_chain: #bruce 080216, for 1-atom wholechains # (the flag test is to make sure it's only used then) self.marked_atom = self.next_atom = atomlist[0] else: # We are probably being called by _copy_fixup_at_end # with fewer or no atoms, or by __init__ in first stage of copy # (Jig.copy_full_in_mapping) with no atoms. # todo: would be better to make those callers tell us for sure. # for now: print bug warning if fewer atoms but not none # (i don't know if that can happen), and assert not too many atoms. assert len(atomlist) <= _NUMBER_OF_MARKER_ATOMS if atomlist: print "bug? %r.setAtoms(%r), len != _NUMBER_OF_MARKER_ATOMS or 0" % \ (self, atomlist) self.marked_atom = self.next_atom = None #bruce 080216 self._check_atom_order( ) #bruce 080216 do in all cases, was just main one return
def readmmp_info_leaf_setitem(self, key, val, interp): import string, Numeric if key == ['handle']: self.handle_offset = Numeric.array(map( string.atof, val.split())) - self.center() else: Jig.readmmp_info_leaf_setitem(self, key, val, interp)
def __init__(self, assy, atomlist): Jig.__init__(self, assy, atomlist) self.font_name = "Helvetica" self.font_size = 10.0 # pt size self.color = black # This is the "draw" color. When selected, this will become highlighted red. self.normcolor = black # This is the normal (unselected) color. self.cancelled = True # We will assume the user will cancel self.handle_offset = V(0.0, 0.0, 0.0)
def edit(self): # in class ESPImage """ Force into 'Build' mode before opening the dialog """ #bruce 060403 changes: force Build, not Select Atoms as before; only do this if current mode is not Build. # (But why do we need to force it into any particular mode? I don't know. [bruce 070608]) commandSequencer = self.assy.w.commandSequencer #bruce 071008 if commandSequencer.currentCommand.commandName != 'DEPOSIT': commandSequencer.userEnterCommand('DEPOSIT') Jig.edit(self)
def __init__(self, assy, list, READ_FROM_MMP): Jig.__init__(self, assy, list) self.width = 20 self.height = 20 self.assy = assy self.cancelled = True # We will assume the user will cancel self.atomPos = [] if not READ_FROM_MMP: self.__init_quat_center(list)
def __init__(self, assy, atomlist = []): #bruce 050526 added optional atomlist arg assert atomlist == [] # whether from default arg value or from caller -- for now Jig.__init__(self, assy, atomlist) self.quat = Q(1, 0, 0, 0) # is self.quat ever set to other values? if not, remove it; if so, add it to mutable_attrs. [bruce 060228 comment] #The motor is usually drawn as an opaque object. However when it is #being previewed, it is drawn as a transparent object - Ninad 2007-10-09 self.previewOpacity = 0.4 self.defaultOpacity = 1.0 self.opacity = self.defaultOpacity
def __init__(self, win): self.win = win #Node.__init__(self, win.assy, gensym("%s" % self.sym, win.assy)) Jig.__init__(self, win.assy, self.atoms) # note: that sets self.glname self.glpane = self.assy.o #@@Geometry object with a visible direction arrow #(at present used in Plane only) This saves the last geometry object #for which the Direction arrow was drawn #(that decides the direction of a plane offset to the object) #The program needs to skip the arrow drawing (which is done inside the # objects _draw_geometry method) when prop manager is closed or when the #Offset option is no more requested. -- ninad 20070612 self.offsetParentGeometry = None
def __init__(self, assy, list): Jig.__init__(self, assy, list) self.cancelled = False # set default color of new gamess jig to magenta self.color = magenta # This is the "draw" color. When selected, this will become highlighted red. self.normcolor = magenta # This is the normal (unselected) color. #bruce 050913 thinks self.history is no longer needed: ## self.history = env.history #self.psets = [] # list of parms set objects [as of circa 050704, only the first of these is ever defined (thinks bruce)] self.pset = gamessParms('Parameter Set 1') self.gmsjob = GamessJob(Gamess.job_parms, jig=self) ## bruce 050701 removing this: self.gmsjob.edit() self.outputfile = '' # Name of jig's most recent output file. [this attr is intentionally not copied -- bruce 050704]
def is_disabled(self): """ Which is called when model tree is updated? """ val = Jig.is_disabled(self) self.gmsjob.edit_cntl.run_job_btn.setEnabled(not val) return val
def __init__(self, assy, atomlist): """ """ if len(atomlist) == 2 and atomlist[0] is atomlist[1]: # let caller pass two atoms the same, but reduce it to one copy # (compensating in setAtoms) # (this is to make length-1 wholechains easier) [bruce 080216] atomlist = atomlist[:1] self._length_1_chain = True elif len(atomlist) == 1: # [bruce 080227 to support mmp read of 1-atom case] # TODO: print warning unless this is called from mmp read # (which is the only time it's not an error, AFAIK) # and mark self invalid unless we verify that marked_atom # is indeed on a length-1 chain (this might need to be # done later by dna updater). self._length_1_chain = True Jig.__init__(self, assy, atomlist) # calls self.setAtoms return
def make_selobj_cmenu_items(self, menu_spec): """ Add Motor-specific context menu items to <menu_spec> list when self is the selobj. """ Jig.make_selobj_cmenu_items(self, menu_spec) #bruce 060313 share this code (it is identical to the following commented out code) ## item = ('Hide', self.Hide) ## menu_spec.append(item) ## if self.disabled_by_user_choice: ## item = ('Disabled', self.toggleJigDisabled, 'checked') ## else: ## item = ('Disable', self.toggleJigDisabled, 'unchecked') ## menu_spec.append(item) ## menu_spec.append(None) # Separator ## item = ('Properties...', self.edit) ## menu_spec.append(item) item = ('Align to Chunk', self.__CM_Align_to_chunk) menu_spec.append(item) item = ('Recenter on Atoms', self.__CM_Recenter_on_atoms) menu_spec.append(item) item = ('Reverse Direction', self.__CM_Reverse_direction) menu_spec.append(item)
def writemmp(self, mapping): """ [extends superclass method] """ # check a few things, then call superclass method try: assert not self.is_homeless() # redundant as of 080111, that's ok assert len(self.atoms) in (1, _NUMBER_OF_MARKER_ATOMS) self._check_atom_order() except: #bruce 080317, for debugging the save file traceback in # "assert not self.is_homeless()" (above) in bug 2673, # happens when saving after region select + delete of any # duplex; fixed now msg = "\n*** BUG: exception in checks before DnaMarker.writemmp; " \ "continuing, but beware of errors when reopening the file" print_compact_traceback( msg + ": ") pass return Jig.writemmp(self, mapping)
def writemmp(self, mapping): """ [extends superclass method] """ # check a few things, then call superclass method try: assert not self.is_homeless() # redundant as of 080111, that's ok assert len(self.atoms) in (1, _NUMBER_OF_MARKER_ATOMS) self._check_atom_order() except: #bruce 080317, for debugging the save file traceback in # "assert not self.is_homeless()" (above) in bug 2673, # happens when saving after region select + delete of any # duplex; fixed now msg = "\n*** BUG: exception in checks before DnaMarker.writemmp; " \ "continuing, but beware of errors when reopening the file" print_compact_traceback(msg + ": ") pass return Jig.writemmp(self, mapping)
def __CM_Calculate_Energy__options(self): if Jig.is_disabled(self): return ['disabled'] else: return [] pass
def __CM_Optimize_Geometry__options(self): if Jig.is_disabled(self): return ['disabled'] else: return []
def readmmp_info_leaf_setitem(self, key, val, interp): import string, numpy.oldnumeric if key == ['handle']: self.handle_offset = Numeric.array(map(string.atof, val.split())) - self.center() else: Jig.readmmp_info_leaf_setitem(self, key, val, interp)
def remove_atom(self, *args, **opts): self._initial_posns = None #bruce 050518; needed in RotaryMotor, harmless in others return Jig.remove_atom(self, *args, **opts)