代码拉取完成,页面将自动刷新
# coding:utf-8
import datetime
import sys
import time
import GuiBase
from PyQt5.QtWidgets import QApplication, QDialog
import logic
import threading
class MainDialog(QDialog):
note = "BUG联系:3307129619"
ui = None
obj_logic = None
threading_obj = None
def __init__(self, parent=None):
super(QDialog, self).__init__(parent)
self.ui = GuiBase.Ui_Dialog()
self.ui.setupUi(self)
self.obj_logic = logic.logic(self.ui)
self.ui.label_6.setText(self.note)
self.ui.lineEdit_2.setText(self.obj_logic.url_get_account)
self.ui.lineEdit_3.setText(self.obj_logic.url_get_red_packet)
self.ui.lineEdit_4.setText(str(self.obj_logic.sleep_time))
"""
获取账户
"""
def getAccount(self):
if self.ui.pushButton_2.text() == '停止':
self.updateLog("请先停止运行再操作...")
return False
self.ui.textBrowser.setText('')
self.obj_logic.account_id = None
self.updateLog("正在查询账户...")
res = self.obj_logic.getAccount(self.ui.lineEdit.text())
if res['code'] == '0':
id = ''
server = ''
level = ''
lastTime = ''
try:
id = res['data']['id']
server = res['data']['server']
level = res['data']['level']
lastTime = res['data']['lastTime']
pass
except BaseException as e:
pass
self.ui.textBrowser.setText(id)
self.updateLog("查询成功,id:{},王国:{},等级:{},最近登录时间:{}".format(id, server, level, lastTime))
pass
else:
self.updateLog("查询失败,{}".format(res['msg']))
pass
# 事件
pass
"""
坐标拾取器
"""
def getWindowPoint(self):
if self.ui.pushButton_2.text() == '停止':
self.updateLog("请先停止运行再操作...")
return False
self.updateLog('正在拉起截图,请稍后.')
self.threading_obj = threading.Thread(target=self.getWindowPointClick)
self.threading_obj.start()
pass
"""
线程操作拉起截图获取坐标事件
"""
def getWindowPointClick(self):
self.obj_logic.getWindowPoint()
temp_arr = [str(v) for v in self.obj_logic.window_point]
temp_str = ' * '.join(temp_arr)
self.ui.label_6.setText("{}|截图屏幕坐标:{}".format(self.note, temp_str))
self.updateLog('选中屏幕坐标:{}'.format(temp_str))
pass
"""
更新设置
"""
def updateSetting(self):
self.obj_logic.url_get_account = self.ui.lineEdit_2.text()
self.obj_logic.url_get_red_packet = self.ui.lineEdit_3.text()
self.obj_logic.sleep_time = self.ui.lineEdit_4.text()
self.updateLog('更新获取用户id地址:{}'.format(self.obj_logic.url_get_account))
self.updateLog('更新领取地址:{}'.format(self.obj_logic.url_get_red_packet))
self.updateLog('更新截屏等待时间:{}'.format(self.obj_logic.sleep_time))
pass
"""
开始运行
"""
def runGrabWindow(self):
if self.ui.pushButton_2.text() == '停止':
# 停止
self.obj_logic.stop = True
self.ui.pushButton_2.setText("运行(RUN)")
if self.threading_obj is not None: # 停止线程
self.threading_obj.join()
self.threading_obj = None
return False
pass
else:
self.ui.pushButton_2.setText("停止")
pass
if tuple(self.obj_logic.window_point) == (0, 0, 0, 0):
self.updateLog('请先获取坐标')
self.obj_logic.stop = True
self.ui.pushButton_2.setText("运行(RUN)")
return False
pass
if self.obj_logic.runGrabWindow_status:
self.updateLog('请稍后,等待线程结束')
self.obj_logic.stop = True
return False
pass
self.obj_logic.stop = False
self.ui.pushButton_2.setText("停止")
self.threading_obj = threading.Thread(target=self.obj_logic.runGrabWindow)
self.threading_obj.start()
pass
"""
更新日志
"""
def updateLog(self, strval):
times = datetime.datetime.now().strftime('%m-%d %H:%M:%S')
self.ui.textBrowser_2.append("{}:{}".format(times, strval))
self.ui.textBrowser_2.moveCursor(self.ui.textBrowser_2.textCursor().End) # 文本框显示到底部
pass
if __name__ == '__main__':
myapp = QApplication(sys.argv)
myDlg = MainDialog()
myDlg.show()
sys.exit(myapp.exec_())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。