smartpi 0.1.29__py3-none-any.whl → 0.1.30__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smartpi/__init__.py +1 -1
- smartpi/_gui.py +22 -5
- {smartpi-0.1.29.dist-info → smartpi-0.1.30.dist-info}/METADATA +1 -1
- {smartpi-0.1.29.dist-info → smartpi-0.1.30.dist-info}/RECORD +6 -6
- {smartpi-0.1.29.dist-info → smartpi-0.1.30.dist-info}/WHEEL +0 -0
- {smartpi-0.1.29.dist-info → smartpi-0.1.30.dist-info}/top_level.txt +0 -0
smartpi/__init__.py
CHANGED
smartpi/_gui.py
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
import socket
|
|
2
4
|
import json
|
|
3
5
|
import time
|
|
4
6
|
|
|
5
7
|
class gui_client:
|
|
6
|
-
def __init__(self, host="127.0.0.1", port=65167):
|
|
7
|
-
self.sock =
|
|
8
|
-
|
|
8
|
+
def __init__(self, host="127.0.0.1", port=65167, timeout=2.0):
|
|
9
|
+
self.sock = None
|
|
10
|
+
try:
|
|
11
|
+
self.sock = socket.create_connection((host, port), timeout=timeout)
|
|
12
|
+
self.clear()
|
|
13
|
+
except :
|
|
14
|
+
self.sock = None
|
|
9
15
|
|
|
16
|
+
def is_connected(self):
|
|
17
|
+
result = False
|
|
18
|
+
if self.sock is not None:
|
|
19
|
+
result = True
|
|
20
|
+
return result
|
|
21
|
+
|
|
10
22
|
def _send(self, cmd):
|
|
11
|
-
self.sock
|
|
12
|
-
|
|
23
|
+
if self.sock is None:
|
|
24
|
+
return
|
|
25
|
+
try:
|
|
26
|
+
self.sock.sendall((json.dumps(cmd) + "\n").encode())
|
|
27
|
+
time.sleep(0.1)
|
|
28
|
+
except :
|
|
29
|
+
self.sock = None
|
|
13
30
|
|
|
14
31
|
def show_text(self, x, y, text, color="black", size=16):
|
|
15
32
|
self._send({"type": "text", "x": x, "y": y, "text": text, "color": color, "size": size})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
smartpi/__init__.py,sha256=
|
|
2
|
-
smartpi/_gui.py,sha256=
|
|
1
|
+
smartpi/__init__.py,sha256=KxiHhAK2d08nDxhs_Me1ZQHnYHBUfjBfIwCDNy0nF3s,199
|
|
2
|
+
smartpi/_gui.py,sha256=ij-6HZAEIwdy_hvU7f0NkyQjx_-eephijlKbGUhf8Uo,2177
|
|
3
3
|
smartpi/base_driver.py,sha256=hJ5_Rph1BT-riYiW1pgw685WAgEMjpqDF264BLSP6hk,24392
|
|
4
4
|
smartpi/color_sensor.py,sha256=YXJjknYjp7teTZsHYZRAWgi73CH0MhBp1go9y0Inxyo,498
|
|
5
5
|
smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
|
|
@@ -14,7 +14,7 @@ smartpi/temperature.py,sha256=VT79CYA41q1d_4AM-Y0eIMeIw7AtCkSXjWVws6Yx5yE,462
|
|
|
14
14
|
smartpi/touch_sensor.py,sha256=P57RRQlqY0KexpMi-ydqwF5albOKCBOGb0Rb6zeVTqk,440
|
|
15
15
|
smartpi/trace.py,sha256=tut7BMbq87ShaR5eNuv7PZtAEz9DS5_BDf0_muIZ-tQ,4577
|
|
16
16
|
smartpi/ultrasonic.py,sha256=kmVpUfvE1oHoqgv92ZU6Fi-sO6DSwm10ssKsImNeOkY,624
|
|
17
|
-
smartpi-0.1.
|
|
18
|
-
smartpi-0.1.
|
|
19
|
-
smartpi-0.1.
|
|
20
|
-
smartpi-0.1.
|
|
17
|
+
smartpi-0.1.30.dist-info/METADATA,sha256=HdapesvaqrPYL7dI86CO7s1gZ01ws0MbCfVdOIqByF8,311
|
|
18
|
+
smartpi-0.1.30.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
19
|
+
smartpi-0.1.30.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
|
|
20
|
+
smartpi-0.1.30.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|