Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 591 → Rev 592

/VibrationTest/trunk/VibrationTest/VibrationTestGui.py
117,8 → 117,8
self.text_ctrl_8 = wx.TextCtrl(self, -1, "")
self.button_1 = wx.Button(self, -1, "button_1")
self.GraphPanel = wx.Panel(self, -1, style=wx.DOUBLE_BORDER|wx.TAB_TRAVERSAL)
self.choice_3 = wx.Choice(self, -1, choices=[])
self.choice_4 = wx.Choice(self, -1, choices=[])
self.yAxesChoice = wx.ComboBox(self, -1, choices=["10", "25", "50", "100", "250"], style=wx.CB_DROPDOWN)
self.graphTypeChoise = wx.ComboBox(self, -1, choices=["Raw Data", "Filtered Data", "Spectrum"], style=wx.CB_DROPDOWN)
self.TestListCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
 
self.__set_properties()
125,6 → 125,7
self.__do_layout()
 
self.Bind(wx.EVT_MENU, self.OnImport, id=-1)
self.Bind(wx.EVT_COMBOBOX, self.onYAxesChange, self.yAxesChoice)
# end wxGlade
 
def setApp(self, app):
134,6 → 135,8
# begin wxGlade: MainFrame.__set_properties
self.SetTitle("VibrationTest")
self.GraphPanel.SetMinSize((800,300))
self.yAxesChoice.SetSelection(2)
self.graphTypeChoise.SetSelection(0)
# end wxGlade
 
def __do_layout(self):
162,9 → 165,9
grid_sizer_1.Add(self.button_1, 0, 0, 0)
sizer_1.Add(grid_sizer_1, 0, 0, 2)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add(self.GraphPanel, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
sizer_2.Add(self.choice_3, 0, 0, 0)
sizer_2.Add(self.choice_4, 0, 0, 0)
sizer_1.Add(self.GraphPanel, 1, 0, 0)
sizer_2.Add(self.yAxesChoice, 0, 0, 0)
sizer_2.Add(self.graphTypeChoise, 0, 0, 0)
sizer_1.Add(sizer_2, 0, wx.EXPAND, 0)
sizer_1.Add((20, 20), 0, 0, 0)
grid_sizer_2.Add(self.TestListCtrl, 1, wx.ALL|wx.EXPAND, 0)
229,9 → 232,13
def OnTestSelected(self, event):
testId = event.m_itemIndex
print "Test Selected id=%d" % (testId)
self.activeTestId = testId
self.drawGraph()
 
vibTest = self.app.getTest(testId)
def drawGraph(self):
vibTest = self.app.getTest(self.activeTestId)
nb = vibTest.getDataLen()
y = int(self.yAxesChoice.GetStringSelection())
 
self.client.Clear()
xydata = _Numeric.arange(nb*2)
238,12 → 245,16
xydata.shape = (nb, 2)
xydata[:,1] = vibTest.getRawData()
line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red')
self.client.Draw(wx.lib.plot.PlotGraphics([line],"Graph Title", "Time", "Acc"), yAxis= (-100,100))
self.client.Draw(wx.lib.plot.PlotGraphics([line],"Graph Title", "Time", "Acc"), yAxis= (-y,y))
self.client.SetEnableGrid('Horizontal')
 
 
def OnImport(self, event): # wxGlade: MainFrame.<event_handler>
self.app.Import()
 
def onYAxesChange(self, event): # wxGlade: MainFrame.<event_handler>
self.drawGraph()
 
# end of class MainFrame