Changeset 644


Ignore:
Timestamp:
Oct 6, 2011 1:57:24 PM (12 years ago)
Author:
jemian
Message:

added a runner, initialize PV and RBV widgets on Connect, rebrand two modules, move docs toward sphinx

Location:
moxy/trunk/src/moxy
Files:
1 added
7 edited
2 moved

Legend:

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

    r643 r644  
    4141    Example use::
    4242   
    43         axis = moxy_axis.Axis()
     43        axis = axis_support.Axis()
    4444        axis.SetConfigure(config_dict):
    4545        if axis.Connect()
  • moxy/trunk/src/moxy/examples/simple-test.xml

    r643 r644  
    11<?xml version="1.0" ?>
    2 <moxy date="2011-10-04" time="17:17:17" version="1.0">
     2<moxy date="2011-10-06" time="13:52:09" version="1.0">
    33  <XYpair name="a1y &amp; a2y test motors" selected="True">
    44    <EPICS_configuration>
     
    2020      <row name="small change down" x="0.5" y="0.5"/>
    2121      <row name="zero" x="0" y="0"/>
     22      <row name="nearby the start" x="1" y="2"/>
    2223    </tab>
    2324  </XYpair>
  • moxy/trunk/src/moxy/examples/test-settings.xml

    r642 r644  
    1212-->
    1313
    14 <moxy date="2009-04-21" time="22:42:25" version="1.0">
     14<wxmtxy date="2009-04-21" time="22:42:25" version="1.0">
    1515  <XYpair name="a1y &amp; a2y test motors" selected="True">
    1616    <EPICS_configuration>
     
    8484    <tab/>
    8585  </XYpair>
    86    -->
    8786  <XYpair>
    8887    <EPICS_configuration>
     
    113112    </tab>
    114113  </XYpair>
     114  -->
    115115  <XYpair name="sample">
    116116    <EPICS_configuration>
     
    144144    </tab>
    145145  </XYpair>
    146 </moxy>
     146</wxmtxy>
  • moxy/trunk/src/moxy/moxy.py

    r642 r644  
    9292
    9393
    94 def main():
    95     '''operate the tool'''
     94def main(args):
     95    '''
     96    Run *moxy* as a tool.
     97   
     98    :param list args: parameter list, typically sys.argv
     99    '''
    96100    application = wx.App()
    97101    settingsFile = None
    98     if len(sys.argv) == 2:
    99         settingsFile = sys.argv[1]
     102    if len(args) == 2:
     103        settingsFile = args[1]
    100104    root.root(None, settingsFile).Show()
    101105    application.MainLoop()
     
    103107
    104108if __name__ == '__main__':
    105     main()
     109    main(sys.argv)
  • moxy/trunk/src/moxy/pair.py

    r643 r644  
    2727import tab
    2828import row
    29 import moxy_axis
     29import axis_support
    3030import wx.lib.scrolledpanel
    3131import copy
     
    212212    def __init__(self, parent, name, root, rootCallback, newtab=False):
    213213        '''initialize an instance of this class
    214             @param parent: object that owns this class
    215             @param name: display test that describes this XYpair
    216             @param root: root object
    217             @param rootCallback: routine in the parent to handle Button events from the Tab
    218             @param newtab: [Boolean] create a default Tab group?'''
     214       
     215        :param obj parent: object that owns this class
     216        :param str name: display text that describes this XYpair
     217        :param obj root: root object
     218        :param method rootCallback: routine in the parent to handle Button events from the Tab
     219        :param bool newtab: create a default Tab group?'''
    219220        self.tab_count = 0
    220221        self.epics = {}
    221222        self.titles = {}
    222223        for axis in ['x', 'y']:
    223             self.epics[axis] = moxy_axis.Axis()
     224            self.epics[axis] = axis_support.Axis()
    224225            self.titles[axis] = {}
    225226            for field in ['DESC', 'EGU']:
     
    245246    def NewTab(self, newrow=True):
    246247        '''make a new tab
    247            @param newrow: [Boolean] option to create a first row'''
     248       
     249        :param bool newrow: option to create a first row'''
    248250        panel = tab.Tab(parent=self.table, pair=self,
    249251                       pairCallback=self.TabHandler, newrow=newrow)
     
    265267    def TabHandler(self, theTab, theRow, command):
    266268        '''Callback function to handle a command from a tab
    267            @param theTab: tab.Tab object
    268            @param theRow: row.Row object
    269            @param command: [string] Row button action to pass upward for handling'''
     269
     270        :param theTab: tab.Tab object
     271        :param theRow: row.Row object
     272        :param command: [string] Row button action to pass upward for handling'''
    270273        self.rootCallback(self, theTab, theRow, command)
    271274
    272275    def GetSelection(self):
    273         '''@return index number of the selected tab object'''
     276        ''':return index number of the selected tab object'''
    274277        return self.table.GetSelection()
    275278
    276279    def GetTabSelection(self):
    277         '''@return selected tab object'''
     280        ''':return selected tab object'''
    278281        tabnum = self.GetSelection()
    279282        if tabnum < 0:
     
    282285
    283286    def GetPageTitle(self):
    284         '''@return page title'''
     287        ''':return page title'''
    285288        return self.title.GetLabel()
    286289
    287290    def SetPageTitle(self, title):
    288291        '''define the page title
    289            @param title: [string] new page title'''
     292       
     293        :param title: [string] new page title'''
    290294        self.title.SetLabel(title)
    291295        self.Layout()
     
    293297    def GetTabText(self, tabnum):
    294298        '''return the text of the tab numbered tabnum
    295            @param tabnum: [int] index of selected tab'''
     299       
     300        :param tabnum: [int] index of selected tab'''
    296301        return self.table.GetPageText(tabnum)
    297302
    298303    def SetTabText(self, tabnum, text):
    299304        '''set the text of the tab numbered tabnum
    300            @param tabnum: [int] index of selected tab
    301            @param text: [string] new text'''
     305       
     306        :param tabnum: [int] index of selected tab
     307        :param text: [string] new text'''
    302308        self.table.SetPageText(tabnum, text)
    303309
    304310    def GetAxisTitleX(self):
    305         '''@return X axis title'''
     311        ''':return X axis title'''
    306312        return self.lbl_x_title.GetLabel()
    307313
    308314    def GetAxisTitleY(self):
    309         '''@return Y axis title'''
     315        ''':return Y axis title'''
    310316        return self.lbl_y_title.GetLabel()
    311317
     
    313319        '''change the background color of the RBV and VAL widgets
    314320       
    315            @param axis: [string] either "x" or "y"
    316            @param state: [Boolean], color is green if state == False, neutral if True
     321        :param axis: [string] either "x" or "y"
     322        :param state: [Boolean], color is green if state == False, neutral if True
    317323        '''
    318324        colormap = {False: self.COLOR_MOVING, True: self.COLOR_NOT_MOVING}
     
    325331
    326332    def GetRbvXY(self):
    327         '''@return readback values for X and Y as a tuple'''
     333        ''':return readback values for X and Y as a tuple'''
    328334        x = self.x_rbv.GetLabel()
    329335        y = self.y_rbv.GetLabel()
     
    332338    def SetAxisTitles(self, x_title, y_title):
    333339        '''define the axis titles
    334             @param x_title: [string] X axis title
    335             @param y_title: [string] Y axis title'''
     340
     341        :param x_title: [string] X axis title
     342        :param y_title: [string] Y axis title'''
    336343        self.lbl_x_title.SetLabel(x_title)
    337344        self.lbl_y_title.SetLabel(y_title)
     
    339346
    340347    def GetEpicsConfig(self):
    341         '''@return deep copy of EPICS PV configuration'''
     348        ''':return deep copy of EPICS PV configuration'''
    342349        config = {}
    343350        for axis in ['x', 'y']:
     
    395402    def ConnectEpics(self):
    396403        '''try to connect the XY_pair PV names with EPICS'''
    397         redirects = {
     404        callback_handlers = {
    398405                    'VAL':  self.onChangePositions,
    399406                    'RBV':  self.onChangePositions,
     
    405412        for axis in ['x', 'y']:
    406413            item = self.epics[axis]
    407             redirects['axis'] = axis
    408             if not item.Connect(**redirects):
     414            callback_handlers['axis'] = axis
     415            if not item.Connect(**callback_handlers):
    409416                raise RuntimeError, "Did not connect %s axis" % axis
    410             # TODO: initial RBV connection does not generate a monitor, fake it here somehow
     417            self.causeInitialCallback(callback_handlers)
    411418
    412419    def ReleaseEpics(self):
    413420        '''release connections with the XY_pair EPICS PVs
    414             @note: When will this be called?'''
     421       
     422        :note: When will this be called?'''
    415423        for axis in ['x', 'y']:
    416424            self.epics[axis].Disconnect()
     
    424432    def MoveAxes(self, x, y):
    425433        '''Command both axes to move to new position
    426             @param x: [float] new X position
    427             @param y: [float] new Y position'''
     434       
     435        :param float x: new X position
     436        :param float y: new Y position
     437        '''
    428438        #print __name__, 'MoveAxes:', x, y
    429439        self.epics['x'].Move(x)
    430440        self.epics['y'].Move(y)
     441   
     442    def causeInitialCallback(self, callbacks):
     443        '''
     444        initial RBV and VAL connections do not generate a monitor,
     445        cause those callbacks to happen here, somehow
     446       
     447        :param float x: new X position
     448        '''
     449        for field in ( 'RBV', 'VAL', ):
     450            axis = callbacks['axis']
     451            ch = self.epics[axis].db[field]
     452            value = ch.get()
     453            handler = callbacks[field]
     454            D = ch.get_ctrlvars()
     455            handler(axis=axis, field=field, value=value, **D)
    431456               
    432457# ################################
     
    436461    def OnStopButton(self, event):
    437462        '''user requested to stop the X and Y motors
    438            @param event: wxPython event object'''
     463       
     464        :param event: wxPython event object'''
    439465        self.TabHandler(self, None, 'stop')
  • moxy/trunk/src/moxy/pvsetup.py

    r642 r644  
    2929import epics
    3030import pprint
    31 import moxy_axis
     31import axis_support
    3232import inspect
    3333import os
     
    299299            xref[field].SetValue(config[field])
    300300            isMotorRec = config[field]
    301         for field in moxy_axis.field_list:
     301        for field in axis_support.field_list:
    302302            if config.has_key(field):
    303303                #pprint.pprint(config)
     
    333333
    334334        :param str axis: "x" or "y"
    335         :param str field: member of moxy_axis.field_list
     335        :param str field: member of axis_support.field_list
    336336        '''
    337337        pv = self.widget[axis][field].GetValue()
     
    359359            field = 'isMotorRec'
    360360            config[axis][field]=self.widget[axis][field].GetValue()
    361             for field in moxy_axis.field_list:
     361            for field in axis_support.field_list:
    362362                config[axis][field]=self.widget[axis][field].GetValue()
    363363        return config
     
    425425        '''
    426426        config = {'isMotorRec': False}
    427         for field in moxy_axis.field_list:
     427        for field in axis_support.field_list:
    428428            config[field] = ''
    429429        self._applyConfiguration_(self.widget[axis], config)
  • moxy/trunk/src/moxy/root.py

    r642 r644  
    3030import tab
    3131import row
    32 import moxy_xml
     32import xml_support
    3333import pvsetup
    3434import version
     
    447447            @param settingsFile: [string] name of the XML file'''
    448448        try:
    449             rc = moxy_xml.Settings(settingsFile)
     449            rc = xml_support.Settings(settingsFile)
    450450            result = rc.ReadXmlFile()
    451451            if result != None:
     
    491491        '''Save the current settings to the named settings file
    492492            @param settingsFile: [string] name of the XML file'''
    493         rc = moxy_xml.Settings(settingsFile)
     493        rc = xml_support.Settings(settingsFile)
    494494        selectedpair = self.pagebook.GetSelection()
    495495        for pairnum in range(self.pagebook.GetPageCount()):
  • moxy/trunk/src/moxy/version.py

    r641 r644  
    1313'''
    1414
    15 '''
     15__full_version_info__ =  '''
    1616version information for moxy
    1717
  • moxy/trunk/src/moxy/xml_support.py

    r643 r644  
    9393import datetime
    9494import copy
    95 import moxy_axis
     95import axis_support
    9696
    9797
     
    101101    def __init__(self, settingsFile=None):
    102102        '''prepare the settings file
    103             :param settingsFile: [string] name of XML file with settings'''
     103       
     104        :param settingsFile: [string] name of XML file with settings'''
    104105        self.rootElement = 'moxy'
    105         # TODO: consider supporting legacy 'wxmtxy' root elements, too
     106        self.legacyRootElementList = [ 'wxmtxy', 'moxy', ]
    106107        self.Clear()
    107108        self.SetSettingsFile(settingsFile)
     
    117118    def SetSettingsFile(self, thefile):
    118119        '''set the name of XML settings file
    119             :param thefile: [string] name of XML file with settings'''
     120       
     121        :param thefile: [string] name of XML file with settings'''
    120122        self.settingsFile = thefile
    121123
     
    125127
    126128    def NewPair(self, title=''):
    127         ''' create space in the database (db) for a new pair
    128             and sets defaults for fields
    129 
    130             :param title: [string] the title of the XY_pair set (default="")
    131             :return: the index number'''
     129        '''
     130        create space in the database (db) for a new pair
     131        and sets defaults for fields
     132
     133        :param title: [string] the title of the XY_pair set (default="")
     134        :return: the index number'''
    132135        if self.CountPairs() == -1:
    133136            self.db[u"pairs"] = []
     
    140143    def GetPairTitle(self, pairnum):
    141144        '''return the name of the XY_pair
    142             :param pairnum: [int] index number of the XY_pair'''
     145       
     146        :param pairnum: [int] index number of the XY_pair'''
    143147        return self.db[u"pairs"][pairnum][u"@name"]
    144148
    145149    def SetPairTitle(self, pairnum, title):
    146150        '''set the name of the XY_pair
    147             :param pairnum: [int] index number of the XY_pair'
    148             :param title: [string] name of the XY_pair'''
     151       
     152        :param pairnum: [int] index number of the XY_pair'
     153        :param title: [string] name of the XY_pair'''
    149154        self.db[u"pairs"][pairnum][u"@name"] = title
    150155
    151156    def SelectPair(self, pairnum):
    152157        '''set the "selected" attribute of the pair
    153             :param pairnum: [int] index number of the XY_pair'''
     158       
     159        :param pairnum: [int] index number of the XY_pair'''
    154160        for pair in self.db[u"pairs"]:   # first, deselect all pairs
    155161            pair[u"@selected"] = False
     
    178184    def NewEpicsConfig(self, pairnum):
    179185        '''Create internal space for a new EPICS configuration
    180             :param pairnum: [int] index number of the XY_pair'''
     186       
     187        :param pairnum: [int] index number of the XY_pair'''
    181188        pairdb = self.db[u"pairs"][pairnum]
    182189        pairdb[u"epics"] = {}
     
    185192            epicsdb[axis] = {}
    186193            axisdb = epicsdb[axis]
    187             for field in moxy_axis.field_list:
     194            for field in axis_support.field_list:
    188195                axisdb[field] = ""
    189196            axisdb[u"isMotorRec"] = False
     
    191198    def GetEpicsConfig(self, pairnum):
    192199        '''Get a deep copy Python dictionary of the current EPICS PV config.
    193             :param pairnum: [int] index number of the XY_pair
    194             :return: the current EPICS configuration'''
     200       
     201        :param pairnum: [int] index number of the XY_pair
     202        :return: the current EPICS configuration'''
    195203        return copy.deepcopy(self.db[u"pairs"][pairnum][u"epics"])
    196204
    197205    def SetEpicsConfig(self, pairnum, config):
    198206        '''set the current EPICS configuration
    199             :param pairnum: [int] index number of the XY_pair
    200             :param config: Python dictionary of EPICS PV configuration'''
     207       
     208        :param pairnum: [int] index number of the XY_pair
     209        :param config: Python dictionary of EPICS PV configuration'''
    201210        pairdb = self.db[u"pairs"][pairnum]
    202211        deep = copy.deepcopy(config)
     
    205214    def SetEpicsField(self, pairnum, axis, field, value):
    206215        '''Define the EPICS config for a specific field
    207             :param pairnum: [int] index number of the XY_pair'
    208             :param axis: [string] "x" or "y"'
    209             :param field: [string] member of moxy_axis.field_list'
    210             :param value: [string] value of this field'''
     216       
     217        :param pairnum: [int] index number of the XY_pair'
     218        :param axis: [string] "x" or "y"'
     219        :param field: [string] member of axis_support.field_list'
     220        :param value: [string] value of this field'''
    211221        try:
    212222            axisdb = self.db[u"pairs"][pairnum][u"epics"][axis]
     
    218228    def NewTab(self, pairnum, title=''):
    219229        ''' create space in the database (db) pair for a new tab
    220             and sets defaults for fields
    221 
    222             :param pairnum: [int] index number of the XY_pair
    223             :param title: the title of the pair set (default="")
    224             :return the index number'''
     230        and sets defaults for fields
     231
     232        :param pairnum: [int] index number of the XY_pair
     233        :param title: the title of the pair set (default="")
     234        :return the index number'''
    225235        pairdb = self.db[u"pairs"][pairnum]
    226236        if not pairdb.has_key(u"tabs"):
     
    234244    def GetTabTitle(self, pairnum, tabnum):
    235245        '''return the name of the tab
    236             :param pairnum: [int] index number of the XY_pair
    237             :param tabnum: [int] index number of the Tab object'''
     246       
     247        :param pairnum: [int] index number of the XY_pair
     248        :param tabnum: [int] index number of the Tab object'''
    238249        return self.db[u"pairs"][pairnum][u"tabs"][tabnum][u"@name"]
    239250
    240251    def SetTabTitle(self, pairnum, tabnum, title):
    241252        '''set the name attribute of the tab
    242             :param pairnum: [int] index number of the XY_pair
    243             :param tabnum: [int] index number of the Tab object
    244             :param title: [string] title the Tab object'''
     253       
     254        :param pairnum: [int] index number of the XY_pair
     255        :param tabnum: [int] index number of the Tab object
     256        :param title: [string] title the Tab object'''
    245257        self.db[u"pairs"][pairnum][u"tabs"][tabnum]["@name"] = title
    246258
    247259    def SelectTab(self, pairnum, tabnum):
    248260        '''set the selected attribute of the pair
    249             :param pairnum: [int] index number of the XY_pair
    250             :param tabnum: [int] index number of the Tab object'''
     261       
     262        :param pairnum: [int] index number of the XY_pair
     263        :param tabnum: [int] index number of the Tab object'''
    251264        pairdb = self.db[u"pairs"][pairnum]
    252265        for tab in pairdb[u"tabs"]:   # first, deselect all tabs
     
    256269    def GetSelectedTab(self, pairnum):
    257270        '''return the index number of the selected tab
    258             :param pairnum: [int] index number of the XY_pair'''
     271       
     272        :param pairnum: [int] index number of the XY_pair'''
    259273        selected = -1
    260274        try:
     
    270284    def CountTabs(self, pairnum):
    271285        '''return the number of tabs
    272             :param pairnum: [int] index number of the XY_pair'''
     286       
     287        :param pairnum: [int] index number of the XY_pair'''
    273288        try:
    274289            return len(self.db[u"pairs"][pairnum][u"tabs"])
     
    278293    def NewRow(self, pairnum, tabnum, title=''):
    279294        ''' create space in the database (db) pair for a new tab
    280             and sets defaults for fields
    281 
    282             :param pairnum: [int] index number of the XY_pair
    283             :param tabnum: [int] index number of the Tab object
    284             :param title: the title of the Tab object (default="")
    285             :return the index number'''
     295        and sets defaults for fields
     296       
     297        :param pairnum: [int] index number of the XY_pair
     298        :param tabnum: [int] index number of the Tab object
     299        :param title: the title of the Tab object (default="")
     300        :return the index number'''
    286301        tabdb = self.db[u"pairs"][pairnum][u"tabs"][tabnum]
    287302        if not tabdb.has_key(u"rows"):
     
    297312    def GetRowTitle(self, pairnum, tabnum, rownum):
    298313        '''return the name of the row
    299             :param pairnum: [int] index number of the XY_pair
    300             :param tabnum: [int] index number of the Tab object
    301             :param rownum: [int] index number of the Row object'''
     314       
     315        :param pairnum: [int] index number of the XY_pair
     316        :param tabnum: [int] index number of the Tab object
     317        :param rownum: [int] index number of the Row object'''
    302318        tabdb = self.db[u"pairs"][pairnum][u"tabs"][tabnum]
    303319        return tabdb[u"rows"][rownum][u"@name"]
     
    305321    def SetRowTitle(self, pairnum, tabnum, rownum, title):
    306322        '''set the name attribute of the row
    307             :param pairnum: [int] index number of the XY_pair
    308             :param tabnum: [int] index number of the Tab object
    309             :param rownum: [int] index number of the Row object
    310             :param title: [string] title the Tab object'''
     323       
     324        :param pairnum: [int] index number of the XY_pair
     325        :param tabnum: [int] index number of the Tab object
     326        :param rownum: [int] index number of the Row object
     327        :param title: [string] title the Tab object'''
    311328        tabdb = self.db[u"pairs"][pairnum][u"tabs"][tabnum]
    312329        tabdb[u"rows"][rownum][u"@name"] = title
     
    314331    def GetRowXY(self, pairnum, tabnum, rownum):
    315332        '''return the name of the row
    316             :param pairnum: [int] index number of the XY_pair
    317             :param tabnum: [int] index number of the Tab object
    318             :param rownum: [int] index number of the Row object'''
     333       
     334        :param pairnum: [int] index number of the XY_pair
     335        :param tabnum: [int] index number of the Tab object
     336        :param rownum: [int] index number of the Row object'''
    319337        tabdb = self.db[u"pairs"][pairnum][u"tabs"][tabnum]
    320338        x = tabdb[u"rows"][rownum][u"@x"]
     
    324342    def SetRowXY(self, pairnum, tabnum, rownum, x, y):
    325343        '''set the name attribute of the row
    326             :param pairnum: [int] index number of the XY_pair
    327             :param tabnum: [int] index number of the Tab object
    328             :param x: [float] X axis position
    329             :param y: [float] Y axis position'''
     344       
     345        :param pairnum: [int] index number of the XY_pair
     346        :param tabnum: [int] index number of the Tab object
     347        :param x: [float] X axis position
     348        :param y: [float] Y axis position'''
    330349        tabdb = self.db[u"pairs"][pairnum][u"tabs"][tabnum]
    331350        tabdb[u"rows"][rownum][u"@x"] = x
     
    334353    def CountRows(self, pairnum, tabnum):
    335354        '''return the number of rows
    336             :param pairnum: [int] index number of the XY_pair
    337             :param tabnum: [int] index number of the Tab object'''
     355       
     356        :param pairnum: [int] index number of the XY_pair
     357        :param tabnum: [int] index number of the Tab object'''
    338358        try:
    339359            return len(self.db[u"pairs"][pairnum][u"tabs"][tabnum][u"rows"])
     
    343363    def GetSelectedRow(self, pairnum, tabnum):
    344364        '''return the index number of the selected row
    345             :param pairnum: [int] index number of the XY_pair
    346             :param tabnum: [int] index number of the Tab object'''
     365       
     366        :param pairnum: [int] index number of the XY_pair
     367        :param tabnum: [int] index number of the Tab object'''
    347368        selected = -1
    348369        try:
     
    358379    def SelectRow(self, pairnum, tabnum, rownum):
    359380        '''set the selected attribute of the pair
    360             :param pairnum: [int] index number of the XY_pair
    361             :param tabnum: [int] index number of the Tab object
    362             :param rownum: [int] index number of the Row object'''
     381       
     382        :param pairnum: [int] index number of the XY_pair
     383        :param tabnum: [int] index number of the Tab object
     384        :param rownum: [int] index number of the Row object'''
    363385        tabdb = self.db[u"pairs"][pairnum][u"tabs"][tabnum]
    364386        for row in tabdb[u"rows"]:   # first, deselect all rows
     
    369391        '''read the settings from a file into an internal dictionary (self.db)
    370392
    371             :note: this method uses xml.dom.minidom (built into all Pythons)
    372             @see: http://docs.python.org/library/xml.dom.minidom.html
     393        :note: this method uses xml.dom.minidom (built into all Pythons)
     394        :see: http://docs.python.org/library/xml.dom.minidom.html
    373395        '''
    374396        try:
    375397            doc = minidom.parse(self.settingsFile) # parse an XML file by name
    376             assert doc.documentElement.tagName == self.rootElement
     398            assert doc.documentElement.tagName in self.legacyRootElementList
    377399        except IOError:
    378400            return 'Could not read the XML file: ' + self.settingsFile
    379401        except AssertionError:
    380             return 'XML root element is not ' + self.rootElement
     402            return 'XML root element is not one of ' + self.legacyRootElementList
    381403        #... read all attributes from the root element
    382404        docElem = doc.documentElement
     
    429451    def _get_attribute(self, node, key, default):
    430452        '''get a specific attribute or return the default
    431             :param node: XML Node object
    432             :param key: [string] name of attribute to find
    433             :param default: [string] default value to return'''
     453       
     454        :param node: XML Node object
     455        :param key: [string] name of attribute to find
     456        :param default: [string] default value to return'''
    434457        value = default
    435458        if node.attributes.has_key(key):
     
    439462    def SaveXmlFile(self):
    440463        '''save the internal dictionary (self.db) to an XML file
     464           
    441465           :note: What about using/saving a default stylesheet?
    442            @see: http://www.boddie.org.uk/python/XML_intro.html
     466           :see: http://www.boddie.org.uk/python/XML_intro.html
    443467        '''
    444468        out = open(self.settingsFile, 'w')
     
    453477    def _SetAttr(self, node, attribute, value):
    454478        '''add attributes that are not empty (but do not strip the whitespace)
    455             :param node: XML Node object
    456             :param attribute: [string] name of attribute
    457             :param value: [string] value of attribute'''
     479           
     480        :param node: XML Node object
     481        :param attribute: [string] name of attribute
     482        :param value: [string] value of attribute'''
    458483        if len(value) > 0:
    459484            node.setAttribute(attribute, value)
     
    461486    def _makeTextNode(self, doc, tag, value):
    462487        '''create a text node for the XML file
    463             :param doc: [xml.dom.minidom documentElement object]
    464             :param str tag: element name
    465             :param str value: element text'''
     488           
     489        :param doc: [xml.dom.minidom documentElement object]
     490        :param str tag: element name
     491        :param str value: element text'''
    466492        node = doc.createElement(tag)
    467493        text = doc.createTextNode(value)
     
    471497    def __repr__(self):
    472498        '''default representation of this structure is XML
    473             :return: XML representation of internal database (db)
    474             :note: What about a default stylesheet?
     499       
     500        :return: XML representation of internal database (db)
     501        :note: What about a default stylesheet?
    475502        '''
    476503        t = datetime.datetime.now()
     
    505532                        self._SetAttr(node, field, str(epicsdb[axis][field]))
    506533                        axisnode.appendChild(node)
    507                     for field in moxy_axis.field_list:
     534                    for field in axis_support.field_list:
    508535                        if field in epicsdb[axis]:
    509536                            if len(epicsdb[axis][field])>0:
Note: See TracChangeset for help on using the changeset viewer.