From 605a3868ddfa09d4a7e48cc66c2de15a08f074b4 Mon Sep 17 00:00:00 2001 From: Holaplace <45121260+Holaplace@users.noreply.github.com> Date: Sun, 1 Dec 2019 00:35:29 +0800 Subject: [PATCH] aviod wire delay --- .spec | 33 +++++++++++++++++++++++++++++++++ ruijie.py | 7 +++++-- wifiConnect.py | 2 +- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 .spec diff --git a/.spec b/.spec new file mode 100644 index 0000000..d41ca86 --- /dev/null +++ b/.spec @@ -0,0 +1,33 @@ +# -*- mode: python ; coding: utf-8 -*- + +block_cipher = None + + +a = Analysis(['linkSHU.py'], + pathex=['F:\\linkSHU (alpha)'], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False) +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=False , icon='logo.ico') diff --git a/ruijie.py b/ruijie.py index f94d970..c0541b2 100644 --- a/ruijie.py +++ b/ruijie.py @@ -11,9 +11,10 @@ class shuConnect: - def __init__(self, user=0, passwd='shu'): + def __init__(self, user=0, passwd='shu', chose=1): self.user = user self.passwd = passwd + self.chose = chose def precheck_connect(self): try: @@ -73,7 +74,9 @@ def connect(self): return False, resp["message"] def start_connect(self): - sleep(1) # 不延时,precheck 中 sock.connect 反应不过来 + if self.chose != 1: + sleep(1) # 不延时,precheck 中 sock.connect 反应不过来 + status = self.check_connect() if status == 1: s = '已认证 & 用户已在线 \n' diff --git a/wifiConnect.py b/wifiConnect.py index 1d208bf..96c48f7 100644 --- a/wifiConnect.py +++ b/wifiConnect.py @@ -87,7 +87,7 @@ def run(self): sleep(1) # 不延时,wifi反应不过来 s0 = "Shu(ForAll) 连接成功\n" - shu = shuConnect(self.user, self.passwd) + shu = shuConnect(self.user, self.passwd, chose=2) s = s0 + shu.start_connect() except: