Changeset 702 for moxy/trunk/src
- Timestamp:
- Dec 2, 2011 4:06:57 PM (14 years ago)
- Location:
- moxy/trunk/src/moxy
- Files:
-
- 5 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified moxy/trunk/src/moxy/axes_set.py ¶
r701 r702 15 15 Enthought Python Distribution. 16 16 17 Copyright (c) 20 11, UChicago Argonne, LLC17 Copyright (c) 2009 - 2011, UChicago Argonne, LLC 18 18 ''' 19 19 20 20 21 from enthought.traits.api import HasTraits, String, Instance, List 22 from enthought.traits.ui.api import View, UItem, HGroup21 from enthought.traits.api import HasTraits, String, Instance, List, Button 22 from enthought.traits.ui.api import View, UItem, VGrid, Label, UReadonly 23 23 from single_axis import SingleAxis 24 24 … … 33 33 ''' 34 34 name = String 35 configButton = Button(Label=name) # TODO: Label assignment does not work yet 35 36 axes = List( Instance( SingleAxis ) ) 37 stopButton = Button(Label='STOP') 38 39 # TODO: need a view more like the prototype 40 # complication is when a PV is not connected 41 # which can probably be solved by some kind of Dependency Trait 42 ''' 43 prototype 44 45 ======== ========= ========= ========= 46 axis x y ... 47 ======== ========= ========= ========= 48 readback x_RBV y_RBV ..._RBV 49 target x_VAL y_VAL ..._VAL 50 ======== ========= ========= ========= 51 52 [___________ STOP button ___________] 53 ''' 36 54 37 55 view = View( 38 56 UItem('name', springy=True), 39 HGroup('axes', springy=True, style='custom'), 57 UItem('configButton'), 58 UItem('axes', springy=True, style='custom'), 59 UItem('stopButton'), 60 UItem('axes[0]', springy=True, style='custom'), 40 61 ) 62 63 def _configButton_fired(self): 64 print 'configButton pressed' 65 self.axes[0].edit_traits() 66 67 def _stopButton_fired(self): 68 print 'STOP pressed' 41 69 42 70 … … 45 73 from connection import PvConnection 46 74 kw = { 'name' : 'test set of axes'} 47 axes = []75 global_axes = [] 48 76 basic_config = {'x': 'prj:m1', 'y': 'prj:m2',} # two test motor records 49 77 for axis in sorted(basic_config): … … 53 81 full_pv = base_pv + "." + field.upper() 54 82 inner[ field.lower() ] = PvConnection( pvname = full_pv ) 55 axes.append( SingleAxis(**inner) )56 kw[ 'axes' ] = axes83 global_axes.append( SingleAxis(**inner) ) 84 kw[ 'axes' ] = global_axes 57 85 58 AxesSet(**kw).configure_traits() 86 # build the test view on-the-fly, based on the number of defined axes 87 vg_args = [] 88 qty = len(global_axes) 89 grid = [] 90 grid.append( Label('motor') ) 91 for axis in global_axes: 92 grid.append( Label(axis.name) ) 93 grid.append( Label('readback') ) 94 for i in range(qty): 95 grid.append( UReadonly('a%d.rbv.pvname'%i) ) 96 grid.append( Label('target') ) 97 for i in range(qty): 98 grid.append( UItem('a%d.val.pvname'%i) ) 99 gridkw = {'columns': qty+1} 100 vg_args.append( VGrid(*grid, **gridkw) ) 101 vkw = {'resizable': True} 102 103 traits_context = {} 104 for i in range(qty): 105 axis = global_axes[i] 106 traits_context['a%d'%i] = axis 107 108 #AxesSet(**kw).configure_traits() 109 AxesSet(**kw).configure_traits(view=View(*vg_args, **vkw), context=traits_context) -
TabularUnified moxy/trunk/src/moxy/connection.py ¶
r701 r702 15 15 Enthought Python Distribution. 16 16 17 Copyright (c) 20 11, UChicago Argonne, LLC17 Copyright (c) 2009 - 2011, UChicago Argonne, LLC 18 18 ''' 19 19 -
TabularUnified moxy/trunk/src/moxy/moxy.py ¶
r701 r702 14 14 ======================================== 15 15 16 Build the Graphical User Interface 17 using the Traits library from the 18 Enthought Python Distribution. 16 Built using the Traits library from the 17 Enthought Python Distribution. 19 18 20 19 Copyright (c) 2011, UChicago Argonne, LLC … … 31 30 UndoAction, RedoAction, Separator, HelpAction 32 31 from axes_set import AxesSet 32 from positions_set import PositionsSet 33 33 34 34 __svnid__ = "$Id$" … … 41 41 def show_about(self, uinfo): 42 42 '''About this application''' 43 print 'About ...', __svnid__ 43 import about 44 about.About().edit_traits() 44 45 45 46 … … 50 51 ''' 51 52 axes_sets = Dict( String, Instance( AxesSet )) 52 user_positions = Dict( String, List( String) )53 user_positions = Dict( String, List( PositionsSet ) ) 53 54 54 55 status_label = String('status:') … … 118 119 outer = { 119 120 'axes_sets' : axes_sets, 120 'user_positions': { },121 'user_positions': {'nothing': [PositionsSet()]}, 121 122 } 122 123 -
TabularUnified moxy/trunk/src/moxy/single_axis.py ¶
r701 r702 15 15 Enthought Python Distribution. 16 16 17 Copyright (c) 20 11, UChicago Argonne, LLC17 Copyright (c) 2009 - 2011, UChicago Argonne, LLC 18 18 ''' 19 19 20 20 21 from enthought.traits.api import HasTraits, String, Instance 21 from enthought.traits.api import HasTraits, String, Instance, Bool 22 from enthought.traits.ui.api import View, Item 22 23 from connection import PvConnection 23 24 … … 38 39 stop = Instance( PvConnection ) 39 40 desc = Instance( PvConnection ) 41 isMotorRecord = Bool(True) 42 43 44 config_view = View( 45 Item('axis.name'), 46 Item('axis.val.pvname'), 47 Item('axis.rbv.pvname'), 48 ) 40 49 41 50 if __name__ == '__main__': … … 48 57 49 58 SingleAxis(**kw).configure_traits() 59 60 single = SingleAxis(**kw) 61 single.configure_traits(view=config_view, context={'axis': single})
Note: See TracChangeset
for help on using the changeset viewer.