2323 END ,
2424 EW ,
2525 LEFT ,
26+ NE ,
2627 NSEW ,
2728 NW ,
2829 VERTICAL ,
4041 W ,
4142)
4243
43- from PIL import Image , ImageTk
4444from pynmeagps import (
4545 NMEA_MSGIDS_PROP ,
4646 NMEA_PAYLOADS_POLL_PROP ,
6363
6464from pygpsclient .globals import (
6565 ERRCOL ,
66- ICON_CONFIRMED ,
67- ICON_PENDING ,
68- ICON_REDRAW ,
69- ICON_SEND ,
70- ICON_UNKNOWN ,
71- ICON_WARNING ,
7266 INFOCOL ,
7367 NMEA_CFGOTHER ,
7468 OKCOL ,
@@ -175,12 +169,6 @@ def __init__(self, app: Frame, parent: Frame, *args, **kwargs):
175169
176170 super ().__init__ (parent .container , * args , ** kwargs )
177171
178- self ._img_send = ImageTk .PhotoImage (Image .open (ICON_SEND ))
179- self ._img_pending = ImageTk .PhotoImage (Image .open (ICON_PENDING ))
180- self ._img_confirmed = ImageTk .PhotoImage (Image .open (ICON_CONFIRMED ))
181- self ._img_warn = ImageTk .PhotoImage (Image .open (ICON_WARNING ))
182- self ._img_unknown = ImageTk .PhotoImage (Image .open (ICON_UNKNOWN ))
183- self ._img_refresh = ImageTk .PhotoImage (Image .open (ICON_REDRAW ))
184172 self ._cfg_id = "" # identity of selected CFG command
185173 self ._cfg_atts = {} # this holds the attributes of the selected CFG command
186174 self ._expected_response = None
@@ -212,18 +200,18 @@ def _body(self):
212200 self , orient = VERTICAL , command = self ._lbx_cfg_cmd .yview
213201 )
214202 self ._lbx_cfg_cmd .config (yscrollcommand = self ._scr_cfg_cmd .set )
215- self ._lbl_send_command = Label (self , image = self ._img_pending )
203+ self ._lbl_send_command = Label (self , image = self .__container . img_none )
216204 self ._btn_send_command = Button (
217205 self ,
218- image = self ._img_send ,
206+ image = self .__container . img_send ,
219207 width = 50 ,
220208 command = self ._on_set_cfg ,
221209 font = self .__app .font_md ,
222210 )
223211 self ._btn_refresh = Button (
224212 self ,
225- image = self ._img_refresh ,
226- width = 50 ,
213+ image = self .__container . img_redraw ,
214+ width = 40 ,
227215 command = self ._on_refresh ,
228216 font = self .__app .font_md ,
229217 )
@@ -248,45 +236,29 @@ def _do_layout(self):
248236 Layout widgets.
249237 """
250238
251- self ._lbl_cfg_dyn .grid (column = 0 , row = 0 , columnspan = 3 , padx = 3 , pady = 3 , sticky = EW )
252- self ._lbx_cfg_cmd .grid (
253- column = 0 , row = 1 , columnspan = 1 , rowspan = 10 , padx = 3 , pady = 3 , sticky = EW
254- )
255- self ._scr_cfg_cmd .grid (column = 1 , row = 1 , rowspan = 10 , sticky = (N , S , W ))
256- self ._btn_send_command .grid (
257- column = 2 , row = 1 , ipadx = 3 , ipady = 3 , padx = 3 , pady = 3 , sticky = W
258- )
259- self ._lbl_send_command .grid (
260- column = 2 , row = 2 , ipadx = 3 , ipady = 3 , padx = 3 , pady = 3 , sticky = W
261- )
262- self ._btn_refresh .grid (
263- column = 2 , row = 3 , ipadx = 3 , ipady = 3 , padx = 3 , pady = 3 , sticky = W
264- )
265- self ._lbl_command .grid (
266- column = 0 , row = 11 , columnspan = 3 , padx = 3 , pady = 3 , sticky = EW
267- )
239+ self ._lbl_cfg_dyn .grid (column = 0 , row = 0 , columnspan = 3 , sticky = EW )
240+ self ._lbx_cfg_cmd .grid (column = 0 , row = 1 , columnspan = 1 , sticky = EW )
241+ self ._scr_cfg_cmd .grid (column = 1 , row = 1 , sticky = (N , S , W ))
242+ self ._btn_send_command .grid (column = 2 , row = 1 , ipadx = 3 , ipady = 3 , sticky = NE )
243+ self ._lbl_send_command .grid (column = 3 , row = 1 , ipadx = 3 , ipady = 3 , sticky = NE )
244+ self ._btn_refresh .grid (column = 4 , row = 1 , ipadx = 3 , ipady = 3 , sticky = NE )
245+ self ._lbl_command .grid (column = 0 , row = 2 , columnspan = 5 , sticky = EW )
268246 self ._frm_container .grid (
269247 column = 0 ,
270- row = 12 ,
271- columnspan = 3 ,
272- rowspan = 15 ,
273- padx = 3 ,
274- pady = 3 ,
248+ row = 3 ,
249+ columnspan = 5 ,
250+ rowspan = 1 ,
275251 sticky = NSEW ,
276252 )
277253 self ._can_container .grid (
278254 column = 0 ,
279255 row = 0 ,
280- columnspan = 3 ,
281- rowspan = 15 ,
282- padx = 3 ,
283- pady = 3 ,
256+ columnspan = 5 ,
257+ rowspan = 1 ,
284258 sticky = NSEW ,
285259 )
286- self ._scr_container_ver .grid (column = 3 , row = 0 , rowspan = 15 , sticky = (N , S , W ))
287- self ._scr_container_hor .grid (
288- column = 0 , row = 15 , columnspan = 3 , rowspan = 15 , sticky = EW
289- )
260+ self ._scr_container_ver .grid (column = 5 , row = 0 , sticky = (N , S , W ))
261+ self ._scr_container_hor .grid (column = 0 , row = 2 , columnspan = 5 , sticky = EW )
290262 self .option_add ("*Font" , self .__app .font_sm )
291263
292264 def _attach_events (self ):
@@ -313,7 +285,7 @@ def reset(self):
313285 self ._lbx_cfg_cmd .insert (i , cmd )
314286
315287 self ._clear_widgets ()
316- self ._lbl_send_command .config (image = self ._img_unknown )
288+ self ._lbl_send_command .config (image = self .__container . img_unknown )
317289
318290 def _setscroll (self , event ): # pylint: disable=unused-argument
319291 """
@@ -395,7 +367,7 @@ def _on_set_cfg(self, *args, **kwargs): # pylint: disable=unused-argument
395367
396368 # send message, update status and await response
397369 self .__container .send_command (msg )
398- self ._lbl_send_command .config (image = self ._img_pending )
370+ self ._lbl_send_command .config (image = self .__container . img_pending )
399371 self .__container .status_label = f"P{ self ._cfg_id } SET message sent"
400372 for msgid in pendcfg :
401373 self .__container .set_pending (msgid , penddlg )
@@ -444,13 +416,13 @@ def _do_poll_cfg(self, *args, **kwargs): # pylint: disable=unused-argument
444416 if msg is not None :
445417 self .__container .send_command (msg )
446418 self .__container .status_label = f"{ cp } { cfg_id } POLL message sent"
447- self ._lbl_send_command .config (image = self ._img_pending )
419+ self ._lbl_send_command .config (image = self .__container . img_pending )
448420 for msgid in pendcfg :
449421 self .__container .set_pending (msgid , penddlg )
450422 self ._expected_response = POLL
451423 else : # CFG cannot be POLLed
452424 self .__container .status_label = f"{ cp } { cfg_id } No POLL available"
453- self ._lbl_send_command .config (image = self ._img_unknown )
425+ self ._lbl_send_command .config (image = self .__container . img_unknown )
454426
455427 def _do_poll_args (self , cfg_id : str ) -> dict :
456428 """
@@ -532,10 +504,10 @@ def update_status(self, msg: NMEAMessage | UBXMessage):
532504 f"{ cfg_id } message acknowledged" ,
533505 OKCOL ,
534506 )
535- self ._lbl_send_command .config (image = self ._img_confirmed )
507+ self ._lbl_send_command .config (image = self .__container . img_confirmed )
536508 else :
537509 self .__container .status_label = (f"{ cfg_id } message rejected" , ERRCOL )
538- self ._lbl_send_command .config (image = self ._img_warn )
510+ self ._lbl_send_command .config (image = self .__container . img_warn )
539511 self .update ()
540512
541513 def _clear_widgets (self ):
0 commit comments