def login(self, name): associate_im = imap.Imapmail() associate_im.user = name associate_im.password = self.dialog.passwordEdit.text() associate_im.server_address = 'imap.' + associate_im.user.split('@')[ -1] # 邮箱地址 if associate_im.user.split('@')[-1] in [ '163.com', 'qq.com', '126.com' ]: associate_im.client() e = associate_im.login() if e == 0: reply = WarningBox.WarningBox('账号或密码输入错误') reply.exec() else: self.if_login[name] = 2 self.AThreads[self.index_2].set_im(associate_im) self.AThreads[self.index_2].start() self.AThreads_2.update({name: self.AThreads[self.index_2]}) self.dialog.close() # self.sign.setEnabled(False) self.sign.setText("登出") self.reMovBtn.setEnabled(False) else: reply = WarningBox.WarningBox('邮箱格式不正确') reply.exec()
def onBtnAdd(self): self.address = self.memberEdit.text() if '@' in self.address: if self.address not in imap.black_list: imap.black_list.append(self.address) self.close() else: self.reply = WarningBox.WarningBox('黑名单已存在该联系人') self.reply.show() else: self.reply = WarningBox.WarningBox('邮箱格式不正确') self.reply.show()
def onBtnAdd(self): self.address = self.memberEdit.text() if '@' in self.address: if self.address not in imap.associate_list: imap.associate_list.append(self.address) self.if_login.update({self.address: 1}) self.close() else: self.reply = WarningBox.WarningBox('关联邮箱已存在该邮箱') self.reply.show() else: self.reply = WarningBox.WarningBox('邮箱格式不正确') self.reply.show()
def onBtn_BlackList(self): if finish == 1: bdialog = BlackList.BlackListUi() bdialog.exec() else: self.reply = WarningBox.WarningBox('初始化未完成') self.reply.show()
def onBtn_WhiteList(self): if finish == 1: wdialog = WhiteList.WhiteListUi() wdialog.exec() else: self.reply = WarningBox.WarningBox('初始化未完成') self.reply.show()
def onBtn_Setting(self, str): if finish == 1: set = Setting.SettingUi(str) set.exec() else: reply = WarningBox.WarningBox('初始化未完成') reply.show()
def onBtn_Special(self): global received_mails if finish == 1: bdialog = SpecialList.SpecialListUi(self.im, received_mails) bdialog.exec() else: self.reply = WarningBox.WarningBox('初始化未完成') self.reply.show()
def onBtn_Normail(self): global received_mails if flag == 1: normail = Normail.NormailUi(self.im, received_mails) normail.exec() else: self.reply = WarningBox.WarningBox('往期邮件扫描未完成') self.reply.show()
def onBtn_Normail(self): global received_mails if flag == 1: normail = Normail.NormailUi(self.im, received_mails) normail.exec() else: # reply = QMessageBox.warning(self, '!', '往期邮件扫描未完成', QMessageBox.Yes) self.reply = WarningBox.WarningBox('往期邮件扫描未完成') self.reply.show()
def onBtn_Lgmail(self): global received_mails if flag == 1: lgmail = Lgmail.LgmailUi(self.im, Lgmail.extra_list, received_mails) lgmail.exec() else: self.reply = WarningBox.WarningBox('往期邮件扫描未完成') self.reply.show()
def onBtn_Setting(self, str): if finish == 1: set = Setting.SettingUi(str) set.sureBtn.clicked.connect( lambda: self.setBackground(set.combox.currentIndex())) set.exec() else: reply = WarningBox.WarningBox('初始化未完成') reply.show()
def onBtn_Lgmail(self): global received_mails if flag == 1: lgmail = Lgmail.LgmailUi(self.im, Lgmail.extra_list, received_mails) lgmail.exec() else: # reply = QMessageBox.warning(self, '!', '往期邮件扫描未完成', QMessageBox.Yes) self.reply = WarningBox.WarningBox('往期邮件扫描未完成') self.reply.show()
def onBtn_Associate(self): global if_login global count global AThread1 global AThread2 if finish == 1: bdialog = Associate_List.AssociateListUi(if_login, count, AThread) bdialog.exec() else: self.reply = WarningBox.WarningBox('初始化未完成') self.reply.show()
def on_pushButton_enter_clicked(self): global s s = socket(AF_INET, SOCK_STREAM) s.settimeout(5) if_connect = 0 try: s.connect((address, port)) if_connect = 1 except BaseException as e: print(e) if_connect = 0 finally: if if_connect == 1: self.im.client() self.im.user = self.lineEdit_account.text() self.im.password = self.lineEdit_password.text() self.im.server_address = 'imap.' + self.im.user.split('@')[ -1] # 邮箱地址 if self.im.user.split('@')[-1] in [ '163.com', 'qq.com', '126.com' ]: self.im.client() e = self.im.login() if e == 0: reply = WarningBox.WarningBox('账号或密码输入错误') reply.exec() s.send(str(dict({'功能': 'exit'})).encode('utf-8')) else: self.save_login_info() # 通过验证,关闭对话框并返回1 self.accept() else: reply = WarningBox.WarningBox('邮箱格式不正确') reply.exec() s.send(str(dict({'功能': 'exit'})).encode('utf-8')) else: reply = WarningBox.WarningBox('连接服务器失败') reply.exec()