Exemplo n.º 1
0
    def getAvailableConnections(self):
        ''' Get a list of objects I can potentially connect to'''

        # Initialize my dictionary 
        self.avail_connects = {}

        dom_obj = self.alfFrameRef.rootContext.resolve(
                           [CosNaming.NameComponent("DomainName1","")])
        dom_context = dom_obj._narrow(CosNaming.NamingContext) 
        if dom_context is None:
            return

        # get a list of applications running in the domain
        appSeq =  self.alfFrameRef.domMgr._get_applications()
        apps = {}
        for app in appSeq:
            sadfile = app._get_profile()
            sadfile = sadfile.replace('//','')
            # NOTE:  Use CF::FileManager to obtain location

            waveform = importWaveform.getWaveform(sadfile, self.alfFrameRef, self.alfFrameRef.Available_Ints)
            for comp in waveform.components:
                for port in comp.ports:
                    if apps.has_key(waveform.name):
                        if apps[waveform.name].has_key(comp.name):
                            apps[waveform.name][comp.name][port.name] = port.type
                        else:
                            apps[waveform.name][comp.name] = {port.name: port.type}
                    else:
                        apps[waveform.name] = {comp.name: {port.name: port.type}}

        p = re.compile("^(OSSIE::.+)_\d+$")
        members = dom_context.list(1000)
        for m in members[0]:
            wav_name = str(m.binding_name[0].id)

            wav_obj = dom_context.resolve(
                                [CosNaming.NameComponent(wav_name,"")])
            wav_context = wav_obj._narrow(CosNaming.NamingContext)
            if wav_context is None:
                continue

            m = p.match(wav_name)
            if m:
                if apps[m.group(1)]:
                    self.avail_connects[wav_name] = apps[m.group(1)]
                else:
                    print "Could not find associated application for: " + wav_name
                    continue
Exemplo n.º 2
0
    def DisplayWaveform(self):
        sn = self.nsBox.GetSelection()
        if sn == self.nsBox.GetRootItem():
            errorMsg(self,'Please select a waveform!')
            return
        snPrnt = self.nsBox.GetItemParent(sn)
        if snPrnt != self.nsBox.GetRootItem():
            errorMsg(self,'Please select a waveform!')
            return

        wave_name = self.nsBox.GetItemText(sn)
        app = self.nsBox.GetPyData(sn)
        if app is None:
            errorMsg(self,'No application associated with this entry!')
            return
            
        # Check to see if a waveform is already active
        if self.active_wave != None:
            self.refreshDisplay(True)

        # Set item bold and all others set to plain text
        troot = self.nsBox.GetRootItem()
        if self.nsBox.GetChildrenCount(troot) <= 0:
            return
        cid1,cookie1 = self.nsBox.GetFirstChild(troot)
        self.nsBox.SetItemBold(cid1, False)
        for x in range(self.nsBox.GetChildrenCount(troot,recursively=False)-1):
            cid2,cookie2 = self.nsBox.GetNextChild(troot,cookie1)
            self.nsBox.SetItemBold(cid2, False)
            cid1 = cid2
            cookie1 = cookie2

        self.nsBox.SetItemBold(sn, True)
        self.nsBox.SelectItem(sn, False)

        # Check to see if this waveform has previously been displayed
        # If so, then update the display and return
        if self.waveform_displays.has_key(wave_name):
            # Clear the canvas and get ready to display the waveform
            #print "already imported this waveform .... displaying..."
            tmpdisplay = self.waveform_displays[wave_name]
#            self.refreshDisplay(True)
            self.active_wave = tmpdisplay.waveform
            self.canvas.updateDisplay(tmpdisplay)
            return

# NOTE: use CF::FileManager list to find SAD file
#sadfile wud resemble like "/waveforms/ossie_demo/ossie_demo.sad.xml
        sadfile = app._get_profile()
        sadfile = sadfile.replace('//','')
        wav_name = sadfile.replace('.sad.xml','')
# No need to prepend /sdr/dom to sad file. CF:FileManager takes the relative path.
        #sadpath = '/sdr/dom/' + sadfile
        sadpath = sadfile

        self.active_wave = importWaveform.getWaveform(sadpath, self, self.Available_Ints)
        self.active_wave.naming_context = str(wave_name)

        tmpdisplay = self.AddWaveformShape(self.active_wave)
        self.waveform_displays[wave_name] = tmpdisplay 

        self.canvas.updateDisplay(tmpdisplay)