Changeset 729
- Timestamp:
- Dec 19, 2011 10:37:56 PM (12 years ago)
- Location:
- moxy/trunk/src/moxy
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
moxy/trunk/src/moxy/Frame1.py
r728 r729 2 2 3 3 import wx 4 from wx.lib.anchors import LayoutAnchors 4 import wx.lib.masked.textctrl 5 5 import wx.lib.buttons 6 6 … … 8 8 return Frame1(parent) 9 9 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)] 13 12 14 13 class Frame1(wx.Frame): 15 def _init_coll_panelSizer_Items(self, parent):16 # generated method, don't edit17 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 edit24 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 edit30 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)38 14 39 15 def _init_ctrls(self, prnt): 40 16 # generated method, don't edit 41 17 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), 43 19 style=wx.DEFAULT_FRAME_STYLE, title=u'Frame1') 44 20 self.SetClientSize(wx.Size(732, 439)) … … 48 24 pos=wx.Point(0, 0), size=wx.Size(732, 439), 49 25 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()69 26 70 27 def __init__(self, parent): -
moxy/trunk/src/moxy/vc_pv.py
r728 r729 27 27 # - - - - - - - - - - - - - - - - - - Global 28 28 29 29 30 __svnid__ = "$Id$" 30 31 … … 43 44 44 45 self._init_widgets() 45 self._ place_widgets()46 self._init_sizers() 46 47 47 48 def _init_widgets(self): 48 49 self.panel = wx.Panel(id=wx.ID_ANY, name='panel1', parent=self) 49 50 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') 53 54 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') 57 58 58 59 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) 60 63 61 64 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 ) 63 70 64 def _ place_widgets(self):71 def _init_sizers(self): 65 72 self.panelSizer = wx.BoxSizer(orient=wx.VERTICAL) 66 73 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) 69 76 self.buttonSizer = wx.BoxSizer(orient=wx.HORIZONTAL) 70 77 self.panelSizer.AddSizer(self.buttonSizer, 0, border=0, flag=wx.EXPAND) 71 78 self.buttonSizer.AddWindow(self.genButton1, proportion=1, border=0, flag=wx.EXPAND) 72 79 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" 73 133 74 134
Note: See TracChangeset
for help on using the changeset viewer.