コード例 #1
0
 def _createFallbackDnaGroup(self):
     """
     Creates a temporary DnaGroup object in which all the DnaSegments 
     created while in this command will be added as members. 
     While exiting this command, these segments will be added first taken 
     away from the temporary group and then added to the DnaGroup of
     BuildDna_EditCommand 
     @see: self.command_will_exit()
     @see: BuildDna_EditCommand.callback_addSegments()
     """
     if self._fallbackDnaGroup is None:
         self.win.assy.part.ensure_toplevel_group()
         self._fallbackDnaGroup = DnaGroup("Fallback Dna", self.win.assy,
                                           self.win.assy.part.topnode)
コード例 #2
0
    def _createStructure(self):
        """
        creates and returns the structure (in this case a L{Group} object that
        contains the DNA strand and axis chunks.
        @return : group containing that contains the DNA strand and axis chunks.
        @rtype: L{Group}
        @note: This needs to return a DNA object once that model is implemented
        """

        # self.name needed for done message
        if self.create_name_from_prefix:
            # create a new name
            name = self.name = gensym(self.prefix,
                                      self.win.assy)  # (in _build_struct)
            self._gensym_data_for_reusing_name = (self.prefix, name)
        else:
            # use externally created name
            self._gensym_data_for_reusing_name = None
            # (can't reuse name in this case -- not sure what prefix it was
            #  made with)
            name = self.name

        # Create the model tree group node.
        # Make sure that the 'topnode'  of this part is a Group (under which the
        # DNa group will be placed), if the topnode is not a group, make it a
        # a 'Group' (applicable to Clipboard parts).See part.py
        # --Part.ensure_toplevel_group method. This is an important line
        # and it fixes bug 2585
        self.win.assy.part.ensure_toplevel_group()

        dnaGroup = DnaGroup(self.name,
                            self.win.assy,
                            self.win.assy.part.topnode,
                            editCommand=self)
        try:

            self.win.assy.place_new_geometry(dnaGroup)

            return dnaGroup

        except (PluginBug, UserError):
            # Why do we need UserError here? Mark 2007-08-28
            dnaGroup.kill()
            raise PluginBug(
                "Internal error while trying to create DNA duplex.")