QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
QWindowsContext::windowsProc: No Qt Window found for event 0x83 (WM_NCCALCSIZE), hwnd=0x0x4c08de.
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
# есть ли этот логин в бд
if self.del_dupl_db_login.isChecked():
while con == '':
con = self.get_connection(self.db_host.toPlainText(),
self.db_user.toPlainText(),
self.db_pass.toPlainText(),
self.db_name.toPlainText(),
'utf8mb4',
DictCursor)
sleep(0.1)
with con.cursor() as cursor:
query = 'SELECT date, Provider FROM OldAccounts WHERE login=%s ORDER BY id DESC LIMIT 1'
cursor.execute(query, item.split(':')[0])
if cursor.rowcount > 0:
dupl_log_db.append(item)
else:
self.dubli.append(item)
else:
self.dubli.append(item)
import sys
from PyQt5 import QtWidgets, QtGui, QtCore, Qt
from time import sleep
import threading
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1479, 781)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
MainWindow.setMinimumSize(QtCore.QSize(1479, 781))
MainWindow.setMaximumSize(QtCore.QSize(1479, 781))
font = QtGui.QFont()
font.setPointSize(9)
MainWindow.setFont(font)
self.centralwidget = QtWidgets.QWidget(MainWindow)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth())
self.centralwidget.setSizePolicy(sizePolicy)
self.centralwidget.setMinimumSize(QtCore.QSize(1479, 781))
self.centralwidget.setMaximumSize(QtCore.QSize(1479, 781))
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(0, 0, 61, 16))
self.label.setObjectName("label")
self.all_accounts = QtWidgets.QTextBrowser(self.centralwidget)
self.all_accounts.setGeometry(QtCore.QRect(0, 20, 791, 521))
self.all_accounts.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
self.all_accounts.setReadOnly(False)
self.all_accounts.setAcceptRichText(False)
self.all_accounts.setObjectName("all_accounts")
self.del_duplicate_accs = QtWidgets.QPushButton(self.centralwidget)
self.del_duplicate_accs.setGeometry(QtCore.QRect(660, 550, 131, 23))
font = QtGui.QFont()
font.setPointSize(8)
self.del_duplicate_accs.setFont(font)
self.del_duplicate_accs.setObjectName("del_duplicate_accs")
self.count_accs = QtWidgets.QLabel(self.centralwidget)
self.count_accs.setGeometry(QtCore.QRect(430, 0, 91, 16))
font = QtGui.QFont()
font.setPointSize(9)
font.setBold(True)
font.setWeight(75)
self.count_accs.setFont(font)
self.count_accs.setObjectName("count_accs")
self.retranslateUi(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Check"))
self.label.setText(_translate("MainWindow", "Аккаунты:"))
self.del_duplicate_accs.setText(_translate("MainWindow", "Удалить дубли по лог."))
self.count_accs.setText(_translate("MainWindow", "0"))
class ExampleApp(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.logins = []
self.accounts = []
self.max_threads = 200
self.dupl_log = []
self.thr = 0
self.all_accounts.textChanged.connect(self.all_accounts_f)
self.del_duplicate_accs.clicked.connect(self.del_dupl_accs)
# изменение списка
def all_accounts_f(self):
self.accounts = []
lists = self.all_accounts.toPlainText().split('\n')
for l in lists:
if l != '' and l != '\n':
self.accounts.append(l)
self.count_accs.setText(str(len(self.accounts)))
# удалить дубликаты акков по логину
def del_dupl_accs(self):
self.all_accounts.blockSignals(True)
if self.count_accs.text() != '0':
self.all_accounts.clear()
self.dupl_log = []
self.logins = [item.split(':')[0] for item in self.accounts]
self.logins = list(set(self.logins))
for item in self.accounts:
while self.thr > self.max_threads:
sleep(0.1)
self.thr += 1
x = threading.Thread(target=self.check_dupl, args=(item,), daemon=True)
x.start()
while self.thr > 0:
sleep(0.1)
for item in self.dupl_log:
self.accounts.pop(self.accounts.index(item))
self.count_accs.setText(str(len(self.accounts)))
self.all_accounts.blockSignals(False)
# поток для проверки дублей (по бд) по логину
def check_dupl(self, item):
if item.split(':')[0] in self.logins:
self.logins.pop(self.logins.index(item.split(':')[0]))
self.all_accounts.append(item)
else:
self.dupl_log.append(item)
self.thr -= 1
def main():
app = QtWidgets.QApplication(sys.argv)
window = ExampleApp()
window.show()
app.exec_()
if __name__ == '__main__':
main()
тогда в качестве приложения можно использовать официальные приложения вк
id и ключи тут:
Как узнать ID приложений-клиентов ВКонакте?