11import tkinter as TK
2- from TestEvents import TestEventTypes
32
43
54class GuiWindow ():
@@ -75,7 +74,7 @@ def _CreateBottomBar(self, parent):
7574 self .selectedTestEventPlatform = TK .StringVar ()
7675 self .selectedTestEventPlatform .trace_variable (
7776 TK .W , self .OnTestEventPlatformChanged )
78- orderedTestEventPlatforms = list ( TestEventTypes . platforms . keys () )
77+ orderedTestEventPlatforms = self . state . testEvents . GetPlatforms ( )
7978 self .testEventPlatformList = TK .OptionMenu (
8079 bottomBarContainer , self .selectedTestEventPlatform , * orderedTestEventPlatforms )
8180 self .testEventPlatformList .pack (side = TK .LEFT )
@@ -88,13 +87,22 @@ def _CreateBottomBar(self, parent):
8887 bottomBarContainer , self .selectedTestEventType , * self .orderedTestEventTypes )
8988 self .testEventTypeList .pack (side = TK .LEFT )
9089
91- self .testEventInputLabel = TK .Label (
92- bottomBarContainer , text = "amount:" )
93- self .testEventInputLabel .pack (side = TK .LEFT )
94- self .testEventAmount = TK .StringVar ()
95- self .testEventInput = TK .Entry (
96- bottomBarContainer , textvariable = self .testEventAmount , width = 10 )
97- self .testEventInput .pack (side = TK .LEFT )
90+ self .testEventValueLabel = TK .Label (
91+ bottomBarContainer , text = "event value:" )
92+ self .testEventValueLabel .pack (side = TK .LEFT )
93+ self .testEventValue = TK .StringVar ()
94+ self .testEventValueInput = TK .Entry (
95+ bottomBarContainer , textvariable = self .testEventValue , width = 10 )
96+ self .testEventValueInput .pack (side = TK .LEFT )
97+
98+ self .testEventPayloadCountLabel = TK .Label (
99+ bottomBarContainer , text = "payload count:" )
100+ self .testEventPayloadCountLabel .pack (side = TK .LEFT )
101+ self .testEventPayloadCount = TK .StringVar ()
102+ self .testEventPayloadCount .set ("1" )
103+ self .testEventPayloadCountInput = TK .Entry (
104+ bottomBarContainer , textvariable = self .testEventPayloadCount , width = 10 )
105+ self .testEventPayloadCountInput .pack (side = TK .LEFT )
98106
99107 self .testEventButton = TK .Button (bottomBarContainer , text = self .translations .GetTranslation (
100108 "Gui TestEventButton" ), command = self .state .OnTestEventButtonHandler )
@@ -107,8 +115,10 @@ def _CreateBottomBar(self, parent):
107115
108116 self .testEventPlatformList .config (state = TK .DISABLED )
109117 self .testEventTypeList .config (state = TK .DISABLED )
110- self .testEventInputLabel .config (state = TK .DISABLED )
111- self .testEventInput .config (state = TK .DISABLED )
118+ self .testEventValueLabel .config (state = TK .DISABLED )
119+ self .testEventValueInput .config (state = TK .DISABLED )
120+ self .testEventPayloadCountLabel .config (state = TK .DISABLED )
121+ self .testEventPayloadCountInput .config (state = TK .DISABLED )
112122 self .testEventButton .config (state = TK .DISABLED )
113123
114124 def UpdateStatusText (self , text ):
@@ -136,27 +146,33 @@ def OnTestEventPlatformChanged(self, *args):
136146 self .testEventTypeList ["menu" ].delete (0 , TK .END )
137147 orderedTestEventTypes = []
138148 if self .selectedTestEventPlatform .get () != self .translations .GetTranslation ("Gui SelectTestEventPlatform" ):
139- orderedTestEventTypes = list (
140- TestEventTypes . platforms [ self .selectedTestEventPlatform .get ()]. keys ())
149+ orderedTestEventTypes = self . state . testEvents . GetPlatformTypes (
150+ self .selectedTestEventPlatform .get ())
141151 for testEventType in orderedTestEventTypes :
142152 self .testEventTypeList ["menu" ].add_command (
143153 label = testEventType , command = TK ._setit (self .selectedTestEventType , testEventType ))
144154 self .selectedTestEventType .set (
145155 self .translations .GetTranslation ("Gui SelectTestEventType" ))
146156 self .testEventTypeList .config (state = TK .NORMAL )
147- self .testEventInputLabel .config (state = TK .DISABLED )
148- self .testEventInput .config (state = TK .DISABLED )
157+ self .testEventValueLabel .config (state = TK .DISABLED )
158+ self .testEventValueInput .config (state = TK .DISABLED )
159+ self .testEventPayloadCountLabel .config (state = TK .DISABLED )
160+ self .testEventPayloadCountInput .config (state = TK .DISABLED )
149161 self .testEventButton .config (state = TK .DISABLED )
150162
151163 def OnTestEventTypeChanged (self , * args ):
152164 amountEnabled = False
153165 if self .selectedTestEventType .get () != self .translations .GetTranslation ("Gui SelectTestEventType" ):
154- amountEnabled = TestEventTypes . platforms [ self .selectedTestEventPlatform .get (
155- )][ self .selectedTestEventType .get ()][ "valueInput" ]
166+ amountEnabled = self . state . testEvents . GetAttribute ( self .selectedTestEventPlatform .get (
167+ ), self .selectedTestEventType .get (), "valueInput" )
156168 if amountEnabled :
157- self .testEventInputLabel .config (state = TK .NORMAL )
158- self .testEventInput .config (state = TK .NORMAL )
169+ self .testEventValueLabel .config (state = TK .NORMAL )
170+ self .testEventValueInput .config (state = TK .NORMAL )
171+ self .testEventPayloadCountLabel .config (state = TK .NORMAL )
172+ self .testEventPayloadCountInput .config (state = TK .NORMAL )
159173 else :
160- self .testEventInputLabel .config (state = TK .DISABLED )
161- self .testEventInput .config (state = TK .DISABLED )
174+ self .testEventValueLabel .config (state = TK .DISABLED )
175+ self .testEventValueInput .config (state = TK .DISABLED )
176+ self .testEventPayloadCountLabel .config (state = TK .DISABLED )
177+ self .testEventPayloadCountInput .config (state = TK .DISABLED )
162178 self .testEventButton .config (state = TK .NORMAL )
0 commit comments