eric6/Templates/TemplateMultipleVariablesDialog.py

changeset 8220
006ee31b4835
parent 8218
7c09585bd960
equal deleted inserted replaced
8219:013aee248a62 8220:006ee31b4835
51 self.grid.setSpacing(6) 51 self.grid.setSpacing(6)
52 self.top.setLayout(self.grid) 52 self.top.setLayout(self.grid)
53 53
54 # populate the scrollarea with labels and text edits 54 # populate the scrollarea with labels and text edits
55 self.variablesEntries = {} 55 self.variablesEntries = {}
56 row = 0 56 for row, var in enumerate(variables):
57 for var in variables:
58 label = QLabel("{0}:".format(var), self.top) 57 label = QLabel("{0}:".format(var), self.top)
59 self.grid.addWidget(label, row, 0, 58 self.grid.addWidget(label, row, 0,
60 Qt.Alignment(Qt.AlignmentFlag.AlignTop)) 59 Qt.Alignment(Qt.AlignmentFlag.AlignTop))
61 if var.find(":") >= 0: 60 if var.find(":") >= 0:
62 formatStr = var[1:-1].split(":")[1] 61 formatStr = var[1:-1].split(":")[1]
67 t = QLineEdit(self.top) 66 t = QLineEdit(self.top)
68 else: 67 else:
69 t = QLineEdit(self.top) 68 t = QLineEdit(self.top)
70 self.grid.addWidget(t, row, 1) 69 self.grid.addWidget(t, row, 1)
71 self.variablesEntries[var] = t 70 self.variablesEntries[var] = t
72 row += 1
73 # add a spacer to make the entries aligned at the top 71 # add a spacer to make the entries aligned at the top
74 spacer = QSpacerItem( 72 spacer = QSpacerItem(
75 20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) 73 20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
76 self.grid.addItem(spacer, row, 1) 74 self.grid.addItem(spacer, self.grid.rowCount(), 1)
77 self.variablesEntries[variables[0]].setFocus() 75 self.variablesEntries[variables[0]].setFocus()
78 self.top.adjustSize() 76 self.top.adjustSize()
79 77
80 # generate the buttons 78 # generate the buttons
81 layout1 = QHBoxLayout() 79 layout1 = QHBoxLayout()

eric ide

mercurial