Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 584 → Rev 585

/VibrationTest/trunk/VibrationTest/VibrationTestGui.py
3,12 → 3,71
# generated by wxGlade 0.6.3 on Thu Sep 24 15:46:36 2009
 
import wx
import wx.lib
import wx.lib.plot
 
# Needs Numeric or numarray or NumPy
try:
import numpy.oldnumeric as _Numeric
except:
try:
import numarray as _Numeric #if numarray is used it is renamed Numeric
except:
try:
import Numeric as _Numeric
except:
msg= """
This module requires the Numeric/numarray or NumPy module,
which could not be imported. It probably is not installed
(it's not part of the standard Python distribution). See the
Numeric Python site (http://numpy.scipy.org) for information on
downloading source or binaries."""
raise ImportError, "Numeric,numarray or NumPy not found. \n" + msg
 
# begin wxGlade: extracode
# end wxGlade
 
 
 
class wxFrame(wx.Panel):
def __init__(self, *args, **kwds):
# begin wxGlade: wxFrame.__init__
kwds["style"] = wx.TAB_TRAVERSAL
wx.Panel.__init__(self, *args, **kwds)
 
self.__set_properties()
self.__do_layout()
# end wxGlade
 
def __set_properties(self):
# begin wxGlade: wxFrame.__set_properties
pass
# end wxGlade
 
def __do_layout(self):
# begin wxGlade: wxFrame.__do_layout
pass
# end wxGlade
 
# end of class wxFrame
 
 
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# content of this block not found: did you rename this class?
pass
 
def __set_properties(self):
# content of this block not found: did you rename this class?
pass
 
def __do_layout(self):
# content of this block not found: did you rename this class?
pass
 
# end of class MyFrame
 
 
class MainFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MainFrame.__init__
31,14 → 90,19
self.label_8 = wx.StaticText(self, -1, "label_8")
self.text_ctrl_8 = wx.TextCtrl(self, -1, "")
self.button_1 = wx.Button(self, -1, "button_1")
self.GraphFanel = wx.Panel(self, -1)
self.panel_1 = wxFrame(self, -1)
 
self.__set_properties()
self.__do_layout()
# end wxGlade
 
 
def __set_properties(self):
# begin wxGlade: MainFrame.__set_properties
self.SetTitle("frame_1")
self.GraphFanel.SetMinSize((800,300))
# end wxGlade
 
def __do_layout(self):
63,12 → 127,59
grid_sizer_1.Add(self.text_ctrl_8, 0, 0, 0)
grid_sizer_1.Add(self.button_1, 0, 0, 0)
sizer_1.Add(grid_sizer_1, 0, 0, 2)
sizer_1.Add((20, 20), 1, wx.EXPAND, 0)
sizer_1.Add(self.GraphFanel, 0, wx.EXPAND, 0)
sizer_1.Add(self.panel_1, 1, wx.ALL|wx.EXPAND, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
 
 
self.client = wx.lib.plot.PlotCanvas(self.GraphFanel)
#define the function for drawing pointLabels
self.client.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.client.SetXSpec('auto')
self.client.SetYSpec('auto')
 
data1 = 2.*_Numeric.pi*_Numeric.arange(200)/200.
data1.shape = (100, 2)
data1[:,1] = _Numeric.sin(data1[:,0])
markers1 = wx.lib.plot.PolyMarker(data1, legend='Green Markers', colour='green', marker='circle',size=1)
pi = 3.1415
markers2 = wx.lib.plot.PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
(3.*pi/4., -1)], legend='Cross Legend', colour='blue',
marker='cross')
self.client.Draw(wx.lib.plot.PlotGraphics([markers1,markers2],"Graph Title", "X Axis", "Y Axis"))
def DrawPointLabel(self, dc, mDataDict):
"""This is the fuction that defines how the pointLabels are plotted
dc - DC that will be passed
mDataDict - Dictionary of data that you want to use for the pointLabel
 
As an example I have decided I want a box at the curve point
with some text information about the curve plotted below.
Any wxDC method can be used.
"""
# ----------
dc.SetPen(wx.Pen(wx.BLACK))
dc.SetBrush(wx.Brush( wx.BLACK, wx.SOLID ) )
sx, sy = mDataDict["scaledXY"] #scaled x,y of closest point
dc.DrawRectangle( sx-5,sy-5, 10, 10) #10by10 square centered on point
px,py = mDataDict["pointXY"]
cNum = mDataDict["curveNum"]
pntIn = mDataDict["pIndex"]
legend = mDataDict["legend"]
#make a string to display
s = "Crv# %i, '%s', Pt. (%.2f,%.2f), PtInd %i" %(cNum, legend, px, py, pntIn)
dc.DrawText(s, sx , sy+1)
# -----------
 
# end of class MainFrame
 
 
/VibrationTest/trunk/VibrationTest/VibrationTestGui.wxg
1,7 → 1,7
<?xml version="1.0"?>
<!-- generated by wxGlade 0.6.3 on Thu Sep 24 15:45:48 2009 -->
<!-- generated by wxGlade 0.6.3 on Fri Sep 25 16:55:51 2009 -->
 
<application path="" 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.8" is_template="0">
<application path="D:\Fred\MK_Proj\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">
<style>wxDEFAULT_FRAME_STYLE</style>
<title>frame_1</title>
150,13 → 150,20
<object class="sizeritem">
<flag>wxEXPAND</flag>
<border>0</border>
<option>0</option>
<object class="wxPanel" name="GraphFanel" base="EditPanel">
<style>wxTAB_TRAVERSAL</style>
<size>800,300</size>
</object>
</object>
<object class="sizeritem">
<flag>wxALL|wxEXPAND</flag>
<border>0</border>
<option>1</option>
<object class="spacer" name="spacer" base="EditSpacer">
<height>20</height>
<width>20</width>
<object class="wxFrame" name="panel_1" base="EditPanel">
<style>wxTAB_TRAVERSAL</style>
</object>
</object>
<object class="sizerslot" />
</object>
</object>
</application>