当前位置: 首页>>代码示例>>Python>>正文


Python EditCommand.EditCommand类代码示例

本文整理汇总了Python中command_support.EditCommand.EditCommand的典型用法代码示例。如果您正苦于以下问题:Python EditCommand类的具体用法?Python EditCommand怎么用?Python EditCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EditCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: runCommand

    def runCommand(self):
        """
        Overrides superclass method. 
        Run this edit command. This method is called when user invokes 
        Insert > Plane command (to create a new plane object) . In addition 
        to creating the Plane object and Property manager, this also updates
        the property manager values with the ones for the new Plane object. 
        
        @see: MWSemantics.createPlane() which calls this while inserting a 
        new Plane
        @see: self.editStructure()
        @see: PlanePropertyManager.setParameters()
        @see: self._updatePropMgrParams()
        @TODO: The code that updates the PropMgr params etc needs to be in the 
        EditCommand API method/
        
        """
        EditCommand.runCommand(self)
        if self.hasValidStructure():             
            self._updatePropMgrParams()

            #Store the previous parameters. Important to set it after you 
            #set attrs in the propMgr. 
            #self.previousParams is used in self._previewStructure and 
            #self._finalizeStructure to check if self.struct changed.
            self.previousParams = self._gatherParameters()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:26,代码来源:Plane_EditCommand.py

示例2: restore_gui

 def restore_gui(self):
     """
     Restore the GUI 
     """
     EditCommand.restore_gui(self)
     if self.flyoutToolbar:
         self.flyoutToolbar.displayProteinStyleAction.setChecked(False)    
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:7,代码来源:ProteinDisplayStyle_Command.py

示例3: restore_gui

 def restore_gui(self):
     """
     Restore the GUI 
     """
     EditCommand.restore_gui(self)
     if self.flyoutToolbar:
         self.flyoutToolbar.editResiduesAction.setChecked(False)    
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:7,代码来源:EditResidues_Command.py

示例4: editStructure

    def editStructure(self, struct = None):
        EditCommand.editStructure(self, struct)        
        if self.hasValidStructure():         
            #When the structure (segment) is finalized (after the  modifications)
            #it will be added to the original NanotubeGroup to which it belonged 
            #before we began editing (modifying) it. 
            self._parentNanotubeGroup = self.struct.getNanotubeGroup() 
            #Set the endpoints
            #@ DOES THIS DO ANYTHING? I don't think so. --Mark 2008-04-01
            #@endPoint1, endPoint2 = self.struct.nanotube.getEndPoints()
            #@params_for_propMgr = (endPoint1, endPoint2)

            #TODO 2008-03-25: better to get all parameters from self.struct and
            #set it in propMgr?  This will mostly work except that reverse is 
            #not true. i.e. we can not specify same set of params for 
            #self.struct.setProps ...because endPoint1 and endPoint2 are derived.
            #by the structure when needed. Commenting out following line of code
            self.propMgr.setParameters(self.struct.getProps())

            #Store the previous parameters. Important to set it after you 
            #set nanotube attrs in the propMgr. 
            #self.previousParams is used in self._previewStructure and 
            #self._finalizeStructure to check if self.struct changed.
            self.previousParams = self._gatherParameters()
            self._updateHandleList()
            self.updateHandlePositions()
        return
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:27,代码来源:NanotubeSegment_EditCommand.py

示例5: __init__

    def __init__(self, commandSequencer, struct = None):
        """
        Constructor for BuildDna_EditCommand
        """

        EditCommand.__init__(self, commandSequencer)
        self.struct = struct
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:7,代码来源:BuildProtein_EditCommand.py

