def __init__(self, parent, actuator, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL): ##### necessary class variables ###### self.actuator = actuator self.plot_width = 0.35 self.cap_start_positions = numpy.zeros(6) self.cap_target_positions = numpy.zeros(6) self.cap_change_amounts = numpy.zeros(6) self.cap_change_labels = ['Leg1,i:0', 'Leg2,i:0', 'Leg3,i:0', 'Leg4,i:0', 'Leg5,i:0', 'Leg6,i:0'] self.cap_plot_ylims = (-10,10) self.leg_change_amounts = numpy.zeros(6) self.leg_change_labels = ['Leg1,i:0', 'Leg2,i:0', 'Leg3,i:0', 'Leg4,i:0', 'Leg5,i:0', 'Leg6,i:0'] self.leg_plot_ylims = (-10,10) ###################################### ### DEBUG ### self.__debug__ = False if self.actuator != None: self.cap_start_positions = self.actuator.getPositions() self.cap_target_positions = self.cap_start_positions ScrolledPanelBase.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TAB_TRAVERSAL ) topLevelWindow = parent.getTopLevelWindow() if hasattr(topLevelWindow, "menuItemDebug"): if topLevelWindow.menuItemDebug.IsChecked(): self.__debug__ = True else: self.__debug = False
def __init__(self, parent, actuator, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL): ##### necessary class variables ###### self.actuator = actuator self.plot_width = 0.35 self.cap_start_positions = numpy.zeros(6) self.cap_target_positions = numpy.zeros(6) self.cap_change_amounts = numpy.zeros(6) self.cap_change_labels = ['Leg1,i:0', 'Leg2,i:0', 'Leg3,i:0', 'Leg4,i:0', 'Leg5,i:0', 'Leg6,i:0'] self.cap_plot_ylims = (-10,10) self.leg_change_amounts = numpy.zeros(6) self.leg_change_labels = ['Leg1,i:0', 'Leg2,i:0', 'Leg3,i:0', 'Leg4,i:0', 'Leg5,i:0', 'Leg6,i:0'] self.leg_plot_ylims = (-10,10) ###################################### if self.actuator != None: self.cap_start_positions = self.actuator.getPositions() self.cap_target_positions = self.cap_start_positions ScrolledPanelBase.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TAB_TRAVERSAL )
def __init__(self, parent, actuator, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL): ##### necessary class variables ###### self.actuator = actuator self.plot_width = 0.35 self.cap_start_positions = numpy.zeros(6) self.cap_target_positions = numpy.zeros(6) self.cap_change_amounts = numpy.zeros(6) self.cap_change_labels = [ 'Leg1,i:0', 'Leg2,i:0', 'Leg3,i:0', 'Leg4,i:0', 'Leg5,i:0', 'Leg6,i:0' ] self.cap_plot_ylims = (-10, 10) self.leg_change_amounts = numpy.zeros(6) self.leg_change_labels = [ 'Leg1,i:0', 'Leg2,i:0', 'Leg3,i:0', 'Leg4,i:0', 'Leg5,i:0', 'Leg6,i:0' ] self.leg_plot_ylims = (-10, 10) ###################################### if self.actuator != None: self.cap_start_positions = self.actuator.getPositions() self.cap_target_positions = self.cap_start_positions ScrolledPanelBase.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL)
def __init__(self, parent): self.fieldCoordDefaultValue = "[(0,0),(1,1),(1,-1),(-1,-1),(-1,1)]" ScrolledPanelBase.__init__(self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size(700,150), style = wx.CLIP_CHILDREN|wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL) boxSizerPanel = wx.BoxSizer(wx.VERTICAL) self.staticTextInputTitle = wx.StaticText( self, wx.ID_ANY, u"Wavefront Data Input", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextInputTitle.Wrap( -1 ) self.staticTextInputTitle.SetFont( wx.Font( 18, 70, 90, 92, False, wx.EmptyString ) ) boxSizerPanel.Add( self.staticTextInputTitle, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) boxSizerScenario = wx.BoxSizer(wx.HORIZONTAL) self.radioButtonScenario = wx.RadioButton(self, wx.ID_ANY, "Scenario", wx.DefaultPosition, wx.DefaultSize, 0) boxSizerScenario.Add(self.radioButtonScenario, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.staticLineScenario = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) boxSizerScenario.Add(self.staticLineScenario, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5) self.staticTextScenarioFile = wx.StaticText(self, wx.ID_ANY, "File", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.staticTextScenarioFile.Wrap(-1) boxSizerScenario.Add(self.staticTextScenarioFile, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.textCtrlScenarioFile = wx.TextCtrl(self, wx.ID_ANY, 'systestdbl_simulated_01-Aug-2012_cset2_all.csv', wx.DefaultPosition, wx.Size( 300,-1 ), 0) boxSizerScenario.Add(self.textCtrlScenarioFile, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.buttonScnearioOpen = wx.Button(self, wx.ID_ANY, "Open...", wx.DefaultPosition, wx.DefaultSize, 0) boxSizerScenario.Add(self.buttonScnearioOpen, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.staticLineScenario2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) boxSizerScenario.Add(self.staticLineScenario2, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5) self.staticTextColumn = wx.StaticText(self, wx.ID_ANY, "Column", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.staticTextColumn.Wrap(-1) boxSizerScenario.Add(self.staticTextColumn, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.textCtrlScenarioColumn = wx.TextCtrl( self, wx.ID_ANY, "scenario4", wx.DefaultPosition, wx.Size( 100,-1 ), 0) boxSizerScenario.Add(self.textCtrlScenarioColumn, 0, wx.ALIGN_CENTER|wx.ALL, 5) boxSizerPanel.Add(boxSizerScenario, 0, wx.EXPAND, 5) boxSizerGntSet = wx.BoxSizer(wx.HORIZONTAL) self.radioButtonGntSet = wx.RadioButton(self, wx.ID_ANY, u"GntSet", wx.DefaultPosition, wx.DefaultSize, 0) boxSizerGntSet.Add(self.radioButtonGntSet, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.staticLineGntSet = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) boxSizerGntSet.Add(self.staticLineGntSet, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5) self.staticTextGntSetRoot = wx.StaticText(self, wx.ID_ANY, u"Root", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.staticTextGntSetRoot.Wrap(-1) boxSizerGntSet.Add(self.staticTextGntSetRoot, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.textCtrlGntSetRoot = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,-1 ), 0) self.textCtrlGntSetRoot.SetValue('xdogs_') # default boxSizerGntSet.Add(self.textCtrlGntSetRoot, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.staticLineGntSet2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) boxSizerGntSet.Add(self.staticLineGntSet2, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5) self.staticTextGntSetExt = wx.StaticText(self, wx.ID_ANY, u"Ext", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextGntSetExt.Wrap(-1) boxSizerGntSet.Add(self.staticTextGntSetExt, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.textCtrlGntSetExt = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(100,-1 ), 0) self.textCtrlGntSetExt.SetValue('gnt') # default boxSizerGntSet.Add(self.textCtrlGntSetExt, 0, wx.ALIGN_CENTER|wx.ALL, 5) boxSizerPanel.Add(boxSizerGntSet, 0, wx.EXPAND, 5) boxSizerZernikes = wx.BoxSizer(wx.HORIZONTAL) self.radioButtonZernikes = wx.RadioButton(self, wx.ID_ANY, u"Zernikes", wx.DefaultPosition, wx.DefaultSize, 0) boxSizerZernikes.Add(self.radioButtonZernikes, 0, wx.ALIGN_CENTER|wx.ALL, 5) ##### TEMPORARY DISABLE ZERNIKES BUTTON; waiting align2.py implementation ###### self.radioButtonZernikes.Enable(False) ################################################################################ self.staticLineZernikes = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) boxSizerZernikes.Add(self.staticLineZernikes, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5) self.staticTextZernikesFile = wx.StaticText(self, wx.ID_ANY, u"File", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.staticTextZernikesFile.Wrap(-1) boxSizerZernikes.Add(self.staticTextZernikesFile, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.textCtrlZernikesFile = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), 0) boxSizerZernikes.Add(self.textCtrlZernikesFile, 0, wx.ALIGN_CENTER|wx.ALL, 5) self.buttonZernikesOpen = wx.Button(self, wx.ID_ANY, u"Open...", wx.DefaultPosition, wx.DefaultSize, 0) boxSizerZernikes.Add(self.buttonZernikesOpen, 0, wx.ALIGN_CENTER|wx.ALL, 5) boxSizerPanel.Add(boxSizerZernikes, 0, wx.EXPAND, 5) boxSizerStartAll = wx.BoxSizer( wx.HORIZONTAL ) self.radioButtonStartAllZeros = wx.RadioButton( self, wx.ID_ANY, u"Start All Zeros", wx.DefaultPosition, wx.DefaultSize, 0 ) self.radioButtonStartAllZeros.SetValue(True) boxSizerStartAll.Add( self.radioButtonStartAllZeros, 0, wx.ALL, 5 ) boxSizerPanel.Add( boxSizerStartAll, 0, wx.EXPAND, 5 ) bSizerFieldCoord = wx.BoxSizer( wx.HORIZONTAL ) self.staticTextFieldCoordTitle = wx.StaticText( self, wx.ID_ANY, u"Field Coordinates:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextFieldCoordTitle.Wrap( -1 ) bSizerFieldCoord.Add( self.staticTextFieldCoordTitle, 0, wx.ALL, 5 ) self.textCtrlFieldCoord = wx.TextCtrl( self, wx.ID_ANY, self.fieldCoordDefaultValue, wx.DefaultPosition, wx.Size( 300,-1 ), 0 ) bSizerFieldCoord.Add( self.textCtrlFieldCoord, 0, wx.ALL, 5 ) boxSizerPanel.Add( bSizerFieldCoord, 0, wx.EXPAND, 5 ) # seperated line self.staticlineSep1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) boxSizerPanel.Add( self.staticlineSep1, 0, wx.EXPAND |wx.ALL, 5 ) # Displaying and controling parameters fgSizerParams = wx.FlexGridSizer( 3, 2, 0, 0 ) fgSizerParams.SetFlexibleDirection( wx.BOTH ) fgSizerParams.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.staticTextMeasuredTrackLength = wx.StaticText( self, wx.ID_ANY, u"Measured Track Length:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextMeasuredTrackLength.Wrap( -1 ) fgSizerParams.Add( self.staticTextMeasuredTrackLength, 1, wx.ALL, 5 ) self.textCtrlMeasuredTrackLength = wx.TextCtrl( self, wx.ID_ANY, u"None", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizerParams.Add( self.textCtrlMeasuredTrackLength, 1, wx.ALL, 5 ) self.staticTextTargetTrackLength = wx.StaticText( self, wx.ID_ANY, u"Target Track Length:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextTargetTrackLength.Wrap( -1 ) fgSizerParams.Add( self.staticTextTargetTrackLength, 1, wx.ALL, 5 ) self.textCtrlTargetTrackLength = wx.TextCtrl( self, wx.ID_ANY, u"None", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizerParams.Add( self.textCtrlTargetTrackLength, 1, wx.ALL, 5 ) self.staticTextHexapodID = wx.StaticText( self, wx.ID_ANY, u"Hexapod ID:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextHexapodID.Wrap( -1 ) fgSizerParams.Add( self.staticTextHexapodID, 1, wx.ALL , 5 ) self.textCtrlHexapodID = wx.TextCtrl( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizerParams.Add( self.textCtrlHexapodID, 1, wx.ALL, 5 ) boxSizerPanel.Add( fgSizerParams, 0, wx.EXPAND, 5 ) self.buttonReset = wx.Button( self, wx.ID_ANY, u"Reset Hexapod Initial Start Position", wx.DefaultPosition, wx.DefaultSize, 0 ) self.buttonReset.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) boxSizerPanel.Add( self.buttonReset, 0, wx.ALL, 5 ) #self.buttonGoHome = wx.Button( self, wx.ID_ANY, u"Go To Hexapod Start Position", wx.DefaultPosition, wx.DefaultSize, 0 ) #self.buttonGoHome.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) #boxSizerPanel.Add( self.buttonGoHome, 0, wx.ALL, 5 ) self.SetSizer(boxSizerPanel) self.Layout() self.SetupScrolling() boxSizerPanel.Fit(self) # Connect Events self.buttonScnearioOpen.Bind(wx.EVT_BUTTON, self.onScenarioFileOpen) self.buttonZernikesOpen.Bind(wx.EVT_BUTTON, self.onZernikesFileOpen) self.buttonReset.Bind( wx.EVT_BUTTON, self.onResetHexapodStartPosition ) #self.buttonGoHome.Bind( wx.EVT_BUTTON, self.onGoHexpaodStartPosition) # disable if the actuator failed to initiate if self.getTopLevelWindow().actuator == None: self.buttonReset.Enable(False)
def __init__(self, parent): self.testAlignObj = None FrameBase.__init__(self, parent, id=wx.ID_ANY, title=u"test align gui", pos=wx.DefaultPosition, size=wx.Size(900, 600), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizerFrameMain = wx.BoxSizer(wx.VERTICAL) self.panelMain = ScrolledPanelBase(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizerPanelMain = wx.BoxSizer(wx.VERTICAL) bSizerFile = wx.BoxSizer(wx.HORIZONTAL) self.staticTextFileNameRoot = wx.StaticText(self.panelMain, wx.ID_ANY, u"File Name Root:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextFileNameRoot.Wrap(-1) bSizerFile.Add(self.staticTextFileNameRoot, 0, wx.ALL, 5) self.textCtrlFileNameRoot = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"ytesta", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlFileNameRoot.SetMinSize(wx.Size(150, -1)) bSizerFile.Add(self.textCtrlFileNameRoot, 0, wx.ALL, 5) self.staticTextExtension = wx.StaticText(self.panelMain, wx.ID_ANY, u"Extension:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextExtension.Wrap(-1) bSizerFile.Add(self.staticTextExtension, 0, wx.ALL, 5) self.textCtrlExtension = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"dat", wx.DefaultPosition, wx.DefaultSize, 0) bSizerFile.Add(self.textCtrlExtension, 0, wx.ALL, 5) bSizerPanelMain.Add(bSizerFile, 0, wx.EXPAND, 5) bSizerMode = wx.BoxSizer(wx.HORIZONTAL) self.radioBoxModeChoices = [u"b", u"c", u"cghz", u"nocgh"] self.radioBoxMode = wx.RadioBox(self.panelMain, wx.ID_ANY, u"Mode", wx.DefaultPosition, wx.DefaultSize, self.radioBoxModeChoices, 1, wx.RA_SPECIFY_ROWS) self.radioBoxMode.SetSelection(0) bSizerMode.Add(self.radioBoxMode, 0, wx.ALL, 5) self.buttonFileUpdate = wx.Button(self.panelMain, wx.ID_ANY, u"UPDATE", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMode.Add(self.buttonFileUpdate, 0, wx.ALL | wx.EXPAND, 5) self.textCtrlOutput = wx.TextCtrl(self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) bSizerMode.Add(self.textCtrlOutput, 0, wx.ALL | wx.EXPAND, 5) self.buttonWriteReport = wx.Button(self.panelMain, wx.ID_ANY, u"Write Report", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMode.Add(self.buttonWriteReport, 0, wx.ALL | wx.EXPAND, 5) bSizerPanelMain.Add(bSizerMode, 0, wx.EXPAND, 5) self.staticlineSep1 = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizerPanelMain.Add(self.staticlineSep1, 0, wx.EXPAND | wx.ALL, 5) bSizerGrids = wx.BoxSizer(wx.HORIZONTAL) # Grid data dataLabels = [ 'Variables', 'Input Values (nm)', 'Residual Values (nm)', 'Weights' ] dataTypes = [ gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_FLOAT + ':6,2', gridlib.GRID_VALUE_FLOAT + ':6,2', gridlib.GRID_VALUE_FLOAT + ':6,1' ] self.gridData1 = CustomDataGrid(self.panelMain, dataLabels, dataTypes) # Cell1 Defaults self.gridData1.SetDefaultCellFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) self.gridData1.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_TOP) bSizerGrids.Add(self.gridData1, 0, wx.ALL, 5) self.gridData1.Hide() self.staticlineGridSep = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) bSizerGrids.Add(self.staticlineGridSep, 0, wx.EXPAND | wx.ALL, 5) # Cell2 Defaults dataLabels = [ 'Compensator', 'Force', 'Solve Amount', 'Unit', 'Include Move', 'Move Amount' ] dataTypes = [ gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_FLOAT + ':6,5', gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_BOOL, gridlib.GRID_VALUE_FLOAT + ':6,5' ] self.gridData2 = CustomDataGrid(self.panelMain, dataLabels, dataTypes) self.gridData2.SetDefaultCellFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) self.gridData2.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_TOP) bSizerGrids.Add(self.gridData2, 0, wx.ALL, 5) self.gridData2.Hide() self.setupDataTable() bSizerPanelMain.Add(bSizerGrids, 1, wx.EXPAND, 5) self.staticlineSep2 = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizerPanelMain.Add(self.staticlineSep2, 0, wx.EXPAND | wx.ALL, 5) bSizerControl = wx.BoxSizer(wx.HORIZONTAL) self.buttonSolve = wx.Button(self.panelMain, wx.ID_ANY, u"SOLVE", wx.DefaultPosition, wx.DefaultSize, 0) bSizerControl.Add(self.buttonSolve, 1, wx.ALL | wx.EXPAND, 5) self.buttonMove = wx.Button(self.panelMain, wx.ID_ANY, u"MOVE", wx.DefaultPosition, wx.DefaultSize, 0) bSizerControl.Add(self.buttonMove, 1, wx.ALL | wx.EXPAND, 5) bSizerPanelMain.Add(bSizerControl, 0, wx.EXPAND, 5) self.panelMain.SetSizer(bSizerPanelMain) self.panelMain.Layout() bSizerPanelMain.Fit(self.panelMain) bSizerFrameMain.Add(self.panelMain, 1, wx.EXPAND | wx.ALL, 0) self.SetSizer(bSizerFrameMain) self.Layout() self.Centre(wx.BOTH) # Connect Events self.buttonFileUpdate.Bind(wx.EVT_BUTTON, self.onFileUpdate) self.buttonWriteReport.Bind(wx.EVT_BUTTON, self.onWriteReport) self.gridData1.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onChangeParams) self.gridData2.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onChangeParams) self.buttonSolve.Bind(wx.EVT_BUTTON, self.onSolve) self.buttonMove.Bind(wx.EVT_BUTTON, self.onMove)
def __init__( self, parent ): self.probesButtonMask = 999 self.validProbeIDs = {} self.probeID = 0 self.numProbes = 0 self.timeFormat = "%Y-%m-%d %H:%M:%S" self.choiceGroupChoices = self.setupGroupChoice() self.choiceAliasChoices = [] self.choiceColorChoices = ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black', 'pink', 'Add...'] self.choiceColorBitmap = self.setupDefaultChoiceColorBitmap() timenow = time.time() ScrolledPanelBase.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TAB_TRAVERSAL ) ### Timers ### self.auto_update_timer = wx.Timer(self, wx.NewId()) ############## self.SetMinSize( wx.Size( 1000,200 ) ) bSizerPanelControlContents = wx.BoxSizer( wx.HORIZONTAL ) self.bSizerLeft = wx.BoxSizer( wx.VERTICAL ) self.gSizerProbes = wx.GridSizer( 1, 4, 0, 5 ) self.staticTextGroup = wx.StaticText( self, wx.ID_ANY, u"Group", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextGroup.Wrap( -1 ) self.gSizerProbes.Add( self.staticTextGroup, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 0 ) self.staticTextAlias = wx.StaticText( self, wx.ID_ANY, u"Alias", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextAlias.Wrap( -1 ) self.gSizerProbes.Add( self.staticTextAlias, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 0 ) self.staticTextColor = wx.StaticText( self, wx.ID_ANY, u"Color", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextColor.Wrap( -1 ) self.gSizerProbes.Add( self.staticTextColor, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 0 ) self.staticTextRemove = wx.StaticText( self, wx.ID_ANY, u"Remove", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextRemove.Wrap( -1 ) self.gSizerProbes.Add( self.staticTextRemove, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 0 ) self.bSizerLeft.Add( self.gSizerProbes, 0, wx.EXPAND, 5 ) bSizerButtons = wx.BoxSizer( wx.HORIZONTAL ) self.buttonAddProbe = wx.Button( self, wx.ID_ANY, u"Add Probe", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerButtons.Add( self.buttonAddProbe, 1, wx.ALL|wx.EXPAND, 5 ) self.buttonPlot = wx.Button( self, wx.ID_ANY, u"Plot", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerButtons.Add( self.buttonPlot, 1, wx.ALL, 5 ) self.bSizerLeft.Add( bSizerButtons, 0, wx.EXPAND, 5 ) bSizerPanelControlContents.Add( self.bSizerLeft, 1, wx.EXPAND, 5 ) self.bSizerRight = wx.BoxSizer( wx.VERTICAL ) fgSizerTime = wx.FlexGridSizer( 2, 5, 0, 0 ) fgSizerTime.SetFlexibleDirection( wx.BOTH ) fgSizerTime.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.checkBoxStartTime = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.checkBoxStartTime.SetToolTipString( u"check to use entered start time" ) fgSizerTime.Add( self.checkBoxStartTime, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextStartTime = wx.StaticText( self, wx.ID_ANY, u"Start Time:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextStartTime.Wrap( -1 ) fgSizerTime.Add( self.staticTextStartTime, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlStartTime = wx.TextCtrl( self, wx.ID_ANY, time.strftime(self.timeFormat, time.localtime(timenow-2*24*60*60)), wx.DefaultPosition, wx.Size( 125,-1 ), 0 ) fgSizerTime.Add( self.textCtrlStartTime, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5 ) self.staticTextStartTimeFormat = wx.StaticText( self, wx.ID_ANY, u"(yyyy-mm-dd hh:MM:ss)", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextStartTimeFormat.Wrap( -1 ) fgSizerTime.Add( self.staticTextStartTimeFormat, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.checkBoxEarliest = wx.CheckBox( self, wx.ID_ANY, u"Use Earliest Time", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizerTime.Add( self.checkBoxEarliest, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.checkBoxEndTime = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.checkBoxEndTime.SetValue(True) self.checkBoxEndTime.SetToolTipString( u"check to use entered end time" ) fgSizerTime.Add( self.checkBoxEndTime, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextEndTime = wx.StaticText( self, wx.ID_ANY, u"End Time:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextEndTime.Wrap( -1 ) fgSizerTime.Add( self.staticTextEndTime, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlEndTime = wx.TextCtrl( self, wx.ID_ANY, time.strftime(self.timeFormat, time.localtime(timenow)), wx.DefaultPosition, wx.Size( 125,-1 ), 0 ) fgSizerTime.Add( self.textCtrlEndTime, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5 ) self.staticTextEndTimeFormat = wx.StaticText( self, wx.ID_ANY, u"(yyyy-mm-dd hh:MM:ss)", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextEndTimeFormat.Wrap( -1 ) fgSizerTime.Add( self.staticTextEndTimeFormat, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.checkBoxCurrent = wx.CheckBox( self, wx.ID_ANY, u"Use Current Time", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizerTime.Add( self.checkBoxCurrent, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.bSizerRight.Add( fgSizerTime, 0, wx.EXPAND|wx.ALL, 5 ) bSizerFunctions = wx.BoxSizer( wx.HORIZONTAL ) sbSizerDuration = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Duration" ), wx.VERTICAL ) bSizerDays = wx.BoxSizer( wx.HORIZONTAL ) self.staticTextDays = wx.StaticText( self, wx.ID_ANY, u"Days:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextDays.Wrap( -1 ) self.staticTextDays.SetToolTipString( u"single check the time checkbox above to use the checked time with duration" ) bSizerDays.Add( self.staticTextDays, 0, wx.ALL, 5 ) self.textCtrlDays = wx.TextCtrl( self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerDays.Add( self.textCtrlDays, 0, wx.ALL, 5 ) sbSizerDuration.Add( bSizerDays, 0, wx.EXPAND, 5 ) bSizerHours = wx.BoxSizer( wx.HORIZONTAL ) self.staticTextHours = wx.StaticText( self, wx.ID_ANY, u"Hours:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextHours.Wrap( -1 ) self.staticTextHours.SetToolTipString( u"single check the time checkbox above to use the checked time with duration" ) bSizerHours.Add( self.staticTextHours, 0, wx.ALL, 5 ) self.textCtrlHours = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerHours.Add( self.textCtrlHours, 0, wx.ALL, 5 ) sbSizerDuration.Add( bSizerHours, 0, wx.EXPAND, 5 ) bSizerMinutes = wx.BoxSizer( wx.HORIZONTAL ) self.staticTextMinutes = wx.StaticText( self, wx.ID_ANY, u"Minutes:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextMinutes.Wrap( -1 ) self.staticTextMinutes.SetToolTipString( u"single check the time checkbox above to use the checked time with duration" ) bSizerMinutes.Add( self.staticTextMinutes, 0, wx.ALL, 5 ) self.textCtrlMinutes = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerMinutes.Add( self.textCtrlMinutes, 0, wx.ALL, 5 ) sbSizerDuration.Add( bSizerMinutes, 0, wx.EXPAND, 5 ) bSizerFunctions.Add( sbSizerDuration, 0, wx.ALL, 5 ) sbSizerUpdate = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Update Intervals" ), wx.VERTICAL ) self.checkBoxUpdate = wx.CheckBox( self, wx.ID_ANY, u"Check to Auto-update", wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizerUpdate.Add( self.checkBoxUpdate, 0, wx.ALL|wx.EXPAND, 5 ) bSizerHoursUpdate = wx.BoxSizer( wx.HORIZONTAL ) self.staticTextHoursUpdate = wx.StaticText( self, wx.ID_ANY, u"Hours:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextHoursUpdate.Wrap( -1 ) self.staticTextHoursUpdate.SetToolTipString( u"check the auto-update checkbox for automatic updating plots with update time intervals" ) bSizerHoursUpdate.Add( self.staticTextHoursUpdate, 0, wx.ALL, 5 ) self.textCtrlHoursUpdate = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerHoursUpdate.Add( self.textCtrlHoursUpdate, 0, wx.ALL, 5 ) sbSizerUpdate.Add( bSizerHoursUpdate, 1, wx.EXPAND, 5 ) bSizerMinutesUpdate = wx.BoxSizer( wx.HORIZONTAL ) self.staticTextMinutesUpdate = wx.StaticText( self, wx.ID_ANY, u"Minutes:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextMinutesUpdate.Wrap( -1 ) self.staticTextMinutesUpdate.SetToolTipString( u"check the auto-update checkbox for automatic updating plots with update time intervals" ) bSizerMinutesUpdate.Add( self.staticTextMinutesUpdate, 0, wx.ALL, 5 ) self.textCtrlMinutesUpdate = wx.TextCtrl( self, wx.ID_ANY, u"5", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerMinutesUpdate.Add( self.textCtrlMinutesUpdate, 0, wx.ALL, 5 ) sbSizerUpdate.Add( bSizerMinutesUpdate, 1, wx.EXPAND, 5 ) bSizerFunctions.Add( sbSizerUpdate, 0, wx.ALL, 5 ) self.bSizerRight.Add( bSizerFunctions, 0, wx.EXPAND, 5 ) bSizerPanelControlContents.Add( self.bSizerRight, 1, wx.EXPAND, 5 ) self.SetSizer( bSizerPanelControlContents ) self.Layout() self.SetupScrolling() bSizerPanelControlContents.Fit( self ) # Connect Events self.buttonAddProbe.Bind( wx.EVT_BUTTON, self.onAddProbe ) self.buttonPlot.Bind( wx.EVT_BUTTON, self.onPlot ) self.checkBoxUpdate.Bind( wx.EVT_CHECKBOX, self.onCheckAutoUpdate ) self.Bind(wx.EVT_TIMER, self.onAutoUpdateTimer, self.auto_update_timer) self.textCtrlHoursUpdate.Bind( wx.EVT_TEXT, self.onAutoUpdateTimeChange ) self.textCtrlMinutesUpdate.Bind( wx.EVT_TEXT, self.onAutoUpdateTimeChange )
def __init__(self, parent, alignObj): self.alignObj = alignObj ScrolledPanelBase.__init__ (self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.CLIP_CHILDREN|wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL) boxSizerSection = wx.BoxSizer(wx.HORIZONTAL) boxSizerContent = wx.BoxSizer(wx.VERTICAL) ########################## # result grid label ########################## self.staticTextTitle = wx.StaticText(self, wx.ID_ANY, "Compensator Results", wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) self.staticTextTitle.Wrap(-1) self.staticTextTitle.SetFont(wx.Font(18, 70, 90, 92, False, wx.EmptyString)) boxSizerContent.Add(self.staticTextTitle, 0, wx.ALIGN_CENTRE|wx.ALL, 5) ########################## # result grid ########################## self.gridResult = ResultGrid(self, self.alignObj) # Grid #self.gridResult.CreateGrid(len(self.usedperts), 4) self.gridResult.EnableEditing(True) self.gridResult.EnableGridLines(True) self.gridResult.EnableDragGridSize(False) self.gridResult.SetMargins(0, 0) # Columns self.gridResult.EnableDragColMove(False) self.gridResult.EnableDragColSize(True) #self.gridResult.SetColLabelSize(100) self.gridResult.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # Rows self.gridResult.EnableDragRowSize(True) # Cell background color hack (make cells background = panel background for beauty) color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE) self.gridResult.SetDefaultCellBackgroundColour(color) # Cell Defaults self.gridResult.SetDefaultCellAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) self.gridResult.SetFocus() self.gridResult.AutoSize() boxSizerContent.Add(self.gridResult, 1, wx.ALIGN_CENTRE|wx.ALL, 5) # Add data... self.updateData() # refresh grid widget self.refreshWidget(self.gridResult) boxSizerSection.Add(boxSizerContent, 1, wx.EXPAND|wx.ALL, 5) ########################## # control buttons ########################## boxSizerControls = wx.BoxSizer(wx.VERTICAL) self.staticTextControlsTitle = wx.StaticText(self, wx.ID_ANY, "Controls", wx.DefaultPosition, wx.DefaultSize, wx.ALL) self.staticTextControlsTitle.SetFont( wx.Font( 14, 70, 90, 90, False, wx.EmptyString ) ) boxSizerControls.Add(self.staticTextControlsTitle, 0, wx.ALIGN_CENTRE|wx.EXPAND|wx.ALL, 5) self.staticlineControlSep = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) boxSizerControls.Add( self.staticlineControlSep, 0, wx.EXPAND|wx.ALL, 5 ) self.buttonPlotFieldVectors = wx.Button(self, id=wx.ID_ANY, label="Plot Field Vectors") self.buttonPlotFieldVectors.SetFont( wx.Font( 12, 70, 90, 90, False, wx.EmptyString ) ) boxSizerControls.Add(self.buttonPlotFieldVectors, 0, wx.ALIGN_CENTRE|wx.ALL|wx.EXPAND, 5) self.buttonAdjustHexapod = wx.Button(self, id=wx.ID_ANY, label="Adjust Hexapod") self.buttonAdjustHexapod.SetFont( wx.Font( 12, 70, 90, 90, False, wx.EmptyString ) ) boxSizerControls.Add(self.buttonAdjustHexapod, 0, wx.ALIGN_CENTRE|wx.ALL|wx.EXPAND, 5) self.buttonMoveTest = wx.Button(self, id=wx.ID_ANY, label="Move Test") self.buttonMoveTest.SetFont( wx.Font( 12, 70, 90, 90, False, wx.EmptyString ) ) boxSizerControls.Add(self.buttonMoveTest, 0, wx.ALIGN_CENTRE|wx.ALL|wx.EXPAND, 5) boxSizerSection.Add(boxSizerControls, 0, wx.EXPAND|wx.ALL, 5) ########################## self.SetSizer(boxSizerSection) self.Layout() self.SetupScrolling() boxSizerSection.Fit(self) # Connect Events self.Bind(wx.EVT_BUTTON, self.onPlotFieldVectors, self.buttonPlotFieldVectors) self.Bind(wx.EVT_BUTTON, self.onAdjustHexapod, self.buttonAdjustHexapod) self.Bind(wx.EVT_BUTTON, self.onMoveTest, self.buttonMoveTest)
def __init__(self, parent): self.probesButtonMask = 999 self.validProbeIDs = {} self.probeID = 0 self.numProbes = 0 self.timeFormat = "%Y-%m-%d %H:%M:%S" self.choiceGroupChoices = self.setupGroupChoice() self.choiceAliasChoices = [] self.choiceColorChoices = [ 'blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black', 'pink', 'Add...' ] self.choiceColorBitmap = self.setupDefaultChoiceColorBitmap() timenow = time.time() ScrolledPanelBase.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL) ### Timers ### self.auto_update_timer = wx.Timer(self, wx.NewId()) ############## self.SetMinSize(wx.Size(1000, 200)) bSizerPanelControlContents = wx.BoxSizer(wx.HORIZONTAL) self.bSizerLeft = wx.BoxSizer(wx.VERTICAL) self.gSizerProbes = wx.GridSizer(1, 4, 0, 5) self.staticTextGroup = wx.StaticText(self, wx.ID_ANY, u"Group", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextGroup.Wrap(-1) self.gSizerProbes.Add(self.staticTextGroup, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 0) self.staticTextAlias = wx.StaticText(self, wx.ID_ANY, u"Alias", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextAlias.Wrap(-1) self.gSizerProbes.Add(self.staticTextAlias, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 0) self.staticTextColor = wx.StaticText(self, wx.ID_ANY, u"Color", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextColor.Wrap(-1) self.gSizerProbes.Add(self.staticTextColor, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 0) self.staticTextRemove = wx.StaticText(self, wx.ID_ANY, u"Remove", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextRemove.Wrap(-1) self.gSizerProbes.Add(self.staticTextRemove, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 0) self.bSizerLeft.Add(self.gSizerProbes, 0, wx.EXPAND, 5) bSizerButtons = wx.BoxSizer(wx.HORIZONTAL) self.buttonAddProbe = wx.Button(self, wx.ID_ANY, u"Add Probe", wx.DefaultPosition, wx.DefaultSize, 0) bSizerButtons.Add(self.buttonAddProbe, 1, wx.ALL | wx.EXPAND, 5) self.buttonPlot = wx.Button(self, wx.ID_ANY, u"Plot", wx.DefaultPosition, wx.DefaultSize, 0) bSizerButtons.Add(self.buttonPlot, 1, wx.ALL, 5) self.bSizerLeft.Add(bSizerButtons, 0, wx.EXPAND, 5) bSizerPanelControlContents.Add(self.bSizerLeft, 1, wx.EXPAND, 5) self.bSizerRight = wx.BoxSizer(wx.VERTICAL) fgSizerTime = wx.FlexGridSizer(2, 5, 0, 0) fgSizerTime.SetFlexibleDirection(wx.BOTH) fgSizerTime.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.checkBoxStartTime = wx.CheckBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.checkBoxStartTime.SetToolTipString( u"check to use entered start time") fgSizerTime.Add(self.checkBoxStartTime, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.staticTextStartTime = wx.StaticText(self, wx.ID_ANY, u"Start Time:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextStartTime.Wrap(-1) fgSizerTime.Add(self.staticTextStartTime, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.textCtrlStartTime = wx.TextCtrl( self, wx.ID_ANY, time.strftime(self.timeFormat, time.localtime(timenow - 2 * 24 * 60 * 60)), wx.DefaultPosition, wx.Size(125, -1), 0) fgSizerTime.Add(self.textCtrlStartTime, 0, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) self.staticTextStartTimeFormat = wx.StaticText( self, wx.ID_ANY, u"(yyyy-mm-dd hh:MM:ss)", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextStartTimeFormat.Wrap(-1) fgSizerTime.Add(self.staticTextStartTimeFormat, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.checkBoxEarliest = wx.CheckBox(self, wx.ID_ANY, u"Use Earliest Time", wx.DefaultPosition, wx.DefaultSize, 0) fgSizerTime.Add(self.checkBoxEarliest, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.checkBoxEndTime = wx.CheckBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.checkBoxEndTime.SetValue(True) self.checkBoxEndTime.SetToolTipString(u"check to use entered end time") fgSizerTime.Add(self.checkBoxEndTime, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.staticTextEndTime = wx.StaticText(self, wx.ID_ANY, u"End Time:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextEndTime.Wrap(-1) fgSizerTime.Add(self.staticTextEndTime, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.textCtrlEndTime = wx.TextCtrl( self, wx.ID_ANY, time.strftime(self.timeFormat, time.localtime(timenow)), wx.DefaultPosition, wx.Size(125, -1), 0) fgSizerTime.Add(self.textCtrlEndTime, 0, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) self.staticTextEndTimeFormat = wx.StaticText(self, wx.ID_ANY, u"(yyyy-mm-dd hh:MM:ss)", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextEndTimeFormat.Wrap(-1) fgSizerTime.Add(self.staticTextEndTimeFormat, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.checkBoxCurrent = wx.CheckBox(self, wx.ID_ANY, u"Use Current Time", wx.DefaultPosition, wx.DefaultSize, 0) fgSizerTime.Add(self.checkBoxCurrent, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.bSizerRight.Add(fgSizerTime, 0, wx.EXPAND | wx.ALL, 5) bSizerFunctions = wx.BoxSizer(wx.HORIZONTAL) sbSizerDuration = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"Duration"), wx.VERTICAL) bSizerDays = wx.BoxSizer(wx.HORIZONTAL) self.staticTextDays = wx.StaticText(self, wx.ID_ANY, u"Days:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDays.Wrap(-1) self.staticTextDays.SetToolTipString( u"single check the time checkbox above to use the checked time with duration" ) bSizerDays.Add(self.staticTextDays, 0, wx.ALL, 5) self.textCtrlDays = wx.TextCtrl(self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, 0) bSizerDays.Add(self.textCtrlDays, 0, wx.ALL, 5) sbSizerDuration.Add(bSizerDays, 0, wx.EXPAND, 5) bSizerHours = wx.BoxSizer(wx.HORIZONTAL) self.staticTextHours = wx.StaticText(self, wx.ID_ANY, u"Hours:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextHours.Wrap(-1) self.staticTextHours.SetToolTipString( u"single check the time checkbox above to use the checked time with duration" ) bSizerHours.Add(self.staticTextHours, 0, wx.ALL, 5) self.textCtrlHours = wx.TextCtrl(self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) bSizerHours.Add(self.textCtrlHours, 0, wx.ALL, 5) sbSizerDuration.Add(bSizerHours, 0, wx.EXPAND, 5) bSizerMinutes = wx.BoxSizer(wx.HORIZONTAL) self.staticTextMinutes = wx.StaticText(self, wx.ID_ANY, u"Minutes:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextMinutes.Wrap(-1) self.staticTextMinutes.SetToolTipString( u"single check the time checkbox above to use the checked time with duration" ) bSizerMinutes.Add(self.staticTextMinutes, 0, wx.ALL, 5) self.textCtrlMinutes = wx.TextCtrl(self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMinutes.Add(self.textCtrlMinutes, 0, wx.ALL, 5) sbSizerDuration.Add(bSizerMinutes, 0, wx.EXPAND, 5) bSizerFunctions.Add(sbSizerDuration, 0, wx.ALL, 5) sbSizerUpdate = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"Update Intervals"), wx.VERTICAL) self.checkBoxUpdate = wx.CheckBox(self, wx.ID_ANY, u"Check to Auto-update", wx.DefaultPosition, wx.DefaultSize, 0) sbSizerUpdate.Add(self.checkBoxUpdate, 0, wx.ALL | wx.EXPAND, 5) bSizerHoursUpdate = wx.BoxSizer(wx.HORIZONTAL) self.staticTextHoursUpdate = wx.StaticText(self, wx.ID_ANY, u"Hours:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextHoursUpdate.Wrap(-1) self.staticTextHoursUpdate.SetToolTipString( u"check the auto-update checkbox for automatic updating plots with update time intervals" ) bSizerHoursUpdate.Add(self.staticTextHoursUpdate, 0, wx.ALL, 5) self.textCtrlHoursUpdate = wx.TextCtrl(self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) bSizerHoursUpdate.Add(self.textCtrlHoursUpdate, 0, wx.ALL, 5) sbSizerUpdate.Add(bSizerHoursUpdate, 1, wx.EXPAND, 5) bSizerMinutesUpdate = wx.BoxSizer(wx.HORIZONTAL) self.staticTextMinutesUpdate = wx.StaticText(self, wx.ID_ANY, u"Minutes:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextMinutesUpdate.Wrap(-1) self.staticTextMinutesUpdate.SetToolTipString( u"check the auto-update checkbox for automatic updating plots with update time intervals" ) bSizerMinutesUpdate.Add(self.staticTextMinutesUpdate, 0, wx.ALL, 5) self.textCtrlMinutesUpdate = wx.TextCtrl(self, wx.ID_ANY, u"5", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMinutesUpdate.Add(self.textCtrlMinutesUpdate, 0, wx.ALL, 5) sbSizerUpdate.Add(bSizerMinutesUpdate, 1, wx.EXPAND, 5) bSizerFunctions.Add(sbSizerUpdate, 0, wx.ALL, 5) self.bSizerRight.Add(bSizerFunctions, 0, wx.EXPAND, 5) bSizerPanelControlContents.Add(self.bSizerRight, 1, wx.EXPAND, 5) self.SetSizer(bSizerPanelControlContents) self.Layout() self.SetupScrolling() bSizerPanelControlContents.Fit(self) # Connect Events self.buttonAddProbe.Bind(wx.EVT_BUTTON, self.onAddProbe) self.buttonPlot.Bind(wx.EVT_BUTTON, self.onPlot) self.checkBoxUpdate.Bind(wx.EVT_CHECKBOX, self.onCheckAutoUpdate) self.Bind(wx.EVT_TIMER, self.onAutoUpdateTimer, self.auto_update_timer) self.textCtrlHoursUpdate.Bind(wx.EVT_TEXT, self.onAutoUpdateTimeChange) self.textCtrlMinutesUpdate.Bind(wx.EVT_TEXT, self.onAutoUpdateTimeChange)
def __init__(self, parent, alignObj): self.alignObj = alignObj ScrolledPanelBase.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL) bSizerPanel = wx.BoxSizer(wx.VERTICAL) ########################## # Move Test panel title ########################## self.staticTextMoveTestTitle = wx.StaticText( self, wx.ID_ANY, u"Move Test (ID: " + self.alignObj.hexapodID + ")", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextMoveTestTitle.Wrap(-1) self.staticTextMoveTestTitle.SetFont( wx.Font(18, 70, 90, 92, False, wx.EmptyString)) bSizerPanel.Add(self.staticTextMoveTestTitle, 0, wx.ALIGN_CENTER | wx.ALL, 5) bSizerMoveGrid = wx.BoxSizer(wx.HORIZONTAL) ########################## # moveTest grid ########################## labels = [ "Compensator", "POB Motion", "Solve Amounts", "Include", "Move", "Units" ] dataTypes = [ gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_FLOAT + ':6,9', gridlib.GRID_VALUE_BOOL, gridlib.GRID_VALUE_FLOAT + ':6,9', gridlib.GRID_VALUE_STRING ] self.moveTestGrid = CustomDataGrid(self, labels, dataTypes) self.updateMoveTestGrid() self.moveTestGrid.SetColLabelSize(30) self.moveTestGrid.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) self.moveTestGrid.AutoSize() ##### # Cell Attributes ##### self.moveTestGrid.SetColReadOnly(0) self.moveTestGrid.SetColReadOnly(1) self.moveTestGrid.SetColReadOnly(2) self.moveTestGrid.SetColReadOnly(4) self.moveTestGrid.SetColReadOnly(5) bSizerMoveGrid.Add(self.moveTestGrid, 0, wx.ALL, 5) ########################################## END moveTestGrid ######################################## bSizerMoveGridControl = wx.BoxSizer(wx.VERTICAL) self.buttonIncludeAll = wx.Button(self, wx.ID_ANY, u"Include All", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMoveGridControl.Add(self.buttonIncludeAll, 0, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) self.textCtrlFactor = wx.TextCtrl(self, wx.ID_ANY, u"0.5", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMoveGridControl.Add(self.textCtrlFactor, 0, wx.ALL, 5) self.buttonFactor = wx.Button(self, wx.ID_ANY, u"Set Factor", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMoveGridControl.Add(self.buttonFactor, 0, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) bSizerMoveGrid.Add(bSizerMoveGridControl, 0, wx.ALL, 5) bSizerPanel.Add(bSizerMoveGrid, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.buttonMove = wx.Button(self, wx.ID_ANY, u"MOVE", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonMove.SetFont(wx.Font(14, 70, 90, 92, False, wx.EmptyString)) if not HAS_POBTEST_MOD: self.buttonMove.SetToolTipString( u"Disabled due to \"pobtest module\" not found.") self.buttonMove.Enable(False) bSizerPanel.Add(self.buttonMove, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.SetSizer(bSizerPanel) self.Layout() # Connect Events self.moveTestGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onMoveTestGridChange) self.buttonIncludeAll.Bind(wx.EVT_BUTTON, self.onInclude) self.buttonFactor.Bind(wx.EVT_BUTTON, self.onSetFactor) self.buttonMove.Bind(wx.EVT_BUTTON, self.onMove)
def __init__(self, parent, alignObj, mode): self.parent = parent self.topWindow = self.getTopWindow() self.mode = mode self.setAlignObj(alignObj, mode) (self.terms, self.params) = self.parseFieldsData() self.diff = self.parseDiffData() ##### custom params notes ##### self.paramsNotes = {'z5': 'weights must be 0', 'z6': 'weights must be 0'} ScrolledPanelBase.__init__(self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.CLIP_CHILDREN|wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL) #wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL) boxSizerPanelSection = wx.BoxSizer( wx.HORIZONTAL ) ######### LEFT PANEL ########## self.boxSizerPanelDisplay = wx.BoxSizer(wx.VERTICAL) #self.scrolledWindowPanelDisplay = wx.ScrolledWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL) #self.scrolledWindowPanelDisplay.SetScrollRate(5, 5) #boxSizerScrolled = wx.BoxSizer(wx.VERTICAL) #self.panelContent = wx.Panel(self.scrolledWindowPanelDisplay, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.EXPAND|wx.ALL) #boxSizerContent = wx.BoxSizer(wx.VERTICAL) ########################## # 1st display grid label ########################## self.staticTextTitleDisplay = wx.StaticText(self, wx.ID_ANY, "Measured Dependent Variables and Weights", wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) self.staticTextTitleDisplay.Wrap(-1) self.staticTextTitleDisplay.SetFont(wx.Font(18, 70, 90, 92, False, wx.EmptyString)) self.boxSizerPanelDisplay.Add(self.staticTextTitleDisplay, 0, wx.ALIGN_CENTRE | wx.ALL, 5) ####################################### # 1st display fields / parameters grid ####################################### self.gridDisplayScrolledPanel = wx.grid.Grid(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) # Grid self.gridDisplayScrolledPanel.CreateGrid(len(self.params), len(self.terms)*2+1) # (col + 1) cus of notes self.gridDisplayScrolledPanel.EnableEditing(self.gridEditable) self.gridDisplayScrolledPanel.EnableGridLines(True) self.gridDisplayScrolledPanel.EnableDragGridSize(False) self.gridDisplayScrolledPanel.SetMargins(0, 0) # Columns self.gridDisplayScrolledPanel.EnableDragColMove(False) self.gridDisplayScrolledPanel.EnableDragColSize(True) self.gridDisplayScrolledPanel.SetColLabelSize(30) self.gridDisplayScrolledPanel.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # Rows self.gridDisplayScrolledPanel.EnableDragRowSize(True) self.gridDisplayScrolledPanel.SetRowLabelSize(80) self.gridDisplayScrolledPanel.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # Label Appearance for row in range(len(self.params)): self.gridDisplayScrolledPanel.SetRowLabelValue(row, self.params[row]) for col in range(len(self.terms)): self.gridDisplayScrolledPanel.SetColLabelValue(col*2, self.terms[col]) self.gridDisplayScrolledPanel.SetColLabelValue(col*2+1, 'weights') # finish labeling notes on last self.gridDisplayScrolledPanel.SetColLabelValue(len(self.terms)*2, 'notes') # fill the content self.updateMeasuredData() # Cell Defaults self.gridDisplayScrolledPanel.SetDefaultCellAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) self.boxSizerPanelDisplay.Add(self.gridDisplayScrolledPanel, 1, wx.ALIGN_CENTRE | wx.ALL, 5) # Cell autoSize self.gridDisplayScrolledPanel.AutoSize() # Cell Change event self.gridDisplayScrolledPanel.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onDisplayCellChange) # Cell background color hack (make cells background = panel background for beauty) color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE) self.gridDisplayScrolledPanel.SetDefaultCellBackgroundColour(color) # relayout self.refreshWidget(self.gridDisplayScrolledPanel) ########################## # 2nd display grid label ########################## self.staticTextTitleDisplayDiff = wx.StaticText(self, wx.ID_ANY, "Key Differences", wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) self.staticTextTitleDisplayDiff.Wrap(-1) self.staticTextTitleDisplayDiff.SetFont(wx.Font(18, 70, 90, 92, False, wx.EmptyString)) self.boxSizerPanelDisplay.Add(self.staticTextTitleDisplayDiff, 0, wx.ALIGN_CENTRE | wx.ALL, 5) ############################### # 2nd display difference grid ############################### self.gridDisplayDiffScrolledPanel = wx.grid.Grid(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) # Grid self.gridDisplayDiffScrolledPanel.CreateGrid(len(self.diff), 2) self.gridDisplayDiffScrolledPanel.EnableEditing(self.gridEditable) self.gridDisplayDiffScrolledPanel.EnableGridLines(True) self.gridDisplayDiffScrolledPanel.EnableDragGridSize(False) self.gridDisplayDiffScrolledPanel.SetMargins(0, 0) # Columns self.gridDisplayDiffScrolledPanel.EnableDragColMove(False) self.gridDisplayDiffScrolledPanel.EnableDragColSize(True) self.gridDisplayDiffScrolledPanel.SetColLabelSize(30) self.gridDisplayDiffScrolledPanel.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # set value column (index 0 column non-editable) colAttr = wx.grid.GridCellAttr() colAttr.SetReadOnly(True) self.gridDisplayDiffScrolledPanel.SetColAttr(0, colAttr) # Rows self.gridDisplayDiffScrolledPanel.EnableDragRowSize(True) self.gridDisplayDiffScrolledPanel.SetRowLabelSize(200) self.gridDisplayDiffScrolledPanel.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # Label Appearance for row in range(len(self.diff)): self.gridDisplayDiffScrolledPanel.SetRowLabelValue(row, self.diff[row]) self.gridDisplayDiffScrolledPanel.SetColLabelValue(0, 'value') self.gridDisplayDiffScrolledPanel.SetColLabelValue(1, 'weights') # fill the content self.updateDiffData() # Cell Defaults self.gridDisplayDiffScrolledPanel.SetDefaultCellAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) self.boxSizerPanelDisplay.Add(self.gridDisplayDiffScrolledPanel, 1, wx.ALIGN_CENTRE | wx.ALL, 5) # Cell autoSize self.gridDisplayDiffScrolledPanel.AutoSize() # Cell Change event self.gridDisplayDiffScrolledPanel.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onDiffCellChange) # Cell background color hack (make cells background = panel background for beauty) color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE) self.gridDisplayDiffScrolledPanel.SetDefaultCellBackgroundColour(color) # relayout self.refreshWidget(self.gridDisplayScrolledPanel) boxSizerPanelSection.Add( self.boxSizerPanelDisplay, 1, wx.EXPAND |wx.ALL, 5 ) ############# LEFT PANEL ############## ############# RIGHT PANEL ############# self.bSizerPanelControl = wx.BoxSizer( wx.VERTICAL ) boxSizerPanelSection.Add( self.bSizerPanelControl, 0, wx.EXPAND, 5 ) ############ RIGHT PANEL ############## self.SetSizer(boxSizerPanelSection) self.Layout() self.SetupScrolling() boxSizerPanelSection.Fit(self)
def __init__(self, parent, stage): self.__savedPositionFile__ = os.path.dirname( __file__) + "/.savedPositions.txt" self.stage = stage self.savedPositions = [] self.__parsedSavedPositions__() FrameBase.__init__(self, parent, id=wx.ID_ANY, title=u"NewFocus 8081 Stage Aligning App", pos=wx.DefaultPosition, size=wx.Size(600, 750), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizerFrameMain = wx.BoxSizer(wx.VERTICAL) self.panelMain = ScrolledPanelBase(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizerPanelMain = wx.BoxSizer(wx.VERTICAL) self.staticTextTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"NewFocus 8081 Stage Aligning", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextTitle.Wrap(-1) self.staticTextTitle.SetFont( wx.Font(14, 70, 90, 92, False, wx.EmptyString)) bSizerPanelMain.Add(self.staticTextTitle, 0, wx.ALIGN_CENTER | wx.ALL, 5) sbSizerDispaly = wx.StaticBoxSizer( wx.StaticBox(self.panelMain, wx.ID_ANY, u"Displays"), wx.HORIZONTAL) fgSizerDisplayDisplacements = wx.FlexGridSizer(5, 3, 0, 0) fgSizerDisplayDisplacements.SetFlexibleDirection(wx.BOTH) fgSizerDisplayDisplacements.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED) self.staticTextDisplayXtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Xtrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXtransTitle.Wrap(-1) self.staticTextDisplayXtransTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXtransTitle, 0, wx.ALL, 5) self.staticTextDisplayXtransValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXtransValue.Wrap(-1) self.staticTextDisplayXtransValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXtransValue, 0, wx.ALL, 5) self.staticTextDisplayXtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXtransUnits.Wrap(-1) self.staticTextDisplayXtransUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXtransUnits, 0, wx.ALL, 5) self.staticTextDisplayYtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Ytrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayYtransTitle.Wrap(-1) self.staticTextDisplayYtransTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayYtransTitle, 0, wx.ALL, 5) self.staticTextDisplayYtransValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayYtransValue.Wrap(-1) self.staticTextDisplayYtransValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayYtransValue, 0, wx.ALL, 5) self.staticTextDisplayYtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayYtransUnits.Wrap(-1) self.staticTextDisplayYtransUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayYtransUnits, 0, wx.ALL, 5) self.staticTextDisplayZtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Ztrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZtransTitle.Wrap(-1) self.staticTextDisplayZtransTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZtransTitle, 0, wx.ALL, 5) self.staticTextDisplayZtransValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZtransValue.Wrap(-1) self.staticTextDisplayZtransValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZtransValue, 0, wx.ALL, 5) self.staticTextDisplayZtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZtransUnits.Wrap(-1) self.staticTextDisplayZtransUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZtransUnits, 0, wx.ALL, 5) self.staticTextDisplayXrotTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Xrot:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXrotTitle.Wrap(-1) self.staticTextDisplayXrotTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXrotTitle, 0, wx.ALL, 5) self.staticTextDisplayXrotValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXrotValue.Wrap(-1) self.staticTextDisplayXrotValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXrotValue, 0, wx.ALL, 5) self.staticTextDisplayXrotUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"rad", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXrotUnits.Wrap(-1) self.staticTextDisplayXrotUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXrotUnits, 0, wx.ALL, 5) self.staticTextDisplayZrotTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Zrot:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZrotTitle.Wrap(-1) self.staticTextDisplayZrotTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZrotTitle, 0, wx.ALL, 5) self.staticTextDisplayZrotValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZrotValue.Wrap(-1) self.staticTextDisplayZrotValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZrotValue, 0, wx.ALL, 5) self.staticTextDisplayZrotUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"rad", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZrotUnits.Wrap(-1) self.staticTextDisplayZrotUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZrotUnits, 0, wx.ALL, 5) sbSizerDispaly.Add(fgSizerDisplayDisplacements, 1, wx.EXPAND, 5) self.staticlineDisplaySep = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) sbSizerDispaly.Add(self.staticlineDisplaySep, 0, wx.EXPAND | wx.ALL, 5) fgSizerDisplayMotorSteps = wx.FlexGridSizer(5, 2, 0, 0) fgSizerDisplayMotorSteps.SetFlexibleDirection(wx.BOTH) fgSizerDisplayMotorSteps.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED) self.staticTextDisplayPx1Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"px1:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPx1Title.Wrap(-1) self.staticTextDisplayPx1Title.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPx1Title, 0, wx.ALL, 5) self.staticTextDisplayPx1Value = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPx1Value.Wrap(-1) self.staticTextDisplayPx1Value.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPx1Value, 0, wx.ALL, 5) self.staticTextDisplayPx2Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"px2:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPx2Title.Wrap(-1) self.staticTextDisplayPx2Title.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPx2Title, 0, wx.ALL, 5) self.staticTextDisplayPx2Value = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPx2Value.Wrap(-1) self.staticTextDisplayPx2Value.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPx2Value, 0, wx.ALL, 5) self.staticTextDisplayPyTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"py:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPyTitle.Wrap(-1) self.staticTextDisplayPyTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPyTitle, 0, wx.ALL, 5) self.staticTextDisplayPyValue = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPyValue.Wrap(-1) self.staticTextDisplayPyValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPyValue, 0, wx.ALL, 5) self.staticTextDisplayPz1Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"pz1:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPz1Title.Wrap(-1) self.staticTextDisplayPz1Title.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPz1Title, 0, wx.ALL, 5) self.staticTextDisplayPz1Value = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPz1Value.Wrap(-1) self.staticTextDisplayPz1Value.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPz1Value, 0, wx.ALL, 5) self.staticTextDisplayPz2Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"pz2:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPz2Title.Wrap(-1) self.staticTextDisplayPz2Title.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPz2Title, 0, wx.ALL, 5) self.staticTextDisplayPz2Value = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPz2Value.Wrap(-1) self.staticTextDisplayPz2Value.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPz2Value, 0, wx.ALL, 5) sbSizerDispaly.Add(fgSizerDisplayMotorSteps, 1, wx.ALL | wx.EXPAND, 5) bSizerPanelMain.Add(sbSizerDispaly, 1, wx.ALL | wx.EXPAND, 5) radioBoxChangeByChoices = [u"SI units", u"motor steps"] self.radioBoxChangeBy = wx.RadioBox(self.panelMain, wx.ID_ANY, u"Change By", wx.DefaultPosition, wx.DefaultSize, radioBoxChangeByChoices, 1, wx.RA_SPECIFY_ROWS) self.radioBoxChangeBy.SetSelection(0) bSizerPanelMain.Add(self.radioBoxChangeBy, 0, wx.ALL, 5) sbSizerChange = wx.StaticBoxSizer( wx.StaticBox(self.panelMain, wx.ID_ANY, u"Change Values"), wx.HORIZONTAL) fgSizerChangeDisplacements = wx.FlexGridSizer(5, 3, 0, 0) fgSizerChangeDisplacements.SetFlexibleDirection(wx.BOTH) fgSizerChangeDisplacements.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED) self.staticTextChangeXtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Xtrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeXtransTitle.Wrap(-1) self.staticTextChangeXtransTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeXtransTitle, 0, wx.ALL, 5) self.textCtrlChangeXtrans = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeXtrans.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeXtrans, 0, wx.ALL, 5) self.staticTextChangeXtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeXtransUnits.Wrap(-1) self.staticTextChangeXtransUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeXtransUnits, 0, wx.ALL, 5) self.staticTextChangeYtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Ytrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeYtransTitle.Wrap(-1) self.staticTextChangeYtransTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeYtransTitle, 0, wx.ALL, 5) self.textCtrlChangeYtrans = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeYtrans.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeYtrans, 0, wx.ALL, 5) self.staticTextChangeYtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeYtransUnits.Wrap(-1) self.staticTextChangeYtransUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeYtransUnits, 0, wx.ALL, 5) self.staticTextChangeZtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Ztrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeZtransTitle.Wrap(-1) self.staticTextChangeZtransTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeZtransTitle, 0, wx.ALL, 5) self.textCtrlChangeZtrans = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeZtrans.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeZtrans, 0, wx.ALL, 5) self.staticTextChangeZtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeZtransUnits.Wrap(-1) self.staticTextChangeZtransUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeZtransUnits, 0, wx.ALL, 5) self.staticTextChangeXrotTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"Xrot:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeXrotTitle.Wrap(-1) self.staticTextChangeXrotTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeXrotTitle, 0, wx.ALL, 5) self.textCtrlChangeXrot = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeXrot.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeXrot, 0, wx.ALL, 5) self.staticTextChangeXrotUnits = wx.StaticText(self.panelMain, wx.ID_ANY, u"rad", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeXrotUnits.Wrap(-1) self.staticTextChangeXrotUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeXrotUnits, 0, wx.ALL, 5) self.staticTextChangeZrotTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"Zrot:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeZrotTitle.Wrap(-1) self.staticTextChangeZrotTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeZrotTitle, 0, wx.ALL, 5) self.textCtrlChangeZrot = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeZrot.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeZrot, 0, wx.ALL, 5) self.staticTextChangeZrotUnits = wx.StaticText(self.panelMain, wx.ID_ANY, u"rad", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeZrotUnits.Wrap(-1) self.staticTextChangeZrotUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeZrotUnits, 0, wx.ALL, 5) sbSizerChange.Add(fgSizerChangeDisplacements, 1, wx.EXPAND, 5) self.staticlineChangeValuesSep = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) sbSizerChange.Add(self.staticlineChangeValuesSep, 0, wx.EXPAND | wx.ALL, 5) fgSizerChangeMotorSteps = wx.FlexGridSizer(5, 2, 0, 0) fgSizerChangeMotorSteps.SetFlexibleDirection(wx.BOTH) fgSizerChangeMotorSteps.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED) self.staticTextChangePx1Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"px1:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePx1Title.Wrap(-1) self.staticTextChangePx1Title.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePx1Title, 0, wx.ALL, 5) self.textCtrlChangePx1 = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePx1.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePx1.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePx1, 0, wx.ALL, 5) self.staticTextChangePx2Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"px2:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePx2Title.Wrap(-1) self.staticTextChangePx2Title.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePx2Title, 0, wx.ALL, 5) self.textCtrlChangePx2 = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePx2.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePx2.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePx2, 0, wx.ALL, 5) self.staticTextChangePyTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"py:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePyTitle.Wrap(-1) self.staticTextChangePyTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePyTitle, 0, wx.ALL, 5) self.textCtrlChangePy = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePy.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePy.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePy, 0, wx.ALL, 5) self.staticTextChangePz1Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"pz1:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePz1Title.Wrap(-1) self.staticTextChangePz1Title.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePz1Title, 0, wx.ALL, 5) self.textCtrlChangePz1 = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePz1.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePz1.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePz1, 0, wx.ALL, 5) self.staticTextChangePz2Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"pz2:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePz2Title.Wrap(-1) self.staticTextChangePz2Title.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePz2Title, 0, wx.ALL, 5) self.textCtrlChangePz2 = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePz2.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePz2.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePz2, 0, wx.ALL, 5) sbSizerChange.Add(fgSizerChangeMotorSteps, 1, wx.EXPAND, 5) bSizerPanelMain.Add(sbSizerChange, 0, wx.ALL | wx.EXPAND, 5) gSizerControls = wx.GridSizer(3, 2, 0, 0) self.buttonMove = wx.Button(self.panelMain, wx.ID_ANY, u"MOVE", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonMove.SetFont(wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonMove, 0, wx.ALL | wx.EXPAND, 5) self.buttonStop = wx.Button(self.panelMain, wx.ID_ANY, u"STOP", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonStop.SetFont(wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonStop, 0, wx.ALL | wx.EXPAND, 5) self.buttonSavePosition = wx.Button(self.panelMain, wx.ID_ANY, u"Save Position", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonSavePosition.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonSavePosition, 0, wx.ALL | wx.EXPAND, 5) self.buttonSelectPositions = wx.Button(self.panelMain, wx.ID_ANY, u"Select Positions (0)", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonSelectPositions.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonSelectPositions, 0, wx.ALL | wx.EXPAND, 5) self.buttonZeroAllChanges = wx.Button(self.panelMain, wx.ID_ANY, u"Zero All Changes", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonZeroAllChanges.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonZeroAllChanges, 0, wx.ALL | wx.EXPAND, 5) """ self.buttonSetZeroMotorSteps = wx.Button( self.panelMain, wx.ID_ANY, u"Set ZERO Motor Steps", wx.DefaultPosition, wx.DefaultSize, 0 ) self.buttonSetZeroMotorSteps.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) self.buttonSetZeroMotorSteps.SetToolTipString( u"Sets current positions as ZERO motor steps" ) gSizerControls.Add( self.buttonSetZeroMotorSteps, 0, wx.ALL|wx.EXPAND, 5 ) """ bSizerPanelMain.Add(gSizerControls, 0, wx.EXPAND, 5) self.panelMain.SetSizer(bSizerPanelMain) self.panelMain.Layout() self.panelMain.SetupScrolling() bSizerPanelMain.Fit(self.panelMain) bSizerFrameMain.Add(self.panelMain, 1, wx.EXPAND | wx.ALL, 0) self.SetSizer(bSizerFrameMain) self.Layout() self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_CLOSE, self.onClose) self.radioBoxChangeBy.Bind(wx.EVT_RADIOBOX, self.onSelectChangeBy) self.textCtrlChangeXtrans.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangeYtrans.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangeZtrans.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangeXrot.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangeZrot.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePx1.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePx2.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePy.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePz1.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePz2.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.buttonMove.Bind(wx.EVT_BUTTON, self.onMove) self.buttonStop.Bind(wx.EVT_BUTTON, self.onStop) self.buttonSavePosition.Bind(wx.EVT_BUTTON, self.onSavePosition) self.buttonSelectPositions.Bind(wx.EVT_BUTTON, self.onSelectionPositions) self.buttonZeroAllChanges.Bind(wx.EVT_BUTTON, self.onZeroAllChanges)
class FrameMain(FrameBase): def __init__(self, parent, stage): self.__savedPositionFile__ = os.path.dirname( __file__) + "/.savedPositions.txt" self.stage = stage self.savedPositions = [] self.__parsedSavedPositions__() FrameBase.__init__(self, parent, id=wx.ID_ANY, title=u"NewFocus 8081 Stage Aligning App", pos=wx.DefaultPosition, size=wx.Size(600, 750), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizerFrameMain = wx.BoxSizer(wx.VERTICAL) self.panelMain = ScrolledPanelBase(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizerPanelMain = wx.BoxSizer(wx.VERTICAL) self.staticTextTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"NewFocus 8081 Stage Aligning", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextTitle.Wrap(-1) self.staticTextTitle.SetFont( wx.Font(14, 70, 90, 92, False, wx.EmptyString)) bSizerPanelMain.Add(self.staticTextTitle, 0, wx.ALIGN_CENTER | wx.ALL, 5) sbSizerDispaly = wx.StaticBoxSizer( wx.StaticBox(self.panelMain, wx.ID_ANY, u"Displays"), wx.HORIZONTAL) fgSizerDisplayDisplacements = wx.FlexGridSizer(5, 3, 0, 0) fgSizerDisplayDisplacements.SetFlexibleDirection(wx.BOTH) fgSizerDisplayDisplacements.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED) self.staticTextDisplayXtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Xtrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXtransTitle.Wrap(-1) self.staticTextDisplayXtransTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXtransTitle, 0, wx.ALL, 5) self.staticTextDisplayXtransValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXtransValue.Wrap(-1) self.staticTextDisplayXtransValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXtransValue, 0, wx.ALL, 5) self.staticTextDisplayXtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXtransUnits.Wrap(-1) self.staticTextDisplayXtransUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXtransUnits, 0, wx.ALL, 5) self.staticTextDisplayYtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Ytrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayYtransTitle.Wrap(-1) self.staticTextDisplayYtransTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayYtransTitle, 0, wx.ALL, 5) self.staticTextDisplayYtransValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayYtransValue.Wrap(-1) self.staticTextDisplayYtransValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayYtransValue, 0, wx.ALL, 5) self.staticTextDisplayYtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayYtransUnits.Wrap(-1) self.staticTextDisplayYtransUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayYtransUnits, 0, wx.ALL, 5) self.staticTextDisplayZtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Ztrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZtransTitle.Wrap(-1) self.staticTextDisplayZtransTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZtransTitle, 0, wx.ALL, 5) self.staticTextDisplayZtransValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZtransValue.Wrap(-1) self.staticTextDisplayZtransValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZtransValue, 0, wx.ALL, 5) self.staticTextDisplayZtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZtransUnits.Wrap(-1) self.staticTextDisplayZtransUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZtransUnits, 0, wx.ALL, 5) self.staticTextDisplayXrotTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Xrot:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXrotTitle.Wrap(-1) self.staticTextDisplayXrotTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXrotTitle, 0, wx.ALL, 5) self.staticTextDisplayXrotValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXrotValue.Wrap(-1) self.staticTextDisplayXrotValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXrotValue, 0, wx.ALL, 5) self.staticTextDisplayXrotUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"rad", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayXrotUnits.Wrap(-1) self.staticTextDisplayXrotUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayXrotUnits, 0, wx.ALL, 5) self.staticTextDisplayZrotTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Zrot:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZrotTitle.Wrap(-1) self.staticTextDisplayZrotTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZrotTitle, 0, wx.ALL, 5) self.staticTextDisplayZrotValue = wx.StaticText( self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZrotValue.Wrap(-1) self.staticTextDisplayZrotValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZrotValue, 0, wx.ALL, 5) self.staticTextDisplayZrotUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"rad", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayZrotUnits.Wrap(-1) self.staticTextDisplayZrotUnits.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayDisplacements.Add(self.staticTextDisplayZrotUnits, 0, wx.ALL, 5) sbSizerDispaly.Add(fgSizerDisplayDisplacements, 1, wx.EXPAND, 5) self.staticlineDisplaySep = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) sbSizerDispaly.Add(self.staticlineDisplaySep, 0, wx.EXPAND | wx.ALL, 5) fgSizerDisplayMotorSteps = wx.FlexGridSizer(5, 2, 0, 0) fgSizerDisplayMotorSteps.SetFlexibleDirection(wx.BOTH) fgSizerDisplayMotorSteps.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED) self.staticTextDisplayPx1Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"px1:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPx1Title.Wrap(-1) self.staticTextDisplayPx1Title.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPx1Title, 0, wx.ALL, 5) self.staticTextDisplayPx1Value = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPx1Value.Wrap(-1) self.staticTextDisplayPx1Value.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPx1Value, 0, wx.ALL, 5) self.staticTextDisplayPx2Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"px2:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPx2Title.Wrap(-1) self.staticTextDisplayPx2Title.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPx2Title, 0, wx.ALL, 5) self.staticTextDisplayPx2Value = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPx2Value.Wrap(-1) self.staticTextDisplayPx2Value.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPx2Value, 0, wx.ALL, 5) self.staticTextDisplayPyTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"py:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPyTitle.Wrap(-1) self.staticTextDisplayPyTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPyTitle, 0, wx.ALL, 5) self.staticTextDisplayPyValue = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPyValue.Wrap(-1) self.staticTextDisplayPyValue.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPyValue, 0, wx.ALL, 5) self.staticTextDisplayPz1Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"pz1:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPz1Title.Wrap(-1) self.staticTextDisplayPz1Title.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPz1Title, 0, wx.ALL, 5) self.staticTextDisplayPz1Value = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPz1Value.Wrap(-1) self.staticTextDisplayPz1Value.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPz1Value, 0, wx.ALL, 5) self.staticTextDisplayPz2Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"pz2:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPz2Title.Wrap(-1) self.staticTextDisplayPz2Title.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPz2Title, 0, wx.ALL, 5) self.staticTextDisplayPz2Value = wx.StaticText(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextDisplayPz2Value.Wrap(-1) self.staticTextDisplayPz2Value.SetFont( wx.Font(12, 70, 90, 92, False, wx.EmptyString)) fgSizerDisplayMotorSteps.Add(self.staticTextDisplayPz2Value, 0, wx.ALL, 5) sbSizerDispaly.Add(fgSizerDisplayMotorSteps, 1, wx.ALL | wx.EXPAND, 5) bSizerPanelMain.Add(sbSizerDispaly, 1, wx.ALL | wx.EXPAND, 5) radioBoxChangeByChoices = [u"SI units", u"motor steps"] self.radioBoxChangeBy = wx.RadioBox(self.panelMain, wx.ID_ANY, u"Change By", wx.DefaultPosition, wx.DefaultSize, radioBoxChangeByChoices, 1, wx.RA_SPECIFY_ROWS) self.radioBoxChangeBy.SetSelection(0) bSizerPanelMain.Add(self.radioBoxChangeBy, 0, wx.ALL, 5) sbSizerChange = wx.StaticBoxSizer( wx.StaticBox(self.panelMain, wx.ID_ANY, u"Change Values"), wx.HORIZONTAL) fgSizerChangeDisplacements = wx.FlexGridSizer(5, 3, 0, 0) fgSizerChangeDisplacements.SetFlexibleDirection(wx.BOTH) fgSizerChangeDisplacements.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED) self.staticTextChangeXtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Xtrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeXtransTitle.Wrap(-1) self.staticTextChangeXtransTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeXtransTitle, 0, wx.ALL, 5) self.textCtrlChangeXtrans = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeXtrans.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeXtrans, 0, wx.ALL, 5) self.staticTextChangeXtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeXtransUnits.Wrap(-1) self.staticTextChangeXtransUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeXtransUnits, 0, wx.ALL, 5) self.staticTextChangeYtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Ytrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeYtransTitle.Wrap(-1) self.staticTextChangeYtransTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeYtransTitle, 0, wx.ALL, 5) self.textCtrlChangeYtrans = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeYtrans.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeYtrans, 0, wx.ALL, 5) self.staticTextChangeYtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeYtransUnits.Wrap(-1) self.staticTextChangeYtransUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeYtransUnits, 0, wx.ALL, 5) self.staticTextChangeZtransTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"Ztrans:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeZtransTitle.Wrap(-1) self.staticTextChangeZtransTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeZtransTitle, 0, wx.ALL, 5) self.textCtrlChangeZtrans = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeZtrans.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeZtrans, 0, wx.ALL, 5) self.staticTextChangeZtransUnits = wx.StaticText( self.panelMain, wx.ID_ANY, u"mm", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeZtransUnits.Wrap(-1) self.staticTextChangeZtransUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeZtransUnits, 0, wx.ALL, 5) self.staticTextChangeXrotTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"Xrot:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeXrotTitle.Wrap(-1) self.staticTextChangeXrotTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeXrotTitle, 0, wx.ALL, 5) self.textCtrlChangeXrot = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeXrot.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeXrot, 0, wx.ALL, 5) self.staticTextChangeXrotUnits = wx.StaticText(self.panelMain, wx.ID_ANY, u"rad", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeXrotUnits.Wrap(-1) self.staticTextChangeXrotUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeXrotUnits, 0, wx.ALL, 5) self.staticTextChangeZrotTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"Zrot:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeZrotTitle.Wrap(-1) self.staticTextChangeZrotTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeZrotTitle, 0, wx.ALL, 5) self.textCtrlChangeZrot = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0.000000", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangeZrot.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.textCtrlChangeZrot, 0, wx.ALL, 5) self.staticTextChangeZrotUnits = wx.StaticText(self.panelMain, wx.ID_ANY, u"rad", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangeZrotUnits.Wrap(-1) self.staticTextChangeZrotUnits.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeDisplacements.Add(self.staticTextChangeZrotUnits, 0, wx.ALL, 5) sbSizerChange.Add(fgSizerChangeDisplacements, 1, wx.EXPAND, 5) self.staticlineChangeValuesSep = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) sbSizerChange.Add(self.staticlineChangeValuesSep, 0, wx.EXPAND | wx.ALL, 5) fgSizerChangeMotorSteps = wx.FlexGridSizer(5, 2, 0, 0) fgSizerChangeMotorSteps.SetFlexibleDirection(wx.BOTH) fgSizerChangeMotorSteps.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED) self.staticTextChangePx1Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"px1:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePx1Title.Wrap(-1) self.staticTextChangePx1Title.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePx1Title, 0, wx.ALL, 5) self.textCtrlChangePx1 = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePx1.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePx1.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePx1, 0, wx.ALL, 5) self.staticTextChangePx2Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"px2:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePx2Title.Wrap(-1) self.staticTextChangePx2Title.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePx2Title, 0, wx.ALL, 5) self.textCtrlChangePx2 = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePx2.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePx2.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePx2, 0, wx.ALL, 5) self.staticTextChangePyTitle = wx.StaticText(self.panelMain, wx.ID_ANY, u"py:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePyTitle.Wrap(-1) self.staticTextChangePyTitle.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePyTitle, 0, wx.ALL, 5) self.textCtrlChangePy = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePy.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePy.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePy, 0, wx.ALL, 5) self.staticTextChangePz1Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"pz1:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePz1Title.Wrap(-1) self.staticTextChangePz1Title.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePz1Title, 0, wx.ALL, 5) self.textCtrlChangePz1 = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePz1.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePz1.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePz1, 0, wx.ALL, 5) self.staticTextChangePz2Title = wx.StaticText(self.panelMain, wx.ID_ANY, u"pz2:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextChangePz2Title.Wrap(-1) self.staticTextChangePz2Title.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) fgSizerChangeMotorSteps.Add(self.staticTextChangePz2Title, 0, wx.ALL, 5) self.textCtrlChangePz2 = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlChangePz2.SetFont( wx.Font(10, 70, 90, 92, False, wx.EmptyString)) self.textCtrlChangePz2.Enable(False) fgSizerChangeMotorSteps.Add(self.textCtrlChangePz2, 0, wx.ALL, 5) sbSizerChange.Add(fgSizerChangeMotorSteps, 1, wx.EXPAND, 5) bSizerPanelMain.Add(sbSizerChange, 0, wx.ALL | wx.EXPAND, 5) gSizerControls = wx.GridSizer(3, 2, 0, 0) self.buttonMove = wx.Button(self.panelMain, wx.ID_ANY, u"MOVE", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonMove.SetFont(wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonMove, 0, wx.ALL | wx.EXPAND, 5) self.buttonStop = wx.Button(self.panelMain, wx.ID_ANY, u"STOP", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonStop.SetFont(wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonStop, 0, wx.ALL | wx.EXPAND, 5) self.buttonSavePosition = wx.Button(self.panelMain, wx.ID_ANY, u"Save Position", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonSavePosition.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonSavePosition, 0, wx.ALL | wx.EXPAND, 5) self.buttonSelectPositions = wx.Button(self.panelMain, wx.ID_ANY, u"Select Positions (0)", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonSelectPositions.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonSelectPositions, 0, wx.ALL | wx.EXPAND, 5) self.buttonZeroAllChanges = wx.Button(self.panelMain, wx.ID_ANY, u"Zero All Changes", wx.DefaultPosition, wx.DefaultSize, 0) self.buttonZeroAllChanges.SetFont( wx.Font(10, 70, 90, 90, False, wx.EmptyString)) gSizerControls.Add(self.buttonZeroAllChanges, 0, wx.ALL | wx.EXPAND, 5) """ self.buttonSetZeroMotorSteps = wx.Button( self.panelMain, wx.ID_ANY, u"Set ZERO Motor Steps", wx.DefaultPosition, wx.DefaultSize, 0 ) self.buttonSetZeroMotorSteps.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) self.buttonSetZeroMotorSteps.SetToolTipString( u"Sets current positions as ZERO motor steps" ) gSizerControls.Add( self.buttonSetZeroMotorSteps, 0, wx.ALL|wx.EXPAND, 5 ) """ bSizerPanelMain.Add(gSizerControls, 0, wx.EXPAND, 5) self.panelMain.SetSizer(bSizerPanelMain) self.panelMain.Layout() self.panelMain.SetupScrolling() bSizerPanelMain.Fit(self.panelMain) bSizerFrameMain.Add(self.panelMain, 1, wx.EXPAND | wx.ALL, 0) self.SetSizer(bSizerFrameMain) self.Layout() self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_CLOSE, self.onClose) self.radioBoxChangeBy.Bind(wx.EVT_RADIOBOX, self.onSelectChangeBy) self.textCtrlChangeXtrans.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangeYtrans.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangeZtrans.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangeXrot.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangeZrot.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePx1.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePx2.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePy.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePz1.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.textCtrlChangePz2.Bind(wx.EVT_TEXT_ENTER, self.onChangePositionValuesEnter) self.buttonMove.Bind(wx.EVT_BUTTON, self.onMove) self.buttonStop.Bind(wx.EVT_BUTTON, self.onStop) self.buttonSavePosition.Bind(wx.EVT_BUTTON, self.onSavePosition) self.buttonSelectPositions.Bind(wx.EVT_BUTTON, self.onSelectionPositions) self.buttonZeroAllChanges.Bind(wx.EVT_BUTTON, self.onZeroAllChanges) #self.buttonSetZeroMotorSteps.Bind( wx.EVT_BUTTON, self.onSetZeroMotorSteps ) def __del__(self): pass def __parsedSavedPositions__(self): if os.path.exists(self.__savedPositionFile__): fHandle = open(self.__savedPositionFile__, 'r') for entry in fHandle: self.savedPositions.append(entry) fHandle.close() def enableControlButtons(self, enable): """ @Purpose: Enable the control buttons or not @Inputs: (bool) enable = True for enabling all control buttons, False otherwise """ self.buttonMove.Enable(enable) self.buttonSelectPositions.Enable(enable) self.buttonSavePosition.Enable(enable) self.buttonZeroAllChanges.Enable(enable) #self.buttonSetZeroMotorSteps.Enable(enable) def move(self): self.enableControlButtons(False) if self.radioBoxChangeBy.GetSelection() == 0: changes = [ float(self.textCtrlChangeXtrans.GetValue()), float(self.textCtrlChangeYtrans.GetValue()), float(self.textCtrlChangeZtrans.GetValue()), float(self.textCtrlChangeXrot.GetValue()), float(self.textCtrlChangeZrot.GetValue()) ] self.stage.translateX(changes[0]) self.stage.translateY(changes[1]) self.stage.translateZ(changes[2]) self.stage.rotateX(changes[3]) self.stage.rotateZ(changes[4]) else: changes = { 'px1': int(self.textCtrlChangePx1.GetValue()), 'px2': int(self.textCtrlChangePx2.GetValue()), 'py': int(self.textCtrlChangePy.GetValue()), 'pz1': int(self.textCtrlChangePz1.GetValue()), 'pz2': int(self.textCtrlChangePz2.GetValue()) } for motor in changes.keys(): self.stage.moveMotor(motor, changes[motor]) self.updateDisplay() self.onZeroAllChanges(None) self.enableControlButtons(True) def updateDisplay(self): """ @Purpose: update the display values @Inputs: (list) SI_units_changes = list of changes in SI units """ motorPositions = self.stage.getMotorPositions() positions = self.stage.getPositions() self.staticTextDisplayPx1Value.SetLabel("%d" % motorPositions[0]) self.staticTextDisplayPx2Value.SetLabel("%d" % motorPositions[1]) self.staticTextDisplayPyValue.SetLabel("%d" % motorPositions[2]) self.staticTextDisplayPz1Value.SetLabel("%d" % motorPositions[3]) self.staticTextDisplayPz2Value.SetLabel("%d" % motorPositions[4]) self.staticTextDisplayXtransValue.SetLabel("%0.6f" % positions[0]) self.staticTextDisplayYtransValue.SetLabel("%0.6f" % positions[1]) self.staticTextDisplayZtransValue.SetLabel("%0.6f" % positions[2]) self.staticTextDisplayXrotValue.SetLabel("%0.6f" % positions[3]) self.staticTextDisplayZrotValue.SetLabel("%0.6f" % positions[4]) # Virtual event handlers, overide them in your derived class def onClose(self, event): threadID = self.__startThread__(self.stage.__del__) threadMap = self.__getThreadMap__() # start the progress (pulse) dialog pulseDialog = wx.ProgressDialog( "Closing...", "Moving Motors to ZERO steps, Please Wait...", maximum=100, parent=self, style=wx.PD_APP_MODAL) while threadMap[threadID].isAlive(): pulseDialog.Pulse() time.sleep(0.01) pulseDialog.Destroy() self.Destroy() def onSelectChangeBy(self, event): if self.radioBoxChangeBy.GetSelection() == 0: self.textCtrlChangeXtrans.Enable(True) self.textCtrlChangeYtrans.Enable(True) self.textCtrlChangeZtrans.Enable(True) self.textCtrlChangeXrot.Enable(True) self.textCtrlChangeZrot.Enable(True) self.textCtrlChangePx1.Enable(False) self.textCtrlChangePx2.Enable(False) self.textCtrlChangePy.Enable(False) self.textCtrlChangePz1.Enable(False) self.textCtrlChangePz2.Enable(False) else: self.textCtrlChangeXtrans.Enable(False) self.textCtrlChangeYtrans.Enable(False) self.textCtrlChangeZtrans.Enable(False) self.textCtrlChangeXrot.Enable(False) self.textCtrlChangeZrot.Enable(False) self.textCtrlChangePx1.Enable(True) self.textCtrlChangePx2.Enable(True) self.textCtrlChangePy.Enable(True) self.textCtrlChangePz1.Enable(True) self.textCtrlChangePz2.Enable(True) def onChangePositionValuesEnter(self, event): self.buttonSelectPositions.SetLabel("Select Positions (0)") def onMove(self, event): self.__startThread__(self.move) def onStop(self, event): self.stage.abortAll() self.updateDisplay() self.enableControlButtons(True) def onSavePosition(self, event): commentDlg = wx.TextEntryDialog( self, "Optional: Please enter a comment on this position.", "Enter a comment for this position.", "") if commentDlg.ShowModal() == wx.ID_OK: comment = commentDlg.GetValue() pos = tuple(self.stage.getMotorPositions()) savedEntry = str(pos) + ";" + comment self.savedPositions.append(savedEntry) fHandle = open(self.__savedPositionFile__, 'a') fHandle.write(savedEntry + '\n') fHandle.close() def onSelectionPositions(self, event): choiceDlg = wx.SingleChoiceDialog( self, "Please Select a position to setup the changes.", "Select a Position", self.savedPositions, wx.CHOICEDLG_STYLE) choiceDlg.SetSize(wx.Size(700, 300)) if choiceDlg.ShowModal() == wx.ID_OK: ind = choiceDlg.GetSelection() entry = self.savedPositions[ind] motorPos = eval(entry.split(';')[0]) # set them up self.radioBoxChangeBy.SetSelection(1) self.onSelectChangeBy(event) self.textCtrlChangePx1.SetValue(str(motorPos[0])) self.textCtrlChangePx2.SetValue(str(motorPos[1])) self.textCtrlChangePy.SetValue(str(motorPos[2])) self.textCtrlChangePz1.SetValue(str(motorPos[3])) self.textCtrlChangePz2.SetValue(str(motorPos[4])) self.buttonSelectPositions.SetLabel("Select Positions (" + str(ind) + ")") def onZeroAllChanges(self, event): self.textCtrlChangeXtrans.SetValue("0.000000") self.textCtrlChangeYtrans.SetValue("0.000000") self.textCtrlChangeZtrans.SetValue("0.000000") self.textCtrlChangeXrot.SetValue("0.000000") self.textCtrlChangeZrot.SetValue("0.000000") self.textCtrlChangePx1.SetValue("0") self.textCtrlChangePx2.SetValue("0") self.textCtrlChangePy.SetValue("0") self.textCtrlChangePz1.SetValue("0") self.textCtrlChangePz2.SetValue("0") self.onChangePositionValuesEnter(event) """
def __init__(self, parent, alignObj, mode): self.parent = parent self.topWindow = self.getTopWindow() self.mode = mode self.setAlignObj(alignObj, mode) (self.terms, self.params) = self.parseFieldsData() self.diff = self.parseDiffData() ##### custom params notes ##### self.paramsNotes = { 'z5': 'weights must be 0', 'z6': 'weights must be 0' } ScrolledPanelBase.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.CLIP_CHILDREN | wx.FULL_REPAINT_ON_RESIZE | wx.TAB_TRAVERSAL) #wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL) boxSizerPanelSection = wx.BoxSizer(wx.HORIZONTAL) ######### LEFT PANEL ########## self.boxSizerPanelDisplay = wx.BoxSizer(wx.VERTICAL) #self.scrolledWindowPanelDisplay = wx.ScrolledWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL) #self.scrolledWindowPanelDisplay.SetScrollRate(5, 5) #boxSizerScrolled = wx.BoxSizer(wx.VERTICAL) #self.panelContent = wx.Panel(self.scrolledWindowPanelDisplay, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.EXPAND|wx.ALL) #boxSizerContent = wx.BoxSizer(wx.VERTICAL) ########################## # 1st display grid label ########################## self.staticTextTitleDisplay = wx.StaticText( self, wx.ID_ANY, "Measured Dependent Variables and Weights", wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) self.staticTextTitleDisplay.Wrap(-1) self.staticTextTitleDisplay.SetFont( wx.Font(18, 70, 90, 92, False, wx.EmptyString)) self.boxSizerPanelDisplay.Add(self.staticTextTitleDisplay, 0, wx.ALIGN_CENTRE | wx.ALL, 5) ####################################### # 1st display fields / parameters grid ####################################### self.gridDisplayScrolledPanel = wx.grid.Grid(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) # Grid self.gridDisplayScrolledPanel.CreateGrid(len(self.params), len(self.terms) * 2 + 1) # (col + 1) cus of notes self.gridDisplayScrolledPanel.EnableEditing(self.gridEditable) self.gridDisplayScrolledPanel.EnableGridLines(True) self.gridDisplayScrolledPanel.EnableDragGridSize(False) self.gridDisplayScrolledPanel.SetMargins(0, 0) # Columns self.gridDisplayScrolledPanel.EnableDragColMove(False) self.gridDisplayScrolledPanel.EnableDragColSize(True) self.gridDisplayScrolledPanel.SetColLabelSize(30) self.gridDisplayScrolledPanel.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # Rows self.gridDisplayScrolledPanel.EnableDragRowSize(True) self.gridDisplayScrolledPanel.SetRowLabelSize(80) self.gridDisplayScrolledPanel.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # Label Appearance for row in range(len(self.params)): self.gridDisplayScrolledPanel.SetRowLabelValue( row, self.params[row]) for col in range(len(self.terms)): self.gridDisplayScrolledPanel.SetColLabelValue( col * 2, self.terms[col]) self.gridDisplayScrolledPanel.SetColLabelValue( col * 2 + 1, 'weights') # finish labeling notes on last self.gridDisplayScrolledPanel.SetColLabelValue( len(self.terms) * 2, 'notes') # fill the content self.updateMeasuredData() # Cell Defaults self.gridDisplayScrolledPanel.SetDefaultCellAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) self.boxSizerPanelDisplay.Add(self.gridDisplayScrolledPanel, 1, wx.ALIGN_CENTRE | wx.ALL, 5) # Cell autoSize self.gridDisplayScrolledPanel.AutoSize() # Cell Change event self.gridDisplayScrolledPanel.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onDisplayCellChange) # Cell background color hack (make cells background = panel background for beauty) color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE) self.gridDisplayScrolledPanel.SetDefaultCellBackgroundColour(color) # relayout self.refreshWidget(self.gridDisplayScrolledPanel) ########################## # 2nd display grid label ########################## self.staticTextTitleDisplayDiff = wx.StaticText( self, wx.ID_ANY, "Key Differences", wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) self.staticTextTitleDisplayDiff.Wrap(-1) self.staticTextTitleDisplayDiff.SetFont( wx.Font(18, 70, 90, 92, False, wx.EmptyString)) self.boxSizerPanelDisplay.Add(self.staticTextTitleDisplayDiff, 0, wx.ALIGN_CENTRE | wx.ALL, 5) ############################### # 2nd display difference grid ############################### self.gridDisplayDiffScrolledPanel = wx.grid.Grid( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.EXPAND) # Grid self.gridDisplayDiffScrolledPanel.CreateGrid(len(self.diff), 2) self.gridDisplayDiffScrolledPanel.EnableEditing(self.gridEditable) self.gridDisplayDiffScrolledPanel.EnableGridLines(True) self.gridDisplayDiffScrolledPanel.EnableDragGridSize(False) self.gridDisplayDiffScrolledPanel.SetMargins(0, 0) # Columns self.gridDisplayDiffScrolledPanel.EnableDragColMove(False) self.gridDisplayDiffScrolledPanel.EnableDragColSize(True) self.gridDisplayDiffScrolledPanel.SetColLabelSize(30) self.gridDisplayDiffScrolledPanel.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # set value column (index 0 column non-editable) colAttr = wx.grid.GridCellAttr() colAttr.SetReadOnly(True) self.gridDisplayDiffScrolledPanel.SetColAttr(0, colAttr) # Rows self.gridDisplayDiffScrolledPanel.EnableDragRowSize(True) self.gridDisplayDiffScrolledPanel.SetRowLabelSize(200) self.gridDisplayDiffScrolledPanel.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) # Label Appearance for row in range(len(self.diff)): self.gridDisplayDiffScrolledPanel.SetRowLabelValue( row, self.diff[row]) self.gridDisplayDiffScrolledPanel.SetColLabelValue(0, 'value') self.gridDisplayDiffScrolledPanel.SetColLabelValue(1, 'weights') # fill the content self.updateDiffData() # Cell Defaults self.gridDisplayDiffScrolledPanel.SetDefaultCellAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) self.boxSizerPanelDisplay.Add(self.gridDisplayDiffScrolledPanel, 1, wx.ALIGN_CENTRE | wx.ALL, 5) # Cell autoSize self.gridDisplayDiffScrolledPanel.AutoSize() # Cell Change event self.gridDisplayDiffScrolledPanel.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onDiffCellChange) # Cell background color hack (make cells background = panel background for beauty) color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE) self.gridDisplayDiffScrolledPanel.SetDefaultCellBackgroundColour(color) # relayout self.refreshWidget(self.gridDisplayScrolledPanel) boxSizerPanelSection.Add(self.boxSizerPanelDisplay, 1, wx.EXPAND | wx.ALL, 5) ############# LEFT PANEL ############## ############# RIGHT PANEL ############# self.bSizerPanelControl = wx.BoxSizer(wx.VERTICAL) boxSizerPanelSection.Add(self.bSizerPanelControl, 0, wx.EXPAND, 5) ############ RIGHT PANEL ############## self.SetSizer(boxSizerPanelSection) self.Layout() self.SetupScrolling() boxSizerPanelSection.Fit(self)
class FrameMain ( FrameBase ): def __init__( self, parent, metroProIP ): self.__isLoggingToFile__ = False self.timeStrFormat = "%Y-%m-%d %H:%M:%S" self.pobMeasureObj = PobMeasure(metroProIP, wxWidget=self) FrameBase.__init__ ( self, parent, id = wx.ID_ANY, title = "POB Measurement Automation", pos = wx.DefaultPosition, size = wx.Size( 1024,500 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) bSizerFrameMain = wx.BoxSizer( wx.VERTICAL ) self.panelMain = ScrolledPanelBase( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizerMain = wx.BoxSizer( wx.VERTICAL ) self.staticTextDisplayTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"POB Measurement Automation", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextDisplayTitle.Wrap( -1 ) self.staticTextDisplayTitle.SetFont( wx.Font( 20, 70, 90, 92, False, wx.EmptyString ) ) bSizerMain.Add( self.staticTextDisplayTitle, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) sbSizerDisplay = wx.StaticBoxSizer( wx.StaticBox( self.panelMain, wx.ID_ANY, u"Progress:" ), wx.VERTICAL ) self.textCtrlDisplayProgress = wx.TextCtrl( self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE|wx.TE_READONLY ) self.textCtrlDisplayProgress.SetFont( wx.Font( 16, 70, 90, 92, False, wx.EmptyString ) ) self.textCtrlDisplayProgress.SetMaxLength( 0 ) self.textCtrlDisplayProgress.SetForegroundColour( "WHITE" ) self.textCtrlDisplayProgress.SetBackgroundColour( "BLACK" ) sbSizerDisplay.Add( self.textCtrlDisplayProgress, 1, wx.ALL|wx.EXPAND, 5 ) bSizerMain.Add( sbSizerDisplay, 1, wx.EXPAND, 5 ) sbSizerParameters = wx.StaticBoxSizer( wx.StaticBox( self.panelMain, wx.ID_ANY, u"Parameters" ), wx.VERTICAL ) fgSizerParameters = wx.FlexGridSizer( 4, 6, 0, 0 ) fgSizerParameters.SetFlexibleDirection( wx.BOTH ) fgSizerParameters.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.staticTextParameterPobId = wx.StaticText( self.panelMain, wx.ID_ANY, u"POB ID:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterPobId.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterPobId, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterPobId = wx.TextCtrl( self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterPobId.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterPobId, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterFieldCoords = wx.StaticText( self.panelMain, wx.ID_ANY, u"Field Coords:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterFieldCoords.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterFieldCoords, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterFieldCoords = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"1", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterFieldCoords.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterFieldCoords, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterTsCenterFieldCoords = wx.StaticText( self.panelMain, wx.ID_ANY, u"TS Center Field Coords:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterTsCenterFieldCoords.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterTsCenterFieldCoords, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterTsCenterFieldCoords = wx.TextCtrl( self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterTsCenterFieldCoords.SetMaxLength( 0 ) self.textCtrlParameterTsCenterFieldCoords.SetToolTipString( u"enter 3 floats separated by commas" ) fgSizerParameters.Add( self.textCtrlParameterTsCenterFieldCoords, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterPobRotation = wx.StaticText( self.panelMain, wx.ID_ANY, u"POB Rotation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterPobRotation.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterPobRotation, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterPobRotation = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterPobRotation.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterPobRotation, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterNumAvgMapPerField = wx.StaticText( self.panelMain, wx.ID_ANY, u"# Avg Maps Per Field:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterNumAvgMapPerField.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterNumAvgMapPerField, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterNumAvgMapPerField = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"128", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterNumAvgMapPerField.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterNumAvgMapPerField, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterNumFieldRepeats = wx.StaticText( self.panelMain, wx.ID_ANY, u"# of Field Repeats:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterNumFieldRepeats.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterNumFieldRepeats, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterNumFieldRepeats = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"4", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterNumFieldRepeats.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterNumFieldRepeats, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterNumFullMeasRepeats = wx.StaticText( self.panelMain, wx.ID_ANY, u"# of Full Measurement Repeats:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterNumFullMeasRepeats.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterNumFullMeasRepeats, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterNumFullMeasRepeats = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"1", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterNumFullMeasRepeats.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterNumFullMeasRepeats, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterRetroRotation = wx.StaticText( self.panelMain, wx.ID_ANY, u"Retro Rotation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterRetroRotation.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterRetroRotation, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterRetroRotation = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterRetroRotation.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterRetroRotation, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterTestLetter = wx.StaticText( self.panelMain, wx.ID_ANY, u"Test Letter:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterTestLetter.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterTestLetter, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterTestLetter = wx.TextCtrl( self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterTestLetter.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterTestLetter, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterMeasurementStartDelay = wx.StaticText( self.panelMain, wx.ID_ANY, u"Measurement Start Delay (min):", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterMeasurementStartDelay.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterMeasurementStartDelay, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterMeasurementStartDelay = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizerParameters.Add( self.textCtrlParameterMeasurementStartDelay, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) sbSizerParameters.Add( fgSizerParameters, 1, wx.EXPAND, 5 ) bSizerMain.Add( sbSizerParameters, 0, wx.EXPAND, 5 ) sbSizerAutoNull = wx.StaticBoxSizer( wx.StaticBox( self.panelMain, wx.ID_ANY, u"AutoNull" ), wx.HORIZONTAL ) radioBoxAutoNullRSOptionsChoices = [ u"Tilt Only", u"Tilt + Power" ] self.radioBoxAutoNullRSOptions = wx.RadioBox( self.panelMain, wx.ID_ANY, u"RS Options:", wx.DefaultPosition, wx.DefaultSize, radioBoxAutoNullRSOptionsChoices, 1, wx.RA_SPECIFY_ROWS ) self.radioBoxAutoNullRSOptions.SetSelection( 0 ) sbSizerAutoNull.Add( self.radioBoxAutoNullRSOptions, 0, wx.ALL, 5 ) self.staticTextAutoNullRSIterTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"RS Iter:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextAutoNullRSIterTitle.Wrap( -1 ) sbSizerAutoNull.Add( self.staticTextAutoNullRSIterTitle, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlAutoNullRSIter = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizerAutoNull.Add( self.textCtrlAutoNullRSIter, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) radioBoxAutoNullTSOptionsChoices = [ u"Tilt Only", u"Tilt + Power" ] self.radioBoxAutoNullTSOptions = wx.RadioBox( self.panelMain, wx.ID_ANY, u"TS Options", wx.DefaultPosition, wx.DefaultSize, radioBoxAutoNullTSOptionsChoices, 1, wx.RA_SPECIFY_ROWS ) self.radioBoxAutoNullTSOptions.SetSelection( 0 ) sbSizerAutoNull.Add( self.radioBoxAutoNullTSOptions, 0, wx.ALL, 5 ) self.staticTextAutoNullTSIterTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"TS Iter:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextAutoNullTSIterTitle.Wrap( -1 ) sbSizerAutoNull.Add( self.staticTextAutoNullTSIterTitle, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlAutoNullTSIter = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizerAutoNull.Add( self.textCtrlAutoNullTSIter, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizerMain.Add( sbSizerAutoNull, 0, wx.EXPAND, 5 ) sbSizerControls = wx.StaticBoxSizer( wx.StaticBox( self.panelMain, wx.ID_ANY, u"Controls" ), wx.HORIZONTAL ) self.buttonControlMeasure = wx.Button( self.panelMain, wx.ID_ANY, u"MEASURE", wx.DefaultPosition, wx.DefaultSize, 0 ) self.buttonControlMeasure.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) sbSizerControls.Add( self.buttonControlMeasure, 1, wx.ALL|wx.EXPAND, 5 ) self.buttonControlStop = wx.Button( self.panelMain, wx.ID_ANY, u"STOP", wx.DefaultPosition, wx.DefaultSize, 0 ) self.buttonControlStop.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) sbSizerControls.Add( self.buttonControlStop, 1, wx.ALL|wx.EXPAND, 5 ) bSizerMain.Add( sbSizerControls, 0, wx.EXPAND, 5 ) self.panelMain.SetSizer( bSizerMain ) self.panelMain.Layout() self.panelMain.SetupScrolling() bSizerMain.Fit( self.panelMain ) bSizerFrameMain.Add( self.panelMain, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( bSizerFrameMain ) self.Layout() # MenuBar, Menu, and MenuItems self.menubarMain = wx.MenuBar( 0 ) self.menuLog = wx.Menu() self.menuItemLogToFile = wx.MenuItem( self.menuLog, wx.ID_ANY, u"Log To File", wx.EmptyString, wx.ITEM_CHECK ) self.menuLog.AppendItem( self.menuItemLogToFile ) self.menuItemClearConsoleLog = wx.MenuItem( self.menuLog, wx.ID_ANY, u"Clear Console Log", wx.EmptyString, wx.ITEM_CHECK ) self.menuLog.AppendItem( self.menuItemClearConsoleLog ) self.menubarMain.Append( self.menuLog, u"Log" ) self.menuAbout = wx.Menu() self.menuItemAbout = wx.MenuItem( self.menuAbout, wx.ID_ANY, u"About", wx.EmptyString, wx.ITEM_NORMAL ) self.menuAbout.AppendItem( self.menuItemAbout ) self.menubarMain.Append( self.menuAbout, u"About" ) self.SetMenuBar( self.menubarMain ) # Icon self.baseDir = os.path.dirname(os.path.abspath(__file__)) + "/" self.SetIcon(wx.Icon(self.baseDir+"icons/icon.ico", wx.BITMAP_TYPE_ICO)) # Connect Events self.buttonControlMeasure.Bind( wx.EVT_BUTTON, self.onControlMeasure ) self.buttonControlStop.Bind( wx.EVT_BUTTON, self.onControlStop ) self.Bind( wx.EVT_MENU, self.onMenuLogToFile, id = self.menuItemLogToFile.GetId() ) self.Bind( wx.EVT_MENU, self.onMenuClearConsoleLog, id = self.menuItemClearConsoleLog.GetId() ) self.Bind( wx.EVT_MENU, self.onMenuAbout, id = self.menuItemAbout.GetId() ) self.Bind(pob_measure_wx_event.EVT_POB_MEAS_PROG, self.onPobMeasureProgressEvent) self.Bind(pob_measure_wx_event.EVT_POB_MEAS_ERROR, self.onPobMeasureErrorEvent) self.Bind(pob_measure_wx_event.EVT_POB_UPDATE_TEST_LETTER, self.onPobUpdateTestLetterEvent) def __del__( self ): pass def __startLogToFile__(self): """ @Puprose: private function to start logging to file. """ self.logFileName = "%spob_measure_%s.log" % \ (os.path.dirname(os.path.abspath(__file__))+"/logs/", datetime.now().strftime("%Y%m%d%H%M%S")) logging.basicConfig(filename=self.logFileName, format="[%(asctime)s] %(levelname)s: %(message)s") def logEvents(self, level, message): """ @Purpose: logging any events happens during the measurement automation. It writes the log to GUI console and a log file. @Inputs: (str) level = 'info', 'warning', 'error', 'critical', 'exception' (str) message = logging message """ timeNowStr = datetime.now().strftime(self.timeStrFormat) self.textCtrlDisplayProgress.AppendText("[%s] %s: %s\n" % (timeNowStr, level.upper(), message)) eval("logging.%s(\"%s\")" % (level, message)) def setupAutoNullParameters(self): RSParams = {} if self.radioBoxAutoNullRSOptions.GetStringSelection() == "Tilt Only": RSParams['type'] = "RetroSph Trans" else: RSParams['type'] = "RetroSph Trans w Power" TSParams = {} if self.radioBoxAutoNullTSOptions.GetStringSelection() == "Tilt Only": TSParams['type'] = "TransSph Trans" else: TSParams['type'] = "TransSph Trans w Power" try: RSParams['iter'] = int(self.textCtrlAutoNullRSIter.GetValue()) TSParams['iter'] = int(self.textCtrlAutoNullTSIter.GetValue()) self.pobMeasureObj.setAutoNullParameter(RSParams, TSParams) except ValueError, exception: errMsg = "ERROR: Invalid Values for 'RS Iteration' or 'TS Iteration'." self.logEvents("error", errMsg) self.popErrorBox("ERROR: setAutoNullParameters", errMsg) print errMsg raise exception
class FrameMain(FrameBase): def __init__(self, parent): self.testAlignObj = None FrameBase.__init__(self, parent, id=wx.ID_ANY, title=u"test align gui", pos=wx.DefaultPosition, size=wx.Size(900, 600), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizerFrameMain = wx.BoxSizer(wx.VERTICAL) self.panelMain = ScrolledPanelBase(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizerPanelMain = wx.BoxSizer(wx.VERTICAL) bSizerFile = wx.BoxSizer(wx.HORIZONTAL) self.staticTextFileNameRoot = wx.StaticText(self.panelMain, wx.ID_ANY, u"File Name Root:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextFileNameRoot.Wrap(-1) bSizerFile.Add(self.staticTextFileNameRoot, 0, wx.ALL, 5) self.textCtrlFileNameRoot = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"ytesta", wx.DefaultPosition, wx.DefaultSize, 0) self.textCtrlFileNameRoot.SetMinSize(wx.Size(150, -1)) bSizerFile.Add(self.textCtrlFileNameRoot, 0, wx.ALL, 5) self.staticTextExtension = wx.StaticText(self.panelMain, wx.ID_ANY, u"Extension:", wx.DefaultPosition, wx.DefaultSize, 0) self.staticTextExtension.Wrap(-1) bSizerFile.Add(self.staticTextExtension, 0, wx.ALL, 5) self.textCtrlExtension = wx.TextCtrl(self.panelMain, wx.ID_ANY, u"dat", wx.DefaultPosition, wx.DefaultSize, 0) bSizerFile.Add(self.textCtrlExtension, 0, wx.ALL, 5) bSizerPanelMain.Add(bSizerFile, 0, wx.EXPAND, 5) bSizerMode = wx.BoxSizer(wx.HORIZONTAL) self.radioBoxModeChoices = [u"b", u"c", u"cghz", u"nocgh"] self.radioBoxMode = wx.RadioBox(self.panelMain, wx.ID_ANY, u"Mode", wx.DefaultPosition, wx.DefaultSize, self.radioBoxModeChoices, 1, wx.RA_SPECIFY_ROWS) self.radioBoxMode.SetSelection(0) bSizerMode.Add(self.radioBoxMode, 0, wx.ALL, 5) self.buttonFileUpdate = wx.Button(self.panelMain, wx.ID_ANY, u"UPDATE", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMode.Add(self.buttonFileUpdate, 0, wx.ALL | wx.EXPAND, 5) self.textCtrlOutput = wx.TextCtrl(self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) bSizerMode.Add(self.textCtrlOutput, 0, wx.ALL | wx.EXPAND, 5) self.buttonWriteReport = wx.Button(self.panelMain, wx.ID_ANY, u"Write Report", wx.DefaultPosition, wx.DefaultSize, 0) bSizerMode.Add(self.buttonWriteReport, 0, wx.ALL | wx.EXPAND, 5) bSizerPanelMain.Add(bSizerMode, 0, wx.EXPAND, 5) self.staticlineSep1 = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizerPanelMain.Add(self.staticlineSep1, 0, wx.EXPAND | wx.ALL, 5) bSizerGrids = wx.BoxSizer(wx.HORIZONTAL) # Grid data dataLabels = [ 'Variables', 'Input Values (nm)', 'Residual Values (nm)', 'Weights' ] dataTypes = [ gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_FLOAT + ':6,2', gridlib.GRID_VALUE_FLOAT + ':6,2', gridlib.GRID_VALUE_FLOAT + ':6,1' ] self.gridData1 = CustomDataGrid(self.panelMain, dataLabels, dataTypes) # Cell1 Defaults self.gridData1.SetDefaultCellFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) self.gridData1.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_TOP) bSizerGrids.Add(self.gridData1, 0, wx.ALL, 5) self.gridData1.Hide() self.staticlineGridSep = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL) bSizerGrids.Add(self.staticlineGridSep, 0, wx.EXPAND | wx.ALL, 5) # Cell2 Defaults dataLabels = [ 'Compensator', 'Force', 'Solve Amount', 'Unit', 'Include Move', 'Move Amount' ] dataTypes = [ gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_FLOAT + ':6,5', gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_BOOL, gridlib.GRID_VALUE_FLOAT + ':6,5' ] self.gridData2 = CustomDataGrid(self.panelMain, dataLabels, dataTypes) self.gridData2.SetDefaultCellFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) self.gridData2.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_TOP) bSizerGrids.Add(self.gridData2, 0, wx.ALL, 5) self.gridData2.Hide() self.setupDataTable() bSizerPanelMain.Add(bSizerGrids, 1, wx.EXPAND, 5) self.staticlineSep2 = wx.StaticLine(self.panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizerPanelMain.Add(self.staticlineSep2, 0, wx.EXPAND | wx.ALL, 5) bSizerControl = wx.BoxSizer(wx.HORIZONTAL) self.buttonSolve = wx.Button(self.panelMain, wx.ID_ANY, u"SOLVE", wx.DefaultPosition, wx.DefaultSize, 0) bSizerControl.Add(self.buttonSolve, 1, wx.ALL | wx.EXPAND, 5) self.buttonMove = wx.Button(self.panelMain, wx.ID_ANY, u"MOVE", wx.DefaultPosition, wx.DefaultSize, 0) bSizerControl.Add(self.buttonMove, 1, wx.ALL | wx.EXPAND, 5) bSizerPanelMain.Add(bSizerControl, 0, wx.EXPAND, 5) self.panelMain.SetSizer(bSizerPanelMain) self.panelMain.Layout() bSizerPanelMain.Fit(self.panelMain) bSizerFrameMain.Add(self.panelMain, 1, wx.EXPAND | wx.ALL, 0) self.SetSizer(bSizerFrameMain) self.Layout() self.Centre(wx.BOTH) # Connect Events self.buttonFileUpdate.Bind(wx.EVT_BUTTON, self.onFileUpdate) self.buttonWriteReport.Bind(wx.EVT_BUTTON, self.onWriteReport) self.gridData1.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onChangeParams) self.gridData2.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.onChangeParams) self.buttonSolve.Bind(wx.EVT_BUTTON, self.onSolve) self.buttonMove.Bind(wx.EVT_BUTTON, self.onMove) def __del__(self): pass def setupDataTable(self): # formating the column sizes (for fitting labels) readonlyColAttr = gridlib.GridCellAttr() readonlyColAttr.SetReadOnly(True) readonly1Cols = [0, 1, 2] readonly2Cols = [0, 2, 3, 5] for col in readonly1Cols: self.gridData1.SetColAttr(col, readonlyColAttr) for col in readonly2Cols: self.gridData2.SetColAttr(col, readonlyColAttr) self.gridData1.SetRowLabelSize(1) self.gridData2.SetRowLabelSize(1) if self.testAlignObj == None: self.moveAmount = [] else: self.moveAmount = [ 0.0 for i in range(len(self.testAlignObj.usedperts)) ] # reset moveAmount list self.refreshWidget(self.gridData1) self.refreshWidget(self.gridData2) def updateDataTable(self): for varInd in range(len(self.testAlignObj.allterms)): self.gridData1.SetCellValue(varInd, 0, self.testAlignObj.allterms[varInd]) self.gridData1.SetCellValue( varInd, 1, self.testAlignObj.meas_variables[varInd]) if self.testAlignObj.res == None: self.gridData1.SetCellValue(varInd, 2, 0.0) else: self.gridData1.SetCellValue(varInd, 2, self.testAlignObj.res[varInd]) self.gridData1.SetCellValue( varInd, 3, float(self.testAlignObj.weights[varInd])) for cInd in range(len(self.testAlignObj.usedperts)): self.gridData2.SetCellValue(cInd, 0, self.testAlignObj.usedperts[cInd]) self.gridData2.SetCellValue(cInd, 1, str(self.testAlignObj.force[cInd])) if self.testAlignObj.p == None: self.gridData2.SetCellValue(cInd, 2, 0.0) else: self.gridData2.SetCellValue(cInd, 2, self.testAlignObj.p[cInd]) self.gridData2.SetCellValue( cInd, 3, self.testAlignObj.sens[ self.testAlignObj.usedperts[cInd]]['units']) if len(self.moveAmount) == 0 or self.moveAmount[cInd] == 0: self.gridData2.SetCellValue(cInd, 4, False) else: self.gridData2.SetCellValue(cInd, 4, True) # col 5, move_amount column if len(self.moveAmount) > 0: self.gridData2.SetCellValue(cInd, 5, self.moveAmount[cInd]) else: self.gridData2.SetCellValue(cInd, 5, 0.0) self.gridData1.Show() self.gridData2.Show() self.gridData1.AutoSize() self.gridData2.AutoSize() self.refreshWidget(self.gridData1) self.refreshWidget(self.gridData2) # Virtual event handlers, overide them in your derived class def onFileUpdate(self, event): fileRoot = self.textCtrlFileNameRoot.GetValue() fileExt = self.textCtrlExtension.GetValue() modeSelect = self.radioBoxModeChoices[self.radioBoxMode.GetSelection()] if len(fileRoot) == 0 or len(fileExt) == 0: self.popErrorBox( 'ERROR', 'ERROR: file name root or file extension CANNOT be EMPTY!') return self.testAlignObj = testalign.TestAlign(force=modeSelect) self.testAlignObj.get_gsmeas_variables(fileRoot, fileExt) self.textCtrlOutput.SetValue(self.testAlignObj.writename) self.gridData1.ClearTable() # clear before proceed. self.gridData2.ClearTable() # clear. self.updateDataTable() self.setupDataTable() def onWriteReport(self, event): if self.testAlignObj != None: self.testAlignObj.write(self.textCtrlOutput.GetValue()) def onChangeParams(self, event): row = event.GetRow() col = event.GetCol() if event.GetEventObject() == self.gridData1: # update weights self.testAlignObj.weights[row] = self.gridData1.GetCellValue( row, col) self.testAlignObj.set_weights(self.testAlignObj.weights) else: if col == 1: # update force forceData = self.gridData2.GetCellValue(row, col) if forceData == 'None': forceData = None else: forceData = float(forceData) self.testAlignObj.force[row] = forceData self.testAlignObj.set_force(self.testAlignObj.force) elif col == 4: # update includes; moveAmount should be updated if self.gridData2.GetCellValue(row, col): self.moveAmount[row] = -1 * self.gridData2.GetCellValue( row, 2) self.gridData2.SetReadOnly(row, 5, False) # Edit ON for moveAmount self.gridData2.SetCellValue( row, 5, self.moveAmount[row]) # Change the actual display else: self.moveAmount[row] = 0.0 self.gridData2.SetReadOnly(row, 5, True) # Edit OFF for moveAmount self.gridData2.SetCellValue( row, 5, self.moveAmount[row]) # Change the actual display elif col == 5: self.moveAmount[row] = self.gridData2.GetCellValue(row, col) self.refreshWidget(self.gridData1) self.refreshWidget(self.gridData2) def onSolve(self, event): self.testAlignObj.solve() self.updateDataTable() event.Skip() def onMove(self, event): #self.testAlignObj.move_solve(exclude=self.excludeList) self.testAlignObj.move_solve2(self.moveAmount) self.updateDataTable() event.Skip()
def __init__( self, parent, metroProIP ): self.__isLoggingToFile__ = False self.timeStrFormat = "%Y-%m-%d %H:%M:%S" self.pobMeasureObj = PobMeasure(metroProIP, wxWidget=self) FrameBase.__init__ ( self, parent, id = wx.ID_ANY, title = "POB Measurement Automation", pos = wx.DefaultPosition, size = wx.Size( 1024,500 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) bSizerFrameMain = wx.BoxSizer( wx.VERTICAL ) self.panelMain = ScrolledPanelBase( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizerMain = wx.BoxSizer( wx.VERTICAL ) self.staticTextDisplayTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"POB Measurement Automation", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextDisplayTitle.Wrap( -1 ) self.staticTextDisplayTitle.SetFont( wx.Font( 20, 70, 90, 92, False, wx.EmptyString ) ) bSizerMain.Add( self.staticTextDisplayTitle, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) sbSizerDisplay = wx.StaticBoxSizer( wx.StaticBox( self.panelMain, wx.ID_ANY, u"Progress:" ), wx.VERTICAL ) self.textCtrlDisplayProgress = wx.TextCtrl( self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE|wx.TE_READONLY ) self.textCtrlDisplayProgress.SetFont( wx.Font( 16, 70, 90, 92, False, wx.EmptyString ) ) self.textCtrlDisplayProgress.SetMaxLength( 0 ) self.textCtrlDisplayProgress.SetForegroundColour( "WHITE" ) self.textCtrlDisplayProgress.SetBackgroundColour( "BLACK" ) sbSizerDisplay.Add( self.textCtrlDisplayProgress, 1, wx.ALL|wx.EXPAND, 5 ) bSizerMain.Add( sbSizerDisplay, 1, wx.EXPAND, 5 ) sbSizerParameters = wx.StaticBoxSizer( wx.StaticBox( self.panelMain, wx.ID_ANY, u"Parameters" ), wx.VERTICAL ) fgSizerParameters = wx.FlexGridSizer( 4, 6, 0, 0 ) fgSizerParameters.SetFlexibleDirection( wx.BOTH ) fgSizerParameters.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.staticTextParameterPobId = wx.StaticText( self.panelMain, wx.ID_ANY, u"POB ID:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterPobId.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterPobId, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterPobId = wx.TextCtrl( self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterPobId.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterPobId, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterFieldCoords = wx.StaticText( self.panelMain, wx.ID_ANY, u"Field Coords:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterFieldCoords.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterFieldCoords, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterFieldCoords = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"1", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterFieldCoords.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterFieldCoords, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterTsCenterFieldCoords = wx.StaticText( self.panelMain, wx.ID_ANY, u"TS Center Field Coords:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterTsCenterFieldCoords.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterTsCenterFieldCoords, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterTsCenterFieldCoords = wx.TextCtrl( self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterTsCenterFieldCoords.SetMaxLength( 0 ) self.textCtrlParameterTsCenterFieldCoords.SetToolTipString( u"enter 3 floats separated by commas" ) fgSizerParameters.Add( self.textCtrlParameterTsCenterFieldCoords, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterPobRotation = wx.StaticText( self.panelMain, wx.ID_ANY, u"POB Rotation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterPobRotation.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterPobRotation, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterPobRotation = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterPobRotation.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterPobRotation, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterNumAvgMapPerField = wx.StaticText( self.panelMain, wx.ID_ANY, u"# Avg Maps Per Field:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterNumAvgMapPerField.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterNumAvgMapPerField, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterNumAvgMapPerField = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"128", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterNumAvgMapPerField.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterNumAvgMapPerField, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterNumFieldRepeats = wx.StaticText( self.panelMain, wx.ID_ANY, u"# of Field Repeats:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterNumFieldRepeats.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterNumFieldRepeats, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterNumFieldRepeats = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"4", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterNumFieldRepeats.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterNumFieldRepeats, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterNumFullMeasRepeats = wx.StaticText( self.panelMain, wx.ID_ANY, u"# of Full Measurement Repeats:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterNumFullMeasRepeats.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterNumFullMeasRepeats, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterNumFullMeasRepeats = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"1", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterNumFullMeasRepeats.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterNumFullMeasRepeats, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterRetroRotation = wx.StaticText( self.panelMain, wx.ID_ANY, u"Retro Rotation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterRetroRotation.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterRetroRotation, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterRetroRotation = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterRetroRotation.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterRetroRotation, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterTestLetter = wx.StaticText( self.panelMain, wx.ID_ANY, u"Test Letter:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterTestLetter.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterTestLetter, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterTestLetter = wx.TextCtrl( self.panelMain, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.textCtrlParameterTestLetter.SetMaxLength( 0 ) fgSizerParameters.Add( self.textCtrlParameterTestLetter, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.staticTextParameterMeasurementStartDelay = wx.StaticText( self.panelMain, wx.ID_ANY, u"Measurement Start Delay (min):", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextParameterMeasurementStartDelay.Wrap( -1 ) fgSizerParameters.Add( self.staticTextParameterMeasurementStartDelay, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlParameterMeasurementStartDelay = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizerParameters.Add( self.textCtrlParameterMeasurementStartDelay, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) sbSizerParameters.Add( fgSizerParameters, 1, wx.EXPAND, 5 ) bSizerMain.Add( sbSizerParameters, 0, wx.EXPAND, 5 ) sbSizerAutoNull = wx.StaticBoxSizer( wx.StaticBox( self.panelMain, wx.ID_ANY, u"AutoNull" ), wx.HORIZONTAL ) radioBoxAutoNullRSOptionsChoices = [ u"Tilt Only", u"Tilt + Power" ] self.radioBoxAutoNullRSOptions = wx.RadioBox( self.panelMain, wx.ID_ANY, u"RS Options:", wx.DefaultPosition, wx.DefaultSize, radioBoxAutoNullRSOptionsChoices, 1, wx.RA_SPECIFY_ROWS ) self.radioBoxAutoNullRSOptions.SetSelection( 0 ) sbSizerAutoNull.Add( self.radioBoxAutoNullRSOptions, 0, wx.ALL, 5 ) self.staticTextAutoNullRSIterTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"RS Iter:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextAutoNullRSIterTitle.Wrap( -1 ) sbSizerAutoNull.Add( self.staticTextAutoNullRSIterTitle, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlAutoNullRSIter = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizerAutoNull.Add( self.textCtrlAutoNullRSIter, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) radioBoxAutoNullTSOptionsChoices = [ u"Tilt Only", u"Tilt + Power" ] self.radioBoxAutoNullTSOptions = wx.RadioBox( self.panelMain, wx.ID_ANY, u"TS Options", wx.DefaultPosition, wx.DefaultSize, radioBoxAutoNullTSOptionsChoices, 1, wx.RA_SPECIFY_ROWS ) self.radioBoxAutoNullTSOptions.SetSelection( 0 ) sbSizerAutoNull.Add( self.radioBoxAutoNullTSOptions, 0, wx.ALL, 5 ) self.staticTextAutoNullTSIterTitle = wx.StaticText( self.panelMain, wx.ID_ANY, u"TS Iter:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextAutoNullTSIterTitle.Wrap( -1 ) sbSizerAutoNull.Add( self.staticTextAutoNullTSIterTitle, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.textCtrlAutoNullTSIter = wx.TextCtrl( self.panelMain, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizerAutoNull.Add( self.textCtrlAutoNullTSIter, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizerMain.Add( sbSizerAutoNull, 0, wx.EXPAND, 5 ) sbSizerControls = wx.StaticBoxSizer( wx.StaticBox( self.panelMain, wx.ID_ANY, u"Controls" ), wx.HORIZONTAL ) self.buttonControlMeasure = wx.Button( self.panelMain, wx.ID_ANY, u"MEASURE", wx.DefaultPosition, wx.DefaultSize, 0 ) self.buttonControlMeasure.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) sbSizerControls.Add( self.buttonControlMeasure, 1, wx.ALL|wx.EXPAND, 5 ) self.buttonControlStop = wx.Button( self.panelMain, wx.ID_ANY, u"STOP", wx.DefaultPosition, wx.DefaultSize, 0 ) self.buttonControlStop.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) sbSizerControls.Add( self.buttonControlStop, 1, wx.ALL|wx.EXPAND, 5 ) bSizerMain.Add( sbSizerControls, 0, wx.EXPAND, 5 ) self.panelMain.SetSizer( bSizerMain ) self.panelMain.Layout() self.panelMain.SetupScrolling() bSizerMain.Fit( self.panelMain ) bSizerFrameMain.Add( self.panelMain, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( bSizerFrameMain ) self.Layout() # MenuBar, Menu, and MenuItems self.menubarMain = wx.MenuBar( 0 ) self.menuLog = wx.Menu() self.menuItemLogToFile = wx.MenuItem( self.menuLog, wx.ID_ANY, u"Log To File", wx.EmptyString, wx.ITEM_CHECK ) self.menuLog.AppendItem( self.menuItemLogToFile ) self.menuItemClearConsoleLog = wx.MenuItem( self.menuLog, wx.ID_ANY, u"Clear Console Log", wx.EmptyString, wx.ITEM_CHECK ) self.menuLog.AppendItem( self.menuItemClearConsoleLog ) self.menubarMain.Append( self.menuLog, u"Log" ) self.menuAbout = wx.Menu() self.menuItemAbout = wx.MenuItem( self.menuAbout, wx.ID_ANY, u"About", wx.EmptyString, wx.ITEM_NORMAL ) self.menuAbout.AppendItem( self.menuItemAbout ) self.menubarMain.Append( self.menuAbout, u"About" ) self.SetMenuBar( self.menubarMain ) # Icon self.baseDir = os.path.dirname(os.path.abspath(__file__)) + "/" self.SetIcon(wx.Icon(self.baseDir+"icons/icon.ico", wx.BITMAP_TYPE_ICO)) # Connect Events self.buttonControlMeasure.Bind( wx.EVT_BUTTON, self.onControlMeasure ) self.buttonControlStop.Bind( wx.EVT_BUTTON, self.onControlStop ) self.Bind( wx.EVT_MENU, self.onMenuLogToFile, id = self.menuItemLogToFile.GetId() ) self.Bind( wx.EVT_MENU, self.onMenuClearConsoleLog, id = self.menuItemClearConsoleLog.GetId() ) self.Bind( wx.EVT_MENU, self.onMenuAbout, id = self.menuItemAbout.GetId() ) self.Bind(pob_measure_wx_event.EVT_POB_MEAS_PROG, self.onPobMeasureProgressEvent) self.Bind(pob_measure_wx_event.EVT_POB_MEAS_ERROR, self.onPobMeasureErrorEvent) self.Bind(pob_measure_wx_event.EVT_POB_UPDATE_TEST_LETTER, self.onPobUpdateTestLetterEvent)
def __init__( self, parent, alignObj ): self.alignObj = alignObj ScrolledPanelBase.__init__( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TAB_TRAVERSAL ) bSizerPanel = wx.BoxSizer( wx.VERTICAL ) ########################## # Move Test panel title ########################## self.staticTextMoveTestTitle = wx.StaticText( self, wx.ID_ANY, u"Move Test (ID: "+self.alignObj.hexapodID+")", wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextMoveTestTitle.Wrap( -1 ) self.staticTextMoveTestTitle.SetFont( wx.Font( 18, 70, 90, 92, False, wx.EmptyString ) ) bSizerPanel.Add( self.staticTextMoveTestTitle, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizerMoveGrid = wx.BoxSizer( wx.HORIZONTAL ) ########################## # moveTest grid ########################## labels = ["Compensator", "POB Motion", "Solve Amounts", "Include", "Move", "Units"] dataTypes = [gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_FLOAT+':6,9', gridlib.GRID_VALUE_BOOL, gridlib.GRID_VALUE_FLOAT+':6,9', gridlib.GRID_VALUE_STRING] self.moveTestGrid = CustomDataGrid(self, labels, dataTypes) self.updateMoveTestGrid() self.moveTestGrid.SetColLabelSize(30) self.moveTestGrid.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) self.moveTestGrid.AutoSize() ##### # Cell Attributes ##### self.moveTestGrid.SetColReadOnly(0) self.moveTestGrid.SetColReadOnly(1) self.moveTestGrid.SetColReadOnly(2) self.moveTestGrid.SetColReadOnly(4) self.moveTestGrid.SetColReadOnly(5) bSizerMoveGrid.Add( self.moveTestGrid, 0, wx.ALL, 5 ) ########################################## END moveTestGrid ######################################## bSizerMoveGridControl = wx.BoxSizer( wx.VERTICAL ) self.buttonIncludeAll = wx.Button( self, wx.ID_ANY, u"Include All", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerMoveGridControl.Add( self.buttonIncludeAll, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5 ) self.textCtrlFactor = wx.TextCtrl( self, wx.ID_ANY, u"0.5", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerMoveGridControl.Add( self.textCtrlFactor, 0, wx.ALL, 5 ) self.buttonFactor = wx.Button( self, wx.ID_ANY, u"Set Factor", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerMoveGridControl.Add( self.buttonFactor, 0, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 5 ) bSizerMoveGrid.Add( bSizerMoveGridControl, 0, wx.ALL, 5 ) bSizerPanel.Add( bSizerMoveGrid, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.buttonMove = wx.Button( self, wx.ID_ANY, u"MOVE", wx.DefaultPosition, wx.DefaultSize, 0 ) self.buttonMove.SetFont( wx.Font( 14, 70, 90, 92, False, wx.EmptyString ) ) if not HAS_POBTEST_MOD: self.buttonMove.SetToolTipString( u"Disabled due to \"pobtest module\" not found." ) self.buttonMove.Enable(False) bSizerPanel.Add( self.buttonMove, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.SetSizer( bSizerPanel ) self.Layout() # Connect Events self.moveTestGrid.Bind( wx.grid.EVT_GRID_CELL_CHANGE, self.onMoveTestGridChange ) self.buttonIncludeAll.Bind( wx.EVT_BUTTON, self.onInclude ) self.buttonFactor.Bind( wx.EVT_BUTTON, self.onSetFactor ) self.buttonMove.Bind( wx.EVT_BUTTON, self.onMove )