def externalShape(self): shape, approx = API.shape(self.EC[self.LCI]) if shape == "rectangle": # print("externalShape == rectangle") self.E.addBTN(5) self.E.addCB(5) self.E.addDD(5) self.E.addHPL(5) self.E.addIMG(5) self.E.addLBL(5) self.E.addPRGF(5) self.E.addPW(5) self.E.addRB(5) self.E.addTXT(5) return self.E elif shape == "square": # print("externalShape == square") self.E.addCB(5) self.E.addIMG(5) self.E.addRB(5) return self.E else: return self.E
def errorSolvedCnt3(self): # error identification solve if len(self.re_schedule_supper_child_index) == 1: s, a = API.shape(self.TC[self.re_schedule_supper_child_index[0]]) if s == "other": self.E.addIMG(80) else: self.E.addIMG(60)
def errorSolvedCnt1(self): # error identification solve if len(self.re_schedule_supper_child_index) == 1: s, a = API.shape(self.TC[self.re_schedule_supper_child_index[0]]) if s == "rectangle" or s == "rectangle": self.E.addBTN(100) else: self.E.addRB(80)
def dropdownSpecial(self, right_cnt_index): grand_child_count, grand_child_index = API.countInnerCtn(self.TC, self.TH, self.child_ctn_idxs[right_cnt_index]) if len(grand_child_index) == 1: GCS, GCA = API.shape(self.TC[grand_child_index[0]]) if GCS == "triangle": self.E.addDD(75) else: return self.E
def innerCnt4Shape(self): for cntIdx in self.child_ctn_idxs: child_shape, points = API.shape(self.TC[cntIdx]) if child_shape == "triangle": self.E.addCB(2.5) elif child_shape == "rectangle" or child_shape == "square": self.E.addPW(2.5) else: self.E.addIMG(2.5) return self.E
def checkBoxSpecial(self): x, y = API.centerOfContour(self.TC[self.PCI]) for cntIdx in self.child_ctn_idxs: shape, edges = API.shape(self.TC[cntIdx]) for point in edges: distance = API.pointsDistance([x, y], point[0]) if distance < 20: self.E.addCB(20) else: continue return self.E
def imageSpecial(self): for cntIdx in self.child_ctn_idxs: super_child_count, super_child_idxs = API.countInnerCtn(self.TC, self.TH, cntIdx) if super_child_count == 1: child_shape, points = API.shape(self.TC[super_child_idxs[0]]) if child_shape == "other": self.E.addIMG(70) else: continue else: continue return self.E
def innerCnt1Shape(self): for cntIdx in self.child_ctn_idxs: child_shape, points = API.shape(self.TC[cntIdx]) if child_shape == "rectangle": # print("innerCnt1Shape == rectangle") self.E.addBTN(10) self.E.addRB(10) self.E.addTXT(10) elif child_shape == "square": # print("innerCnt1Shape == square") self.E.addRB(10) return self.E
def supperInnerCnt1Shape(self): for cntIdx in self.child_ctn_idxs: super_inner_count, super_inner_ctn_idxs = API.countInnerCtn(self.TC, self.TH, cntIdx) if super_inner_count == 1: child_shape, points = API.shape(self.TC[super_inner_ctn_idxs[0]]) if child_shape == "rectangle" or child_shape == "square": self.E.addBTN(80) return self.E else: self.E.addRB(80) return self.E elif super_inner_count == 0: self.E.addTXT(80) return self.E else: return self.E
def innerCnt2Shape(self): for cntIdx in self.child_ctn_idxs: child_shape, points = API.shape(self.TC[cntIdx]) if child_shape == "triangle": # print("innerCnt2Shape == triangle") self.E.addPRGF(2.5) elif child_shape == "rectangle": # print("innerCnt2Shape == rectangle") self.E.addDD(2.5) self.E.addHPL(2.5) self.E.addLBL(2.5) self.E.addPRGF(2.5) elif child_shape == "square": # print("innerCnt2Shape == square") self.E.addDD(2.5) self.E.addLBL(2.5) else: # print("innerCnt2Shape == else") self.E.addHPL(2.5) self.E.addIMG(2.5) self.E.addPRGF(2.5) return self.E