Esempio n. 1
0
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
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 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)
Esempio n. 5
0
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)
Esempio n. 6
0
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)
Esempio n. 7
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)
Esempio n. 8
0
 def newPipegap():
     Add_Delete_Widgets.addPipegap(self, self.Pipegap.layout())
Esempio n. 9
0
 def newCustomer():
     Add_Delete_Widgets.addCustomer(self, self.Customer.layout())
Esempio n. 10
0
 def newInductor():
     Add_Delete_Widgets.addInductor(self, self.Inductor.layout())
Esempio n. 11
0
 def newCapacitor():
     Add_Delete_Widgets.addCapacitor(self, self.Capacitor.layout())
Esempio n. 12
0
 def newResistor():
     Add_Delete_Widgets.addResistor(self, self.Resistor.layout())
Esempio n. 13
0
 def newLabel():
     Add_Delete_Widgets.addLabel(self, self.Label.layout())
Esempio n. 14
0
 def newGround():
     Add_Delete_Widgets.addGround(self, self.Ground.layout())
Esempio n. 15
0
 def newConductor():
     Add_Delete_Widgets.addConductor(self, self.Conductor.layout())
Esempio n. 16
0
 def newMeter():
     Add_Delete_Widgets.addMeter(self, self.Meter.layout())
Esempio n. 17
0
 def deleteMeter():
     Add_Delete_Widgets.deleteMeter(self, self.Meter.layout())
Esempio n. 18
0
 def deleteGround():
     Add_Delete_Widgets.deleteGround(self, self.Ground.layout())
Esempio n. 19
0
 def deleteLabel():
     Add_Delete_Widgets.deleteLabel(self, self.Label.layout())
Esempio n. 20
0
 def newArrester():
     Add_Delete_Widgets.addArrester(self, self.Arrester.layout())
Esempio n. 21
0
 def deleteResistor():
     Add_Delete_Widgets.deleteResistor(self, self.Resistor.layout())
Esempio n. 22
0
 def deleteArrester():
     Add_Delete_Widgets.deleteArrester(self, self.Arrester.layout())
Esempio n. 23
0
 def deleteCapacitor():
     Add_Delete_Widgets.deleteCapacitor(self, self.Capacitor.layout())
Esempio n. 24
0
 def newArrbez():
     Add_Delete_Widgets.addArrbez(self, self.Arrbez.layout())
Esempio n. 25
0
 def deleteInductor():
     Add_Delete_Widgets.deleteInductor(self, self.Inductor.layout())
Esempio n. 26
0
 def deleteArrbez():
     Add_Delete_Widgets.deleteArrbez(self, self.Arrbez.layout())
Esempio n. 27
0
 def deleteCustomer():
     Add_Delete_Widgets.deleteCustomer(self, self.Customer.layout())
Esempio n. 28
0
 def newLPM():
     Add_Delete_Widgets.addLPM(self, self.LPM.layout())
Esempio n. 29
0
 def deletePipegap():
     Add_Delete_Widgets.deletePipegap(self, self.Pipegap.layout())
Esempio n. 30
0
 def deleteLPM():
     Add_Delete_Widgets.deleteLPM(self, self.LPM.layout())