Code refactoring

This commit is contained in:
svk28 2017-04-13 14:03:48 +03:00
parent c6bf9f6d81
commit 1fa7c96d1b

20
gui.py
View File

@ -195,11 +195,11 @@ class EditForm(QMainWindow):
self.widgetsList = []
self.btnRelationsList = []
# добавляем динамически поля на форму в зависимости от типов данных
for item in dm.getFields(tblName):
for fName, fType, fAutoIncr in dm.getFields(tblName):
#print(item)
fName = item[0]
fType = item[1]
fAutoIncr = item[2]
#fName = item[0]
#fType = item[1]
#fAutoIncr = item[2]
fDescr = dm.getFieldDescription(tblName, fName)
hboxEdit = QHBoxLayout()
lbl = QLabel(fDescr)
@ -341,9 +341,9 @@ def addDataIntoTable(dbTableName, tblDataWidget, data='NULL'):
n = 0
tblDataWidget.setRowCount(rows)
tblDataWidget.setColumnCount(cols)
for item in fieldNames:
fName = item[0]
fDescr = item[1]
for fname, fDescr in fieldNames:
#fName = item[0]
#fDescr = item[1]
#### определяем наличие связей и добавляем дополнительные столбцы
####print(fName, fDescr, dm.getRelationsForField(dbTableName, fName))
# установка заголовков столбцов таблицы
@ -468,9 +468,9 @@ def showRelationsRecords(fieldIndex, fieldValue):
# print(fieldValue)
data = dm.selectRelationsDataFromDB(tblName, fieldName, fieldValue)
#print(data)
for item in data:
tbl = item[0]
qweryResult = item[1]
for tbl, qweryResult in data:
#tbl = item[0]
#qweryResult = item[1]
if qweryResult:
#print('report' + str(qweryResult) + 'report')
tblRelationsData = MyTable(tbl)