with sq.connect(f"direction_db/{lg_hash_dir}/{direction_db_list}.db") as con:
cur = con.cursor()
colums_of_table = cur.execute("SELECT * FROM direction_db").fetchall()
colums_of_table_len_col = len(colums_of_table[0]) - 1
colums_of_table_len_row = len(colums_of_table) - 1
self.ui.tableWidget.setColumnCount(colums_of_table_len_col)
self.ui.tableWidget.setRowCount(colums_of_table_len_row)
self.ui.progressBar.show()
for row in range(2, colums_of_table_len_row + 2):
value_bar = (row / (colums_of_table_len_row + 2)) * 100
self.ui.progressBar.setValue(value_bar)
for col in range(1, colums_of_table_len_col + 1):
item_db = cur.execute("SELECT * FROM direction_db WHERE id=(%s)" % row).fetchone()
k_table = row - 2
c_table = col - 1
item_list_db = str(item_db[col])
if item_list_db == '-':
item_list_db = ''
if item_list_db == 'None':
item_list_db = ''
self.ui.tableWidget.setItem(k_table, c_table, QTableWidgetItem(item_list_db))
self.ui.progressBar.hide()
item_db_label = cur.execute("SELECT * FROM direction_db WHERE id=1").fetchone()
item_db_lb = item_db_label
col_table_name = list()
for i in range(1, colums_of_table_len_col + 1):
col_tab = item_db_lb[i]
col_tb = str(col_tab)
col_table_name.append(col_tb)
for i in col_table_name:
if i == 'None':
ix_none = col_table_name.index('None')
col_table_name.pop(ix_none)
col_table_name.insert(ix_none, '')
self.ui.tableWidget.setHorizontalHeaderLabels(col_table_name)
self.ui.tableWidget.resizeColumnsToContents()
item_db = cur.execute("SELECT * FROM direction_db WHERE id=(%s)" % row).fetchone()
for row in range(2....