Skip to content

Commit c34d533

Browse files
committed
name anonymous threads
1 parent 15ed248 commit c34d533

File tree

4 files changed

+34
-25
lines changed

4 files changed

+34
-25
lines changed

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python Debugger: Current File",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal",
13+
"justMyCode": false
14+
},
15+
{
16+
"name": "Python: Attach using Process Id",
17+
"type": "debugpy",
18+
"request": "attach",
19+
"processId": "${command:pickProcess}"
20+
}
21+
]
22+
}

example.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,12 @@
4242
img[pos_y][pos_x] = color
4343
p.set_image(img)
4444

45-
key = input("Enter 'n' for the next image, enter any other key to skip\n")
46-
if key.upper() == "N":
47-
# set rgb color with a converted hsv color
48-
color = utils.from_hsv(0.5, 1.0, 0.7)
49-
50-
# set all pixels to the current color
51-
for x in range(28):
52-
for y in range(14):
53-
img[y][x] = color
54-
p.set_image(img)
55-
56-
key = input("Enter 'n' for the next image, enter any other key to skip\n")
57-
if key.upper() == "N":
58-
color = [255, 255, 255]
59-
60-
# create 3 white lines
61-
for x in range(28):
62-
for y in range(3,10,3):
63-
img[y][x] = color
64-
p.set_image(img)
65-
66-
p.close()
45+
while True:
46+
color = utils.from_hsv(0.5, 1.0, 0.7)
47+
48+
# set all pixels to the current color
49+
for x in range(28):
50+
for y in range(14):
51+
img[y][x] = color
52+
p.set_image(img)
53+

pyghthouse/connection/wsconnector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def start(self):
4848
self.lock.acquire() # wait for connection to be established
4949
self.__connection_state = ConnectionState.CONNECTING
5050
kwargs = {"sslopt": {"cert_reqs": CERT_NONE}} if self.ignore_ssl_cert else None
51-
Thread(target=self.ws.run_forever, kwargs=kwargs).start()
52-
51+
Thread(target=self.ws.run_forever, name="Websocket Thread", kwargs=kwargs).start()
52+
5353

5454
def _fail(self, ws, err):
5555
self.__connection_state = ConnectionState.FAILED

pyghthouse/ph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def print_warning(msg):
166166
class PHThread(Thread):
167167

168168
def __init__(self, parent):
169-
super().__init__()
169+
super().__init__(name = "PHThread")
170170
self.parent = parent
171171
self._stop_event = Event()
172172

0 commit comments

Comments
 (0)