コード例 #1
0
    def addSelection(self,docname,objname,subname,pnt):
        i = self.i_active_ref
        if i < 0:
            #not selecting any reference
            return
        if i > 0 and self.auto_next:
            prevref = LinkFromStr( self.refLines[i-1].text(), self.obj.Document )
            if prevref[0].Name == objname and subname == '':
                # whole object was selected by double-clicking
                # its subelement was already written to line[i-1], so we decrease i to overwrite the lineRefChanged
                i -= 1
        if i > len(self.refLines)-1:
            # all 4 references have been selected, finish
            assert(self.auto_next)
            self.i_active_ref = -1
            self.updateRefButtons()
            return
        if i > -1:
            # assign the selected reference
            if objname == self.obj.Name:
                self.form.message.setText(_translate('AttachmentEditor',"Ignored. Can't attach object to itself!",None))
                return
            if App.getDocument(docname).getObject(objname) in getAllDependent(self.obj):
                self.form.message.setText(_translate('AttachmentEditor',"{obj1} depends on object being attached, can't use it for attachment",None).format(obj1= objname))
                return

            self.refLines[i].setText( StrFromLink(App.getDocument(docname).getObject(objname), subname) )
            self.lineRefChanged(i,'')
            if self.auto_next:
                i += 1
        self.i_active_ref = i
        self.updateRefButtons()
コード例 #2
0
    def addSelection(self,docname,objname,subname,pnt):
        i = self.i_active_ref
        if i < 0:
            #not selecting any reference
            return
        if i > 0 and self.auto_next:
            prevref = LinkFromStr( self.refLines[i-1].text(), self.obj.Document )
            if prevref[0].Name == objname and subname == '':
                # whole object was selected by double-clicking
                # its subelement was already written to line[i-1], so we decrease i to overwrite the lineRefChanged
                i -= 1
        if i > len(self.refLines)-1:
            # all 4 references have been selected, finish
            assert(self.auto_next)
            self.i_active_ref = -1
            self.updateRefButtons()
            return
        if i > -1:
            # assign the selected reference
            if objname == self.obj.Name:
                self.form.message.setText(_translate('AttachmentEditor',"Ignored. Can't attach object to itself!",None))
                return
            if App.getDocument(docname).getObject(objname) in getAllDependent(self.obj):
                self.form.message.setText(_translate('AttachmentEditor',"{obj1} depends on object being attached, can't use it for attachment",None).format(obj1= objname))
                return

            self.refLines[i].setText( StrFromLink(App.getDocument(docname).getObject(objname), subname) )
            self.lineRefChanged(i,'')
            if self.auto_next:
                i += 1
        self.i_active_ref = i
        self.updateRefButtons()
コード例 #3
0
ファイル: TempoVis.py プロジェクト: secondmover/FreeCAD-1
 def show_all_dependent(self, doc_obj):
     '''show_all_dependent(doc_obj): shows all objects that depend on doc_obj. This method is probably useless.'''
     self.show(getAllDependent(doc_obj))
コード例 #4
0
ファイル: TempoVis.py プロジェクト: secondmover/FreeCAD-1
 def hide_all_dependent(self, doc_obj):
     '''hide_all_dependent(doc_obj): hides all objects that depend on doc_obj. Groups, Parts and Bodies are not hidden by this.'''
     self.hide([o for o in getAllDependent(doc_obj) if not isContainer(o)])
コード例 #5
0
ファイル: TempoVis.py プロジェクト: itain/FreeCAD
 def show_all_dependent(self, doc_obj):
     '''show_all_dependent(doc_obj): shows all objects that depend on doc_obj. This method is probably useless.'''
     self.show( getAllDependent(doc_obj) )
コード例 #6
0
ファイル: TempoVis.py プロジェクト: itain/FreeCAD
 def get_all_dependent(self, doc_obj):
     '''get_all_dependent(doc_obj): gets all objects that depend on doc_obj. Groups, Parts and Bodies are not hidden by this.'''
     return [o for o in getAllDependent(doc_obj) if not isContainer(o)]
コード例 #7
0
 def hide_all_dependent(self, doc_obj):
     '''hide_all_dependent(doc_obj): hides all objects that depend on doc_obj. Groups, Parts and Bodies are not hidden by this.'''
     self.hide( [o for o in getAllDependent(doc_obj) if not isContainer(o)])
コード例 #8
0
 def get_all_dependent(self, doc_obj):
     '''get_all_dependent(doc_obj): gets all objects that depend on doc_obj. Groups, Parts and Bodies are not hidden by this.'''
     return [o for o in getAllDependent(doc_obj) if not isContainer(o)]