Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 625 → Rev 626

/VibrationTest/trunk/VibrationTest/VibrationTestGui.py
22,6 → 22,8
FS = 11111
pi = 3.14
 
rootPath = ""
 
# Needs Numeric or numarray or NumPy
try:
import numpy.oldnumeric as _Numeric
51,12 → 53,13
class MeasureDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: MeasureDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME
kwds["style"] = wx.CAPTION|wx.RESIZE_BORDER|wx.THICK_FRAME
wx.Dialog.__init__(self, *args, **kwds)
self.text_ctrl_1 = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
self.button = wx.Button(self, -1, "STOP")
self.voltageCtrl = speedmeter.SpeedMeter(self, extrastyle=speedmeter.SM_DRAW_HAND | speedmeter.SM_DRAW_PARTIAL_SECTORS | speedmeter.SM_DRAW_MIDDLE_ICON )
self.speedCtrl = speedmeter.SpeedMeter(self, extrastyle=speedmeter.SM_DRAW_HAND | speedmeter.SM_DRAW_PARTIAL_SECTORS | speedmeter.SM_DRAW_MIDDLE_TEXT | speedmeter.SM_DRAW_SECONDARY_TICKS)
 
self.__set_properties()
self.__do_layout()
 
63,10 → 66,11
self.Bind(wx.EVT_BUTTON, self.onButton, self.button)
# end wxGlade
self.button.SetFocus()
YELLOW = wx.Colour(255, 240, 0)
BG = wx.Colour(0x80, 0x80, 0x80)
# Configure Voltage Ctrl
#self.voltageCtrl.SetAngleRange(-3.14/3, 3.14/3)
self.voltageCtrl.SetAngleRange(0,pi)
intervals = range(0, 5)
self.voltageCtrl.SetIntervals(intervals)
77,7 → 81,7
self.voltageCtrl.SetTicksColour(wx.WHITE)
self.voltageCtrl.SetHandColour(YELLOW)
 
icon = wx.Icon("fuel.ico", wx.BITMAP_TYPE_ICO)
icon = wx.Icon("%s/Resources/fuel.ico" % rootPath, wx.BITMAP_TYPE_ICO)
icon.SetWidth(24)
icon.SetHeight(24)
 
88,7 → 92,6
 
 
# Configure Speed Ctr;
#self.speedCtrl.SetAngleRange(-pi/6, 7*pi/6)
self.speedCtrl.SetAngleRange(0,pi)
intervals = range(0, 261, 20)
self.speedCtrl.SetIntervals(intervals)
290,8 → 293,11
wxglade_tmp_menu.Append(304, "Save", "", wx.ITEM_NORMAL)
self.frame_1_menubar.Append(wxglade_tmp_menu, "TestSet")
wxglade_tmp_menu = wx.Menu()
wxglade_tmp_menu.Append(401, "Flash VibTest FC software", "", wx.ITEM_NORMAL)
wxglade_tmp_menu.Append(402, "Restore original FC software", "", wx.ITEM_NORMAL)
self.frame_1_menubar.Append(wxglade_tmp_menu, "MK")
wxglade_tmp_menu = wx.Menu()
wxglade_tmp_menu.Append(1099, "About", "", wx.ITEM_NORMAL)
self.frame_1_menubar.Append(wxglade_tmp_menu, "Help")
self.SetMenuBar(self.frame_1_menubar)
# Menu Bar end
302,13 → 308,13
self.label_35 = wx.StaticText(self, -1, "Motor(s)")
self.tcMotors = wx.TextCtrl(self, -1, "1")
self.label_38 = wx.StaticText(self, -1, "")
self.text_ctrl_10 = wx.TextCtrl(self, -1, "")
self.panel_2 = wx.Panel(self, -1)
self.label_36 = wx.StaticText(self, -1, "Channel(s)")
self.tcChannels = wx.TextCtrl(self, -1, "6")
self.label_39 = wx.StaticText(self, -1, "")
self.text_ctrl_11 = wx.TextCtrl(self, -1, "")
self.button_4 = wx.Button(self, -1, "Start")
self.GraphPanel = wx.Panel(self, -1)
self.panel_3 = wx.Panel(self, -1)
self.button_4 = wx.Button(self, -1, "Measure")
self.graphCtrl = wx.lib.plot.PlotCanvas(self, size=(800,300))
self.label_40 = wx.StaticText(self, -1, "Graph Type ")
self.graphTypeChoice = wx.Choice(self, -1, choices=["Raw Signal", "Filtered Signal", "Spectrum"])
self.label_41 = wx.StaticText(self, -1, "Y Axis Range ")
319,14 → 325,18
self.__do_layout()
 
