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("Ignored. Can't attach object to itself!") return if App.getDocument(docname).getObject(objname) in getAllDependent(self.obj): self.form.message.setText("{obj1} depends on object being attached, can't use it for attachment".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()
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) )
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)])