def OnImportBtnButton(self, event): dlg = wx.FileDialog(self, "Choose an idl file to import", "/home", "", "*.idl", wx.OPEN) tmpPath = '' try: returnCode = dlg.ShowModal() if returnCode == wx.ID_OK: tmpPath = dlg.GetPath() elif returnCode == wx.ID_CANCEL: dlg.Destroy() return finally: dlg.Destroy() print dlg.GetMessage() newInts = importIDL.getInterfaces(tmpPath) tmpMsg = 'You will need to copy <' + tmpPath[(tmpPath.rfind('/') + 1):] tmpMsg += '> to /usr/local/include/standardinterfaces in order to ' tmpMsg += 'use the generated code.' dlg = wx.MessageDialog(self, tmpMsg, 'Note', wx.OK | wx.CANCEL | wx.ICON_INFORMATION) try: returnCode = dlg.ShowModal() if returnCode == wx.ID_CANCEL: dlg.Destroy() return finally: dlg.Destroy() self.Available_Ints.extend(newInts) self.display_ints() event.Skip()
def OnImportBtnButton(self, event): dlg = wx.FileDialog(self, "Choose an idl file to import", "/home", "", "*.idl", wx.OPEN) tmpPath = '' try: returnCode = dlg.ShowModal() if returnCode == wx.ID_OK: tmpPath = dlg.GetPath() elif returnCode == wx.ID_CANCEL: dlg.Destroy() return finally: dlg.Destroy() print dlg.GetMessage() newInts = importIDL.getInterfaces(tmpPath) tmpMsg = 'You will need to copy <' + tmpPath[(tmpPath.rfind('/')+1):] tmpMsg += '> to /usr/local/include/standardinterfaces in order to ' tmpMsg += 'use the generated code.' dlg = wx.MessageDialog(self, tmpMsg, 'Note', wx.OK | wx.CANCEL | wx.ICON_INFORMATION) try: returnCode = dlg.ShowModal() if returnCode == wx.ID_CANCEL: dlg.Destroy() return finally: dlg.Destroy() self.Available_Ints.extend(newInts) self.display_ints() event.Skip()
def importStandardIdl(parent): #if os.path.isfile(self.parent.ossieIncludePath + "cf.idl"): # cfIdl_file = self.parent.ossieIncludePath + "cf.idl" if os.path.isfile("/usr/local/include/ossie/" + "cf.idl"): cfIdl_file = "/usr/local/include/ossie/" + "cf.idl" else: tmpstr = "Cannot find cf.idl in the OSSIE installation location:\n" tmpstr += parent.ossieIncludePath errorMsg(parent,tmpstr) # for each file in the standardinterfaces directory, import all available # interfaces (skip standardIdl files) stdIdlPath = "/usr/local/include/standardinterfaces/" idlList = os.listdir(stdIdlPath) if len(idlList) <= 0: tmpstr = "Can't find any files in: " + parent.stdIdlPath errorMsg(parent,tmpstr) return # Add the CF interfaces first - in case another file includes them, we # don't want them asscociated with anything other than cf.idl Available_Ints = [] Available_Ints.extend(importIDL.getInterfaces(cfIdl_file)) for idl_file in idlList: # standardIdl files are not included because they are aggregates of the other interfaces if 'standardIdl' in idl_file: continue if 'customInterfaces' in idl_file: continue if idl_file[-3:] != "idl": continue tempInts = importIDL.getInterfaces(stdIdlPath+idl_file) for t in tempInts: if t not in Available_Ints: # print "Testing: " + t.name + " " + idl_file + " " + str(len(self.Available_Ints)) Available_Ints.append(t) #if t.name == 'timingStatus': # self.timing_interface = CC.Interface(t.name, t.nameSpace, t.operations, t.filename, t.fullpath) #self.timing_port = CC.Port('send_timing_report', self.timing_interface, "Uses", "data") # print "CF.py: " + t.name + " " + str(len(t.operations)) return Available_Ints
def importStandardIdl(parent): #if os.path.isfile(self.parent.ossieIncludePath + "cf.idl"): # cfIdl_file = self.parent.ossieIncludePath + "cf.idl" if os.path.isfile("/usr/local/include/ossie/" + "cf.idl"): cfIdl_file = "/usr/local/include/ossie/" + "cf.idl" else: tmpstr = "Cannot find cf.idl in the OSSIE installation location:\n" tmpstr += parent.ossieIncludePath errorMsg(parent, tmpstr) # for each file in the standardinterfaces directory, import all available # interfaces (skip standardIdl files) stdIdlPath = "/usr/local/include/standardinterfaces/" idlList = os.listdir(stdIdlPath) if len(idlList) <= 0: tmpstr = "Can't find any files in: " + parent.stdIdlPath errorMsg(parent, tmpstr) return # Add the CF interfaces first - in case another file includes them, we # don't want them asscociated with anything other than cf.idl Available_Ints = [] Available_Ints.extend(importIDL.getInterfaces(cfIdl_file)) for idl_file in idlList: # standardIdl files are not included because they are aggregates of the other interfaces if 'standardIdl' in idl_file: continue if 'customInterfaces' in idl_file: continue if idl_file[-3:] != "idl": continue tempInts = importIDL.getInterfaces(stdIdlPath + idl_file) for t in tempInts: if t not in Available_Ints: # print "Testing: " + t.name + " " + idl_file + " " + str(len(self.Available_Ints)) Available_Ints.append(t) #if t.name == 'timingStatus': # self.timing_interface = CC.Interface(t.name, t.nameSpace, t.operations, t.filename, t.fullpath) #self.timing_port = CC.Port('send_timing_report', self.timing_interface, "Uses", "data") # print "CF.py: " + t.name + " " + str(len(t.operations)) return Available_Ints
def importStandardIdl(self): '''Imports IDL from cf, standardinterfaces, and custominterfaces''' #temporarily change self.parent to self so this works #normally this function looks at the MainFrame - but not in standalone changedParent = False if self.parent == None: self.parent = self changedParent = True if os.path.isfile(self.parent.ossieIncludePath + "cf.idl"): cfIdl_file = self.parent.ossieIncludePath + "cf.idl" else: tmpstr = "Cannot find cf.idl in the OSSIE installation location:\n" tmpstr += self.parent.ossieIncludePath errorMsg(self.parent,tmpstr) # for each file in the standardinterfaces directory, import all available # interfaces (skip standardIdl files) standard_idl_list = os.listdir(self.parent.stdIdlPath) try: custom_idl_list = os.listdir(self.parent.customIdlPath) except OSError: # this will occur if customIdlPath was never set # as a result of customInterfaces not being found custom_idl_list = [] if len(standard_idl_list) <= 0: tmpstr = "Can't find any files in: " + self.parent.stdIdlPath errorMsg(self.parent,tmpstr) return # Add the CF interfaces first - in case another file includes them, we # don't want them asscociated with anything other than cf.idl self.Available_Ints.extend(importIDL.getInterfaces(cfIdl_file)) # import standard interfaces for standard_idl_file in standard_idl_list: # standardIdl files are not included because they are aggregates of the other interfaces if 'standardIdl' in standard_idl_file: continue if string.lower(os.path.splitext(standard_idl_file)[1]) != ".idl": # ignore non idl files continue tempInts = importIDL.getInterfaces(self.parent.stdIdlPath+standard_idl_file) for t in tempInts: if t not in self.Available_Ints: self.Available_Ints.append(t) # import custom interfaces for custom_idl_file in custom_idl_list: # ignore aggregate 'customInterfaces.idl' file if 'customInterfaces' in custom_idl_file: continue if string.lower(os.path.splitext(custom_idl_file)[1]) != ".idl": # ignore non idl files continue tempInts = importIDL.getInterfaces(self.parent.customIdlPath+custom_idl_file) for t in tempInts: if t not in self.Available_Ints: # print "Testing: " + t.name + " " + idl_file + " " + str(len(self.Available_Ints)) self.Available_Ints.append(t) if t.name == 'timingStatus': self.timing_interface = CC.Interface(t.name, t.nameSpace, t.operations, t.filename, t.fullpath) self.timing_port = CC.Port('send_timing_report', self.timing_interface, "Uses", "data") # print "CF.py: " + t.name + " " + str(len(t.operations)) if changedParent == True: self.parent = None
def importStandardIdl(self): '''Imports IDL from cf, standardinterfaces, and custominterfaces''' #temporarily change self.parent to self so this works #normally this function looks at the MainFrame - but not in standalone changedParent = False if self.parent == None: self.parent = self changedParent = True if os.path.isfile(self.parent.ossieIncludePath + "cf.idl"): cfIdl_file = self.parent.ossieIncludePath + "cf.idl" else: tmpstr = "Cannot find cf.idl in the OSSIE installation location:\n" tmpstr += self.parent.ossieIncludePath errorMsg(self.parent, tmpstr) # for each file in the standardinterfaces directory, import all available # interfaces (skip standardIdl files) standard_idl_list = os.listdir(self.parent.stdIdlPath) try: custom_idl_list = os.listdir(self.parent.customIdlPath) except OSError: # this will occur if customIdlPath was never set # as a result of customInterfaces not being found custom_idl_list = [] if len(standard_idl_list) <= 0: tmpstr = "Can't find any files in: " + self.parent.stdIdlPath errorMsg(self.parent, tmpstr) return # Add the CF interfaces first - in case another file includes them, we # don't want them asscociated with anything other than cf.idl self.Available_Ints.extend(importIDL.getInterfaces(cfIdl_file)) # import standard interfaces for standard_idl_file in standard_idl_list: # standardIdl files are not included because they are aggregates of the other interfaces if 'standardIdl' in standard_idl_file: continue if string.lower(os.path.splitext(standard_idl_file)[1]) != ".idl": # ignore non idl files continue tempInts = importIDL.getInterfaces(self.parent.stdIdlPath + standard_idl_file) for t in tempInts: if t not in self.Available_Ints: self.Available_Ints.append(t) # import custom interfaces for custom_idl_file in custom_idl_list: # ignore aggregate 'customInterfaces.idl' file if 'customInterfaces' in custom_idl_file: continue if string.lower(os.path.splitext(custom_idl_file)[1]) != ".idl": # ignore non idl files continue tempInts = importIDL.getInterfaces(self.parent.customIdlPath + custom_idl_file) for t in tempInts: if t not in self.Available_Ints: # print "Testing: " + t.name + " " + idl_file + " " + str(len(self.Available_Ints)) self.Available_Ints.append(t) if t.name == 'timingStatus': self.timing_interface = CC.Interface( t.name, t.nameSpace, t.operations, t.filename, t.fullpath) self.timing_port = CC.Port('send_timing_report', self.timing_interface, "Uses", "data") # print "CF.py: " + t.name + " " + str(len(t.operations)) if changedParent == True: self.parent = None