Changeset 3696
- Timestamp:
- 05/07/07 13:46:17 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
experimental/write_to_file/trunk/write_to_file/write_to_file.py
r3695 r3696 15 15 #TODO:add comment explainging this class 16 16 17 def __init__(self, parent): 18 self.parent = parent 19 20 def write(self, data, file_name): 17 def __init__(self, orb, gui): 18 self.orb = orb 19 self.gui = gui 20 21 def pushPacket(self, data, file_name): 21 22 #TODO: test this method 22 23 open_file = open(file_name, 'w') #open the file for writing … … 163 164 sys.exit(1) 164 165 name = [CosNaming.NameComponent(self.component_name[0],""), 165 CosNaming.NameComponent(self.component_name[1],""),166 CosNaming.NameComponent(self.component_name[2],"")]166 CosNaming.NameComponent(self.component_name[1],""), 167 CosNaming.NameComponent(self.component_name[2],"")] 167 168 168 169 try: … … 173 174 sys.exit(1) 174 175 175 #connect to an existing port176 176 ResourceHandle = ResourceRef._narrow(CF.Resource) 177 177 PortReference = ResourceHandle.getPort(self.port_name) 178 178 if PortReference is None: 179 179 print "Failed to get Port reference" 180 self.PortHandle = PortReference._narrow( standardInterfaces__POA.complexShort)180 self.PortHandle = PortReference._narrow(CF.Port) 181 181 182 183 #create the class instance of the write_to_file class 184 self.my_file_writer = write_to_file(self.orb, self) 185 186 obj_poa = self.orb.resolve_initial_references("RootPOA") 187 poaManager = obj_poa._get_the_POAManager() 188 poaManager.activate() 189 obj_poa.activate_object(self.my_file_writer) 190 self.PortHandle.connectPort(self.my_file_writer._this(), "thisismyconnectionid_w2file") 191 #orb.run() 192 182 193 def OnCloseWindow(self,event): 183 194 if hasattr(self.parent, 'removeToolFrame'): … … 186 197 event.Skip() 187 198 188 189 190 199 def __del__(self): 200 if self.CORBA_being_used: 201 self.PortHandle.disconnectPort("thisismyconnectionid_plot") 202 while (_time.time() - self.my_local_plot.end_time) < 1.5: 203 #print (time.time() - self.my_local_plot.end_time) 204 pass 205 #_time.sleep(1) 206 207 208