Changeset 10501

Show
Ignore:
Timestamp:
11/11/10 09:47:10 (3 years ago)
Author:
Snyder.Jason
Message:

added a button to start nodebooter, reworked startup sequence to offer to start the naming service and to inform the user if nodebooter hasnt been started

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/tools/alf/ALF.py

    r10469 r10501  
    5959import shlex 
    6060import subprocess 
     61import ConfigParser 
    6162from ALFNodeBooterUtils import ALFNodeBooterUtils 
     63from ALFNSChoiceDialog import ALFNSChoiceDialog 
     64from ALFNodeBooterDialog import ALFNodeBooterDialog 
    6265 
    6366import wx.lib.foldpanelbar as fpb 
     
    6871[wxID_TOOLBAR_TIMING_TOOL, wxID_TOOLBAR_REFRESH_TOOL, 
    6972wxID_TOOLBAR_TIMING_DISPLAY_TOOL, wxID_TOOLBAR_CONNECT_TOOL, 
    70 wxID_TOOLBAR_NAMINGSERVICE_DIALOG, wxID_TOOLBAR_LAUNCH_WAVEDASH] = [wx.NewId() for x in range(6)] 
     73wxID_TOOLBAR_NAMINGSERVICE_DIALOG, wxID_TOOLBAR_LAUNCH_WAVEDASH, 
     74wxID_TOOLBAR_START_NODEBOOTER] = [wx.NewId() for x in range(7)] 
    7175 
    7276[wxID_NSBOX_POPUP_DISPLAY, wxID_NSBOX_POPUP_START,  
     
    7781 wxID_INSTALLBOX_POPUP_INSTALL, wxID_COMPONENTSBOX_POPUP_INSTALL] = [wx.NewId() for x in range(4)] 
    7882 
     83OSSIE_CONFIG_FILE = '.ossie.cfg' 
    7984#---------------------------------------------------------------------- 
    8085class alfApp(wx.App): 
     
    141146         
    142147        self.Bind(wx.EVT_CLOSE, self.OnClose) 
    143  
     148        self.connections = {'127.0.0.1': []} 
     149        self.namingservice = ['127.0.0.1', ''] 
    144150        self.nodeBooterProcess = None 
    145         nbUtils = ALFNodeBooterUtils() 
    146         if not nbUtils.namingServiceIsRunning(): 
    147             nbUtils.startNamingService() 
    148         if not nbUtils.nodeBooterIsRunning(): 
    149             self.nodeBooterProcess = nbUtils.startNodeBooter() 
     151        self.nbUtils = ALFNodeBooterUtils() 
     152        if not self.nbUtils.namingServiceIsRunning(): 
     153            anscd = ALFNSChoiceDialog(self) 
     154         
    150155 
    151156    def __init__(self,parent): 
     
    166171        self.fileMgr = None 
    167172         
    168         self.connections = {'127.0.0.1': []} 
    169         self.namingservice = ['127.0.0.1', ''] 
     173         
    170174        self.init_CORBA() 
    171175         
     
    410414        toolbar.AddSimpleTool(wxID_TOOLBAR_LAUNCH_WAVEDASH, wavedash_bmp, shortHelpString="Launch Wavedash to configure waveforms") 
    411415 
     416        toolbar.AddSeparator() 
     417        nodeBooter_img = wx.Image(root + '/images/nbstart.png', type = wx.BITMAP_TYPE_PNG) 
     418        nodeBooter_img.Rescale(24, 24) 
     419        nodeBooter_bmp = wx.BitmapFromImage(nodeBooter_img) 
     420        toolbar.AddSimpleTool(wxID_TOOLBAR_START_NODEBOOTER, nodeBooter_bmp, shortHelpString="Start NodeBooter") 
    412421        toolbar.Bind(wx.EVT_TOOL, self.OnToolBarClick) 
    413422         
     
    469478            self.DisplayAvailableComponents() 
    470479            tb.ToggleTool(wxID_TOOLBAR_REFRESH_TOOL, False) 
     480         
     481        elif event.GetId() == wxID_TOOLBAR_START_NODEBOOTER: 
     482            anbd = ALFNodeBooterDialog(self) 
     483             
     484            if anbd.GetReturnCode() == 0: 
     485                self.namingservice[0] = '127.0.0.1' 
     486                self.init_CORBA() 
     487                self.refreshDisplay(True) 
     488                self.DisplayInstalledWaveforms() 
     489                self.DisplayAvailableWaveforms() 
     490                self.DisplayAvailableComponents() 
    471491             
    472492    def processTimingEvent(self, component_name, port_name, function_name, description, time_s, time_us, number_samples): 
     
    11311151                shape.Destroy() 
    11321152        self.diagram.Destroyparent 
     1153         
     1154    def setOSSIEProperty(self, sectionName, propertyName, propertyValue): 
     1155        configFile = os.getenv('HOME') + '/' + OSSIE_CONFIG_FILE 
     1156        configParser = ConfigParser.SafeConfigParser() 
     1157        #check to see if a config file already exists 
     1158        if os.path.exists(configFile): 
     1159            #if so, read in its properties so they don't get lost 
     1160            configParser.read(configFile) 
     1161        if not configParser.has_section(sectionName): 
     1162            configParser.add_section(sectionName) 
     1163        configParser.set(sectionName, propertyName, propertyValue) 
     1164        f = open(configFile, 'w') 
     1165        configParser.write(f) 
     1166        f.close() 
     1167             
     1168    def getOSSIEProperty(self, sectionName, propertyName): 
     1169        configFile = os.getenv('HOME') + '/' + OSSIE_CONFIG_FILE 
     1170        if os.path.exists(configFile): 
     1171            configParser = ConfigParser.SafeConfigParser() 
     1172            configParser.read(configFile) 
     1173            if configParser.has_option(sectionName, propertyName): 
     1174                return configParser.get(sectionName, propertyName) 
     1175        return None 
    11331176#---------------------------------------------------------------------- 
    11341177