source: wxmtxy/trunk/wxmtxy.py @ 184

Last change on this file since 184 was 184, checked in by jemian, 13 years ago

keywords

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Date Revision Author HeadURL Id
File size: 3.8 KB
Line 
1#!/usr/bin/env python
2#Boa:App:BoaApp
3
4#*************************************************************************
5# Copyright (c) 2009-2010 The University of Chicago, as Operator of Argonne
6#     National Laboratory.
7# Copyright (c) 2009-2010 The Regents of the University of California, as
8#     Operator of Los Alamos National Laboratory.
9# This file is distributed subject to a Software License Agreement found
10# in the file LICENSE that is included with this distribution.
11#*************************************************************************
12
13'''
14start the wxmtxy GUI
15
16@version:
17########### SVN repository information ###################
18# $Date: 2010-06-03 21:04:15 +0000 (Thu, 03 Jun 2010) $
19# $Author: jemian $
20# $Revision: 184 $
21# $URL: wxmtxy/trunk/wxmtxy.py $
22# $Id: wxmtxy.py 184 2010-06-03 21:04:15Z jemian $
23########### SVN repository information ###################
24
25README
26
27    *wxmtxy* (an EPICS GUI tool) provides support for an X,Y positioner
28    (motor) pair by allowing users to define a table of known positions
29    and providing a one-button click to drive a chosen X,Y pair to a specific
30    table setting.  Also can record current position into a setting.
31
32    Several sets of X,Y positioners can be configured.  (Each set is
33    separate.)  In fact, the positioners do not have to be motors,
34    but can be any type of EPICS PV that will accept a numeric value.
35
36
37    wxmtxy is based on wxPython and relies on CaChannel to communicate
38    with EPICS.
39   
40    In the Graphical User Interface (GUI), tooltips are provided for
41    most items.  Moving and pausing the mouse over a widget (GUI
42    component such as a button or a label) will cause a terse description
43    of that widget to be displayed. Moving the mouse away will cause that
44    tooltip to disappear.
45   
46    For more help, explanations are provided in the HTML pages.
47   
48    TRAC wiki
49    @see: https://subversion.xor.aps.anl.gov/trac/bcdaext/wiki/wxmtxy
50   
51    @note: subversion checkout:  svn co https://subversion.xor.aps.anl.gov/bcdaext/wxmtxy/
52
53----
54 @note: wxPython does not provide standard tear-off windows
55 @see: http://wiki.python.org/moin/Distutils/Tutorial
56 @see: http://www.py2exe.org/index.cgi/Tutorial
57 @note: for an undo example, see: http://wiki.wxpython.org/AnotherTutorial
58'''
59
60
61import wx
62import wxmtxy_root
63import pvConnect
64import sys
65
66
67modules ={u'wxmtxy_htmlview': [0,
68                      'HtmlView to view HTML-formatted help files',
69                      u'wxmtxy_htmlview.py'],
70 u'wxmtxy_pair': [0,
71                  'configuration for X,Y pair of EPICS positioners',
72                  u'wxmtxy_pair.py'],
73 u'wxmtxy_pvsetup': [0, 'configure EPICS for X,Y pair', u'wxmtxy_pvsetup.py'],
74 u'wxmtxy_root': [1, 'Main frame of Application', u'wxmtxy_root.py'],
75 u'wxmtxy_row': [0, 'one row of settings', u'wxmtxy_row.py'],
76 u'wxmtxy_tab': [0, 'set of rows with positioner settings', u'wxmtxy_tab.py']}
77
78
79class BoaApp(wx.App):
80    '''Built using Boa-constructor (as a subclass of wx.App)'''
81
82    def OnInit(self):
83        '''demonstrate the use of this tool'''
84        self.main = wxmtxy_root.create(None)
85        self.main.Show()
86        self.SetTopWindow(self.main)
87        return True
88
89
90def on_exit(timer, epics_db):
91    '''Exit handler to stop the ca.poll()
92        @param timer: CaPollWx object
93        @param epics_db: Python list of pvConnect.EpicsPv objects to be released'''
94    #print __name__, "exit handler"
95    #for item in epics_db:
96    #    item.release()
97    if pvConnect.IMPORTED_CACHANNEL:
98        pvConnect.on_exit(timer)
99
100
101def main():
102    '''operate the tool'''
103    application = wx.App()
104    settingsFile = None
105    if len(sys.argv) == 2:
106        settingsFile = sys.argv[1]
107    wxmtxy_root.root(None, settingsFile).Show()
108    capoll_timer = None
109    if pvConnect.IMPORTED_CACHANNEL:
110        capoll_timer = pvConnect.CaPollWx(0.1)
111        capoll_timer.start()
112    application.MainLoop()
113    on_exit(capoll_timer, None)
114
115
116if __name__ == '__main__':
117    main()
Note: See TracBrowser for help on using the repository browser.