Skip to content

Commit 9c848c1

Browse files
committed
update
1 parent 1ac390c commit 9c848c1

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

config_file.ini

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
[iothook]
2+
broker = iothook.com
3+
port = 1883
4+
username = iothookpublic
5+
password = iothookpublic
6+
topics = #,timestamp,test,testtopic,aaa,$SYS,
7+
18
[hivemq]
29
broker = broker.hivemq.com
310
port = 1883
@@ -31,7 +38,7 @@ broker = test.mosquitto.org
3138
port = 1883
3239
username =
3340
password =
34-
topics = #,timestamp,
41+
topics = #,timestamp,test,
3542

3643
[flespi]
3744
broker = mqtt.flespi.io
@@ -54,13 +61,6 @@ username =
5461
password =
5562
topics = #,timestamp,
5663

57-
[iothook]
58-
broker = iothook.com
59-
port = 1883
60-
username = iothookpublic
61-
password = iothookpublic
62-
topics = #,timestamp,test,testtopic,aaa,$SYS,
63-
6464
[ele]
6565
broker = iothook.com
6666
port = 1883

new_connect.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,46 +22,43 @@ def __init__(self, main_window, font_size):
2222

2323
self.main_window = main_window
2424
self.title("MQTT Client New Connect")
25-
self.geometry("300x300")
25+
self.geometry("300x350")
2626

27-
ipadding = {'ipadx': 10, 'ipady': 10}
27+
ipadding = {'ipadx': 5, 'ipady': 5}
2828

2929
frame = Frame(self, padx=5, pady=5)
3030
frame.grid(row=0, column=1)
3131

32-
Label(frame, text='Name', padx=5, pady=5).pack()
33-
Label(frame, text='Broker', padx=5, pady=5).pack()
34-
Label(frame, text='Port', padx=5, pady=5).pack()
35-
Label(frame, text='Username', padx=5, pady=5).pack()
36-
Label(frame, text='Password', padx=5, pady=5).pack()
32+
Label(frame, text='Name').pack(**ipadding)
33+
Label(frame, text='Broker').pack(**ipadding)
34+
Label(frame, text='Port').pack(**ipadding)
35+
Label(frame, text='Username').pack(**ipadding)
36+
Label(frame, text='Password').pack(**ipadding)
3737

3838
frame2 = Frame(self, padx=5, pady=5)
3939
frame2.grid(row=0, column=2)
4040

4141
self.entry_name_text = StringVar(self)
4242
self.entry_name = Entry(frame2, font=font_size,
43-
textvariable=self.entry_name_text).pack(padx=5,
44-
pady=5)
43+
textvariable=self.entry_name_text).pack(**ipadding)
4544

4645
self.entry_broker_text = StringVar(self)
4746
self.entry_broker = Entry(frame2, font=font_size,
48-
textvariable=self.entry_broker_text).pack(
49-
padx=5, pady=5)
47+
textvariable=self.entry_broker_text).pack(**ipadding)
5048

5149
self.entry_port_text = StringVar(self)
5250
self.entry_port = Entry(frame2, font=font_size,
53-
textvariable=self.entry_port_text).pack(padx=5,
54-
pady=5)
51+
textvariable=self.entry_port_text).pack(**ipadding)
5552

5653
self.entry_username_text = StringVar(self)
5754
self.entry_username = Entry(frame2, font=font_size,
5855
textvariable=self.entry_username_text).pack(
59-
padx=5, pady=5)
56+
**ipadding)
6057

6158
self.entry_password_text = StringVar(self)
6259
self.entry_password = Entry(frame2, font=font_size,
6360
textvariable=self.entry_password_text).pack(
64-
padx=5, pady=5)
61+
**ipadding)
6562

6663
self.button_cancel = Button(self, text="Cancel",
6764
font=font_size,

subscriber.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def on_connect(self, client, userdata, flags, rc):
3333
self.on_message_count, self.publish_message_count))
3434

3535
def on_disconnect(self, client, userdata, rc):
36-
self.mqtt_disconnect()
36+
print("on_disconnect")
37+
self.main_window.connect_status_text.set(
38+
"Disconnect | Message: %s | Publish: %s" % (
39+
self.on_message_count, self.publish_message_count))
3740

3841
def on_message(self, client, userdata, msg):
3942
self.topic = msg.topic
@@ -100,6 +103,3 @@ def mqtt_disconnect(self):
100103
"state"] = tk.DISABLED
101104
self.main_window.button_add_subscribe_topic["state"] = tk.DISABLED
102105

103-
self.main_window.connect_status_text.set(
104-
"Disconnect | Message: %s | Publish: %s" % (
105-
self.on_message_count, self.publish_message_count))

0 commit comments

Comments
 (0)