def setClause(self):
     title = unicode(self.ui.titleEdit.text())
     parent = unicode(self.ui.parentBox.currentText())
     self.clause = Clause()
     self.clause.setTitle(title)
     self.clause.setType(self.project.getTIM().getType(unicode(self.ui.typeBox.currentText())))
     self.document = self.project.getDocument(unicode(self.ui.documentBox.currentText()))
     self.document.addClause(self.clause)
     if (parent != "Sem Clausula Pai") :
         parentClause = self.clausesList[unicode(self.ui.parentBox.currentText())]
         link = Link()
         link.addChild(self.clause.getID())
         link.addParent(parentClause)
         link.consolidateLink(self.project)
     self.openElementSignal.emit("clause:" + self.clause.getID())
 def addLink(self):
     addLinkDialog = AddLinkDialog(self, self.project, self.clause, self.option)
     if (addLinkDialog.exec_()):
         clause = addLinkDialog.getClause()
         link = Link()
         if (self.option=="uplinks") :
             link.parent = clause
             link.parent_id = clause.getID()
             link.child = self.clause
             link.child_id = self.clause.getID()
             link.addParent(clause.getID(), clause)
             link.addChild(self.clause.getID(), self.clause)
         elif (self.option=="downlinks") :
             link.child = clause
             link.child_id = clause.getID()
             link.parent = self.clause
             link.parent_id = self.clause.getID()
             link.addChild(clause.getID(), clause)
             link.addParent(self.clause.getID(), self.clause)
         model = EditLinksModel(self.clause, self.option)
         self.ui.linksView.setModel(model)