64,6 → 64,136 |
(MeasStatusUpdateEvent, EVT_MEAS_STATUS_UPDATE) = wx.lib.newevent.NewEvent() |
(MeasDataEvent, EVT_MEAS_DATA) = wx.lib.newevent.NewEvent() |
|
class MkSettingsDialog(wx.Frame): |
def __init__(self, *args, **kwds): |
# begin wxGlade: MkSettingsDialog.__init__ |
kwds["style"] = wx.DEFAULT_FRAME_STYLE |
wx.Frame.__init__(self, *args, **kwds) |
self.label_2 = wx.StaticText(self, -1, "Gyro-P", style=wx.ALIGN_RIGHT) |
self.slider_GyroP = wx.Slider(self, -1, 0, 0, 255, style=wx.SL_HORIZONTAL|wx.SL_LABELS) |
self.label_2_copy = wx.StaticText(self, -1, "Gyro-I", style=wx.ALIGN_RIGHT) |
self.slider_GyroI = wx.Slider(self, -1, 0, 0, 255, style=wx.SL_HORIZONTAL|wx.SL_LABELS) |
self.label_2_copy_1 = wx.StaticText(self, -1, "Gyro-D", style=wx.ALIGN_RIGHT) |
self.slider_GyroD = wx.Slider(self, -1, 0, 0, 255, style=wx.SL_HORIZONTAL|wx.SL_LABELS) |
self.label_2_copy_2 = wx.StaticText(self, -1, "Factor-I", style=wx.ALIGN_RIGHT) |
self.slider_FactorI = wx.Slider(self, -1, 0, 0, 255, style=wx.SL_HORIZONTAL|wx.SL_LABELS) |
self.label_2_copy_3 = wx.StaticText(self, -1, "", style=wx.ALIGN_RIGHT) |
self.slider_1_copy_3 = wx.Slider(self, -1, 0, 0, 255, style=wx.SL_HORIZONTAL|wx.SL_LABELS) |
self.loadButton = wx.Button(self, -1, "Load") |
self.storeButton = wx.Button(self, -1, "Store") |
|
self.__set_properties() |
self.__do_layout() |
|
self.Bind(wx.EVT_BUTTON, self.onLoad, self.loadButton) |
# end wxGlade |
|
def __set_properties(self): |
# begin wxGlade: MkSettingsDialog.__set_properties |
self.SetTitle("MK Settings") |
self.SetSize((600, 450)) |
self.label_2.SetMinSize((80, 16)) |
self.label_2.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) |
self.slider_GyroP.SetMinSize((400, -1)) |
self.slider_GyroP.SetBackgroundColour(wx.Colour(128, 128, 128)) |
self.label_2_copy.SetMinSize((80, 16)) |
self.label_2_copy.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) |
self.slider_GyroI.SetMinSize((400, -1)) |
self.slider_GyroI.SetBackgroundColour(wx.Colour(128, 128, 128)) |
self.label_2_copy_1.SetMinSize((80, 16)) |
self.label_2_copy_1.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) |
self.slider_GyroD.SetMinSize((400, -1)) |
self.slider_GyroD.SetBackgroundColour(wx.Colour(128, 128, 128)) |
self.label_2_copy_2.SetMinSize((80, 16)) |
self.label_2_copy_2.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) |
self.slider_FactorI.SetMinSize((400, -1)) |
self.slider_FactorI.SetBackgroundColour(wx.Colour(128, 128, 128)) |
self.label_2_copy_3.SetMinSize((80, 16)) |
self.label_2_copy_3.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) |
self.slider_1_copy_3.SetMinSize((400, -1)) |
self.slider_1_copy_3.SetBackgroundColour(wx.Colour(128, 128, 128)) |
# end wxGlade |
|
def __do_layout(self): |
# begin wxGlade: MkSettingsDialog.__do_layout |
sizer_15 = wx.BoxSizer(wx.VERTICAL) |
sizer_21 = wx.BoxSizer(wx.HORIZONTAL) |
sizer_22 = wx.BoxSizer(wx.VERTICAL) |
sizer_25 = wx.BoxSizer(wx.HORIZONTAL) |
sizer_23 = wx.BoxSizer(wx.VERTICAL) |
sizer_24_copy_3 = wx.BoxSizer(wx.HORIZONTAL) |
sizer_24_copy_2 = wx.BoxSizer(wx.HORIZONTAL) |
sizer_24_copy_1 = wx.BoxSizer(wx.HORIZONTAL) |
sizer_24_copy = wx.BoxSizer(wx.HORIZONTAL) |
sizer_24 = wx.BoxSizer(wx.HORIZONTAL) |
sizer_21.Add((20, 20), 0, 0, 0) |
sizer_22.Add((20, 20), 0, 0, 0) |
sizer_24.Add(self.label_2, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) |
sizer_24.Add((20, 20), 0, 0, 0) |
sizer_24.Add(self.slider_GyroP, 0, 0, 0) |
sizer_23.Add(sizer_24, 1, wx.EXPAND, 0) |
sizer_23.Add((20, 20), 0, 0, 0) |
sizer_24_copy.Add(self.label_2_copy, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) |
sizer_24_copy.Add((20, 20), 0, 0, 0) |
sizer_24_copy.Add(self.slider_GyroI, 0, 0, 0) |
sizer_23.Add(sizer_24_copy, 1, wx.EXPAND, 0) |
sizer_23.Add((20, 20), 0, 0, 0) |
sizer_24_copy_1.Add(self.label_2_copy_1, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) |
sizer_24_copy_1.Add((20, 20), 0, 0, 0) |
sizer_24_copy_1.Add(self.slider_GyroD, 0, 0, 0) |
sizer_23.Add(sizer_24_copy_1, 1, wx.EXPAND, 0) |
sizer_23.Add((20, 20), 0, 0, 0) |
sizer_24_copy_2.Add(self.label_2_copy_2, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) |
sizer_24_copy_2.Add((20, 20), 0, 0, 0) |
sizer_24_copy_2.Add(self.slider_FactorI, 0, 0, 0) |
sizer_23.Add(sizer_24_copy_2, 1, wx.EXPAND, 0) |
sizer_23.Add((20, 20), 0, 0, 0) |
sizer_24_copy_3.Add(self.label_2_copy_3, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) |
sizer_24_copy_3.Add((20, 20), 0, 0, 0) |
sizer_24_copy_3.Add(self.slider_1_copy_3, 0, 0, 0) |
sizer_23.Add(sizer_24_copy_3, 1, wx.EXPAND, 0) |
sizer_23.Add((20, 20), 0, 0, 0) |
sizer_22.Add(sizer_23, 1, wx.EXPAND, 0) |
sizer_25.Add(self.loadButton, 0, 0, 0) |
sizer_25.Add((20, 20), 0, 0, 0) |
sizer_25.Add(self.storeButton, 0, 0, 0) |
sizer_25.Add((20, 20), 0, 0, 0) |
sizer_22.Add(sizer_25, 1, wx.EXPAND, 0) |
sizer_22.Add((20, 20), 0, 0, 0) |
sizer_21.Add(sizer_22, 0, 0, 0) |
sizer_21.Add((20, 20), 0, 0, 0) |
sizer_15.Add(sizer_21, 0, 0, 0) |
self.SetSizer(sizer_15) |
self.Layout() |
self.SetSize((600, 450)) |
# end wxGlade |
|
def onLoad(self, event): # wxGlade: MkSettingsDialog.<event_handler> |
print "Loading MK Settings" |
|
mk = MkProtocol.MkComm() |
mk.open(comPort=self.app.settings["serialport"].value) |
|
msg = mk.getSettingsMsg() |
print "Index=",msg.getIndex() |
print "Name=",msg.getName() |
|
self.slider_GyroP.SetValue(msg.getSetting(SettingsMsg.IDX_STICK_P)) |
self.slider_GyroP.SetValue(msg.getSetting(SettingsMsg.IDX_STICK_I)) |
self.slider_GyroP.SetValue(msg.getSetting(SettingsMsg.IDX_STICK_D)) |
|
mk.close() |
|
event.Skip() |
|
|
def setApp(self, app): |
self.app = app |
# end of class MkSettingsDialog |
|
|
|
|
class MeasureDialog(wx.Dialog): |
def __init__(self, *args, **kwds): |
# begin wxGlade: MeasureDialog.__init__ |
1162,12 → 1292,17 |
|
def OnInit(self): |
wx.InitAllImageHandlers() |
|
self.frame_1 = MainFrame(None, -1, "") |
self.frame_1.setApp(self); |
self.frame_1.setApp(self) |
self.SetTopWindow(self.frame_1) |
|
self.frame_1.CenterOnScreen() |
self.frame_1.Show() |
|
self.mkSettingsFrame = MkSettingsDialog(None, -1, "") |
self.mkSettingsFrame.setApp(self); |
self.mkSettingsFrame.Show() |
|
return 1 |
|
def saveTests(self, filePath): |