示例6: __init__

    def __init__(self, commandSequencer, struct = None):
        """
        Constructor for DnaDuplex_EditCommand
        """

        EditCommand.__init__(self, commandSequencer)        

        #_fallbackDnaGroup stores the DnaSegments created while in 
        #this command. This temporary dnaGroup is created IF AND ONLY IF 
        #DnaDuplex_EditCommand is unable to access the dnaGroup object of the 
        #parent BuildDna_EditCommand. (so if this group gets created, it should
        #be considered as a bug. While exiting the command the list of segments 
        #of this group is given to the BuildDna_EditCommand where they get 
        #their new parent. @see self.restore_gui
        self._fallbackDnaGroup = None

        #_parentDnaGroup is the dnagroup of BuildDna_EditCommand 
        self._parentDnaGroup = None

        #Maintain a list of segments created while this command was running. 
        #Note that the segments , when created will be added directly to the 
        # self._parentDnaGroup (or self._fallbackDnaGroup if there is a bug) 
        # But self._parentDnaGroup (which must be = the dnaGroup of 
        # BuildDna_EditCommand.) may already contain DnaSegments (added earlier)
        # so, we can not use group.steal_members() in case user cancels the 
        #structure creation (segment addition). 
        self._segmentList = []

        self.struct = struct
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:29,代码来源:DnaDuplex_EditCommand.py

示例7: model_changed

    def model_changed(self):
        #This MAY HAVE BUG. WHEN --
        #debug pref 'call model_changed only when needed' is ON
        #See related bug 2729 for details. 

        #The following code that updates te handle positions and the strand 
        #sequence fixes bugs like 2745 and updating the handle positions
        #updating handle positions in model_changed instead of in 
        #self.graphicsMode._draw_handles() is also a minor optimization
        #This can be further optimized by debug pref 
        #'call model_changed only when needed' but its NOT done because of an 
        # issue menitoned in bug 2729   - Ninad 2008-04-07    

        EditCommand.model_changed(self) #This also calls the 
                                        #propMgr.model_changed 

        if self.grabbedHandle is not None:
            return

        #For Rattlesnake, PAM5 segment resizing  is not supported. 
        #@see: self.hasResizableStructure()        
        if self.hasValidStructure():
            isStructResizable, why_not = self.hasResizableStructure()
            if not isStructResizable:
                self.handles = []
                return
            elif len(self.handles) == 0:
                self._updateHandleList()

            self.updateHandlePositions()
            #NOTE: The following also updates self._previousParams
            self._updateStrandSequence_if_needed()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:32,代码来源:DnaStrand_EditCommand.py

示例8: editStructure

    def editStructure(self, struct = None):
        """
        Overrides EditCommand.editStructure method. Provides a way to edit an
        existing structure. This implements a topLevel command that the client
        can execute to edit an existing object(i.e. self.struct) that it wants.

        Example: If its a plane edit controller, this method will be used to
                edit an object of class Plane.

        This method also creates a propMgr objects if it doesn't exist and
        shows this property manager

        @see: L{self.createStructure} (another top level command that
              facilitates creation of a model object created by this
              editCommand
        @see: L{Plane.edit} and L{Plane_EditCommand._createPropMgrObject}
        """

        if struct is not None:
            #Should we always unpick the structure while editing it?
            #Makes sense for editing a Dna. If this is problematic, the
            #following should be done in the subclasses that need this.
            if hasattr(struct, 'picked') and struct.picked:
                struct.unpick()

        EditCommand.editStructure(self, struct)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:26,代码来源:BuildDna_EditCommand.py

示例9: cancelStructure

 def cancelStructure(self):
     """
     Overrides Editcommand.cancelStructure ..calls _removeSegments which 
     deletes all the segments created while this command was running
     @see: B{EditCommand.cancelStructure}
     """
     EditCommand.cancelStructure(self)
     self._removeSegments()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:8,代码来源:InsertNanotube_EditCommand.py

示例10: cancelStructure

 def cancelStructure(self):
     """
     Cancel the structure
     """
     EditCommand.cancelStructure(self)
     if self.struct is not None:
         if self.struct.isEmpty():
             self._removeStructure()
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:8,代码来源:BuildDna_EditCommand.py

