From 6c1264015cb6783c9154d2bf621c63dea7059a44 Mon Sep 17 00:00:00 2001 From: uhi22 Date: Mon, 24 Oct 2022 23:19:45 +0200 Subject: [PATCH] improved gui. cleanups. --- pyPlc.py | 8 +++----- pyPlcHomeplug.py | 11 +++-------- pyPlcWorker.py | 5 ++--- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/pyPlc.py b/pyPlc.py index 843bf50..fb640b2 100644 --- a/pyPlc.py +++ b/pyPlc.py @@ -32,7 +32,7 @@ def cbShowStatus(s, selection=""): lblMode['text']=s s="" if (selection == "pevmac"): - lblPevMac['text']=s + lblPevMac['text']="PEV MAC " + s s="" if (len(s)>0): lblStatus['text']=s @@ -40,9 +40,8 @@ def cbShowStatus(s, selection=""): root = tk.Tk() lastKey = '' -display = tk.Label(root, text='No Key', width=30) # A textual element in the graphical user interface -display.pack() -lblHelp = tk.Label(root, text="x=exit, t=testframe") +lblHelp = tk.Label(root, justify= "left") +lblHelp['text']="x=exit \nS=GET_SW \nP=PEV mode \nE=EVSE mode \nL=Listen mode \ns=SET_KEY \nG=GET_KEY (try twice) \nt=SET_KEY modified" lblHelp.pack() lblStatus = tk.Label(root, text="(Status)") lblStatus.pack() @@ -52,7 +51,6 @@ lblMode = tk.Label(root, text="(mode)") lblMode.pack() # Bind the keyboard handler to all relevant elements: -display.bind('', storekeyname) root.bind('', storekeyname) cbShowStatus("initialized") root.update() diff --git a/pyPlcHomeplug.py b/pyPlcHomeplug.py index 4d35d06..1da81a0 100644 --- a/pyPlcHomeplug.py +++ b/pyPlcHomeplug.py @@ -401,8 +401,7 @@ class pyPlcHomeplug(): self.mytransmitbuffer[37]=0x43 # - def sendTestFrame(self, selection): - + def sendTestFrame(self, selection): if (selection=="1"): self.composeSlacParamReq() self.addToTrace("transmitting SLAC_PARAM.REQ...") @@ -420,13 +419,9 @@ class pyPlcHomeplug(): self.addToTrace("transmitting SET_KEY.REQ (key 0)") self.transmit(self.mytransmitbuffer) if (selection=="t"): - self.composeSetKey(2) + self.composeSetKey(2) # set key with modified content self.addToTrace("transmitting SET_KEY.REQ (key 2)") self.transmit(self.mytransmitbuffer) - if (selection=="D"): - self.composeDHCP() - self.addToTrace("transmitting broken DHCP") - self.transmit(self.mytransmitbuffer) if (selection=="G"): self.composeGetKey() self.addToTrace("transmitting GET_KEY") @@ -600,10 +595,10 @@ class pyPlcHomeplug(): for ts, pkt in self.sniffer: # attention: for using this in non-blocking manner, we need the patch described above. self.nPacketsReceived+=1 # print('%d' % (ts)) # the time stamp + # We received an ethernet package. Determine its type, and dispatch it to the related handler. etherType = self.getEtherType(pkt) if (etherType == 0x88E1): # it is a HomePlug message self.myreceivebuffer = pkt - # self.showMacAddresses(pkt) self.evaluateReceivedHomeplugPacket() if (etherType == 0x86dd): # it is an IPv6 frame self.ipv6.evaluateReceivedPacket(pkt) diff --git a/pyPlcWorker.py b/pyPlcWorker.py index 6baab08..3b72b6d 100644 --- a/pyPlcWorker.py +++ b/pyPlcWorker.py @@ -33,8 +33,7 @@ class pyPlcWorker(): if (strAction == "E"): self.hp.enterEvseMode() if (strAction == "L"): - self.hp.enterListenMode() - - self.addToTrace("UserAction " + strAction) + self.hp.enterListenMode() + # self.addToTrace("UserAction " + strAction) self.hp.sendTestFrame(strAction)