|
@@ -74,10 +74,15 @@ class Controls(wx.Frame):
|
74
|
74
|
bold = wx.Font(20, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD, False)
|
75
|
75
|
|
76
|
76
|
self.snipsBtn = wx.Button(self, wx.ID_ANY, "Idle")
|
|
77
|
+ self.snipsBtn.Bind(wx.EVT_BUTTON, self.close)
|
77
|
78
|
|
78
|
|
- self.printBtn = wx.Button(self, wx.ID_ANY, "Date Label")
|
79
|
|
- self.printBtn.SetFont(bold)
|
80
|
|
- self.printBtn.Bind(wx.EVT_BUTTON, self.print_date)
|
|
79
|
+ self.dateBtn = wx.Button(self, wx.ID_ANY, "Date Label")
|
|
80
|
+ self.dateBtn.SetFont(bold)
|
|
81
|
+ self.dateBtn.Bind(wx.EVT_BUTTON, self.print_date)
|
|
82
|
+
|
|
83
|
+ self.outsideBtn = wx.Button(self, wx.ID_ANY, "Outside Label")
|
|
84
|
+ self.outsideBtn.SetFont(bold)
|
|
85
|
+ self.outsideBtn.Bind(wx.EVT_BUTTON, self.print_outside)
|
81
|
86
|
|
82
|
87
|
self.nameBtn = wx.Button(self, wx.ID_ANY, "Name Label")
|
83
|
88
|
self.nameBtn.SetFont(bold)
|
|
@@ -99,16 +104,20 @@ class Controls(wx.Frame):
|
99
|
104
|
self.SetBackgroundColour("black")
|
100
|
105
|
self.ShowFullScreen(True)
|
101
|
106
|
|
|
107
|
+ vsizer_left = wx.BoxSizer(wx.VERTICAL)
|
|
108
|
+ vsizer_left.Add(self.dateBtn, -1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 0)
|
|
109
|
+ vsizer_left.Add(self.outsideBtn, -1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 0)
|
|
110
|
+
|
102
|
111
|
hsizer_top = wx.BoxSizer(wx.HORIZONTAL)
|
103
|
|
- hsizer_top.Add(self.printBtn, -1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 0)
|
|
112
|
+ hsizer_top.Add(vsizer_left, -1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 0)
|
104
|
113
|
hsizer_top.Add(self.nameBtn, -1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 0)
|
105
|
114
|
|
106
|
115
|
sizer.Add(self.snipsBtn, -1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 0)
|
107
|
|
- sizer.Add(hsizer_top, 2, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 20)
|
|
116
|
+ sizer.Add(hsizer_top, 2, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 10)
|
108
|
117
|
|
109
|
118
|
hsizer = wx.BoxSizer(wx.HORIZONTAL)
|
110
|
119
|
|
111
|
|
- sizer.Add(hsizer, 1, wx.ALL|wx.EXPAND, 20)
|
|
120
|
+ sizer.Add(hsizer, 1, wx.ALL|wx.EXPAND, 10)
|
112
|
121
|
hsizer.Add(self.kitchenBtn, -1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 0)
|
113
|
122
|
hsizer.Add(self.diningBtn, -1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTRE, 0)
|
114
|
123
|
self.SetSizer(sizer)
|
|
@@ -167,6 +176,10 @@ class Controls(wx.Frame):
|
167
|
176
|
#self.namePanel.Disable()
|
168
|
177
|
#wx.CallLater(4000, self.hide_name_menu)
|
169
|
178
|
|
|
179
|
+ def print_outside(self, event):
|
|
180
|
+ self.printer.nametag(theme='outside')
|
|
181
|
+ self.printer.printout(printer='Zebra_2824')
|
|
182
|
+ wx.CallLater(4000, self.printer.cleanup, [self.printer.pdf,])
|
170
|
183
|
|
171
|
184
|
|
172
|
185
|
@staticmethod
|
|
@@ -174,11 +187,12 @@ class Controls(wx.Frame):
|
174
|
187
|
print("Published: {0}: {1}".format(userdata, result))
|
175
|
188
|
|
176
|
189
|
def send_notification(self, title, text, icon="dialog-information"):
|
|
190
|
+ pass
|
177
|
191
|
#subprocess.check_call(['/usr/bin/notify-send', str(title), str(text)])
|
178
|
|
- self.notification = Notify.Notification.new(title, text)
|
179
|
|
- self.notification.show()
|
|
192
|
+ #self.notification = Notify.Notification.new(title, text)
|
|
193
|
+ #self.notification.show()
|
180
|
194
|
# Since we might not be on the main thread (?)
|
181
|
|
- wx.CallAfter(self.queue_close_notifiaction)
|
|
195
|
+ #wx.CallAfter(self.queue_close_notifiaction)
|
182
|
196
|
|
183
|
197
|
def queue_close_notifiaction(self, event=None):
|
184
|
198
|
wx.CallLater(20000, self.close_notification)
|
|
@@ -242,7 +256,7 @@ class Controls(wx.Frame):
|
242
|
256
|
self.GetEventHandler().ProcessEvent(event)
|
243
|
257
|
|
244
|
258
|
self.mqtt.on_message = on_message
|
245
|
|
- while True
|
|
259
|
+ while True:
|
246
|
260
|
self.mqtt.loop()
|
247
|
261
|
if self.MQTT_EXIT.isSet():
|
248
|
262
|
return None
|