Subversion Repositories Projects

Rev

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

Rev 632 Rev 633
Line 301... Line 301...
301
        wxglade_tmp_menu = wx.Menu()
301
        wxglade_tmp_menu = wx.Menu()
302
        wxglade_tmp_menu.Append(1099, "About", "", wx.ITEM_NORMAL)
302
        wxglade_tmp_menu.Append(1099, "About", "", wx.ITEM_NORMAL)
303
        self.frame_1_menubar.Append(wxglade_tmp_menu, "Help")
303
        self.frame_1_menubar.Append(wxglade_tmp_menu, "Help")
304
        self.SetMenuBar(self.frame_1_menubar)
304
        self.SetMenuBar(self.frame_1_menubar)
305
        # Menu Bar end
305
        # Menu Bar end
306
        self.Description = wx.StaticText(self, -1, "Description")
306
        self.label_1 = wx.StaticText(self, -1, "Test Description :", style=wx.ALIGN_RIGHT)
307
        self.tcDescr = wx.TextCtrl(self, -1, "Test")
307
        self.descrCtrl = wx.TextCtrl(self, -1, "N/A")
308
        self.label_37 = wx.StaticText(self, -1, "Speed(s)")
308
        self.label_2 = wx.StaticText(self, -1, "Channel(s) :", style=wx.ALIGN_RIGHT)
309
        self.tcSpeeds = wx.TextCtrl(self, -1, "100-200:10")
309
        self.accTopCb = wx.CheckBox(self, -1, "ACC Top")
310
        self.label_35 = wx.StaticText(self, -1, "Motor(s)")
310
        self.accRollCb = wx.CheckBox(self, -1, "ACC Roll")
311
        self.tcMotors = wx.TextCtrl(self, -1, "1")
311
        self.accNickCb = wx.CheckBox(self, -1, "ACC Nick")
312
        self.label_38 = wx.StaticText(self, -1, "")
312
        self.label_3 = wx.StaticText(self, -1, "Motor(s) :", style=wx.ALIGN_RIGHT)
313
        self.panel_2 = wx.Panel(self, -1)
313
        self.motorsCtrl = wx.TextCtrl(self, -1, "1")
314
        self.label_36 = wx.StaticText(self, -1, "Channel(s)")
314
        self.label_4 = wx.StaticText(self, -1, "Speed(s) :")
315
        self.tcChannels = wx.TextCtrl(self, -1, "6")
315
        self.speedCtrl = wx.TextCtrl(self, -1, "100-200:10")
316
        self.label_39 = wx.StaticText(self, -1, "")
316
        self.bitmap_button_1 = wx.BitmapButton(self, -1, wx.Bitmap("Resources\\Fairytale_player_play.png", wx.BITMAP_TYPE_ANY))
317
        self.panel_3 = wx.Panel(self, -1)
317
        self.static_line_1 = wx.StaticLine(self, -1)
318
        self.button_4 = wx.Button(self, -1, "Measure")
-
 
319
        self.graphCtrl = wx.lib.plot.PlotCanvas(self, size=(800,300))
318
        self.graphCtrl = wx.lib.plot.PlotCanvas(self, size=(800,300))
320
        self.label_40 = wx.StaticText(self, -1, "Graph Type ")
319
        self.label_40 = wx.StaticText(self, -1, "Graph Type ")
321
        self.graphTypeChoice = wx.Choice(self, -1, choices=["Raw Signal", "Filtered Signal", "Spectrum"])
320
        self.graphTypeChoice = wx.Choice(self, -1, choices=["Raw Signal", "Filtered Signal", "Spectrum"])
322
        self.label_41 = wx.StaticText(self, -1, "Y Axis Range ")
321
        self.label_41 = wx.StaticText(self, -1, "Y Axis Range ")
323
        self.yAxisChoice = wx.Choice(self, -1, choices=["25", "50", "100", "200"])
322
        self.yAxisChoice = wx.Choice(self, -1, choices=["25", "50", "100", "200"])
Line 333... Line 332...
333
        self.Bind(wx.EVT_MENU, self.onClearSelected, id=302)
332
        self.Bind(wx.EVT_MENU, self.onClearSelected, id=302)
334
        self.Bind(wx.EVT_MENU, self.onSelectAll, id=310)
333
        self.Bind(wx.EVT_MENU, self.onSelectAll, id=310)
335
        self.Bind(wx.EVT_MENU, self.OnImport, id=303)
334
        self.Bind(wx.EVT_MENU, self.OnImport, id=303)
336
        self.Bind(wx.EVT_MENU, self.onExport, id=304)
