class HBox4(QGridLayout):
def __init__(self, parent=None):
super(HBox4, self).__init__(parent)
self.table = TableWidget()
self.addWidget(self.table, *(0,0))
self.addWidget(TabDemo(), *(0,1))
def update(self,data):
self.table.update(data)
class TableWidget(QTableWidget):
def __init__(self, parent=None, data=[]):
super(TableWidget, self).__init__(parent)
#data = []
self.setColumnCount(1)
self.setRowCount(len(data))
for i, entry in enumerate(data, start=1):
self.setRowCount(i)
item = QTableWidgetItem()
item.setText(str(entry))
def update(self,data):
self.clearContents ()
#тут очищаем таблицу, затем тот же код, что и в init
self.setColumnCount(1)
self.setRowCount(len(data))
for i, entry in enumerate(data, start=1):
self.setRowCount(i)
item = QTableWidgetItem()
item.setText(str(entry))
This is a known bug, unfortunately not fully resolved.
For more details and possible workarounds see
https://bugs.launchpad.net/ubuntu/+source/linux/+b...
https://bugs.launchpad.net/ubuntu/+source/linux/+b...
try:
cursor.execute("SELECT * FROM index WHERE complete = FALSE")
except Exception as e:
print(e)
return None
import requests
session = requests.Session()
rows = cursor.fetchall()
for row in rows:
print("open %s"%row[1])
try:
req = session.get(row[1])
#скачал что надо, обработал
except AttributeError as e:
print(e)
return None
try:
cursor.execute("INSERT INTO pages (fields) VALUES (%s)", ("что там напарсил",))
except Exception as e:
print(e)
return None
try:
cursor.execute("UPDATE index SET complete = TRUE WHERE id = %s",(row[0],))
except Exception as e:
print(e)
return None
db.commit()
(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\\d{1,3}\b)?(?P<host>\S+)