def writeLabel(self, openetran): grid = self.Label.layout() status = 0 # Status = 1 when no widgets are left to delete while status == 0: status = Add_Delete_Widgets.deleteLabel(self, grid) # Number of Meters in the system num = len(openetran['label']) if num > 1: for k in range(num - 1): Add_Delete_Widgets.addLabel(self, grid) # Different version of the writeWidget function because there are ComboBoxes in the layout countTotal = grid.count() count = 0 # current count of the elements in the layout i = 0 # index of the current list (each key containing a list of lists) rowStart = 2 rowEnd = rowStart + 2 while count < countTotal: # List of positions of each text fields in the layout positions = [(i, j) for i in range(rowStart, rowEnd) for j in range(1, 4, 2)] k = 0 for position in positions: count = (position[0] + 1) * (position[1] + 1) if position[0] == (rowEnd - 1) and position[1] == 3: continue # Slightly different function if it's a combo box to set the text elif position[0] == rowStart and position[1] == 1: v = openetran['label'][i][k] widget = grid.itemAtPosition(position[0], position[1]).widget() if v == 'Phase': widget.setCurrentIndex(0) else: widget.setCurrentIndex(1) k += 1 else: v = openetran['label'][i][k] widget = grid.itemAtPosition(position[0], position[1]).widget() widget.setText(v) k += 1 rowStart = rowEnd + 1 rowEnd = rowStart + 2 i += 1 k = 0
def writeArrbez(self, openetran): grid = self.Arrbez.layout() status = 0 # Status = 1 when no widgets are left to delete while status == 0: status = Add_Delete_Widgets.deleteArrbez(self, grid) # Number of arrbez in the system num = len(openetran['arrbez']) if num > 1: for k in range(num - 1): Add_Delete_Widgets.addArrbez(self, grid) writeWidgets(openetran, grid, 'arrbez', 4, 4, 0)
def writePipegap(self, openetran): grid = self.Pipegap.layout() status = 0 # Status = 1 when no widgets are left to delete while status == 0: status = Add_Delete_Widgets.deletePipegap(self, grid) # Number of Meters in the system num = len(openetran['pipegap']) if num > 1: for k in range(num - 1): Add_Delete_Widgets.addPipegap(self, grid) writeWidgets(openetran, grid, 'pipegap', 2, 4, 0)
def writeCustomer(self, openetran): grid = self.Customer.layout() status = 0 # Status = 1 when no widgets are left to delete while status == 0: status = Add_Delete_Widgets.deleteCustomer(self, grid) # Number of Meters in the system num = len(openetran['customer']) if num > 1: for k in range(num - 1): Add_Delete_Widgets.addCustomer(self, grid) writeWidgets(openetran, grid, 'customer', 6, 6, 1)
def writeLPM(self, openetran): grid = self.LPM.layout() status = 0 # Status = 1 when no widgets are left to delete while status == 0: status = Add_Delete_Widgets.deleteLPM(self, grid) # Number of LPMs in the system num = len(openetran['lpm']) if num > 1: for k in range(num - 1): Add_Delete_Widgets.addLPM(self, grid) writeWidgets(openetran, grid, 'lpm', 3, 4, 1)
def writeInsulator(self, openetran): grid = self.Insulator.layout() status = 0 # Status = 1 when no widgets are left to delete while status == 0: status = Add_Delete_Widgets.deleteInsulator(self, grid) # Number of insulators in the system num = len(openetran['insulator']) if num > 1: for k in range(num - 1): Add_Delete_Widgets.addInsulator(self, grid) writeWidgets(openetran, grid, 'insulator', 3, 4, 0)
def writeGround(self, openetran): grid = self.Ground.layout() status = 0 # Status = 1 when no widgets are left to delete while status == 0: status = Add_Delete_Widgets.deleteGround(self, grid) # Number of grounds in the system num = len(openetran['ground']) if num > 1: for k in range(num - 1): Add_Delete_Widgets.addGround(self, grid) writeWidgets(openetran, grid, 'ground', 4, 6, 0)
def newPipegap(): Add_Delete_Widgets.addPipegap(self, self.Pipegap.layout())
def newCustomer(): Add_Delete_Widgets.addCustomer(self, self.Customer.layout())
def newInductor(): Add_Delete_Widgets.addInductor(self, self.Inductor.layout())
def newCapacitor(): Add_Delete_Widgets.addCapacitor(self, self.Capacitor.layout())
def newResistor(): Add_Delete_Widgets.addResistor(self, self.Resistor.layout())
def newLabel(): Add_Delete_Widgets.addLabel(self, self.Label.layout())
def newGround(): Add_Delete_Widgets.addGround(self, self.Ground.layout())
def newConductor(): Add_Delete_Widgets.addConductor(self, self.Conductor.layout())
def newMeter(): Add_Delete_Widgets.addMeter(self, self.Meter.layout())
def deleteMeter(): Add_Delete_Widgets.deleteMeter(self, self.Meter.layout())
def deleteGround(): Add_Delete_Widgets.deleteGround(self, self.Ground.layout())
def deleteLabel(): Add_Delete_Widgets.deleteLabel(self, self.Label.layout())
def newArrester(): Add_Delete_Widgets.addArrester(self, self.Arrester.layout())
def deleteResistor(): Add_Delete_Widgets.deleteResistor(self, self.Resistor.layout())
def deleteArrester(): Add_Delete_Widgets.deleteArrester(self, self.Arrester.layout())
def deleteCapacitor(): Add_Delete_Widgets.deleteCapacitor(self, self.Capacitor.layout())
def newArrbez(): Add_Delete_Widgets.addArrbez(self, self.Arrbez.layout())
def deleteInductor(): Add_Delete_Widgets.deleteInductor(self, self.Inductor.layout())
def deleteArrbez(): Add_Delete_Widgets.deleteArrbez(self, self.Arrbez.layout())
def deleteCustomer(): Add_Delete_Widgets.deleteCustomer(self, self.Customer.layout())
def newLPM(): Add_Delete_Widgets.addLPM(self, self.LPM.layout())
def deletePipegap(): Add_Delete_Widgets.deletePipegap(self, self.Pipegap.layout())
def deleteLPM(): Add_Delete_Widgets.deleteLPM(self, self.LPM.layout())