source: wxmtxy/trunk/src/moxy/moxy.py @ 631

Last change on this file since 631 was 631, checked in by jemian, 12 years ago

begin refactoring into release structure and rebranding with new product name: moxy

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