Changeset 729


Ignore:
Timestamp:
Dec 19, 2011 10:37:56 PM (12 years ago)
Author:
jemian
Message:

work-in-progress

Location:
moxy/trunk/src/moxy
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • moxy/trunk/src/moxy/Frame1.py

    r728 r729  
    22
    33import wx
    4 from wx.lib.anchors import LayoutAnchors
     4import wx.lib.masked.textctrl
    55import wx.lib.buttons
    66
     
    88    return Frame1(parent)
    99
    10 [wxID_FRAME1, wxID_FRAME1GENBUTTON1, wxID_FRAME1GENBUTTON2, wxID_FRAME1PANEL1,
    11  wxID_FRAME1STATICBOX1, wxID_FRAME1STATICBOX2,
    12 ] = [wx.NewId() for _init_ctrls in range(6)]
     10[wxID_FRAME1, wxID_FRAME1PANEL1,
     11] = [wx.NewId() for _init_ctrls in range(2)]
    1312
    1413class Frame1(wx.Frame):
    15     def _init_coll_panelSizer_Items(self, parent):
    16         # generated method, don't edit
    17 
    18         parent.AddWindow(self.staticBox1, 1, border=2, flag=wx.EXPAND)
    19         parent.AddWindow(self.staticBox2, 1, border=2, flag=wx.EXPAND)
    20         parent.AddSizer(self.buttonSizer, 0, border=0, flag=wx.EXPAND)
    21 
    22     def _init_coll_buttonSizer_Items(self, parent):
    23         # generated method, don't edit
    24 
    25         parent.AddWindow(self.genButton1, 0, border=0, flag=0)
    26         parent.AddWindow(self.genButton2, 0, border=0, flag=0)
    27 
    28     def _init_sizers(self):
    29         # generated method, don't edit
    30         self.panelSizer = wx.BoxSizer(orient=wx.VERTICAL)
    31 
    32         self.buttonSizer = wx.BoxSizer(orient=wx.HORIZONTAL)
    33 
    34         self._init_coll_panelSizer_Items(self.panelSizer)
    35         self._init_coll_buttonSizer_Items(self.buttonSizer)
    36 
    37         self.panel1.SetSizer(self.panelSizer)
    3814
    3915    def _init_ctrls(self, prnt):
    4016        # generated method, don't edit
    4117        wx.Frame.__init__(self, id=wxID_FRAME1, name=u'Frame1', parent=prnt,
    42               pos=wx.Point(349, 351), size=wx.Size(732, 439),
     18              pos=wx.Point(439, 340), size=wx.Size(732, 439),
    4319              style=wx.DEFAULT_FRAME_STYLE, title=u'Frame1')
    4420        self.SetClientSize(wx.Size(732, 439))
     
    4824              pos=wx.Point(0, 0), size=wx.Size(732, 439),
    4925              style=wx.TAB_TRAVERSAL)
    50 
    51         self.staticBox1 = wx.StaticBox(id=wxID_FRAME1STATICBOX1,
    52               label=u'PV name and value', name='staticBox1', parent=self.panel1,
    53               pos=wx.Point(0, 0), size=wx.Size(732, 204), style=0)
    54         self.staticBox1.SetToolTipString(u'PV name and value')
    55 
    56         self.staticBox2 = wx.StaticBox(id=wxID_FRAME1STATICBOX2,
    57               label='staticBox2', name='staticBox2', parent=self.panel1,
    58               pos=wx.Point(0, 204), size=wx.Size(732, 204), style=0)
    59 
    60         self.genButton1 = wx.lib.buttons.GenButton(id=wxID_FRAME1GENBUTTON1,
    61               label=u'Connect', name='genButton1', parent=self.panel1,
    62               pos=wx.Point(0, 408), size=wx.Size(88, 31), style=0)
    63 
    64         self.genButton2 = wx.lib.buttons.GenButton(id=wxID_FRAME1GENBUTTON2,
    65               label=u'Disconnect', name='genButton2', parent=self.panel1,
    66               pos=wx.Point(88, 408), size=wx.Size(88, 31), style=0)
    67 
    68         self._init_sizers()
    6926
    7027    def __init__(self, parent):
  • moxy/trunk/src/moxy/vc_pv.py

    r728 r729  
    2727# - - - - - - - - - - - - - - - - - - Global
    2828
     29
    2930__svnid__ = "$Id$"
    3031
     
    4344       
    4445        self._init_widgets()
    45         self._place_widgets()
     46        self._init_sizers()
    4647
    4748    def _init_widgets(self):
    4849        self.panel = wx.Panel(id=wx.ID_ANY, name='panel1', parent=self)
    4950
    50         self.staticBox1 = wx.StaticBox(id=wx.ID_ANY,
    51               label=u'PV name and value', name='staticBox1', parent=self.panel, size=wx.Size(300, 100),)
    52         self.staticBox1.SetToolTipString(u'PV name and value')
     51        #self.sbTop = wx.StaticBox(id=wx.ID_ANY,
     52        #      label=u'PV name and value', name='sbTop', parent=self.panel, size=wx.Size(300, 100),)
     53        #self.sbTop.SetToolTipString(u'PV name and value')
    5354
    54         self.staticBox2 = wx.StaticBox(id=wx.ID_ANY,
    55               label='staticBox2', name='staticBox2', parent=self.panel, size=wx.Size(300, 100),)
    56         self.staticBox2.SetToolTipString(u'connection info')
     55        #self.sbBottom = wx.StaticBox(id=wx.ID_ANY,
     56        #      label='connection info', name='sbBottom', parent=self.panel, size=wx.Size(300, 100),)
     57        #self.sbBottom.SetToolTipString(u'EPICS connection info')
    5758
    5859        self.genButton1 = wx.lib.buttons.GenButton(id=wx.ID_ANY,
    59               label=u'Connect', name='genButton1', parent=self.panel,)
     60              label=u'Connect', name='connectButton', parent=self.panel,)
     61        self.genButton1.SetToolTipString(u'Connect with EPICS PV')
     62        self.genButton1.Bind(wx.EVT_BUTTON, self.doConnectButton)
    6063
    6164        self.genButton2 = wx.lib.buttons.GenButton(id=wx.ID_ANY,
    62               label=u'Disconnect', name='genButton2', parent=self.panel,)
     65              label=u'Disconnect', name='disconnectButton', parent=self.panel,)
     66        self.genButton2.SetToolTipString(u'Disconnect from EPICS PV')
     67        self.genButton2.Bind(wx.EVT_BUTTON, self.doDisconnectButton)
     68       
     69        # wx.StaticBoxSizer( wx.StaticBox( parent_window, id, "label" ), wx.HORIZONTAL )
    6370   
    64     def _place_widgets(self):
     71    def _init_sizers(self):
    6572        self.panelSizer = wx.BoxSizer(orient=wx.VERTICAL)
    6673        self.panel.SetSizer(self.panelSizer)
    67         self.panelSizer.AddWindow(self.staticBox1, proportion=1, border=0, flag=wx.EXPAND)
    68         self.panelSizer.AddWindow(self.staticBox2, proportion=1, border=0, flag=wx.EXPAND)
     74        #self.panelSizer.AddWindow(self.sbTop, proportion=1, border=0, flag=wx.EXPAND)
     75        #self.panelSizer.AddWindow(self.sbBottom, proportion=1, border=0, flag=wx.EXPAND)
    6976        self.buttonSizer = wx.BoxSizer(orient=wx.HORIZONTAL)
    7077        self.panelSizer.AddSizer(self.buttonSizer, 0, border=0, flag=wx.EXPAND)
    7178        self.buttonSizer.AddWindow(self.genButton1, proportion=1, border=0, flag=wx.EXPAND)
    7279        self.buttonSizer.AddWindow(self.genButton2, proportion=1, border=0, flag=wx.EXPAND)
     80       
     81        #self.sbTopSizer = wx.StaticBoxSizer(self.sbTop, wx.VERTICAL)
     82        #self.sbBottomSizer = wx.StaticBoxSizer(self.sbBottom, wx.VERTICAL )
     83       
     84    def _example_(self, parent):
     85        '''
     86        StaticBoxSizer example
     87       
     88        create the control items,
     89        defines self.motorList dictionary,
     90        returns FlexGridSizer object
     91        '''
     92        sbox = wx.StaticBox(parent, id=wx.ID_ANY,
     93              label='watch EPICS motors', style=0)
     94        sbs = wx.StaticBoxSizer(sbox, wx.VERTICAL)
     95        fgs = wx.FlexGridSizer(rows=4, cols=3, hgap=4, vgap=4)
     96
     97        # column labels
     98        for item in self.AXIS_LABELS:
     99            fgs.Add(
     100                 wx.StaticText(parent, wx.ID_ANY, item),
     101                 0, flag=wx.EXPAND)
     102        # one motor axis per row
     103        self.motorList = {}
     104        for axis in self.AXIS_NAMES:
     105            fgs.Add(
     106                 wx.StaticText(parent, wx.ID_ANY, axis, style=wx.ALIGN_RIGHT),
     107                 0, flag=wx.EXPAND)
     108            D = {}
     109            for field in self.AXIS_FIELDS:
     110                text = '[%s].%s' % (axis, field)
     111                widget = wx.TextCtrl(parent, wx.ID_ANY, text, style=wx.TE_READONLY|wx.ALIGN_RIGHT)
     112                widget.SetBackgroundColour(self.NOT_MOVING_COLOR)
     113                widget.SetToolTipString("motor,%s,%s" % (axis, field))
     114                widget.SetFont(self.basicFont)
     115                fgs.Add(widget, 0, flag=wx.EXPAND)
     116                D[field] = widget
     117            self.motorList[axis] = D
     118
     119        fgs.AddGrowableCol(1)
     120        fgs.AddGrowableCol(2)
     121
     122        sbs.Add(fgs, 0, wx.EXPAND|wx.ALIGN_CENTRE|wx.ALL, 5)
     123
     124        return sbs
     125
     126    def doConnectButton(self, event):
     127        event.Skip()
     128        print "Connect button pressed"
     129
     130    def doDisconnectButton(self, event):
     131        event.Skip()
     132        print "Disconnect button pressed"
    73133   
    74134
Note: See TracChangeset for help on using the changeset viewer.