示例#1
0
 def installWaveform(self, wformName, start):
     wform = self.model.getWaveform(wformName, WaveformModel.SYSTEM_WAVEFORM)
     if wform is None:
         utils.showMessage("Unable to install " + wformName, utils.FATAL, self.enableGUI)
         return False
     else:
         instance = self.CORBAutils.installWaveform(wform.sadFile, wform.dasFile, start)
         if instance is not None:
             instanceName = instance[instance.find("::") + 2 :]
             self.model.addInstanceWaveform(wformName, instanceName, start)
             return instanceName
         else:
             utils.showMessage("Unable to find applications", utils.NON_FATAL, self.enableGUI)
             return False
示例#2
0
    def getFileList(self, dir, filetype, quiet=False):
        fileList = []

        fileList = self.CORBAutils.getFileList(dir, filetype)

        # If no file found?
        if fileList == None:
            if not quiet:  # Ignore the error for _tmp_alf_waveforms.
                utils.showMessage(
                    "Could not find " + filetype + " files in this directory:\n " + dir, utils.FATAL, self.enableGUI
                )
            return None

        return fileList
示例#3
0
    def getFileList(self, dir, filetype, quiet=False):
        fileList = []

        fileList = self.CORBAutils.getFileList(dir, filetype)

        #If no file found?
        if fileList == None:
            if not quiet:  #Ignore the error for _tmp_alf_waveforms.
                utils.showMessage(
                    "Could not find " + filetype +
                    " files in this directory:\n " + dir, utils.FATAL,
                    self.enableGUI)
            return None

        return fileList
示例#4
0
 def installWaveform(self, wformName, start):
     wform = self.model.getWaveform(wformName,
                                    WaveformModel.SYSTEM_WAVEFORM)
     if wform is None:
         utils.showMessage("Unable to install " + wformName, utils.FATAL,
                           self.enableGUI)
         return False
     else:
         instance = self.CORBAutils.installWaveform(wform.sadFile,
                                                    wform.dasFile, start)
         if instance is not None:
             instanceName = instance[instance.find("::") + 2:]
             self.model.addInstanceWaveform(wformName, instanceName, start)
             return instanceName
         else:
             utils.showMessage("Unable to find applications",
                               utils.NON_FATAL, self.enableGUI)
             return False
示例#5
0
    def addInstanceWaveform(self, wform, instance, isRunning=False):

        #newWaveform = copy.deepcopy(self.getWaveform(wform, WaveformModel.SYSTEM_WAVEFORM))
        parent = self.getWaveform(wform, WaveformModel.SYSTEM_WAVEFORM)
        if parent is None:
            errMsg = "Unable to add new application, " + instance + ". \nWaveform  " + wform + "."
            errMsg = errMsg + "\nPlease check /sdr/waveforms or /sdr/_tmp_alf_waveforms directory for valid waveforms"
            #errMsg = errMsg + "Warning! This version of Wavedash do not support component as waveform applications "
            utils.showMessage(errMsg, utils.NON_FATAL)
            return
        newWaveform = Waveform(parent.id, instance, parent.sadFile,
                               parent.dasFile, WaveformModel.INSTANCE_WAVEFORM,
                               self.controller, isRunning)
        #newWaveform.type = WaveformModel.INSTANCE_WAVEFORM
        #newWaveform.name = instance
        if (self.instanceWaveforms.has_key(parent)):
            self.instanceWaveforms[parent].append(newWaveform)
        else:
            self.instanceWaveforms[parent] = [newWaveform]

        wEvent = WaveformEvent(WAVEFORM_INSTANCE_ADDED)
        wEvent.waveform = newWaveform
        self.fireModelChange(wEvent)
示例#6
0
    def buildWaveforms(self, waveformSADList, waveformDASList):
        """ This method gets a list of sad files of waveforms passed from the 
        controller and builds the model of every Waveform.  
        """

        #self.systemWaveforms = []
        #self.instanceWaveforms = {}
        #self.activeWaveform = None
        wformsToBeRemoved = []

        for fIndex in range(len(waveformSADList)):
            sadFile = waveformSADList[fIndex]
            dasFile = waveformDASList[fIndex]
            # print "sadFile = ", sadFile
            wavedom = self.controller.getDOM(sadFile)
            #if error in getting the DOM?
            if (wavedom is None):
                print "Error! buildWaveforms(): Could not build DOM for ", sadFile
                continue
            swassemblyNode = wavedom.getElementsByTagName(
                'softwareassembly')[0]
            wname = swassemblyNode.attributes['name'].value

            #stripping off 'OSSIE::' from waveform names
            wname = wname[wname.find('::') + 2:]
            wid = swassemblyNode.attributes['id'].value
            existingWform = self.getWaveform(wname,
                                             WaveformModel.SYSTEM_WAVEFORM)
            #Build a new waveform only if there is no other waveoform exists in the same name
            #This block prevents the duplicate waveform entries while doing Refresh
            if (existingWform is None):

                #create a new waveform and add it to systemWaveforms list
                #since this method builds only system waveform, it always pass the
                #state parameter of Waveform as SYSTEM_WAVEFORM

                newWaveform = Waveform(wid, wname, sadFile, dasFile,
                                       WaveformModel.SYSTEM_WAVEFORM,
                                       self.controller)
                #if(newWaveform.name == "w1"):
                #   print "after waveform building"
                #  for comp in newWaveform.components:
                #     for prop in comp.properties:
                #        print str(prop.id) + ": "  + str(prop.getValue())
                self.systemWaveforms.append(newWaveform)
                wEvent = WaveformEvent(SYSTEM_WAVEFORM_ADDED)
                wEvent.waveform = newWaveform

                self.fireModelChange(wEvent)
            #Check if sadFile of the current waveform and existing waveform matches or not.
            #If it matches, no need to create the waveform. else, there report to user that
            #there is name conflict
            else:
                if (sadFile == existingWform.sadFile
                        and dasFile == existingWform.dasFile):
                    continue
                else:
                    errormsg = "Conflicting names for waveform - " + wname
                    errormsg = errormsg + "\nCheck the sad files - " + sadFile
                    errormsg = errormsg + "\n" + existingWform.sadFile
                    utils.showMessage(errormsg, utils.NON_FATAL)
                    continue

        #When this method is called from Refresh, we need to remove the waveforms from the systemWaveforms dict
        #that are not present in the given sadFile and DASFile list.
        wformFound = False
        for sysWform in self.systemWaveforms:
            wformFound = False
            for curSADFile in waveformSADList:
                if curSADFile == sysWform.sadFile:
                    #wform match found
                    wformFound = True

            #if no match found? then remove the wform from system waveforms list.
            #since we are iterating on self.systemWaveforms, we cannot remvoe items
            #from the same list now. collect the lsit of waveforms to be removed and
            #remove them from hte list once for all.
            if wformFound is False:
                wformsToBeRemoved.append(sysWform)

        for wform in wformsToBeRemoved:
            print "removing waveform ", wform.getName()
            self.systemWaveforms.remove(wform)
            wEvent = WaveformEvent(SYSTEM_WAVEFORM_REMOVED)
            wEvent.waveform = wform
            self.fireModelChange(wEvent)