Subversion Repositories Projects

Rev

Rev 591 | Rev 593 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 591 Rev 592
Line 115... Line 115...
115
        self.text_ctrl_4 = wx.TextCtrl(self, -1, "")
115
        self.text_ctrl_4 = wx.TextCtrl(self, -1, "")
116
        self.label_8 = wx.StaticText(self, -1, "label_8")
116
        self.label_8 = wx.StaticText(self, -1, "label_8")
117
        self.text_ctrl_8 = wx.TextCtrl(self, -1, "")
117
        self.text_ctrl_8 = wx.TextCtrl(self, -1, "")
118
        self.button_1 = wx.Button(self, -1, "button_1")
118
        self.button_1 = wx.Button(self, -1, "button_1")
119
        self.GraphPanel = wx.Panel(self, -1, style=wx.DOUBLE_BORDER|wx.TAB_TRAVERSAL)
119
        self.GraphPanel = wx.Panel(self, -1, style=wx.DOUBLE_BORDER|wx.TAB_TRAVERSAL)
120
        self.choice_3 = wx.Choice(self, -1, choices=[])
120
        self.yAxesChoice = wx.ComboBox(self, -1, choices=["10", "25", "50", "100", "250"], style=wx.CB_DROPDOWN)
121
        self.choice_4 = wx.Choice(self, -1, choices=[])
121
        self.graphTypeChoise = wx.ComboBox(self, -1, choices=["Raw Data", "Filtered Data", "Spectrum"], style=wx.CB_DROPDOWN)
122
        self.TestListCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
122
        self.TestListCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
Line 123... Line 123...
123
 
123
 
124
        self.__set_properties()
124
        self.__set_properties()
Line 125... Line 125...
125
        self.__do_layout()
125
        self.__do_layout()
-
 
126
 
126
 
127
        self.Bind(wx.EVT_MENU, self.OnImport, id=-1)
Line 127... Line 128...
127
        self.Bind(wx.EVT_MENU, self.OnImport, id=-1)
128
        self.Bind(wx.EVT_COMBOBOX, self.onYAxesChange, self.yAxesChoice)
128
        # end wxGlade
129
        # end wxGlade
Line 129... Line 130...
129
 
130
 
130
    def setApp(self, app):
131
    def setApp(self, app):
131
        self.app = app
132
        self.app = app
132
 
133
 
-
 
134
    def __set_properties(self):
-
 
135
        # begin wxGlade: MainFrame.__set_properties
133
    def __set_properties(self):
136
        self.SetTitle("VibrationTest")
Line 134... Line 137...
134
        # begin wxGlade: MainFrame.__set_properties
137
        self.GraphPanel.SetMinSize((800,300))
135
        self.SetTitle("VibrationTest")
138
        self.yAxesChoice.SetSelection(2)
136
        self.GraphPanel.SetMinSize((800,300))
139
        self.graphTypeChoise.SetSelection(0)
Line 160... Line 163...
160
        grid_sizer_1.Add(self.label_8, 0, wx.ALIGN_RIGHT, 0)
163
        grid_sizer_1.Add(self.label_8, 0, wx.ALIGN_RIGHT, 0)
161
        grid_sizer_1.Add(self.text_ctrl_8, 0, 0, 0)
164
        grid_sizer_1.Add(self.text_ctrl_8, 0, 0, 0)
162
        grid_sizer_1.Add(self.button_1, 0, 0, 0)
165
        grid_sizer_1.Add(self.button_1, 0, 0, 0)
163
        sizer_1.Add(grid_sizer_1, 0, 0, 2)
166
        sizer_1.Add(grid_sizer_1, 0, 0, 2)
164
        sizer_1.Add((20, 20), 0, 0, 0)
167
        sizer_1.Add((20, 20), 0, 0, 0)
165
        sizer_1.Add(self.GraphPanel, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
168
        sizer_1.Add(self.GraphPanel, 1, 0, 0)
166
        sizer_2.Add(self.choice_3, 0, 0, 0)
169
        sizer_2.Add(self.yAxesChoice, 0, 0, 0)
167
        sizer_2.Add(self.choice_4, 0, 0, 0)
170
        sizer_2.Add(self.graphTypeChoise, 0, 0, 0)
168
        sizer_1.Add(sizer_2, 0, wx.EXPAND, 0)
171
        sizer_1.Add(sizer_2, 0, wx.EXPAND, 0)
169
        sizer_1.Add((20, 20), 0, 0, 0)
172
        sizer_1.Add((20, 20), 0, 0, 0)
170
        grid_sizer_2.Add(self.TestListCtrl, 1, wx.ALL|wx.EXPAND, 0)
173
        grid_sizer_2.Add(self.TestListCtrl, 1, wx.ALL|wx.EXPAND, 0)
171
        sizer_1.Add(grid_sizer_2, 1, wx.EXPAND, 0)
174
        sizer_1.Add(grid_sizer_2, 1, wx.EXPAND, 0)
172
        self.SetSizer(sizer_1)
175
        self.SetSizer(sizer_1)
Line 227... Line 230...
227
        # -----------
230
        # -----------
Line 228... Line 231...
228
 
231
 
229
    def OnTestSelected(self, event):
232
    def OnTestSelected(self, event):
230
         testId = event.m_itemIndex
233
         testId = event.m_itemIndex
-
 
234
         print "Test Selected id=%d" % (testId)
-
 
235
         self.activeTestId = testId
Line -... Line 236...
-
 
236
         self.drawGraph()
231
         print "Test Selected id=%d" % (testId)
237
 
232
 
238
    def drawGraph(self):
-
 
239
         vibTest = self.app.getTest(self.activeTestId)
Line 233... Line 240...
233
         vibTest = self.app.getTest(testId)
240
         nb = vibTest.getDataLen()
234
         nb = vibTest.getDataLen()
241
         y = int(self.yAxesChoice.GetStringSelection())
235
 
242
 
236
         self.client.Clear()
243
         self.client.Clear()
237
         xydata = _Numeric.arange(nb*2)
244
         xydata = _Numeric.arange(nb*2)
238
         xydata.shape = (nb, 2)
245
         xydata.shape = (nb, 2)
-
 
246
         xydata[:,1] = vibTest.getRawData()
Line 239... Line 247...
239
         xydata[:,1] = vibTest.getRawData()
247
         line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red')
240
         line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red')
248
         self.client.Draw(wx.lib.plot.PlotGraphics([line],"Graph Title", "Time", "Acc"), yAxis= (-y,y))
Line -... Line 249...
-
 
249
         self.client.SetEnableGrid('Horizontal')
-
 
250
 
-
 
251
 
241
         self.client.Draw(wx.lib.plot.PlotGraphics([line],"Graph Title", "Time", "Acc"), yAxis= (-100,100))
252
    def OnImport(self, event): # wxGlade: MainFrame.<event_handler>
Line 242... Line 253...
242
 
253
        self.app.Import()
243
 
254