self.Bind(wx.EVT_MENU, self.OnSettings, id=101)
self.Bind(wx.EVT_MENU, self.onExit, id=150)
self.Bind(wx.EVT_MENU, self.onClear, id=301)
self.Bind(wx.EVT_MENU, self.onClearSelected, id=302)
self.Bind(wx.EVT_MENU, self.OnImport, id=303)
self.Bind(wx.EVT_MENU, self.onExport, id=304)
self.Bind(wx.EVT_MENU, self.onAbout, id=1099)
self.Bind(wx.EVT_BUTTON, self.onStartMeasure, self.button_4)
self.Bind(wx.EVT_CHOICE, self.onGraphTypeChange, self.graphTypeChoice)
self.Bind(wx.EVT_CHOICE, self.onYAxisChange, self.yAxisChoice)
# end wxGlade
favicon = wx.Icon('%s/Resources/60px-Procman.ico' % rootPath, wx.BITMAP_TYPE_ICO, 32, 32)
wx.Frame.SetIcon(self, favicon)
 
def setApp(self, app):
self.app = app
337,7 → 347,7
self.SetSize((850, 700))
self.Description.SetMinSize((53, 13))
self.button_4.SetMinSize((80, 80))
self.GraphPanel.SetMinSize((800,300))
self.graphCtrl.SetMinSize((800,300))
self.graphTypeChoice.SetSelection(0)
self.yAxisChoice.SetSelection(1)
self.TestListCtrl.SetMinSize((800,300))
361,11 → 371,11
grid_sizer_1.Add(self.label_35, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(self.tcMotors, 0, 0, 0)
grid_sizer_1.Add(self.label_38, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(self.text_ctrl_10, 0, 0, 0)
grid_sizer_1.Add(self.panel_2, 1, wx.EXPAND, 0)
grid_sizer_1.Add(self.label_36, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(self.tcChannels, 0, 0, 0)
grid_sizer_1.Add(self.label_39, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(self.text_ctrl_11, 0, 0, 0)
grid_sizer_1.Add(self.panel_3, 1, wx.EXPAND, 0)
sizer_9.Add(grid_sizer_1, 0, 0, 0)
sizer_10.Add((50, 20), 0, 0, 0)
sizer_10.Add(self.button_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
372,7 → 382,7
sizer_9.Add(sizer_10, 1, wx.EXPAND, 0)
sizer_8.Add(sizer_9, 0, 0, 0)
sizer_8.Add((20, 30), 0, 0, 0)
sizer_11.Add(self.GraphPanel, 1, wx.EXPAND, 0)
sizer_11.Add(self.graphCtrl, 1, wx.EXPAND, 0)
sizer_11.Add((20, 5), 0, 0, 0)
sizer_12.Add(self.label_40, 0, wx.ALIGN_CENTER_VERTICAL, 0)
sizer_12.Add(self.graphTypeChoice, 0, 0, 0)
394,14 → 404,14
self.TestListCtrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnTestSelected, self.TestListCtrl)
 
# Configure Graph
self.client = wx.lib.plot.PlotCanvas(self.GraphPanel, size=(800,300))
#self.graphCtrl = wx.lib.plot.PlotCanvas(self.GraphPanel, size=(800,300))
self.client.SetPointLabelFunc(self.DrawPointLabel)
self.graphCtrl.SetPointLabelFunc(self.DrawPointLabel)
self.client.SetFont(wx.Font(10,wx.SWISS,wx.NORMAL,wx.NORMAL))
self.client.SetFontSizeAxis(10)
self.client.SetFontSizeLegend(7)
self.client.setLogScale((False,False))
self.graphCtrl.SetFont(wx.Font(10,wx.SWISS,wx.NORMAL,wx.NORMAL))
self.graphCtrl.SetFontSizeAxis(10)
self.graphCtrl.SetFontSizeLegend(7)
self.graphCtrl.setLogScale((False,False))
 
 
# Configure TestListCtrl
462,7 → 472,7
nbSelected = self.TestListCtrl.SelectedItemCount
 
if nbSelected == 0:
self.client.Clear()
self.graphCtrl.Clear()
elif nbSelected > 1:
self.graphTypeChoice.Disable()
476,8 → 486,8
line = wx.lib.plot.PolyLine(data, legend= 'Vibrations', colour='red', width=2)
markers = wx.lib.plot.PolyMarker(data, legend= '', colour='red', marker='circle',size=2)
title = "Comparing tests"
self.client.Draw(wx.lib.plot.PlotGraphics([line, markers], title, "Test", "Vibration Value"), xAxis=(1,max(x,10)), yAxis=(0,y))
self.client.SetEnableGrid('Horizontal')
self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line, markers], title, "Test", "Vibration Value"), xAxis=(1,max(x,10)), yAxis=(0,y))
self.graphCtrl.SetEnableGrid('Horizontal')
 
else:
self.graphTypeChoice.Enable()
491,8 → 501,8
line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
title = "Raw Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
self.client.SetEnableGrid('Horizontal')
self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
self.graphCtrl.SetEnableGrid('Horizontal')
if self.graphTypeChoice.GetSelection() == 1:
xydata = _Numeric.linspace(0,0.09*nb,2*nb)
501,8 → 511,8
line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
title = "Filtered Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
self.client.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
self.client.SetEnableGrid('Horizontal')
self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
self.graphCtrl.SetEnableGrid('Horizontal')
elif self.graphTypeChoice.GetSelection() == 2:
xydata = _Numeric.linspace(0,FS/2,nb)
519,8 → 529,8
filterLine2 = wx.lib.plot.PolyLine(((fc,0),(fc,y)), legend='HP Filter', colour='Black', width=4)
title = "Spectrum: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
self.client.Draw(wx.lib.plot.PlotGraphics([line,markers, filterLine1, filterLine2], title, "Freq (Hz)", "Acc"), xAxis=(0,200), yAxis= (-0,y))
self.client.SetEnableGrid(True)
self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line,markers, filterLine1, filterLine2], title, "Freq (Hz)", "Acc"), xAxis=(0,200), yAxis= (-0,y))
self.graphCtrl.SetEnableGrid(True)
 
 
def OnImport(self, event): # wxGlade: MainFrame.<event_handler>
616,6 → 626,35
self._removeTest(idx)
def onCopyData(self, event): # wxGlade: MainFrame.<event_handler>
clipdata = wx.TextDataObject()
txt = ""
idx = self.TestListCtrl.GetFirstSelected()
while idx != -1:
txt += ("%d\n" % self.app.getTest(idx).getVibValue(self.app.settings["hpf"].value, self.app.settings["lpf"].value))
idx = self.TestListCtrl.GetNextSelected(idx)
clipdata.SetText(txt)
wx.TheClipboard.Open()
wx.TheClipboard.SetData(clipdata)
wx.TheClipboard.Close()
 
