есть функция "browse" и она должна добавлять новый line edit но почему-то не появляется хотя в списке с line edit-ами оно отображается
from PyQt5 import uic, QtWidgets
from PyQt5.QtWidgets import QApplication
from PyQt5.uic import loadUi
import os
Form, Window = uic.loadUiType("настройки.ui")
safe_file = open("safe_file.txt", "r")
model = safe_file.readline(2)
llist = safe_file.readlines()
llist.pop(0)
llist.pop(0)
safe_file.close()
list_of_lines = []
class Ui(QtWidgets.QDialog, Form):
def __init__(self):
super(Ui,self).__init__()
layout = QtWidgets.QVBoxLayout()
self.setupUi(self)
self.pushButton.clicked.connect(self.safe)
self.pushButton_2.clicked.connect(self.browes)
llist_names = []
for i in range(len(llist)):
llist_names.append(" " + os.path.basename(llist[i]).replace("\n","")+ ' -')
self.textEdit.setText('\n'.join(llist_names) )
for i in range(len(llist)):
list_of_lines.append(QtWidgets.QLineEdit(self))
list_of_lines[i].move(110, i * 18 + 105)
list_of_lines[i].resize(100, 15)
print(list_of_lines)
print(len(llist))
def safe(self):
content = self.comboBox.currentText()
if self.radioButton.isChecked():
model = "slow"
else:
model = "fast"
safe_file = open("safe_file.txt","w+")
safe_file.write(model + "\n" + content)
for i in range(len(llist)):
safe_file.write("\n" + llist[i].replace("\n", ""))
safe_file.close()
def browes(self):
frame = QtWidgets.QFileDialog.getOpenFileName(self, "monte negro")
llist.append(frame[0])
llist_names=[]
print(llist)
for i in range(len(llist)):
llist_names.append(" " + os.path.basename(llist[i]).replace("\n","")+ ' -')
print(llist_names)
self.textEdit.setText('\n'.join(llist_names))
for i in range(len(llist)):
list_of_lines.append(QtWidgets.QLineEdit())
list_of_lines[i].move(110, i * 18 + 105)
list_of_lines[i].resize(100, 15)
print(list_of_lines)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
w = Ui()
w.show()
sys.exit(app.exec_())
# app = QApplication([])
# window = Window()
# form = Form()
# form.setupUi(window)
# window.show()
# app.exec()