335
        self.Bind(wx.EVT_MENU, self.onExport, id=304)
337
        self.Bind(wx.EVT_MENU, self.onAbout, id=1099)
336
        self.Bind(wx.EVT_MENU, self.onAbout, id=1099)
338
        self.Bind(wx.EVT_BUTTON, self.onStartMeasure, self.button_4)
337
        self.Bind(wx.EVT_BUTTON, self.onStartMeasure, self.bitmap_button_1)
339
        self.Bind(wx.EVT_CHOICE, self.onGraphTypeChange, self.graphTypeChoice)
338
        self.Bind(wx.EVT_CHOICE, self.onGraphTypeChange, self.graphTypeChoice)
340
        self.Bind(wx.EVT_CHOICE, self.onYAxisChange, self.yAxisChoice)
339
        self.Bind(wx.EVT_CHOICE, self.onYAxisChange, self.yAxisChoice)
341
        self.Bind(wx.EVT_BUTTON, self.onCopyGraphData, self.copyGraphButton)
340
        self.Bind(wx.EVT_BUTTON, self.onCopyGraphData, self.copyGraphButton)
342
        # end wxGlade
341
        # end wxGlade
343
        favicon = wx.Icon('%s/Resources/60px-Procman.ico' % rootPath, wx.BITMAP_TYPE_ICO, 32, 32)
342
        favicon = wx.Icon('%s/Resources/60px-Procman.ico' % rootPath, wx.BITMAP_TYPE_ICO, 32, 32)
344
        wx.Frame.SetIcon(self, favicon)
343
        wx.Frame.SetIcon(self, favicon)
-
 
344
       
Line 345... Line 345...
345
 
345
 
346
    def setApp(self, app):
346
    def setApp(self, app):
Line 347... Line 347...
347
        self.app = app
347
        self.app = app
348
 
348
 
349
    def __set_properties(self):
349
    def __set_properties(self):
350
        # begin wxGlade: MainFrame.__set_properties
350
        # begin wxGlade: MainFrame.__set_properties
-
 
351
        self.SetTitle("VibrationTest")
-
 
352
        self.SetSize((850, 700))
351
        self.SetTitle("VibrationTest")
353
        self.label_1.SetMinSize((110, -1))
-
 
354
        self.label_1.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
-
 
355
        self.descrCtrl.SetMinSize((350, -1))
-
 
356
        self.label_2.SetMinSize((110, -1))
-
 
357
        self.label_2.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
-
 
358
        self.accTopCb.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
-
 
359
        self.accRollCb.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
352
        self.SetSize((850, 700))
360
        self.accRollCb.SetValue(1)
-
 
361
        self.accNickCb.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
-
 
362
        self.label_3.SetMinSize((110, -1))
-
 
363
        self.label_3.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
-
 
364
        self.label_4.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
-
 
365
        self.speedCtrl.SetToolTipString("e.g. \n 100 \n 100,150 \n 100-200:10")
-
 
366
        self.bitmap_button_1.SetToolTipString("Start Measurement")
353
        self.Description.SetMinSize((53, 13))
367
        self.bitmap_button_1.SetSize(self.bitmap_button_1.GetBestSize())
-
 
368
        self.static_line_1.SetMinSize((800,3))
354
        self.button_4.SetMinSize((80, 80))
369
        self.graphCtrl.SetMinSize((800,300))
-
 
370
        self.label_40.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
355
        self.graphCtrl.SetMinSize((800,300))
371
        self.graphTypeChoice.SetSelection(0)
-
 
372
        self.label_41.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
356
        self.graphTypeChoice.SetSelection(0)
373
        self.yAxisChoice.SetSelection(1)
-
 
374
        self.copyGraphButton.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
357
        self.yAxisChoice.SetSelection(1)
375
        self.TestListCtrl.SetMinSize((800,300))
Line 358... Line 376...
358
        self.TestListCtrl.SetMinSize((800,300))
376
        self.TestListCtrl.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
359
        # end wxGlade
377
        # end wxGlade
360
 
378
 
361
    def __do_layout(self):
379
    def __do_layout(self):
362
        # begin wxGlade: MainFrame.__do_layout
380
        # begin wxGlade: MainFrame.__do_layout
363
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
381
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
-
 
382
        sizer_8 = wx.BoxSizer(wx.VERTICAL)
364
        sizer_8 = wx.BoxSizer(wx.VERTICAL)
383
        sizer_11 = wx.BoxSizer(wx.VERTICAL)
365
        sizer_11 = wx.BoxSizer(wx.VERTICAL)
384
        sizer_12 = wx.BoxSizer(wx.HORIZONTAL)