示例11: restore_gui

 def restore_gui(self):
     """
     @see: EditCommand.restore_gui
     """
     EditCommand.restore_gui(self)
     #Following call doesn't update the struct with steps similar to 
     #ones in bug 2699. Instead calling struct.updateCosmeticProps directly
     ##self.propMgr.update_props_if_needed_before_closing()
     if self.hasValidStructure():
         self.struct.updateCosmeticProps() 
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:10,代码来源:Plane_EditCommand.py

示例12: init_gui

    def init_gui(self):
        """
        Do changes to the GUI while entering this command. This includes opening 
        the property manager, updating the command toolbar , connecting widget 
        slots (if any) etc. Note: The slot connection in property manager and 
        command toolbar is handled in those classes. 

        Called once each time the command is entered; should be called only 
        by code in modes.py

        @see: L{self.restore_gui}
        """
        EditCommand.init_gui(self)        


        if isinstance(self.graphicsMode, DnaDuplex_GraphicsMode):
            self._setParamsForDnaLineGraphicsMode()
            self.mouseClickPoints = []

        #Clear the segmentList as it may still be maintaining a list of segments
        #from the previous run of the command. 
        self._segmentList = []

        prevMode = self.commandSequencer.prevMode 
        if prevMode.commandName == 'BUILD_DNA':
            params = prevMode.provideParamsForTemporaryMode(self.commandName)
            self.callback_addSegments, self._parentDnaGroup = params

            #@TODO: self.callback_addSegments is not used as of 2008-02-24 
            #due to change in implementation. Not removing it for now as the 
            #new implementation (which uses the dnaGroup object of 
            #BuildDna_EditCommand is still being tested) -- Ninad 2008-02-24

            #Following won't be necessary after Command Toolbar is 
            #properly integrated into the Command/CommandSequencer API
            try:
                self.flyoutToolbar = prevMode.flyoutToolbar
                #Need a better way to deal with changing state of the 
                #corresponding action in the flyout toolbar. To be revised 
                #during command toolbar cleanup 
                self.flyoutToolbar.dnaDuplexAction.setChecked(True)
            except AttributeError:
                self.flyoutToolbar = None


            if self.flyoutToolbar:
                if not self.flyoutToolbar.dnaDuplexAction.isChecked():
                    self.flyoutToolbar.dnaDuplexAction.setChecked(True)
        else:
            #Should this be an assertion? Should we always kill _parentDnaGroup
            #if its not None? ..not a good idea. Lets just make it to None. 
            self._parentDnaGroup = None             
            self._createFallbackDnaGroup()
            
        self.updateDrawingPlane(plane = None)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:55,代码来源:DnaDuplex_EditCommand.py

示例13: __init__

    def __init__(self, commandSequencer, struct = None):
        """
        Constructor for InsertNanotube_EditCommand
        """

        EditCommand.__init__(self, commandSequencer)        

        #Maintain a list of segments created while this command was running. 
        self._segmentList = []

        self.struct = struct
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:11,代码来源:InsertNanotube_EditCommand.py

示例14: restore_gui

 def restore_gui(self):
     """
     Do changes to the GUI while exiting this command. This includes closing 
     this mode's property manager, updating the command toolbar ,
     Note: The slot connection/disconnection in property manager and 
     command toolbar is handled in those classes.
     @see: L{self.init_gui}
     """
     EditCommand.restore_gui(self)
     if self.flyoutToolbar:
         self.flyoutToolbar.deActivateFlyoutToolbar()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:11,代码来源:BuildNanotube_EditCommand.py

示例15: editStructure

    def editStructure(self, struct = None):
        """
        """
        EditCommand.editStructure(self, struct)        
        if self.hasValidStructure():             
            self._updatePropMgrParams()

            #Store the previous parameters. Important to set it after you 
            #set attrs in the propMgr. 
            #self.previousParams is used in self._previewStructure and 
            #self._finalizeStructure to check if self.struct changed.
            self.previousParams = self._gatherParameters()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:12,代码来源:Plane_EditCommand.py


注:本文中的command_support.EditCommand.EditCommand类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。