def _finalizeStructure(self): """ Overrides EditCommand._finalizeStructure. @see: EditCommand.preview_or_finalize_structure """ if self.struct is not None: #@TODO 2008-03-19:Should we always do this even when strand sequence #is not changed?? Should it waste time in comparing the current #sequence with a previous one? Assigning sequence while leaving the #command will be slow for large files.Need to be optimized if #problematic. #What if a flag is set in self.propMgr.updateSequence() when it #updates the seq for the second time and we check that here. #Thats not good if the method gets called multiple times for some #reason other than the user entered sequence. So not doing here. #Better fix would be to check if sequence gets changed (textChanged) #in DnaSequence editor class .... Need to be revised EditCommand._finalizeStructure(self) self._updateStrandSequence_if_needed() self.assignStrandSequence()
def _finalizeStructure(self): """ Overrides EditCommand._finalizeStructure. This method also makes sure that the DnaGroup is not empty ..if its empty it deletes it. @see: dna_model.DnaGroup.isEmpty @see: EditCommand.preview_or_finalize_structure """ if self.struct is not None: if self.struct.isEmpty(): #Don't keep empty DnaGroup Fixes bug 2603. self._removeStructure() self.win.win_update() else: EditCommand._finalizeStructure(self) if self.struct is not None: #Make sure that he DnaGroup in the Model Tree is in collapsed state #after finalizing the structure. #DON'T DO self.struct.open = False in the above conditional #because the EditCommand._finalizeStructure may have assigned #'None' for 'self.struct'! self.struct.open = False
def _finalizeStructure(self): """ Overrides EditCommand._finalizeStructure. This method also makes sure that the NanotubeGroup is not empty ..if its empty it deletes it. @see: cnt_model.NanotubeGroup.isEmpty @see: EditCommand.preview_or_finalize_structure """ if self.struct is not None: if self.struct.isEmpty(): #Don't keep empty NanotubeGroup Fixes bug 2603. self._removeStructure() self.win.win_update() else: EditCommand._finalizeStructure(self) if self.struct is not None: #Make sure that he NanotubeGroup in the Model Tree is in collapsed state #after finalizing the structure. #DON'T DO self.struct.open = False in the above conditional #because the EditCommand._finalizeStructure may have assigned #'None' for 'self.struct'! self.struct.open = False
def _finalizeStructure(self): """ Finalize the structure. This is a step just before calling Done method. to exit out of this command. Subclasses may overide this method @see: EditCommand_PM.ok_btn_clicked @see: DnaSegment_EditCommand where this method is overridden. """ #The following can happen in this case: User creates first duplex, #Now clicks inside 3D workspace to define the first point of the #next duplex. Now moves the mouse to draw dna rubberband line. #and then its 'Done' When it does that, it has modified the #'number of base pairs' value in the PM and then it uses that value #to modify self.struct ...which is the first segment user created! #In order to avoid this, either self.struct should be set to None after #its appended to the segment list (in self.createStructure) #Or it should compute the number of base pairs each time instead of #relying on the corresponding value in the PM. The latter is not #advisable if we support modifying the number of base pairs from the #PM (and hitting preview) while in DnaDuplex command. #In the mean time, I think this solution will always work. if len(self.mouseClickPoints) == 1: return else: EditCommand._finalizeStructure(self)
def _finalizeStructure(self): """ Finalize the structure. This is a step just before calling Done method. to exit out of this command. Subclasses may overide this method @see: EditCommand_PM.ok_btn_clicked @see: NanotubeSegment_EditCommand where this method is overridden. """ #The following can happen in this case: User creates first nanotube, #Now clicks inside 3D workspace to define the first point of the #next nanotube. Now moves the mouse to draw cnt rubberband line. #and then its 'Done' When it does that, it has modified the #'number of base pairs' value in the PM and then it uses that value #to modify self.struct ...which is the first segment user created! #In order to avoid this, either self.struct should be set to None after #its appended to the segment list (in self.createStructure) #Or it should compute the number of base pairs each time instead of #relying on the corresponding value in the PM. The latter is not #advisable if we support modifying the number of base pairs from the #PM (and hitting preview) while in InsertNanotube command. #In the mean time, I think this solution will always work. if len(self.mouseClickPoints) == 1: return else: EditCommand._finalizeStructure(self)