Changeset 775 for moxy/trunk


Ignore:
Timestamp:
Feb 2, 2012 9:18:54 AM (13 years ago)
Author:
jemian
Message:

access the PyEpics? motor control panel - needs fix to start properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified moxy/trunk/src/moxy/vc_axis.py

    r772 r775  
    2525import m_pv
    2626import m_axis
     27import epics.wx
    2728
    2829
     
    125126        description_sizer = self._Make_Description_Sizer( panel )
    126127        position_sizer = self._Make_Positions_Sizer( panel )
    127         self.stopButton = Make_My_Button(panel,
     128       
     129        controlsButton = Make_My_Button(panel,
     130                                         label=u'more',
     131                                         name='controlsButton',
     132                                         tip=u'Access more controls for EPICS motors',
     133                                         binding=self.doMotorControlsButton)
     134       
     135        stopButton = Make_My_Button(panel,
    128136                                         label=u'Stop',
    129137                                         name='stopButton',
    130138                                         tip=u'Stop this axis from moving',
    131139                                         binding=self.doStopButton)
    132         self.stopButton.SetBackgroundColour('red')
    133         self.stopButton.SetForegroundColour('yellow')
     140        stopButton.SetBackgroundColour('red')
     141        stopButton.SetForegroundColour('yellow')
    134142
    135143        self.SetStatus( 'initialized' )
     
    139147        sizer.AddSizer(description_sizer, 1, flag=wx.EXPAND)
    140148        sizer.AddSizer(position_sizer, 1, flag=wx.EXPAND)
    141         sizer.AddSizer(self.stopButton, 0, flag=wx.EXPAND)
     149        sizer.AddSizer(controlsButton, 0, flag=wx.EXPAND)
     150        sizer.AddSizer(stopButton, 0, flag=wx.EXPAND)
    142151
    143152    def _Make_Description_Sizer(self, parent):
     
    217226        self.axis_parent.axis.stopMotion()
    218227        self.SetStatus( 'stopped' )
     228
     229    def doMotorControlsButton(self, event):
     230        '''stop this axis from moving'''
     231        self.motorControlsDialog()
     232   
     233    def motorControlsDialog(self):
     234        # TODO: implement this with a button
     235        if self.axis_parent.axis.isMotorRecord:
     236            pv = self.axis_parent.axis.axis.get_pv('VAL').pvname
     237            # FIXME: what is the correct parent to use here?
     238            # TODO: Look at implementation of epics.wx.motordetailframe.MotorDetailFrame()
     239            parent = wx.GetTopLevelParent(self.axis_parent)
     240            dlog = MotorControlsDialog(parent, m_pv.GetBasePv(pv))
     241            dlog.Show()     # needs to be a modeless dialog
     242            #dlog.Destroy()
     243        else:
     244            msg = "This axis is not an EPICS motor record."
     245            msg += "  No motor control screen available."
     246            AcknowledgeDialog(self.axis_parent, msg)
    219247
    220248    def SetStatus(self, value):
     
    657685
    658686
     687class MotorControlsDialog(wx.Dialog):
     688    '''comment'''
     689   
     690    def __init__(self, parent, pv):
     691        '''
     692        modeless dialog that provides the motor controls panel from PyEpics
     693       
     694        :param obj parent: WX parent
     695        :param str pv: EPICS PV name for the motor record
     696        '''
     697        # TODO: needs to be a new modeless dialog
     698        wx.Dialog.__init__(self, None, -1, "controls for %s" % pv)
     699        style = "small"     # small | medium | full (default)
     700        mp = epics.wx.MotorPanel(parent, pv, psize=style)
     701       
     702        sizer = wx.BoxSizer( orient=wx.VERTICAL )
     703        sizer.AddSizer( mp, 1, flag=wx.EXPAND )
     704        self.SetSizer( sizer )
     705        sizer.Fit(self)
     706
     707
    659708# - - - - - - - - - - - - - - - - - - methods
    660709
Note: See TracChangeset for help on using the changeset viewer.