366
        sizer_12 = wx.BoxSizer(wx.HORIZONTAL)
385
        sizer_17 = wx.BoxSizer(wx.VERTICAL)
-
 
386
        sizer_9 = wx.BoxSizer(wx.HORIZONTAL)
-
 
387
        sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
-
 
388
        sizer_13 = wx.BoxSizer(wx.VERTICAL)
367
        sizer_9 = wx.BoxSizer(wx.HORIZONTAL)
389
        sizer_16 = wx.BoxSizer(wx.HORIZONTAL)
368
        sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
390
        sizer_15 = wx.BoxSizer(wx.HORIZONTAL)
369
        grid_sizer_1 = wx.GridSizer(3, 4, 4, 5)
391
        sizer_14 = wx.BoxSizer(wx.HORIZONTAL)
370
        sizer_3.Add((20, 20), 0, 0, 0)
392
        sizer_3.Add((20, 20), 0, 0, 0)
371
        sizer_8.Add((20, 20), 0, 0, 0)
393
        sizer_8.Add((20, 20), 0, 0, 0)
-
 
394
        sizer_14.Add(self.label_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
372
        grid_sizer_1.Add(self.Description, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
395
        sizer_14.Add((20, 20), 0, 0, 0)
373
        grid_sizer_1.Add(self.tcDescr, 0, 0, 0)
396
        sizer_14.Add(self.descrCtrl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
374
        grid_sizer_1.Add(self.label_37, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
397
        sizer_13.Add(sizer_14, 1, wx.EXPAND, 0)
375
        grid_sizer_1.Add(self.tcSpeeds, 0, 0, 0)
398
        sizer_13.Add((20, 5), 0, 0, 0)
376
        grid_sizer_1.Add(self.label_35, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
399
        sizer_15.Add(self.label_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
377
        grid_sizer_1.Add(self.tcMotors, 0, 0, 0)
400
        sizer_15.Add((20, 20), 0, 0, 0)
378
        grid_sizer_1.Add(self.label_38, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
401
        sizer_15.Add(self.accTopCb, 0, wx.ALIGN_CENTER_VERTICAL, 0)
379
        grid_sizer_1.Add(self.panel_2, 1, wx.EXPAND, 0)
402
        sizer_15.Add((20, 20), 0, 0, 0)
380
        grid_sizer_1.Add(self.label_36, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
403
        sizer_15.Add(self.accRollCb, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-
 
404
        sizer_15.Add((20, 20), 0, 0, 0)
-
 
405
        sizer_15.Add(self.accNickCb, 0, wx.ALIGN_CENTER_VERTICAL, 0)
381
        grid_sizer_1.Add(self.tcChannels, 0, 0, 0)
406
        sizer_13.Add(sizer_15, 1, wx.EXPAND, 0)
-
 
407
        sizer_13.Add((20, 5), 0, 0, 0)
382
        grid_sizer_1.Add(self.label_39, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
408
        sizer_16.Add(self.label_3, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-
 
409
        sizer_16.Add((20, 20), 0, 0, 0)
-
 
410
        sizer_16.Add(self.motorsCtrl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
383
        grid_sizer_1.Add(self.panel_3, 1, wx.EXPAND, 0)
411
        sizer_16.Add((50, 20), 0, 0, 0)
-
 
412
        sizer_16.Add(self.label_4, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
384
        sizer_9.Add(grid_sizer_1, 0, 0, 0)
413
        sizer_16.Add((20, 20), 0, 0, 0)
-
 
414
        sizer_16.Add(self.speedCtrl, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-
 
415
        sizer_13.Add(sizer_16, 1, wx.EXPAND, 0)
-
 
416
        sizer_7.Add(sizer_13, 1, wx.EXPAND, 0)
-
 
417
        sizer_7.Add((20, 20), 0, 0, 0)
385
        sizer_10.Add((50, 20), 0, 0, 0)
418
        sizer_7.Add((20, 20), 0, 0, 0)
386
        sizer_10.Add(self.button_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
419
        sizer_9.Add(sizer_7, 1, wx.EXPAND, 0)
-
 
420
        sizer_9.Add(self.bitmap_button_1, 0, 0, 0)
-
 
421
        sizer_8.Add(sizer_9, 0, 0, 0)
-
 
422
        sizer_17.Add((20, 20), 0, 0, 0)
387
        sizer_9.Add(sizer_10, 1, wx.EXPAND, 0)
423
        sizer_17.Add(self.static_line_1, 0, wx.EXPAND, 0)
388
        sizer_8.Add(sizer_9, 0, 0, 0)
424
        sizer_17.Add((20, 20), 0, 0, 0)
389
        sizer_8.Add((20, 30), 0, 0, 0)
425
        sizer_8.Add(sizer_17, 0, wx.EXPAND, 0)
390
        sizer_11.Add(self.graphCtrl, 1, wx.EXPAND, 0)
426
        sizer_11.Add(self.graphCtrl, 1, wx.EXPAND, 0)
391
        sizer_11.Add((20, 5), 0, 0, 0)
427
        sizer_11.Add((20, 5), 0, 0, 0)
Line 459... Line 495...
459
        self.TestListCtrl.SetStringItem(index, 1, "%.1f V" %test.voltage)
495
        self.TestListCtrl.SetStringItem(index, 1, "%.1f V" %test.voltage)
460
        self.TestListCtrl.SetStringItem(index, 2, str(test.speed))
496
        self.TestListCtrl.SetStringItem(index, 2, str(test.speed))
461
        self.TestListCtrl.SetStringItem(index, 3, test.channel)
497
        self.TestListCtrl.SetStringItem(index, 3, test.channel)
Line 462... Line 498...
462
 
498
 
463
        vv = int(test.getVibValue(self.app.settings["hpf"].value, self.app.settings["lpf"].value))
499
        vv = int(test.getVibValue(self.app.settings["hpf"].value, self.app.settings["lpf"].value))
464
        vvs = "|%s| (%d)" % ("----------------------------------------------------------------------------------------------------"[0:min(vv,100)], vv)
500
        vvs = "|%s| (%d)" % ("----------------------------------------------------------------------------------------------------"[0:min(vv/2,100)], vv)
465
        self.TestListCtrl.SetStringItem(index, 4, vvs)
501
        self.TestListCtrl.SetStringItem(index, 4, vvs)
Line 466... Line 502...
466
        self.TestListCtrl.Select(index)
502
        self.TestListCtrl.Select(index)
Line 592... Line 628...
592
        self.app.onSettingsChanged()
628
        self.app.onSettingsChanged()
Line 593... Line 629...
593
 
629
 
594
    def onStartMeasure(self, event): # wxGlade: MainFrame.<event_handler>
630
    def onStartMeasure(self, event): # wxGlade: MainFrame.<event_handler>
595
        # Collect measure parameters
631
        # Collect measure parameters
596
        mp = MeasureParameters()
632
        mp = MeasureParameters()
597
        mp.descr = self.tcDescr.GetValue()
633
        mp.descr = self.descrCtrl.GetValue()
-
 
634
        mp.motors = map(int,self.motorsCtrl.GetValue().split(','))
598
        mp.motors = map(int,self.tcMotors.GetValue().split(','))
635
        mp.channels = []
-
 
636
        if self.accTopCb.IsChecked(): mp.channels.append(5)
-
 
637
        if self.accRollCb.IsChecked(): mp.channels.append(6)
599
        mp.channels = map(int,self.tcChannels.GetValue().split(','))
638
        if self.accNickCb.IsChecked(): mp.channels.append(7)
600
        s = self.tcSpeeds.GetValue()
639
        s = self.speedCtrl.GetValue()
601
        if s=="test":
640
        if s=="test":
602
          mp.speeds = (100,100,100,100,100, 150,150,150,150,150, 200,200,200,200,200, 100,150,200, 100,150,200, 100,150,200, 100,150,200)
641
          mp.speeds = (100,100,100,100,100, 150,150,150,150,150, 200,200,200,200,200, 100,150,200, 100,150,200, 100,150,200, 100,150,200)
603
        elif s.count("-") == 1:
642
        elif s.count("-") == 1:
604
            # assume from-to:step format
643
            # assume from-to:step format
Line 608... Line 647...
608
            if len(s[1]) != 2: raise Exception("Invalid format")
647
            if len(s[1]) != 2: raise Exception("Invalid format")
609
            mp.speeds = range(int(s[0]),int(s[1][0])+int(s[1][1]),int(s[1][1]))
648
            mp.speeds = range(int(s[0]),int(s[1][0])+int(s[1][1]),int(s[1][1]))
610
        else:
649
        else:
611
            mp.speeds = map(int,s.split(','))
650
            mp.speeds = map(int,s.split(','))
Line -... Line 651...
-
 
651
           
-
 
652
        print mp.descr
-
 
653
        print mp.motors
-
 
654
        print mp.channels
-
 
655
        print mp.speeds
-
 
656
       
Line 612... Line 657...
612
           
657
           
613
       
658
       
614
        # create the dialog that will show the satus
659
        # create the dialog that will show the satus