def onAbout(self, event): # wxGlade: MainFrame.<event_handler>
# First we create and fill the info object
print "about"
info = wx.AboutDialogInfo()
info.Name = "MK Vibration Test"
info.Version = "0.2"
info.Copyright = ""
info.Developers=["Frederic Goddeeris"]
info.Description = "Please consult the WIKI page for a complete description of the tool:"
info.WebSite = ("http://www.mikrokopter.de/ucwiki/en/VibrationTest", "VibrationTest WIKI page")
wx.AboutBox(info)
def onExit(self, event): # wxGlade: MainFrame.<event_handler>
self.Close(True)
 
 
# end of class MainFrame
 
class Setting:
961,5 → 1000,10
# end of class App
 
if __name__ == "__main__":
 
rootPath = os.path.abspath(os.path.dirname(sys.argv[0]))
print rootPath
 
VibrationTestGui = App(0)
VibrationTestGui.MainLoop()
/VibrationTest/trunk/VibrationTest/VibrationTestGui.wxg
1,5 → 1,5
<?xml version="1.0"?>
<!-- generated by wxGlade 0.6.3 on Mon Oct 05 03:20:42 2009 -->
<!-- generated by wxGlade 0.6.3 on Tue Oct 06 22:57:54 2009 -->
 
<application path="C:\DATA\MK\SVN\Projects\VibrationTest\trunk\VibrationTest\VibrationTestGui.py" name="VibrationTestGui" class="App" option="0" language="python" top_window="frame_1" encoding="ISO-8859-15" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6" is_template="0">
<object class="MainFrame" name="frame_1" base="EditFrame">
23,6 → 23,7
<item>
<label>Exit</label>
<id>150</id>
<handler>onExit</handler>
</item>
</menu>
<menu name="" itemid="300" label="TestSet">
52,9 → 53,22
<handler>onExport</handler>
</item>
</menu>
<menu name="" label="MK">
<menu name="" itemid="400" label="MK">
<item>
<label>Flash VibTest FC software</label>
<id>401</id>
</item>
<item>
<label>Restore original FC software</label>
<id>402</id>
</item>
</menu>
<menu name="" label="Help">
<menu name="" itemid="1000" label="Help">
<item>
<label>About</label>
<id>1099</id>
<handler>onAbout</handler>
</item>
</menu>
</menus>
</object>
153,9 → 167,11
</object>
</object>
<object class="sizeritem">
<flag>wxEXPAND</flag>
<border>0</border>
<option>0</option>
<object class="wxTextCtrl" name="text_ctrl_10" base="EditTextCtrl">
<option>1</option>
<object class="wxPanel" name="panel_2" base="EditPanel">
<style>wxTAB_TRAVERSAL</style>
</object>
</object>
<object class="sizeritem">
183,9 → 199,11
</object>
</object>
<object class="sizeritem">
<flag>wxEXPAND</flag>
<border>0</border>
<option>0</option>
<object class="wxTextCtrl" name="text_ctrl_11" base="EditTextCtrl">
<option>1</option>
<object class="wxPanel" name="panel_3" base="EditPanel">
<style>wxTAB_TRAVERSAL</style>
</object>
</object>
</object>
209,7 → 227,7
<border>0</border>
<option>0</option>
<object class="wxButton" name="button_4" base="EditButton">
<label>Start</label>
<label>Measure</label>
<events>
<handler event="EVT_BUTTON">onStartMeasure</handler>
</events>
237,8 → 255,11
<flag>wxEXPAND</flag>
<border>0</border>
<option>1</option>
<object class="wxPanel" name="GraphPanel" base="EditPanel">
<style>wxTAB_TRAVERSAL</style>
<object class="wx.lib.plot.PlotCanvas" name="graphCtrl" base="CustomWidget">
<arguments>
<argument>$parent</argument>
<argument>size=(800,300)</argument>
</arguments>
<size>800,300</size>
</object>
</object>
444,7 → 465,7
</object>
</object>
<object class="MeasureDialog" name="MeasureDialog" base="EditDialog">
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxTHICK_FRAME</style>
<style>wxCAPTION|wxRESIZE_BORDER|wxTHICK_FRAME</style>
<title>Measuring Status</title>
<object class="wxBoxSizer" name="sizer_1" base="EditBoxSizer">
<orient>wxHORIZONTAL</orient>
541,7 → 562,7
<object class="speedmeter.SpeedMeter" name="speedCtrl" base="CustomWidget">
<arguments>
<argument>$parent</argument>
<argument>extrastyle=speedmeter.SM_DRAW_HAND | speedmeter.SM_DRAW_SECTORS | speedmeter.SM_DRAW_MIDDLE_TEXT | speedmeter.SM_DRAW_SECONDARY_TICKS</argument>
<argument>extrastyle=speedmeter.SM_DRAW_HAND | speedmeter.SM_DRAW_PARTIAL_SECTORS | speedmeter.SM_DRAW_MIDDLE_TEXT | speedmeter.SM_DRAW_SECONDARY_TICKS</argument>
</arguments>
<size>50,-1</size>
</object>
/VibrationTest/trunk/buildDist.sh
18,7 → 18,9
echo Python Code...
mkdir $DIST/VibrationTest -p
cd $DIST/VibrationTest
cp $HOME/VibrationTest/*.py ./
cp $HOME/VibrationTest/VibrationTestGui.py ./
cp $HOME/VibrationTest/mkProto.py ./
cp -a $HOME/VibrationTest/Resources ./
cp $HEXFILE ./
 
echo Compiled Python Code... | tee -a $LOG
36,6 → 38,7
mkdir $DIST/VibrationTestExe -p
cd $DIST/VibrationTestExe
cp $TMP/dist/* ./ -a
cp -a $HOME/VibrationTest/Resources ./
 
cp $HEXFILE ./